LEONARDI Application Composer - 8.9.0.40 by W4 S.A.

leon.view.win.swing
Class LySwingChoice

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.LySwingChoice
All Implemented Interfaces:
java.awt.event.ItemListener, java.util.EventListener, LyEventTransmitter, LyGetValueInterface, LyGraphicalChoice, LyGraphicalComponent, LyGraphicalFieldItem, LyViewComponent, LyFreeInterface, LySetEditableInterface, LySetEnabledInterface, LySetFocusInterface, LySwingComponent

public class LySwingChoice
extends LySwingFieldItem
implements LySwingComponent, LyGraphicalChoice, java.awt.event.ItemListener, LySetEnabledInterface, LySetEditableInterface, LyGetValueInterface, LySetFocusInterface

This class implements the Choice object (as described in the dtd) for Swing viewer.

An input field of Choice type allows to display a graphical component containing a set of check boxes. It allows to choose one or more values among a discrete list of values. It is possible to specify whether the choice is multiple or not and whether the boxes should be arranged horizontally or vertically.

See Also:
LyChoice

Nested Class Summary
 class LySwingChoice._LyJChoicePanel
          Represents a Swing panel containing the representation of the choice objects.
 class LySwingChoice._SpecialPanel
          Special panel where its dimensions are based on those of another component.
 
Field Summary
static java.lang.String __VERSION
           
 
Constructor Summary
LySwingChoice(LyChoice choice)
          Class constructor of a choice object for the Swing target.
 
Method Summary
 void addCheckBox(java.awt.Component checkbox, LyOption option)
          Adds a new checkbox with the given options to this current component.
 void addCheckBoxToGroup(java.awt.Component box)
          Adds a checkbox to the checkbox group.
 void addChoiceToPanel(java.awt.Component choice)
          Adds a choice element to the panel.
 java.lang.Object createCheckBoxGroup()
          Creates and configures the object that manage a group of checkboxes (logically).
 java.awt.Container createChoicePanel(LyChoiceBase.Fill fill)
          Creates and configures the panel that contains all the choices.
 java.lang.Object getCheckboxGroup()
          Gets the checkbox group of the current component.
 java.awt.Component getComponent()
          (non-Javadoc).
 java.lang.String getValue()
          Gets the list of checkboxes that are selected.
 void initialize()
          Initializes this component and creates a new checkbox group if it is a single choice object.
 boolean isChecked(java.awt.Component box)
          Returns the state of a given box.
 void itemStateChanged(java.awt.event.ItemEvent e)
          (non-Javadoc).
 void setChecked(java.awt.Component box, boolean isChecked)
          Checks or unchecks a checkbox or a group of checkboxes, depending on this choice object.
 void setContent()
          Sets the content of this choice component.
 void setEditable(boolean editable)
          Sets the editable status of all the choices elements of this component.
 void setEnabled(boolean status)
          Sets the enabled status of all the choices elements of this component.
 void setFocus()
          Sets the focus to this component.
 void setValue(java.lang.String value)
          Sets or unsets the checkbox status of the specified elements.
 
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

LySwingChoice

public LySwingChoice(LyChoice choice)
Class constructor of a choice object for the Swing target.

Parameters:
choice - a CHOICE component defined for every type of view targets. This choice component is initialized specificaly for the Swing view.
Method Detail

createCheckBoxGroup

public java.lang.Object createCheckBoxGroup()
Creates and configures the object that manage a group of checkboxes (logically).

Returns:
a new check box group

addCheckBoxToGroup

public void addCheckBoxToGroup(java.awt.Component box)
Adds a checkbox to the checkbox group.

Parameters:
box - the checkbox to add. It may be a JCheckBox if the choices are multiple, else a JRadioButton.

createChoicePanel

public java.awt.Container createChoicePanel(LyChoiceBase.Fill fill)
Creates and configures the panel that contains all the choices.

Parameters:
fill - a short that specifies the way to place the choices
Returns:
a panel initialized to contain all the choices of this component

setChecked

public void setChecked(java.awt.Component box,
                       boolean isChecked)
Checks or unchecks a checkbox or a group of checkboxes, depending on this choice object.

Parameters:
box - the checkbox to modify
isChecked - the state to set for the specified checkbox

isChecked

public boolean isChecked(java.awt.Component box)
Returns the state of a given box.

Parameters:
box - the box to test
Returns:
true if the box is checked, false otherwise

itemStateChanged

public void itemStateChanged(java.awt.event.ItemEvent e)
(non-Javadoc).

Specified by:
itemStateChanged in interface java.awt.event.ItemListener
See Also:
ItemListener.itemStateChanged(java.awt.event.ItemEvent)

addChoiceToPanel

public void addChoiceToPanel(java.awt.Component choice)
Adds a choice element to the panel. A handler is associated to the specified choice for it to validate or close the form respectively with the ENTER and ESCAPE keys.

Parameters:
choice - the choice to add

initialize

public void initialize()
Initializes this component and creates a new checkbox group if it is a single choice object.


setContent

public void setContent()
Sets the content of this choice component. Every checkboxes it contains are added to the checkbox list and initialized giving their properties, then they are added to this component's panel.


setEditable

public void setEditable(boolean editable)
Sets the editable status of all the choices elements of this component.

Specified by:
setEditable in interface LySetEditableInterface
Parameters:
editable - new status
See Also:
LySetEditableInterface.setEditable(boolean)

setEnabled

public void setEnabled(boolean status)
Sets the enabled status of all the choices elements of this component.

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

setFocus

public void setFocus()
Sets the focus to this component.

Specified by:
setFocus in interface LySetFocusInterface
See Also:
LySetFocusInterface.setFocus()

getCheckboxGroup

public java.lang.Object getCheckboxGroup()
Gets the checkbox group of the current component.

Returns:
the checkbox group

getComponent

public java.awt.Component getComponent()
(non-Javadoc).

Specified by:
getComponent in interface LySwingComponent
Overrides:
getComponent in class LySwingObject
Returns:
this Swing view component
See Also:
LySwingComponent.getComponent()

addCheckBox

public void addCheckBox(java.awt.Component checkbox,
                        LyOption option)
Adds a new checkbox with the given options to this current component. This method initializes the checkboxes list and their associations if they are empty.

Parameters:
checkbox - the new checkbox component to add
option - the options of the new checkbox

getValue

public java.lang.String getValue()
Gets the list of checkboxes that are selected.

Specified by:
getValue in interface LyGetValueInterface
Returns:
a String of the list of checkbox id separated with LyString.SEP
See Also:
setValue(String)

setValue

public void setValue(java.lang.String value)
Sets or unsets the checkbox status of the specified elements.

Parameters:
value - the list of checkboxes to set their status. This list is a string separated with LyString.SEP of the checkboxes id to set. If null, then every checkbox is unselected.
See Also:
getValue()

(c) January 2013 - W4 S.A.

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