All Downloads are FREE. Search and download functionalities are using the official Maven repository.

de.mhus.lib.vaadin.aqua.NavigationSelection Maven / Gradle / Ivy

There is a newer version: 3.2.8
Show newest version
package de.mhus.lib.vaadin.aqua;

import java.util.LinkedList;

public class NavigationSelection {

	protected NavigationNode[] path;
	protected NavigationNode node;
	private NavigationNode parent;

	public NavigationSelection(NavigationNode node) {
		
		this.node = node;

		this.parent = node;
		if (node.isLeaf()) 
			parent = node.getParent();
		
		LinkedList cache = new LinkedList();
		NavigationNode cur = parent;
		while (cur != null) {
			cache.addFirst(cur);
			cur = cur.getParent();
		}
		path = cache.toArray(new NavigationNode[cache.size()]);

	}
	
	public NavigationNode[] getPath() {
		return path;
	}
	
	public NavigationNode getSelectedNode() {
		return node;
	}
	
	public NavigationNode[] getChildren() {
		return parent.getChildren();
	}
	
	public boolean isSelectedNode(NavigationNode test) {
		return node.equals(test);
	}
	
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy