Search in sources :

Example 66 with LabeledText

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

the class TableValue method createContents.

/* (non-Javadoc)
	 * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
	 */
@Override
protected Control createContents(Composite parent) {
    config = (TableValueConfig) getElement().getAdapter(TableValueConfig.class);
    Composite dialogArea = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    dialogArea.setLayout(layout);
    dciSelector = new DciSelector(dialogArea, SWT.NONE, true);
    dciSelector.setLabel(Messages.get().TableValue_Table);
    dciSelector.setDcObjectType(DataCollectionObject.DCO_TYPE_TABLE);
    dciSelector.setDciId(config.getObjectId(), config.getDciId());
    GridData gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    dciSelector.setLayoutData(gd);
    title = new LabeledText(dialogArea, SWT.NONE);
    title.setLabel(Messages.get().AlarmViewer_Title);
    title.setText(config.getTitle());
    gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    title.setLayoutData(gd);
    gd = new GridData();
    gd.verticalAlignment = SWT.TOP;
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    refreshRate = WidgetHelper.createLabeledSpinner(dialogArea, SWT.BORDER, Messages.get().AbstractChart_RefreshInterval, 1, 10000, gd);
    refreshRate.setSelection(config.getRefreshRate());
    return dialogArea;
}
Also used : DciSelector(org.netxms.ui.eclipse.datacollection.widgets.DciSelector) 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 67 with LabeledText

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

the class RackDiagram method createContents.

/* (non-Javadoc)
    * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
    */
@Override
protected Control createContents(Composite parent) {
    config = (RackDiagramConfig) getElement().getAdapter(RackDiagramConfig.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("Rack");
    objectSelector.setClassFilter(ObjectSelectionDialog.createRackSelectionFilter());
    objectSelector.setObjectClass(AbstractObject.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("Title");
    title.setText(config.getTitle());
    gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    gd.horizontalSpan = 2;
    title.setLayoutData(gd);
    gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    gd.horizontalSpan = 2;
    view = WidgetHelper.createLabeledCombo(dialogArea, SWT.READ_ONLY, "View", gd);
    view.setItems(RACK_VIEWS);
    view.setText(RACK_VIEWS[config.getView().getValue()]);
    showTitle = new Button(dialogArea, SWT.CHECK);
    showTitle.setText("Show title");
    showTitle.setSelection(config.isShowTitle());
    gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    showTitle.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) Button(org.eclipse.swt.widgets.Button) GridData(org.eclipse.swt.layout.GridData)

Example 68 with LabeledText

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

the class ServiceComponents method createContents.

@Override
protected Control createContents(Composite parent) {
    config = (ServiceComponentsConfig) getElement().getAdapter(ServiceComponentsConfig.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("Container");
    objectSelector.setClassFilter(ObjectSelectionDialog.createContainerSelectionFilter());
    objectSelector.setObjectClass(AbstractObject.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("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("Zoom level (%)");
    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("Enable double click action on objects");
    enableObjectDoubleClick.setSelection(config.isObjectDoubleClickEnabled());
    gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    gd.horizontalSpan = 2;
    enableObjectDoubleClick.setLayoutData(gd);
    gd = new GridData();
    gd.horizontalAlignment = SWT.LEFT;
    gd.horizontalSpan = 2;
    layoutAlgorithm = WidgetHelper.createLabeledCombo(dialogArea, SWT.READ_ONLY, "Layout algorithm", gd);
    layoutAlgorithm.add("Spring");
    layoutAlgorithm.add("Radial");
    layoutAlgorithm.add("Horizontal tree");
    layoutAlgorithm.add("Vertical tree");
    layoutAlgorithm.add("Sparse vertical tree");
    layoutAlgorithm.select(config.getDefaultLayoutAlgorithm().getValue());
    /**
     ** object display ***
     */
    Group objectDisplayGroup = new Group(dialogArea, SWT.NONE);
    objectDisplayGroup.setText("Default display options");
    gd = new GridData();
    gd.grabExcessHorizontalSpace = true;
    gd.horizontalAlignment = SWT.FILL;
    gd.verticalAlignment = SWT.FILL;
    objectDisplayGroup.setLayoutData(gd);
    layout = new GridLayout();
    objectDisplayGroup.setLayout(layout);
    gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    objectDisplayMode = WidgetHelper.createLabeledCombo(objectDisplayGroup, SWT.READ_ONLY, "Display object as", gd);
    objectDisplayMode.add("Icons");
    objectDisplayMode.add("Small labels");
    objectDisplayMode.add("Large labels");
    objectDisplayMode.add("Status icons");
    objectDisplayMode.select(config.getObjectDisplayMode().getValue());
    checkShowStatusIcon = new Button(objectDisplayGroup, SWT.CHECK);
    checkShowStatusIcon.setText("Show status icon");
    checkShowStatusIcon.setSelection((config.getFlags() & NetworkMap.MF_SHOW_STATUS_ICON) != 0);
    checkShowStatusFrame = new Button(objectDisplayGroup, SWT.CHECK);
    checkShowStatusFrame.setText("Show status frame");
    checkShowStatusFrame.setSelection((config.getFlags() & NetworkMap.MF_SHOW_STATUS_FRAME) != 0);
    checkShowStatusBkgnd = new Button(objectDisplayGroup, SWT.CHECK);
    checkShowStatusBkgnd.setText("Show status background");
    checkShowStatusBkgnd.setSelection((config.getFlags() & NetworkMap.MF_SHOW_STATUS_BKGND) != 0);
    /**
     ** default link appearance ***
     */
    Group linkGroup = new Group(dialogArea, SWT.NONE);
    linkGroup.setText("Default connection options");
    gd = new GridData();
    gd.grabExcessHorizontalSpace = true;
    gd.horizontalAlignment = SWT.FILL;
    gd.verticalAlignment = SWT.FILL;
    linkGroup.setLayoutData(gd);
    layout = new GridLayout();
    linkGroup.setLayout(layout);
    gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    routingAlgorithm = WidgetHelper.createLabeledCombo(linkGroup, SWT.READ_ONLY, "Routing algorithm", gd);
    routingAlgorithm.add("Direct");
    routingAlgorithm.add("Manhattan");
    routingAlgorithm.select(config.getDefaultLinkRouting() - 1);
    final SelectionListener listener = new SelectionListener() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            linkColor.setEnabled(radioColorCustom.getSelection());
        }

        @Override
        public void widgetDefaultSelected(SelectionEvent e) {
            widgetSelected(e);
        }
    };
    radioColorDefault = new Button(linkGroup, SWT.RADIO);
    radioColorDefault.setText("Default color");
    radioColorDefault.setSelection(config.getDefaultLinkColor() < 0);
    radioColorDefault.addSelectionListener(listener);
    gd = new GridData();
    gd.verticalIndent = WidgetHelper.OUTER_SPACING * 2;
    radioColorDefault.setLayoutData(gd);
    radioColorCustom = new Button(linkGroup, SWT.RADIO);
    radioColorCustom.setText("Custom color");
    radioColorCustom.setSelection(config.getDefaultLinkColor() >= 0);
    radioColorCustom.addSelectionListener(listener);
    linkColor = new ColorSelector(linkGroup);
    linkColor.setColorValue(ColorConverter.rgbFromInt(config.getDefaultLinkColor()));
    linkColor.setEnabled(config.getDefaultLinkColor() >= 0);
    gd = new GridData();
    gd.horizontalIndent = 20;
    linkColor.getButton().setLayoutData(gd);
    return dialogArea;
}
Also used : Group(org.eclipse.swt.widgets.Group) 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) ColorSelector(org.eclipse.jface.preference.ColorSelector) SelectionListener(org.eclipse.swt.events.SelectionListener)

Example 69 with LabeledText

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

the class StatusIndicator method createContents.

/* (non-Javadoc)
	 * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
	 */
@Override
protected Control createContents(Composite parent) {
    config = (StatusIndicatorConfig) getElement().getAdapter(StatusIndicatorConfig.class);
    Composite dialogArea = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    dialogArea.setLayout(layout);
    objectSelector = new ObjectSelector(dialogArea, SWT.NONE, false);
    objectSelector.setLabel(Messages.get().StatusIndicator_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(Messages.get().StatusIndicator_Title);
    title.setText(config.getTitle());
    gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    title.setLayoutData(gd);
    checkFullColors = new Button(dialogArea, SWT.CHECK);
    checkFullColors.setText(Messages.get().StatusIndicator_UseFullColorRange);
    checkFullColors.setSelection(config.isFullColorRange());
    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) Button(org.eclipse.swt.widgets.Button) GridData(org.eclipse.swt.layout.GridData)

Example 70 with LabeledText

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

the class ImportDashboardDialog 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;
    dialogArea.setLayout(layout);
    textName = new LabeledText(dialogArea, SWT.NONE);
    textName.setLabel(Messages.get().ImportDashboardDialog_ObjectName);
    textName.getTextControl().setTextLimit(63);
    GridData gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    gd.widthHint = 350;
    textName.setLayoutData(gd);
    importFileSelector = new LocalFileSelector(dialogArea, SWT.NONE, false, SWT.OPEN);
    importFileSelector.setLabel(Messages.get().ImportDashboardDialog_ImportFile);
    // $NON-NLS-1$ //$NON-NLS-2$
    importFileSelector.setFilterExtensions(new String[] { "*.xml", "*.*" });
    importFileSelector.setFilterNames(new String[] { Messages.get().ImportDashboardDialog_XMLFiles, Messages.get().ImportDashboardDialog_AllFiles });
    importFileSelector.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(ModifyEvent e) {
            Element root = null;
            try {
                DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
                DocumentBuilder db = dbf.newDocumentBuilder();
                Document dom = db.parse(importFileSelector.getFile());
                root = dom.getDocumentElement();
                if (// $NON-NLS-1$
                !root.getNodeName().equals("dashboard"))
                    throw new Exception(Messages.get().ImportDashboard_InvalidFile);
                root.normalize();
            } catch (Exception e1) {
                MessageDialogHelper.openError(getShell(), "Error", "Unable to open the document");
            } finally {
                if (root == null)
                    return;
                NodeList nameRoot = root.getElementsByTagName("name");
                textName.setText(nameRoot.item(0).getTextContent());
                root.normalize();
            }
        }
    });
    gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    gd.widthHint = 350;
    importFileSelector.setLayoutData(gd);
    return dialogArea;
}
Also used : DocumentBuilderFactory(javax.xml.parsers.DocumentBuilderFactory) Composite(org.eclipse.swt.widgets.Composite) ModifyListener(org.eclipse.swt.events.ModifyListener) LabeledText(org.netxms.ui.eclipse.widgets.LabeledText) Element(org.w3c.dom.Element) NodeList(org.w3c.dom.NodeList) Document(org.w3c.dom.Document) GridLayout(org.eclipse.swt.layout.GridLayout) ModifyEvent(org.eclipse.swt.events.ModifyEvent) LocalFileSelector(org.netxms.ui.eclipse.filemanager.widgets.LocalFileSelector) DocumentBuilder(javax.xml.parsers.DocumentBuilder) 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