org.universAAL.ui.dm.userInteraction.mainMenu.file
Class MenuNode

Package class diagram package MenuNode
java.lang.Object
  extended by org.universAAL.ui.dm.userInteraction.mainMenu.file.MenuNode
Direct Known Subclasses:
RDFMenuNode

public class MenuNode
extends Object

A node of the main menu. The main menu can be hierarchically. Thus, a node can have a parent and multiple children (currently, a maximum of 15 children is allowed). The leaf node of this tree should have a service class and vendor associated.

Author:
mtazari, cstockloew

Constructor Summary
MenuNode(int level)
           
 
Method Summary
 void add(String path, String vendor, String serviceClass)
           
 int add(String path, String vendor, String serviceClass, String iconURL)
          Add a new node to the menu.
 Iterable<MenuNode> children()
          Get an iterator for all children of this node.
 String getIconURL()
           
 String getLabel()
          Get the label of this node.
 MenuNode getParent()
          Get the parent of this node.
 String getPath()
          Get the path of this node.
 ServiceRequest getService(Resource user)
          Create a service request with the user as well as service class and vendor of this node (if this node a leaf node and has an associated service).
 boolean hasChild()
          Determines whether this node has children.
 boolean hasService()
          Determines whether a service (and a vendor) is bound to this node.
protected  MenuNode newMenuNode(int level)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MenuNode

public MenuNode(int level)
Method Detail

add

public int add(String path,
               String vendor,
               String serviceClass,
               String iconURL)
Add a new node to the menu. The argument 'path' can consist of multiple labels (separated by the symbol '/') that will result in multiple levels of the menu. Nodes are automatically created if they do not exist. The leaf node is associated with the given parameters for vendor and service class.

Parameters:
path - The path of possibly multiple labels according to the different levels in the menu.
vendor - The vendor of the service.
serviceClass - The class the service implements.
Returns:
The number of newly created nodes.

newMenuNode

protected MenuNode newMenuNode(int level)

add

public void add(String path,
                String vendor,
                String serviceClass)

children

public Iterable<MenuNode> children()
Get an iterator for all children of this node.

Returns:
The iterator.

getLabel

public String getLabel()
Get the label of this node.

Returns:
The label.

getParent

public MenuNode getParent()
Get the parent of this node.

Returns:
The parent.

getPath

public String getPath()
Get the path of this node. The path is a string containing the labels of all nodes from this node up to the root node. It starts with '/' and the labels are separated by '/'.

Returns:
The path.

getService

public ServiceRequest getService(Resource user)
Create a service request with the user as well as service class and vendor of this node (if this node a leaf node and has an associated service).

Parameters:
user - The user.
Returns:
The service request.

hasChild

public boolean hasChild()
Determines whether this node has children.

Returns:
true, if this node has children.

hasService

public boolean hasService()
Determines whether a service (and a vendor) is bound to this node.

Returns:
true, if this node has a service.

getIconURL

public String getIconURL()


Copyright © 2014 universAAL Consortium. All Rights Reserved.