net.sf.jzeno.echo.databinding
Class DynaCheckBox

java.lang.Object
  extended by nextapp.echo.AbstractComponent
      extended by net.sf.jzeno.echo.components.CustomComponent
          extended by net.sf.jzeno.echo.databinding.DynaCheckBox
All Implemented Interfaces:
java.beans.PropertyChangeListener, java.io.Serializable, java.util.EventListener, BindingTarget, PropertyComponent, RebindableComponent, EventSink, EventSource, Precreation, Component, ActionListener, FastComponent, FastComponentContainer
Direct Known Subclasses:
BooleanEditor, BooleanViewer

public class DynaCheckBox
extends CustomComponent
implements java.beans.PropertyChangeListener, EventSource, FastComponent, ActionListener, Precreation

Checkbox that can be bound to a boolean (primitive) or

Boolean

(object) property.

See Also:
Serialized Form

Field Summary
static int BOTTOM
           
static int CENTER
           
static int LEFT
           
static int RIGHT
           
static int TOP
           
 
Fields inherited from interface nextapp.echo.Component
BACKGROUND_CHANGED_PROPERTY, CHILDREN_CHANGED_PROPERTY, ENABLED_CHANGED_PROPERTY, FONT_CHANGED_PROPERTY, FOREGROUND_CHANGED_PROPERTY, IDENTIFIER_CHANGED_PROPERTY, LOCALE_CHANGED_PROPERTY, MODEL_CHANGED_PROPERTY, SELECTABLE_CHANGED_PROPERTY, STYLE_BACKGROUND, STYLE_FONT, STYLE_FOREGROUND, UPDATE_PROPERTY, VISIBLE_CHANGED_PROPERTY
 
Constructor Summary
DynaCheckBox()
           Creates an unbound component.
DynaCheckBox(java.lang.Class beanClass, java.lang.String propertyName, java.lang.String constructionHints)
           Creates a databound checkbox.
 
Method Summary
 void actionPerformed(ActionEvent e)
          Invoked when an action occurs.
 void applyContext()
           
 void applyStyle(Style style)
          Sets stylistic properties of this component based on a Style object.
 java.lang.String getCssClass()
           
 java.lang.String getCssClassDisabled()
           
 Font getFont()
          Returns the font.
 int getStateMargin()
           
 java.lang.String getText()
           Gets the label that appears after the checkbox.
 java.lang.String getToolTipText()
           Gets the tooltip that appears when the user hoovers over the checkbox.
 boolean isAsync()
           
 boolean isReadOnly()
           Returns whether or not this checkbox is read-only.
 boolean isSelected()
          Deprecated. read the boolean property you've bound this checkbox to.
 void propertyChange(java.beans.PropertyChangeEvent evt)
           Used internally.
 void rebind()
           This operation causes the component to reset it's content to that of the domain model.
 void setActionCommand(java.lang.String command)
           
 void setAsync(boolean async)
           
 void setCssClass(java.lang.String cssClass)
           
 void setCssClassDisabled(java.lang.String cssClass)
           
 void setFocused(boolean focused)
           Sets the input focus on this component
 void setFont(Font font)
          Sets the font of the component.
 void setReadOnly(boolean readOnly)
           Sets whether or not this checkbox is read-only.
 void setSelected(boolean selected)
          Deprecated. write to the boolean property you've bound this checkbox to.
 void setStateMargin(int i)
          Sets the size of the margin to be displayed between the state indicator of the toggle button and its icon and text.
 void setText(java.lang.String text)
           Sets the label that appears after the checkbox.
 void setToolTipText(java.lang.String tip)
           Sets the tooltip that appears when the user hoovers over the checkbox.
 
Methods inherited from class net.sf.jzeno.echo.components.CustomComponent
addValidator, fireActionEvent, fireActionEvent, fireActionEvent, getActionCommand, getBean, getBeanClass, getDecorator, getNullObject, getProperty, getValidationErrors, getValidators, getValue, isBound, isMarkedInvalid, isRequired, isValid, markInvalid, markValid, preRender, removeValidator, setBean, setBeanClass, setDecorator, setNullObject, setProperty, setRequired, setValue, traceValue, validate
 
Methods inherited from class nextapp.echo.AbstractComponent
add, add, addHierarchyListener, addPropertyChangeListener, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getClientId, getComponent, getComponentCount, getComponents, getEchoInstance, getForeground, getIdentifier, getListenerList, getLocale, getParent, indexOf, init, isAncestorOf, isDifferent, isEnabled, isFocused, isRecursivelyVisible, isRegistered, isSelectableForScriptRecorder, isShowing, isVisible, processHierarchyEvent, remove, remove, removeAll, removeHierarchyListener, removePropertyChangeListener, setBackground, setClientId, setEnabled, setForeground, setIdentifier, setLocale, setParent, setRegistered, setSelectableForScriptRecorder, setVisible, update
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface net.sf.jzeno.echo.EventSource
getActionCommand
 

Field Detail

TOP

public static final int TOP
See Also:
Constant Field Values

CENTER

public static final int CENTER
See Also:
Constant Field Values

BOTTOM

public static final int BOTTOM
See Also:
Constant Field Values

LEFT

public static final int LEFT
See Also:
Constant Field Values

RIGHT

public static final int RIGHT
See Also:
Constant Field Values
Constructor Detail

DynaCheckBox

public DynaCheckBox()

Creates an unbound component.


DynaCheckBox

public DynaCheckBox(java.lang.Class beanClass,
                    java.lang.String propertyName,
                    java.lang.String constructionHints)

Creates a databound checkbox. You should bind it to a boolean or Boolean property.

Method Detail

rebind

public void rebind()
Description copied from interface: RebindableComponent

This operation causes the component to reset it's content to that of the domain model.

Specified by:
rebind in interface RebindableComponent
Overrides:
rebind in class CustomComponent

propertyChange

public void propertyChange(java.beans.PropertyChangeEvent evt)

Used internally.

Specified by:
propertyChange in interface java.beans.PropertyChangeListener

isReadOnly

public boolean isReadOnly()

Returns whether or not this checkbox is read-only. If a checkbox is read-only it only visualizes the boolean it is bound to, but the user can not change the state of the checkbox.

Specified by:
isReadOnly in interface PropertyComponent
Overrides:
isReadOnly in class CustomComponent

setReadOnly

public void setReadOnly(boolean readOnly)

Sets whether or not this checkbox is read-only. If a checkbox is read-only it only visualizes the boolean it is bound to, but the user can not change the state of the checkbox. The checkbox will be disabled.

It is also possible to specify the same, with inverse logic, through the enabled property. This method is needed because all PropertyComponent implementations must support it.

Specified by:
setReadOnly in interface PropertyComponent
Overrides:
setReadOnly in class CustomComponent

setText

public void setText(java.lang.String text)

Sets the label that appears after the checkbox.


getText

public java.lang.String getText()

Gets the label that appears after the checkbox.


setToolTipText

public void setToolTipText(java.lang.String tip)

Sets the tooltip that appears when the user hoovers over the checkbox.


getToolTipText

public java.lang.String getToolTipText()

Gets the tooltip that appears when the user hoovers over the checkbox.


setSelected

public void setSelected(boolean selected)
Deprecated. write to the boolean property you've bound this checkbox to.

Sets the selection state of the checkbox. The same effect can be achieved by changing the boolean property that this checkbox is bound to. We advise you to do this, instead of using the setSelected method.


isSelected

public boolean isSelected()
Deprecated. read the boolean property you've bound this checkbox to.

Gets the selection state of the checkbox. The same effect can be achieved by reading the boolean property that this checkbox is bound to. We advise you to do this, instead of using the isSelected method.


setFocused

public void setFocused(boolean focused)

Sets the input focus on this component

Specified by:
setFocused in interface Component
Overrides:
setFocused in class AbstractComponent
Parameters:
focused - True if the component is to be focused.

setActionCommand

public void setActionCommand(java.lang.String command)
Specified by:
setActionCommand in interface EventSource
Overrides:
setActionCommand in class CustomComponent

actionPerformed

public void actionPerformed(ActionEvent e)
Description copied from interface: ActionListener
Invoked when an action occurs.

Specified by:
actionPerformed in interface ActionListener
Parameters:
e - The event describing the action.

setStateMargin

public void setStateMargin(int i)
Sets the size of the margin to be displayed between the state indicator of the toggle button and its icon and text.

Parameters:
newValue - The size of the margin between the state indicator and the toggle button's text, in pixels.

getStateMargin

public int getStateMargin()

applyStyle

public void applyStyle(Style style)
Description copied from interface: Component
Sets stylistic properties of this component based on a Style object. The version of this method in Component will set foreground and background colors and the font from the style if they are present. Components should override this method if they allow more properties to be set from a style object, and should call super.applyStyle() if necessary.

Specified by:
applyStyle in interface Component
Overrides:
applyStyle in class AbstractComponent
Parameters:
style - The style object from which to retrieve properties for this Component.

applyContext

public void applyContext()
Specified by:
applyContext in interface Precreation

isAsync

public boolean isAsync()

setAsync

public void setAsync(boolean async)

setFont

public void setFont(Font font)
Description copied from interface: Component
Sets the font of the component.

Specified by:
setFont in interface Component
Overrides:
setFont in class AbstractComponent
Parameters:
font - The new font of the component.

getFont

public Font getFont()
Description copied from interface: Component
Returns the font.

Specified by:
getFont in interface Component
Overrides:
getFont in class AbstractComponent
Returns:
The font of the component.

getCssClass

public java.lang.String getCssClass()

setCssClass

public void setCssClass(java.lang.String cssClass)

getCssClassDisabled

public java.lang.String getCssClassDisabled()

setCssClassDisabled

public void setCssClassDisabled(java.lang.String cssClass)