]> git.mxchange.org Git - addressbook-lib.git/blobdiff - src/org/mxchange/addressbook/menu/MenuTools.java
This lib should only contain remote EJB interfaces for the addressbook application...
[addressbook-lib.git] / src / org / mxchange / addressbook / menu / MenuTools.java
diff --git a/src/org/mxchange/addressbook/menu/MenuTools.java b/src/org/mxchange/addressbook/menu/MenuTools.java
deleted file mode 100644 (file)
index 87f8c11..0000000
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Copyright (C) 2015 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
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-package org.mxchange.addressbook.menu;
-
-import java.util.Iterator;
-import java.util.Map;
-import org.mxchange.addressbook.BaseAddressbookSystem;
-import org.mxchange.addressbook.menu.item.SelectableMenuItem;
-import org.mxchange.jcore.exceptions.MenuInitializationException;
-
-/**
- * Menu utilities
- * <p>
- * @author Roland Haeder
- */
-public class MenuTools extends BaseAddressbookSystem {
-
-       /**
-        * Gets an array with all available access keys back from given menu map.
-        * This can later be handle to the client's enterChar() method.
-        * <p>
-        * @param menus A Map with all menus and their entries
-        * @param menuType Menu type
-        * @return An array with available access chars
-        * @throws org.mxchange.jcore.exceptions.MenuInitializationException If the menu cannot be initialized
-        */
-       public static char[] getAccessKeysFromMenuMap (final Map<String, Menu> menus, final String menuType) throws MenuInitializationException {
-               // First search for the proper menu class
-               Menu menu = menus.get(menuType);
-
-               // Is it there?
-               if (!(menu instanceof Menu)) {
-                       // Not found
-                       throw new MenuInitializationException(menu, menuType);
-               }
-
-               // Get iterator
-               Iterator<SelectableMenuItem> iterator = menu.getMenuItemsIterator();
-
-               // Init return array and counter 'i'
-               char[] accessKeys = new char[menu.getMenuItemsCount()];
-               int i = 0;
-
-               // Now "walk" through all menu entries
-               while (iterator.hasNext()) {
-                       // Get item
-                       SelectableMenuItem item = iterator.next();
-                       //* NOISY-DEBUG: */ logger.logDebug("item=" + item);
-
-                       // Get access key from item and add it to the array
-                       accessKeys[i] = item.getAccessKey();
-                       //* NOISY-DEBUG: */ logger.logDebug("accessKeys[" + i + "]=" + accessKeys[i]);
-
-                       // Increment counter
-                       i++;
-               }
-
-               // Return finished array
-               return accessKeys;
-       }
-}