Search in sources :

Example 11 with ObjectSelector

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

the class MapAppearance 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 = (AbstractObject) getElement().getAdapter(AbstractObject.class);
    if (// Paranoid check
    object == null)
        return dialogArea;
    GridLayout layout = new GridLayout();
    layout.verticalSpacing = WidgetHelper.OUTER_SPACING;
    layout.marginWidth = 0;
    layout.marginHeight = 0;
    dialogArea.setLayout(layout);
    // Image
    image = new ImageSelector(dialogArea, SWT.NONE);
    image.setLabel(Messages.get().MapAppearance_Image);
    GridData gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    image.setLayoutData(gd);
    image.setImageGuid(object.getImage(), false);
    // Submap
    if (!(object instanceof NetworkMap)) {
        drillDownObject = new ObjectSelector(dialogArea, SWT.NONE, true);
        drillDownObject.setLabel("Drill-down object");
        drillDownObject.setObjectClass(AbstractObject.class);
        drillDownObject.setObjectId(object.getDrillDownObjectId());
        drillDownObject.setClassFilter(ObjectSelectionDialog.createDashboardAndNetworkMapSelectionFilter());
        gd = new GridData();
        gd.horizontalAlignment = SWT.FILL;
        gd.grabExcessHorizontalSpace = true;
        drillDownObject.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) GridData(org.eclipse.swt.layout.GridData) ImageSelector(org.netxms.ui.eclipse.imagelibrary.widgets.ImageSelector) NetworkMap(org.netxms.client.objects.NetworkMap)

Example 12 with ObjectSelector

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

the class NetworkServicePolling 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 = (NetworkService) getElement().getAdapter(NetworkService.class);
    GridLayout layout = new GridLayout();
    layout.verticalSpacing = WidgetHelper.DIALOG_SPACING;
    layout.marginWidth = 0;
    layout.marginHeight = 0;
    layout.numColumns = 2;
    dialogArea.setLayout(layout);
    GridData gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    serviceType = WidgetHelper.createLabeledCombo(dialogArea, SWT.READ_ONLY, Messages.get().NetworkServicePolling_ServiceType, gd);
    serviceType.add(Messages.get().NetworkServicePolling_TypeUserDef);
    serviceType.add(Messages.get().NetworkServicePolling_TypeSSH);
    serviceType.add(Messages.get().NetworkServicePolling_TypePOP3);
    serviceType.add(Messages.get().NetworkServicePolling_TypeSMTP);
    serviceType.add(Messages.get().NetworkServicePolling_TypeFTP);
    serviceType.add(Messages.get().NetworkServicePolling_TypeHTTP);
    serviceType.add(Messages.get().NetworkServicePolling_TypeHTTPS);
    serviceType.add(Messages.get().NetworkServicePolling_TypeTelnet);
    serviceType.select(object.getServiceType());
    port = new LabeledText(dialogArea, SWT.NONE);
    port.setLabel(Messages.get().NetworkServicePolling_Port);
    port.setText(Integer.toString(object.getPort()));
    gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    port.setLayoutData(gd);
    ipAddress = new LabeledText(dialogArea, SWT.NONE);
    ipAddress.setLabel("IP Address");
    if (object.getIpAddress().isValidAddress())
        ipAddress.setText(object.getIpAddress().getHostAddress());
    gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    gd.horizontalSpan = 2;
    ipAddress.setLayoutData(gd);
    request = new LabeledText(dialogArea, SWT.NONE);
    request.setLabel(Messages.get().NetworkServicePolling_Request);
    request.setText(object.getRequest());
    gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    gd.horizontalSpan = 2;
    request.setLayoutData(gd);
    response = new LabeledText(dialogArea, SWT.NONE);
    response.setLabel(Messages.get().NetworkServicePolling_Response);
    response.setText(object.getResponse());
    gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    gd.horizontalSpan = 2;
    response.setLayoutData(gd);
    pollerNode = new ObjectSelector(dialogArea, SWT.NONE, true);
    pollerNode.setLabel(Messages.get().NetworkServicePolling_PollerNode);
    pollerNode.setEmptySelectionName(Messages.get().NetworkServicePolling_SelectionDefault);
    pollerNode.setObjectClass(AbstractNode.class);
    pollerNode.setObjectId(object.getPollerNode());
    gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    pollerNode.setLayoutData(gd);
    gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = false;
    pollCount = WidgetHelper.createLabeledSpinner(dialogArea, SWT.BORDER, Messages.get().NetworkServicePolling_RequiredPolls, 0, 1000, gd);
    pollCount.setSelection(object.getPollCount());
    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 13 with ObjectSelector

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

the class SNMP 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);
    FormLayout dialogLayout = new FormLayout();
    dialogLayout.marginWidth = 0;
    dialogLayout.marginHeight = 0;
    dialogLayout.spacing = WidgetHelper.DIALOG_SPACING;
    dialogArea.setLayout(dialogLayout);
    FormData fd = new FormData();
    fd.left = new FormAttachment(0, 0);
    fd.top = new FormAttachment(0, 0);
    snmpVersion = WidgetHelper.createLabeledCombo(dialogArea, SWT.BORDER | SWT.READ_ONLY, Messages.get().Communication_Version, fd);
    // $NON-NLS-1$
    snmpVersion.add("1");
    // $NON-NLS-1$
    snmpVersion.add("2c");
    // $NON-NLS-1$
    snmpVersion.add("3");
    snmpVersion.select(snmpVersionToIndex(node.getSnmpVersion()));
    snmpVersion.addSelectionListener(new SelectionListener() {

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

        @Override
        public void widgetSelected(SelectionEvent e) {
            onSnmpVersionChange();
        }
    });
    snmpPort = new LabeledText(dialogArea, SWT.NONE);
    snmpPort.setLabel(Messages.get().Communication_UDPPort);
    snmpPort.setText(Integer.toString(node.getSnmpPort()));
    fd = new FormData();
    fd.left = new FormAttachment(0, 0);
    fd.top = new FormAttachment(snmpVersion.getParent(), 0, SWT.BOTTOM);
    snmpAuth = WidgetHelper.createLabeledCombo(dialogArea, SWT.BORDER | SWT.READ_ONLY, Messages.get().Communication_Authentication, fd);
    snmpAuth.add(Messages.get().Communication_AuthNone);
    snmpAuth.add(Messages.get().Communication_AuthMD5);
    snmpAuth.add(Messages.get().Communication_AuthSHA1);
    snmpAuth.select(node.getSnmpAuthMethod());
    snmpAuth.setEnabled(node.getSnmpVersion() == AbstractNode.SNMP_VERSION_3);
    fd = new FormData();
    fd.left = new FormAttachment(snmpAuth.getParent(), 0, SWT.RIGHT);
    fd.top = new FormAttachment(snmpVersion.getParent(), 0, SWT.BOTTOM);
    snmpPriv = WidgetHelper.createLabeledCombo(dialogArea, SWT.BORDER | SWT.READ_ONLY, Messages.get().Communication_Encryption, fd);
    snmpPriv.add(Messages.get().Communication_EncNone);
    snmpPriv.add(Messages.get().Communication_EncDES);
    snmpPriv.add(Messages.get().Communication_EncAES);
    snmpPriv.select(node.getSnmpPrivMethod());
    snmpPriv.setEnabled(node.getSnmpVersion() == AbstractNode.SNMP_VERSION_3);
    snmpProxy = new ObjectSelector(dialogArea, SWT.NONE, true);
    snmpProxy.setLabel(Messages.get().Communication_Proxy);
    snmpProxy.setObjectId(node.getSnmpProxyId());
    fd = new FormData();
    fd.left = new FormAttachment(0, 0);
    fd.top = new FormAttachment(snmpAuth.getParent(), 0, SWT.BOTTOM);
    fd.right = new FormAttachment(snmpPriv.getParent(), 0, SWT.RIGHT);
    snmpProxy.setLayoutData(fd);
    snmpAuthName = new LabeledText(dialogArea, SWT.NONE);
    snmpAuthName.setLabel(node.getSnmpVersion() == AbstractNode.SNMP_VERSION_3 ? Messages.get().Communication_UserName : Messages.get().Communication_Community);
    snmpAuthName.setText(node.getSnmpAuthName());
    fd = new FormData();
    fd.left = new FormAttachment(snmpProxy, 0, SWT.RIGHT);
    fd.top = new FormAttachment(0, 0);
    fd.right = new FormAttachment(100, 0);
    snmpAuthName.setLayoutData(fd);
    snmpAuthPassword = new LabeledText(dialogArea, SWT.NONE);
    snmpAuthPassword.setLabel(Messages.get().Communication_AuthPassword);
    snmpAuthPassword.setText(node.getSnmpAuthPassword());
    fd = new FormData();
    fd.left = new FormAttachment(snmpAuthName, 0, SWT.LEFT);
    fd.top = new FormAttachment(snmpAuth.getParent(), 0, SWT.TOP);
    fd.right = new FormAttachment(100, 0);
    snmpAuthPassword.setLayoutData(fd);
    snmpAuthPassword.getTextControl().setEnabled(node.getSnmpVersion() == AbstractNode.SNMP_VERSION_3);
    snmpPrivPassword = new LabeledText(dialogArea, SWT.NONE);
    snmpPrivPassword.setLabel(Messages.get().Communication_EncPassword);
    snmpPrivPassword.setText(node.getSnmpPrivPassword());
    fd = new FormData();
    fd.left = new FormAttachment(snmpAuthName, 0, SWT.LEFT);
    fd.top = new FormAttachment(snmpProxy, 0, SWT.TOP);
    fd.right = new FormAttachment(100, 0);
    snmpPrivPassword.setLayoutData(fd);
    snmpPrivPassword.getTextControl().setEnabled(node.getSnmpVersion() == AbstractNode.SNMP_VERSION_3);
    fd = new FormData();
    fd.left = new FormAttachment(snmpVersion.getParent(), 0, SWT.RIGHT);
    fd.right = new FormAttachment(snmpAuthName, 0, SWT.LEFT);
    fd.top = new FormAttachment(0, 0);
    snmpPort.setLayoutData(fd);
    return dialogArea;
}
Also used : FormLayout(org.eclipse.swt.layout.FormLayout) FormData(org.eclipse.swt.layout.FormData) ObjectSelector(org.netxms.ui.eclipse.objectbrowser.widgets.ObjectSelector) Composite(org.eclipse.swt.widgets.Composite) LabeledText(org.netxms.ui.eclipse.widgets.LabeledText) SelectionEvent(org.eclipse.swt.events.SelectionEvent) FormAttachment(org.eclipse.swt.layout.FormAttachment) SelectionListener(org.eclipse.swt.events.SelectionListener)

Example 14 with ObjectSelector

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

the class ZoneCommunications method createContents.

/* (non-Javadoc)
	 * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
	 */
@Override
protected Control createContents(Composite parent) {
    zone = (Zone) getElement().getAdapter(Zone.class);
    Composite dialogArea = new Composite(parent, SWT.NONE);
    GridLayout dialogLayout = new GridLayout();
    dialogLayout.marginWidth = 0;
    dialogLayout.marginHeight = 0;
    dialogArea.setLayout(dialogLayout);
    agentProxy = new ObjectSelector(dialogArea, SWT.NONE, true);
    agentProxy.setLabel(Messages.get().ZoneCommunications_DefaultProxy);
    agentProxy.setClassFilter(ObjectSelectionFilterFactory.getInstance().createNodeSelectionFilter(false));
    agentProxy.setObjectId(zone.getProxyNodeId());
    GridData gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    agentProxy.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) GridData(org.eclipse.swt.layout.GridData)

Example 15 with ObjectSelector

use of org.netxms.ui.eclipse.objectbrowser.widgets.ObjectSelector 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

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