org.openswing.swing.client
Class CheckBoxControl

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjavax.swing.JComponent
              extended byjavax.swing.AbstractButton
                  extended byjavax.swing.JToggleButton
                      extended byjavax.swing.JCheckBox
                          extended byorg.openswing.swing.client.CheckBoxControl
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.image.ImageObserver, InputControl, java.awt.ItemSelectable, java.awt.MenuContainer, java.io.Serializable, javax.swing.SwingConstants

public class CheckBoxControl
extends javax.swing.JCheckBox
implements InputControl

Title: OpenSwing Framework

Description: check-box whose text is translated according to internalization settings. As default behavior, check-box supports two states: Boolean.TRUE (selected) and Boolean.FALSE (deselected). Optionally (when "allowNullValue" property has been set to true), check-box supports three states: Boolean.TRUE (selected) and Boolean.FALSE (deselected) and null (not selected and gray).

Copyright: Copyright (C) 2006 Mauro Carniel

This file is part of OpenSwing Framework. This library is free software; you can redistribute it and/or modify it under the terms of the (LGPL) Lesser General Public License as published by the Free Software Foundation; GNU LESSER GENERAL PUBLIC LICENSE Version 2.1, February 1999 This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. The author may be contacted at: maurocarniel@tin.it

See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class javax.swing.JToggleButton
javax.swing.JToggleButton.ToggleButtonModel
 
Nested classes inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Field Summary
 
Fields inherited from class javax.swing.JCheckBox
BORDER_PAINTED_FLAT_CHANGED_PROPERTY
 
Fields inherited from class javax.swing.AbstractButton
BORDER_PAINTED_CHANGED_PROPERTY, CONTENT_AREA_FILLED_CHANGED_PROPERTY, DISABLED_ICON_CHANGED_PROPERTY, DISABLED_SELECTED_ICON_CHANGED_PROPERTY, FOCUS_PAINTED_CHANGED_PROPERTY, HORIZONTAL_ALIGNMENT_CHANGED_PROPERTY, HORIZONTAL_TEXT_POSITION_CHANGED_PROPERTY, ICON_CHANGED_PROPERTY, MARGIN_CHANGED_PROPERTY, MNEMONIC_CHANGED_PROPERTY, MODEL_CHANGED_PROPERTY, PRESSED_ICON_CHANGED_PROPERTY, ROLLOVER_ENABLED_CHANGED_PROPERTY, ROLLOVER_ICON_CHANGED_PROPERTY, ROLLOVER_SELECTED_ICON_CHANGED_PROPERTY, SELECTED_ICON_CHANGED_PROPERTY, TEXT_CHANGED_PROPERTY, VERTICAL_ALIGNMENT_CHANGED_PROPERTY, VERTICAL_TEXT_POSITION_CHANGED_PROPERTY
 
Fields inherited from class javax.swing.JComponent
TOOL_TIP_TEXT_KEY, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface javax.swing.SwingConstants
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
CheckBoxControl()
           
 
Method Summary
 void addValueChangedListener(ValueChangeListener listener)
          Add a value changed listener to this input control.
 java.lang.String getAttributeName()
          Link the input control to the form which contains it and with the specified the attribute.
 java.awt.Font getFont()
           
 LabelControl getLinkLabel()
          Link the input control to the form which contains it and with the specified the attribute.
 java.lang.String getToolTipText()
           
 java.lang.Object getValue()
           
 ValueChangeListener[] getValueChangeListeners()
           
 boolean isAllowNullValue()
           
 boolean isCanCopy()
           
 boolean isChanged()
           
 boolean isEnabledOnEdit()
           
 boolean isEnabledOnInsert()
           
 boolean isRequired()
           
 void removeValueChangedListener(ValueChangeListener listener)
          Remove a value changed listener from this input control.
 void setAllowNullValue(boolean allowNullValue)
          Define if null value is alloed (i.e. distinct from Boolean.FALSE value)
 void setAttributeName(java.lang.String attributeName)
          Link the input control to the form which contains it and with the specified the attribute.
 void setCanCopy(boolean canCopy)
          Define if the input control value is duplicated when user has clicked on COPY button.
 void setChanged(boolean changed)
          Define if the input control value is changed.
 void setEnabled(boolean enabled)
          Set abilitation setting.
 void setEnabledOnEdit(boolean enabled)
          Define if the input control is enabled on EDIT mode, false otherwise
 void setEnabledOnInsert(boolean enabled)
          Define if the input control is enabled on INSERT mode.
 void setFont(java.awt.Font font)
          Set the specified font.
 void setLinkLabel(LabelControl label)
          Link the input control label to the specified label.
 void setSelected(boolean selected)
           
 void setText(java.lang.String text)
          Set check box label.
 void setToolTipText(java.lang.String toolTipText)
          Set a tooltip text.
 void setValue(java.lang.Object value)
          Set value to the input control.
 
Methods inherited from class javax.swing.JCheckBox
getAccessibleContext, getUIClassID, isBorderPaintedFlat, setBorderPaintedFlat, updateUI
 
Methods inherited from class javax.swing.AbstractButton
addActionListener, addChangeListener, addItemListener, doClick, doClick, getAction, getActionCommand, getActionListeners, getChangeListeners, getDisabledIcon, getDisabledSelectedIcon, getDisplayedMnemonicIndex, getHorizontalAlignment, getHorizontalTextPosition, getIcon, getIconTextGap, getItemListeners, getLabel, getMargin, getMnemonic, getModel, getMultiClickThreshhold, getPressedIcon, getRolloverIcon, getRolloverSelectedIcon, getSelectedIcon, getSelectedObjects, getText, getUI, getVerticalAlignment, getVerticalTextPosition, imageUpdate, isBorderPainted, isContentAreaFilled, isFocusPainted, isRolloverEnabled, isSelected, removeActionListener, removeChangeListener, removeItemListener, setAction, setActionCommand, setBorderPainted, setContentAreaFilled, setDisabledIcon, setDisabledSelectedIcon, setDisplayedMnemonicIndex, setFocusPainted, setHorizontalAlignment, setHorizontalTextPosition, setIcon, setIconTextGap, setLabel, setMargin, setMnemonic, setMnemonic, setModel, setMultiClickThreshhold, setPressedIcon, setRolloverEnabled, setRolloverIcon, setRolloverSelectedIcon, setSelectedIcon, setUI, setVerticalAlignment, setVerticalTextPosition
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintImmediately, paintImmediately, print, printAll, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setTransferHandler, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setLayout, transferFocusBackward, transferFocusDownCycle, validate
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, createImage, createImage, createVolatileImage, createVolatileImage, dispatchEvent, enable, enableInputMethods, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.openswing.swing.client.InputControl
addFocusListener, isEnabled, removeFocusListener
 

Constructor Detail

CheckBoxControl

public CheckBoxControl()
Method Detail

getFont

public final java.awt.Font getFont()
Specified by:
getFont in interface java.awt.MenuContainer
Returns:
current Font setting

setFont

public final void setFont(java.awt.Font font)
Set the specified font.

Parameters:
font - Font to set

setToolTipText

public final void setToolTipText(java.lang.String toolTipText)
Set a tooltip text. This text will be translated according to the internationalization settings.

Parameters:
toolTipText - tool tip text entry in the dictionary

getToolTipText

public final java.lang.String getToolTipText()
Returns:
tool tip text entry in the dictionary

addValueChangedListener

public final void addValueChangedListener(ValueChangeListener listener)
Add a value changed listener to this input control.

Specified by:
addValueChangedListener in interface InputControl
Parameters:
listener - value changed listener to add

removeValueChangedListener

public final void removeValueChangedListener(ValueChangeListener listener)
Remove a value changed listener from this input control.

Specified by:
removeValueChangedListener in interface InputControl
Parameters:
listener - value changed listener to remove

setAttributeName

public final void setAttributeName(java.lang.String attributeName)
Link the input control to the form which contains it and with the specified the attribute.

Specified by:
setAttributeName in interface InputControl
Parameters:
attributeName - attribute name to which link the input control

getAttributeName

public final java.lang.String getAttributeName()
Link the input control to the form which contains it and with the specified the attribute.

Specified by:
getAttributeName in interface InputControl

isRequired

public final boolean isRequired()
Specified by:
isRequired in interface InputControl
Returns:
mandatory property of the input control

setLinkLabel

public final void setLinkLabel(LabelControl label)
Link the input control label to the specified label.

Specified by:
setLinkLabel in interface InputControl
Parameters:
label - label used when showing error messages related to the input control

getLinkLabel

public final LabelControl getLinkLabel()
Link the input control to the form which contains it and with the specified the attribute.

Specified by:
getLinkLabel in interface InputControl
Returns:
label used when showing error messages related to the input control

isEnabledOnInsert

public final boolean isEnabledOnInsert()
Specified by:
isEnabledOnInsert in interface InputControl
Returns:
true if the input control is enabled on INSERT mode, false otherwise

setEnabledOnInsert

public final void setEnabledOnInsert(boolean enabled)
Define if the input control is enabled on INSERT mode.

Specified by:
setEnabledOnInsert in interface InputControl
Parameters:
enabled - true if the input control is enabled on INSERT mode, false otherwise

isEnabledOnEdit

public final boolean isEnabledOnEdit()
Specified by:
isEnabledOnEdit in interface InputControl
Returns:
true if the input control is enabled on EDIT mode, false otherwise

setEnabledOnEdit

public final void setEnabledOnEdit(boolean enabled)
Define if the input control is enabled on EDIT mode, false otherwise

Specified by:
setEnabledOnEdit in interface InputControl
Parameters:
enabled - mandatory property of the input control

isCanCopy

public final boolean isCanCopy()
Specified by:
isCanCopy in interface InputControl
Returns:
define if the input control value is duplicated when user has clicked on COPY button

setCanCopy

public final void setCanCopy(boolean canCopy)
Define if the input control value is duplicated when user has clicked on COPY button.

Specified by:
setCanCopy in interface InputControl
Parameters:
canCopy - define if the input control value is duplicated when user has clicked on COPY button

getValue

public final java.lang.Object getValue()
Specified by:
getValue in interface InputControl
Returns:
value related to the input control

setValue

public final void setValue(java.lang.Object value)
Set value to the input control.

Specified by:
setValue in interface InputControl
Parameters:
value - value to set into the input control

isChanged

public final boolean isChanged()
Specified by:
isChanged in interface InputControl
Returns:
true if the input control value is changed, false otherwise

setChanged

public final void setChanged(boolean changed)
Define if the input control value is changed.

Specified by:
setChanged in interface InputControl
Parameters:
changed - true if the input control value is changed, false otherwise

setEnabled

public final void setEnabled(boolean enabled)
Set abilitation setting.

Specified by:
setEnabled in interface InputControl
Parameters:
enabled - flag used to set abilitation of control

setText

public final void setText(java.lang.String text)
Set check box label.

Parameters:
text - check box label

isAllowNullValue

public final boolean isAllowNullValue()
Returns:
define if null value is alloed (i.e. distinct from Boolean.FALSE value)

setAllowNullValue

public final void setAllowNullValue(boolean allowNullValue)
Define if null value is alloed (i.e. distinct from Boolean.FALSE value)

Parameters:
allowNullValue - define if null value is alloed (i.e. distinct from Boolean.FALSE value)

setSelected

public final void setSelected(boolean selected)

getValueChangeListeners

public final ValueChangeListener[] getValueChangeListeners()
Specified by:
getValueChangeListeners in interface InputControl
Returns:
value changed listeners list