public class DateChooserCombo extends AbstractCombo
FormattedText
and DateChooser
.
Issues notification when the text content is modified or when a date is selected in the calendar.
Modifier and Type | Field and Description |
---|---|
protected static org.eclipse.swt.graphics.Image |
buttonImage
Default image for the button
|
protected boolean |
footerVisible
Flag to set footer visible or not in the popup
|
protected FormattedText |
formattedText
FormattedText widget for edition of the date
|
protected int |
gridVisible
Flag to set grid visible or not in the popup
|
protected static java.lang.String |
IMAGE
Default image filename
|
protected java.util.Locale |
locale
Locale used for localized names and formats
|
protected DateChooserTheme |
theme
Calendar theme
|
protected boolean |
weeksVisible
Flag to set weeks numbers visible or not
|
_shell, button, createOnDrop, filter, GTK, hasFocus, listener, popup, popupContent, showButtonOnFocus, text, WIN32
Constructor and Description |
---|
DateChooserCombo(org.eclipse.swt.widgets.Composite parent,
int style)
Constructs a new instance of this class given its parent and a style value
describing its behavior and appearance.
|
Modifier and Type | Method and Description |
---|---|
void |
addKeyListener(org.eclipse.swt.events.KeyListener listener)
Adds the listener to the collection of listeners who will be notified when
keys are pressed and released on the system keyboard, by sending it one of
the messages defined in the KeyListener interface.
The listener is set on the Text widget, as there is no sense to have it
on the Composite.
|
protected void |
beforeDrop()
Called just before the popup is dropped.
|
org.eclipse.swt.graphics.Point |
computeSize(int wHint,
int hHint,
boolean changed)
Returns the preferred size of the receiver.
If wHint == SWT.DEFAULT, the preferred size is computed to adjust the width to display a date in the MM/dd/yyyy format. |
protected org.eclipse.swt.widgets.Button |
createButtonControl(int style)
Creates the button widget.
|
protected org.eclipse.swt.widgets.Control |
createPopupContent(org.eclipse.swt.widgets.Composite parent)
Creates the popup content.
|
protected org.eclipse.swt.widgets.Text |
createTextControl(int style)
Creates the text widget.
|
protected boolean |
doSelection()
This method is called when a SWT.Selection is notify in the popup content,
allowing to update the Text widget content.
|
protected void |
dropDown(boolean drop)
Manages drop down of the popup.
|
int |
getGridVisible()
Returns the grid visibility status.
|
java.util.Date |
getValue()
Returns the current
Date value of the widget. |
boolean |
isFooterVisible()
Returns true if footer is visible in the popup calendar.
|
boolean |
isGridVisible()
Deprecated.
|
boolean |
isWeeksVisible()
Returns true if weeks numbers are visible.
|
void |
removeKeyListener(org.eclipse.swt.events.KeyListener listener)
Removes the listener from the collection of listeners who will
be notified when keys are pressed and released on the system keyboard.
|
void |
setFooterVisible(boolean footerVisible)
Sets the footer of popup calendar visible or not.
|
void |
setFormatter(DateFormatter formatter)
Associates a new
DateFormatter to the text widget, replacing
the default one. |
void |
setGridVisible(boolean gridVisible)
Deprecated.
|
void |
setGridVisible(int gridVisible)
Sets the grid visible or not.
|
void |
setImage(org.eclipse.swt.graphics.Image image)
Sets a new image to display on the button, replacing the default one.
|
void |
setLocale(java.util.Locale locale)
Sets the locale used both by the input mask and the calendar.
|
void |
setTheme(DateChooserTheme theme)
Sets the theme to apply to the calendar popup.
|
void |
setValue(java.util.Date value)
Sets a new
Date value. |
void |
setWeeksVisible(boolean weeksVisible)
Sets the weeks numbers visible or not.
|
addModifyListener, addSelectionListener, addVerifyListener, buttonEvent, checkStyle, comboEvent, contentEvent, copy, createPopup, cut, getEditable, getPopupVisible, getSelection, getShell, getStyle, getText, getTextHeight, getTextLimit, handleFocus, isDropped, isFocusControl, isShowButtonOnFocus, paste, popupEvent, redraw, redraw, removeModifyListener, removeSelectionListener, removeVerifyListener, selectAll, setBackground, setCreateOnDrop, setEditable, setEnabled, setFocus, setFont, setForeground, setLayout, setMenu, setPopupLocation, setSelection, setShowButtonOnFocus, setTextLimit, setToolTipText, setVisible, textEvent, updateButtonDisplay
changed, checkSubclass, drawBackground, getBackgroundMode, getChildren, getLayout, getLayoutDeferred, getTabList, isLayoutDeferred, layout, layout, layout, layout, layout, setBackgroundMode, setLayoutDeferred, setTabList
computeTrim, getClientArea, getHorizontalBar, getScrollbarsMode, getVerticalBar
addControlListener, addDragDetectListener, addFocusListener, addGestureListener, addHelpListener, addMenuDetectListener, addMouseListener, addMouseMoveListener, addMouseTrackListener, addMouseWheelListener, addPaintListener, addTouchListener, addTraverseListener, computeSize, dragDetect, dragDetect, forceFocus, getAccessible, getBackground, getBackgroundImage, getBorderWidth, getBounds, getCursor, getDragDetect, getEnabled, getFont, getForeground, getLayoutData, getLocation, getMenu, getMonitor, getOrientation, getParent, getRegion, getSize, getTextDirection, getToolTipText, getTouchEnabled, getVisible, internal_dispose_GC, internal_new_GC, isEnabled, isReparentable, isVisible, moveAbove, moveBelow, pack, pack, print, removeControlListener, removeDragDetectListener, removeFocusListener, removeGestureListener, removeHelpListener, removeMenuDetectListener, removeMouseListener, removeMouseMoveListener, removeMouseTrackListener, removeMouseWheelListener, removePaintListener, removeTouchListener, removeTraverseListener, requestLayout, setBackgroundImage, setBounds, setBounds, setCapture, setCursor, setDragDetect, setLayoutData, setLocation, setLocation, setOrientation, setParent, setRedraw, setRegion, setSize, setSize, setTextDirection, setTouchEnabled, toControl, toControl, toDisplay, toDisplay, traverse, traverse, traverse, update
addDisposeListener, addListener, checkWidget, dispose, getData, getData, getDisplay, getListeners, isAutoDirection, isDisposed, isListening, notifyListeners, removeDisposeListener, removeListener, removeListener, reskin, setData, setData, toString
protected static final java.lang.String IMAGE
protected static org.eclipse.swt.graphics.Image buttonImage
protected FormattedText formattedText
protected boolean footerVisible
protected int gridVisible
protected boolean weeksVisible
protected DateChooserTheme theme
protected java.util.Locale locale
public DateChooserCombo(org.eclipse.swt.widgets.Composite parent, int style)
The widget is initialized with a default image for the button, and a
default DateFormatter
.
parent
- a composite control which will be the parent of the new instance (cannot be null)style
- the style of control to constructpublic void addKeyListener(org.eclipse.swt.events.KeyListener listener)
addKeyListener
in class org.eclipse.swt.widgets.Control
listener
- the listener which should be notifiedprotected void beforeDrop()
beforeDrop
in class AbstractCombo
AbstractCombo.beforeDrop()
public org.eclipse.swt.graphics.Point computeSize(int wHint, int hHint, boolean changed)
computeSize
in class org.eclipse.swt.widgets.Control
wHint
- the width hint (can be SWT.DEFAULT)hHint
- the height hint (can be SWT.DEFAULT)changed
- true
if the control's contents have changed, and false
otherwiseprotected org.eclipse.swt.widgets.Button createButtonControl(int style)
createButtonControl
in class AbstractCombo
style
- button styleAbstractCombo.createButtonControl(int)
protected org.eclipse.swt.widgets.Control createPopupContent(org.eclipse.swt.widgets.Composite parent)
DateChooser
.createPopupContent
in class AbstractCombo
parent
- The parent Composite that will contain the controlprotected org.eclipse.swt.widgets.Text createTextControl(int style)
FormattedText
with the default formatter for Date
values.
The formatter is provided by DefaultFormatterFactory
. By default
a DateFormatter
is returned. This can be changed by
registering a new formatter for Date class.createTextControl
in class AbstractCombo
style
- text styleAbstractCombo.createTextControl(int)
protected boolean doSelection()
doSelection
in class AbstractCombo
protected void dropDown(boolean drop)
AbstractCombo
dropDown
in class AbstractCombo
drop
- true
to drop the popup, false
to closeAbstractCombo.dropDown(boolean)
public int getGridVisible()
public java.util.Date getValue()
Date
value of the widget.
public boolean isFooterVisible()
true
if footer visible, else false
public boolean isGridVisible()
public boolean isWeeksVisible()
public void removeKeyListener(org.eclipse.swt.events.KeyListener listener)
removeKeyListener
in class org.eclipse.swt.widgets.Control
listener
- the listener which should no longer be notifiedpublic void setFooterVisible(boolean footerVisible)
footerVisible
- true
to set footer visible, else false
public void setFormatter(DateFormatter formatter)
DateFormatter
to the text widget, replacing
the default one.formatter
- date formatterpublic void setGridVisible(boolean gridVisible)
gridVisible
- true
to set grid visible, else false
public void setGridVisible(int gridVisible)
gridVisible
- grid visibility flagpublic void setImage(org.eclipse.swt.graphics.Image image)
image
- new imagepublic void setLocale(java.util.Locale locale)
locale
- localepublic void setTheme(DateChooserTheme theme)
theme
- new theme (must not be null)public void setValue(java.util.Date value)
Date
value.value
- new date valuepublic void setWeeksVisible(boolean weeksVisible)
weeksVisible
- true
to set weeks visible, else false