ilog.views.appframe.event
Class IlvListActionHandler

java.lang.Object
  extended by ilog.views.appframe.event.IlvSingleActionHandler
      extended by ilog.views.appframe.event.IlvListActionHandler
All Implemented Interfaces:
ActionHandler, ActionListener, EventListener

public abstract class IlvListActionHandler
extends IlvSingleActionHandler

Action handler that handles list actions. List actions are typically used for displaying the list of recently used files or the list of open windows in a menu. List actions are marked in the settings with the attribute isList="true". For example, the action that displays the main recent file list of the application is defined as follows:

 <action actionCommand="RecentFiles"
          isList="true"
          ...
 
For more details on list actions, see the IlvAction class.


Constructor Summary
IlvListActionHandler(String command)
          Constructs a new IlvListActionHandler that handles the list action with the specified command key.
 
Method Summary
 String getEmptyString()
          Returns the empty string used when the list action does not contain any items.
 char getFirstNumberingCharacter()
          Returns the character used for numbering the menu items associated with the items of the list action.
 Object[] getListItems()
          Returns the items that are stored in the list action handled by this object.
 int getMenuItemMaximumLength()
          Returns the maximum number of characters allowed for displaying menu items associated with items of the list action that this object handles.
 int getSelectedItem()
          Returns the index of the currently selected item in the list items of the list action.
 boolean isDynamicList()
          Determines whether the items stored in the list action are dynamically determined before displaying the pop-up menu associated with the list action.
 boolean isNumbering()
          Determines whether menu items displaying list items of the list action are prefixed with a numbering string.
 boolean isSubMenuItems()
          Determines whether the menu items created for the items of the list action should be created in a sub pop-up menu.
protected  void selectedItemChanged(int index, Object object)
          Invoked when the selected item of the list of items has changed.
 void setAction(Action action)
          Sets the action this object handles.
 void setDynamicList(boolean dynamic)
          Specifies the dynamic list mode of the list action this object handles.
 void setEmptyString(String emptyString)
          Sets the string used when the list action does not contain any items.
 void setFirstNumberingCharacter(char c)
          Sets the character used for numbering the menu item associated with the items of the list action.
 void setListItems(Object[] items)
          Sets the items that are stored in the list action handled by this object.
 void setMenuItemMaximumLength(int maxLength)
          Sets the maximum number of characters allowed for displaying the menu items associated with items of the list action that this object handles.
 void setNumbering(boolean numbering)
          Specifies whether menu items displaying list items of the list action should be prefixed with a numbering string.
 void setSelectedItem(int index)
          Sets the newly selected item in the list of items of the list action.
 void setSubMenuItems(boolean subMenu)
          Creates the menu items for the items of the list action in a sub pop-up menu or below the menu item associated with the list action, depending on the value of the subMenu parameter.
 
Methods inherited from class ilog.views.appframe.event.IlvSingleActionHandler
actionPerformed, getAction, getCommand, isProcessingAction, setCommand, updateAction, updateSingleAction
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IlvListActionHandler

public IlvListActionHandler(String command)
Constructs a new IlvListActionHandler that handles the list action with the specified command key.

Parameters:
command - The command key of the action handled by this action handler.
Method Detail

getListItems

public Object[] getListItems()
Returns the items that are stored in the list action handled by this object.

See Also:
setListItems(java.lang.Object[]), IlvAction.GetListItems(javax.swing.Action)

setListItems

public void setListItems(Object[] items)
Sets the items that are stored in the list action handled by this object. Menu items that are associated with the list action are refreshed according to the newly specified items.

Parameters:
items - The new items of the list action.
See Also:
getListItems(), IlvAction.SetListItems(javax.swing.Action, java.lang.Object[])

getSelectedItem

public int getSelectedItem()
Returns the index of the currently selected item in the list items of the list action.

Returns:
The index of the selected item or -1 if no item is selected.
See Also:
setSelectedItem(int), selectedItemChanged(int, java.lang.Object), IlvAction.GetSelectionIndex(javax.swing.Action)

setSelectedItem

public void setSelectedItem(int index)
Sets the newly selected item in the list of items of the list action.

Parameters:
index - The index of the newly selected list item.
See Also:
getSelectedItem(), selectedItemChanged(int, java.lang.Object), IlvAction.SetSelectionIndex(javax.swing.Action, int)

selectedItemChanged

protected void selectedItemChanged(int index,
                                   Object object)
Invoked when the selected item of the list of items has changed.

Parameters:
index - The index of the newly selected item.
object - The newly selected item.
See Also:
getSelectedItem(), setSelectedItem(int)

isDynamicList

public boolean isDynamicList()
Determines whether the items stored in the list action are dynamically determined before displaying the pop-up menu associated with the list action. If list items are dynamically set, the IlvSingleActionHandler.updateAction(javax.swing.Action) is invoked just before the pop-up menu is displayed.

Returns:
true if list items are dynamically set; false otherwise.
See Also:
setDynamicList(boolean)

setDynamicList

public void setDynamicList(boolean dynamic)
Specifies the dynamic list mode of the list action this object handles.

Parameters:
dynamic - If true, list items are defined just before the pop-up menu associated with the list action is displayed; otherwise, list items are set once using the setListItems(java.lang.Object[]) method.
See Also:
isDynamicList()

isSubMenuItems

public boolean isSubMenuItems()
Determines whether the menu items created for the items of the list action should be created in a sub pop-up menu.

Returns:
true if menu items are created in a sub pop-up menu; false otherwise.
See Also:
setSubMenuItems(boolean)

setSubMenuItems

public void setSubMenuItems(boolean subMenu)
Creates the menu items for the items of the list action in a sub pop-up menu or below the menu item associated with the list action, depending on the value of the subMenu parameter.

Parameters:
subMenu - If true, menu items will be created in a sub pop-up menu; if false, menu items will be created below the menu item associated with the list action and the menu item will become invisible.
See Also:
isSubMenuItems()

getMenuItemMaximumLength

public int getMenuItemMaximumLength()
Returns the maximum number of characters allowed for displaying menu items associated with items of the list action that this object handles.

See Also:
setMenuItemMaximumLength(int)

setMenuItemMaximumLength

public void setMenuItemMaximumLength(int maxLength)
Sets the maximum number of characters allowed for displaying the menu items associated with items of the list action that this object handles.

Parameters:
maxLength - The new maximum number of characters.
See Also:
getMenuItemMaximumLength()

isNumbering

public boolean isNumbering()
Determines whether menu items displaying list items of the list action are prefixed with a numbering string.

See Also:
IlvAction.ACTION_LIST_MENU_USENUMBERING, setNumbering(boolean), getFirstNumberingCharacter()

setNumbering

public void setNumbering(boolean numbering)
Specifies whether menu items displaying list items of the list action should be prefixed with a numbering string.

Parameters:
numbering - If true, menu items will be prefixed with a numbering string; if false, menu items will not be prefixed.
See Also:
isNumbering(), getFirstNumberingCharacter()

getFirstNumberingCharacter

public char getFirstNumberingCharacter()
Returns the character used for numbering the menu items associated with the items of the list action. The first numbering character is only used when the numbering mode is set (isNumbering() returns true).

See Also:
setFirstNumberingCharacter(char), isNumbering(), IlvAction.ACTION_LIST_MENU_FIRSTNUMBER

setFirstNumberingCharacter

public void setFirstNumberingCharacter(char c)
Sets the character used for numbering the menu item associated with the items of the list action. The first numbering character is only used when the numbering mode is set (isNumbering() returns true).

Parameters:
c - The first numbering character.
See Also:
getFirstNumberingCharacter(), isNumbering()

getEmptyString

public String getEmptyString()
Returns the empty string used when the list action does not contain any items.

See Also:
setEmptyString(java.lang.String), IlvAction.ACTION_LIST_MENU_EMPTYSTRING

setEmptyString

public void setEmptyString(String emptyString)
Sets the string used when the list action does not contain any items.

Parameters:
emptyString - The new empty string. The specified string should be a key to a string resource.
See Also:
getEmptyString()

setAction

public void setAction(Action action)
Sets the action this object handles. This method overrides the command key previously set with the IlvSingleActionHandler.setCommand(java.lang.String) method.

Overrides:
setAction in class IlvSingleActionHandler
Parameters:
action - The new action this instance handles.
See Also:
IlvSingleActionHandler.getAction(), IlvSingleActionHandler.setCommand(java.lang.String)


Copyright © 1996-2007 ILOG S.A. All rights reserved.   Documentation homepage.   . All Rights Reserved.