Search in sources :

Example 26 with LabeledText

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

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

the class CreateFolderDialog 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);
    textNewDirectoryName = new LabeledText(dialogArea, SWT.NONE);
    textNewDirectoryName.setLabel(Messages.get().CreateFolderDialog_Label);
    GridData gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    textNewDirectoryName.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)

Example 28 with LabeledText

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

the class StartClientToServerFileUploadDialog 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);
    fileSelector = new LocalFileSelector(dialogArea, SWT.NONE, false, SWT.OPEN | SWT.MULTI);
    fileSelector.setLabel(Messages.get().StartClientToServerFileUploadDialog_LocalFile);
    GridData gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    gd.widthHint = 400;
    fileSelector.setLayoutData(gd);
    fileSelector.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(ModifyEvent e) {
            localFiles = fileSelector.getFileList();
            if (localFiles.size() > 1) {
                textRemoteFile.setEditable(false);
            } else {
                textRemoteFile.setEditable(true);
            }
        }
    });
    textRemoteFile = new LabeledText(dialogArea, SWT.NONE);
    textRemoteFile.setLabel(Messages.get().StartClientToServerFileUploadDialog_RemoteFileName);
    gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    textRemoteFile.setLayoutData(gd);
    return dialogArea;
}
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) LocalFileSelector(org.netxms.ui.eclipse.filemanager.widgets.LocalFileSelector) LabeledText(org.netxms.ui.eclipse.widgets.LabeledText) GridData(org.eclipse.swt.layout.GridData)

Example 29 with LabeledText

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

the class StartServerToAgentFileUploadDialog 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);
    Label label = new Label(dialogArea, SWT.NONE);
    label.setText(Messages.get().StartServerToAgentFileUploadDialog_ServerFile);
    fileList = new TableViewer(dialogArea, SWT.BORDER | SWT.MULTI | SWT.FULL_SELECTION);
    GridData gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    gd.widthHint = 400;
    gd.heightHint = 150;
    fileList.getControl().setLayoutData(gd);
    fileList.setContentProvider(new ArrayContentProvider());
    fileList.setLabelProvider(new LabelProvider() {

        @Override
        public String getText(Object element) {
            return ((ServerFile) element).getName();
        }
    });
    fileList.setComparator(new ViewerComparator() {

        @Override
        public int compare(Viewer viewer, Object e1, Object e2) {
            return ((ServerFile) e1).getName().compareToIgnoreCase(((ServerFile) e2).getName());
        }
    });
    fileList.setInput(serverFiles);
    Composite buttonArea = new Composite(dialogArea, SWT.NONE);
    layout = new GridLayout();
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    layout.numColumns = 2;
    buttonArea.setLayout(layout);
    gd = new GridData();
    gd.horizontalAlignment = SWT.RIGHT;
    buttonArea.setLayoutData(gd);
    buttonAddFile = new Button(buttonArea, SWT.PUSH);
    buttonAddFile.setText("&Add...");
    gd = new GridData();
    gd.widthHint = WidgetHelper.BUTTON_WIDTH_HINT;
    buttonAddFile.setLayoutData(gd);
    buttonAddFile.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            SelectServerFileDialog dlg = new SelectServerFileDialog(getShell(), true);
            if (dlg.open() == Window.OK) {
                for (ServerFile f : dlg.getSelectedFiles()) {
                    boolean found = false;
                    for (ServerFile sf : serverFiles) if (sf.getName().equals(f.getName())) {
                        found = true;
                        break;
                    }
                    if (!found)
                        serverFiles.add(f);
                }
                fileList.refresh();
            }
        }
    });
    buttonRemoveFile = new Button(buttonArea, SWT.PUSH);
    buttonRemoveFile.setText("&Remove");
    gd = new GridData();
    gd.widthHint = WidgetHelper.BUTTON_WIDTH_HINT;
    buttonRemoveFile.setLayoutData(gd);
    buttonRemoveFile.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            IStructuredSelection selection = (IStructuredSelection) fileList.getSelection();
            for (Object o : selection.toList()) serverFiles.remove(o);
            fileList.refresh();
        }
    });
    textRemoteFile = new LabeledText(dialogArea, SWT.NONE);
    textRemoteFile.setLabel(Messages.get().StartServerToAgentFileUploadDialog_RemoteFileName);
    gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    textRemoteFile.setLayoutData(gd);
    checkJobOnHold = new Button(dialogArea, SWT.CHECK);
    checkJobOnHold.setText(Messages.get().StartServerToAgentFileUploadDialog_CreateJobOnHold);
    checkJobOnHold.addSelectionListener(new SelectionListener() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            checkIsSchedule.setEnabled(!checkJobOnHold.getSelection());
        }

        @Override
        public void widgetDefaultSelected(SelectionEvent e) {
            widgetSelected(e);
        }
    });
    if (canScheduleFileUpload) {
        checkIsSchedule = new Button(dialogArea, SWT.CHECK);
        checkIsSchedule.setText(Messages.get().StartServerToAgentFileUploadDialog_ScheduleTask);
        checkIsSchedule.addSelectionListener(new SelectionListener() {

            @Override
            public void widgetSelected(SelectionEvent e) {
                checkJobOnHold.setEnabled(!checkIsSchedule.getSelection());
                scheduleSelector.setEnabled(checkIsSchedule.getSelection());
            }

            @Override
            public void widgetDefaultSelected(SelectionEvent e) {
                widgetSelected(e);
            }
        });
        scheduleSelector = new ScheduleSelector(dialogArea, SWT.NONE);
        scheduleSelector.setEnabled(false);
    }
    return dialogArea;
}
Also used : ScheduleSelector(org.netxms.ui.eclipse.widgets.ScheduleSelector) Composite(org.eclipse.swt.widgets.Composite) LabeledText(org.netxms.ui.eclipse.widgets.LabeledText) ViewerComparator(org.eclipse.jface.viewers.ViewerComparator) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) Label(org.eclipse.swt.widgets.Label) ServerFile(org.netxms.client.server.ServerFile) TableViewer(org.eclipse.jface.viewers.TableViewer) Viewer(org.eclipse.jface.viewers.Viewer) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) GridLayout(org.eclipse.swt.layout.GridLayout) Button(org.eclipse.swt.widgets.Button) GridData(org.eclipse.swt.layout.GridData) ArrayContentProvider(org.eclipse.jface.viewers.ArrayContentProvider) SelectionEvent(org.eclipse.swt.events.SelectionEvent) TableViewer(org.eclipse.jface.viewers.TableViewer) LabelProvider(org.eclipse.jface.viewers.LabelProvider) SelectionListener(org.eclipse.swt.events.SelectionListener)

Example 30 with LabeledText

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

the class MapLinkGeneral method createContents.

/* (non-Javadoc)
	 * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
	 */
@Override
protected Control createContents(Composite parent) {
    object = (LinkEditor) getElement().getAdapter(LinkEditor.class);
    Composite dialogArea = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.numColumns = 2;
    dialogArea.setLayout(layout);
    name = new LabeledText(dialogArea, SWT.NONE);
    name.setLabel(Messages.get().MapLinkGeneral_Name);
    name.setText(object.getName());
    GridData gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    gd.horizontalSpan = 2;
    name.setLayoutData(gd);
    connector1 = new LabeledText(dialogArea, SWT.NONE);
    connector1.setLabel(Messages.get().MapLinkGeneral_NameConn1);
    connector1.setText(object.getConnectorName1());
    gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    gd.horizontalSpan = 2;
    connector1.setLayoutData(gd);
    connector2 = new LabeledText(dialogArea, SWT.NONE);
    connector2.setLabel(Messages.get().MapLinkGeneral_NameConn2);
    connector2.setText(object.getConnectorName2());
    gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    gd.horizontalSpan = 2;
    connector2.setLayoutData(gd);
    final Group colorGroup = new Group(dialogArea, SWT.NONE);
    colorGroup.setText(Messages.get().MapLinkGeneral_Color);
    layout = new GridLayout();
    colorGroup.setLayout(layout);
    gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    gd.horizontalSpan = 2;
    colorGroup.setLayoutData(gd);
    final SelectionListener listener = new SelectionListener() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            color.setEnabled(radioColorCustom.getSelection());
            list.setEnabled(radioColorObject.getSelection());
            add.setEnabled(radioColorObject.getSelection());
            remove.setEnabled(radioColorObject.getSelection());
            checkUseThresholds.setEnabled(radioColorObject.getSelection());
        }

        @Override
        public void widgetDefaultSelected(SelectionEvent e) {
            widgetSelected(e);
        }
    };
    radioColorDefault = new Button(colorGroup, SWT.RADIO);
    radioColorDefault.setText(Messages.get().MapLinkGeneral_DefColor);
    radioColorDefault.setSelection((object.getColor() < 0) && (object.getStatusObject().size() == 0));
    radioColorDefault.addSelectionListener(listener);
    radioColorObject = new Button(colorGroup, SWT.RADIO);
    radioColorObject.setText(Messages.get().MapLinkGeneral_BasedOnObjStatus);
    radioColorObject.setSelection(object.getStatusObject().size() != 0);
    radioColorObject.addSelectionListener(listener);
    final Composite nodeSelectionGroup = new Composite(colorGroup, SWT.NONE);
    layout = new GridLayout();
    layout.numColumns = 2;
    nodeSelectionGroup.setLayout(layout);
    gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    gd.horizontalSpan = 2;
    nodeSelectionGroup.setLayoutData(gd);
    list = new List(nodeSelectionGroup, SWT.BORDER | SWT.SINGLE | SWT.V_SCROLL | SWT.H_SCROLL);
    gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.verticalSpan = 2;
    gd.verticalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    gd.horizontalIndent = 20;
    list.setLayoutData(gd);
    if (object.getStatusObject() != null) {
        for (int i = 0; i < object.getStatusObject().size(); i++) {
            final AbstractObject obj = ((NXCSession) ConsoleSharedData.getSession()).findObjectById(object.getStatusObject().get(i));
            // $NON-NLS-1$ //$NON-NLS-2$
            list.add((obj != null) ? obj.getObjectName() : ("<" + Long.toString(object.getStatusObject().get(i)) + ">"));
        }
    }
    list.setEnabled(radioColorObject.getSelection());
    add = new Button(nodeSelectionGroup, SWT.PUSH);
    add.setText(Messages.get().MapLinkGeneral_Add);
    gd = new GridData();
    gd.widthHint = WidgetHelper.BUTTON_WIDTH_HINT;
    gd.verticalAlignment = SWT.TOP;
    add.setLayoutData(gd);
    add.addSelectionListener(new SelectionListener() {

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

        @Override
        public void widgetSelected(SelectionEvent e) {
            addObject();
        }
    });
    add.setEnabled(radioColorObject.getSelection());
    remove = new Button(nodeSelectionGroup, SWT.PUSH);
    remove.setText(Messages.get().MapLinkGeneral_Delete);
    gd.widthHint = WidgetHelper.BUTTON_WIDTH_HINT;
    gd.verticalAlignment = SWT.TOP;
    remove.setLayoutData(gd);
    remove.addSelectionListener(new SelectionListener() {

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

        @Override
        public void widgetSelected(SelectionEvent e) {
            removeObject();
        }
    });
    remove.setEnabled(radioColorObject.getSelection());
    checkUseThresholds = new Button(nodeSelectionGroup, SWT.CHECK);
    checkUseThresholds.setText("Use active thresholds");
    checkUseThresholds.setEnabled(radioColorObject.getSelection());
    checkUseThresholds.setSelection(object.isUseActiveThresholds());
    gd = new GridData();
    gd.horizontalIndent = 17;
    checkUseThresholds.setLayoutData(gd);
    radioColorCustom = new Button(colorGroup, SWT.RADIO);
    radioColorCustom.setText(Messages.get().MapLinkGeneral_CustomColor);
    radioColorCustom.setSelection((object.getColor() >= 0) && (object.getStatusObject().size() == 0));
    radioColorCustom.addSelectionListener(listener);
    color = new ColorSelector(colorGroup);
    if (radioColorCustom.getSelection())
        color.setColorValue(ColorConverter.rgbFromInt(object.getColor()));
    else
        color.setEnabled(false);
    gd = new GridData();
    gd.horizontalIndent = 20;
    color.getButton().setLayoutData(gd);
    gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    routingAlgorithm = WidgetHelper.createLabeledCombo(dialogArea, SWT.READ_ONLY, Messages.get().MapLinkGeneral_RoutingAlg, gd);
    routingAlgorithm.add(Messages.get().MapLinkGeneral_MapDefault);
    routingAlgorithm.add(Messages.get().MapLinkGeneral_Direct);
    routingAlgorithm.add(Messages.get().MapLinkGeneral_Manhattan);
    routingAlgorithm.add(Messages.get().MapLinkGeneral_BendPoints);
    routingAlgorithm.select(object.getRoutingAlgorithm());
    return dialogArea;
}
Also used : Group(org.eclipse.swt.widgets.Group) NXCSession(org.netxms.client.NXCSession) Composite(org.eclipse.swt.widgets.Composite) LabeledText(org.netxms.ui.eclipse.widgets.LabeledText) GridLayout(org.eclipse.swt.layout.GridLayout) Button(org.eclipse.swt.widgets.Button) AbstractObject(org.netxms.client.objects.AbstractObject) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) List(org.eclipse.swt.widgets.List) ColorSelector(org.eclipse.jface.preference.ColorSelector) 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