ch.uzh.ifi.attempto.acewiki.gui
Class AceWikiMenuCreator

java.lang.Object
  extended by ch.uzh.ifi.attempto.acewiki.gui.AceWikiMenuCreator
All Implemented Interfaces:
MenuCreator, java.io.Serializable, java.util.EventListener, nextapp.echo.app.event.ActionListener

public class AceWikiMenuCreator
extends java.lang.Object
implements MenuCreator, nextapp.echo.app.event.ActionListener

This is the menu creator class that generates the menu entries for the predictive editor on the basis of the AceWiki grammar.

Author:
Tobias Kuhn
See Also:
Serialized Form

Constructor Summary
AceWikiMenuCreator(Wiki wiki, OntologyElement highlightedElement, nextapp.echo.app.event.ActionListener actionListener)
          Creates a new AceWiki-specific menu creator object.
 
Method Summary
 void actionPerformed(nextapp.echo.app.event.ActionEvent e)
           
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AceWikiMenuCreator

public AceWikiMenuCreator(Wiki wiki,
                          OntologyElement highlightedElement,
                          nextapp.echo.app.event.ActionListener actionListener)
Creates a new AceWiki-specific menu creator object.

Parameters:
wiki - The wiki instance.
highlightedElement - The ontology element that should be highlighted in the editor (because it is the current element).
actionListener - The action-listener.
Method Detail

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.

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.

actionPerformed

public void actionPerformed(nextapp.echo.app.event.ActionEvent e)
Specified by:
actionPerformed in interface nextapp.echo.app.event.ActionListener

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.

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