Search in sources :

Example 86 with RowLayout

use of org.eclipse.swt.layout.RowLayout 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;
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) RowLayout(org.eclipse.swt.layout.RowLayout) GridData(org.eclipse.swt.layout.GridData) Label(org.eclipse.swt.widgets.Label) DateTime(org.eclipse.swt.widgets.DateTime)

Aggregations

RowLayout (org.eclipse.swt.layout.RowLayout)86 Composite (org.eclipse.swt.widgets.Composite)73 GridData (org.eclipse.swt.layout.GridData)55 Button (org.eclipse.swt.widgets.Button)54 GridLayout (org.eclipse.swt.layout.GridLayout)52 Label (org.eclipse.swt.widgets.Label)44 SelectionEvent (org.eclipse.swt.events.SelectionEvent)41 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)34 Group (org.eclipse.swt.widgets.Group)27 Text (org.eclipse.swt.widgets.Text)23 Combo (org.eclipse.swt.widgets.Combo)19 Shell (org.eclipse.swt.widgets.Shell)17 Display (org.eclipse.swt.widgets.Display)16 Point (org.eclipse.swt.graphics.Point)12 ArrayList (java.util.ArrayList)10 StyledText (org.eclipse.swt.custom.StyledText)10 Table (org.eclipse.swt.widgets.Table)10 List (java.util.List)9 SelectionListener (org.eclipse.swt.events.SelectionListener)9 FillLayout (org.eclipse.swt.layout.FillLayout)9