Search in sources :

Example 1 with ObjectSelector

use of org.netxms.ui.eclipse.objectbrowser.widgets.ObjectSelector in project netxms by netxms.

the class EventMonitor method createContents.

@Override
protected Control createContents(Composite parent) {
    config = (EventMonitorConfig) getElement().getAdapter(EventMonitorConfig.class);
    Composite dialogArea = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    dialogArea.setLayout(layout);
    objectSelector = new ObjectSelector(dialogArea, SWT.NONE, true);
    objectSelector.setLabel("Root object");
    objectSelector.setObjectClass(AbstractObject.class);
    objectSelector.setObjectId(config.getObjectId());
    GridData gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    objectSelector.setLayoutData(gd);
    title = new LabeledText(dialogArea, SWT.NONE);
    title.setLabel("Title");
    title.setText(config.getTitle());
    gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    title.setLayoutData(gd);
    return dialogArea;
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) ObjectSelector(org.netxms.ui.eclipse.objectbrowser.widgets.ObjectSelector) Composite(org.eclipse.swt.widgets.Composite) LabeledText(org.netxms.ui.eclipse.widgets.LabeledText) GridData(org.eclipse.swt.layout.GridData)

Example 2 with ObjectSelector

use of org.netxms.ui.eclipse.objectbrowser.widgets.ObjectSelector in project netxms by netxms.

the class ObjectStatusChart method createContents.

/* (non-Javadoc)
	 * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
	 */
@Override
protected Control createContents(Composite parent) {
    config = (ObjectStatusChartConfig) getElement().getAdapter(ObjectStatusChartConfig.class);
    Composite dialogArea = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.numColumns = 2;
    dialogArea.setLayout(layout);
    objectSelector = new ObjectSelector(dialogArea, SWT.NONE, false);
    objectSelector.setLabel(Messages.get().ObjectStatusChart_RootObject);
    objectSelector.setObjectClass(AbstractObject.class);
    objectSelector.setObjectId(config.getRootObject());
    GridData gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    gd.horizontalSpan = 2;
    objectSelector.setLayoutData(gd);
    title = new LabeledText(dialogArea, SWT.NONE);
    title.setLabel(Messages.get().ObjectStatusChart_Title);
    title.setText(config.getTitle());
    gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    gd.horizontalSpan = 2;
    title.setLayoutData(gd);
    Group optionsGroup = new Group(dialogArea, SWT.NONE);
    optionsGroup.setText(Messages.get().ObjectStatusChart_Options);
    gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    optionsGroup.setLayoutData(gd);
    GridLayout optionsLayout = new GridLayout();
    optionsGroup.setLayout(optionsLayout);
    checkShowLegend = new Button(optionsGroup, SWT.CHECK);
    checkShowLegend.setText(Messages.get().ObjectStatusChart_ShowLegend);
    checkShowLegend.setSelection(config.isShowLegend());
    checkShow3D = new Button(optionsGroup, SWT.CHECK);
    checkShow3D.setText(Messages.get().ObjectStatusChart_3DView);
    checkShow3D.setSelection(config.isShowIn3D());
    checkTransposed = new Button(optionsGroup, SWT.CHECK);
    checkTransposed.setText(Messages.get().ObjectStatusChart_Transposed);
    checkTransposed.setSelection(config.isTransposed());
    checkTranslucent = new Button(optionsGroup, SWT.CHECK);
    checkTranslucent.setText(Messages.get().ObjectStatusChart_Translucent);
    checkTranslucent.setSelection(config.isTranslucent());
    gd = new GridData();
    gd.verticalAlignment = SWT.TOP;
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    refreshRate = WidgetHelper.createLabeledSpinner(dialogArea, SWT.BORDER, Messages.get().ObjectStatusChart_RefreshInterval, 1, 10000, gd);
    refreshRate.setSelection(config.getRefreshRate());
    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) LabeledText(org.netxms.ui.eclipse.widgets.LabeledText) Button(org.eclipse.swt.widgets.Button) GridData(org.eclipse.swt.layout.GridData)

Example 3 with ObjectSelector

use of org.netxms.ui.eclipse.objectbrowser.widgets.ObjectSelector in project netxms by netxms.

the class SnmpTrapMonitor method createContents.

@Override
protected Control createContents(Composite parent) {
    config = (SnmpTrapMonitorConfig) getElement().getAdapter(SnmpTrapMonitorConfig.class);
    Composite dialogArea = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    dialogArea.setLayout(layout);
    objectSelector = new ObjectSelector(dialogArea, SWT.NONE, true);
    objectSelector.setLabel("Root object");
    objectSelector.setObjectClass(AbstractObject.class);
    objectSelector.setObjectId(config.getObjectId());
    GridData gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    objectSelector.setLayoutData(gd);
    title = new LabeledText(dialogArea, SWT.NONE);
    title.setLabel("Title");
    title.setText(config.getTitle());
    gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    title.setLayoutData(gd);
    return dialogArea;
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) ObjectSelector(org.netxms.ui.eclipse.objectbrowser.widgets.ObjectSelector) Composite(org.eclipse.swt.widgets.Composite) LabeledText(org.netxms.ui.eclipse.widgets.LabeledText) GridData(org.eclipse.swt.layout.GridData)

Example 4 with ObjectSelector

use of org.netxms.ui.eclipse.objectbrowser.widgets.ObjectSelector in project netxms by netxms.

the class StatusMap method createContents.

/* (non-Javadoc)
	 * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
	 */
@Override
protected Control createContents(Composite parent) {
    config = (StatusMapConfig) getElement().getAdapter(StatusMapConfig.class);
    Composite dialogArea = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    dialogArea.setLayout(layout);
    objectSelector = new ObjectSelector(dialogArea, SWT.NONE, true);
    objectSelector.setLabel(Messages.get().AlarmViewer_RootObject);
    objectSelector.setObjectClass(AbstractObject.class);
    objectSelector.setObjectId(config.getObjectId());
    GridData gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    objectSelector.setLayoutData(gd);
    title = new LabeledText(dialogArea, SWT.NONE);
    title.setLabel(Messages.get().AlarmViewer_Title);
    title.setText(config.getTitle());
    gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    title.setLayoutData(gd);
    Group severityGroup = new Group(dialogArea, SWT.NONE);
    severityGroup.setText(Messages.get().StatusMap_SeverityFilter);
    gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    severityGroup.setLayoutData(gd);
    layout = new GridLayout();
    layout.numColumns = 4;
    layout.makeColumnsEqualWidth = true;
    severityGroup.setLayout(layout);
    checkSeverity = new Button[7];
    for (int severity = 6; severity >= 0; severity--) {
        checkSeverity[severity] = new Button(severityGroup, SWT.CHECK);
        checkSeverity[severity].setText(StatusDisplayInfo.getStatusText(severity));
        checkSeverity[severity].setSelection((config.getSeverityFilter() & (1 << severity)) != 0);
    }
    Group optionsGroup = new Group(dialogArea, SWT.NONE);
    optionsGroup.setText(Messages.get().StatusMap_Options);
    gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    optionsGroup.setLayoutData(gd);
    layout = new GridLayout();
    layout.numColumns = 1;
    layout.makeColumnsEqualWidth = true;
    optionsGroup.setLayout(layout);
    checkGroupObjects = new Button(optionsGroup, SWT.CHECK);
    checkGroupObjects.setText(Messages.get().StatusMap_Group);
    checkGroupObjects.setSelection(config.isGroupObjects());
    checkShowFilter = new Button(optionsGroup, SWT.CHECK);
    checkShowFilter.setText(Messages.get().StatusMap_ShowFilter);
    checkShowFilter.setSelection(config.isShowTextFilter());
    checkRadial = new Button(optionsGroup, SWT.CHECK);
    checkRadial.setText("Show in radial form");
    checkRadial.setSelection(config.isShowRadial());
    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) LabeledText(org.netxms.ui.eclipse.widgets.LabeledText) Button(org.eclipse.swt.widgets.Button) GridData(org.eclipse.swt.layout.GridData)

Example 5 with ObjectSelector

use of org.netxms.ui.eclipse.objectbrowser.widgets.ObjectSelector in project netxms by netxms.

the class General method createContents.

/* (non-Javadoc)
	 * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
	 */
@Override
protected Control createContents(Composite parent) {
    Composite dialogArea = (Composite) super.createContents(parent);
    dci = editor.getObjectAsItem();
    GridLayout layout = new GridLayout();
    layout.verticalSpacing = WidgetHelper.OUTER_SPACING;
    layout.marginWidth = 0;
    layout.marginHeight = 0;
    layout.numColumns = 2;
    dialogArea.setLayout(layout);
    /**
     * description area *
     */
    Group groupDescription = new Group(dialogArea, SWT.NONE);
    groupDescription.setText(Messages.get().General_Description);
    FillLayout descriptionLayout = new FillLayout();
    descriptionLayout.marginWidth = WidgetHelper.OUTER_SPACING;
    descriptionLayout.marginHeight = WidgetHelper.OUTER_SPACING;
    groupDescription.setLayout(descriptionLayout);
    description = new Text(groupDescription, SWT.BORDER);
    description.setTextLimit(255);
    description.setText(dci.getDescription());
    GridData gd = new GridData();
    gd.grabExcessHorizontalSpace = true;
    gd.horizontalAlignment = SWT.FILL;
    gd.horizontalSpan = 2;
    groupDescription.setLayoutData(gd);
    /**
     * data area *
     */
    Group groupData = new Group(dialogArea, SWT.NONE);
    groupData.setText(Messages.get().General_Data);
    FormLayout dataLayout = new FormLayout();
    dataLayout.marginHeight = WidgetHelper.OUTER_SPACING;
    dataLayout.marginWidth = WidgetHelper.OUTER_SPACING;
    groupData.setLayout(dataLayout);
    gd = new GridData();
    gd.grabExcessHorizontalSpace = true;
    gd.horizontalAlignment = SWT.FILL;
    gd.horizontalSpan = 2;
    groupData.setLayoutData(gd);
    parameter = new LabeledText(groupData, SWT.NONE);
    parameter.setLabel(Messages.get().General_Parameter);
    parameter.getTextControl().setTextLimit(255);
    parameter.setText(dci.getName());
    selectButton = new Button(groupData, SWT.PUSH);
    selectButton.setText(Messages.get().General_Select);
    selectButton.addSelectionListener(new SelectionListener() {

        @Override
        public void widgetDefaultSelected(SelectionEvent e) {
            widgetSelected(e);
        }

        @Override
        public void widgetSelected(SelectionEvent e) {
            selectParameter();
        }
    });
    FormData fd = new FormData();
    fd.left = new FormAttachment(0, 0);
    fd.top = new FormAttachment(0, 0);
    fd.right = new FormAttachment(selectButton, -WidgetHelper.INNER_SPACING, SWT.LEFT);
    parameter.setLayoutData(fd);
    fd = new FormData();
    fd.right = new FormAttachment(100, 0);
    fd.bottom = new FormAttachment(parameter, 0, SWT.BOTTOM);
    fd.width = WidgetHelper.BUTTON_WIDTH_HINT;
    selectButton.setLayoutData(fd);
    fd = new FormData();
    fd.left = new FormAttachment(0, 0);
    fd.top = new FormAttachment(parameter, WidgetHelper.OUTER_SPACING, SWT.BOTTOM);
    fd.right = new FormAttachment(50, -WidgetHelper.OUTER_SPACING / 2);
    origin = WidgetHelper.createLabeledCombo(groupData, SWT.READ_ONLY, Messages.get().General_Origin, fd);
    origin.add(Messages.get().General_SourceInternal);
    origin.add(Messages.get().General_SourceAgent);
    origin.add(Messages.get().General_SourceSNMP);
    origin.add(Messages.get().General_SourceCPSNMP);
    origin.add(Messages.get().General_SourcePush);
    origin.add(Messages.get().General_WinPerf);
    origin.add(Messages.get().General_SMCLP);
    origin.add(Messages.get().General_Script);
    origin.add(Messages.get().General_SourceSSH);
    origin.add(Messages.get().General_SourceMQTT);
    origin.add(Messages.get().General_SourceDeviceDriver);
    origin.select(dci.getOrigin());
    origin.addSelectionListener(new SelectionListener() {

        @Override
        public void widgetDefaultSelected(SelectionEvent e) {
            widgetSelected(e);
        }

        @Override
        public void widgetSelected(SelectionEvent e) {
            onOriginChange();
        }
    });
    fd = new FormData();
    fd.left = new FormAttachment(50, WidgetHelper.OUTER_SPACING / 2);
    fd.top = new FormAttachment(parameter, WidgetHelper.OUTER_SPACING, SWT.BOTTOM);
    fd.right = new FormAttachment(100, 0);
    dataType = WidgetHelper.createLabeledCombo(groupData, SWT.READ_ONLY, Messages.get().General_DataType, fd);
    dataType.add(DataCollectionDisplayInfo.getDataTypeName(DataType.INT32));
    dataType.add(DataCollectionDisplayInfo.getDataTypeName(DataType.UINT32));
    dataType.add(DataCollectionDisplayInfo.getDataTypeName(DataType.COUNTER32));
    dataType.add(DataCollectionDisplayInfo.getDataTypeName(DataType.INT64));
    dataType.add(DataCollectionDisplayInfo.getDataTypeName(DataType.UINT64));
    dataType.add(DataCollectionDisplayInfo.getDataTypeName(DataType.COUNTER64));
    dataType.add(DataCollectionDisplayInfo.getDataTypeName(DataType.FLOAT));
    dataType.add(DataCollectionDisplayInfo.getDataTypeName(DataType.STRING));
    dataType.select(getDataTypePosition(dci.getDataType()));
    checkInterpretRawSnmpValue = new Button(groupData, SWT.CHECK);
    checkInterpretRawSnmpValue.setText(Messages.get().General_InterpretRawValue);
    checkInterpretRawSnmpValue.setSelection(dci.isSnmpRawValueInOctetString());
    checkInterpretRawSnmpValue.addSelectionListener(new SelectionListener() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            snmpRawType.setEnabled(checkInterpretRawSnmpValue.getSelection());
        }

        @Override
        public void widgetDefaultSelected(SelectionEvent e) {
            widgetSelected(e);
        }
    });
    fd = new FormData();
    fd.left = new FormAttachment(0, 0);
    fd.top = new FormAttachment(origin.getParent(), WidgetHelper.OUTER_SPACING, SWT.BOTTOM);
    checkInterpretRawSnmpValue.setLayoutData(fd);
    checkInterpretRawSnmpValue.setEnabled(dci.getOrigin() == DataCollectionItem.SNMP);
    snmpRawType = new Combo(groupData, SWT.BORDER | SWT.READ_ONLY);
    for (int i = 0; i < snmpRawTypes.length; i++) snmpRawType.add(snmpRawTypes[i]);
    snmpRawType.select(dci.getSnmpRawValueType());
    snmpRawType.setEnabled((dci.getOrigin() == DataCollectionItem.SNMP) && dci.isSnmpRawValueInOctetString());
    fd = new FormData();
    fd.left = new FormAttachment(0, 0);
    fd.top = new FormAttachment(checkInterpretRawSnmpValue, WidgetHelper.OUTER_SPACING, SWT.BOTTOM);
    fd.right = new FormAttachment(checkInterpretRawSnmpValue, 0, SWT.RIGHT);
    snmpRawType.setLayoutData(fd);
    checkUseCustomSnmpPort = new Button(groupData, SWT.CHECK);
    checkUseCustomSnmpPort.setText(Messages.get().General_UseCustomPort);
    checkUseCustomSnmpPort.setSelection(dci.getSnmpPort() != 0);
    checkUseCustomSnmpPort.addSelectionListener(new SelectionListener() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            customSnmpPort.setEnabled(checkUseCustomSnmpPort.getSelection());
        }

        @Override
        public void widgetDefaultSelected(SelectionEvent e) {
            widgetSelected(e);
        }
    });
    fd = new FormData();
    fd.left = new FormAttachment(checkInterpretRawSnmpValue, WidgetHelper.OUTER_SPACING, SWT.RIGHT);
    fd.right = new FormAttachment(100, 0);
    fd.top = new FormAttachment(dataType.getParent(), WidgetHelper.OUTER_SPACING, SWT.BOTTOM);
    checkUseCustomSnmpPort.setLayoutData(fd);
    checkUseCustomSnmpPort.setEnabled(dci.getOrigin() == DataCollectionItem.SNMP);
    customSnmpPort = new Spinner(groupData, SWT.BORDER);
    customSnmpPort.setMinimum(1);
    customSnmpPort.setMaximum(65535);
    if ((dci.getOrigin() == DataCollectionItem.SNMP) && (dci.getSnmpPort() != 0)) {
        customSnmpPort.setEnabled(true);
        customSnmpPort.setSelection(dci.getSnmpPort());
    } else {
        customSnmpPort.setEnabled(false);
    }
    fd = new FormData();
    fd.left = new FormAttachment(checkInterpretRawSnmpValue, WidgetHelper.OUTER_SPACING, SWT.RIGHT);
    fd.right = new FormAttachment(100, 0);
    fd.top = new FormAttachment(checkUseCustomSnmpPort, WidgetHelper.OUTER_SPACING, SWT.BOTTOM);
    customSnmpPort.setLayoutData(fd);
    sampleCount = new LabeledSpinner(groupData, SWT.NONE);
    sampleCount.setLabel(Messages.get().General_SampleCountForAvg);
    sampleCount.setRange(0, 65535);
    sampleCount.setSelection(dci.getSampleCount());
    sampleCount.setEnabled(dci.getOrigin() == DataCollectionItem.WINPERF);
    fd = new FormData();
    fd.left = new FormAttachment(0, 0);
    fd.top = new FormAttachment(snmpRawType, WidgetHelper.OUTER_SPACING, SWT.BOTTOM);
    fd.right = new FormAttachment(100, 0);
    sampleCount.setLayoutData(fd);
    sourceNode = new ObjectSelector(groupData, SWT.NONE, true);
    sourceNode.setLabel(Messages.get().General_ProxyNode);
    sourceNode.setObjectClass(Node.class);
    sourceNode.setObjectId(dci.getSourceNode());
    sourceNode.setEnabled(dci.getOrigin() != DataCollectionItem.PUSH);
    fd = new FormData();
    fd.top = new FormAttachment(sampleCount, WidgetHelper.OUTER_SPACING, SWT.BOTTOM);
    fd.right = new FormAttachment(100, 0);
    agentCacheMode = WidgetHelper.createLabeledCombo(groupData, SWT.READ_ONLY, Messages.get().General_AgentCacheMode, fd);
    agentCacheMode.add(Messages.get().General_Default);
    agentCacheMode.add(Messages.get().General_On);
    agentCacheMode.add(Messages.get().General_Off);
    agentCacheMode.select(dci.getCacheMode().getValue());
    agentCacheMode.setEnabled((dci.getOrigin() == DataCollectionItem.AGENT) || (dci.getOrigin() == DataCollectionItem.SNMP));
    fd = new FormData();
    fd.left = new FormAttachment(0, 0);
    fd.top = new FormAttachment(sampleCount, WidgetHelper.OUTER_SPACING, SWT.BOTTOM);
    fd.right = new FormAttachment(agentCacheMode.getParent(), -WidgetHelper.OUTER_SPACING, SWT.LEFT);
    sourceNode.setLayoutData(fd);
    /**
     * polling area *
     */
    Group groupPolling = new Group(dialogArea, SWT.NONE);
    groupPolling.setText(Messages.get().General_Polling);
    FormLayout pollingLayout = new FormLayout();
    pollingLayout.marginHeight = WidgetHelper.OUTER_SPACING;
    pollingLayout.marginWidth = WidgetHelper.OUTER_SPACING;
    groupPolling.setLayout(pollingLayout);
    gd = new GridData();
    gd.grabExcessHorizontalSpace = true;
    gd.horizontalAlignment = SWT.FILL;
    gd.verticalAlignment = SWT.FILL;
    groupPolling.setLayoutData(gd);
    fd = new FormData();
    fd.left = new FormAttachment(0, 0);
    fd.right = new FormAttachment(50, -WidgetHelper.OUTER_SPACING / 2);
    fd.top = new FormAttachment(0, 0);
    schedulingMode = WidgetHelper.createLabeledCombo(groupPolling, SWT.READ_ONLY, Messages.get().General_PollingMode, fd);
    schedulingMode.add(Messages.get().General_FixedIntervalsDefault);
    schedulingMode.add(Messages.get().General_FixedIntervalsCustom);
    schedulingMode.add(Messages.get().General_CustomSchedule);
    schedulingMode.select(dci.isUseAdvancedSchedule() ? 2 : ((dci.getPollingInterval() > 0) ? 1 : 0));
    schedulingMode.setEnabled(dci.getOrigin() != DataCollectionItem.PUSH);
    schedulingMode.addSelectionListener(new SelectionListener() {

        @Override
        public void widgetDefaultSelected(SelectionEvent e) {
            widgetSelected(e);
        }

        @Override
        public void widgetSelected(SelectionEvent e) {
            pollingInterval.setEnabled(schedulingMode.getSelectionIndex() == 1);
        }
    });
    pollingInterval = new LabeledSpinner(groupPolling, SWT.NONE);
    pollingInterval.setLabel(Messages.get().General_PollingInterval);
    pollingInterval.setRange(1, 99999);
    pollingInterval.setSelection((dci.getPollingInterval() > 0) ? dci.getPollingInterval() : ConsoleSharedData.getSession().getDefaultDciPollingInterval());
    pollingInterval.setEnabled(!dci.isUseAdvancedSchedule() && (dci.getPollingInterval() > 0) && (dci.getOrigin() != DataCollectionItem.PUSH));
    fd = new FormData();
    fd.left = new FormAttachment(50, WidgetHelper.OUTER_SPACING / 2);
    fd.right = new FormAttachment(100, 0);
    fd.top = new FormAttachment(0, 0);
    pollingInterval.setLayoutData(fd);
    /**
     * status *
     */
    Group groupStatus = new Group(dialogArea, SWT.NONE);
    groupStatus.setText(Messages.get().General_Status);
    gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.verticalAlignment = SWT.FILL;
    groupStatus.setLayoutData(gd);
    RowLayout statusLayout = new RowLayout();
    statusLayout.type = SWT.VERTICAL;
    groupStatus.setLayout(statusLayout);
    statusActive = new Button(groupStatus, SWT.RADIO);
    statusActive.setText(Messages.get().General_Active);
    statusActive.setSelection(dci.getStatus() == DataCollectionItem.ACTIVE);
    statusDisabled = new Button(groupStatus, SWT.RADIO);
    statusDisabled.setText(Messages.get().General_Disabled);
    statusDisabled.setSelection(dci.getStatus() == DataCollectionItem.DISABLED);
    statusUnsupported = new Button(groupStatus, SWT.RADIO);
    statusUnsupported.setText(Messages.get().General_NotSupported);
    statusUnsupported.setSelection(dci.getStatus() == DataCollectionItem.NOT_SUPPORTED);
    /**
     * storage *
     */
    Group groupStorage = new Group(dialogArea, SWT.NONE);
    groupStorage.setText(Messages.get().General_Storage);
    gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.verticalAlignment = SWT.FILL;
    gd.horizontalSpan = 2;
    groupStorage.setLayoutData(gd);
    GridLayout storageLayout = new GridLayout();
    storageLayout.numColumns = 2;
    storageLayout.horizontalSpacing = WidgetHelper.OUTER_SPACING;
    groupStorage.setLayout(storageLayout);
    gd = new GridData();
    gd.grabExcessHorizontalSpace = true;
    gd.horizontalAlignment = SWT.FILL;
    retentionMode = WidgetHelper.createLabeledCombo(groupStorage, SWT.READ_ONLY, Messages.get().General_RetentionMode, gd);
    retentionMode.add(Messages.get().General_UseDefaultRetention);
    retentionMode.add(Messages.get().General_UseCustomRetention);
    retentionMode.add(Messages.get().General_NoStorage);
    retentionMode.select(((dci.getFlags() & DataCollectionObject.DCF_NO_STORAGE) != 0) ? 2 : ((dci.getRetentionTime() > 0) ? 1 : 0));
    retentionMode.addSelectionListener(new SelectionListener() {

        @Override
        public void widgetDefaultSelected(SelectionEvent e) {
            widgetSelected(e);
        }

        @Override
        public void widgetSelected(SelectionEvent e) {
            int mode = retentionMode.getSelectionIndex();
            retentionTime.setEnabled(mode == 1);
        }
    });
    retentionTime = new LabeledSpinner(groupStorage, SWT.NONE);
    retentionTime.setLabel(Messages.get().General_RetentionTime);
    retentionTime.setRange(1, 99999);
    retentionTime.setSelection((dci.getRetentionTime() > 0) ? dci.getRetentionTime() : ConsoleSharedData.getSession().getDefaultDciRetentionTime());
    retentionTime.setEnabled(((dci.getFlags() & DataCollectionObject.DCF_NO_STORAGE) == 0) && (dci.getRetentionTime() > 0));
    gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    retentionTime.setLayoutData(gd);
    int mode = 0;
    if ((dci.getFlags() & DataCollectionObject.DCF_NO_STORAGE) != 0)
        mode = 2;
    else if (dci.getRetentionTime() > 0)
        mode = 1;
    retentionMode.select(mode);
    retentionTime.setEnabled(mode == 1);
    onOriginChange();
    return dialogArea;
}
Also used : FormLayout(org.eclipse.swt.layout.FormLayout) FormData(org.eclipse.swt.layout.FormData) Group(org.eclipse.swt.widgets.Group) Composite(org.eclipse.swt.widgets.Composite) LabeledText(org.netxms.ui.eclipse.widgets.LabeledText) Spinner(org.eclipse.swt.widgets.Spinner) LabeledSpinner(org.netxms.ui.eclipse.widgets.LabeledSpinner) Text(org.eclipse.swt.widgets.Text) LabeledText(org.netxms.ui.eclipse.widgets.LabeledText) Combo(org.eclipse.swt.widgets.Combo) FillLayout(org.eclipse.swt.layout.FillLayout) LabeledSpinner(org.netxms.ui.eclipse.widgets.LabeledSpinner) GridLayout(org.eclipse.swt.layout.GridLayout) ObjectSelector(org.netxms.ui.eclipse.objectbrowser.widgets.ObjectSelector) Button(org.eclipse.swt.widgets.Button) RowLayout(org.eclipse.swt.layout.RowLayout) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) FormAttachment(org.eclipse.swt.layout.FormAttachment) SelectionListener(org.eclipse.swt.events.SelectionListener)

Aggregations

Composite (org.eclipse.swt.widgets.Composite)32 ObjectSelector (org.netxms.ui.eclipse.objectbrowser.widgets.ObjectSelector)32 GridLayout (org.eclipse.swt.layout.GridLayout)31 GridData (org.eclipse.swt.layout.GridData)30 LabeledText (org.netxms.ui.eclipse.widgets.LabeledText)22 Button (org.eclipse.swt.widgets.Button)16 SelectionEvent (org.eclipse.swt.events.SelectionEvent)10 SelectionListener (org.eclipse.swt.events.SelectionListener)10 Group (org.eclipse.swt.widgets.Group)10 FormAttachment (org.eclipse.swt.layout.FormAttachment)4 FormData (org.eclipse.swt.layout.FormData)4 FormLayout (org.eclipse.swt.layout.FormLayout)4 RowLayout (org.eclipse.swt.layout.RowLayout)4 Label (org.eclipse.swt.widgets.Label)4 Spinner (org.eclipse.swt.widgets.Spinner)4 LabeledSpinner (org.netxms.ui.eclipse.widgets.LabeledSpinner)4 ModifyEvent (org.eclipse.swt.events.ModifyEvent)2 ModifyListener (org.eclipse.swt.events.ModifyListener)2 FillLayout (org.eclipse.swt.layout.FillLayout)2 Combo (org.eclipse.swt.widgets.Combo)2