org.eclipse.swt.widgets.DateTime Java Examples
The following examples show how to use
org.eclipse.swt.widgets.DateTime.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DateTimeFieldEditor.java From elexis-3-core with Eclipse Public License 1.0 | 6 votes |
/** * Returns this field editor's text control. * <p> * The control is created if it does not yet exist * </p> * * @param parent * the parent * @return the text control */ public DateTime getDateTimeControl(Composite parent) { if (this.dateTimeField == null) { this.dateTimeField = new DateTime(parent, SWT.DATE | SWT.MEDIUM); this.dateTimeField.setFont(parent.getFont()); this.dateTimeField.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { valueChanged(); } }); this.dateTimeField.addDisposeListener(new DisposeListener() { public void widgetDisposed(DisposeEvent event) { DateTimeFieldEditor.this.dateTimeField = null; } }); } else { checkParent(this.dateTimeField, parent); } return this.dateTimeField; }
Example #2
Source File: ColumnFilterDialog.java From nebula with Eclipse Public License 2.0 | 6 votes |
public void updateDate2Composite() { if (isBetweenDates()) { date2Widget = new DateTime(widgetComp, SWT.CALENDAR); date2Widget.addListener(SWT.Selection, e-> setDate2Selection()); time2Widget = new DateTime(widgetComp, SWT.TIME); time2Widget.addListener(SWT.Selection, e-> setDate2Selection()); time2Widget.setHours(0); time2Widget.setMinutes(0); time2Widget.setSeconds(0); } else { if (date2Widget != null) { date2Widget.dispose(); date2Widget = null; time2Widget.dispose(); time2Widget = null; } } widgetComp.layout(true, true); final Point newSize = getShell().computeSize(SWT.DEFAULT, SWT.DEFAULT, true); getShell().setSize(newSize); }
Example #3
Source File: MetricDisplay.java From scava with Eclipse Public License 2.0 | 6 votes |
private Date toDate(DateTime dayPicker, DateTime timePicker) throws Exception { String input = ""; int year = dayPicker.getYear(); int month = dayPicker.getMonth() + 1; int day = dayPicker.getDay(); int hours = timePicker.getHours(); int minutes = timePicker.getMinutes(); int seconds = timePicker.getSeconds(); input = year + "/" + month + "/" + day + "/" + hours + "/" + minutes + "/" + seconds; SimpleDateFormat ft = new SimpleDateFormat("yyyy/MM/dd/HH/mm/ss"); Date t; t = ft.parse(input); return t; }
Example #4
Source File: DateTimeSelectorDialog.java From elexis-3-core with Eclipse Public License 1.0 | 6 votes |
private Composite createDefaultArea(Composite parent){ Composite composite = new Composite(parent, SWT.NONE); composite.setLayout(new GridLayout(2, false)); Label label = new Label(composite, SWT.NONE); label.setText("Zeitpunkt"); label.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1)); Composite dateComposite = new Composite(composite, SWT.NONE); dateComposite.setLayout(new GridLayout(2, true)); dateComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); timeSelection = new DateTime(dateComposite, SWT.TIME); timeSelection.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); dateSelection = new DateTime(dateComposite, SWT.CALENDAR); dateSelection.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); timeSelection.setTime(date.get(Calendar.HOUR_OF_DAY), date.get(Calendar.MINUTE), date.get(Calendar.SECOND)); dateSelection.setDate(date.get(Calendar.YEAR), date.get(Calendar.MONTH), date.get(Calendar.DAY_OF_MONTH)); getShell().setText(Messages.DateTimeSelectorDialog_enterDate); //$NON-NLS-1$ return composite; }
Example #5
Source File: DateTimeSelectorDialog.java From elexis-3-core with Eclipse Public License 1.0 | 6 votes |
private Composite createCalendarArea(Composite parent){ Composite composite = new Composite(parent, SWT.NONE); GridLayout gd = new GridLayout(1, false); gd.marginLeft = 2; // SWT BUG composite.setLayout(gd); dateSelection = new DateTime(composite, SWT.CALENDAR); dateSelection.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, true, false, 1, 1)); Composite dateComposite = new Composite(composite, SWT.NONE); dateComposite.setLayout(new GridLayout(2, true)); dateComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); Label label = new Label(dateComposite, SWT.NONE); label.setText("Zeitpunkt"); label.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1)); timeSelection = new DateTime(dateComposite, SWT.TIME); timeSelection.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); timeSelection.setTime(date.get(Calendar.HOUR_OF_DAY), date.get(Calendar.MINUTE), date.get(Calendar.SECOND)); dateSelection.setDate(date.get(Calendar.YEAR), date.get(Calendar.MONTH), date.get(Calendar.DAY_OF_MONTH)); getShell().setText(Messages.DateTimeSelectorDialog_enterDate); //$NON-NLS-1$ return composite; }
Example #6
Source File: DataBinding.java From olca-app with Mozilla Public License 2.0 | 6 votes |
private void setDateValue(Object bean, String property, DateTime dateTime) { log.trace("Change value {} @ {}", property, bean); GregorianCalendar calendar = new GregorianCalendar(); calendar.set(Calendar.DAY_OF_MONTH, dateTime.getDay()); calendar.set(Calendar.YEAR, dateTime.getYear()); calendar.set(Calendar.MONTH, dateTime.getMonth()); try { if (Bean.getType(bean, property) == Date.class) Bean.setValue(bean, property, calendar.getTime()); else if (Bean.getType(bean, property) == GregorianCalendar.class) Bean.setValue(bean, property, calendar); else log.error("Cannot set bean value"); } catch (Exception e) { error("Cannot set bean value", e); } }
Example #7
Source File: DateEditor.java From gama with GNU General Public License v3.0 | 6 votes |
@Override public Control createCustomParameterControl(final Composite compo) { edit = new Composite(compo, SWT.NONE); final GridLayout pointEditorLayout = new GridLayout(2, true); pointEditorLayout.horizontalSpacing = 10; pointEditorLayout.verticalSpacing = 0; pointEditorLayout.marginHeight = 0; pointEditorLayout.marginWidth = 0; edit.setLayout(pointEditorLayout); date = new DateTime(edit, SWT.DROP_DOWN | SWT.BORDER | SWT.DATE | SWT.LONG); time = new DateTime(edit, SWT.DROP_DOWN | SWT.BORDER | SWT.TIME | SWT.LONG); date.setBackground(IGamaColors.PARAMETERS_BACKGROUND.color()); date.addSelectionListener(this); time.setBackground(IGamaColors.PARAMETERS_BACKGROUND.color()); time.addSelectionListener(this); edit.setBackground(IGamaColors.PARAMETERS_BACKGROUND.color()); displayParameterValue(); return edit; }
Example #8
Source File: ExportFilterComposite.java From translationstudio8 with GNU General Public License v2.0 | 6 votes |
/** * 获取当前过滤条件的值 * @return ; */ public ExportFilterComponentBean getValue() { if (valueText instanceof Text) { this.baseDataBean.setFilterVlaue(((Text) valueText).getText()); } else if (valueText instanceof DateTime) { DateTime temp = (DateTime) valueText; StringBuffer bf = new StringBuffer(); bf.append(temp.getYear()); bf.append("-"); DecimalFormat df = new DecimalFormat("00"); bf.append(df.format(temp.getMonth() + 1)); bf.append("-"); bf.append(df.format(temp.getDay())); bf.append(" 00:00:00"); // 补全时间 this.baseDataBean.setFilterVlaue(bf.toString()); } return this.baseDataBean; }
Example #9
Source File: TaskEditor.java From codeexamples-eclipse with Eclipse Public License 1.0 | 6 votes |
@Override public void createPartControl(Composite parent) { GridLayout layout = new GridLayout(); layout.numColumns = 2; parent.setLayout(layout); new Label(parent, SWT.NONE).setText("Summary"); Text text = new Text(parent, SWT.BORDER); text.setText(todo.getSummary()); text.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false)); new Label(parent, SWT.NONE).setText("Description"); Text lastName = new Text(parent, SWT.BORDER); lastName.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false)); lastName.setText(todo.getDescription()); new Label(parent, SWT.NONE).setText("Done"); Button doneBtn = new Button(parent, SWT.CHECK); doneBtn.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false)); doneBtn.setSelection(todo.isDone()); new Label(parent, SWT.NONE).setText("Due Date"); DateTime dueDate = new DateTime(parent, SWT.CHECK); dueDate.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false)); Date date = todo.getDueDate(); dueDate.setDate(date.getYear(), date.getMonth(), date.getDay()); }
Example #10
Source File: ExportFilterComposite.java From tmxeditor8 with GNU General Public License v2.0 | 6 votes |
/** * 获取当前过滤条件的值 * @return ; */ public ExportFilterComponentBean getValue() { if (valueText instanceof Text) { this.baseDataBean.setFilterVlaue(((Text) valueText).getText()); } else if (valueText instanceof DateTime) { DateTime temp = (DateTime) valueText; StringBuffer bf = new StringBuffer(); bf.append(temp.getYear()); bf.append("-"); DecimalFormat df = new DecimalFormat("00"); bf.append(df.format(temp.getMonth() + 1)); bf.append("-"); bf.append(df.format(temp.getDay())); bf.append(" 00:00:00"); // 补全时间 this.baseDataBean.setFilterVlaue(bf.toString()); } return this.baseDataBean; }
Example #11
Source File: DateTimeDataElementComposite.java From birt with Eclipse Public License 1.0 | 6 votes |
protected void createDatePicker( int style ) { btnDate = new Button( this, SWT.CHECK ); btnDate.addListener( SWT.Selection, this ); pickerDate = new DateTime( this, SWT.DATE | style ); pickerDate.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) ); pickerDate.addListener( SWT.Selection, this ); btnTime = new Button( this, SWT.CHECK ); btnTime.addListener( SWT.Selection, this ); pickerTime = new DateTime( this, SWT.TIME | style ); pickerTime.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) ); pickerTime.addListener( SWT.Selection, this ); }
Example #12
Source File: KonsZumVerrechnenWizardDialog.java From elexis-3-core with Eclipse Public License 1.0 | 5 votes |
private TimeTool getDate(DateTime selDate, int hour, int minute, int second){ Calendar cal = GregorianCalendar.getInstance(); cal.set(Calendar.DAY_OF_MONTH, selDate.getDay()); cal.set(Calendar.MONTH, selDate.getMonth()); cal.set(Calendar.YEAR, selDate.getYear()); cal.set(Calendar.HOUR_OF_DAY, hour); cal.set(Calendar.MINUTE, minute); cal.set(Calendar.SECOND, second); TimeTool date = new TimeTool(cal.getTime()); return date; }
Example #13
Source File: TimeSpanSelectionComposite.java From elexis-3-core with Eclipse Public License 1.0 | 5 votes |
private void updateTimeSpan(DateTime dateTime){ if (timeSpan == null) { timeSpan = new TimeSpan(); } if (timespanFrom == dateTime) { setDateTime(dateTime, timeSpan.from); } else if (timespanTo == dateTime) { setDateTime(dateTime, timeSpan.until); } }
Example #14
Source File: TimerConditionWizardPage.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
protected Control createCalendarEditor(final Composite stackedComposite) { final Composite calendarControl = new Composite(stackedComposite, SWT.NONE); calendarControl.setLayout(GridLayoutFactory.fillDefaults().numColumns(4).margins(15, 15).create()); calendarControl.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create()); final Label selectDateLabel = new Label(calendarControl, SWT.NONE); selectDateLabel.setText(Messages.selectDateLabel); final DateTime dateChooser = new DateTime(calendarControl, SWT.DATE | SWT.DROP_DOWN | SWT.BORDER); final Label atLabel = new Label(calendarControl, SWT.NONE); atLabel.setText(Messages.at); final DateTime timeChooser = new DateTime(calendarControl, SWT.TIME | SWT.BORDER); final Button generateFixedDate = new Button(calendarControl, SWT.PUSH); generateFixedDate.setLayoutData(GridDataFactory.swtDefaults().span(4, 1).create()); generateFixedDate.setText(Messages.generateFixedDateLabel); generateFixedDate.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent e) { final String displayDate = DateUtil.getWidgetDisplayDate(dateChooser, timeChooser); condition.setName(displayDate); condition.setContent(DateUtil.getDateExpressionContent(dateChooser.getYear(), dateChooser.getMonth(), dateChooser.getDay(), timeChooser.getHours(), timeChooser.getMinutes(), timeChooser.getSeconds())); condition.setType(ExpressionConstants.SCRIPT_TYPE); condition.setInterpreter(ExpressionConstants.GROOVY); condition.setReturnType(Date.class.getName()); conditionViewer.setSelection(new StructuredSelection(condition)); } }); return calendarControl; }
Example #15
Source File: Widgets.java From olca-app with Mozilla Public License 2.0 | 5 votes |
public static DateTime date(Composite parent, String label, String property, ModelEditor<?> editor, FormToolkit toolkit) { toolkit.createLabel(parent, label, SWT.NONE); DateTime dateTime = new DateTime(parent, SWT.DATE | SWT.DROP_DOWN); GridData data = new GridData(); data.widthHint = 150; dateTime.setLayoutData(data); editor.getBinding().onDate(() -> editor.getModel(), property, dateTime); new CommentControl(parent, toolkit, property, editor.getComments()); return dateTime; }
Example #16
Source File: ResourceChartDialogEx.java From logbook with MIT License | 5 votes |
/** * DateTimeで選択されている日付からCalendarインスタンスを作成します * * @param dateTime * @return */ private static Calendar getCalendar(DateTime dateTime) { Calendar cal = DateUtils.truncate(Calendar.getInstance(TimeZone.getDefault()), Calendar.DAY_OF_MONTH); cal.set(Calendar.YEAR, dateTime.getYear()); cal.set(Calendar.MONTH, dateTime.getMonth()); cal.set(Calendar.DAY_OF_MONTH, dateTime.getDay()); return cal; }
Example #17
Source File: DefaultXViewerControlFactory.java From nebula with Eclipse Public License 2.0 | 5 votes |
/** * @see net.uniopt.jface.viewers.XViewerControlFactory#createControl(net.uniopt.jface.viewers.CellEditDescriptor, * org.eclipse.nebula.widgets.xviewer.XViewer) */ @Override public Control createControl(CellEditDescriptor ced, XViewer xv) { if (ced.getControl().equals(Text.class)) { return new Text(xv.getTree(), ced.getSwtStyle()); } else if (ced.getControl().equals(Combo.class)) { return new Combo(xv.getTree(), ced.getSwtStyle()); } else if (ced.getControl().equals(DateTime.class)) { return new DateTime(xv.getTree(), ced.getSwtStyle()); } else { return null; } }
Example #18
Source File: LaborVerordnungDialog.java From elexis-3-core with Eclipse Public License 1.0 | 4 votes |
private void getDate(DateTime widget, TimeTool date){ date.set(Calendar.YEAR, widget.getYear()); date.set(Calendar.MONTH, widget.getMonth()); date.set(Calendar.DAY_OF_MONTH, widget.getDay()); }
Example #19
Source File: LaborVerordnungDialog.java From elexis-3-core with Eclipse Public License 1.0 | 4 votes |
private void getTime(DateTime widget, TimeTool time){ time.set(Calendar.HOUR_OF_DAY, widget.getHours()); time.set(Calendar.MINUTE, widget.getMinutes()); time.set(Calendar.SECOND, widget.getSeconds()); }
Example #20
Source File: EditLabResultDialog.java From elexis-3-core with Eclipse Public License 1.0 | 4 votes |
private void getDate(DateTime widget, TimeTool date){ date.set(Calendar.YEAR, widget.getYear()); date.set(Calendar.MONTH, widget.getMonth()); date.set(Calendar.DAY_OF_MONTH, widget.getDay()); }
Example #21
Source File: ModelPage.java From olca-app with Mozilla Public License 2.0 | 4 votes |
protected DateTime date(Composite parent, String label, String property) { return Widgets.date(parent, label, property, getEditor(), getToolkit()); }
Example #22
Source File: EditLabResultDialog.java From elexis-3-core with Eclipse Public License 1.0 | 4 votes |
private void getTime(DateTime widget, TimeTool time){ time.set(Calendar.HOUR_OF_DAY, widget.getHours()); time.set(Calendar.MINUTE, widget.getMinutes()); time.set(Calendar.SECOND, widget.getSeconds()); }
Example #23
Source File: ColumnFilterDialog.java From nebula with Eclipse Public License 2.0 | 4 votes |
@Override protected void createExtendedArea(Composite parent) { super.createExtendedArea(parent); if (column.getSortDataType() == SortDataType.Date) { widgetComp = new Composite(parent, SWT.NONE); widgetComp.setLayout(new GridLayout(6, false)); GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = 2; widgetComp.setLayoutData(gd); Label label = new Label(widgetComp, SWT.NONE); label.setText("Date Match: "); dateRangeTypeCombo = new ComboViewer(widgetComp, SWT.NONE); dateRangeTypeCombo.setContentProvider(new ArrayContentProvider()); dateRangeTypeCombo.setLabelProvider(new LabelProvider() { @Override public String getText(Object element) { return ((DateRangeType) element).getDisplayName(); } }); dateRangeTypeCombo.setInput(DateRangeType.values()); dateRangeTypeCombo.addSelectionChangedListener(event -> { String text2 = dateRangeTypeCombo.getCombo().getText(); dateRangeType = DateRangeType.get(text2); updateDate2Composite(); }); date1Widget = new DateTime(widgetComp, SWT.CALENDAR); date1Widget.addListener(SWT.Selection, e-> setDate1Selection()); // set initial date Calendar cal = Calendar.getInstance(); cal.set(date1Widget.getYear(), date1Widget.getMonth(), date1Widget.getDay(), 0, 0); date1 = cal.getTime(); time1Widget = new DateTime(widgetComp, SWT.TIME); time1Widget.addListener(SWT.Selection, e-> setDate1Selection()); time1Widget.setHours(0); time1Widget.setMinutes(0); time1Widget.setSeconds(0); } }
Example #24
Source File: DateTimeSelectorDialog.java From elexis-3-core with Eclipse Public License 1.0 | 4 votes |
private void getDate(DateTime widget, TimeTool date){ date.set(Calendar.YEAR, widget.getYear()); date.set(Calendar.MONTH, widget.getMonth()); date.set(Calendar.DAY_OF_MONTH, widget.getDay()); }
Example #25
Source File: DateTimeSelectorDialog.java From elexis-3-core with Eclipse Public License 1.0 | 4 votes |
private void getTime(DateTime widget, TimeTool time){ time.set(Calendar.HOUR_OF_DAY, widget.getHours()); time.set(Calendar.MINUTE, widget.getMinutes()); time.set(Calendar.SECOND, widget.getSeconds()); }
Example #26
Source File: DateTimeObservable.java From bonita-studio with GNU General Public License v2.0 | 4 votes |
public DateTimeObservable(final DateTime dateTime) { this.dateTime = dateTime; this.dateTime.addSelectionListener(listener); }
Example #27
Source File: DateTimeControl.java From bonita-studio with GNU General Public License v2.0 | 4 votes |
public DateTimeControl(final Composite parent) { super(parent, SWT.NONE); setLayout(GridLayoutFactory.fillDefaults().numColumns(2).create()); dateControl = new DateTime(this, SWT.BORDER | SWT.DATE | SWT.DROP_DOWN); timeControl = new DateTime(this, SWT.BORDER | SWT.TIME); }
Example #28
Source File: MigrationTaskEditor.java From depan with Apache License 2.0 | 4 votes |
/** * Create the editor's GUI. * * @param parent Parent Composite. * @return the top level Control for the GUI. */ private Control createControl(Composite parent) { // controls Composite topLevel = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(2, false); topLevel.setLayout(layout); Label labelId = new Label(topLevel, SWT.NONE); id = new Text(topLevel, SWT.BORDER); Label labelName = new Label(topLevel, SWT.NONE); name = new Text(topLevel, SWT.BORDER); Label labelDescription = new Label(topLevel, SWT.NONE); description = new Text( topLevel, SWT.BORDER | SWT.MULTI | SWT.WRAP | SWT.V_SCROLL); Label labelQuarter = new Label(topLevel, SWT.NONE); quarter = new Text(topLevel, SWT.BORDER); Label labelUpdatedBy = new Label(topLevel, SWT.NONE); updatedBy = new Text(topLevel, SWT.BORDER); Label labelUpdateDate = new Label(topLevel, SWT.NONE); updateDate = new DateTime(topLevel, SWT.CALENDAR); Label labelEngineers = new Label(topLevel, SWT.None); Control engineersEdit = createEngineersEditor(topLevel); // content labelId.setText("ID"); labelName.setText("Name"); labelDescription.setText("Description"); labelQuarter.setText("Quarter"); labelUpdatedBy.setText("Updated by"); labelUpdateDate.setText("Updated date"); labelEngineers.setText("Engineers"); // layout labelUpdateDate.setLayoutData( new GridData(SWT.FILL, SWT.TOP, false, false)); labelDescription.setLayoutData( new GridData(SWT.FILL, SWT.TOP, false, false)); labelEngineers.setLayoutData( new GridData(SWT.FILL, SWT.TOP, false, false)); id.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); name.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); quarter.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); updatedBy.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); GridData descriptionLayout = new GridData(SWT.FILL, SWT.FILL, true, false); descriptionLayout.heightHint = 150; description.setLayoutData(descriptionLayout); engineersEdit.setLayoutData(descriptionLayout); fillContent(); return topLevel; }
Example #29
Source File: DateTimeFieldEditor.java From elexis-3-core with Eclipse Public License 1.0 | 2 votes |
/** * Returns this field editor's text control. * * @return the text control, or <code>null</code> if no text field is * created yet */ protected DateTime getDateTimeControl() { return this.dateTimeField; }
Example #30
Source File: TimeSpanSelectionComposite.java From elexis-3-core with Eclipse Public License 1.0 | 2 votes |
/** * Update the date value of the TimeTool. * * @param time * @param dateTime */ private void setDateTime(DateTime dateTime, TimeTool time){ time.set(TimeTool.DAY_OF_MONTH, dateTime.getDay()); time.set(TimeTool.MONTH, dateTime.getMonth()); time.set(TimeTool.YEAR, dateTime.getYear()); }