Class Date_selector_dialog
- java.lang.Object
-
- java.awt.Component
-
- java.awt.Container
-
- java.awt.Window
-
- java.awt.Dialog
-
- javax.swing.JDialog
-
- com.inductiveautomation.ignition.client.util.gui.date_selector.Popup_dialog
-
- com.inductiveautomation.ignition.client.util.gui.date_selector.Date_selector_dialog
-
- All Implemented Interfaces:
Date_selector
,java.awt.image.ImageObserver
,java.awt.MenuContainer
,java.io.Serializable
,javax.accessibility.Accessible
,javax.swing.RootPaneContainer
,javax.swing.WindowConstants
public class Date_selector_dialog extends Popup_dialog implements Date_selector
The Date_selector_dialog, shown below, combines aDate_selector
and aPopup_dialog
to provide a standalone, popup dialog for choosing dates.The class does implement the
Date_selector
interface, but bear in mind that the window closes when the user selects a date. Unlike theTitled_date_selector
wrapper class, both of the action events are sent to listeners, however. Create one the hard way like this:Date_selector calendar = new Date_selector_panel(selector); calendar = new Navigable_date_selector(calendar); // add navigation Date_selector_dialog chooser = new Date_selector_dialog(parent_frame, calendar); //... Date d = chooser.select(); // Pops up chooser; returns selected Date.
You can leave out the navigation bar by omitting the second line of the previous example. The following convenience constructor has exactly the same effect as the earlier code:
Date_selector_dialog chooser = new Date_selector_dialog(parent_frame); <pre> You can also pop up the dialog like this: <pre> chooser.setVisible(true); // blocks until dialog closed Date d = chooser.get_selected_date(); </pre>
This class is a stand-alone dialog. For a version that you can embed into another window, seeDate_selector_panel
.@see Date_selector @see Date_selector_panel @see Navigable_date_selector @see Titled_date_selector
- See Also:
Popup_dialog
, Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class javax.swing.JDialog
javax.swing.JDialog.AccessibleJDialog
-
Nested classes/interfaces inherited from class java.awt.Dialog
java.awt.Dialog.AccessibleAWTDialog, java.awt.Dialog.ModalExclusionType, java.awt.Dialog.ModalityType
-
Nested classes/interfaces inherited from class java.awt.Window
java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
-
-
Field Summary
-
Fields inherited from class javax.swing.JDialog
accessibleContext, rootPane, rootPaneCheckingEnabled
-
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
-
Fields inherited from interface com.inductiveautomation.ignition.client.util.gui.date_selector.Date_selector
CHANGE_ACTION, COMMIT_ACTION, SELECT_ACTION
-
-
Constructor Summary
Constructors Constructor Description Date_selector_dialog(java.awt.Dialog parent)
Date_selector_dialog(java.awt.Dialog parent, Date_selector toWrap)
LikeDate_selector_dialog(Frame, Date_selector)
, but for aDialog
parent.Date_selector_dialog(java.awt.Frame parent)
Creates a dialog box with the indicated parent that holds a standardDate_selector_panel
(as created using the no-arg constructor).Date_selector_dialog(java.awt.Frame parent, Date_selector toWrap)
Creates a dialog box with the indicated parent that holds the indicated Date_selector.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addActionListener(java.awt.event.ActionListener l)
Add an action listner for bothDate_selector.CHANGE_ACTION
andDate_selector.SELECT_ACTION
action events.int
get(int f)
Must work just likeCalendar.get(int)
java.util.Date
get_current_date()
Get the current date.java.util.Date
get_selected_date()
For use when you pop up a dialog usingsetVisible(true)
rather thanselect()
.int
getCloseAction()
javax.swing.JComponent
getComponent()
Date_selector
getInnerSelector()
void
removeActionListener(java.awt.event.ActionListener l)
Remove a previously-added listenervoid
roll(int f, boolean up)
Must work just likeCalendar.roll(int, boolean)
java.util.Date
select()
Pops up the chooser and blocks until the user selects a date.void
set_selected_date(java.util.Date d)
void
setCloseAction(int i)
The close action to set.-
Methods inherited from class com.inductiveautomation.ignition.client.util.gui.date_selector.Popup_dialog
getContentPane
-
Methods inherited from class javax.swing.JDialog
addImpl, createRootPane, dialogInit, getAccessibleContext, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
-
Methods inherited from class java.awt.Dialog
addNotify, getModalityType, getTitle, hide, isModal, isResizable, isUndecorated, setBackground, setModal, setModalityType, setOpacity, setResizable, setShape, setTitle, setUndecorated, setVisible, show, toBack
-
Methods inherited from class java.awt.Window
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeNotify, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImage, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, toFront
-
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, 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, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setMixingCutoutShape, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
-
-
-
Constructor Detail
-
Date_selector_dialog
public Date_selector_dialog(java.awt.Frame parent)
Creates a dialog box with the indicated parent that holds a standardDate_selector_panel
(as created using the no-arg constructor).
-
Date_selector_dialog
public Date_selector_dialog(java.awt.Dialog parent)
-
Date_selector_dialog
public Date_selector_dialog(java.awt.Frame parent, Date_selector toWrap)
Creates a dialog box with the indicated parent that holds the indicated Date_selector. Note that the current month and year is displayed in the dialog-box title bar, so there's no need to display it in the selector too.
-
Date_selector_dialog
public Date_selector_dialog(java.awt.Dialog parent, Date_selector toWrap)
LikeDate_selector_dialog(Frame, Date_selector)
, but for aDialog
parent.
-
-
Method Detail
-
get_selected_date
public java.util.Date get_selected_date()
For use when you pop up a dialog usingsetVisible(true)
rather thanselect()
.- Specified by:
get_selected_date
in interfaceDate_selector
- Returns:
- the selected date or null if the dialog was closed without selecting anything.
-
get_current_date
public java.util.Date get_current_date()
Get the current date. The dialog stays in existance until the user closes it or selects a date, so this method can be used to see what month the user has scrolled to.- Specified by:
get_current_date
in interfaceDate_selector
- Returns:
- the date currently displayed on the calendar.
-
set_selected_date
public void set_selected_date(java.util.Date d)
- Specified by:
set_selected_date
in interfaceDate_selector
-
addActionListener
public void addActionListener(java.awt.event.ActionListener l)
Add an action listner for bothDate_selector.CHANGE_ACTION
andDate_selector.SELECT_ACTION
action events.- Specified by:
addActionListener
in interfaceDate_selector
-
removeActionListener
public void removeActionListener(java.awt.event.ActionListener l)
Remove a previously-added listener- Specified by:
removeActionListener
in interfaceDate_selector
-
select
public java.util.Date select()
Pops up the chooser and blocks until the user selects a date.- Returns:
- the selected date or null if the dialog was closed without selecting anything.
-
roll
public void roll(int f, boolean up)
Description copied from interface:Date_selector
Must work just likeCalendar.roll(int, boolean)
- Specified by:
roll
in interfaceDate_selector
-
get
public int get(int f)
Description copied from interface:Date_selector
Must work just likeCalendar.get(int)
- Specified by:
get
in interfaceDate_selector
-
getCloseAction
public int getCloseAction()
- Returns:
- Current close action: Date_selector.CHANGE_ACTION, Date_selector.SELECT_ACTION, or Date_selector.COMMIT_ACTION
-
setCloseAction
public void setCloseAction(int i)
The close action to set. Allowable values are Date_selector.CHANGE_ACTION, Date_selector.SELECT_ACTION, and Date_selector.COMMIT_ACTION
-
getComponent
public javax.swing.JComponent getComponent()
- Specified by:
getComponent
in interfaceDate_selector
-
getInnerSelector
public Date_selector getInnerSelector()
- Specified by:
getInnerSelector
in interfaceDate_selector
- Returns:
- A reference to any 'inner' selector inside this
Date_selector
implementation. May returnthis
.
-
-