use of org.eclipse.swt.widgets.DateTime in project yamcs-studio by yamcs.
the class CustomizeRangeDialog method createDialogArea.
@Override
protected Control createDialogArea(Composite parent) {
Composite area = (Composite) super.createDialogArea(parent);
Composite container = new Composite(area, SWT.NONE);
container.setLayoutData(new GridData(GridData.FILL_BOTH));
GridLayout layout = new GridLayout(2, false);
layout.marginHeight = 20;
layout.marginWidth = 20;
layout.verticalSpacing = 2;
container.setLayout(layout);
Composite startLabelWrapper = new Composite(container, SWT.NONE);
GridLayout gl = new GridLayout(2, false);
gl.marginHeight = 0;
gl.marginWidth = 0;
startLabelWrapper.setLayout(gl);
Label lbl = new Label(startLabelWrapper, SWT.NONE);
lbl.setText("Start");
startClosed = new Button(startLabelWrapper, SWT.CHECK | SWT.NONE);
startClosed.addListener(SWT.Selection, e -> {
startDate.setVisible(startClosed.getSelection());
startTime.setVisible(startClosed.getSelection());
validate();
});
startClosed.setSelection(startClosedValue);
Composite startComposite = new Composite(container, SWT.NONE);
RowLayout rl = new RowLayout();
rl.marginLeft = 0;
rl.marginTop = 0;
rl.marginBottom = 0;
rl.center = true;
startComposite.setLayout(rl);
startDate = new DateTime(startComposite, SWT.DATE | SWT.LONG | SWT.DROP_DOWN | SWT.BORDER);
startDate.addListener(SWT.Selection, e -> validate());
startTime = new DateTime(startComposite, SWT.TIME | SWT.LONG | SWT.BORDER);
startTime.addListener(SWT.Selection, e -> validate());
if (startTimeValue != null) {
startDate.setDate(startTimeValue.get(Calendar.YEAR), startTimeValue.get(Calendar.MONTH), startTimeValue.get(Calendar.DAY_OF_MONTH));
startTime.setTime(startTimeValue.get(Calendar.HOUR_OF_DAY), startTimeValue.get(Calendar.MINUTE), startTimeValue.get(Calendar.SECOND));
}
startDate.setVisible(startClosedValue);
startTime.setVisible(startClosedValue);
Composite stopLabelWrapper = new Composite(container, SWT.NONE);
gl = new GridLayout(2, false);
gl.marginHeight = 0;
gl.marginWidth = 0;
stopLabelWrapper.setLayout(gl);
lbl = new Label(stopLabelWrapper, SWT.NONE);
lbl.setText("Stop");
stopClosed = new Button(stopLabelWrapper, SWT.CHECK | SWT.NONE);
stopClosed.addListener(SWT.Selection, e -> {
stopDate.setVisible(stopClosed.getSelection());
stopTime.setVisible(stopClosed.getSelection());
validate();
});
stopClosed.setSelection(stopClosedValue);
Composite stopComposite = new Composite(container, SWT.NONE);
rl = new RowLayout();
rl.marginLeft = 0;
rl.marginTop = 0;
rl.marginBottom = 0;
rl.center = true;
rl.fill = true;
stopComposite.setLayout(rl);
stopDate = new DateTime(stopComposite, SWT.DATE | SWT.LONG | SWT.DROP_DOWN | SWT.BORDER);
stopDate.addListener(SWT.Selection, e -> validate());
stopTime = new DateTime(stopComposite, SWT.TIME | SWT.LONG | SWT.BORDER);
stopTime.addListener(SWT.Selection, e -> validate());
if (stopTimeValue != null) {
stopDate.setDate(stopTimeValue.get(Calendar.YEAR), stopTimeValue.get(Calendar.MONTH), stopTimeValue.get(Calendar.DAY_OF_MONTH));
stopTime.setTime(stopTimeValue.get(Calendar.HOUR_OF_DAY), stopTimeValue.get(Calendar.MINUTE), stopTimeValue.get(Calendar.SECOND));
}
stopDate.setVisible(stopClosedValue);
stopTime.setVisible(stopClosedValue);
return container;
}
use of org.eclipse.swt.widgets.DateTime in project yamcs-studio by yamcs.
the class ImportPastEventsDialog method createDialogArea.
@Override
protected Control createDialogArea(Composite parent) {
Composite area = (Composite) super.createDialogArea(parent);
Composite container = new Composite(area, SWT.NONE);
container.setLayoutData(new GridData(GridData.FILL_BOTH));
GridLayout layout = new GridLayout(2, false);
layout.marginHeight = 20;
layout.marginWidth = 20;
layout.verticalSpacing = 2;
container.setLayout(layout);
Label lbl = new Label(container, SWT.NONE);
lbl.setText("Start:");
Composite startComposite = new Composite(container, SWT.NONE);
RowLayout rl = new RowLayout();
rl.marginLeft = 0;
rl.marginTop = 0;
rl.marginBottom = 0;
rl.center = true;
startComposite.setLayout(rl);
startDate = new DateTime(startComposite, SWT.DATE | SWT.LONG | SWT.DROP_DOWN | SWT.BORDER);
startDate.addListener(SWT.Selection, e -> validate());
startDate.addListener(SWT.FocusOut, e -> validate());
startTime = new DateTime(startComposite, SWT.TIME | SWT.LONG | SWT.BORDER);
startTime.addListener(SWT.Selection, e -> validate());
startTime.addListener(SWT.FocusOut, e -> validate());
if (startTimeValue != null) {
startDate.setDate(startTimeValue.get(Calendar.YEAR), startTimeValue.get(Calendar.MONTH), startTimeValue.get(Calendar.DAY_OF_MONTH));
startTime.setTime(startTimeValue.get(Calendar.HOUR_OF_DAY), startTimeValue.get(Calendar.MINUTE), startTimeValue.get(Calendar.SECOND));
}
lbl = new Label(container, SWT.NONE);
lbl.setText("Stop:");
Composite stopComposite = new Composite(container, SWT.NONE);
rl = new RowLayout();
rl.marginLeft = 0;
rl.marginTop = 0;
rl.marginBottom = 0;
rl.center = true;
rl.fill = true;
stopComposite.setLayout(rl);
stopDate = new DateTime(stopComposite, SWT.DATE | SWT.LONG | SWT.DROP_DOWN | SWT.BORDER);
stopDate.addListener(SWT.Selection, e -> validate());
stopDate.addListener(SWT.FocusOut, e -> validate());
stopTime = new DateTime(stopComposite, SWT.TIME | SWT.LONG | SWT.BORDER);
stopTime.addListener(SWT.Selection, e -> validate());
stopTime.addListener(SWT.FocusOut, e -> validate());
if (stopTimeValue != null) {
stopDate.setDate(stopTimeValue.get(Calendar.YEAR), stopTimeValue.get(Calendar.MONTH), stopTimeValue.get(Calendar.DAY_OF_MONTH));
stopTime.setTime(stopTimeValue.get(Calendar.HOUR_OF_DAY), stopTimeValue.get(Calendar.MINUTE), stopTimeValue.get(Calendar.SECOND));
}
return container;
}
Aggregations