Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## jcontrol.ui.wombat.menu
Class MultiImageMenu

    java.lang.Object
      jcontrol.ui.wombat.Component
          jcontrol.ui.wombat.AbstractFocusComponent
              jcontrol.ui.wombat.menu.Menu
                  jcontrol.ui.wombat.menu.MultiImageMenu

All Implemented Interfaces:
  EventListener, ActionProducer, KeyListener, TouchListener, IFocusable

    public class MultiImageMenu

extends Menu

The class `MultiImageMenu` implements a menu with several images. Menu items can be specified as Strings or Resource objects of type JCIF.
If an item is selected an ActionEvent of type `ActionEvent.ITEM_SELECTED` is fired. If an already selected item is touched again (or if the "select"-key on an optional keyboard is pressed) an ActionEvent of type `ActionEvent.MENU_ACTION` is fired.

(C) DOMOLOGIC Home Automation GmbH 2005 - 2007

Field Summary
`static int` | `STYLE_NONE`
`static int` | `STYLE_SHOW_BORDER`

Fields inherited from class jcontrol.ui.wombat.menu.Menu
`m_inactives, m_items, m_scrollValue, m_selectedIndex`

Fields inherited from class jcontrol.ui.wombat.AbstractFocusComponent
`BORDER_WIDTH, listener`

Fields inherited from class jcontrol.ui.wombat.Component
`backgroundColor, COLOR_COMPONENT_BACKGROUND, COLOR_COMPONENT_BACKGROUND_HIGHLIGHTED, COLOR_COMPONENT_DARK_SHADOW, COLOR_COMPONENT_FOREGROUND, COLOR_COMPONENT_FOREGROUND_INACTIVE, COLOR_COMPONENT_HIGHLIGHT_SHADOW, COLOR_COMPONENT_LIGHT_SHADOW, COLOR_COMPONENT_LIST_BACKGROUND, COLOR_COMPONENT_NORMAL_SHADOW, COLOR_COMPONENT_SELECTION_TEXT, COLOR_COMPONENT_SELECTION_TEXT_BACKGROUND, COLOR_COMPONENT_SELECTION_TEXT_BACKGROUND_INACTIVE, COLOR_COMPONENT_SELECTION_TEXT_INACTIVE, eventQueue, font, foregroundColor, frame, height, parent, RESERVED1, RESERVED2, RESERVED3, RESERVED4, RESERVED5, RESERVED6, state, STATE_ABORT_UPDATE, STATE_ANIMATED, STATE_BG_COLOR_SET, STATE_COVERED, STATE_DIRTY_MASK, STATE_DIRTY_PAINTALL, STATE_DIRTY_REPAINT, STATE_DIRTY_UPDATE, STATE_DISABLED, STATE_DISPOSED, STATE_FG_COLOR_SET, STATE_FOCUS, STATE_HEIGHT_FIXED, STATE_NO_REDRAW, STATE_REVALIDATE, STATE_SELECTED, STATE_SIZE_FIXED, STATE_UPDATED, STATE_VISIBLE, STATE_WIDTH_FIXED, transparentColor, width, x, y`

Fields inherited from interface jcontrol.ui.wombat.IFocusable
`TRANSFER_FOCUS_BACKWARD, TRANSFER_FOCUS_FORWARD`

Fields inherited from interface jcontrol.ui.wombat.event.TouchListener
`RESULT_ACCEPTED, RESULT_EXECUTED, RESULT_NONE`

Constructor Summary
`MultiImageMenu(int x, int y, int width, int height, int horizontalCount, int verticalCount, int style)` Constructor for MultiImageMenu.

Method Summary
`int` | `addMenuItem(String item)` Adds a new Menu item at the first free position.
`int` | `getFirstFreeIndex()` Returns the first free position in this menu or -1 if all items are set.
`int` | `insertMenuItem(String item, int index)` Inserts a menu item at the specified position.
`KeyEvent` | `onKeyEvent(KeyEvent e)` If a KeyEvent accurs, this method is called.
`int` | `onTouchEvent(TouchEvent e)` Every time a touch event is fired, this method will be called.
`void` | `paint(XGraphics g)` Paints the menu.
`boolean` | `removeMenuItem(int index)` Removes the item at the specified index if the is none.
`protected boolean` | `selectNextOrPrev(boolean updown)` Selects the next or previous menu item in this menu.
`void` | `setImageItems(Resource[] imageItems)` Set the given list of image resource items to this menu.
`void` | `setSelectionVisible(boolean visible)` Turns the selection border on or off.
`void` | `setTextItems(String[] textItems)` Set the given list of string items to this menu.
`void` | `setTouchMargin(int margin)` Sets the space between the menu items that is not touch sensitive.
`void` | `setTransparent(boolean transparent)` Sets the transparent state of the background.

Methods inherited from class jcontrol.ui.wombat.menu.Menu
`getIndex, getItem, getItemCount, getSelectedIndex, setEnabled, setSelection`

Methods inherited from class jcontrol.ui.wombat.AbstractFocusComponent
`clearCorners, drawBevelRect, drawButton, drawDottedRect, drawFocusRect, getActionListener, onActionEvent, requestFocus, setActionListener, setEnabled, setVisible`

Methods inherited from class jcontrol.ui.wombat.Component
`drawDisabledImage, getFrame, isEnabled, isVisible, isVisibleInternal, redrawInternalAndParent, repaint, repaintAll, safeExec, setBackgroundColor, setBackgroundColorInternal, setBounds, setDirty, setFont, setForegroundColor, setForegroundColorInternal, setParametersInternal, setRedraw, setTransparentColor, unsafeExec, update`

Methods inherited from class java.lang.Object
`clone, equals, getClass, notifyAll, toString, wait`

Field Detail

### STYLE_NONE

    public static final int STYLE_NONE

See Also:
  Constant Field Values

### STYLE_SHOW_BORDER

    public static final int STYLE_SHOW_BORDER

See Also:
  Constant Field Values

Constructor Detail

### MultiImageMenu

    public MultiImageMenu(int x,
                          int y,
                          int width,
                          int height,
                          int horizontalCount,
                          int verticalCount,
                          int style)

  Constructor for MultiImageMenu.

  Parameters:
    `x` - the x coordinate
    `y` - the y coordinate
    `width` - the width
    `height` - the height
    `maxVisibleItems` - the number of visible menu items, images will be clipped to the same size to fit into the menu's bounds.

Method Detail

### setTransparent

    public void setTransparent(boolean transparent)

  Sets the transparent state of the background. If the background is transparent it will never be repainted, i.e, components that intersect with the drawable area of this multi image menu will not be "overpainted".

  Parameters:
    `transparent` - the transparent state

### setSelectionVisible

    public void setSelectionVisible(boolean visible)

  Turns the selection border on or off.

  Parameters:
    `visible` - the visible state of the selection border

### setTextItems

    public void setTextItems(String[] textItems)

  Set the given list of string items to this menu. If the number of items exceeds the maximum capacity of this menu, the excessive items will not be shown.

  Parameters:
    `textItems` - a list of strings.

### setTouchMargin

    public void setTouchMargin(int margin)

  Sets the space between the menu items that is not touch sensitive.

  Parameters:
    `margin` - space between the menu items

### setImageItems

    public void setImageItems(Resource[] imageItems)

  Set the given list of image resource items to this menu. If the number of items exceeds the maximum capacity of this menu, the excessive items will not be shown.

  Parameters:
    `imageItems` - a list of strings.

### addMenuItem

    public int addMenuItem(String item)

  Adds a new Menu item at the first free position. If no free position is available, the item is not added, and this method returns -1.

  Specified by:
    `addMenuItem` in class `Menu`
  Parameters:
    `item` - the name of the menu item, can even specify an image name
  Returns:
    the index of the new menu item
  See Also:
    `Menu.insertMenuItem(String, int)`

### getFirstFreeIndex

    public int getFirstFreeIndex()

  Returns the first free position in this menu or -1 if all items are set.

### insertMenuItem

    public int insertMenuItem(String item,
                              int index)

  Inserts a menu item at the specified position. Any item that already exists at this position will be discarded.

  Specified by:
    `insertMenuItem` in class `Menu`
  Parameters:
    `item` - the name of the menu item, can even specify an image name
    `index` - the position
  Returns:
    the index of the new menu item
  See Also:
    `Menu.addMenuItem(String)`

### removeMenuItem

    public boolean removeMenuItem(int index)

  Removes the item at the specified index if the is none.

  Specified by:
    `removeMenuItem` in class `Menu`
  Parameters:
    `index` - the index to remove
  Returns:
    boolean `true` if the item has been removed successfully, `false` otherwise
  See Also:
    `Menu.setEnabled(int, boolean)`

### paint

    public void paint(XGraphics g)

  Paints the menu.

  Overrides:
    `paint` in class `Component`
  Parameters:
    `g` - the application's graphics object.
  See Also:
    `Component.paint(XGraphics)`

### onKeyEvent

    public KeyEvent onKeyEvent(KeyEvent e)

  If a KeyEvent accurs, this method is called.

  Specified by:
    `onKeyEvent` in interface `KeyListener`
  Specified by:
    `onKeyEvent` in class `AbstractFocusComponent`
  Parameters:
    `e` - the KeyEvent.
  Returns:
    `null` if the KeyEvent has been consumed by the KeyListener,
    or the the specified KeyEvent if it should be passed on to the next KeyListener.

### selectNextOrPrev

    protected boolean selectNextOrPrev(boolean updown)

  Description copied from class: `Menu`
  Selects the next or previous menu item in this menu.

  Overrides:
    `selectNextOrPrev` in class `Menu`
  Parameters:
    `updown` - if true, select the next item, the previous otherwise
  Returns:
    true if the selection has changed

### onTouchEvent

    public int onTouchEvent(TouchEvent e)

  Description copied from interface: `TouchListener`
  Every time a touch event is fired, this method will be called.

  Specified by:
    `onTouchEvent` in interface `TouchListener`
  Specified by:
    `onTouchEvent` in class `AbstractFocusComponent`
  Parameters:
    `e` - The touch event.
  Returns:
    `RESULT_ACCEPTED` if the TouchEvent has been consumed by the TouchListener,
    `RESULT_EXECUTED` if the TouchEvent has been consumed by the TouchListener and some important action has been performed, e.g. an action event has been invoked,
    `RESULT_NONE` if the TouchEvent should be passed on to the next TouchListener.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD