]> git.mxchange.org Git - addressbook-swing.git/blobdiff - src/org/mxchange/addressbook/menu/BaseMenu.java
Updated copyright year
[addressbook-swing.git] / src / org / mxchange / addressbook / menu / BaseMenu.java
index ad8c2e593884b7f4313b83f9cc686cbed5aacbcb..bbd7414863a229f049af6dd89b5be93f9dda6f34 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * 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
@@ -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;
@@ -25,10 +26,11 @@ import org.mxchange.addressbook.menu.item.SelectableMenuItem;
 import org.mxchange.jcore.client.Client;
 
 /**
- *
- * @author Roland Haeder
+ * A general menu class
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
  */
-public class BaseMenu extends BaseAddressbookSystem {
+public abstract class BaseMenu extends BaseAddressbookSystem implements Menu {
 
        /**
         * Menu list
@@ -41,32 +43,20 @@ public class BaseMenu extends BaseAddressbookSystem {
        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) {
@@ -78,7 +68,7 @@ public class BaseMenu extends BaseAddressbookSystem {
                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()) {
@@ -90,7 +80,7 @@ public class BaseMenu extends BaseAddressbookSystem {
                }
 
                // Trace message
-               this.getLogger().logTrace("EXIT!"); //NOI18N
+               this.getLoggerBeanLocal().logTrace("EXIT!"); //NOI18N
        }
 
        /**
@@ -98,8 +88,8 @@ public class BaseMenu extends BaseAddressbookSystem {
         * <p>
         * @return      menuList List of menu entries
         */
-       protected final List<SelectableMenuItem> getMenuList () {
-               return this.menuList;
+       protected List<SelectableMenuItem> getMenuList () {
+               return Collections.unmodifiableList(this.menuList);
        }
 
        /**
@@ -110,12 +100,12 @@ public 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
        }
 }