Search in sources :

Example 96 with LabeledText

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

the class CreateInterfaceDialog 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;
    layout.makeColumnsEqualWidth = true;
    dialogArea.setLayout(layout);
    nameField = new LabeledText(dialogArea, SWT.NONE);
    nameField.setLabel(Messages.get().CreateInterfaceDialog_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);
    macAddrField = new LabeledText(dialogArea, SWT.NONE);
    macAddrField.setLabel(Messages.get().CreateInterfaceDialog_MACAddr);
    gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    gd.horizontalSpan = 2;
    macAddrField.setLayoutData(gd);
    ipAddrField = new LabeledText(dialogArea, SWT.NONE);
    ipAddrField.setLabel(Messages.get().CreateInterfaceDialog_IPAddr);
    gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    ipAddrField.setLayoutData(gd);
    ipMaskField = new LabeledText(dialogArea, SWT.NONE);
    ipMaskField.setLabel(Messages.get().CreateInterfaceDialog_IPNetMak);
    gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    ipMaskField.setLayoutData(gd);
    checkIsPhy = new Button(dialogArea, SWT.CHECK);
    checkIsPhy.setText(Messages.get().CreateInterfaceDialog_IsPhysicalPort);
    gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    gd.horizontalSpan = 2;
    checkIsPhy.setLayoutData(gd);
    checkIsPhy.addSelectionListener(new SelectionListener() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            slotField.setEnabled(checkIsPhy.getSelection());
            portField.setEnabled(checkIsPhy.getSelection());
        }

        @Override
        public void widgetDefaultSelected(SelectionEvent e) {
            widgetSelected(e);
        }
    });
    slotField = new LabeledText(dialogArea, SWT.NONE);
    slotField.setLabel(Messages.get().CreateInterfaceDialog_Slot);
    // $NON-NLS-1$
    slotField.setText("0");
    gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    slotField.setLayoutData(gd);
    slotField.setEnabled(false);
    portField = new LabeledText(dialogArea, SWT.NONE);
    portField.setLabel(Messages.get().CreateInterfaceDialog_Port);
    // $NON-NLS-1$
    portField.setText("0");
    gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    portField.setLayoutData(gd);
    portField.setEnabled(false);
    return dialogArea;
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) 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) SelectionEvent(org.eclipse.swt.events.SelectionEvent) SelectionListener(org.eclipse.swt.events.SelectionListener)

Example 97 with LabeledText

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

the class EditColumnDialog 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.marginWidth = WidgetHelper.DIALOG_WIDTH_MARGIN;
    layout.marginHeight = WidgetHelper.DIALOG_HEIGHT_MARGIN;
    layout.verticalSpacing = WidgetHelper.DIALOG_SPACING;
    dialogArea.setLayout(layout);
    name = new LabeledText(dialogArea, SWT.NONE);
    name.setLabel(Messages.get().EditColumnDialog_Name);
    name.setText(columnObject.getName());
    GridData gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    gd.widthHint = 350;
    name.setLayoutData(gd);
    format = WidgetHelper.createLabeledCombo(dialogArea, SWT.READ_ONLY, Messages.get().EditColumnDialog_Format, WidgetHelper.DEFAULT_LAYOUT_DATA);
    for (int i = 0; i < formatNames.length; i++) format.add(formatNames[i]);
    format.select(columnObject.getFormat());
    Composite dataGroup = null;
    if (snmpColumn) {
        dataGroup = new Composite(dialogArea, SWT.NONE);
        layout = new GridLayout();
        layout.marginHeight = 0;
        layout.marginWidth = 0;
        layout.horizontalSpacing = WidgetHelper.INNER_SPACING;
        layout.numColumns = 2;
        dataGroup.setLayout(layout);
        gd = new GridData();
        gd.horizontalAlignment = SWT.FILL;
        gd.grabExcessHorizontalSpace = true;
        dataGroup.setLayoutData(gd);
    }
    data = new LabeledText(snmpColumn ? dataGroup : dialogArea, SWT.NONE);
    if (snmpColumn) {
        data.setLabel(Messages.get().EditColumnDialog_SNMP_OID);
        data.setText(columnObject.getSnmpOid());
    } else {
        data.setLabel(Messages.get().EditColumnDialog_SubstrIndex);
        data.setText(Integer.toString(columnObject.getSubstringIndex()));
    }
    gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    gd.widthHint = 350;
    data.setLayoutData(gd);
    if (snmpColumn) {
        selectButton = new Button(dataGroup, SWT.PUSH);
        // $NON-NLS-1$
        selectButton.setText("...");
        gd = new GridData();
        gd.verticalAlignment = SWT.BOTTOM;
        selectButton.setLayoutData(gd);
        selectButton.addSelectionListener(new SelectionListener() {

            @Override
            public void widgetSelected(SelectionEvent e) {
                SnmpObjectId initial;
                try {
                    initial = SnmpObjectId.parseSnmpObjectId(data.getText());
                } catch (SnmpObjectIdFormatException ex) {
                    initial = null;
                }
                MibSelectionDialog dlg = new MibSelectionDialog(getShell(), initial, 0);
                if (dlg.open() == Window.OK) {
                    data.setText(dlg.getSelectedObjectId().toString());
                }
            }

            @Override
            public void widgetDefaultSelected(SelectionEvent e) {
                widgetSelected(e);
            }
        });
    }
    return dialogArea;
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) MibSelectionDialog(org.netxms.ui.eclipse.snmp.dialogs.MibSelectionDialog) 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) SelectionEvent(org.eclipse.swt.events.SelectionEvent) SnmpObjectIdFormatException(org.netxms.client.snmp.SnmpObjectIdFormatException) SnmpObjectId(org.netxms.client.snmp.SnmpObjectId) SelectionListener(org.eclipse.swt.events.SelectionListener)

Example 98 with LabeledText

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

the class SensorGeneralPage method createControl.

/* (non-Javadoc)
    * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
    */
@Override
public void createControl(Composite parent) {
    container = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.verticalSpacing = WidgetHelper.DIALOG_SPACING;
    layout.horizontalSpacing = WidgetHelper.DIALOG_SPACING;
    layout.marginWidth = 0;
    layout.marginHeight = 0;
    container.setLayout(layout);
    textObjectName = new LabeledText(container, SWT.NONE);
    textObjectName.setLabel(Messages.get().General_ObjectName);
    textObjectName.setText("");
    GridData gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    textObjectName.setLayoutData(gd);
    textObjectName.getTextControl().addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(ModifyEvent e) {
            getWizard().getContainer().updateButtons();
        }
    });
    comboCommMethod = (Combo) WidgetHelper.createLabeledCombo(container, SWT.BORDER | SWT.READ_ONLY, Messages.get().SensorWizard_General_CommMethod, WidgetHelper.DEFAULT_LAYOUT_DATA);
    comboCommMethod.setItems(Sensor.COMM_METHOD);
    comboCommMethod.select(0);
    gd = new GridData();
    gd.grabExcessHorizontalSpace = false;
    comboCommMethod.setLayoutData(gd);
    comboCommMethod.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(ModifyEvent e) {
            getWizard().getContainer().updateButtons();
        }
    });
    commonData = new SensorCommon(container, SWT.NONE, getWizard());
    gd = new GridData();
    gd.verticalAlignment = SWT.TOP;
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    commonData.setLayoutData(gd);
    setControl(container);
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) ModifyEvent(org.eclipse.swt.events.ModifyEvent) Composite(org.eclipse.swt.widgets.Composite) ModifyListener(org.eclipse.swt.events.ModifyListener) LabeledText(org.netxms.ui.eclipse.widgets.LabeledText) GridData(org.eclipse.swt.layout.GridData) SensorCommon(org.netxms.ui.eclipse.objectmanager.widgets.SensorCommon)

Example 99 with LabeledText

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

the class CreateNewToolDialog 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;
    dialogArea.setLayout(layout);
    textName = new LabeledText(dialogArea, SWT.NONE);
    textName.setLabel(Messages.get().CreateNewToolDialog_Name);
    GridData gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    gd.widthHint = 300;
    textName.setLayoutData(gd);
    comboType = WidgetHelper.createLabeledCombo(dialogArea, SWT.READ_ONLY, Messages.get().CreateNewToolDialog_ToolType, WidgetHelper.DEFAULT_LAYOUT_DATA);
    ObjectToolsLabelProvider lp = new ObjectToolsLabelProvider();
    for (String s : lp.getAllToolTypes()) comboType.add(s);
    comboType.select(0);
    lp.dispose();
    return dialogArea;
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) ObjectToolsLabelProvider(org.netxms.ui.eclipse.objecttools.views.helpers.ObjectToolsLabelProvider) Composite(org.eclipse.swt.widgets.Composite) LabeledText(org.netxms.ui.eclipse.widgets.LabeledText) GridData(org.eclipse.swt.layout.GridData)

Example 100 with LabeledText

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

the class EditInputFieldDialog 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.marginWidth = WidgetHelper.DIALOG_WIDTH_MARGIN;
    layout.marginHeight = WidgetHelper.DIALOG_HEIGHT_MARGIN;
    layout.verticalSpacing = WidgetHelper.DIALOG_SPACING;
    dialogArea.setLayout(layout);
    name = new LabeledText(dialogArea, SWT.NONE);
    name.setLabel(Messages.get().EditInputFieldDialog_Name);
    name.setText(field.getName());
    name.setEditable(create);
    GridData gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    gd.widthHint = 350;
    name.setLayoutData(gd);
    type = WidgetHelper.createLabeledCombo(dialogArea, SWT.READ_ONLY, Messages.get().EditInputFieldDialog_Type, WidgetHelper.DEFAULT_LAYOUT_DATA);
    for (int i = 0; i < typeNames.length; i++) type.add(typeNames[i]);
    type.select(field.getType().getValue());
    type.addSelectionListener(new SelectionListener() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            checkValidatePassword.setVisible(InputFieldType.getByValue(type.getSelectionIndex()) == InputFieldType.PASSWORD);
        }

        @Override
        public void widgetDefaultSelected(SelectionEvent e) {
            widgetSelected(e);
        }
    });
    displayName = new LabeledText(dialogArea, SWT.NONE);
    displayName.setLabel(Messages.get().EditInputFieldDialog_DisplayName);
    displayName.setText(field.getDisplayName());
    gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    gd.widthHint = 350;
    displayName.setLayoutData(gd);
    checkValidatePassword = new Button(dialogArea, SWT.CHECK);
    checkValidatePassword.setText(Messages.get().EditInputFieldDialog_ValidatePassword);
    checkValidatePassword.setVisible(field.getType() == InputFieldType.PASSWORD);
    checkValidatePassword.setSelection(field.getOptions().validatePassword);
    return dialogArea;
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) 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) SelectionEvent(org.eclipse.swt.events.SelectionEvent) SelectionListener(org.eclipse.swt.events.SelectionListener)

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