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