2 * Copyright (C) 2015 Roland Haeder
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 package org.mxchange.addressbook.menu;
19 import java.util.ArrayList;
20 import java.util.Iterator;
21 import java.util.List;
22 import org.mxchange.addressbook.BaseFrameworkSystem;
23 import org.mxchange.addressbook.client.Client;
24 import org.mxchange.addressbook.menu.item.SelectableMenuItem;
28 * @author Roland Haeder
30 public class BaseMenu extends BaseFrameworkSystem {
35 private List<SelectableMenuItem> menuList;
38 * No instance from this object
40 protected BaseMenu () {
47 * @return Count of menu items
49 public int getMenuItemsCount () {
50 return this.menuList.size();
54 * "Getter" for an iterator of this menu's items
56 * @return An iterator of all menu items
58 public Iterator<SelectableMenuItem> getMenuItemsIterator () {
59 return this.menuList.iterator();
65 * @param client Client instance to call back
67 public void show (final Client client) {
69 Iterator<SelectableMenuItem> iterator = this.menuList.iterator();
72 this.getLogger().debug("Showing menu with '" + this.menuList.size() + "' entries.");
75 while (iterator.hasNext()) {
77 SelectableMenuItem item = iterator.next();
85 * Getter for menu list
87 * @return menuList List of menu entries
89 protected final List<SelectableMenuItem> getMenuList () {
96 * @param menuType Menu type to initialize
97 * @param client CLient to call back
99 protected void initMenu (final String menuType, final Client client) {
101 this.menuList = new ArrayList<>(5);