edu.neu.ccs.gui
Class BooleanView

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 byedu.neu.ccs.gui.BooleanView
All Implemented Interfaces:
Accessible, Displayable, ImageObserver, ItemSelectable, JPTConstants, MenuContainer, Serializable, SwingConstants, TypedView

public class BooleanView
extends JCheckBox
implements TypedView, JPTConstants

A TypedView for the input of a boolean value.

Since:
1.0
Version:
2.3.3
See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class javax.swing.JCheckBox
JCheckBox.AccessibleJCheckBox
 
Nested classes inherited from class javax.swing.JToggleButton
JToggleButton.AccessibleJToggleButton, JToggleButton.ToggleButtonModel
 
Nested classes inherited from class javax.swing.AbstractButton
AbstractButton.AccessibleAbstractButton, AbstractButton.ButtonChangeListener
 
Nested classes inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Nested classes inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
static String BOOLEAN_VALUE
          Bound property name for the boolean value property.
protected  boolean defaultValue
          The default value for this input object.
protected  InputProperties properties
          Property list for this view object.
 
Fields inherited from class javax.swing.JCheckBox
BORDER_PAINTED_FLAT_CHANGED_PROPERTY
 
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 javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Container
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface edu.neu.ccs.gui.TypedView
DATA_TYPE
 
Fields inherited from interface edu.neu.ccs.gui.Displayable
DEFAULT_VIEW_STATE, VIEW_STATE
 
Fields inherited from interface edu.neu.ccs.util.JPTConstants
ABOVE, ALIGNMENT, BELOW, BOTTOM_LEFT, BOTTOM_RIGHT, DEFAULT, FONT, INPUT_PROPERTIES, MANDATORY, OPTIONAL, ORIENTATION, TOP_LEFT, TOP_RIGHT, VALUE
 
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
BooleanView(String labelText)
          Constructs a view with the given label and a default value of true.
BooleanView(String labelText, Action action)
          Constructs a view with the given label and a default value of true that will execute the given action when clicked.
BooleanView(String labelText, Action action, boolean b)
          Constructs a view with the given label and the given default value that will execute the given action when clicked.
BooleanView(String labelText, boolean b)
          Constructs a view with the given label and the given default value.
 
Method Summary
 Stringable demandObject()
          Returns an XBoolean object whose state is set to the view state of this view.
 boolean getBooleanValue()
          Returns the boolean value that is the model for this view.
 Class getDataType()
          Returns the XBoolean class object.
static Font getDefaultFont()
          Returns the default font for a JCheckBox.
 String getDefaultViewState()
          Returns the String "true" or the String "false" corresponding with the default view state of this object.
 InputProperties getInputProperties()
          Returns the input properties for this view.
 String getViewState()
          Returns the String "true" or the String "false", corresponding with the view state of this object.
protected static boolean parseBoolean(String data, String caller)
          Returns the boolean value represented by the given String data.
 void refreshComponent()
          Refreshes the component by repacking the parent window.
 Stringable requestObject()
          Returns an XBoolean object whose state is set to the view state of this view.
 void reset()
          Resets the view state of this object to the default view state for this object.
 void setBooleanValue(boolean b)
          Sets the boolean value that is the model for this view to the given value.
 void setDefaultViewState(String data)
          Sets the default view state for this view to the boolean value represented by the given String data.
 void setFont(Font font)
          Sets the font for this component.
 void setInputProperties(InputProperties p)
          Sets the input properties for this view to the provided input properties.
 void setViewState(String data)
          Sets the view state for this view to the boolean value represented by the given String data.
 
Methods inherited from class javax.swing.JCheckBox
configurePropertiesFromAction, createActionPropertyChangeListener, getAccessibleContext, getUIClassID, isBorderPaintedFlat, paramString, setBorderPaintedFlat, updateUI
 
Methods inherited from class javax.swing.AbstractButton
addActionListener, addChangeListener, addItemListener, checkHorizontalKey, checkVerticalKey, createActionListener, 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, setMargin, setMnemonic, setMnemonic, setModel, setMultiClickThreshhold, setPressedIcon, setRolloverEnabled, setRolloverIcon, setRolloverSelectedIcon, setSelected, setSelectedIcon, setText, 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, 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, getPropertyChangeListeners, getPropertyChangeListeners, 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, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, 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, addImpl, 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, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setLayout, transferFocusBackward, 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, 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, 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, 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
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface edu.neu.ccs.gui.Displayable
setEnabled
 

Field Detail

BOOLEAN_VALUE

public static final String BOOLEAN_VALUE
Bound property name for the boolean value property.

See Also:
Constant Field Values

defaultValue

protected boolean defaultValue
The default value for this input object.


properties

protected InputProperties properties
Property list for this view object.

Constructor Detail

BooleanView

public BooleanView(String labelText)
Constructs a view with the given label and a default value of true.

Parameters:
labelText - the text for the label
See Also:
BooleanView(String, boolean), BooleanView(String, Action), BooleanView(String, Action, boolean)

BooleanView

public BooleanView(String labelText,
                   boolean b)
Constructs a view with the given label and the given default value.

Parameters:
labelText - the text for the label
b - the default value
See Also:
BooleanView(String), BooleanView(String, Action), BooleanView(String, Action, boolean)

BooleanView

public BooleanView(String labelText,
                   Action action)
Constructs a view with the given label and a default value of true that will execute the given action when clicked.

Parameters:
labelText - the text for the label
action - the action to execute when the button is clicked
See Also:
BooleanView(String), BooleanView(String, boolean), BooleanView(String, Action, boolean)

BooleanView

public BooleanView(String labelText,
                   Action action,
                   boolean b)
Constructs a view with the given label and the given default value that will execute the given action when clicked.

Parameters:
labelText - the text for the label
action - the action to execute when the button is clicked
b - the default value
See Also:
BooleanView(String), BooleanView(String, boolean), BooleanView(String, Action)
Method Detail

demandObject

public Stringable demandObject()
Returns an XBoolean object whose state is set to the view state of this view.

Specified by:
demandObject in interface TypedView
Returns:
a Stringable model object
See Also:
requestObject(), TypedView

requestObject

public Stringable requestObject()
Returns an XBoolean object whose state is set to the view state of this view.

Specified by:
requestObject in interface TypedView
Returns:
a Stringable model object
See Also:
demandObject(), TypedView

setInputProperties

public void setInputProperties(InputProperties p)
Description copied from interface: TypedView

Sets the input properties for this view to the provided input properties.

If the given input properties list is null, the property list for this view is set to the base property list containing default property values.

Specified by:
setInputProperties in interface TypedView
Parameters:
p - the new input properties for the view
See Also:
TypedView.getInputProperties()

getInputProperties

public InputProperties getInputProperties()
Description copied from interface: TypedView
Returns the input properties for this view.

Specified by:
getInputProperties in interface TypedView
Returns:
the input properties
See Also:
TypedView.setInputProperties(InputProperties)

getDataType

public Class getDataType()
Returns the XBoolean class object.

Specified by:
getDataType in interface TypedView
Returns:
the current class of a model object
See Also:
TypedView

setViewState

public void setViewState(String data)
Sets the view state for this view to the boolean value represented by the given String data.

Specified by:
setViewState in interface Displayable
Parameters:
data - the new view state
See Also:
getViewState(), Displayable

getViewState

public String getViewState()
Returns the String "true" or the String "false", corresponding with the view state of this object.

Specified by:
getViewState in interface Displayable
Returns:
the view state as a String
See Also:
setViewState(String), Displayable

setDefaultViewState

public void setDefaultViewState(String data)
Sets the default view state for this view to the boolean value represented by the given String data.

Specified by:
setDefaultViewState in interface Displayable
Parameters:
data - the new default view state
See Also:
reset(), Displayable

getDefaultViewState

public String getDefaultViewState()
Returns the String "true" or the String "false" corresponding with the default view state of this object.

Specified by:
getDefaultViewState in interface Displayable
Returns:
the default view state as a String
See Also:
setDefaultViewState(String), reset()

reset

public void reset()
Description copied from interface: Displayable

Resets the view state of this object to the default view state for this object.

Equivalent to: setViewState(getDefaultViewState()).

Specified by:
reset in interface Displayable
See Also:
Displayable.setViewState(String), Displayable.getDefaultViewState()

setBooleanValue

public void setBooleanValue(boolean b)

Sets the boolean value that is the model for this view to the given value.

Fires property change BOOLEAN_VALUE.

Parameters:
b - the new value
See Also:
getBooleanValue()

getBooleanValue

public boolean getBooleanValue()
Returns the boolean value that is the model for this view.

See Also:
setBooleanValue(boolean)

setFont

public void setFont(Font font)

Sets the font for this component.

If the given font is null then it is set to getDefaultFont().

Calls the super setFont method and then refreshes the component in its parent view.

Fires property change FONT.

Parameters:
font - the font to set for this view

getDefaultFont

public static Font getDefaultFont()
Returns the default font for a JCheckBox.

Since:
2.3.3

refreshComponent

public void refreshComponent()
Refreshes the component by repacking the parent window.


parseBoolean

protected static boolean parseBoolean(String data,
                                      String caller)
Returns the boolean value represented by the given String data.

Parameters:
data - the data String to be parsed
caller - the name of the method that requires parsing
Throws:
JPTError - if there is an error parsing the data