Search in sources :

Example 1 with DateTimeSelector

use of org.netxms.ui.eclipse.widgets.DateTimeSelector in project netxms by netxms.

the class HistoricalDataSelectionDialog method createDialogArea.

/* (non-Javadoc)
	 * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
	 */
@Override
protected Control createDialogArea(Composite parent) {
    Composite dialogArea = (Composite) super.createDialogArea(parent);
    GridLayout layout = new GridLayout();
    layout.marginWidth = WidgetHelper.DIALOG_WIDTH_MARGIN;
    layout.marginHeight = WidgetHelper.DIALOG_HEIGHT_MARGIN;
    layout.numColumns = 3;
    dialogArea.setLayout(layout);
    radioLastRecords = new Button(dialogArea, SWT.RADIO);
    radioLastRecords.setText(Messages.get().HistoricalDataSelectionDialog_LastRecords);
    GridData gd = new GridData();
    gd.horizontalSpan = 3;
    radioLastRecords.setLayoutData(gd);
    radioLastRecords.setSelection(maxRecords != 0);
    spinnerRecords = new Spinner(dialogArea, SWT.BORDER);
    spinnerRecords.setMinimum(1);
    spinnerRecords.setMaximum(65535);
    spinnerRecords.setSelection(maxRecords);
    gd = new GridData();
    gd.horizontalSpan = 3;
    spinnerRecords.setLayoutData(gd);
    spinnerRecords.setEnabled(radioLastRecords.getSelection());
    radioTimeFrame = new Button(dialogArea, SWT.RADIO);
    radioTimeFrame.setText(Messages.get().HistoricalDataSelectionDialog_TimeFrame);
    gd = new GridData();
    gd.horizontalSpan = 3;
    gd.verticalIndent = 5;
    radioTimeFrame.setLayoutData(gd);
    radioTimeFrame.setSelection(maxRecords == 0);
    dtsFrom = new DateTimeSelector(dialogArea, SWT.NONE);
    dtsFrom.setValue(timeFrom);
    dtsFrom.setEnabled(radioTimeFrame.getSelection());
    // $NON-NLS-1$
    new Label(dialogArea, SWT.NONE).setText("  -  ");
    dtsTo = new DateTimeSelector(dialogArea, SWT.NONE);
    dtsTo.setValue(timeTo);
    dtsTo.setEnabled(radioTimeFrame.getSelection());
    final SelectionListener listener = new SelectionListener() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            spinnerRecords.setEnabled(radioLastRecords.getSelection());
            dtsFrom.setEnabled(radioTimeFrame.getSelection());
            dtsTo.setEnabled(radioTimeFrame.getSelection());
        }

        @Override
        public void widgetDefaultSelected(SelectionEvent e) {
            widgetSelected(e);
        }
    };
    radioLastRecords.addSelectionListener(listener);
    radioTimeFrame.addSelectionListener(listener);
    return dialogArea;
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) Button(org.eclipse.swt.widgets.Button) Spinner(org.eclipse.swt.widgets.Spinner) GridData(org.eclipse.swt.layout.GridData) Label(org.eclipse.swt.widgets.Label) SelectionEvent(org.eclipse.swt.events.SelectionEvent) DateTimeSelector(org.netxms.ui.eclipse.widgets.DateTimeSelector) SelectionListener(org.eclipse.swt.events.SelectionListener)

Example 2 with DateTimeSelector

use of org.netxms.ui.eclipse.widgets.DateTimeSelector in project netxms by netxms.

the class RerunTimeDialog method createDialogArea.

/* (non-Javadoc)
    * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
    */
@Override
protected Control createDialogArea(Composite parent) {
    final Composite dialogArea = (Composite) super.createDialogArea(parent);
    GridLayout layout = new GridLayout();
    layout.marginHeight = WidgetHelper.DIALOG_HEIGHT_MARGIN;
    layout.marginWidth = WidgetHelper.DIALOG_WIDTH_MARGIN;
    layout.numColumns = 2;
    dialogArea.setLayout(layout);
    final WidgetFactory factory = new WidgetFactory() {

        @Override
        public Control createControl(Composite parent, int style) {
            return new DateTimeSelector(parent, style);
        }
    };
    dateSelector = (DateTimeSelector) WidgetHelper.createLabeledControl(dialogArea, SWT.NONE, factory, "New execution time", WidgetHelper.DEFAULT_LAYOUT_DATA);
    dateSelector.setValue(new Date());
    return dialogArea;
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) WidgetFactory(org.netxms.ui.eclipse.tools.WidgetFactory) DateTimeSelector(org.netxms.ui.eclipse.widgets.DateTimeSelector) Date(java.util.Date)

Example 3 with DateTimeSelector

use of org.netxms.ui.eclipse.widgets.DateTimeSelector in project netxms by netxms.

the class MaintanenceScheduleDialog method createDialogArea.

/* (non-Javadoc)
    * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
    */
@Override
protected Control createDialogArea(Composite parent) {
    Composite dialogArea = (Composite) super.createDialogArea(parent);
    GridLayout layout = new GridLayout();
    layout.verticalSpacing = WidgetHelper.OUTER_SPACING;
    layout.marginHeight = WidgetHelper.DIALOG_HEIGHT_MARGIN;
    layout.marginWidth = WidgetHelper.DIALOG_WIDTH_MARGIN;
    layout.numColumns = 2;
    dialogArea.setLayout(layout);
    labelStartDate = new Label(dialogArea, SWT.NONE);
    labelStartDate.setText(Messages.get().MaintanenceScheduleDialog_StartDate);
    startDateSelector = new DateTimeSelector(dialogArea, SWT.NONE);
    startDateSelector.setValue(new Date());
    startDateSelector.setToolTipText(Messages.get().MaintanenceScheduleDialog_StartDate);
    labelEndDate = new Label(dialogArea, SWT.NONE);
    labelEndDate.setText(Messages.get().MaintanenceScheduleDialog_EndDate);
    endDateSelector = new DateTimeSelector(dialogArea, SWT.NONE);
    endDateSelector.setValue(new Date());
    startDateSelector.setToolTipText(Messages.get().MaintanenceScheduleDialog_EndDate);
    return dialogArea;
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) Label(org.eclipse.swt.widgets.Label) DateTimeSelector(org.netxms.ui.eclipse.widgets.DateTimeSelector) Date(java.util.Date)

Aggregations

GridLayout (org.eclipse.swt.layout.GridLayout)3 Composite (org.eclipse.swt.widgets.Composite)3 DateTimeSelector (org.netxms.ui.eclipse.widgets.DateTimeSelector)3 Date (java.util.Date)2 Label (org.eclipse.swt.widgets.Label)2 SelectionEvent (org.eclipse.swt.events.SelectionEvent)1 SelectionListener (org.eclipse.swt.events.SelectionListener)1 GridData (org.eclipse.swt.layout.GridData)1 Button (org.eclipse.swt.widgets.Button)1 Spinner (org.eclipse.swt.widgets.Spinner)1 WidgetFactory (org.netxms.ui.eclipse.tools.WidgetFactory)1