Search in sources :

Example 6 with ObjectSelector

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

the class NetworkMap method createContents.

/* (non-Javadoc)
	 * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
	 */
@Override
protected Control createContents(Composite parent) {
    config = (NetworkMapConfig) getElement().getAdapter(NetworkMapConfig.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().NetworkMap_NetworkMap);
    objectSelector.setObjectClass(org.netxms.client.objects.NetworkMap.class);
    objectSelector.setObjectId(config.getObjectId());
    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().NetworkMap_Title);
    title.setText(config.getTitle());
    gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    gd.horizontalSpan = 2;
    title.setLayoutData(gd);
    Label label = new Label(dialogArea, SWT.NONE);
    label.setText(Messages.get().NetworkMap_ZoomLevel);
    gd = new GridData();
    gd.horizontalSpan = 2;
    label.setLayoutData(gd);
    zoomLevelScale = new Scale(dialogArea, SWT.HORIZONTAL);
    zoomLevelScale.setMinimum(10);
    zoomLevelScale.setMaximum(400);
    zoomLevelScale.setSelection(config.getZoomLevel());
    gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    zoomLevelScale.setLayoutData(gd);
    zoomLevelScale.addSelectionListener(new SelectionListener() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            zoomLevelSpinner.setSelection(zoomLevelScale.getSelection());
        }

        @Override
        public void widgetDefaultSelected(SelectionEvent e) {
            widgetSelected(e);
        }
    });
    zoomLevelSpinner = new Spinner(dialogArea, SWT.BORDER);
    zoomLevelSpinner.setMinimum(10);
    zoomLevelSpinner.setMaximum(400);
    zoomLevelSpinner.setSelection(config.getZoomLevel());
    zoomLevelSpinner.addSelectionListener(new SelectionListener() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            zoomLevelScale.setSelection(zoomLevelSpinner.getSelection());
        }

        @Override
        public void widgetDefaultSelected(SelectionEvent e) {
            widgetSelected(e);
        }
    });
    enableObjectDoubleClick = new Button(dialogArea, SWT.CHECK);
    enableObjectDoubleClick.setText(Messages.get().NetworkMap_EnableDoubleClickAction);
    enableObjectDoubleClick.setSelection(config.isObjectDoubleClickEnabled());
    return dialogArea;
}
Also used : Composite(org.eclipse.swt.widgets.Composite) LabeledText(org.netxms.ui.eclipse.widgets.LabeledText) Spinner(org.eclipse.swt.widgets.Spinner) Label(org.eclipse.swt.widgets.Label) Scale(org.eclipse.swt.widgets.Scale) GridLayout(org.eclipse.swt.layout.GridLayout) ObjectSelector(org.netxms.ui.eclipse.objectbrowser.widgets.ObjectSelector) Button(org.eclipse.swt.widgets.Button) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) SelectionListener(org.eclipse.swt.events.SelectionListener)

Example 7 with ObjectSelector

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

the class SyslogMonitor method createContents.

@Override
protected Control createContents(Composite parent) {
    config = (SyslogMonitorConfig) getElement().getAdapter(SyslogMonitorConfig.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 8 with ObjectSelector

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

the class CreateNodeDialog 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.DIALOG_SPACING;
    layout.horizontalSpacing = WidgetHelper.DIALOG_SPACING;
    layout.marginHeight = WidgetHelper.DIALOG_HEIGHT_MARGIN;
    layout.marginWidth = WidgetHelper.DIALOG_WIDTH_MARGIN;
    layout.numColumns = 2;
    layout.makeColumnsEqualWidth = true;
    dialogArea.setLayout(layout);
    objectNameField = new LabeledText(dialogArea, SWT.NONE);
    objectNameField.setLabel(Messages.get().CreateNodeDialog_Name);
    objectNameField.getTextControl().setTextLimit(255);
    GridData gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    gd.widthHint = 600;
    gd.horizontalSpan = 2;
    objectNameField.setLayoutData(gd);
    objectNameField.setText(objectName);
    final Composite ipAddrGroup = new Composite(dialogArea, SWT.NONE);
    layout = new GridLayout();
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    layout.numColumns = 2;
    ipAddrGroup.setLayout(layout);
    gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    gd.horizontalSpan = 2;
    ipAddrGroup.setLayoutData(gd);
    hostNameField = new LabeledText(ipAddrGroup, SWT.NONE);
    hostNameField.setLabel(Messages.get().CreateNodeDialog_PrimaryHostName);
    hostNameField.getTextControl().setTextLimit(255);
    gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    hostNameField.setLayoutData(gd);
    hostNameField.setText(hostName);
    agentPortField = WidgetHelper.createLabeledSpinner(dialogArea, SWT.BORDER, Messages.get().CreateNodeDialog_AgentPort, 1, 65535, WidgetHelper.DEFAULT_LAYOUT_DATA);
    agentPortField.setSelection(agentPort);
    snmpPortField = WidgetHelper.createLabeledSpinner(dialogArea, SWT.BORDER, Messages.get().CreateNodeDialog_SNMPPort, 1, 65535, WidgetHelper.DEFAULT_LAYOUT_DATA);
    snmpPortField.setSelection(snmpPort);
    sshLoginField = new LabeledText(dialogArea, SWT.NONE);
    sshLoginField.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
    sshLoginField.setLabel("SSH Login");
    sshLoginField.setText(sshLogin);
    sshPasswordField = new LabeledText(dialogArea, SWT.NONE);
    sshPasswordField.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
    sshPasswordField.setLabel("SSH Password");
    sshPasswordField.setText(sshPassword);
    Group optionsGroup = new Group(dialogArea, SWT.NONE);
    optionsGroup.setText(Messages.get().CreateNodeDialog_Options);
    gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    gd.horizontalSpan = 2;
    optionsGroup.setLayoutData(gd);
    optionsGroup.setLayout(new RowLayout(SWT.VERTICAL));
    checkUnmanaged = new Button(optionsGroup, SWT.CHECK);
    checkUnmanaged.setText(Messages.get().CreateNodeDialog_CreateUnmanaged);
    checkUnmanaged.setSelection((creationFlags & NXCObjectCreationData.CF_CREATE_UNMANAGED) != 0);
    checkDisableAgent = new Button(optionsGroup, SWT.CHECK);
    checkDisableAgent.setText(Messages.get().CreateNodeDialog_DisableAgent);
    checkDisableAgent.setSelection((creationFlags & NXCObjectCreationData.CF_DISABLE_NXCP) != 0);
    checkDisableSNMP = new Button(optionsGroup, SWT.CHECK);
    checkDisableSNMP.setText(Messages.get().CreateNodeDialog_DisableSNMP);
    checkDisableSNMP.setSelection((creationFlags & NXCObjectCreationData.CF_DISABLE_SNMP) != 0);
    checkDisablePing = new Button(optionsGroup, SWT.CHECK);
    checkDisablePing.setText(Messages.get().CreateNodeDialog_DisableICMP);
    checkDisablePing.setSelection((creationFlags & NXCObjectCreationData.CF_DISABLE_ICMP) != 0);
    agentProxySelector = new ObjectSelector(dialogArea, SWT.NONE, true);
    agentProxySelector.setLabel(Messages.get().CreateNodeDialog_AgentProxy);
    agentProxySelector.setObjectClass(Node.class);
    agentProxySelector.setObjectId(agentProxy);
    gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    agentProxySelector.setLayoutData(gd);
    snmpProxySelector = new ObjectSelector(dialogArea, SWT.NONE, true);
    snmpProxySelector.setLabel(Messages.get().CreateNodeDialog_SNMPProxy);
    snmpProxySelector.setObjectClass(Node.class);
    snmpProxySelector.setObjectId(snmpProxy);
    gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    snmpProxySelector.setLayoutData(gd);
    icmpProxySelector = new ObjectSelector(dialogArea, SWT.NONE, true);
    icmpProxySelector.setLabel("Proxy for ICMP");
    icmpProxySelector.setObjectClass(Node.class);
    icmpProxySelector.setObjectId(icmpProxy);
    gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    icmpProxySelector.setLayoutData(gd);
    sshProxySelector = new ObjectSelector(dialogArea, SWT.NONE, true);
    sshProxySelector.setLabel("Proxy for SSH");
    sshProxySelector.setEmptySelectionName("<default>");
    sshProxySelector.setObjectClass(Node.class);
    sshProxySelector.setObjectId(sshProxy);
    gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    sshProxySelector.setLayoutData(gd);
    if (session.isZoningEnabled()) {
        zoneSelector = new ZoneSelector(dialogArea, SWT.NONE, false);
        zoneSelector.setLabel(Messages.get().CreateNodeDialog_Zone);
        Zone zone = ConsoleSharedData.getSession().findZone(zoneUIN);
        zoneSelector.setZoneUIN((zone != null) ? zone.getUIN() : -1);
        gd = new GridData();
        gd.horizontalAlignment = SWT.FILL;
        gd.grabExcessHorizontalSpace = true;
        gd.horizontalSpan = 2;
        zoneSelector.setLayoutData(gd);
    }
    if (enableShowAgainFlag) {
        checkCreateAnother = new Button(dialogArea, SWT.CHECK);
        checkCreateAnother.setText(Messages.get().CreateNodeDialog_ShowAgain);
        checkCreateAnother.setSelection(showAgain);
    }
    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) Zone(org.netxms.client.objects.Zone) RowLayout(org.eclipse.swt.layout.RowLayout) ZoneSelector(org.netxms.ui.eclipse.objectbrowser.widgets.ZoneSelector) GridData(org.eclipse.swt.layout.GridData)

Example 9 with ObjectSelector

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

the class RackPlacement 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 = (RackElement) getElement().getAdapter(RackElement.class);
    GridLayout layout = new GridLayout();
    layout.verticalSpacing = WidgetHelper.OUTER_SPACING;
    layout.marginWidth = 0;
    layout.marginHeight = 0;
    layout.numColumns = 3;
    dialogArea.setLayout(layout);
    rackSelector = new ObjectSelector(dialogArea, SWT.NONE, true);
    rackSelector.setLabel(Messages.get().RackPlacement_Rack);
    rackSelector.setObjectClass(Rack.class);
    rackSelector.setObjectId(object.getRackId());
    GridData gd = new GridData();
    gd.grabExcessHorizontalSpace = true;
    gd.horizontalAlignment = SWT.FILL;
    gd.horizontalSpan = 3;
    rackSelector.setLayoutData(gd);
    rackImageFrontSelector = new ImageSelector(dialogArea, SWT.NONE);
    rackImageFrontSelector.setLabel("Rack front image");
    rackImageFrontSelector.setImageGuid(object.getFrontRackImage(), false);
    rackImageFrontSelector.setEnabled(object.getRackOrientation() == RackOrientation.FRONT || object.getRackOrientation() == RackOrientation.FILL);
    gd = new GridData();
    gd.grabExcessHorizontalSpace = true;
    gd.horizontalAlignment = SWT.FILL;
    gd.horizontalSpan = 3;
    rackImageFrontSelector.setLayoutData(gd);
    rackImageRearSelector = new ImageSelector(dialogArea, SWT.NONE);
    rackImageRearSelector.setLabel("Rack rear image");
    rackImageRearSelector.setImageGuid(object.getRearRackImage(), false);
    rackImageRearSelector.setEnabled(object.getRackOrientation() == RackOrientation.REAR || object.getRackOrientation() == RackOrientation.FILL);
    gd = new GridData();
    gd.grabExcessHorizontalSpace = true;
    gd.horizontalAlignment = SWT.FILL;
    gd.horizontalSpan = 3;
    rackImageRearSelector.setLayoutData(gd);
    rackPosition = new LabeledSpinner(dialogArea, SWT.NONE);
    rackPosition.setLabel(Messages.get().RackPlacement_Position);
    rackPosition.setRange(1, 50);
    rackPosition.setSelection(object.getRackPosition());
    gd = new GridData();
    gd.grabExcessHorizontalSpace = true;
    gd.horizontalAlignment = SWT.FILL;
    rackPosition.setLayoutData(gd);
    rackHeight = new LabeledSpinner(dialogArea, SWT.NONE);
    rackHeight.setLabel(Messages.get().RackPlacement_Height);
    rackHeight.setRange(1, 50);
    rackHeight.setSelection(object.getRackHeight());
    gd = new GridData();
    gd.grabExcessHorizontalSpace = true;
    gd.horizontalAlignment = SWT.FILL;
    rackHeight.setLayoutData(gd);
    gd = new GridData();
    gd.grabExcessHorizontalSpace = true;
    gd.horizontalAlignment = SWT.FILL;
    rackOrientation = WidgetHelper.createLabeledCombo(dialogArea, SWT.READ_ONLY, "Orientation", gd);
    rackOrientation.setItems(ORIENTATION);
    rackOrientation.setText(ORIENTATION[object.getRackOrientation().getValue()]);
    rackOrientation.addSelectionListener(new SelectionListener() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            if (RackOrientation.getByValue(rackOrientation.getSelectionIndex()) == RackOrientation.FRONT) {
                rackImageRearSelector.setEnabled(false);
                rackImageFrontSelector.setEnabled(true);
            } else if (RackOrientation.getByValue(rackOrientation.getSelectionIndex()) == RackOrientation.REAR) {
                rackImageRearSelector.setEnabled(true);
                rackImageFrontSelector.setEnabled(false);
            } else {
                rackImageRearSelector.setEnabled(true);
                rackImageFrontSelector.setEnabled(true);
            }
        }

        @Override
        public void widgetDefaultSelected(SelectionEvent e) {
            widgetSelected(e);
        }
    });
    return dialogArea;
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) ObjectSelector(org.netxms.ui.eclipse.objectbrowser.widgets.ObjectSelector) Composite(org.eclipse.swt.widgets.Composite) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) ImageSelector(org.netxms.ui.eclipse.imagelibrary.widgets.ImageSelector) LabeledSpinner(org.netxms.ui.eclipse.widgets.LabeledSpinner) SelectionListener(org.eclipse.swt.events.SelectionListener)

Example 10 with ObjectSelector

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

the class SSH method createContents.

/* (non-Javadoc)
    * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
    */
@Override
protected Control createContents(Composite parent) {
    node = (AbstractNode) getElement().getAdapter(AbstractNode.class);
    Composite dialogArea = new Composite(parent, SWT.NONE);
    GridLayout dialogLayout = new GridLayout();
    dialogLayout.marginWidth = 0;
    dialogLayout.marginHeight = 0;
    dialogLayout.numColumns = 2;
    dialogLayout.makeColumnsEqualWidth = true;
    dialogArea.setLayout(dialogLayout);
    sshLogin = new LabeledText(dialogArea, SWT.NONE);
    sshLogin.setLabel("Login");
    sshLogin.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
    sshLogin.setText(node.getSshLogin());
    sshPassword = new LabeledText(dialogArea, SWT.NONE);
    sshPassword.setLabel("Password");
    sshPassword.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
    sshPassword.setText(node.getSshPassword());
    sshProxy = new ObjectSelector(dialogArea, SWT.NONE, true);
    sshProxy.setLabel(Messages.get().Communication_Proxy);
    sshProxy.setEmptySelectionName("<default>");
    sshProxy.setObjectId(node.getSshProxyId());
    sshProxy.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1));
    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)

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