ch.uzh.ifi.attempto.preditor
Class DefaultMenuCreator

java.lang.Object
  extended by ch.uzh.ifi.attempto.preditor.DefaultMenuCreator
All Implemented Interfaces:
MenuCreator

public class DefaultMenuCreator
extends java.lang.Object
implements MenuCreator

This class is the default implementation of a menu creator.

Author:
Tobias Kuhn

Constructor Summary
DefaultMenuCreator()
           
 
Method Summary
 MenuEntry createMenuEntry(ConcreteOption option)
          This method must create and return the menu entry object for the given concrete option.
 java.util.List<SpecialMenuItem> createSpecialMenuItems(NextTokenOptions options)
          This method should return the special menu items for the given situation (described by the next token options).
 int getColorShift(java.lang.String menuBlockName)
          This method should return the shift of the color to be used for the given menu block.
 java.util.List<java.lang.String> getMenuGroupOrdering()
          This method can be used to define the ordering of the menu groups.
 java.util.Comparator<MenuItem> getMenuItemComparator()
          This method can return a comparator to define the order of the menu items within each menu group.
 void setColorShift(java.lang.String menuBlockName, int colorShift)
          This methods sets the color shift for the given menu block.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultMenuCreator

public DefaultMenuCreator()
Method Detail

createMenuEntry

public MenuEntry createMenuEntry(ConcreteOption option)
Description copied from interface: MenuCreator
This method must create and return the menu entry object for the given concrete option. described by the given next token options.

Specified by:
createMenuEntry in interface MenuCreator
Parameters:
option - The concrete option that represents a possible next token.
Returns:
A new menu entry object for the given option.

createSpecialMenuItems

public java.util.List<SpecialMenuItem> createSpecialMenuItems(NextTokenOptions options)
Description copied from interface: MenuCreator
This method should return the special menu items for the given situation (described by the next token options).

Specified by:
createSpecialMenuItems in interface MenuCreator
Parameters:
options - The options for the next token.
Returns:
A list of special menu items to be shown.

getMenuGroupOrdering

public java.util.List<java.lang.String> getMenuGroupOrdering()
Description copied from interface: MenuCreator
This method can be used to define the ordering of the menu groups. Menu groups with names that are not contained in the list returned by this method appear in an undefined order. All other menu groups appear in the same order as in the list.

Specified by:
getMenuGroupOrdering in interface MenuCreator
Returns:
A list of menu group names.

getColorShift

public int getColorShift(java.lang.String menuBlockName)
Description copied from interface: MenuCreator
This method should return the shift of the color to be used for the given menu block. A shift value of 120, for example, means a shift by 120 "degrees" towards violet. A shift of 360 is a full rotation and result in the original color.

Specified by:
getColorShift in interface MenuCreator
Parameters:
menuBlockName - The name of the menu block for which the color shift should be returned.
Returns:
The color shift value.

setColorShift

public void setColorShift(java.lang.String menuBlockName,
                          int colorShift)
This methods sets the color shift for the given menu block. It defines the color in which the menu block is to be displayed.

Parameters:
menuBlockName - The name of the menu block for which the color shift should be set.
colorShift - The color shift value.
See Also:
MenuCreator.getColorShift(java.lang.String)

getMenuItemComparator

public java.util.Comparator<MenuItem> getMenuItemComparator()
Description copied from interface: MenuCreator
This method can return a comparator to define the order of the menu items within each menu group.

Specified by:
getMenuItemComparator in interface MenuCreator
Returns:
A comparator to compare menu items.


Copyright 2008-2012, AceWiki developers