Search in sources :

Example 11 with LabeledSpinner

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

the class GeneralTable 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.getObjectAsTable();
    final NXCSession session = (NXCSession) ConsoleSharedData.getSession();
    owner = session.findObjectById(dci.getNodeId());
    if (owner instanceof Cluster) {
        cluster = (Cluster) owner;
    } else if (owner instanceof AbstractNode) {
        for (AbstractObject o : owner.getParentsAsArray()) {
            if (o instanceof Cluster) {
                cluster = (Cluster) o;
                break;
            }
        }
    }
    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().GeneralTable_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().GeneralTable_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().GeneralTable_Parameter);
    parameter.getTextControl().setTextLimit(255);
    parameter.setText(dci.getName());
    selectButton = new Button(groupData, SWT.PUSH);
    selectButton.setText(Messages.get().GeneralTable_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().GeneralTable_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.select(dci.getOrigin());
    origin.addSelectionListener(new SelectionListener() {

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

        @Override
        public void widgetSelected(SelectionEvent e) {
            onOriginChange();
        }
    });
    checkUseCustomSnmpPort = new Button(groupData, SWT.CHECK);
    checkUseCustomSnmpPort.setText(Messages.get().GeneralTable_UseCustomSNMPPort);
    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(origin.getParent(), WidgetHelper.OUTER_SPACING, SWT.RIGHT);
    fd.right = new FormAttachment(100, 0);
    fd.top = new FormAttachment(parameter, WidgetHelper.OUTER_SPACING, SWT.BOTTOM);
    checkUseCustomSnmpPort.setLayoutData(fd);
    checkUseCustomSnmpPort.setEnabled(dci.getOrigin() == DataCollectionObject.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(origin.getParent(), WidgetHelper.OUTER_SPACING, SWT.RIGHT);
    fd.right = new FormAttachment(100, 0);
    fd.top = new FormAttachment(checkUseCustomSnmpPort, WidgetHelper.OUTER_SPACING, SWT.BOTTOM);
    customSnmpPort.setLayoutData(fd);
    sourceNode = new ObjectSelector(groupData, SWT.NONE, true);
    sourceNode.setLabel(Messages.get().GeneralTable_ProxyNode);
    sourceNode.setObjectClass(Node.class);
    sourceNode.setObjectId(dci.getSourceNode());
    sourceNode.setEnabled(dci.getOrigin() != DataCollectionObject.PUSH);
    sourceNode.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(ModifyEvent e) {
            editor.setSourceNode(sourceNode.getObjectId());
        }
    });
    fd = new FormData();
    fd.top = new FormAttachment(origin.getParent(), WidgetHelper.OUTER_SPACING, SWT.BOTTOM);
    fd.right = new FormAttachment(100, 0);
    agentCacheMode = WidgetHelper.createLabeledCombo(groupData, SWT.READ_ONLY, Messages.get().GeneralTable_AgentCacheMode, fd);
    agentCacheMode.add(Messages.get().GeneralTable_Default);
    agentCacheMode.add(Messages.get().GeneralTable_On);
    agentCacheMode.add(Messages.get().GeneralTable_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(origin.getParent(), 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().GeneralTable_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().GeneralTable_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() != DataCollectionObject.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);
    fd = new FormData();
    fd.left = new FormAttachment(0, 0);
    fd.right = new FormAttachment(100, 0);
    fd.top = new FormAttachment(schedulingMode.getParent(), WidgetHelper.OUTER_SPACING, SWT.BOTTOM);
    clusterResource = WidgetHelper.createLabeledCombo(groupPolling, SWT.READ_ONLY, Messages.get().GeneralTable_ClRes, fd);
    if (cluster != null) {
        clusterResourceMap = new HashMap<Integer, Long>();
        clusterResourceMap.put(0, 0L);
        clusterResource.add(Messages.get().GeneralTable_None);
        if (dci.getResourceId() == 0)
            clusterResource.select(0);
        int index = 1;
        for (ClusterResource r : cluster.getResources()) {
            clusterResource.add(r.getName());
            clusterResourceMap.put(index, r.getId());
            if (dci.getResourceId() == r.getId())
                clusterResource.select(index);
            index++;
        }
    } else {
        clusterResource.add(Messages.get().GeneralTable_None);
        clusterResource.select(0);
        clusterResource.setEnabled(false);
    }
    /**
     * status *
     */
    Group groupStatus = new Group(dialogArea, SWT.NONE);
    groupStatus.setText(Messages.get().GeneralTable_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().GeneralTable_Active);
    statusActive.setSelection(dci.getStatus() == DataCollectionObject.ACTIVE);
    statusDisabled = new Button(groupStatus, SWT.RADIO);
    statusDisabled.setText(Messages.get().GeneralTable_Disabled);
    statusDisabled.setSelection(dci.getStatus() == DataCollectionObject.DISABLED);
    statusUnsupported = new Button(groupStatus, SWT.RADIO);
    statusUnsupported.setText(Messages.get().GeneralTable_NotSupported);
    statusUnsupported.setSelection(dci.getStatus() == DataCollectionObject.NOT_SUPPORTED);
    /**
     * storage *
     */
    Group groupStorage = new Group(dialogArea, SWT.NONE);
    groupStorage.setText(Messages.get().GeneralTable_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().GeneralTable_RetentionMode, gd);
    retentionMode.add(Messages.get().GeneralTable_UseDefaultRetention);
    retentionMode.add(Messages.get().GeneralTable_UseCustomRetention);
    retentionMode.add(Messages.get().GeneralTable_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().GeneralTable_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);
    return dialogArea;
}
Also used : Group(org.eclipse.swt.widgets.Group) NXCSession(org.netxms.client.NXCSession) ModifyListener(org.eclipse.swt.events.ModifyListener) AbstractNode(org.netxms.client.objects.AbstractNode) Spinner(org.eclipse.swt.widgets.Spinner) LabeledSpinner(org.netxms.ui.eclipse.widgets.LabeledSpinner) LabeledSpinner(org.netxms.ui.eclipse.widgets.LabeledSpinner) ClusterResource(org.netxms.client.objects.ClusterResource) GridLayout(org.eclipse.swt.layout.GridLayout) ModifyEvent(org.eclipse.swt.events.ModifyEvent) Button(org.eclipse.swt.widgets.Button) RowLayout(org.eclipse.swt.layout.RowLayout) SelectionEvent(org.eclipse.swt.events.SelectionEvent) FormAttachment(org.eclipse.swt.layout.FormAttachment) FormLayout(org.eclipse.swt.layout.FormLayout) FormData(org.eclipse.swt.layout.FormData) Composite(org.eclipse.swt.widgets.Composite) LabeledText(org.netxms.ui.eclipse.widgets.LabeledText) Cluster(org.netxms.client.objects.Cluster) Text(org.eclipse.swt.widgets.Text) LabeledText(org.netxms.ui.eclipse.widgets.LabeledText) FillLayout(org.eclipse.swt.layout.FillLayout) ObjectSelector(org.netxms.ui.eclipse.objectbrowser.widgets.ObjectSelector) AbstractObject(org.netxms.client.objects.AbstractObject) GridData(org.eclipse.swt.layout.GridData) SelectionListener(org.eclipse.swt.events.SelectionListener)

Example 12 with LabeledSpinner

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

the class ObjectPolling 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 = (PollingTarget) getElement().getAdapter(PollingTarget.class);
    GridLayout layout = new GridLayout();
    layout.verticalSpacing = WidgetHelper.DIALOG_SPACING;
    layout.marginWidth = 0;
    layout.marginHeight = 0;
    dialogArea.setLayout(layout);
    GridData gd = new GridData();
    /* poller node */
    if (object.containPollerNode()) {
        Group servicePollGroup = new Group(dialogArea, SWT.NONE);
        servicePollGroup.setText(Messages.get().NodePolling_GroupNetSrv);
        layout = new GridLayout();
        layout.horizontalSpacing = WidgetHelper.DIALOG_SPACING;
        layout.numColumns = 2;
        servicePollGroup.setLayout(layout);
        gd = new GridData();
        gd.horizontalAlignment = SWT.FILL;
        gd.grabExcessHorizontalSpace = true;
        servicePollGroup.setLayoutData(gd);
        pollerNode = new ObjectSelector(servicePollGroup, SWT.NONE, true);
        pollerNode.setLabel(Messages.get().NodePolling_PollerNode);
        pollerNode.setObjectClass(AbstractNode.class);
        pollerNode.setEmptySelectionName(Messages.get().NodePolling_EmptySelectionServer);
        pollerNode.setObjectId(object.getPollerNodeId());
        gd = new GridData();
        gd.horizontalAlignment = SWT.FILL;
        gd.grabExcessHorizontalSpace = true;
        pollerNode.setLayoutData(gd);
        Label label = new Label(servicePollGroup, SWT.WRAP);
        label.setText(Messages.get().NodePolling_PollerNodeDescription);
        gd = new GridData();
        gd.widthHint = 250;
        label.setLayoutData(gd);
    }
    /* poll count */
    if (object instanceof AbstractNode) {
        pollCount = new LabeledSpinner(dialogArea, SWT.NONE);
        pollCount.setLabel("Required poll count for status change");
        pollCount.setSelection(((AbstractNode) object).getRequredPollCount());
    }
    /* options */
    Group optionsGroup = new Group(dialogArea, SWT.NONE);
    optionsGroup.setText(Messages.get().NodePolling_GroupOptions);
    layout = new GridLayout();
    layout.verticalSpacing = WidgetHelper.DIALOG_SPACING;
    optionsGroup.setLayout(layout);
    gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    optionsGroup.setLayoutData(gd);
    if (object.containAgent())
        addFlag(optionsGroup, AbstractNode.NF_DISABLE_NXCP, Messages.get().NodePolling_OptDisableAgent);
    if (object.containInterfaces()) {
        addFlag(optionsGroup, AbstractNode.NF_DISABLE_SNMP, Messages.get().NodePolling_OptDisableSNMP);
        addFlag(optionsGroup, AbstractNode.NF_DISABLE_ICMP, Messages.get().NodePolling_OptDisableICMP);
    }
    addFlag(optionsGroup, AbstractNode.DCF_DISABLE_STATUS_POLL, Messages.get().NodePolling_OptDisableStatusPoll);
    addFlag(optionsGroup, AbstractNode.DCF_DISABLE_CONF_POLL, Messages.get().NodePolling_OptDisableConfigPoll);
    if (object.containInterfaces()) {
        addFlag(optionsGroup, AbstractNode.NF_DISABLE_ROUTE_POLL, Messages.get().NodePolling_OptDisableRTPoll);
        addFlag(optionsGroup, AbstractNode.NF_DISABLE_TOPOLOGY_POLL, Messages.get().NodePolling_OptDisableTopoPoll);
        addFlag(optionsGroup, AbstractNode.NF_DISABLE_DISCOVERY_POLL, Messages.get().NodePolling_OptDisableDiscoveryPoll);
    }
    addFlag(optionsGroup, AbstractNode.DCF_DISABLE_DATA_COLLECT, Messages.get().NodePolling_OptDisableDataCollection);
    /* use ifXTable */
    if (object.containInterfaces()) {
        Group ifXTableGroup = new Group(dialogArea, SWT.NONE);
        ifXTableGroup.setText(Messages.get().NodePolling_GroupIfXTable);
        layout = new GridLayout();
        layout.horizontalSpacing = WidgetHelper.DIALOG_SPACING;
        layout.numColumns = 3;
        layout.makeColumnsEqualWidth = true;
        ifXTableGroup.setLayout(layout);
        gd = new GridData();
        gd.horizontalAlignment = SWT.FILL;
        gd.grabExcessHorizontalSpace = true;
        ifXTableGroup.setLayoutData(gd);
        radioIfXTableDefault = new Button(ifXTableGroup, SWT.RADIO);
        radioIfXTableDefault.setText(Messages.get().NodePolling_Default);
        radioIfXTableDefault.setSelection(object.getIfXTablePolicy() == AbstractNode.IFXTABLE_DEFAULT);
        radioIfXTableEnable = new Button(ifXTableGroup, SWT.RADIO);
        radioIfXTableEnable.setText(Messages.get().NodePolling_Enable);
        radioIfXTableEnable.setSelection(object.getIfXTablePolicy() == AbstractNode.IFXTABLE_ENABLED);
        radioIfXTableDisable = new Button(ifXTableGroup, SWT.RADIO);
        radioIfXTableDisable.setText(Messages.get().NodePolling_Disable);
        radioIfXTableDisable.setSelection(object.getIfXTablePolicy() == AbstractNode.IFXTABLE_DISABLED);
    }
    /* agent cache */
    if (object.containAgent()) {
        Group agentCacheGroup = new Group(dialogArea, SWT.NONE);
        agentCacheGroup.setText(Messages.get().NodePolling_AgentCacheMode);
        layout = new GridLayout();
        layout.horizontalSpacing = WidgetHelper.DIALOG_SPACING;
        layout.numColumns = 3;
        layout.makeColumnsEqualWidth = true;
        agentCacheGroup.setLayout(layout);
        gd = new GridData();
        gd.horizontalAlignment = SWT.FILL;
        gd.grabExcessHorizontalSpace = true;
        agentCacheGroup.setLayoutData(gd);
        radioAgentCacheDefault = new Button(agentCacheGroup, SWT.RADIO);
        radioAgentCacheDefault.setText(Messages.get().NodePolling_Default);
        radioAgentCacheDefault.setSelection(object.getAgentCacheMode() == AgentCacheMode.DEFAULT);
        radioAgentCacheOn = new Button(agentCacheGroup, SWT.RADIO);
        radioAgentCacheOn.setText(Messages.get().NodePolling_On);
        radioAgentCacheOn.setSelection(object.getAgentCacheMode() == AgentCacheMode.ON);
        radioAgentCacheOff = new Button(agentCacheGroup, SWT.RADIO);
        radioAgentCacheOff.setText(Messages.get().NodePolling_Off);
        radioAgentCacheOff.setSelection(object.getAgentCacheMode() == AgentCacheMode.OFF);
    }
    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) AbstractNode(org.netxms.client.objects.AbstractNode) Button(org.eclipse.swt.widgets.Button) GridData(org.eclipse.swt.layout.GridData) Label(org.eclipse.swt.widgets.Label) LabeledSpinner(org.netxms.ui.eclipse.widgets.LabeledSpinner)

Example 13 with LabeledSpinner

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

the class RackProperties 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);
    rack = (Rack) getElement().getAdapter(Rack.class);
    GridLayout layout = new GridLayout();
    layout.verticalSpacing = WidgetHelper.OUTER_SPACING;
    layout.marginWidth = 0;
    layout.marginHeight = 0;
    layout.numColumns = 2;
    dialogArea.setLayout(layout);
    rackHeight = new LabeledSpinner(dialogArea, SWT.NONE);
    rackHeight.setLabel(Messages.get().RackProperties_Height);
    rackHeight.setRange(1, 50);
    rackHeight.setSelection(rack.getHeight());
    GridData gd = new GridData();
    gd.grabExcessHorizontalSpace = true;
    gd.horizontalAlignment = SWT.FILL;
    rackHeight.setLayoutData(gd);
    gd = new GridData();
    gd.grabExcessHorizontalSpace = true;
    gd.horizontalAlignment = SWT.FILL;
    numberingScheme = WidgetHelper.createLabeledCombo(dialogArea, SWT.READ_ONLY | SWT.DROP_DOWN, Messages.get().RackProperties_Numbering, gd);
    numberingScheme.add(Messages.get().RackProperties_BottomTop);
    numberingScheme.add(Messages.get().RackProperties_TopBottom);
    numberingScheme.select(rack.isTopBottomNumbering() ? 1 : 0);
    return dialogArea;
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) GridData(org.eclipse.swt.layout.GridData) LabeledSpinner(org.netxms.ui.eclipse.widgets.LabeledSpinner)

Example 14 with LabeledSpinner

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

the class AddSubnetDialog 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.marginHeight = WidgetHelper.DIALOG_HEIGHT_MARGIN;
    layout.marginWidth = WidgetHelper.DIALOG_WIDTH_MARGIN;
    layout.verticalSpacing = WidgetHelper.DIALOG_SPACING;
    layout.numColumns = 2;
    dialogArea.setLayout(layout);
    address = new LabeledText(dialogArea, SWT.NONE);
    address.setLabel(Messages.get().AddAddressListElementDialog_NetworkAddress);
    // $NON-NLS-1$
    address.setText("0.0.0.0");
    GridData gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    gd.widthHint = 300;
    address.setLayoutData(gd);
    mask = new LabeledSpinner(dialogArea, SWT.NONE);
    mask.setLabel(Messages.get().AddAddressListElementDialog_NetworkMask);
    mask.getSpinnerControl().setMinimum(0);
    mask.getSpinnerControl().setMaximum(128);
    gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    mask.setLayoutData(gd);
    return dialogArea;
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) LabeledText(org.netxms.ui.eclipse.widgets.LabeledText) GridData(org.eclipse.swt.layout.GridData) LabeledSpinner(org.netxms.ui.eclipse.widgets.LabeledSpinner)

Aggregations

GridData (org.eclipse.swt.layout.GridData)14 GridLayout (org.eclipse.swt.layout.GridLayout)14 Composite (org.eclipse.swt.widgets.Composite)14 LabeledSpinner (org.netxms.ui.eclipse.widgets.LabeledSpinner)14 LabeledText (org.netxms.ui.eclipse.widgets.LabeledText)8 Button (org.eclipse.swt.widgets.Button)7 SelectionEvent (org.eclipse.swt.events.SelectionEvent)6 SelectionListener (org.eclipse.swt.events.SelectionListener)6 Group (org.eclipse.swt.widgets.Group)6 Label (org.eclipse.swt.widgets.Label)5 ObjectSelector (org.netxms.ui.eclipse.objectbrowser.widgets.ObjectSelector)4 RowLayout (org.eclipse.swt.layout.RowLayout)3 Spinner (org.eclipse.swt.widgets.Spinner)3 FillLayout (org.eclipse.swt.layout.FillLayout)2 FormAttachment (org.eclipse.swt.layout.FormAttachment)2 FormData (org.eclipse.swt.layout.FormData)2 FormLayout (org.eclipse.swt.layout.FormLayout)2 Text (org.eclipse.swt.widgets.Text)2 AbstractNode (org.netxms.client.objects.AbstractNode)2 ArrayContentProvider (org.eclipse.jface.viewers.ArrayContentProvider)1