com.isti.util.gui
Class IstiTimePanel

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 com.isti.util.gui.IstiTimePanel
All Implemented Interfaces:
UpdateListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible

public class IstiTimePanel
extends javax.swing.JPanel
implements UpdateListener

Class IstiTimePanel implements the time panel.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
 
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
protected  java.lang.String calendarTipText
           
protected  java.lang.String dayOfMonthTextTip
           
protected static boolean debugFlag
           
protected  java.lang.String monthTipText
           
protected  java.lang.String timeTipText
           
protected  java.lang.String yearTextTip
           
 
Fields inherited from class javax.swing.JComponent
accessibleContext, 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
IstiTimePanel()
          Creates a time panel with the default title for the panel and the calendar popup.
IstiTimePanel(java.lang.String title)
          Creates a time panel with the given title for the panel and the calendar popup.
IstiTimePanel(java.lang.String title, boolean showZeroTextFlag)
          Creates a time panel with the given title for the panel and the calendar popup using the provided calendar.
IstiTimePanel(java.lang.String title, boolean showZeroTextFlag, java.util.Calendar calObj)
          Creates a time panel with the given title for the panel and the calendar popup using the provided calendar.
 
Method Summary
 void addUpdateListener(UpdateListener l)
          Adds an UpdateListener.
(package private)  void calendarButton_actionPerformed(java.awt.event.ActionEvent e)
          Calendar button processing
protected  void fireUpdate(java.awt.Component component, java.lang.Object e)
          Notification of an update event.
 java.util.Calendar getCalendar()
          Gets the calendar for this panel.
 int getDayOfMonth()
          Gets the current day of the month.
 java.util.Date getMaxTime()
          Gets the maximum time.
 java.util.Date getMinTime()
          Gets the minimum time.
 int getMonth()
          Gets the current month.
 java.util.Date getTime()
          Get the date that is specified in this object.
 java.util.TimeZone getTimeZone()
          Gets the time zone.
 java.lang.String getTitle()
          Gets the title of the time panel.
 int getYear()
          Gets the current year.
 boolean isEnabled()
          Determines whether this component is enabled.
 boolean isShowLabels()
          Determines if the labels are shown.
protected  boolean isTimeUpdate()
          Gets the time update flag.
 void processUpdate(java.awt.Component component, java.lang.Object e)
          Process an update.
 void removeUpdateListener(UpdateListener l)
          Removes an UpdateListener.
 void setEnabled(boolean b)
          Enables or disables this component, depending on the value of the parameter b.
 boolean setMaxTime(java.util.Date date)
          Sets the maximum time.
 boolean setMinTime(java.util.Date date)
          Sets the minimum time.
 void setShowLabels(boolean b)
          Enables or disables showing the labels.
 boolean setTime(java.util.Date date)
          Sets the time.
protected  void setTimeUpdateFlag(boolean b)
          Sets the time update flag.
 void setTimeZone(java.util.TimeZone value)
          Sets the time zone with the given time zone value.
 void setTitle(java.lang.String title)
          Sets the title of the time panel.
 java.lang.String toString()
          Returns a string representation of this component and its values.
protected  void updateDateFields()
          Update the date fields to the current date.
protected  void updateDays()
          Updates the days of the month.
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
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, 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, 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, setFocusTraversalKeys, setFont, 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, 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, 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, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

debugFlag

protected static boolean debugFlag

monthTipText

protected final java.lang.String monthTipText

dayOfMonthTextTip

protected final java.lang.String dayOfMonthTextTip

yearTextTip

protected final java.lang.String yearTextTip

timeTipText

protected final java.lang.String timeTipText

calendarTipText

protected final java.lang.String calendarTipText
Constructor Detail

IstiTimePanel

public IstiTimePanel()
Creates a time panel with the default title for the panel and the calendar popup.


IstiTimePanel

public IstiTimePanel(java.lang.String title)
Creates a time panel with the given title for the panel and the calendar popup.

Parameters:
title - the title for the panel and the calendar popup or null for default.

IstiTimePanel

public IstiTimePanel(java.lang.String title,
                     boolean showZeroTextFlag)
Creates a time panel with the given title for the panel and the calendar popup using the provided calendar.

Parameters:
title - the title for the panel and the calendar popup or null for default.
showZeroTextFlag - the show zero test flag, if true spaces in the text are replaced with zeros.

IstiTimePanel

public IstiTimePanel(java.lang.String title,
                     boolean showZeroTextFlag,
                     java.util.Calendar calObj)
Creates a time panel with the given title for the panel and the calendar popup using the provided calendar.

Parameters:
title - the title for the panel and the calendar popup or null for default.
showZeroTextFlag - the show zero test flag, if true spaces in the text are replaced with zeros.
calObj - calendar object or null to create a new one.
Method Detail

getMaxTime

public java.util.Date getMaxTime()
Gets the maximum time.

Returns:
the maximum time.

getMinTime

public java.util.Date getMinTime()
Gets the minimum time.

Returns:
the minimum time.

getTime

public java.util.Date getTime()
Get the date that is specified in this object.

Returns:
the date that is specified in this object.

getTimeZone

public java.util.TimeZone getTimeZone()
Gets the time zone.

Returns:
the time zone object associated with this panel.

getTitle

public java.lang.String getTitle()
Gets the title of the time panel.

Returns:
the title of the time panel.

isEnabled

public boolean isEnabled()
Determines whether this component is enabled. An enabled component can respond to user input and generate events. Components are enabled initially by default. A component may be enabled or disabled by calling its setEnabled method.

Overrides:
isEnabled in class java.awt.Component
Returns:
true if the component is enabled; false otherwise.
See Also:
setEnabled(boolean)

isShowLabels

public boolean isShowLabels()
Determines if the labels are shown.

Returns:
true if the labels are shown, false otherwise.

setEnabled

public void setEnabled(boolean b)
Enables or disables this component, depending on the value of the parameter b. An enabled component can respond to user input and generate events. Components are enabled initially by default.

Overrides:
setEnabled in class javax.swing.JComponent
Parameters:
b - If true, this component is enabled; otherwise this component is disabled.
See Also:
isEnabled()

setShowLabels

public void setShowLabels(boolean b)
Enables or disables showing the labels.

Parameters:
b - If true the labels are shown; otherwise the labels are not shown.

setMaxTime

public boolean setMaxTime(java.util.Date date)
Sets the maximum time.

Parameters:
date - the date to set or null to clear.
Returns:
true if the maximum time is valid and was updated.

setMinTime

public boolean setMinTime(java.util.Date date)
Sets the minimum time.

Parameters:
date - the date to set or null to clear.
Returns:
true if the minimum time is valid and was updated.

setTime

public boolean setTime(java.util.Date date)
Sets the time.

Parameters:
date - the date to set or null to clear.
Returns:
true if the time is valid and was updated.

setTimeZone

public void setTimeZone(java.util.TimeZone value)
Sets the time zone with the given time zone value.

Parameters:
value - the given time zone.

setTitle

public void setTitle(java.lang.String title)
Sets the title of the time panel.

Parameters:
title - the title for the time panel.

toString

public java.lang.String toString()
Returns a string representation of this component and its values.

Overrides:
toString in class java.awt.Component
Returns:
a string representation of this component.

isTimeUpdate

protected boolean isTimeUpdate()
Gets the time update flag.

Returns:
the time update flag.

setTimeUpdateFlag

protected void setTimeUpdateFlag(boolean b)
Sets the time update flag.

Parameters:
b - true if time is being updated, false otherwise.

updateDateFields

protected void updateDateFields()
Update the date fields to the current date.


updateDays

protected void updateDays()
Updates the days of the month.


calendarButton_actionPerformed

void calendarButton_actionPerformed(java.awt.event.ActionEvent e)
Calendar button processing

Parameters:
e - action event

getMonth

public int getMonth()
Gets the current month.

Returns:
the month

getDayOfMonth

public int getDayOfMonth()
Gets the current day of the month.

Returns:
the day of the month

getYear

public int getYear()
Gets the current year.

Returns:
the year

getCalendar

public java.util.Calendar getCalendar()
Gets the calendar for this panel.

Returns:
the calendar for this panel.

addUpdateListener

public void addUpdateListener(UpdateListener l)
Adds an UpdateListener. The listener will receive an update event the user finishes making a selection.

Parameters:
l - the UpdateListener that is to be notified

removeUpdateListener

public void removeUpdateListener(UpdateListener l)
Removes an UpdateListener.

Parameters:
l - the UpdateListener to remove

fireUpdate

protected void fireUpdate(java.awt.Component component,
                          java.lang.Object e)
Notification of an update event.

Parameters:
component - the component.
e - the event or null if none.

processUpdate

public void processUpdate(java.awt.Component component,
                          java.lang.Object e)
Process an update.

Specified by:
processUpdate in interface UpdateListener
Parameters:
component - the component.
e - the event or null if none.