2 * Copyright (c) 2010-2023 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.openhab.binding.yamahareceiver.internal.protocol.xml.InputWithNavigationControlXML;
18 * The current state of the navigation
20 * @author David Graeff - Initial contribution
22 public class NavigationControlState implements Invalidateable {
23 public String menuName = null;
24 public int menuLayer = -1;
25 public int currentLine = 0;
26 public int maxLine = -1;
27 public String items[] = new String[InputWithNavigationControlXML.MAX_PER_PAGE];
29 public String getCurrentItemName() {
30 if (currentLine < 1 || currentLine > items.length) {
33 return items[currentLine - 1];
36 public String getAllItemLabels() {
37 StringBuilder sb = new StringBuilder();
38 for (String item : items) {
39 if (item != null && !item.isEmpty()) {
47 public void clearItems() {
48 for (int i = 0; i < items.length; ++i) {
54 public void invalidate() {
55 this.menuName = "N/A";