com.gsoft.titration.client
Class DateButton

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--javax.swing.AbstractButton
                          |
                          +--javax.swing.JButton
                                |
                                +--com.gsoft.titration.client.DateButton

public class DateButton
extends JButton

Custom button for entering dates. The DateButton class
is just a standard button that defines an additional bound
property: "date". The button displays the date property as its
label. When clicked, it does not generate an
ActionEvent, but displays a DateChooser dialog
instead, that allows you to change the date. When the date is
changed, a PropertyChangeEvent is generated, according
the contract for bound properties.


Field Summary
 private Datedate
          Date property.
 private final static DateChooserDATE_CHOOSER
          DateChooser instance to use to change the date.
 private final static DateFormatDATE_FORMAT
          Format to use to display the date property.

Fields inherited from class javax.swing.AbstractButton
MODEL_CHANGED_PROPERTY, TEXT_CHANGED_PROPERTY, MNEMONIC_CHANGED_PROPERTY, MARGIN_CHANGED_PROPERTY, VERTICAL_ALIGNMENT_CHANGED_PROPERTY, HORIZONTAL_ALIGNMENT_CHANGED_PROPERTY, VERTICAL_TEXT_POSITION_CHANGED_PROPERTY, HORIZONTAL_TEXT_POSITION_CHANGED_PROPERTY, BORDER_PAINTED_CHANGED_PROPERTY, FOCUS_PAINTED_CHANGED_PROPERTY, ROLLOVER_ENABLED_CHANGED_PROPERTY, CONTENT_AREA_FILLED_CHANGED_PROPERTY, ICON_CHANGED_PROPERTY, PRESSED_ICON_CHANGED_PROPERTY, SELECTED_ICON_CHANGED_PROPERTY, ROLLOVER_ICON_CHANGED_PROPERTY, ROLLOVER_SELECTED_ICON_CHANGED_PROPERTY, DISABLED_ICON_CHANGED_PROPERTY, DISABLED_SELECTED_ICON_CHANGED_PROPERTY, model, changeListener, actionListener, itemListener, changeEvent

Fields inherited from class javax.swing.JComponent
ui, listenerList, WHEN_FOCUSED, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_IN_FOCUSED_WINDOW, UNDEFINED_CONDITION, TOOL_TIP_TEXT_KEY, accessibleContext

Fields inherited from class java.awt.Component
TOP_ALIGNMENT, CENTER_ALIGNMENT, BOTTOM_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT

Constructor Summary
DateButton(Date date)
          Constructs a new DateButton object with a given
date.
DateButton()
          Constructs a new DateButton object with the system
date as the initial date.

Method Summary
 protected voidfireActionPerformed(ActionEvent e)
          Called when the button is clicked, in order to fire an
ActionEvent.
 DategetDate()
          Gets the value of the date property.
 voidsetDate(Date date)
          Sets the valus of the date property.

Methods inherited from class javax.swing.JButton
updateUI, getUIClassID, isDefaultButton, isDefaultCapable, setDefaultCapable, removeNotify, configurePropertiesFromAction, paramString, getAccessibleContext

Methods inherited from class javax.swing.AbstractButton
getText, setText, isSelected, setSelected, doClick, doClick, setMargin, getMargin, getIcon, setIcon, getPressedIcon, setPressedIcon, getSelectedIcon, setSelectedIcon, getRolloverIcon, setRolloverIcon, getRolloverSelectedIcon, setRolloverSelectedIcon, getDisabledIcon, setDisabledIcon, getDisabledSelectedIcon, setDisabledSelectedIcon, getVerticalAlignment, setVerticalAlignment, getHorizontalAlignment, setHorizontalAlignment, getVerticalTextPosition, setVerticalTextPosition, getHorizontalTextPosition, setHorizontalTextPosition, checkHorizontalKey, checkVerticalKey, setActionCommand, getActionCommand, setAction, getAction, createActionPropertyChangeListener, isBorderPainted, setBorderPainted, paintBorder, isFocusPainted, setFocusPainted, isContentAreaFilled, setContentAreaFilled, isRolloverEnabled, setRolloverEnabled, getMnemonic, setMnemonic, setMnemonic, isFocusTraversable, getModel, setModel, getUI, setUI, addChangeListener, removeChangeListener, fireStateChanged, addActionListener, removeActionListener, createChangeListener, fireItemStateChanged, createActionListener, createItemListener, setEnabled, getLabel, setLabel, addItemListener, removeItemListener, getSelectedObjects, init, imageUpdate

Methods inherited from class javax.swing.JComponent
setUI, getComponentGraphics, paintComponent, paintChildren, update, paint, printAll, print, printComponent, printChildren, printBorder, isPaintingTile, isFocusCycleRoot, isManagingFocus, setNextFocusableComponent, getNextFocusableComponent, setRequestFocusEnabled, isRequestFocusEnabled, requestFocus, grabFocus, setVerifyInputWhenFocusTarget, getVerifyInputWhenFocusTarget, setPreferredSize, getPreferredSize, setMaximumSize, getMaximumSize, setMinimumSize, getMinimumSize, isMinimumSizeSet, isPreferredSizeSet, isMaximumSizeSet, contains, setBorder, getBorder, getInsets, getInsets, getAlignmentY, setAlignmentY, getAlignmentX, setAlignmentX, setInputVerifier, getInputVerifier, getGraphics, setDebugGraphicsOptions, getDebugGraphicsOptions, registerKeyboardAction, registerKeyboardAction, unregisterKeyboardAction, getRegisteredKeyStrokes, getConditionForKeyStroke, getActionForKeyStroke, resetKeyboardActions, setInputMap, getInputMap, getInputMap, setActionMap, getActionMap, requestDefaultFocus, setVisible, hide, setForeground, setBackground, setFont, processFocusEvent, processComponentKeyEvent, processKeyEvent, processKeyBinding, setToolTipText, getToolTipText, getToolTipText, getToolTipLocation, createToolTip, scrollRectToVisible, setAutoscrolls, getAutoscrolls, processMouseMotionEvent, enable, disable, getClientProperty, putClientProperty, isLightweightComponent, reshape, getBounds, getSize, getLocation, getX, getY, getWidth, getHeight, hasFocus, isOpaque, setOpaque, computeVisibleRect, getVisibleRect, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, addPropertyChangeListener, addPropertyChangeListener, removePropertyChangeListener, removePropertyChangeListener, fireVetoableChange, addVetoableChangeListener, removeVetoableChangeListener, getTopLevelAncestor, addAncestorListener, removeAncestorListener, getListeners, addNotify, repaint, repaint, revalidate, isValidateRoot, isOptimizedDrawingEnabled, paintImmediately, paintImmediately, setDoubleBuffered, isDoubleBuffered, getRootPane

Methods inherited from class java.awt.Container
getComponentCount, countComponents, getComponent, getComponents, insets, add, add, add, add, add, addImpl, remove, remove, removeAll, getLayout, setLayout, doLayout, layout, invalidate, validate, validateTree, preferredSize, minimumSize, paintComponents, printComponents, addContainerListener, removeContainerListener, processEvent, processContainerEvent, deliverEvent, getComponentAt, locate, getComponentAt, findComponentAt, findComponentAt, isAncestorOf, list, list

Methods inherited from class java.awt.Component
getName, setName, getParent, getPeer, setDropTarget, getDropTarget, getGraphicsConfiguration, getTreeLock, getToolkit, isValid, isDisplayable, isVisible, isShowing, isEnabled, enable, enableInputMethods, show, show, getForeground, getBackground, getFont, getLocale, setLocale, getColorModel, getLocation, getLocationOnScreen, location, setLocation, move, setLocation, getSize, size, setSize, resize, setSize, resize, getBounds, bounds, setBounds, setBounds, isLightweight, getFontMetrics, setCursor, getCursor, paintAll, repaint, repaint, repaint, createImage, createImage, prepareImage, prepareImage, checkImage, checkImage, inside, contains, dispatchEvent, postEvent, addComponentListener, removeComponentListener, addFocusListener, removeFocusListener, addHierarchyListener, removeHierarchyListener, addHierarchyBoundsListener, removeHierarchyBoundsListener, addKeyListener, removeKeyListener, addMouseListener, removeMouseListener, addMouseMotionListener, removeMouseMotionListener, addInputMethodListener, removeInputMethodListener, getInputMethodRequests, getInputContext, enableEvents, disableEvents, coalesceEvents, processComponentEvent, processMouseEvent, processInputMethodEvent, processHierarchyEvent, processHierarchyBoundsEvent, handleEvent, mouseDown, mouseDrag, mouseUp, mouseMove, mouseEnter, mouseExit, keyDown, keyUp, action, gotFocus, lostFocus, transferFocus, nextFocus, add, remove, toString, list, list, list, setComponentOrientation, getComponentOrientation

Methods inherited from class java.lang.Object
getClass, hashCode, equals, clone, notify, notifyAll, wait, wait, wait, finalize

Field Detail

date

private Date date
Date property.

DATE_CHOOSER

private final static DateChooser DATE_CHOOSER
DateChooser instance to use to change the date.

DATE_FORMAT

private final static DateFormat DATE_FORMAT
Format to use to display the date property.
Constructor Detail

DateButton

public DateButton(Date date)
Constructs a new DateButton object with a given
date.
Parameters:
date initial date

DateButton

public DateButton()
Constructs a new DateButton object with the system
date as the initial date.
Method Detail

fireActionPerformed

protected void fireActionPerformed(ActionEvent e)
Called when the button is clicked, in order to fire an
ActionEvent. Displays the dialog to change the
date instead of generating the event and updates the date
property.
Parameters:
e ActionEvent to fire

getDate

public Date getDate()
Gets the value of the date property.
Returns: the current value of the date property

setDate

public void setDate(Date date)
Sets the valus of the date property.
Parameters:
date new value of the date property
Returns: the old value of the date property