Class DateTime
- All Implemented Interfaces:
Drawable
Note that although this class is a subclass of Composite,
it does not make sense to add children to it, or set a layout on it.
- Styles:
- DATE, TIME, CALENDAR, SHORT, MEDIUM, LONG, DROP_DOWN, CALENDAR_WEEKNUMBERS
- Events:
- DefaultSelection, Selection
Note: Only one of the styles DATE, TIME, or CALENDAR may be specified, and only one of the styles SHORT, MEDIUM, or LONG may be specified. The DROP_DOWN style is only valid with the DATE style.
IMPORTANT: This class is not intended to be subclassed.
- Since:
- 3.3
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) Color(package private) Calendar(package private) longMajor handles of this class.(package private) longMajor handles of this class.(package private) FieldPositionprivate DateFormat(package private) int(package private) static final String(package private) static final String(package private) static final String(package private) static final String(package private) static final String(package private) static final String(package private) Button(package private) longGTK4 field used to hold the main GtkEditable widget.(package private) Color(package private) boolean(package private) boolean(package private) int(package private) Locale(package private) static final intprivate intprivate int(package private) static final int(package private) int(package private) int(package private) ListenerUsed when SWT.DROP_DOWN is set(package private) DateTime(package private) Listener(package private) Listener(package private) Shell(package private) Point(package private) int(package private) int(package private) int(package private) int(package private) static final int(package private) longMajor handles of this class.(package private) longMajor handles of this class.(package private) StringBuilder(package private) int(package private) intFields inherited from class Composite
backgroundMode, childrenLowered, embeddedHandle, fixClipHandle, fixClipMap, imHandle, layout, layoutCount, NO_INPUT_METHOD, noChildDrawing, popupChild, socketHandle, tabListFields inherited from class Scrollable
horizontalBar, RESIZE_ON_GETCLIENTAREA, scrolledHandle, verticalBarFields inherited from class Control
accessible, autoScale, backgroundAlpha, backgroundImage, cachedNoBackground, checkScaleFactor, cssBackground, cssForeground, cursor, DISABLE_EMOJI, dragDetectionQueue, dragGesture, drawCount, drawRegion, enableWindow, eventRegion, firstFixedHandle, fixedHandle, font, gestureBegin, gestureEnd, gestureRotation, gestureSwipe, gestureZoom, keyController, labelRelation, lastInput, layoutData, menu, mouseDown, panGesture, parent, provider, redrawWindow, region, regionHandle, rotateGesture, toolTipText, zoomGestureFields inherited from class Widget
ACTIVATE, ACTIVATE_INVERSE, AUTO_TEXT_DIRECTION, BACKGROUND, BACKSPACE, BACKSPACE_INVERSE, BUTTON_PRESS_EVENT, BUTTON_PRESS_EVENT_INVERSE, BUTTON_RELEASE_EVENT, BUTTON_RELEASE_EVENT_INVERSE, CANVAS, CHANGE_VALUE, CHANGED, CHECK_SUBWINDOW, CLICKED, CLOSE_REQUEST, COMMIT, COMPUTE_SIZE, CONFIGURE_EVENT, COPY_CLIPBOARD, COPY_CLIPBOARD_INVERSE, CREATE_MENU_PROXY, CUT_CLIPBOARD, CUT_CLIPBOARD_INVERSE, data, DAY_SELECTED, DAY_SELECTED_DOUBLE_CLICK, DECELERATE, DEFAULT_HEIGHT, DEFAULT_WIDTH, DELETE_EVENT, DELETE_FROM_CURSOR, DELETE_FROM_CURSOR_INVERSE, DELETE_RANGE, DELETE_TEXT, DIRECTION_CHANGED, DISABLED, display, DISPOSE_SENT, DISPOSED, DPI_CHANGED, DRAG_DETECT, DRAW, ENTER, ENTER_NOTIFY_EVENT, EVENT, EVENT_AFTER, eventTable, EXPAND_COLLAPSE_CURSOR_ROW, EXPOSE_EVENT, EXPOSE_EVENT_INVERSE, FOCUS, FOCUS_IN, FOCUS_IN_EVENT, FOCUS_OUT, FOCUS_OUT_EVENT, FONT, FOREGROUND, FOREIGN_HANDLE, gdkSeatGrabPrepareFunc, GESTURE_PRESSED, GESTURE_RELEASED, GRAB_FOCUS, handle, HANDLE, HAS_AUTO_DIRECTION, HIDDEN, HIDE, ICON_RELEASE, IM_UPDATE, INPUT, INSERT_TEXT, IS_ACTIVE, KEY_CHECK_SUBWINDOW, KEY_GTK_CSS, KEY_PRESS_EVENT, KEY_PRESSED, KEY_RELEASE_EVENT, KEY_RELEASED, KEYED_DATA, LAST_SIGNAL, LAYOUT_CHANGED, LAYOUT_CHILD, LAYOUT_NEEDED, LEAVE, LEAVE_NOTIFY_EVENT, MAP, MAP_EVENT, MENU, MNEMONIC_ACTIVATE, MONTH_CHANGED, MOTION, MOTION_INVERSE, MOTION_NOTIFY_EVENT, MOTION_NOTIFY_EVENT_INVERSE, MOVE_CURSOR, MOVE_CURSOR_INVERSE, MOVE_FOCUS, MOVED, NOTIFY_DEFAULT_HEIGHT, NOTIFY_DEFAULT_WIDTH, NOTIFY_MAXIMIZED, NOTIFY_STATE, OBSCURED, OUTPUT, PARENT_BACKGROUND, PASTE_CLIPBOARD, PASTE_CLIPBOARD_INVERSE, POPPED_UP, POPULATE_POPUP, POPUP_MENU, PREEDIT_CHANGED, REALIZE, RELEASED, RESIZED, ROW_ACTIVATED, ROW_DELETED, ROW_HAS_CHILD_TOGGLED, ROW_INSERTED, SCROLL, SCROLL_BEGIN, SCROLL_CHILD, SCROLL_END, SCROLL_EVENT, SELECT, SELECTION_DONE, SHOW, SHOW_HELP, SIZE_ALLOCATE, SIZE_ALLOCATE_GTK4, SKIN_NEEDED, START_INTERACTIVE_SEARCH, state, STATUS_ICON_POPUP_MENU, style, STYLE_UPDATED, SWITCH_PAGE, TEST_COLLAPSE_ROW, TEST_EXPAND_ROW, TEXT_BUFFER_INSERT_TEXT, THEME_BACKGROUND, TOGGLED, UNMAP, UNMAP_EVENT, UNREALIZE, VALUE_CHANGED, WINDOW_STATE_EVENT, ZERO_HEIGHT, ZERO_WIDTH -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddSelectionListener(SelectionListener listener) Adds the listener to the collection of listeners who will be notified when the control is selected by the user, by sending it one of the messages defined in theSelectionListenerinterface.private intcalculateCalendarXpos(Point calendarSize, Rectangle coordsRelativeToScreen, Rectangle displayRect, int width) private intcalculateCalendarYpos(Point containerBounds, Rectangle coordsRelativeToScreen, int height, Rectangle displayRect) (package private) static intcheckStyle(int style) protected voidChecks that this class can be subclassed.(package private) boolean(package private) void(package private) PointcomputeMaxTextSize(int wHint, int hHint, boolean changed) Compute the native text entry size when the formatted text inside the entry is at the longest length possible.(package private) PointcomputeSizeInPixels(int wHint, int hHint, boolean changed) (package private) RectanglecomputeTrimInPixels(int x, int y, int width, int height) (package private) void(package private) voidcreateHandle(int index) private voidprivate voidprivate void(package private) voidcreatePopupShell(int year, int month, int day) private void(package private) void(package private) voidcreateWidget(int index) private long(package private) GdkRGBA(package private) void(package private) voiddropDownCalendar(boolean drop) Called when pressing the SWT.DROP_DOWN button on a Date Field(package private) longprivate void(package private) long(package private) long(package private) intgetArrow(long widget) private static intgetCalendarField(DateFormat.Field field) Extracts the calendarfield transforming HOUR1 types to HOUR0private static intgetCalendarField(FieldPosition fieldPosition) Extracts the calendarfield for the given fieldposition(package private) StringgetComputeSizeString(int style) (package private) voidgetDate()intgetDay()Returns the receiver's date, or day of the month.private static FieldPositiongetFieldPosition(AttributedCharacterIterator iterator) Searches the current postion of the iterator for aDateFormat.Fieldand constructs aFieldPositionfrom itprivate static FieldPositiongetFieldPosition(DateFormat.Field field, AttributedCharacterIterator iterator) creates aFieldPositionout of aDateFormat.Fieldand and aAttributedCharacterIterators current position(package private) DateFormat(package private) String(package private) GtkBorderGets the border padding structure, which can be used to determine the inner padding of the text field.intgetHours()Returns the receiver's hours.intReturns the receiver's minutes.intgetMonth()Returns the receiver's month.(package private) Stringprivate FieldPositiongetNextField(FieldPosition field) Given aFieldPositionsearches the next field in the format stringprivate FieldPositiongetPreviousField(FieldPosition field) intReturns the receiver's seconds.(package private) String(package private) StringgetText()Returns a string containing a copy of the contents of the receiver's text field, or an empty string if there are no contents.(package private) StringgetText(int start, int end) (package private) StringGets the substring between start and end indices of the caller provided string.(package private) PointReturns the selected text.intgetYear()Returns the receiver's year.(package private) longgtk_button_release_event(long widget, long event) (package private) longgtk_day_selected(long widget) (package private) longgtk_day_selected_double_click(long widget) (package private) intgtk_gesture_release_event(long gesture, int n_press, double x, double y, long event) (package private) longgtk_month_changed(long widget) (package private) longgtk_output(long widget) Output signal is called when Spinner's arrow buttons are triggered, usually by clicking the mouse on the [gtk3: +/-] buttons.(package private) longgtk3_key_press_event(long widget, long event) (package private) booleangtk4_key_press_event(long controller, int keyval, int keycode, int state, long event) (package private) voidhandleFocus(int type) private booleanhasAmPm()(package private) voidprivate void(package private) voidprivate final voidprivate final voidprivate final void(package private) voidincrementField(int amount) (package private) voidprivate booleanprivate booleanisDate()private boolean(package private) booleanprivate booleanprivate static booleanisSameField(FieldPosition p1, FieldPosition p2) Check if the givenFieldPositionare considered "the same", this is when both are notnulland reference the sameFormat.Fieldattribute, or both of them have no field attribute and have the same positionprivate booleanisTime()(package private) booleanisValidDate(int year, int month, int day) (package private) booleanisValidTime(int fieldName, int value) private charkeyToString(int key) (package private) void(package private) booleanonNumberKeyInput(int key) (package private) void(package private) voidpopupCalendarEvent(Event event) (package private) voidpopupShellEvent(Event event) private void(package private) voidregister()(package private) voidvoidremoveSelectionListener(SelectionListener listener) Removes the listener from the collection of listeners who will be notified when the control is selected by the user.(package private) void(package private) void(package private) voidselectField(DateFormat.Field field) selects the first occurrence of the given field(package private) voidselectField(FieldPosition fieldPosition) Selects the given field at the given start/end coordinates(package private) voidvoidsetBackground(Color color) Sets the receiver's background color to the color specified by the argument, or to the default system color for the control if the argument is null.(package private) voidsetBackgroundGdkRGBA(long context, long handle, GdkRGBA rgba) (package private) voidsetBackgroundGdkRGBA(GdkRGBA rgba) (package private) voidsetBoundsInPixels(int x, int y, int width, int height) private voidvoidsetDate(int year, int month, int day) Sets the receiver's year, month, and day in a single operation.voidsetDay(int day) Sets the receiver's date, or day of the month, to the specified day.private voidUsually called when control is resized or first initialized.voidsetEnabled(boolean enabled) Enables the receiver if the argument istrue, and disables it otherwise.(package private) voidsetFieldOfInternalDataStructure(FieldPosition field, int value) voidSets the font that the receiver will use to paint textual information to the font specified by the argument, or to the default font for that kind of control if the argument is null.(package private) voidsetFontDescription(long font) voidsetForeground(Color color) Sets the receiver's foreground color to the color specified by the argument, or to the default system color for the control if the argument is null.(package private) voidsetForegroundGdkRGBA(GdkRGBA rgba) voidsetHours(int hours) Sets the receiver's hours.voidSets the receiver's pop up menu to the argument.voidsetMinutes(int minutes) Sets the receiver's minutes.voidsetMonth(int month) Sets the receiver's month.voidsetSeconds(int seconds) Sets the receiver's seconds.(package private) voidCalculates appropriate width of GtkEntry and adds Date/Time string to the Date/Time Spinner(package private) voidsetTextField(FieldPosition field, int value) (package private) voidsetTextSelection(int start, int end) Highlight (select) the text between the start and end.voidsetTime(int hours, int minutes, int seconds) Sets the receiver's hours, minutes, and seconds in a single operation.voidsetYear(int year) Sets the receiver's year.private voidshowPopupShell(Point containerBounds, Point calendarSize, Rectangle coordsRelativeToScreen, Rectangle displayRect) private boolean(package private) voidprivate FieldPositionupdateField(FieldPosition field) Returns a field with updated positionla dataprivate intvalidateValueBounds(FieldPosition field, int value) Methods inherited from class Composite
_getChildren, _getTabList, adjustChildClipping, applyThemeBackground, changed, checkBuffered, computeTabList, connectFixedHandleDraw, createHandle, drawBackground, enableWidget, findDeferredControl, findMenus, fixChildren, fixClippings, fixModal, fixParentGdkResource, fixStyle, fixTabList, fixZOrder, forceFocus, getBackgroundMode, getChildren, getChildrenCount, getClientAreaInPixels, getLayout, getLayoutDeferred, getTabList, gtk_button_press_event, gtk_draw, gtk_focus, gtk_focus_in_event, gtk_focus_out_event, gtk_map, gtk_realize, gtk_scroll_child, gtk_style_updated, hasBorder, hooksKeys, imHandle, isLayoutDeferred, isTabGroup, layout, layout, layout, layout, layout, markLayout, minimumSize, moveAbove, moveBelow, moveChildren, mustBeVisibleOnInitBounds, parentingHandle, printWidget, propagateDraw, redrawChildren, releaseChildren, releaseHandle, removeControl, resizeHandle, reskinChildren, setBackgroundMode, setBounds, setFocus, setLayout, setLayoutDeferred, setOrientation, setScrollBarVisible, setTabGroupFocus, setTabItemFocus, setTabList, showWidget, toString, translateMnemonic, translateTraversal, traversalCode, updateBackgroundMode, updateLayoutMethods inherited from class Scrollable
clientHandle, computeTrim, createScrollBar, destroyScrollBar, getBorderWidthInPixels, getClientArea, getHorizontalBar, getScrollbarsMode, getVerticalBar, gtk_scroll_event, hScrollBarWidth, redrawBackgroundImage, redrawWidget, sendLeaveNotify, setScrollbarsMode, topHandle, updateScrollBarValue, vScrollBarWidthMethods inherited from class Control
_getAccessible, _getShell, addControlListener, addDragDetectListener, addFocusListener, addGestureListener, addHelpListener, addKeyListener, addMenuDetectListener, addMouseListener, addMouseMoveListener, addMouseTrackListener, addMouseWheelListener, addPaintListener, addRelation, addTouchListener, addTraverseListener, cairoClipRegion, cairoCopyRegion, cairoDisposeRegion, checkBackground, checkBorder, checkMirrored, cleanupEnableWindow, computeNativeSize, computeSize, computeSize, computeSizeInPixels, computeTabGroup, computeTabRoot, containedInRegion, defaultFont, destroyWidget, dragDetect, dragDetect, dragDetect, dragDetect, drawBackground, drawGripper, drawWidget, enterExitHandle, eventSurface, eventWindow, filterKey, findBackgroundControl, fixFocus, fixGdkEventTypeValues, fixStyle, flushQueueOnDnd, forceFocus, forceResize, gestureBeginProc, gestureEndProc, gestureHandle, getAccessible, getBackground, getBackgroundGdkRGBA, getBackgroundImage, getBaseGdkRGBA, getBgGdkRGBA, getBorderWidth, getBounds, getBoundsInPixels, getClientWidth, getContextBackgroundGdkRGBA, getContextColorGdkRGBA, getControl, getControlOrigin, getCursor, getDragDetect, getEnabled, getFont, getFontDescription, getForeground, getForegroundGdkRGBA, getIMCaretPos, getLayoutData, getLocation, getLocationInPixels, getMenu, getMonitor, getOrientation, getParent, getPath, getRegion, getShell, getSize, getSizeInPixels, getSurfaceOrigin, getTextDirection, getThickness, getToolTipText, getTouchEnabled, getVisible, getWindowOrigin, gtk_button_press_event, gtk_commit, gtk_css_provider_load_from_css, gtk_enter_notify_event, gtk_gesture_press_event, gtk_label_set_align, gtk_leave_notify_event, gtk_mnemonic_activate, gtk_motion_notify_event, gtk_preedit_changed, gtk_style_context_get_border, gtk_style_context_get_padding, gtk_unrealize, gtk_widget_reparent, gtk_widget_set_align, gtk3_event_after, gtk3_key_release_event, gtk3_popup_menu, gtk3_show_help, gtk4_draw, gtk4_enter_event, gtk4_focus_enter_event, gtk4_focus_leave_event, gtk4_focus_window_event, gtk4_key_release_event, gtk4_leave_event, gtk4_motion_event, gtk4_scroll_event, hasFocus, hooksPaint, hoverProc, internal_dispose_GC, internal_new_GC, isActive, isAutoScalable, isDescribedByLabel, isEnabled, isFocusAncestor, isFocusControl, isFocusHandle, isReparentable, isShowing, isTabItem, isVisible, magnifyProc, menuShell, mnemonicHit, mnemonicMatch, moveAbove, moveBelow, moveHandle, pack, pack, paintHandle, paintSurface, paintWindow, print, printWindow, redraw, redraw, redraw, release, releaseParent, removeControlListener, removeDragDetectListener, removeFocusListener, removeGestureListener, removeHelpListener, removeKeyListener, removeMenuDetectListener, removeMouseListener, removeMouseMoveListener, removeMouseTrackListener, removeMouseWheelListener, removePaintListener, removeRelation, removeTouchListener, removeTraverseListener, requestLayout, resizeCalculationsGTK3, restackWindow, rotateProc, sendDragEvent, sendFocusEvent, sendGestureEvent, sendGestureEvent, sendGestureEvent, sendHelpEvent, sendMouseEvent, sendMouseEvent, setBackground, setBackgroundGdkRGBA, setBackgroundImage, setBackgroundSurface, setBounds, setBounds, setBoundsInPixels, setCapture, setCursor, setCursor, setDragDetect, setForegroundGdkRGBA, setInitialBounds, setLayoutData, setLocation, setLocation, setLocationInPixels, setLocationInPixels, setOrientation, setParent, setParentBackground, setParentGdkResource, setRadioSelection, setRedraw, setRegion, setRelations, setSize, setSize, setSizeInPixels, setSizeInPixels, setTextDirection, setToolTipText, setToolTipText, setTouchEnabled, setVisible, setWidgetBackground, setZOrder, setZOrder, showMenu, showMenu, sort, swipeProc, toControl, toControl, toDisplay, toDisplay, toDisplayInPixels, translateMnemonic, traverse, traverse, traverse, traverse, traverse, traverseEscape, traverseGroup, traverseItem, traverseMnemonic, traversePage, traverseReturn, update, update, wantDragDropDetection, windowProcMethods inherited from class Widget
_addListener, addDisposeListener, addListener, addTypedListener, cellDataProc, checkBits, checkOpen, checkOrientation, checkParent, checkWidget, convertPangoFontDescriptionToCss, cssHandle, dispose, dpiChanged, enterMotionProc, error, filterProc, filters, fixMnemonic, fixMnemonic, fixMnemonic, focusProc, fontHeight, gdk_event_free, gdk_event_get_state, gdk_event_get_surface_or_window, gdk_pointer_grab, gdk_pointer_ungrab, gdk_surface_get_size, gdk_window_get_size, GdkSeatGrabPrepareFunc, gesturePressReleaseProc, getData, getData, getDisplay, getListeners, getName, getStyle, getTypedListeners, gtk_activate, gtk_adjustment_get, gtk_box_new, gtk_box_pack_end, gtk_box_set_child_packing, gtk_cell_renderer_get_preferred_size, gtk_change_value, gtk_changed, gtk_clicked, gtk_close_request, gtk_configure_event, gtk_container_get_border_width_or_margin, gtk_container_set_border_width, gtk_create_menu_proxy, gtk_delete_event, gtk_delete_range, gtk_delete_text, gtk_expand_collapse_cursor_row, gtk_grab_focus, gtk_hide, gtk_icon_release, gtk_input, gtk_insert_text, gtk_map_event, gtk_menu_popped_up, gtk_move_focus, gtk_populate_popup, gtk_row_activated, gtk_row_has_child_toggled, gtk_select, gtk_selection_done, gtk_show, gtk_size_allocate, gtk_start_interactive_search, gtk_status_icon_popup_menu, gtk_switch_page, gtk_test_collapse_row, gtk_test_expand_row, gtk_text_buffer_insert_text, gtk_timer, gtk_toggled, gtk_tree_view_column_cell_get_position, gtk_unmap, gtk_unmap_event, gtk_value_changed, gtk_widget_get_preferred_size, gtk_widget_get_surface, gtk_widget_get_window, gtk_widget_hide, gtk_widget_show, gtk_widget_size_allocate, gtk_window_state_event, hooks, isAutoDirection, isDisposed, isListening, isValidSubclass, isValidThread, keyPressReleaseProc, leaveProc, mnemonicHit, mnemonicMatch, notifyCreationTracker, notifyDisposalTracker, notifyListeners, notifyProc, notifyState, postEvent, postEvent, removeDisposeListener, removeListener, removeListener, removeListener, removeTypedListener, rendererGetPreferredWidthProc, rendererRenderProc, rendererSnapshotProc, reskin, reskinWidget, scrollProc, sendEvent, sendEvent, sendEvent, sendEvent, sendIMKeyEvent, sendKeyEvent, sendSelectionEvent, sendSelectionEvent, setButtonState, setData, setData, setFontDescription, setInputState, setKeyState, setLocationState, setToolTipText, shellMapProc, sizeAllocateProc, sizeRequestProc, snapshotToDraw, timerProc, translateTraversal, windowActiveProc, windowProc, windowProc, windowProc, windowProc
-
Field Details
-
day
int day -
month
int month -
year
int year -
hours
int hours -
minutes
int minutes -
seconds
int seconds -
textEntryHandle
long textEntryHandleMajor handles of this class. Note, these can vary or all equal each other depending on Date/Time/Calendar/Drop_down configuration used. See createHandle () -
spinButtonHandle
long spinButtonHandleMajor handles of this class. Note, these can vary or all equal each other depending on Date/Time/Calendar/Drop_down configuration used. See createHandle () -
containerHandle
long containerHandleMajor handles of this class. Note, these can vary or all equal each other depending on Date/Time/Calendar/Drop_down configuration used. See createHandle () -
calendarHandle
long calendarHandleMajor handles of this class. Note, these can vary or all equal each other depending on Date/Time/Calendar/Drop_down configuration used. See createHandle () -
editableHandle
long editableHandleGTK4 field used to hold the main GtkEditable widget. Primarily used for styles SWT.DROP_DOWN invalid input: '&' SWT.TIME -
calendar
Calendar calendar -
down
Button down -
currentField
FieldPosition currentField -
typeBuffer
StringBuilder typeBuffer -
typeBufferPos
int typeBufferPos -
firstTime
boolean firstTime -
dateFormat
-
fg
Color fg -
bg
Color bg -
hasFocus
boolean hasFocus -
savedYear
int savedYear -
savedMonth
int savedMonth -
savedDay
int savedDay -
popupShell
Shell popupShell -
popupCalendar
DateTime popupCalendar -
popupListener
Listener popupListener -
popupFilter
Listener popupFilter -
prefferedSize
Point prefferedSize -
locale
Locale locale -
mouseEventListener
Listener mouseEventListenerUsed when SWT.DROP_DOWN is set -
DEFAULT_SHORT_DATE_FORMAT
- See Also:
-
DEFAULT_MEDIUM_DATE_FORMAT
- See Also:
-
DEFAULT_LONG_DATE_FORMAT
- See Also:
-
DEFAULT_SHORT_TIME_FORMAT
- See Also:
-
DEFAULT_MEDIUM_TIME_FORMAT
- See Also:
-
DEFAULT_LONG_TIME_FORMAT
- See Also:
-
MIN_YEAR
static final int MIN_YEAR- See Also:
-
MAX_YEAR
static final int MAX_YEAR- See Also:
-
SPACE_FOR_CURSOR
static final int SPACE_FOR_CURSOR- See Also:
-
mdYear
private int mdYear -
mdMonth
private int mdMonth
-
-
Constructor Details
-
DateTime
Constructs a new instance of this class given its parent and a style value describing its behavior and appearance.The style value is either one of the style constants defined in class
SWTwhich is applicable to instances of this class, or must be built by bitwise OR'ing together (that is, using theint"|" operator) two or more of thoseSWTstyle constants. The class description lists the style constants that are applicable to the class. Style bits are also inherited from superclasses.- Parameters:
parent- a composite control which will be the parent of the new instance (cannot be null)style- the style of control to construct- Throws:
IllegalArgumentException-- ERROR_NULL_ARGUMENT - if the parent is null
SWTException-- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent
- ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass
- See Also:
-
-
Method Details
-
createText
void createText() -
getFormat
-
checkStyle
static int checkStyle(int style) -
addSelectionListener
Adds the listener to the collection of listeners who will be notified when the control is selected by the user, by sending it one of the messages defined in theSelectionListenerinterface.widgetSelectedis called when the user changes the control's value.widgetDefaultSelectedis typically called when ENTER is pressed.- Parameters:
listener- the listener which should be notified- Throws:
IllegalArgumentException-- ERROR_NULL_ARGUMENT - if the listener is null
SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
- See Also:
-
checkSubclass
protected void checkSubclass()Description copied from class:WidgetChecks that this class can be subclassed.The SWT class library is intended to be subclassed only at specific, controlled points (most notably,
CompositeandCanvaswhen implementing new widgets). This method enforces this rule unless it is overridden.IMPORTANT: By providing an implementation of this method that allows a subclass of a class which does not normally allow subclassing to be created, the implementer agrees to be fully responsible for the fact that any such subclass will likely fail between SWT releases and will be strongly platform specific. No support is provided for user-written classes which are implemented in this fashion.
The ability to subclass outside of the allowed SWT classes is intended purely to enable those not on the SWT development team to implement patches in order to get around specific limitations in advance of when those limitations can be addressed by the team. Subclassing should not be attempted without an intimate and detailed understanding of the hierarchy.
- Overrides:
checkSubclassin classComposite
-
computeMaxTextSize
Compute the native text entry size when the formatted text inside the entry is at the longest length possible. i.e. Assume DATE/HOUR field to be double digit, MONTH field for SWT.DATE | SWT.LONG is the longest text.- Returns:
- text entry size to hold the longest possible formatted text.
-
computeSizeInPixels
- Overrides:
computeSizeInPixelsin classComposite
-
computeTrimInPixels
- Overrides:
computeTrimInPixelsin classScrollable
-
createHandle
void createHandle(int index) - Overrides:
createHandlein classComposite
-
createSWTFixedHandle
private void createSWTFixedHandle() -
createHandleForCalendar
private void createHandleForCalendar() -
createHandleForDateWithDropDown
private void createHandleForDateWithDropDown() -
createHandleForDateTime
private void createHandleForDateTime() -
createDropDownButton
void createDropDownButton() -
createPopupShell
void createPopupShell(int year, int month, int day) -
setFontDescription
void setFontDescription(long font) - Overrides:
setFontDescriptionin classControl
-
checkSubwindow
boolean checkSubwindow()- Overrides:
checkSubwindowin classComposite
-
createWidget
void createWidget(int index) - Overrides:
createWidgetin classScrollable
-
onDispose
-
dropDownCalendar
void dropDownCalendar(boolean drop) Called when pressing the SWT.DROP_DOWN button on a Date Field- Parameters:
drop- true if the calendar is suppose to drop down.
-
showPopupShell
-
calculateCalendarYpos
-
calculateCalendarXpos
-
focusDayOnPopupCalendar
private void focusDayOnPopupCalendar() -
setCurrentDate
private void setCurrentDate() -
recreateCalendar
private void recreateCalendar() -
hideDropDownCalendar
private void hideDropDownCalendar() -
getComputeSizeString
-
getFormattedString
String getFormattedString() -
getDate
void getDate() -
getDay
public int getDay()Returns the receiver's date, or day of the month.The first day of the month is 1, and the last day depends on the month and year.
- Returns:
- a positive integer beginning with 1
- Throws:
SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
getHours
public int getHours()Returns the receiver's hours.Hours is an integer between 0 and 23.
- Returns:
- an integer between 0 and 23
- Throws:
SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
getMinutes
public int getMinutes()Returns the receiver's minutes.Minutes is an integer between 0 and 59.
- Returns:
- an integer between 0 and 59
- Throws:
SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
getMonth
public int getMonth()Returns the receiver's month.The first month of the year is 0, and the last month is 11.
- Returns:
- an integer between 0 and 11
- Throws:
SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
getNameText
String getNameText()- Overrides:
getNameTextin classWidget
-
getSeconds
public int getSeconds()Returns the receiver's seconds.Seconds is an integer between 0 and 59.
- Returns:
- an integer between 0 and 59
- Throws:
SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
getSpokenText
String getSpokenText() -
getYear
public int getYear()Returns the receiver's year.The first year is 1752 and the last year is 9999.
- Returns:
- an integer between 1752 and 9999
- Throws:
SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
gtk_day_selected
long gtk_day_selected(long widget) - Overrides:
gtk_day_selectedin classWidget
-
gtk_day_selected_double_click
long gtk_day_selected_double_click(long widget) - Overrides:
gtk_day_selected_double_clickin classWidget
-
gtk_month_changed
long gtk_month_changed(long widget) - Overrides:
gtk_month_changedin classWidget
-
eventHandle
long eventHandle()- Overrides:
eventHandlein classControl
-
focusHandle
long focusHandle()- Overrides:
focusHandlein classComposite
-
fontHandle
long fontHandle()- Overrides:
fontHandlein classControl
-
dateTimeHandle
private long dateTimeHandle() -
hookEvents
void hookEvents()- Overrides:
hookEventsin classComposite
-
hookEventsForCalendar
private final void hookEventsForCalendar() -
hookEventsForDateTimeSpinner
private final void hookEventsForDateTimeSpinner() -
hookEventsForMenu
private final void hookEventsForMenu() -
incrementField
void incrementField(int amount) -
hasAmPm
private boolean hasAmPm() -
isDropped
boolean isDropped() -
isCalendar
private boolean isCalendar() -
isDateWithDropDownButton
private boolean isDateWithDropDownButton() -
isDate
private boolean isDate() -
isTime
private boolean isTime() -
isReadOnly
private boolean isReadOnly() -
showWeekNumbers
private boolean showWeekNumbers() -
initAccessible
void initAccessible() -
isValidTime
boolean isValidTime(int fieldName, int value) -
isValidDate
boolean isValidDate(int year, int month, int day) -
popupCalendarEvent
-
handleFocus
void handleFocus(int type) -
popupShellEvent
-
removeSelectionListener
Removes the listener from the collection of listeners who will be notified when the control is selected by the user.- Parameters:
listener- the listener which should no longer be notified- Throws:
IllegalArgumentException-- ERROR_NULL_ARGUMENT - if the listener is null
SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
- See Also:
-
selectField
selects the first occurrence of the given field -
selectField
Selects the given field at the given start/end coordinates -
sendSelectionEvent
void sendSelectionEvent() -
setBackground
Description copied from class:ControlSets the receiver's background color to the color specified by the argument, or to the default system color for the control if the argument is null.Note: This operation is a hint and may be overridden by the platform.
Note: The background color can be overridden by setting a background image.
- Overrides:
setBackgroundin classControl- Parameters:
color- the new color (or null)
-
setBackgroundGdkRGBA
- Overrides:
setBackgroundGdkRGBAin classControl
-
setBackgroundGdkRGBA
- Overrides:
setBackgroundGdkRGBAin classControl
-
setEnabled
public void setEnabled(boolean enabled) Description copied from class:ControlEnables the receiver if the argument istrue, and disables it otherwise. A disabled control is typically not selectable from the user interface and draws with an inactive or "grayed" look.- Overrides:
setEnabledin classControl- Parameters:
enabled- the new enabled state
-
setFont
Description copied from class:ControlSets the font that the receiver will use to paint textual information to the font specified by the argument, or to the default font for that kind of control if the argument is null. -
setForegroundGdkRGBA
- Overrides:
setForegroundGdkRGBAin classControl
-
setForeground
Description copied from class:ControlSets the receiver's foreground color to the color specified by the argument, or to the default system color for the control if the argument is null.Note: This operation is a hint and may be overridden by the platform.
- Overrides:
setForegroundin classControl- Parameters:
color- the new color (or null)
-
setFieldOfInternalDataStructure
-
setDate
public void setDate(int year, int month, int day) Sets the receiver's year, month, and day in a single operation.This is the recommended way to set the date, because setting the year, month, and day separately may result in invalid intermediate dates.
- Parameters:
year- an integer between 1752 and 9999month- an integer between 0 and 11day- a positive integer beginning with 1- Throws:
SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
- Since:
- 3.4
-
setDay
public void setDay(int day) Sets the receiver's date, or day of the month, to the specified day.The first day of the month is 1, and the last day depends on the month and year. If the specified day is not valid for the receiver's month and year, then it is ignored.
- Parameters:
day- a positive integer beginning with 1- Throws:
SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
- See Also:
-
setHours
public void setHours(int hours) Sets the receiver's hours.Hours is an integer between 0 and 23.
- Parameters:
hours- an integer between 0 and 23- Throws:
SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
setMenu
Description copied from class:ControlSets the receiver's pop up menu to the argument. All controls may optionally have a pop up menu that is displayed when the user requests one for the control. The sequence of key strokes, button presses and/or button releases that are used to request a pop up menu is platform specific.Note: Disposing of a control that has a pop up menu will dispose of the menu. To avoid this behavior, set the menu to null before the control is disposed.
-
setMinutes
public void setMinutes(int minutes) Sets the receiver's minutes.Minutes is an integer between 0 and 59.
- Parameters:
minutes- an integer between 0 and 59- Throws:
SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
setMonth
public void setMonth(int month) Sets the receiver's month.The first month of the year is 0, and the last month is 11. If the specified month is not valid for the receiver's day and year, then it is ignored.
- Parameters:
month- an integer between 0 and 11- Throws:
SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
- See Also:
-
setSeconds
public void setSeconds(int seconds) Sets the receiver's seconds.Seconds is an integer between 0 and 59.
- Parameters:
seconds- an integer between 0 and 59- Throws:
SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
setTime
public void setTime(int hours, int minutes, int seconds) Sets the receiver's hours, minutes, and seconds in a single operation.- Parameters:
hours- an integer between 0 and 23minutes- an integer between 0 and 59seconds- an integer between 0 and 59- Throws:
SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
- Since:
- 3.4
-
setYear
public void setYear(int year) Sets the receiver's year.The first year is 1752 and the last year is 9999. If the specified year is not valid for the receiver's day and month, then it is ignored.
- Parameters:
year- an integer between 1752 and 9999- Throws:
SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
- See Also:
-
setBoundsInPixels
void setBoundsInPixels(int x, int y, int width, int height) - Overrides:
setBoundsInPixelsin classControl
-
setDropDownButtonSize
private void setDropDownButtonSize()Usually called when control is resized or first initialized. -
getGtkBorderPadding
GtkBorder getGtkBorderPadding()Gets the border padding structure, which can be used to determine the inner padding of the text field. Note, this function returns the correct padding only under GTK3.- Returns:
- GtkBorder object that holds the padding values.
-
onNumberKeyInput
boolean onNumberKeyInput(int key) -
keyToString
private char keyToString(int key) -
updateControl
void updateControl() -
register
-
defaultBackground
GdkRGBA defaultBackground()- Overrides:
defaultBackgroundin classControl
-
deregister
void deregister()- Overrides:
deregisterin classComposite
-
getArrow
int getArrow(long widget) -
setText
Calculates appropriate width of GtkEntry and adds Date/Time string to the Date/Time Spinner -
gtk4_key_press_event
boolean gtk4_key_press_event(long controller, int keyval, int keycode, int state, long event) - Overrides:
gtk4_key_press_eventin classComposite- Parameters:
controller- the corresponding controller responsible for capturing the eventkeyval- the pressed keykeycode- raw code of the pressed keystate- the bitmask, representing the state of the modifier keys and pointer buttonsevent- the GdkEvent captured- Returns:
- TRUE if the event has been fully/properly handled, otherwise FALSE
-
gtk3_key_press_event
long gtk3_key_press_event(long widget, long event) - Overrides:
gtk3_key_press_eventin classComposite
-
commitData
void commitData() -
getText
String getText()Returns a string containing a copy of the contents of the receiver's text field, or an empty string if there are no contents.- Returns:
- Spinner's text
- Throws:
SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
getText
Gets the substring between start and end indices of the caller provided string. Checks are done to ensure that start and end indices are well formed.- Returns:
- substring of str between start invalid input: '&' end. If start invalid input: '&' end indices are malformed, an empty string is returned.
-
getTextSelection
Point getTextSelection()Returns the selected text. If selected text is less than one character the returned Point has equal start and end values.- Returns:
- the highlighted (selected) text or position of cursor
-
setTextSelection
void setTextSelection(int start, int end) Highlight (select) the text between the start and end. -
setTextField
-
validateValueBounds
-
gtk_button_release_event
long gtk_button_release_event(long widget, long event) - Overrides:
gtk_button_release_eventin classControl
-
gtk_gesture_release_event
int gtk_gesture_release_event(long gesture, int n_press, double x, double y, long event) - Overrides:
gtk_gesture_release_eventin classControl- Parameters:
gesture- the corresponding controller responsible for capturing the eventn_press- how many touch/button presses happened with this onex- the x coordinate, in widget allocation coordinatesy- the y coordinate, in widget allocation coordinatesevent- the GdkEvent captured
-
gtk_output
long gtk_output(long widget) Output signal is called when Spinner's arrow buttons are triggered, usually by clicking the mouse on the [gtk3: +/-] buttons. On every click output is called twice presenting current and previous value. This method compares two values and determines if Up or down arrow was called.- Overrides:
gtk_outputin classWidget
-
replaceCurrentlySelectedTextRegion
-
onTextMouseClick
void onTextMouseClick() -
getText
-
selectAll
void selectAll() -
hideDateTime
void hideDateTime() -
releaseWidget
void releaseWidget()- Overrides:
releaseWidgetin classComposite
-
updateField
Returns a field with updated positionla data -
getNextField
Given aFieldPositionsearches the next field in the format string- Parameters:
field- the Field to start from- Returns:
- the next
FieldPosition
-
getPreviousField
- Returns:
- the next field of the given one
-
getFieldPosition
Searches the current postion of the iterator for aDateFormat.Fieldand constructs aFieldPositionfrom it- Parameters:
iterator- the iterator to use- Returns:
- a new
FieldPosition
-
getFieldPosition
private static FieldPosition getFieldPosition(DateFormat.Field field, AttributedCharacterIterator iterator) creates aFieldPositionout of aDateFormat.Fieldand and aAttributedCharacterIterators current position- Parameters:
field- the field to useiterator- the iterator to extract the data from- Returns:
- a
FieldPositioninit to this Field and begin/end index
-
isSameField
Check if the givenFieldPositionare considered "the same", this is when both are notnulland reference the sameFormat.Fieldattribute, or both of them have no field attribute and have the same position- Parameters:
p1- first position to comparep2- second position to compare- Returns:
trueif considered the same,falseotherwise
-
getCalendarField
Extracts the calendarfield for the given fieldposition- Returns:
- the
Calendarfield or -1 if this is not a valid Fieldposition
-
getCalendarField
Extracts the calendarfield transforming HOUR1 types to HOUR0- Returns:
- the calendarfield corresponding to the
DateFormat.Field
-