Class Menu

java.lang.Object
overit.geocall.ui.Menu
All Implemented Interfaces:
SingleUseComponent
Direct Known Subclasses:
SortableMenu

public class Menu extends Object implements SingleUseComponent
The class implements the user interface element that should be used to display contextual menus that appears in popups when the user click on a graphical object. The menu is composed by a list of items (each of which is a voice of the menu) that can either be non-active titles or active voices that can trigger events.
The class implements the SingleUseComponent interface.
  • Field Details

    • _sequence

      protected static int _sequence
    • _items

      protected ArrayList<Menu.Item> _items
    • _id

      protected String _id
    • _cellStyle

      protected static String _cellStyle
    • _nospinAttrib

      protected static String _nospinAttrib
    • _checkOnIcon

      protected IconHD _checkOnIcon
    • _checkOffIcon

      protected IconHD _checkOffIcon
    • _emptyIcon

      protected IconHD _emptyIcon
  • Constructor Details

    • Menu

      public Menu(Teacher teacher)
      Creates a menu
      Parameters:
      teacher - The component that manage the translations (see Teacher)
  • Method Details

    • getTeacher

      public Teacher getTeacher()
      Returns the Teacher, the object that manages the translations
      Returns:
      The Teacher that manages the translations
    • addItem

      public void addItem(String label, String icon, String event)
      Creates and add an item to the menu
      Parameters:
      label - The label of the item
      icon - The icon of the item
      event - The event associated to the item
    • addItem

      public void addItem(String label, String icon, String event, String id)
      Creates and add an item to the menu
      Parameters:
      label - The label of the item
      icon - The icon of the item
      event - The event associated to the item
      id - The target for the event
    • addItem

      public void addItem(String label, String icon, String event, String id, String param, String msg, String prompt)
      Creates and add an item to the menu
      Parameters:
      label - The label of the item
      icon - The icon of the item
      event - The event associated to the item
      id - The target for the event
      param - The parameter passed to the event triggered when the user clicks the menu voice
      msg - The string that appears as a message when the user clicks the menu voice
      prompt - The string that appears as a prompt when the user clicks the menu voice
    • add

      public void add(Menu.Item item)
      Adds a menu voice
      Parameters:
      item - The item to be added to the menu
    • setTitle

      public void setTitle(String title)
      Sets the title of the menu
      Parameters:
      title - The string that will appear as a title - always the first voice - for the menu
    • addTitle

      public void addTitle(String title)
      Adds a non-active menu voice
      Parameters:
      title - The string, rendered as a title, for the menu
    • getItems

      public ArrayList getItems()
      Returns the item of the menu
      Returns:
      The list of the items
    • getHtml

      public org.apache.ecs.Element getHtml(EntitySet es, Window w)
      Returns the html code of the menu
      Specified by:
      getHtml in interface SingleUseComponent
      Parameters:
      es - The EntitySet to which the element belongs
      w - The Window currently displayed
      Returns:
      The html code of the menu
    • drawItem

      protected org.apache.ecs.Element drawItem(Menu.Item mi, boolean fullmenu, Window w)
    • getEmptyDiv

      protected org.apache.ecs.Element getEmptyDiv()
    • getTitleDiv

      protected org.apache.ecs.Element getTitleDiv(String title)
    • getLabelDiv

      protected org.apache.ecs.Element getLabelDiv(String label)
    • getCheckDiv

      protected org.apache.ecs.Element getCheckDiv(Boolean checked, Boolean ro)
    • getIconDiv

      protected org.apache.ecs.Element getIconDiv(Icon icon, Boolean ro)
    • getCheckOrIconDiv

      protected org.apache.ecs.Element getCheckOrIconDiv(Boolean checked, Icon icon, Boolean ro)
    • buildSetupScript

      public void buildSetupScript(StringBuilder sb)
      Every component can add a script to the StringBuilder, script executed when the component is created The method add the script that manage the creation and showing of the menu
      Specified by:
      buildSetupScript in interface SingleUseComponent
      Parameters:
      sb - The StringBuilder on which we want to add the script