org.rapla.components.calendar
Class DateField

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.text.JTextComponent
                  extended by javax.swing.JTextField
                      extended by org.rapla.components.calendar.AbstractBlockField
                          extended by org.rapla.components.calendar.DateField
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible, Scrollable, SwingConstants

public final class DateField
extends AbstractBlockField

The DateField only accepts characters that are part of DateFormat.getDateInstance(DateFormat.SHORT,locale). The inputblocks are [date,month,year]. The order of the input-blocks is determined by the locale. You can use the keyboard to navigate between the blocks or to increment/decrement the blocks.

See Also:
AbstractBlockField, Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JTextField
JTextField.AccessibleJTextField
 
Nested classes/interfaces inherited from class javax.swing.text.JTextComponent
JTextComponent.AccessibleJTextComponent, JTextComponent.KeyBinding
 
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
 
Fields inherited from class org.rapla.components.calendar.AbstractBlockField
m_oldText
 
Fields inherited from class javax.swing.JTextField
notifyAction
 
Fields inherited from class javax.swing.text.JTextComponent
DEFAULT_KEYMAP, FOCUS_ACCELERATOR_KEY
 
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 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
DateField()
           
DateField(Locale locale)
           
DateField(Locale locale, TimeZone timeZone)
           
 
Method Summary
protected  int blockCount()
          The number of blocks for this Component.
 boolean blocksValid()
          returns true if the text can be split into blocks.
protected  void changeSelectedBlock(int[] blocks, int block, String selected, int count)
          This method will be called, when the user has pressed the up/down arrows on a selected block.
 Date getDate()
           
 DateFormat getOutputFormat()
          returns the output format of the date-field.
 DateFormat getParsingFormat()
          returns the parsingFormat of the selected locale.
protected  char[] getSeparators()
           
 TimeZone getTimeZone()
           
 String getToolTipText(MouseEvent event)
           
protected  boolean isSeparator(char c)
          returns true if the character is a block-separator.
protected  boolean isValidChar(char c)
          returns true if the character should be accepted by the component.
protected  void mark(int dot, int mark)
          Select the text from dot to mark.
protected  int maxBlockLength(int block)
          returns the maximum length of the specified block.
 void paint(Graphics g)
           
 void setDate(Date value)
           
 void setDateRenderer(DateRenderer dateRenderer)
          sets the DateRenderer for the calendar
 void setLocale(Locale locale)
           
 void setTimeZone(TimeZone timeZone)
           
 void setWeekdaysVisible(boolean m_weekdaysVisible)
          you can choose, if weekdays should be displayed in the right corner of the DateField.
 
Methods inherited from class org.rapla.components.calendar.AbstractBlockField
addChangeListener, beep, calcBlocks, createDefaultModel, fireValueChanged, getChangeListeners, markBlock, removeChangeListener
 
Methods inherited from class javax.swing.JTextField
addActionListener, configurePropertiesFromAction, createActionPropertyChangeListener, fireActionPerformed, getAccessibleContext, getAction, getActionListeners, getActions, getColumns, getColumnWidth, getHorizontalAlignment, getHorizontalVisibility, getPreferredSize, getScrollOffset, getUIClassID, isValidateRoot, paramString, postActionEvent, removeActionListener, scrollRectToVisible, setAction, setActionCommand, setColumns, setDocument, setFont, setHorizontalAlignment, setScrollOffset
 
Methods inherited from class javax.swing.text.JTextComponent
addCaretListener, addInputMethodListener, addKeymap, copy, cut, fireCaretUpdate, getCaret, getCaretColor, getCaretListeners, getCaretPosition, getDisabledTextColor, getDocument, getDragEnabled, getFocusAccelerator, getHighlighter, getInputMethodRequests, getKeymap, getKeymap, getMargin, getNavigationFilter, getPreferredScrollableViewportSize, getScrollableBlockIncrement, getScrollableTracksViewportHeight, getScrollableTracksViewportWidth, getScrollableUnitIncrement, getSelectedText, getSelectedTextColor, getSelectionColor, getSelectionEnd, getSelectionStart, getText, getText, getUI, isEditable, loadKeymap, modelToView, moveCaretPosition, paste, processInputMethodEvent, read, removeCaretListener, removeKeymap, removeNotify, replaceSelection, select, selectAll, setCaret, setCaretColor, setCaretPosition, setComponentOrientation, setDisabledTextColor, setDragEnabled, setEditable, setFocusAccelerator, setHighlighter, setKeymap, setMargin, setNavigationFilter, setSelectedTextColor, setSelectionColor, setSelectionEnd, setSelectionStart, setText, setUI, updateUI, viewToModel, write
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setForeground, setInheritsPopupMenu, 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, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, 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, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, 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, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, 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
 

Constructor Detail

DateField

public DateField()

DateField

public DateField(Locale locale)

DateField

public DateField(Locale locale,
                 TimeZone timeZone)
Method Detail

setLocale

public void setLocale(Locale locale)
Overrides:
setLocale in class Component

setTimeZone

public void setTimeZone(TimeZone timeZone)

setWeekdaysVisible

public void setWeekdaysVisible(boolean m_weekdaysVisible)
you can choose, if weekdays should be displayed in the right corner of the DateField. Default is true.


setDateRenderer

public void setDateRenderer(DateRenderer dateRenderer)
sets the DateRenderer for the calendar


getTimeZone

public TimeZone getTimeZone()

getDate

public Date getDate()

setDate

public void setDate(Date value)

getSeparators

protected char[] getSeparators()
Specified by:
getSeparators in class AbstractBlockField
Returns:
all seperators.

isSeparator

protected boolean isSeparator(char c)
Description copied from class: AbstractBlockField
returns true if the character is a block-separator. All block-separators must be valid characters.

Specified by:
isSeparator in class AbstractBlockField
See Also:
AbstractBlockField.isValidChar(char)

getParsingFormat

public DateFormat getParsingFormat()
returns the parsingFormat of the selected locale. This is same as the default date-format of the selected locale.


getOutputFormat

public DateFormat getOutputFormat()
returns the output format of the date-field. The OutputFormat always uses the full block size: 01.01.2000 instead of 1.1.2000


changeSelectedBlock

protected void changeSelectedBlock(int[] blocks,
                                   int block,
                                   String selected,
                                   int count)
Description copied from class: AbstractBlockField
This method will be called, when the user has pressed the up/down arrows on a selected block.

Specified by:
changeSelectedBlock in class AbstractBlockField
count - Posible values are 1,-1,10,-10.

getToolTipText

public String getToolTipText(MouseEvent event)
Overrides:
getToolTipText in class JTextComponent

blocksValid

public boolean blocksValid()
Description copied from class: AbstractBlockField
returns true if the text can be split into blocks.

Specified by:
blocksValid in class AbstractBlockField

blockCount

protected int blockCount()
Description copied from class: AbstractBlockField
The number of blocks for this Component.

Specified by:
blockCount in class AbstractBlockField

mark

protected void mark(int dot,
                    int mark)
Description copied from class: AbstractBlockField
Select the text from dot to mark.

Overrides:
mark in class AbstractBlockField

maxBlockLength

protected int maxBlockLength(int block)
Description copied from class: AbstractBlockField
returns the maximum length of the specified block.

Specified by:
maxBlockLength in class AbstractBlockField

isValidChar

protected boolean isValidChar(char c)
Description copied from class: AbstractBlockField
returns true if the character should be accepted by the component.

Specified by:
isValidChar in class AbstractBlockField

paint

public void paint(Graphics g)
Overrides:
paint in class JComponent


Copyright © 2000-2006 Rapla Team. All Rights Reseserved.