X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2Forg%2Fmxchange%2Faddressbook%2Fmenu%2FBaseMenu.java;h=e365652ab5755c51a06c46b401c2b2cf8fed2451;hb=015fbc4cc69c0bdbb644da6bab24133290e9ca68;hp=019c8e03b4778fdd8395100a7828f2bd27d672ef;hpb=8f39e6c8e605ac61f32e40e65418821bf2949e5a;p=addressbook-swing.git diff --git a/src/org/mxchange/addressbook/menu/BaseMenu.java b/src/org/mxchange/addressbook/menu/BaseMenu.java index 019c8e0..e365652 100644 --- a/src/org/mxchange/addressbook/menu/BaseMenu.java +++ b/src/org/mxchange/addressbook/menu/BaseMenu.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2015 Roland Haeder + * Copyright (C) 2016 Roland Haeder * * 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 @@ -18,6 +18,7 @@ package org.mxchange.addressbook.menu; 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; @@ -26,10 +27,10 @@ import org.mxchange.jcore.client.Client; /** * A general menu class - * + *

* @author Roland Haeder */ -public abstract class BaseMenu extends BaseAddressbookSystem { +public abstract class BaseMenu extends BaseAddressbookSystem implements Menu { /** * Menu list @@ -42,32 +43,20 @@ public abstract class BaseMenu extends BaseAddressbookSystem { protected BaseMenu () { } - /** - * Size of menu items - *

- * @return Count of menu items - */ + @Override public int getMenuItemsCount () { return this.menuList.size(); } - /** - * "Getter" for an iterator of this menu's items - *

- * @return An iterator of all menu items - */ + @Override public Iterator getMenuItemsIterator () { return this.menuList.iterator(); } - /** - * Shows this menu - *

- * @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) { @@ -79,7 +68,7 @@ public abstract class BaseMenu extends BaseAddressbookSystem { Iterator 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()) { @@ -91,7 +80,7 @@ public abstract class BaseMenu extends BaseAddressbookSystem { } // Trace message - this.getLogger().logTrace("EXIT!"); //NOI18N + this.getLoggerBeanLocal().logTrace("EXIT!"); //NOI18N } /** @@ -99,8 +88,8 @@ public abstract class BaseMenu extends BaseAddressbookSystem { *

* @return menuList List of menu entries */ - protected final List getMenuList () { - return this.menuList; + protected List getMenuList () { + return Collections.unmodifiableList(this.menuList); } /** @@ -111,12 +100,12 @@ public abstract class BaseMenu extends BaseAddressbookSystem { */ 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 } }