LEONARDI Application Composer - 8.9.0.40 by W4 S.A.

leon.view.win.swing
Class LySwingList

java.lang.Object
  extended by leon.view.graphic.LyGraphicalObject
      extended by leon.view.win.swing.LySwingObject
          extended by leon.view.win.swing.LySwingFieldItem
              extended by leon.view.win.swing.LySwingList
All Implemented Interfaces:
LyActionListener, LyEventTransmitter, LySelectionListener, LyGetValueInterface, LyGraphicalComponent, LyGraphicalFieldItem, LyGraphicalList, LyViewComponent, LyFreeInterface, LySetEditableInterface, LySetEnabledInterface, LySetListOptionsInterface, LySwingComponent

public class LySwingList
extends LySwingFieldItem
implements LySwingComponent, LyGraphicalList, LySelectionListener, LyActionListener, LySetEnabledInterface, LySetEditableInterface, LyGetValueInterface

This class implements the List object (as described in the dtd) for swing viewer.

An input field of List type allows to choose one or more values among a discrete list of values. It is possible to specify if the selection is multiple or not as well as the height of the list.

See Also:
LyList

Nested Class Summary
 class LySwingList._LyJCellRenderer
          This class implements a customized renderer for list cell.
 
Field Summary
static java.lang.String __VERSION
           
 
Constructor Summary
LySwingList(LyList list)
          Class constructor of a List object for the Swing target.
 
Method Summary
 void actionPerformed(LyActionEvent actionEvent)
          (non-Javadoc).
 void addListOption(LyListOption item, int pos)
          Adds a list option at the given position.
 java.awt.Component createListComponent(boolean monoselection, java.awt.Color selectionColor, java.awt.Color inactiveSelectionColor)
          Creates the component used to display this list.
 void fillList()
          Fills this list component with the elements in the description.
 java.awt.Component getComponent()
          Gets the swing component of this list.
 java.lang.Object[] getSelectedObjects(java.awt.Component listComponent)
          Gets the list of selected elements in this list.
 java.lang.String getValue()
          Returns the ids of the elements in this list.
 void initialize()
          Builds the component and registers events.
 void removeListOption(LyListOption listOption)
          Removes the given list option from this list.
 void selectionPerformed(LySelectionEvent selectionEvent)
          Invoked when an selection occurs: the list component is refreshed.
 void selectListOption(java.lang.Object[] selectedOptions)
          Selects the specified list elements in this list.
 void setContent()
          Sets the content of this list.
 void setEditable(boolean editable)
          Disabling is not implemented on Swing lists.
 void setEnabled(boolean enabled)
          Sets the enable status of the field item.
 
Methods inherited from class leon.view.win.swing.LySwingFieldItem
getActionTransmitter, getSelectionTransmitter
 
Methods inherited from class leon.view.win.swing.LySwingObject
getBounds, getChildrenBounds, getDefaultFrame
 
Methods inherited from class leon.view.graphic.LyGraphicalObject
expand, free, getController, getEnv, getEnvironment, getIdCode, getIntResource, getMessage, getMessage, getResource, getString, getString, getString, getViewComponent, getViewManager, isFreed, isFreeing, isImageAnimated, processDemand, processDemand, testResource, translate
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface leon.view.graphic.LyGraphicalComponent
free, getViewComponent
 

Field Detail

__VERSION

public static final java.lang.String __VERSION
See Also:
Constant Field Values
Constructor Detail

LySwingList

public LySwingList(LyList list)
Class constructor of a List object for the Swing target.

Parameters:
list - a LIST component defined for every type of view targets. This list is initialized for the swing view and filled with the default values.
Method Detail

initialize

public void initialize()
Builds the component and registers events.


createListComponent

public java.awt.Component createListComponent(boolean monoselection,
                                              java.awt.Color selectionColor,
                                              java.awt.Color inactiveSelectionColor)
Creates the component used to display this list.

Parameters:
monoselection - a boolean that specifies if this list allow mono or multi selection
selectionColor - the background color of selected options
inactiveSelectionColor - the color of the inactive selected options. This color is not used in this implementation.
Returns:
the component for this list

fillList

public void fillList()
Fills this list component with the elements in the description.


selectListOption

public void selectListOption(java.lang.Object[] selectedOptions)
Selects the specified list elements in this list.

Parameters:
selectedOptions - an array containing the LyListOption elements to set selected
See Also:
getSelectedObjects(Component)

getSelectedObjects

public java.lang.Object[] getSelectedObjects(java.awt.Component listComponent)
Gets the list of selected elements in this list.

Parameters:
listComponent - the list component to get its selected objects
Returns:
an array containing the selected LyListOption
See Also:
selectListOption(Object[]), JList.getSelectedValues()

setContent

public void setContent()
Sets the content of this list.


getComponent

public java.awt.Component getComponent()
Gets the swing component of this list. This component is a JScrollPane which preferred size is the same as its parent.

Specified by:
getComponent in interface LySwingComponent
Overrides:
getComponent in class LySwingObject
Returns:
a scrollPane that contain this component's list.
See Also:
LySwingComponent.getComponent()

addListOption

public void addListOption(LyListOption item,
                          int pos)
Adds a list option at the given position.

Specified by:
addListOption in interface LyGraphicalList
Specified by:
addListOption in interface LySetListOptionsInterface
Parameters:
item - the list option to add
pos - the position of the option in this list
See Also:
removeListOption(LyListOption), LyGraphicalList.addListOption(LyListOption, int)

removeListOption

public void removeListOption(LyListOption listOption)
Removes the given list option from this list.

Specified by:
removeListOption in interface LyGraphicalList
Specified by:
removeListOption in interface LySetListOptionsInterface
Parameters:
listOption - the list option to remove
See Also:
addListOption(LyListOption, int), LyGraphicalList.removeListOption(LyListOption)

setEditable

public void setEditable(boolean editable)
Disabling is not implemented on Swing lists.

Specified by:
setEditable in interface LySetEditableInterface
Parameters:
editable - the new status, not used in this implementation
See Also:
LySetEditableInterface.setEditable(boolean)

setEnabled

public void setEnabled(boolean enabled)
Sets the enable status of the field item.

Specified by:
setEnabled in interface LySetEnabledInterface
Parameters:
enabled - The new status.
See Also:
LySetEnabledInterface.setEnabled(boolean)

getValue

public java.lang.String getValue()
Returns the ids of the elements in this list. These ids are concatenated in a String separated with LyJListComponent.ITEM_SEP.

Specified by:
getValue in interface LyGetValueInterface
Returns:
the value of this list component, or null if there is none
See Also:
LyGetValueInterface.getValue()

selectionPerformed

public void selectionPerformed(LySelectionEvent selectionEvent)
Invoked when an selection occurs: the list component is refreshed.

Specified by:
selectionPerformed in interface LySelectionListener
Parameters:
selectionEvent - description of the selection which has occured
See Also:
LySelectionListener.selectionPerformed(LySelectionEvent)

actionPerformed

public void actionPerformed(LyActionEvent actionEvent)
(non-Javadoc).

Specified by:
actionPerformed in interface LyActionListener
See Also:
LyActionListener.actionPerformed(LyActionEvent)

(c) January 2013 - W4 S.A.

Website: W4 S.A., contact us: support@w4global.com