2 * Copyright (c) 2010-2021 Contributors to the openHAB project
4 * See the NOTICE file(s) distributed with this work for additional
7 * This program and the accompanying materials are made available under the
8 * terms of the Eclipse Public License 2.0 which is available at
9 * http://www.eclipse.org/legal/epl-2.0
11 * SPDX-License-Identifier: EPL-2.0
13 package org.openhab.binding.yamahareceiver.internal.state;
15 import org.apache.commons.lang.StringUtils;
16 import org.openhab.binding.yamahareceiver.internal.protocol.xml.InputWithNavigationControlXML;
19 * The current state of the navigation
21 * @author David Graeff - Initial contribution
23 public class NavigationControlState implements Invalidateable {
24 public String menuName = null;
25 public int menuLayer = -1;
26 public int currentLine = 0;
27 public int maxLine = -1;
28 public String items[] = new String[InputWithNavigationControlXML.MAX_PER_PAGE];
30 public String getCurrentItemName() {
31 if (currentLine < 1 || currentLine > items.length) {
34 return items[currentLine - 1];
37 public String getAllItemLabels() {
38 StringBuilder sb = new StringBuilder();
39 for (String item : items) {
40 if (StringUtils.isNotEmpty(item)) {
48 public void clearItems() {
49 for (int i = 0; i < items.length; ++i) {
55 public void invalidate() {
56 this.menuName = "N/A";