public class JpanelCalendar
extends javax.swing.JPanel
implements java.awt.event.ActionListener
A GUI Calendar for use with the JdateField class.
javax.swing.JPanel.AccessibleJPaneljavax.swing.JComponent.AccessibleJComponent| Modifier and Type | Field and Description |
|---|---|
protected JdateButton[] |
_datebuttonArray
The meat of the calendar.
|
private boolean |
allowMonthChange
If true, we'll allow the use to change the month and year
displayed in the calendar.
|
private javax.swing.JPanel |
buttonPanel |
private javax.swing.JPanel |
calButtonPanel |
protected JsetValueCallback |
callback
Who do we notify when the user changes the date through
direct manipulation of the calendar?
|
protected javax.swing.JButton |
closeButton |
private boolean |
compact
If true, we'll try to render the calendar in a compressed
form, with less space for the calendar buttons.
|
private boolean |
dateIsSet
Used to control whether we show a selected day in the
calendar.
|
(package private) static boolean |
debug |
private boolean |
editable
If true, we will allow the calendar to be used to change the
date/time selected.
|
private boolean |
inhibitPainting
Private flag to inhibit updating while we're modifying
our calendar's state.
|
(package private) static int[] |
leapDays |
(package private) static java.lang.String[] |
month_names |
(package private) static int[] |
monthDays |
private JMonthYearPanel |
monthYearPanel |
protected java.awt.Font |
notTodayFont |
protected JpopUpCalendar |
pCal
If we are contained in a pop-up, this will refer to
the dialog frame, so that the close button can close
it.
|
private java.util.Date |
previousDate
The last known good date.
|
protected javax.swing.JButton |
resetButton |
protected java.util.GregorianCalendar |
selectedDate_calendar
What time do we have set?
|
private boolean |
showTime
If true, we'll show the time of day in the calendar, and allow
the user to edit the time of day if we are editable.
|
(package private) static java.text.DateFormatSymbols |
symbolTable
Localized DateFormatSymbols for us to use appropriate month
and week day strings.
|
private JTimePanel |
timePanel |
protected java.awt.Font |
todayFont |
(package private) static TranslationService |
ts
TranslationService object for handling string localization in
the Ganymede system.
|
protected java.util.GregorianCalendar |
visibleDate_calendar
What time do we have visible?
|
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW| Constructor and Description |
|---|
JpanelCalendar(java.util.GregorianCalendar parentCalendar,
JsetValueCallback callback,
boolean editable)
Lots of constructors.
|
JpanelCalendar(java.util.GregorianCalendar parentCalendar,
JsetValueCallback callback,
boolean showTime,
boolean editable)
Constructors.
|
JpanelCalendar(java.util.GregorianCalendar parentCalendar,
JsetValueCallback callback,
boolean showTime,
boolean compact,
boolean editable)
The main constructor.
|
JpanelCalendar(JpopUpCalendar pC,
java.util.GregorianCalendar parentCalendar,
JsetValueCallback callback,
boolean editable) |
JpanelCalendar(JpopUpCalendar pC,
java.util.GregorianCalendar parentCalendar,
JsetValueCallback callback,
boolean showTime,
boolean editable) |
JpanelCalendar(JpopUpCalendar pC,
java.util.GregorianCalendar parentCalendar,
JsetValueCallback callback,
boolean showTime,
boolean compact,
boolean editable) |
| Modifier and Type | Method and Description |
|---|---|
void |
actionPerformed(java.awt.event.ActionEvent e)
Our buttons call us back here.
|
void |
buttonPressed(JdateButton _bttn)
This method handles the final processing of any calendar button
pushed.
|
void |
clear() |
void |
displaySelectedPage()
This method forces the calendar to jump to the page containing the
selected date.
|
boolean |
getAllowMonthChange()
This method may be used to query the calendar to see if the
month and year changing buttons are enabled.
|
java.util.Date |
getDate()
This method returns the selected date held in this calendar.
|
int |
getSelectedMonth()
This method returns the month of the year for the selected
date, in the range 0-11.
|
java.lang.String |
getSelectedMonthString()
This method returns a string describing the month and year
of the currently selected date
|
int |
getSelectedYear()
This method returns the year being displayed
in the calendar gui.
|
int |
getVisibleMonth()
This method returns the month of the year
currently being displayed in the calendar gui,
in the range 0-11.
|
int |
getVisibleYear()
This method returns the year being displayed
in the calendar gui.
|
boolean |
isEditable()
Returns true if this calendar is configured to allow editing
of the selected date.
|
static void |
main(java.lang.String[] argv)
Command line test rig
|
void |
setAllowMonthChange(boolean okay)
This method may be used to enable or disable the month and year changing
buttons.
|
void |
setDate(java.util.Date date)
This is the main programmatic entry point for setting the date selected
in this calendar widget.
|
private void |
setYear(int year) |
void |
timeChanged(java.lang.String _field,
int _value)
This method is used to update the calendar's notion of time from
information passed in from the time panel.
|
void |
update()
This method takes the current time held in selectedDate_calendar and refreshes
the calendar with it.
|
void |
update(java.awt.Graphics g) |
(package private) void |
updateDate()
This will update the visibleDate_calendar according to the current
year and month visible in the GUI controls.
|
protected void |
writeDates()
This method updates the calendar buttons from the time information held
in visibleDate_calendar.
|
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, unregisterKeyboardActionadd, 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
TranslationService object for handling string localization in the Ganymede system.
static final java.text.DateFormatSymbols symbolTable
Localized DateFormatSymbols for us to use appropriate month and week day strings.
static final int[] leapDays
static final int[] monthDays
static final java.lang.String[] month_names
protected java.util.GregorianCalendar selectedDate_calendar
protected java.util.GregorianCalendar visibleDate_calendar
protected JsetValueCallback callback
Who do we notify when the user changes the date through direct manipulation of the calendar?
protected JpopUpCalendar pCal
If we are contained in a pop-up, this will refer to the dialog frame, so that the close button can close it.
protected javax.swing.JButton closeButton
protected javax.swing.JButton resetButton
protected JdateButton[] _datebuttonArray
The meat of the calendar. This array of JdateButton's are both the display and the main user interface element for the JpanelCalendar.
private JMonthYearPanel monthYearPanel
private javax.swing.JPanel calButtonPanel
private javax.swing.JPanel buttonPanel
private JTimePanel timePanel
protected java.awt.Font todayFont
protected java.awt.Font notTodayFont
private boolean editable
If true, we will allow the calendar to be used to change the date/time selected. If false, we will be display only.
private boolean dateIsSet
Used to control whether we show a selected day in the calendar. If false, no date has been set, and we'll show all calendar pages with no dates highlighed.
private boolean showTime
If true, we'll show the time of day in the calendar, and allow the user to edit the time of day if we are editable. If false, we'll show the the date only.
private boolean allowMonthChange
If true, we'll allow the use to change the month and year displayed in the calendar.
private boolean compact
If true, we'll try to render the calendar in a compressed form, with less space for the calendar buttons.
private java.util.Date previousDate
The last known good date. If we attempt to pass a date change back to our client and the attempt fails, this is the date we'll revert to afterwards.
private boolean inhibitPainting
public JpanelCalendar(java.util.GregorianCalendar parentCalendar,
JsetValueCallback callback,
boolean editable)
public JpanelCalendar(java.util.GregorianCalendar parentCalendar,
JsetValueCallback callback,
boolean showTime,
boolean editable)
showTime - If true, then the "Choose a time" part will be there. Also, if true, time will appear in date at top.public JpanelCalendar(JpopUpCalendar pC, java.util.GregorianCalendar parentCalendar, JsetValueCallback callback, boolean editable)
public JpanelCalendar(JpopUpCalendar pC, java.util.GregorianCalendar parentCalendar, JsetValueCallback callback, boolean showTime, boolean editable)
public JpanelCalendar(JpopUpCalendar pC, java.util.GregorianCalendar parentCalendar, JsetValueCallback callback, boolean showTime, boolean compact, boolean editable)
compact - If true, calendar will be drawn smaller.public JpanelCalendar(java.util.GregorianCalendar parentCalendar,
JsetValueCallback callback,
boolean showTime,
boolean compact,
boolean editable)
The main constructor. Here's where all the magic happens.
public void setDate(java.util.Date date)
This is the main programmatic entry point for setting the date selected in this calendar widget. Calling this method will update the selected time/date to that passed, and will redraw the calendar with the selected time/date shown.
Calling this method will not trigger a callback to report the date change to our client.
public java.util.Date getDate()
This method returns the selected date held in this calendar.
public boolean isEditable()
Returns true if this calendar is configured to allow editing of the selected date.
public int getVisibleMonth()
This method returns the month of the year currently being displayed in the calendar gui, in the range 0-11.
public int getSelectedMonth()
This method returns the month of the year for the selected date, in the range 0-11.
public int getVisibleYear()
This method returns the year being displayed in the calendar gui.
public int getSelectedYear()
This method returns the year being displayed in the calendar gui.
private void setYear(int year)
public void clear()
public void setAllowMonthChange(boolean okay)
This method may be used to enable or disable the month and year changing buttons. If this method is called with a false parameter, the calendar will not allow changing of the month/year.
By default, the JpanelCalendar allows month flipping in editable calendars and does not allow it in non-editable calendars.
public boolean getAllowMonthChange()
This method may be used to query the calendar to see if the month and year changing buttons are enabled. If this method returns false, the calendar does not allow changing of the month/year.
void updateDate()
public void displaySelectedPage()
This method forces the calendar to jump to the page containing the selected date.
public java.lang.String getSelectedMonthString()
This method returns a string describing the month and year of the currently selected date
public void actionPerformed(java.awt.event.ActionEvent e)
actionPerformed in interface java.awt.event.ActionListenerpublic void update()
protected void writeDates()
This method updates the calendar buttons from the time information held in visibleDate_calendar.
public void update(java.awt.Graphics g)
update in class javax.swing.JComponentpublic void buttonPressed(JdateButton _bttn)
public void timeChanged(java.lang.String _field,
int _value)
public static void main(java.lang.String[] argv)