DateControl

Overview | Package | Class | Tree | Deprecated | Index | Help

PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.openswing.swing.client
Class DateControl

    java.lang.Object
      java.awt.Component
          java.awt.Container
              javax.swing.JComponent
                  javax.swing.JPanel
                      org.openswing.swing.client.BaseInputControl
                          org.openswing.swing.client.DateControl

All Implemented Interfaces:
  javax.accessibility.Accessible, java.util.EventListener, java.awt.event.FocusListener, java.awt.image.ImageObserver, InputControl, java.awt.event.KeyListener, java.awt.MenuContainer, java.io.Serializable

public class DateControl
extends BaseInputControl
implements java.awt.event.KeyListener, java.awt.event.FocusListener, InputControl

Title: OpenSwing Framework

Description: Date input control: contains a text input control when digit the date and a button for opening a calendar.

Copyright: Copyright (C) 2006 Mauro Carniel

This file is part of OpenSwing Framework. This library is free software; you can redistribute it and/or modify it under the terms of the (LGPL) Lesser General Public License as published by the Free Software Foundation; GNU LESSER GENERAL PUBLIC LICENSE Version 2.1, February 1999 This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. The author may be contacted at: maurocarniel@tin.it

See Also:
  Serialized Form

Nested Class Summary

Nested classes inherited from class javax.swing.JComponent
`javax.swing.JComponent.AccessibleJComponent`

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`

Constructor Summary
`DateControl()`
`DateControl(int dateType, int dateFormat, char dateFormatSeparator, boolean showCenturyInDateFormat, java.lang.String timeFormat)` Constructor.

Method Summary
`void` | `addActionListener(java.awt.event.ActionListener listener)` Adds the specified action listener to receive action events from this textfield.
`void` | `addDateChangedListener(DateChangedListener listener)` Add a date changed listener.
`void` | `addFocusListener(java.awt.event.FocusListener listener)` Adds the specified focus listener to receive focus events from this component when this component gains input focus.
`void` | `addKeyListener(java.awt.event.KeyListener listener)` Adds the specified key listener to receive action events from this field.
`void` | `finalize()`
`void` | `focusGained(java.awt.event.FocusEvent e)` Invoked when a component gains the keyboard focus.
`void` | `focusLost(java.awt.event.FocusEvent e)` Invoked when a component loses the keyboard focus.
`javax.swing.JComponent` | `getBindingComponent()`
`java.util.Date` | `getDate()`
`javax.swing.JTextField` | `getDateField()`
`int` | `getDateType()`
`java.util.Calendar` | `getDefaultDate()`
`int` | `getFormat()`
`java.util.Date` | `getLowerLimit()`
`char` | `getSeparator()`
`java.lang.String` | `getTimeFormat()`
`java.util.Date` | `getUpperLimit()`
`java.lang.Object` | `getValue()`
`boolean` | `isEnabled()`
`boolean` | `isShowCalendarButton()`
`boolean` | `isShowCentury()`
`void` | `keyPressed(java.awt.event.KeyEvent e)` Invoked when a key has been pressed.
`void` | `keyReleased(java.awt.event.KeyEvent e)` Invoked when a key has been released.
`void` | `keyTyped(java.awt.event.KeyEvent e)` Invoked when a key has been typed.
`void` | `processKeyEvent(java.awt.event.KeyEvent e)`
`void` | `refresh()` Refresh calendar content.
`void` | `removeActionListener(java.awt.event.ActionListener listener)` Removes the specified action listener so that it no longer receives action events from this textfield.
`void` | `removeDateChangedListener(DateChangedListener listener)` Remove a date changed listener.
`void` | `removeFocusListener(java.awt.event.FocusListener listener)` Removes the specified focus listener so that it no longer receives focus events from this component.
`void` | `removeKeyListener(java.awt.event.KeyListener listener)` Removes the specified key listener so that it no longer receives action events from this field.
`void` | `requestFocus()` Riceve il fuoco e lo smista al componente wrappato.
`void` | `setDate(java.util.Date date)` Set date into the date field.
`void` | `setDateType(int dateType)` Set date type: date only, date + time, time only.
`void` | `setDefaultDate(java.util.Calendar defaultDate)` Set the default date to set into the calendar, when opening it for the first time.
`void` | `setEnabled(boolean enabled)` Set current input control abilitation.
`void` | `setFormat(int dateFormat)` Set date format.
`void` | `setLowerLimit(java.util.Date lowerLimit)` Set minimum allowed date.
`void` | `setSeparator(char separator)` Set separator.
`void` | `setShowCalendarButton(boolean showCalendarButton)` Show/hide calendar button; default value: `true`
`void` | `setShowCentury(boolean showCentury)` Used to show century.
`void` | `setTimeFormat(java.lang.String timeFormat)` Set the time format.
`void` | `setUpperLimit(java.util.Date upperLimit)` Set maximum allowed date.
`void` | `setValue(java.lang.Object value)` Set value to the input control.
`void` | `transferFocus()` Riceve la richiesta di trasferimento fuoco e lo smista al componente wrappato.

Methods inherited from class org.openswing.swing.client.BaseInputControl
`addValueChangedListener, getAttributeName, getFont, getLinkLabel, getTextAlignment, getToolTipText, getValueChangeListeners, isCanCopy, isChanged, isEnabledOnEdit, isEnabledOnInsert, isRequired, removeValueChangedListener, setAttributeName, setCanCopy, setChanged, setEnabledOnEdit, setEnabledOnInsert, setFont, setLinkLabel, setRequired, setTextAlignment, setToolTipText`

Methods inherited from class javax.swing.JPanel
`getAccessibleContext, getUI, getUIClassID, 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, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintImmediately, paintImmediately, print, printAll, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setTransferHandler, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update`

Methods inherited from class java.awt.Container
`add, add, add, add, add, addContainerListener, 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, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setLayout, transferFocusBackward, transferFocusDownCycle, validate`

Methods inherited from class java.awt.Component
`action, add, addComponentListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, createImage, createImage, createVolatileImage, createVolatileImage, dispatchEvent, enable, enableInputMethods, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, 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, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, 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, remove, removeComponentListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, 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, transferFocusUpCycle`

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

Methods inherited from interface org.openswing.swing.client.InputControl
`addValueChangedListener, getAttributeName, getLinkLabel, getValueChangeListeners, isCanCopy, isChanged, isEnabledOnEdit, isEnabledOnInsert, isRequired, removeValueChangedListener, setAttributeName, setCanCopy, setChanged, setEnabledOnEdit, setEnabledOnInsert, setLinkLabel`

Constructor Detail

### DateControl

    public DateControl()

### DateControl

    public DateControl(int dateType,
                       int dateFormat,
                       char dateFormatSeparator,
                       boolean showCenturyInDateFormat,
                       java.lang.String timeFormat)

  Constructor.

Parameters:
  `dateType` - possibile values: Consts.TYPE_DATE, Consts.TYPE_TIME, Consts.TYPE_DATE_TIME
  `dateFormatSeparator` - yy MM dd separator; for example: '/' or '-'
  `showCenturyInDateFormat` - define if the year is in the format 'yy' or 'yyyy'
  `timeFormat` - possibile values: Resources.HH_MM or Resources.H_MM_AAA or Resources.HH_MM_SS or Resources.H_MM_SS_AAA

Method Detail

### finalize

    public final void finalize()

### setSeparator

    public final void setSeparator(char separator)

  Set separator.

  Parameters:
    `separator` - separator character

### getSeparator

    public final char getSeparator()

  Returns:
    separator

### setFormat

    public final void setFormat(int dateFormat)

  Set date format.

### getFormat

    public final int getFormat()

  Returns:
    date format; possible values: YMD, DMY, MDY, YDM

### setDate

    public final void setDate(java.util.Date date)

  Set date into the date field.

  Parameters:
    `date` - date

### getDate

    public final java.util.Date getDate()

  Returns:
    date

### setUpperLimit

    public final void setUpperLimit(java.util.Date upperLimit)

  Set maximum allowed date.

  Parameters:
    `upperLimit` - maximum allowed date

### getUpperLimit

    public final java.util.Date getUpperLimit()

  Returns:
    minimum allowed date

### setLowerLimit

    public final void setLowerLimit(java.util.Date lowerLimit)

  Set minimum allowed date.

  Parameters:
    `lowerLimit` - minimum allowed date

### getLowerLimit

    public final java.util.Date getLowerLimit()

  Returns:
    minimum allowed date

### refresh

    public final void refresh()

  Refresh calendar content.

### setEnabled

    public void setEnabled(boolean enabled)

  Description copied from interface: `InputControl`
  Set current input control abilitation.

  Specified by:
    `setEnabled` in interface `InputControl`
  Overrides:
    `setEnabled` in class `BaseInputControl`

### isEnabled

    public final boolean isEnabled()

  Specified by:
    `isEnabled` in interface `InputControl`
  Overrides:
    `isEnabled` in class `BaseInputControl`
  Returns:
    current input control abilitation

### requestFocus

    public final void requestFocus()

  Riceve il fuoco e lo smista al componente wrappato.

  Overrides:
    `requestFocus` in class `BaseInputControl`

### transferFocus

    public final void transferFocus()

  Riceve la richiesta di trasferimento fuoco e lo smista al componente wrappato.

### isShowCentury

    public final boolean isShowCentury()

  Returns:
    show century

### setShowCentury

    public final void setShowCentury(boolean showCentury)

  Used to show century.

  Parameters:
    `showCentury` - show century

### focusGained

    public void focusGained(java.awt.event.FocusEvent e)

  Invoked when a component gains the keyboard focus.

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

### focusLost

    public void focusLost(java.awt.event.FocusEvent e)

  Invoked when a component loses the keyboard focus.

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

### keyTyped

    public final void keyTyped(java.awt.event.KeyEvent e)

  Invoked when a key has been typed. See the class description for `KeyEvent` for a definition of a key typed event.

  Specified by:
    `keyTyped` in interface `java.awt.event.KeyListener`

### keyPressed

    public final void keyPressed(java.awt.event.KeyEvent e)

  Invoked when a key has been pressed. See the class description for `KeyEvent` for a definition of a key pressed event.

  Specified by:
    `keyPressed` in interface `java.awt.event.KeyListener`

### keyReleased

    public final void keyReleased(java.awt.event.KeyEvent e)

  Invoked when a key has been released. See the class description for `KeyEvent` for a definition of a key released event.

  Specified by:
    `keyReleased` in interface `java.awt.event.KeyListener`

### getDateField

    public final javax.swing.JTextField getDateField()

  Returns:
    date input field

### getDateType

    public final int getDateType()

  Returns:
    possibile values: Consts.TYPE_DATE, Consts.TYPE_TIME, Consts.TYPE_DATE_TIME

### setDateType

    public final void setDateType(int dateType)

  Set date type: date only, date + time, time only.

  Parameters:
    `dateType` - possibile values: Consts.TYPE_DATE, Consts.TYPE_TIME, Consts.TYPE_DATE_TIME

### getTimeFormat

    public final java.lang.String getTimeFormat()

  Returns:
    possibile values: Resources.HH_MM or Resources.H_MM_AAA or Resources.HH_MM_SS or Resources.H_MM_SS_AAA

### setTimeFormat

    public final void setTimeFormat(java.lang.String timeFormat)

  Set the time format.

  Parameters:
    `timeFormat` - possibile values: Resources.HH_MM or Resources.H_MM_AAA or Resources.HH_MM_SS or Resources.H_MM_SS_AAA

### addDateChangedListener

    public final void addDateChangedListener(DateChangedListener listener)

  Add a date changed listener.

### removeDateChangedListener

    public final void removeDateChangedListener(DateChangedListener listener)

  Remove a date changed listener.

### getBindingComponent

    public javax.swing.JComponent getBindingComponent()

  Overrides:
    `getBindingComponent` in class `BaseInputControl`
  Returns:
    component inside this whose contains the value

### getValue

    public java.lang.Object getValue()

  Specified by:
    `getValue` in interface `InputControl`
  Overrides:
    `getValue` in class `BaseInputControl`
  Returns:
    value related to the input control

### setValue

    public void setValue(java.lang.Object value)

  Set value to the input control.

  Specified by:
    `setValue` in interface `InputControl`
  Overrides:
    `setValue` in class `BaseInputControl`
  Parameters:
    `value` - value to set into the input control

### addFocusListener

    public final void addFocusListener(java.awt.event.FocusListener listener)

  Adds the specified focus listener to receive focus events from this component when this component gains input focus. If listener `l` is `null`, no exception is thrown and no action is performed.

  Specified by:
    `addFocusListener` in interface `InputControl`
  Since:
    JDK1.1
  See Also:
    `FocusEvent`, `FocusListener`, `removeFocusListener(java.awt.event.FocusListener)`, `Component.getFocusListeners()`

### removeFocusListener

    public final void removeFocusListener(java.awt.event.FocusListener listener)

  Removes the specified focus listener so that it no longer receives focus events from this component. This method performs no function, nor does it throw an exception, if the listener specified by the argument was not previously added to this component. If listener `l` is `null`, no exception is thrown and no action is performed.

  Specified by:
    `removeFocusListener` in interface `InputControl`
  Since:
    JDK1.1
  See Also:
    `FocusEvent`, `FocusListener`, `addFocusListener(java.awt.event.FocusListener)`, `Component.getFocusListeners()`

### addActionListener

    public final void addActionListener(java.awt.event.ActionListener listener)

  Adds the specified action listener to receive action events from this textfield.

### addKeyListener

    public final void addKeyListener(java.awt.event.KeyListener listener)

  Adds the specified key listener to receive action events from this field.

### removeKeyListener

    public final void removeKeyListener(java.awt.event.KeyListener listener)

  Removes the specified key listener so that it no longer receives action events from this field.

### removeActionListener

    public final void removeActionListener(java.awt.event.ActionListener listener)

  Removes the specified action listener so that it no longer receives action events from this textfield.

### processKeyEvent

    public void processKeyEvent(java.awt.event.KeyEvent e)

### getDefaultDate

    public final java.util.Calendar getDefaultDate()

  Returns:
    default date to set into the calendar, when opening it for the first time; null means today

### setDefaultDate

    public final void setDefaultDate(java.util.Calendar defaultDate)

  Set the default date to set into the calendar, when opening it for the first time. A null value means today.

  Parameters:
    `defaultDate` - default date to set into the calendar, when opening it for the first time; null means today

### isShowCalendarButton

    public final boolean isShowCalendarButton()

  Returns:
    show/hide calendar button; default value: `true`

### setShowCalendarButton

    public final void setShowCalendarButton(boolean showCalendarButton)

  Show/hide calendar button; default value: `true`

  Parameters:
    `showCalendarButton` - show/hide calendar button;

Overview | Package | Class | Tree | Deprecated | Index | Help

PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD