java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.AbstractButton
javax.swing.JToggleButton
javax.swing.JCheckBox
org.scopemvc.view.swing.SCheckBox
- All Implemented Interfaces:
- javax.accessibility.Accessible, java.util.EventListener, java.awt.image.ImageObserver, java.awt.event.ItemListener, java.awt.ItemSelectable, java.awt.MenuContainer, org.scopemvc.view.util.ModelBindable, org.scopemvc.core.PropertyView, Refreshable, java.io.Serializable, javax.swing.SwingConstants, org.scopemvc.core.View
- public class SCheckBox
- extends javax.swing.JCheckBox
- implements org.scopemvc.core.PropertyView, java.awt.event.ItemListener, org.scopemvc.view.util.ModelBindable, Refreshable
A JCheckbox linked to a Boolean or boolean property of a bound model object.
Updates to the checkbox result in changes to the
model property immediately.
Note that the Selector specified for a SCheckbox must
select a single Boolean or boolean property.
Checkbox responds to the bound model or the particular
bound property becoming read-only by disabling itself.
A SCheckbox is also disabled if it has no bound model or
property, or the property is a null Boolean.
SCheckbox can issue a Control when the checkbox
changes state.
- Version:
- $Revision: 1.3 $ $Date: 2002/01/26 09:46:20 $
| Nested classes inherited from class javax.swing.JCheckBox |
javax.swing.JCheckBox.AccessibleJCheckBox |
| Nested classes inherited from class javax.swing.JToggleButton |
javax.swing.JToggleButton.AccessibleJToggleButton, javax.swing.JToggleButton.ToggleButtonModel |
| Nested classes inherited from class javax.swing.AbstractButton |
javax.swing.AbstractButton.AccessibleAbstractButton, javax.swing.AbstractButton.ButtonChangeListener |
| Nested classes inherited from class javax.swing.JComponent |
javax.swing.JComponent.AccessibleJComponent |
| Nested classes inherited from class java.awt.Container |
java.awt.Container.AccessibleAWTContainer |
| Nested classes inherited from class java.awt.Component |
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy |
| Fields inherited from class javax.swing.AbstractButton |
actionListener, BORDER_PAINTED_CHANGED_PROPERTY, changeEvent, changeListener, 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, itemListener, MARGIN_CHANGED_PROPERTY, MNEMONIC_CHANGED_PROPERTY, model, 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 java.awt.Container |
|
| 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 |
| Methods inherited from class javax.swing.AbstractButton |
addActionListener, addChangeListener, addImpl, addItemListener, checkHorizontalKey, checkVerticalKey, configurePropertiesFromAction, createActionListener, createActionPropertyChangeListener, createChangeListener, createItemListener, doClick, doClick, fireActionPerformed, fireItemStateChanged, fireStateChanged, 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, init, isBorderPainted, isContentAreaFilled, isFocusPainted, isRolloverEnabled, isSelected, paintBorder, removeActionListener, removeChangeListener, removeItemListener, setAction, setActionCommand, setBorderPainted, setContentAreaFilled, setDisabledIcon, setDisabledSelectedIcon, setDisplayedMnemonicIndex, setEnabled, setFocusPainted, setHorizontalAlignment, setHorizontalTextPosition, setIcon, setIconTextGap, setLabel, setLayout, setMargin, setMnemonic, setMnemonic, setModel, setMultiClickThreshhold, setPressedIcon, setRolloverEnabled, setRolloverIcon, setRolloverSelectedIcon, setSelectedIcon, setText, setUI, setVerticalAlignment, setVerticalTextPosition |
| Methods inherited from class javax.swing.JComponent |
addAncestorListener, addNotify, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update |
| Methods inherited from class java.awt.Container |
add, add, add, add, add, addContainerListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, transferFocusDownCycle, validate, validateTree |
| Methods inherited from class java.awt.Component |
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, 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, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle |
LOG
private static final org.apache.commons.logging.Log LOG
boundModel
private SwingBoundModel boundModel
- Helper to manage model to view binding.
validationHelper
private ValidationHelper validationHelper
- Helper to manage validation state.
controlID
private java.lang.String controlID
- ID of the Control issued when checkbox changes state.
valueIsNull
private boolean valueIsNull
- SCheckbox can "hold" a null when bound to a
Boolean property that happens to be null.
SCheckBox
public SCheckBox()
getBoundModel
public final java.lang.Object getBoundModel()
- Specified by:
getBoundModel in interface org.scopemvc.core.View
setBoundModel
public final void setBoundModel(java.lang.Object inModel)
- Specified by:
setBoundModel in interface org.scopemvc.core.View
getSelector
public final org.scopemvc.core.Selector getSelector()
- Specified by:
getSelector in interface org.scopemvc.core.PropertyView
setSelector
public final void setSelector(org.scopemvc.core.Selector inSelector)
- Specified by:
setSelector in interface org.scopemvc.core.PropertyView
setSelectorString
public final void setSelectorString(java.lang.String inSelectorString)
updateFromProperty
public void updateFromProperty(java.lang.Object inValue,
boolean inReadOnly)
- Incoming value is a Boolean or null.
- Specified by:
updateFromProperty in interface org.scopemvc.view.util.ModelBindable
setSelected
public void setSelected(boolean b)
- Description copied from class:
javax.swing.AbstractButton
- Set the value of the button's "selected" property. Selection is only
meaningful for toggle-type buttons (check boxes, radio buttons).
getViewValue
public java.lang.Object getViewValue()
- Description copied from interface:
org.scopemvc.view.util.ModelBindable
- Get the current value (what would be set
as a property of the bound model object)
being presented on the View.
- Specified by:
getViewValue in interface org.scopemvc.view.util.ModelBindable
validationFailed
public void validationFailed(java.lang.Exception inException)
- Description copied from interface:
org.scopemvc.view.util.ModelBindable
- Validation failed while getting a value from View into
the bound model object. Use this to indicate to the user that the
value being edited is invalid.
- Specified by:
validationFailed in interface org.scopemvc.view.util.ModelBindable
validationSuccess
public void validationSuccess()
- Description copied from interface:
org.scopemvc.view.util.ModelBindable
- Clear previous validation failure.
- Specified by:
validationSuccess in interface org.scopemvc.view.util.ModelBindable
createToolTip
public javax.swing.JToolTip createToolTip()
- Description copied from class:
javax.swing.JComponent
- Return the
toolTip property of this component, creating it and
setting it if it is currently null. This method can be
overridden in subclasses which wish to control the exact form of
tooltip created.
itemStateChanged
public void itemStateChanged(java.awt.event.ItemEvent inEvent)
- Description copied from interface:
java.awt.event.ItemListener
- This method is called when an item's state is changed.
- Specified by:
itemStateChanged in interface java.awt.event.ItemListener
setControlID
public final void setControlID(java.lang.String inControlID)
- Set the ID of the Control that will be issued when
state changes. If null no Control will be issued.
setController
public void setController(org.scopemvc.core.Controller inController)
- Don't assign a Controller to SCheckBox, instead delegate
to the containing SwingView that has a parent Controller.
- Specified by:
setController in interface org.scopemvc.core.View
getController
public org.scopemvc.core.Controller getController()
- Don't assign a Controller to SCheckBox, instead delegate
to the containing SwingView that has a parent Controller.
- Specified by:
getController in interface org.scopemvc.core.View
issueControl
public void issueControl(org.scopemvc.core.Control inControl)
- Don't assign a Controller to SCheckBox, instead delegate
to the containing SwingView that has a parent Controller.
- Specified by:
issueControl in interface org.scopemvc.core.View
refresh
public void refresh()
- Description copied from interface:
Refreshable
- Update the widget with the current state of the bound model.
Probably something like this:
Object propertyValue = boundModel.getPropertyValue();
boolean propertyReadOnly = boundModel.getPropertyReadOnly();
updateFromProperty(propertyValue, propertyReadOnly);
- Specified by:
refresh in interface Refreshable