JClass DesktopViews 6.3.0 API
Documentation

com.klg.jclass.swing
Class DateTimePopup

java.lang.Object
  |
  +--com.klg.jclass.swing.DateTimePopup
All Implemented Interfaces:
EventListener, JCPopupCalendarEditor, JCValueListener, Serializable

public class DateTimePopup
extends Object
implements JCPopupCalendarEditor, JCValueListener

Class that functions as the popup editor for JCPopupCalendar.

See Also:
Serialized Form

Field Summary
protected  com.klg.jclass.swing.DateTimeChooser chooser
          A date/time chooser component to do the editing.
protected  com.klg.jclass.util.value.JCValueModel model
          Value model used to store the editor's value.
protected  Component parent
          The popup's parent.
protected  com.klg.jclass.util.JCListenerList popupListeners
          A list of listeners to tell about value changes.
 
Constructor Summary
DateTimePopup()
          A no arguments constructor.
DateTimePopup(Component parent)
          A constructor with a given parent.
DateTimePopup(Component parent, Calendar c)
          Create a DateTimePopup with a given date/time but otherwise with default values.
DateTimePopup(Component parent, int chooserType, boolean showTimeComponent, boolean showApplyButton, Locale l, Calendar c)
          Create a DateTimePopup of the given chooserType.
DateTimePopup(Component parent, int chooserType, boolean showTimeComponent, boolean showApplyButton, Locale l, Calendar c, String[] months, String[] shortMonths, String[] days)
          Create a DateTimePopup of the given chooserType.
 
Method Summary
 void addPopupListener(com.klg.jclass.util.swing.JCPopupListener l)
          Add a JCPopupListener to the popup to inform when the value in the popup component has been committed.
 void firePopupEvent()
          Fire a popup event to all listeners.
 com.klg.jclass.swing.DateTimeChooser getDateTimeChooser()
          Returns the DateTimeChooser component that does the date/time editing.
 JComponent getEditorComponent()
          Returns the component in the popup that does the date/time editing.
 boolean getHidePopupOnDayTableClick()
          Get whether the popup will popdown when the user selects a day on the day table.
 boolean getShowApplyButton()
          Get whether an apply button be shown in the popup.
 boolean getShowTimeComponent()
          Returns whether the time component should appear or not.
 void removePopupListener(com.klg.jclass.util.swing.JCPopupListener l)
          Removes a JCPopupListener.
 void setFont(Font f)
          Sets the Font of the popup.
 void setHidePopupOnDayTableClick(boolean hidePopupOnDayTableClick)
          Set whether the popup will popdown when the user selects a day on the day table.
 void setLocale(Locale locale)
          Sets the locale being used by the popup.
 void setMaximumDate(Object maxDate)
          Sets the maximum date.
 void setMinimumDate(Object minDate)
          Sets the minimum date.
 void setShowApplyButton(boolean showApplyButton)
          Set whether an apply button be shown in the popup.
 void setShowTimeComponent(boolean showTimeComponent)
          Sets whether the time component should appear or not.
 void setValue(Object value)
          Sets the value in the popup editor.
 void valueChanged(com.klg.jclass.util.value.JCValueEvent event)
          The method informs a listener that the value has been changed.
 void valueChanging(com.klg.jclass.util.value.JCValueEvent event)
          The value is changing.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

parent

protected Component parent
The popup's parent. Normally a JCPopupCalendar.


chooser

protected com.klg.jclass.swing.DateTimeChooser chooser
A date/time chooser component to do the editing.


popupListeners

protected com.klg.jclass.util.JCListenerList popupListeners
A list of listeners to tell about value changes.


model

protected com.klg.jclass.util.value.JCValueModel model
Value model used to store the editor's value.

Constructor Detail

DateTimePopup

public DateTimePopup()
A no arguments constructor. Create a DateTimePopup with default values.


DateTimePopup

public DateTimePopup(Component parent)
A constructor with a given parent. For all other values, the DateTimePopup will be created with default values.

Parameters:
parent - The popup's parent.

DateTimePopup

public DateTimePopup(Component parent,
                     Calendar c)
Create a DateTimePopup with a given date/time but otherwise with default values.

Parameters:
parent - The popup's parent.
c - The date/time stored in a Calendar object

DateTimePopup

public DateTimePopup(Component parent,
                     int chooserType,
                     boolean showTimeComponent,
                     boolean showApplyButton,
                     Locale l,
                     Calendar c)
Create a DateTimePopup of the given chooserType. Also specify whether a time component should be shown, the locale, and the date/time to use.

Parameters:
parent - The popup's parent
chooserType - The type of date chooser. Must be one of JCDateChooser.QUICK_SELECT, JCDateChooser.DUAL_SPIN, JCDateChooser.SPIN_POPDOWN, or JCDateChooser.READ_ONLY. Note that specifying JCDateChooser.SPIN_POPDOWN will cause JCDateChooser.DUAL_SPIN to be used because we cannot have a popdown within a popdown.
showTimeComponent - Determines whether the time component is shown or not.
showApplyButton - Determines whether the apply button is shown or not.
l - The locale to use
c - The date/time stored in a Calendar object

DateTimePopup

public DateTimePopup(Component parent,
                     int chooserType,
                     boolean showTimeComponent,
                     boolean showApplyButton,
                     Locale l,
                     Calendar c,
                     String[] months,
                     String[] shortMonths,
                     String[] days)
Create a DateTimePopup of the given chooserType. Also specify whether a time component should be shown, the locale, the date/time to use, and a list of month, shortMonth, and day strings to use for the calendar.

Parameters:
parent - The popup's parent
chooserType - The type of date chooser. Must be one of JCDateChooser.QUICK_SELECT, JCDateChooser.DUAL_SPIN, JCDateChooser.SPIN_POPDOWN, or JCDateChooser.READ_ONLY. Note that specifying JCDateChooser.SPIN_POPDOWN will cause JCDateChooser.DUAL_SPIN to be used because we cannot have a popdown within a popdown.
showTimeComponent - Determines whether the time component is shown or not.
showApplyButton - Determines whether the apply button is shown or not.
l - The locale to use
c - The date/time stored in a Calendar object
months - The month strings to use for the calendar. Note that this array must be the correct size for the locale (or longer).
shortMonths - The shortMonth strings to use for the calendar. Note that this array must be the correct size for the locale (or longer).
days - The day strings to use for the calendar. Note that this array must be the correct size for the locale (or longer).
Method Detail

getDateTimeChooser

public com.klg.jclass.swing.DateTimeChooser getDateTimeChooser()
Returns the DateTimeChooser component that does the date/time editing.

Returns:
The component which does the date/time editing for this popup.

getEditorComponent

public JComponent getEditorComponent()
Returns the component in the popup that does the date/time editing. Note this is the same as getDateTimeChooser() but this method is needed for the CalendarPopupEditor interface.

Specified by:
getEditorComponent in interface JCPopupCalendarEditor
Returns:
The component which does the date/time editing for this popup.
See Also:
getDateTimeChooser()

addPopupListener

public void addPopupListener(com.klg.jclass.util.swing.JCPopupListener l)
Add a JCPopupListener to the popup to inform when the value in the popup component has been committed.

Specified by:
addPopupListener in interface JCPopupCalendarEditor
Parameters:
l - The popup listener to add

removePopupListener

public void removePopupListener(com.klg.jclass.util.swing.JCPopupListener l)
Removes a JCPopupListener.

Specified by:
removePopupListener in interface JCPopupCalendarEditor
Parameters:
l - The popup listener to remove

firePopupEvent

public void firePopupEvent()
Fire a popup event to all listeners.

Specified by:
firePopupEvent in interface JCPopupCalendarEditor

setValue

public void setValue(Object value)
Sets the value in the popup editor.

Specified by:
setValue in interface JCPopupCalendarEditor
Parameters:
value - The value to set on the popup editor. This value can be of type Calendar or Date.

setMinimumDate

public void setMinimumDate(Object minDate)
Sets the minimum date. The calendar cannot change to before this date.

Specified by:
setMinimumDate in interface JCPopupCalendarEditor
Parameters:
minDate - The new minimum date. This value can be of type Calendar or Date.

setMaximumDate

public void setMaximumDate(Object maxDate)
Sets the maximum date. The calendar cannot change to after this date.

Specified by:
setMaximumDate in interface JCPopupCalendarEditor
Parameters:
maxDate - The new maximum date. This value can be of type Calendar or Date.

setLocale

public void setLocale(Locale locale)
Sets the locale being used by the popup. In turn, this object sets the locale on the DateTimeChooser, which will set it on its child components.

Specified by:
setLocale in interface JCPopupCalendarEditor
Parameters:
locale - The new locale to be used

setFont

public void setFont(Font f)
Sets the Font of the popup. This font gets propagated to the child components

Specified by:
setFont in interface JCPopupCalendarEditor
Parameters:
f - the new Font for the popup

setShowTimeComponent

public void setShowTimeComponent(boolean showTimeComponent)
Sets whether the time component should appear or not.

Specified by:
setShowTimeComponent in interface JCPopupCalendarEditor
Parameters:
showTimeComponent - If true, the time component will appear

getShowTimeComponent

public boolean getShowTimeComponent()
Returns whether the time component should appear or not.

Specified by:
getShowTimeComponent in interface JCPopupCalendarEditor
Returns:
true, if the time component should appear

setShowApplyButton

public void setShowApplyButton(boolean showApplyButton)
Set whether an apply button be shown in the popup. If an apply button is shown, clicking on the button applies the value to the model and hides the popup.

Specified by:
setShowApplyButton in interface JCPopupCalendarEditor
Parameters:
showApplyButton - If true, an apply button is shown in the popup.

getShowApplyButton

public boolean getShowApplyButton()
Get whether an apply button be shown in the popup. If an apply button is shown, clicking on the button applies the value to the model and hides the popup.

Specified by:
getShowApplyButton in interface JCPopupCalendarEditor
Returns:
true, if the apply button will appear.

setHidePopupOnDayTableClick

public void setHidePopupOnDayTableClick(boolean hidePopupOnDayTableClick)
Set whether the popup will popdown when the user selects a day on the day table.

Specified by:
setHidePopupOnDayTableClick in interface JCPopupCalendarEditor
Parameters:
hidePopupOnDayTableClick - If true, the popup will popdown when the user selects a day on the day table.

getHidePopupOnDayTableClick

public boolean getHidePopupOnDayTableClick()
Get whether the popup will popdown when the user selects a day on the day table.

Specified by:
getHidePopupOnDayTableClick in interface JCPopupCalendarEditor
Returns:
true, if the popup will popdown when the user selects a day on the day table.

valueChanging

public void valueChanging(com.klg.jclass.util.value.JCValueEvent event)
The value is changing. A listener may further change the new_value or abort the change altogether. In the case of an abort (initiatied by calling event.setAllowChange(false)), the valueChanged method will never be called.

Specified by:
valueChanging in interface JCValueListener
Parameters:
event - The event generated by the value changing

valueChanged

public void valueChanged(com.klg.jclass.util.value.JCValueEvent event)
The method informs a listener that the value has been changed.

Specified by:
valueChanged in interface JCValueListener
Parameters:
event - The event generated by the value changed

Copyright © 2004 Quest Software Inc..
All rights reserved.