X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=sidebyside;f=src%2Forg%2Fmxchange%2Faddressbook%2Fmenu%2FMenuTools.java;h=ee03267c4299383778f9cd6cb8d29611ae3d9b5e;hb=78cb72fdfed1c1e8675476db81cefdab0f577838;hp=75bfb7ed58a5e139327fcf2dd967d7114cf87bc2;hpb=31fce847a127086ff40fa9b4edde6137a8ef7e3f;p=jaddressbook-lib.git
diff --git a/src/org/mxchange/addressbook/menu/MenuTools.java b/src/org/mxchange/addressbook/menu/MenuTools.java
index 75bfb7ed..ee03267c 100644
--- a/src/org/mxchange/addressbook/menu/MenuTools.java
+++ b/src/org/mxchange/addressbook/menu/MenuTools.java
@@ -1,78 +1,78 @@
-/*
- * 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 .
- */
-package org.mxchange.addressbook.menu;
-
-import java.util.Iterator;
-import java.util.Map;
-import org.apache.logging.log4j.Logger;
-import org.mxchange.addressbook.BaseFrameworkSystem;
-import org.mxchange.addressbook.menu.item.SelectableMenuItem;
-
-/**
- *
- * @author Roland Haeder
- */
-public class MenuTools extends BaseFrameworkSystem {
-
- /**
- * Gets an array with all available access keys back from given menu map.
- * This can later be handle to the client's enterChar() method.
- *
- * @param menus A Map with all menus and their entries
- * @param menuType Menu type
- * @return An array with available access chars
- */
- public static char[] getAccessKeysFromMenuMap (final Map menus, final String menuType) {
- // Get logger
- Logger logger = new MenuTools().getLogger();
-
- // First search for the proper menu class
- Menu menu = menus.get(menuType);
-
- // Is it there?
- if (!(menu instanceof Menu)) {
- // Not found
- // @todo Rewrite to exception
- logger.error("Menu '" + menuType + "' not found.");
- System.exit(1);
- }
-
- // Get iterator
- Iterator 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.debug("item=" + item);
-
- // Get access key from item and add it to the array
- accessKeys[i] = item.getAccessKey();
- //* NOISY-DEBUG: */ logger.debug("accessKeys[" + i + "]=" + accessKeys[i]);
-
- // Increment counter
- i++;
- }
-
- // Return finished array
- return accessKeys;
- }
-}
+/*
+ * 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 .
+ */
+package org.mxchange.addressbook.menu;
+
+import java.util.Iterator;
+import java.util.Map;
+import org.apache.logging.log4j.Logger;
+import org.mxchange.addressbook.menu.item.SelectableMenuItem;
+import org.mxchange.jcore.BaseFrameworkSystem;
+
+/**
+ *
+ * @author Roland Haeder
+ */
+public class MenuTools extends BaseFrameworkSystem {
+
+ /**
+ * Gets an array with all available access keys back from given menu map.
+ * This can later be handle to the client's enterChar() method.
+ *
+ * @param menus A Map with all menus and their entries
+ * @param menuType Menu type
+ * @return An array with available access chars
+ */
+ public static char[] getAccessKeysFromMenuMap (final Map menus, final String menuType) {
+ // Get logger
+ Logger logger = new MenuTools().getLogger();
+
+ // First search for the proper menu class
+ Menu menu = menus.get(menuType);
+
+ // Is it there?
+ if (!(menu instanceof Menu)) {
+ // Not found
+ // TODO Rewrite to exception
+ logger.error("Menu '" + menuType + "' not found.");
+ System.exit(1);
+ }
+
+ // Get iterator
+ Iterator 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.debug("item=" + item);
+
+ // Get access key from item and add it to the array
+ accessKeys[i] = item.getAccessKey();
+ //* NOISY-DEBUG: */ logger.debug("accessKeys[" + i + "]=" + accessKeys[i]);
+
+ // Increment counter
+ i++;
+ }
+
+ // Return finished array
+ return accessKeys;
+ }
+}