/*
- * Copyright (C) 2015 Roland Haeder
+ * Copyright (C) 2016 - 2022 Free Software Foundation
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
import java.text.MessageFormat;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import org.mxchange.addressbook.BaseAddressbookSystem;
/**
* A general menu class
- *
- * @author Roland Haeder
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
*/
-public abstract class BaseMenu extends BaseAddressbookSystem {
+public abstract class BaseMenu extends BaseAddressbookSystem implements Menu {
/**
* Menu list
protected BaseMenu () {
}
- /**
- * Size of menu items
- * <p>
- * @return Count of menu items
- */
+ @Override
public int getMenuItemsCount () {
return this.menuList.size();
}
- /**
- * "Getter" for an iterator of this menu's items
- * <p>
- * @return An iterator of all menu items
- */
+ @Override
public Iterator<SelectableMenuItem> getMenuItemsIterator () {
return this.menuList.iterator();
}
- /**
- * Shows this menu
- * <p>
- * @param client Client instance to call back
- */
+ @Override
public void show (final Client client) {
// Trace message
- this.getLogger().logTrace(MessageFormat.format("client={0} CALLED!", client)); //NOI18N
+ this.getLoggerBeanLocal().logTrace(MessageFormat.format("client={0} CALLED!", client)); //NOI18N
// Client must not be null
if (null == client) {
Iterator<SelectableMenuItem> iterator = this.menuList.iterator();
// Debug message
- this.getLogger().logDebug("Showing menu with '" + this.menuList.size() + "' entries.");
+ this.getLoggerBeanLocal().logDebug("Showing menu with '" + this.menuList.size() + "' entries.");
// Output all menus
while (iterator.hasNext()) {
}
// Trace message
- this.getLogger().logTrace("EXIT!"); //NOI18N
+ this.getLoggerBeanLocal().logTrace("EXIT!"); //NOI18N
}
/**
* <p>
* @return menuList List of menu entries
*/
- protected final List<SelectableMenuItem> getMenuList () {
- return this.menuList;
+ protected List<SelectableMenuItem> getMenuList () {
+ return Collections.unmodifiableList(this.menuList);
}
/**
*/
protected void initMenu (final String menuType, final Client client) {
// Trace message
- this.getLogger().logTrace(MessageFormat.format("menuType={0},client={1} - CALLED!", menuType, client)); //NOI18N
+ this.getLoggerBeanLocal().logTrace(MessageFormat.format("menuType={0},client={1} - CALLED!", menuType, client)); //NOI18N
// Init menu list
this.menuList = new ArrayList<>(5);
// Trace message
- this.getLogger().logTrace("EXIT!"); //NOI18N
+ this.getLoggerBeanLocal().logTrace("EXIT!"); //NOI18N
}
}