public class JdateField
extends javax.swing.JPanel
implements java.awt.event.ActionListener, java.awt.event.FocusListener
This class defines a Date/Time GUI component that ties into the
JsetValueCallback interface that
the Ganymede clients use internally to receive higher level GUI
events.
javax.swing.JPanel.AccessibleJPaneljavax.swing.JComponent.AccessibleJComponent| Modifier and Type | Field and Description |
|---|---|
private JsetValueCallback |
callback
The callback that we use to communicate date changes in this
field to the Ganymede client, etc.
|
private java.util.Date |
curr_date
The date that we most recently have from our GUI components.
|
private javax.swing.JFormattedTextField |
datef
datePicker's internal text editing field, that we apply a
FocusListener to.
|
private org.jdesktop.swingx.JXDatePicker |
datePicker
The SwingX date picker GUI component we're building JdateField around.
|
(package private) static boolean |
debug |
private java.util.Date |
original_date
The last date that we had from the Ganymede server.
|
private javax.swing.JTextField |
timef
A text editing component for the time of day for this JdateField,
if we are set up to provide time display/editing.
|
(package private) static TranslationService |
ts
TranslationService object for handling string localization in the
Ganymede client.
|
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW| Constructor and Description |
|---|
JdateField()
Minimal Constructor for JdateField.
|
JdateField(java.util.Date date,
boolean iseditable,
boolean islimited,
boolean usetime,
java.util.Date minDate,
java.util.Date maxDate)
Contructor that creates a JdateField based on the date it is given.
|
JdateField(java.util.Date date,
boolean iseditable,
boolean islimited,
boolean usetime,
java.util.Date minDate,
java.util.Date maxDate,
JsetValueCallback parent)
Contructor that creates a JdateField based on the Date object it is given.
|
| Modifier and Type | Method and Description |
|---|---|
void |
actionPerformed(java.awt.event.ActionEvent e)
ActionListener method we use to trigger on mouse clicks on the drop-down calendar widget.
|
void |
focusGained(java.awt.event.FocusEvent e)
Required by the FocusListener interface.
|
void |
focusLost(java.awt.event.FocusEvent e)
FocusListener method to react to focus loss on the datePicker
and/or timef text editing widgets.
|
java.util.Date |
getDate()
Returns the date associated with this JdateField
|
private java.lang.String |
prefixZero(java.lang.String str) |
void |
setCallback(JsetValueCallback callback)
Attaches this JdateField component to the callback we use to
notify on date/time change input.
|
void |
setDate(java.util.Date date)
Sets the date and time value of this JdateField.
|
private void |
setDateOnly(java.util.Date date)
Sets the calendar date of this JdateField, keeping the time of
day previously set.
|
void |
setLimits(java.util.Date minDate,
java.util.Date maxDate)
Sets the minimum and maximum dates allowed in this JdateField.
|
private void |
setTimeOnly(java.lang.String timeStr)
Sets the time of day for this JdateField, keeping the calendar
date previously set.
|
void |
updateServer()
Propagate the date value up to the server object.
|
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUIaddAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, 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, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, 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, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, updateadd, 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, transferFocusDownCycle, validate, validateTreeaction, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, 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, 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, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, 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, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCyclestatic final boolean debug
static final TranslationService ts
private org.jdesktop.swingx.JXDatePicker datePicker
private javax.swing.JFormattedTextField datef
private javax.swing.JTextField timef
private JsetValueCallback callback
private java.util.Date original_date
private java.util.Date curr_date
public JdateField()
public JdateField(java.util.Date date,
boolean iseditable,
boolean islimited,
boolean usetime,
java.util.Date minDate,
java.util.Date maxDate,
JsetValueCallback parent)
parent - the container which implements the callback function for this JdateFielddate - the Date object to useiseditable - true if the datefield can be edited by the userislimited - true if there is to be a restriction on the range of datesusetime - If true, this JdateField will display a time edit box next to the date edit field.minDate - the oldest possible date that can be entered into this JdateFieldmaxDate - the newest possible date that can be entered into this JdateFieldpublic JdateField(java.util.Date date,
boolean iseditable,
boolean islimited,
boolean usetime,
java.util.Date minDate,
java.util.Date maxDate)
date - the Date object to useislimited - true if there is to be a restriction on the range of datesusetime - If true, this JdateField will display a time edit box next to the date edit field.minDate - the oldest possible date that can be entered into this JdateFieldmaxDate - the newest possible date that can be entered into this JdateFieldpublic void focusLost(java.awt.event.FocusEvent e)
focusLost in interface java.awt.event.FocusListenerpublic void focusGained(java.awt.event.FocusEvent e)
focusGained in interface java.awt.event.FocusListenerpublic void actionPerformed(java.awt.event.ActionEvent e)
actionPerformed in interface java.awt.event.ActionListenerpublic java.util.Date getDate()
public void setLimits(java.util.Date minDate,
java.util.Date maxDate)
private void setDateOnly(java.util.Date date)
Sets the calendar date of this JdateField, keeping the time of day previously set.
Calling this method does not trigger the callback.
date - The Date to load into this JdateField.private void setTimeOnly(java.lang.String timeStr)
Sets the time of day for this JdateField, keeping the calendar date previously set.
Calling this method does not trigger the callback.
timeStr - The string to extract time of day from.public void setDate(java.util.Date date)
Sets the date and time value of this JdateField.
Calling this method does not trigger the callback.
date - The Date to extract the calendar date and time of
day from.public void setCallback(JsetValueCallback callback)
public void updateServer()
private java.lang.String prefixZero(java.lang.String str)