Search in sources :

Example 36 with LabeledText

use of org.netxms.ui.eclipse.widgets.LabeledText 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 37 with LabeledText

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

the class AttributeEditDialog 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;
    dialogArea.setLayout(layout);
    textName = new LabeledText(dialogArea, SWT.NONE);
    textName.setLabel(Messages.get().AttributeEditDialog_Name);
    textName.getTextControl().setTextLimit(63);
    if (name != null) {
        textName.setText(name);
        textName.setEditable(false);
    }
    GridData gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    textName.setLayoutData(gd);
    textValue = new LabeledText(dialogArea, SWT.NONE);
    textValue.setLabel(Messages.get().AttributeEditDialog_Value);
    textValue.getTextControl().setTextLimit(255);
    if (value != null)
        textValue.setText(value);
    gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    gd.widthHint = 300;
    textValue.setLayoutData(gd);
    if (name != null)
        textValue.setFocus();
    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)

Example 38 with LabeledText

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

the class ConditionDciEditDialog 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.numColumns = 2;
    dialogArea.setLayout(layout);
    LabeledText node = new LabeledText(dialogArea, SWT.NONE, SWT.BORDER | SWT.READ_ONLY);
    node.setLabel(Messages.get().ConditionDciEditDialog_Node);
    node.setText(nodeName);
    GridData gd = new GridData();
    gd.horizontalSpan = 2;
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    gd.widthHint = 400;
    node.setLayoutData(gd);
    LabeledText parameter = new LabeledText(dialogArea, SWT.NONE, SWT.BORDER | SWT.READ_ONLY);
    parameter.setLabel(Messages.get().ConditionDciEditDialog_Parameter);
    parameter.setText(dciName);
    gd = new GridData();
    gd.horizontalSpan = 2;
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    parameter.setLayoutData(gd);
    if (dci.getType() != DataCollectionObject.DCO_TYPE_TABLE) {
        gd = new GridData();
        gd.horizontalAlignment = SWT.FILL;
        gd.grabExcessHorizontalSpace = true;
        function = WidgetHelper.createLabeledCombo(dialogArea, SWT.NONE, Messages.get().ConditionDciEditDialog_Function, gd);
        function.add(Messages.get().ConditionDciEditDialog_FuncLast);
        function.add(Messages.get().ConditionDciEditDialog_FuncAvg);
        function.add(Messages.get().ConditionDciEditDialog_FuncDeviation);
        function.add(Messages.get().ConditionDciEditDialog_FuncDiff);
        function.add(Messages.get().ConditionDciEditDialog_FuncError);
        function.add(Messages.get().ConditionDciEditDialog_FuncSum);
        function.select(dci.getFunction());
        function.addSelectionListener(new SelectionListener() {

            @Override
            public void widgetSelected(SelectionEvent e) {
                polls.setEnabled(isFunctionWithArgs());
            }

            @Override
            public void widgetDefaultSelected(SelectionEvent e) {
                widgetSelected(e);
            }
        });
        final WidgetFactory factory = new WidgetFactory() {

            @Override
            public Control createControl(Composite parent, int style) {
                Spinner spinner = new Spinner(parent, style);
                spinner.setMinimum(1);
                spinner.setMaximum(255);
                return spinner;
            }
        };
        polls = (Spinner) WidgetHelper.createLabeledControl(dialogArea, SWT.BORDER, factory, Messages.get().ConditionDciEditDialog_Polls, gd);
        polls.setSelection(dci.getPolls());
        polls.setEnabled(isFunctionWithArgs());
    }
    return dialogArea;
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) WidgetFactory(org.netxms.ui.eclipse.tools.WidgetFactory) LabeledText(org.netxms.ui.eclipse.widgets.LabeledText) Spinner(org.eclipse.swt.widgets.Spinner) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) SelectionListener(org.eclipse.swt.events.SelectionListener)

Example 39 with LabeledText

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

the class CreateNetworkServiceDialog 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.OUTER_SPACING;
    layout.marginHeight = WidgetHelper.DIALOG_HEIGHT_MARGIN;
    layout.marginWidth = WidgetHelper.DIALOG_WIDTH_MARGIN;
    layout.numColumns = 2;
    dialogArea.setLayout(layout);
    nameField = new LabeledText(dialogArea, SWT.NONE);
    nameField.setLabel(Messages.get().CreateNetworkServiceDialog_Name);
    nameField.getTextControl().setTextLimit(255);
    GridData gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    gd.widthHint = 300;
    gd.horizontalSpan = 2;
    nameField.setLayoutData(gd);
    gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    serviceTypeField = WidgetHelper.createLabeledCombo(dialogArea, SWT.READ_ONLY, Messages.get().CreateNetworkServiceDialog_ServiceType, gd);
    serviceTypeField.add(Messages.get().CreateNetworkServiceDialog_TypeUserDef);
    serviceTypeField.add(Messages.get().CreateNetworkServiceDialog_TypeSSH);
    serviceTypeField.add(Messages.get().CreateNetworkServiceDialog_TypePOP3);
    serviceTypeField.add(Messages.get().CreateNetworkServiceDialog_TypeSMTP);
    serviceTypeField.add(Messages.get().CreateNetworkServiceDialog_TypeFTP);
    serviceTypeField.add(Messages.get().CreateNetworkServiceDialog_TypeHTTP);
    serviceTypeField.add(Messages.get().CreateNetworkServiceDialog_TypeHTTPS);
    serviceTypeField.add(Messages.get().CreateNetworkServiceDialog_TypeTelnet);
    serviceTypeField.select(NetworkService.CUSTOM);
    portField = new LabeledText(dialogArea, SWT.NONE);
    portField.setLabel(Messages.get().CreateNetworkServiceDialog_Port);
    // $NON-NLS-1$
    portField.setText("0");
    gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    portField.setLayoutData(gd);
    requestField = new LabeledText(dialogArea, SWT.NONE);
    requestField.setLabel(Messages.get().CreateNetworkServiceDialog_Request);
    gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    gd.horizontalSpan = 2;
    requestField.setLayoutData(gd);
    responseField = new LabeledText(dialogArea, SWT.NONE);
    responseField.setLabel(Messages.get().CreateNetworkServiceDialog_Response);
    gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    gd.horizontalSpan = 2;
    responseField.setLayoutData(gd);
    final IDialogSettings settings = Activator.getDefault().getDialogSettings();
    checkCreateDci = new Button(dialogArea, SWT.CHECK);
    checkCreateDci.setText(Messages.get().CreateNetworkServiceDialog_CreateStatusDCI);
    // $NON-NLS-1$
    checkCreateDci.setSelection(settings.getBoolean("CreateNetworkServiceDialog.checkCreateDci"));
    gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    gd.horizontalSpan = 2;
    checkCreateDci.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) IDialogSettings(org.eclipse.jface.dialogs.IDialogSettings) Button(org.eclipse.swt.widgets.Button) GridData(org.eclipse.swt.layout.GridData)

Example 40 with LabeledText

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

the class CreateZoneDialog 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.marginHeight = WidgetHelper.DIALOG_HEIGHT_MARGIN;
    layout.marginWidth = WidgetHelper.DIALOG_WIDTH_MARGIN;
    dialogArea.setLayout(layout);
    nameField = new LabeledText(dialogArea, SWT.NONE);
    nameField.setLabel(Messages.get().CreateZoneDialog_Name);
    nameField.getTextControl().setTextLimit(255);
    GridData gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    gd.widthHint = 300;
    nameField.setLayoutData(gd);
    uinField = new LabeledText(dialogArea, SWT.NONE);
    uinField.setLabel(Messages.get().CreateZoneDialog_ZoneId);
    uinField.getTextControl().setTextLimit(12);
    gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    uinField.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)

Aggregations

Composite (org.eclipse.swt.widgets.Composite)104 LabeledText (org.netxms.ui.eclipse.widgets.LabeledText)104 GridLayout (org.eclipse.swt.layout.GridLayout)103 GridData (org.eclipse.swt.layout.GridData)102 Button (org.eclipse.swt.widgets.Button)50 SelectionEvent (org.eclipse.swt.events.SelectionEvent)37 SelectionListener (org.eclipse.swt.events.SelectionListener)31 Group (org.eclipse.swt.widgets.Group)24 ObjectSelector (org.netxms.ui.eclipse.objectbrowser.widgets.ObjectSelector)22 Label (org.eclipse.swt.widgets.Label)18 RowLayout (org.eclipse.swt.layout.RowLayout)11 Spinner (org.eclipse.swt.widgets.Spinner)11 ModifyEvent (org.eclipse.swt.events.ModifyEvent)9 ModifyListener (org.eclipse.swt.events.ModifyListener)9 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)8 LabeledSpinner (org.netxms.ui.eclipse.widgets.LabeledSpinner)8 ColorSelector (org.eclipse.jface.preference.ColorSelector)6 DisposeEvent (org.eclipse.swt.events.DisposeEvent)6 DisposeListener (org.eclipse.swt.events.DisposeListener)6 WidgetFactory (org.netxms.ui.eclipse.tools.WidgetFactory)6