Search in sources :

Example 1 with StatusSelector

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

the class ConditionEvents method createContents.

/* (non-Javadoc)
	 * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
	 */
@Override
protected Control createContents(Composite parent) {
    Composite dialogArea = new Composite(parent, SWT.NONE);
    object = (Condition) getElement().getAdapter(Condition.class);
    if (// Paranoid check
    object == null)
        return dialogArea;
    GridLayout layout = new GridLayout();
    layout.numColumns = 1;
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    layout.horizontalSpacing = WidgetHelper.DIALOG_SPACING;
    dialogArea.setLayout(layout);
    /* event group */
    Group eventGroup = new Group(dialogArea, SWT.NONE);
    eventGroup.setText(Messages.get().ConditionEvents_Events);
    GridData gd = new GridData();
    gd.grabExcessHorizontalSpace = true;
    gd.horizontalAlignment = SWT.FILL;
    eventGroup.setLayoutData(gd);
    layout = new GridLayout();
    eventGroup.setLayout(layout);
    activationEvent = new EventSelector(eventGroup, SWT.NONE);
    activationEvent.setLabel(Messages.get().ConditionEvents_ActivationEvent);
    activationEvent.setEventCode(object.getActivationEvent());
    gd = new GridData();
    gd.grabExcessHorizontalSpace = true;
    gd.horizontalAlignment = SWT.FILL;
    activationEvent.setLayoutData(gd);
    deactivationEvent = new EventSelector(eventGroup, SWT.NONE);
    deactivationEvent.setLabel(Messages.get().ConditionEvents_DeactivationEvent);
    deactivationEvent.setEventCode(object.getDeactivationEvent());
    gd = new GridData();
    gd.grabExcessHorizontalSpace = true;
    gd.horizontalAlignment = SWT.FILL;
    deactivationEvent.setLayoutData(gd);
    sourceObject = new ObjectSelector(eventGroup, SWT.NONE, true);
    sourceObject.setLabel(Messages.get().ConditionEvents_SourceObject);
    sourceObject.setEmptySelectionName(Messages.get().ConditionEvents_SelectionServer);
    sourceObject.setObjectId(object.getEventSourceObject());
    gd = new GridData();
    gd.grabExcessHorizontalSpace = true;
    gd.horizontalAlignment = SWT.FILL;
    sourceObject.setLayoutData(gd);
    /* status group */
    Group statusGroup = new Group(dialogArea, SWT.NONE);
    statusGroup.setText(Messages.get().ConditionEvents_Status);
    gd = new GridData();
    gd.grabExcessHorizontalSpace = true;
    gd.horizontalAlignment = SWT.FILL;
    statusGroup.setLayoutData(gd);
    layout = new GridLayout();
    layout.numColumns = 2;
    statusGroup.setLayout(layout);
    activeStatus = new StatusSelector(statusGroup, SWT.NONE, Severity.CRITICAL.getValue());
    activeStatus.setLabel(Messages.get().ConditionEvents_ActiveStatus);
    activeStatus.setSelection(object.getActiveStatus());
    gd = new GridData();
    gd.grabExcessHorizontalSpace = true;
    gd.horizontalAlignment = SWT.FILL;
    activeStatus.setLayoutData(gd);
    inactiveStatus = new StatusSelector(statusGroup, SWT.NONE, Severity.CRITICAL.getValue());
    inactiveStatus.setLabel(Messages.get().ConditionEvents_InactiveStatus);
    inactiveStatus.setSelection(object.getInactiveStatus());
    gd = new GridData();
    gd.grabExcessHorizontalSpace = true;
    gd.horizontalAlignment = SWT.FILL;
    inactiveStatus.setLayoutData(gd);
    return dialogArea;
}
Also used : Group(org.eclipse.swt.widgets.Group) GridLayout(org.eclipse.swt.layout.GridLayout) ObjectSelector(org.netxms.ui.eclipse.objectbrowser.widgets.ObjectSelector) Composite(org.eclipse.swt.widgets.Composite) EventSelector(org.netxms.ui.eclipse.eventmanager.widgets.EventSelector) StatusSelector(org.netxms.ui.eclipse.widgets.StatusSelector) GridData(org.eclipse.swt.layout.GridData)

Aggregations

GridData (org.eclipse.swt.layout.GridData)1 GridLayout (org.eclipse.swt.layout.GridLayout)1 Composite (org.eclipse.swt.widgets.Composite)1 Group (org.eclipse.swt.widgets.Group)1 EventSelector (org.netxms.ui.eclipse.eventmanager.widgets.EventSelector)1 ObjectSelector (org.netxms.ui.eclipse.objectbrowser.widgets.ObjectSelector)1 StatusSelector (org.netxms.ui.eclipse.widgets.StatusSelector)1