Java Code Examples for org.eclipse.swt.SWT#DATE
The following examples show how to use
org.eclipse.swt.SWT#DATE .
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: 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 2
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 3
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 4
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 5
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 6
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); }