com.retek.commons.gui.widget
Class RDateField

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjavax.swing.JComponent
              extended byjavax.swing.JPanel
                  extended bycom.retek.commons.gui.widget.RPanel
                      extended bycom.retek.commons.gui.widget.RDateField
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.event.ActionListener, java.util.EventListener, java.awt.event.FocusListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.beans.PropertyChangeListener, REventListener, java.io.Serializable, WidgetInterface

public class RDateField
extends RPanel
implements java.awt.event.ActionListener, java.awt.event.FocusListener, java.beans.PropertyChangeListener, WidgetInterface

This class sublcasses an RPanel and supplies a date field that consists of a text field and a button that triggers a popup calendar window. It acts just like any other widget.

Retek Inc. Copyright (c) 2002

See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
 
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
 
Field Summary
static java.lang.String DATE_SELECTED
           
static java.lang.String FOCUS_GAINED
           
static java.lang.String FOCUS_LOST
           
 
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.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
RDateField()
          Return new RDateField object.
RDateField(javax.swing.JDialog dialog)
          Return new RDateField object.
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent event)
          Implements the ActionListener method.
 void clear()
          Clears the date field of all information.
 void focusGained(java.awt.event.FocusEvent event)
          Implements the focus listener method.
 void focusLost(java.awt.event.FocusEvent event)
          Implements the focus listener method.
 java.lang.String getClusterName()
          Retrieves the cluster name of the widget.
 java.lang.String getName()
          Retrieve the name fo the component.
 java.lang.String getText()
          Retrieves the text in the date field.
 boolean isEmpty()
          Retrieves whether or not the date field is empty.
 boolean isErrorState()
          Retrieves whether or not the date field is in an error state.
 void propertyChange(java.beans.PropertyChangeEvent event)
          Implements the proerty change listener method.
 void refresh()
          Refreshes the text in the date field (this will reformat the text).
 void requestFocus()
          Transfers focus of the cursor to the date field.
 void selectAll()
          Selects all the text in the date field.
 void setBackground(java.awt.Color color)
           
 void setCalendarOwner(javax.swing.JDialog dialog)
          Assigns a JDialog as the calendar owner of the calendar.
 void setClusterName(java.lang.String name)
          Sets the cluster name of the widget.
 void setDate(RDate date)
          Sets the date represented by this date field.
 void setDate(java.lang.String dateText)
          Sets the date represented by this date field.
 void setEditable(boolean editable)
          Sets whether or not the date field is editable.
 void setEnabled(boolean enabled)
          Sets whether or not the date field is enabled.
 void setErrorState(boolean errorState)
          Sets whether or not the date field is in an error state.
 void setFocusedState()
          Sets the date field to focused state, updating colors.
 void setForeground(java.awt.Color color)
           
 void setFormatInvalid(boolean formatInvalid)
          Sets whether or not the date field currently contains invalidly formatted data.
 void setLength(int length)
          Sets the enterable length of the component.
 void setMask(Mask mask)
          Sets the formatting mask on the component.
 void setMinimumWidth(int width)
          Sets the minimum width of the component.
 void setName(java.lang.String name)
          Sets the name of the component.
 void updateColorState()
          Updates the color state.
 
Methods inherited from class com.retek.commons.gui.widget.RPanel
addREventListener, getFocusCycleComponents, notifyREventListeners, notifyREventListeners, performActionEvent, performErrorEvent, removeAllREventListeners, removeREventListener, repaintPanel, setEmptyBorder, setEmptyBorder, setFocusCycleComponents, setLineBorder, setLineBorder, setLoweredBevelBorder, setMinimumHeight, setRaisedBevelBorder, setTitleBorder, setTitleBorder, setTitleBorder, setTitleBorder
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
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, paintBorder, 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, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setFont, 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, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, 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, 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
 

Field Detail

FOCUS_GAINED

public static final java.lang.String FOCUS_GAINED
See Also:
Constant Field Values

FOCUS_LOST

public static final java.lang.String FOCUS_LOST
See Also:
Constant Field Values

DATE_SELECTED

public static final java.lang.String DATE_SELECTED
See Also:
Constant Field Values
Constructor Detail

RDateField

public RDateField()
Return new RDateField object.


RDateField

public RDateField(javax.swing.JDialog dialog)
Return new RDateField object.

Method Detail

setName

public void setName(java.lang.String name)
Sets the name of the component. This actually sets the name within the text field.

Specified by:
setName in interface WidgetInterface
Parameters:
name - The name to assign to this component.

getName

public java.lang.String getName()
Retrieve the name fo the component.

Specified by:
getName in interface WidgetInterface
Returns:
The name of the component.

setCalendarOwner

public void setCalendarOwner(javax.swing.JDialog dialog)
Assigns a JDialog as the calendar owner of the calendar.

Parameters:
dialog - The dialog to assign as the calendar owner.

getText

public java.lang.String getText()
Retrieves the text in the date field.

Returns:
The text is the date field.

setMask

public void setMask(Mask mask)
Sets the formatting mask on the component. This actually sets the mask on the text field within the component.

Parameters:
mask - A mask to assign to the component.

setLength

public void setLength(int length)
Sets the enterable length of the component. This represents the number of characters allowed in the date field. Once this value exceeds zero, the calendar button will become active.

Parameters:
length - The enterable length of the component.

setMinimumWidth

public void setMinimumWidth(int width)
Sets the minimum width of the component.

Parameters:
width - The minimum width (number of pixels).

setFormatInvalid

public void setFormatInvalid(boolean formatInvalid)
Sets whether or not the date field currently contains invalidly formatted data.

Parameters:
formatInvalid - True if the data is in an invalid format, false if valid.

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent event)
Implements the ActionListener method. This is called when the calendar button is pressed.

Specified by:
actionPerformed in interface java.awt.event.ActionListener

setDate

public void setDate(RDate date)
Sets the date represented by this date field. A null date will clear the field.

Parameters:
date - The date to assign to the date field.

setDate

public void setDate(java.lang.String dateText)
Sets the date represented by this date field. A null, empty or invalid date will clear the date field.

Parameters:
dateText - The date to assign to the date field.

isEmpty

public boolean isEmpty()
Retrieves whether or not the date field is empty.

Returns:
True if the text field is empty, false if not.

clear

public void clear()
Clears the date field of all information.


selectAll

public void selectAll()
Selects all the text in the date field.


refresh

public void refresh()
Refreshes the text in the date field (this will reformat the text).


requestFocus

public void requestFocus()
Transfers focus of the cursor to the date field.


setEnabled

public void setEnabled(boolean enabled)
Sets whether or not the date field is enabled. This disables/enables both the text field and the button when called.

Parameters:
enabled - True if the date field should be enabled, false if not.

setEditable

public void setEditable(boolean editable)
Sets whether or not the date field is editable. This disables/enables the text field.

Parameters:
editable - True if the date field should be editable, false if not.

focusGained

public void focusGained(java.awt.event.FocusEvent event)
Implements the focus listener method. It triggers a property change every time the date field receives focus.

Specified by:
focusGained in interface java.awt.event.FocusListener

focusLost

public void focusLost(java.awt.event.FocusEvent event)
Implements the focus listener method. It triggers a property change every time the date field looses focus.

Specified by:
focusLost in interface java.awt.event.FocusListener

propertyChange

public void propertyChange(java.beans.PropertyChangeEvent event)
Implements the proerty change listener method. If it is a calendar date modified event, then update our date. We also fire a focus lost property change event in this case as a workaround to strange focus lost problems.

Specified by:
propertyChange in interface java.beans.PropertyChangeListener

setClusterName

public void setClusterName(java.lang.String name)
Sets the cluster name of the widget. A cluster name associates a group of widgets.

Specified by:
setClusterName in interface WidgetInterface

getClusterName

public java.lang.String getClusterName()
Retrieves the cluster name of the widget.

Specified by:
getClusterName in interface WidgetInterface

setBackground

public void setBackground(java.awt.Color color)
See Also:
in JTextField.

setForeground

public void setForeground(java.awt.Color color)
See Also:
in JTextField.

setErrorState

public void setErrorState(boolean errorState)
Sets whether or not the date field is in an error state.

Specified by:
setErrorState in interface WidgetInterface
Parameters:
errorState - True if the date field is in an error state, false if not.

isErrorState

public boolean isErrorState()
Retrieves whether or not the date field is in an error state.

Specified by:
isErrorState in interface WidgetInterface
Returns:
True if the date field is in an error state, false if not.

setFocusedState

public void setFocusedState()
Sets the date field to focused state, updating colors.

Specified by:
setFocusedState in interface WidgetInterface

updateColorState

public void updateColorState()
Updates the color state. This method ensures the color displayed by the widget is correct based on the state of the widget. The controlling color flag is to keep the set() methods from changing the default background color.



Copyright © 2005 Retek Inc. All Rights Reserved. - Generated at Fri, 01/21/2005 14:25