Search in sources :

Example 21 with ObjectSelector

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

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

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

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

the class CreateNetworkMapDialog 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 = // $NON-NLS-1$
    WidgetHelper.createLabeledText(// $NON-NLS-1$
    dialogArea, // $NON-NLS-1$
    SWT.SINGLE | SWT.BORDER, // $NON-NLS-1$
    SWT.DEFAULT, // $NON-NLS-1$
    Messages.get().CreateNetworkMapDialog_Name, // $NON-NLS-1$
    "", WidgetHelper.DEFAULT_LAYOUT_DATA);
    textName.getShell().setMinimumSize(300, 0);
    mapType = WidgetHelper.createLabeledCombo(dialogArea, SWT.READ_ONLY, Messages.get().CreateNetworkMapDialog_MapType, WidgetHelper.DEFAULT_LAYOUT_DATA);
    mapType.add(Messages.get().CreateNetworkMapDialog_Custom);
    mapType.add(Messages.get().CreateNetworkMapDialog_L2Topology);
    mapType.add(Messages.get().CreateNetworkMapDialog_IpTopology);
    mapType.add("Internal Communication Topology");
    mapType.select(0);
    GridData gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    mapType.getParent().setLayoutData(gd);
    mapType.addSelectionListener(new SelectionListener() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            seedObjectSelector.setEnabled(mapType.getSelectionIndex() > 0 && mapType.getSelectionIndex() != 3);
        }

        @Override
        public void widgetDefaultSelected(SelectionEvent e) {
            widgetSelected(e);
        }
    });
    seedObjectSelector = new ObjectSelector(dialogArea, SWT.NONE, true);
    seedObjectSelector.setLabel(Messages.get().CreateNetworkMapDialog_SeedNode);
    seedObjectSelector.setObjectClass(Node.class);
    seedObjectSelector.setClassFilter(ObjectSelectionDialog.createNodeSelectionFilter(false));
    seedObjectSelector.setEnabled(false);
    gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    seedObjectSelector.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) SelectionEvent(org.eclipse.swt.events.SelectionEvent) SelectionListener(org.eclipse.swt.events.SelectionListener)

Example 25 with ObjectSelector

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

the class GeneralTextBox method createContents.

/* (non-Javadoc)
    * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
    */
@Override
protected Control createContents(Composite parent) {
    textBox = (NetworkMapTextBox) getElement().getAdapter(NetworkMapTextBox.class);
    Composite dialogArea = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.marginWidth = WidgetHelper.DIALOG_WIDTH_MARGIN;
    layout.marginHeight = WidgetHelper.DIALOG_HEIGHT_MARGIN;
    layout.verticalSpacing = WidgetHelper.OUTER_SPACING;
    layout.numColumns = 3;
    dialogArea.setLayout(layout);
    GridData gd = new GridData();
    gd.horizontalSpan = 3;
    gd.grabExcessHorizontalSpace = true;
    gd.horizontalAlignment = SWT.FILL;
    labeledText = WidgetHelper.createLabeledText(dialogArea, SWT.MULTI | SWT.BORDER, SWT.DEFAULT, "Text", textBox.getText(), gd);
    labeledText.setTextLimit(255);
    gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    backgroundSelector = WidgetHelper.createLabeledColorSelector(dialogArea, "Background color", gd);
    backgroundSelector.setColorValue(ColorConverter.rgbFromInt(textBox.getBackgroundColor()));
    gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    textSelector = WidgetHelper.createLabeledColorSelector(dialogArea, "Text color", gd);
    textSelector.setColorValue(ColorConverter.rgbFromInt(textBox.getTextColor()));
    gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    borderSelector = WidgetHelper.createLabeledColorSelector(dialogArea, "Border color", gd);
    borderSelector.setColorValue(ColorConverter.rgbFromInt(textBox.getBorderColor()));
    borderCheck = new Button(dialogArea, SWT.CHECK);
    borderCheck.setText("Show border");
    borderCheck.setSelection(textBox.isBorderRequired());
    gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    gd.horizontalSpan = 3;
    borderCheck.setLayoutData(gd);
    borderCheck.addSelectionListener(new SelectionListener() {

        /* (non-Javadoc)
          * @see org.eclipse.swt.events.SelectionListener#widgetSelected(org.eclipse.swt.events.SelectionEvent)
          */
        @Override
        public void widgetSelected(SelectionEvent e) {
            borderSelector.setEnabled(borderCheck.getSelection());
        }

        /* (non-Javadoc)
          * @see org.eclipse.swt.events.SelectionListener#widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent)
          */
        @Override
        public void widgetDefaultSelected(SelectionEvent e) {
            widgetSelected(e);
        }
    });
    fontSize = WidgetHelper.createLabeledSpinner(dialogArea, SWT.BORDER, "Text size", 1, 100, WidgetHelper.DEFAULT_LAYOUT_DATA);
    fontSize.setSelection(textBox.getFontSize());
    drillDownObject = new ObjectSelector(dialogArea, SWT.NONE, true);
    drillDownObject.setLabel("Drill-down object");
    drillDownObject.setObjectClass(AbstractObject.class);
    drillDownObject.setObjectId(textBox.getDrillDownObjectId());
    drillDownObject.setClassFilter(ObjectSelectionDialog.createDashboardAndNetworkMapSelectionFilter());
    gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    gd.horizontalSpan = 3;
    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) 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)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