Imp
[using it]
Interface Manipulation Package v4.0 (2008-06-25) a-projector ©copyright Author


imp.gui
Class DateInput

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by imp.gui.IComponent
                      extended by imp.gui.DateInput
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible

public class DateInput
extends IComponent

Defines a date editor of the form year-month-day.

E.g.: <imp-gui:date-input bgcolor='white' min='2001' max='2020' value='2003-04-01'/>

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Component
Component.BaselineResizeBehavior
 
Field Summary
 
Fields inherited from class javax.swing.JComponent
TOOL_TIP_TEXT_KEY, 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
 
Method Summary
 long getValue()
          Gets the last input value.
 void outputValue(long value)
          Called when a value is output.
 void outputValue(String value)
          Called when a value is output.
 DateInput setFormat(String format)
          Sets the display format and return this.
 DateInput setLocale(String localization)
          Sets the display localization and return this.
 DateInput setMax(int max)
          Sets the year max value and return this, default is 2020.
 DateInput setMin(int min)
          Sets the year min value and return this, default is 1900.
 DateInput setValue(long value)
          Sets the default value and return this.
static long toDate(String localization, String format, String date)
          Gets the date represented by the given string.
static String toString(String localization, String format, long date)
          Gets a string representation of the given date.
 
Methods inherited from class imp.gui.IComponent
getBgcolor, getColor, getTextFont, getTitle, getTooltip, grab, refresh, setBgcolor, setColor, setHeight, setTextFont, setTitle, setTooltip, setWidth
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintImmediately, paintImmediately, print, printAll, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, 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, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, createImage, createImage, createVolatileImage, createVolatileImage, dispatchEvent, enable, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, 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, 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, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

getValue

public long getValue()
Gets the last input value.


outputValue

public void outputValue(long value)
Called when a value is output.

Parameters:
value - A date as time in milliseconds after January 1, 1970 00:00:00 GMT.

outputValue

public void outputValue(String value)
Called when a value is output.

Parameters:
value - A date, using the specified format.

setFormat

public DateInput setFormat(String format)
Sets the display format and return this.

Parameters:
format - A string of the form date:verbosity, time:verbosity or date-time:verbosity where verbosity defines the string representation, either standard (default), numeric, short, long, full.

setLocale

public DateInput setLocale(String localization)
Sets the display localization and return this.

Parameters:
localization - A string of the form language_country:zone, language_country, language:zone, language or :zone (e.g. en_US:America/Chicago) where the
The language is a lowercase two-letter ISO-639 code.
The country is an uppercase two-letter ISO-3166 code.
The zone is either a time-zone abbreviation such as "PST", or a full name such as "America/Chicago", or a custom ID such as "GMT-8:00".
Unspecified aspects are set to the current system defaults.

setMax

public DateInput setMax(int max)
Sets the year max value and return this, default is 2020.


setMin

public DateInput setMin(int min)
Sets the year min value and return this, default is 1900.


setValue

public DateInput setValue(long value)
Sets the default value and return this.

Parameters:
value - A date as time in milliseconds after January 1, 1970 00:00:00 GMT.
As String:
Defines the date using the standard syntax "YYYY-MM-DD HH:MM:SS:MMM".

toDate

public static long toDate(String localization,
                          String format,
                          String date)
Gets the date represented by the given string.

Parameters:
localization - A string of the form language_country:zone, language_country, language:zone, language or :zone (e.g. en_US:America/Chicago) where the
The language is a lowercase two-letter ISO-639 code.
The country is an uppercase two-letter ISO-3166 code.
The zone is either a time-zone abbreviation such as "PST", or a full name such as "America/Chicago", or a custom ID such as "GMT-8:00".
Unspecified aspects are set to the current system defaults.
format - A string of the form date:verbosity, time:verbosity or date-time:verbosity where verbosity defines the string representation, either standard (default), numeric, short, long, full.
date - The date value using the locale format or the standard YYYY-MM-DD HH:MM:SS.mmm numerical format.
Returns:
The date as time in milliseconds after January 1, 1970 00:00:00 GMT.
Throws:
IllegalArgumentException - If the string does not represent a valid date.

toString

public static String toString(String localization,
                              String format,
                              long date)
Gets a string representation of the given date.

Parameters:
localization - A string of the form language_country:zone, language_country, language:zone, language or :zone (e.g. en_US:America/Chicago) where the
The language is a lowercase two-letter ISO-639 code.
The country is an uppercase two-letter ISO-3166 code.
The zone is either a time-zone abbreviation such as "PST", or a full name such as "America/Chicago", or a custom ID such as "GMT-8:00".
Unspecified aspects are set to the current system defaults.
format - A string of the form date:verbosity, time:verbosity or date-time:verbosity where verbosity defines the string representation, either numeric, short, long or full (default).
date - The date as time in milliseconds after January 1, 1970 00:00:00 GMT.
Returns:
The date as a string.