Search in sources :

Example 1 with ImageSelector

use of org.netxms.ui.eclipse.imagelibrary.widgets.ImageSelector in project netxms by netxms.

the class RackPlacement method createContents.

/* (non-Javadoc)
	 * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
	 */
@Override
protected Control createContents(Composite parent) {
    Composite dialogArea = new Composite(parent, SWT.NONE);
    object = (RackElement) getElement().getAdapter(RackElement.class);
    GridLayout layout = new GridLayout();
    layout.verticalSpacing = WidgetHelper.OUTER_SPACING;
    layout.marginWidth = 0;
    layout.marginHeight = 0;
    layout.numColumns = 3;
    dialogArea.setLayout(layout);
    rackSelector = new ObjectSelector(dialogArea, SWT.NONE, true);
    rackSelector.setLabel(Messages.get().RackPlacement_Rack);
    rackSelector.setObjectClass(Rack.class);
    rackSelector.setObjectId(object.getRackId());
    GridData gd = new GridData();
    gd.grabExcessHorizontalSpace = true;
    gd.horizontalAlignment = SWT.FILL;
    gd.horizontalSpan = 3;
    rackSelector.setLayoutData(gd);
    rackImageFrontSelector = new ImageSelector(dialogArea, SWT.NONE);
    rackImageFrontSelector.setLabel("Rack front image");
    rackImageFrontSelector.setImageGuid(object.getFrontRackImage(), false);
    rackImageFrontSelector.setEnabled(object.getRackOrientation() == RackOrientation.FRONT || object.getRackOrientation() == RackOrientation.FILL);
    gd = new GridData();
    gd.grabExcessHorizontalSpace = true;
    gd.horizontalAlignment = SWT.FILL;
    gd.horizontalSpan = 3;
    rackImageFrontSelector.setLayoutData(gd);
    rackImageRearSelector = new ImageSelector(dialogArea, SWT.NONE);
    rackImageRearSelector.setLabel("Rack rear image");
    rackImageRearSelector.setImageGuid(object.getRearRackImage(), false);
    rackImageRearSelector.setEnabled(object.getRackOrientation() == RackOrientation.REAR || object.getRackOrientation() == RackOrientation.FILL);
    gd = new GridData();
    gd.grabExcessHorizontalSpace = true;
    gd.horizontalAlignment = SWT.FILL;
    gd.horizontalSpan = 3;
    rackImageRearSelector.setLayoutData(gd);
    rackPosition = new LabeledSpinner(dialogArea, SWT.NONE);
    rackPosition.setLabel(Messages.get().RackPlacement_Position);
    rackPosition.setRange(1, 50);
    rackPosition.setSelection(object.getRackPosition());
    gd = new GridData();
    gd.grabExcessHorizontalSpace = true;
    gd.horizontalAlignment = SWT.FILL;
    rackPosition.setLayoutData(gd);
    rackHeight = new LabeledSpinner(dialogArea, SWT.NONE);
    rackHeight.setLabel(Messages.get().RackPlacement_Height);
    rackHeight.setRange(1, 50);
    rackHeight.setSelection(object.getRackHeight());
    gd = new GridData();
    gd.grabExcessHorizontalSpace = true;
    gd.horizontalAlignment = SWT.FILL;
    rackHeight.setLayoutData(gd);
    gd = new GridData();
    gd.grabExcessHorizontalSpace = true;
    gd.horizontalAlignment = SWT.FILL;
    rackOrientation = WidgetHelper.createLabeledCombo(dialogArea, SWT.READ_ONLY, "Orientation", gd);
    rackOrientation.setItems(ORIENTATION);
    rackOrientation.setText(ORIENTATION[object.getRackOrientation().getValue()]);
    rackOrientation.addSelectionListener(new SelectionListener() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            if (RackOrientation.getByValue(rackOrientation.getSelectionIndex()) == RackOrientation.FRONT) {
                rackImageRearSelector.setEnabled(false);
                rackImageFrontSelector.setEnabled(true);
            } else if (RackOrientation.getByValue(rackOrientation.getSelectionIndex()) == RackOrientation.REAR) {
                rackImageRearSelector.setEnabled(true);
                rackImageFrontSelector.setEnabled(false);
            } else {
                rackImageRearSelector.setEnabled(true);
                rackImageFrontSelector.setEnabled(true);
            }
        }

        @Override
        public void widgetDefaultSelected(SelectionEvent e) {
            widgetSelected(e);
        }
    });
    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) ImageSelector(org.netxms.ui.eclipse.imagelibrary.widgets.ImageSelector) LabeledSpinner(org.netxms.ui.eclipse.widgets.LabeledSpinner) SelectionListener(org.eclipse.swt.events.SelectionListener)

Example 2 with ImageSelector

use of org.netxms.ui.eclipse.imagelibrary.widgets.ImageSelector in project netxms by netxms.

the class MapAppearance method createContents.

/* (non-Javadoc)
	 * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
	 */
@Override
protected Control createContents(Composite parent) {
    Composite dialogArea = new Composite(parent, SWT.NONE);
    object = (AbstractObject) getElement().getAdapter(AbstractObject.class);
    if (// Paranoid check
    object == null)
        return dialogArea;
    GridLayout layout = new GridLayout();
    layout.verticalSpacing = WidgetHelper.OUTER_SPACING;
    layout.marginWidth = 0;
    layout.marginHeight = 0;
    dialogArea.setLayout(layout);
    // Image
    image = new ImageSelector(dialogArea, SWT.NONE);
    image.setLabel(Messages.get().MapAppearance_Image);
    GridData gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    image.setLayoutData(gd);
    image.setImageGuid(object.getImage(), false);
    // Submap
    if (!(object instanceof NetworkMap)) {
        drillDownObject = new ObjectSelector(dialogArea, SWT.NONE, true);
        drillDownObject.setLabel("Drill-down object");
        drillDownObject.setObjectClass(AbstractObject.class);
        drillDownObject.setObjectId(object.getDrillDownObjectId());
        drillDownObject.setClassFilter(ObjectSelectionDialog.createDashboardAndNetworkMapSelectionFilter());
        gd = new GridData();
        gd.horizontalAlignment = SWT.FILL;
        gd.grabExcessHorizontalSpace = true;
        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) GridData(org.eclipse.swt.layout.GridData) ImageSelector(org.netxms.ui.eclipse.imagelibrary.widgets.ImageSelector) NetworkMap(org.netxms.client.objects.NetworkMap)

Example 3 with ImageSelector

use of org.netxms.ui.eclipse.imagelibrary.widgets.ImageSelector in project netxms by netxms.

the class EditDCIImageRuleDialog method createDialogArea.

/* (non-Javadoc)
	 * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
	 */
@Override
protected Control createDialogArea(final Composite parent) {
    Composite dialogArea = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.numColumns = 1;
    layout.makeColumnsEqualWidth = true;
    dialogArea.setLayout(layout);
    // Condition area
    conditionGroup = new Group(dialogArea, SWT.NONE);
    conditionGroup.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
    conditionGroup.setText(Messages.get().EditDCIImageRuleDialog_Condition);
    GridLayout condLayout = new GridLayout();
    condLayout.numColumns = 2;
    conditionGroup.setLayout(condLayout);
    operation = WidgetHelper.createLabeledCombo(conditionGroup, SWT.BORDER | SWT.DROP_DOWN | SWT.READ_ONLY, Messages.get().EditDCIImageRuleDialog_Operation, WidgetHelper.DEFAULT_LAYOUT_DATA);
    operation.add(Messages.get().EditDCIImageRuleDialog_OpLess);
    operation.add(Messages.get().EditDCIImageRuleDialog_OpLessEq);
    operation.add(Messages.get().EditDCIImageRuleDialog_OpEq);
    operation.add(Messages.get().EditDCIImageRuleDialog_OpGtEq);
    operation.add(Messages.get().EditDCIImageRuleDialog_OpGt);
    operation.add(Messages.get().EditDCIImageRuleDialog_OpNe);
    operation.add(Messages.get().EditDCIImageRuleDialog_OpLike);
    operation.add(Messages.get().EditDCIImageRuleDialog_OpNotLike);
    operation.select((rule.getComparisonType() != -1) ? rule.getComparisonType() : 0);
    value = WidgetHelper.createLabeledText(conditionGroup, SWT.BORDER, 120, Messages.get().EditDCIImageRuleDialog_Value, rule.getCompareValue(), WidgetHelper.DEFAULT_LAYOUT_DATA);
    comment = WidgetHelper.createLabeledText(dialogArea, SWT.BORDER, 120, Messages.get().EditDCIImageRuleDialog_Comment, rule.getComment(), WidgetHelper.DEFAULT_LAYOUT_DATA);
    image = new ImageSelector(dialogArea, SWT.NONE);
    image.setLabel(Messages.get().EditDCIImageRuleDialog_Image);
    GridData gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    image.setLayoutData(gd);
    try {
        selectedImage = rule.getImage();
        image.setImageGuid(selectedImage, true);
    } catch (Exception e) {
    }
    image.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(ModifyEvent e) {
            getShell().setSize(getShell().computeSize(SWT.DEFAULT, SWT.DEFAULT, true));
            getShell().layout(true, true);
        }
    });
    return dialogArea;
}
Also used : Group(org.eclipse.swt.widgets.Group) GridLayout(org.eclipse.swt.layout.GridLayout) ModifyEvent(org.eclipse.swt.events.ModifyEvent) Composite(org.eclipse.swt.widgets.Composite) ModifyListener(org.eclipse.swt.events.ModifyListener) GridData(org.eclipse.swt.layout.GridData) ImageSelector(org.netxms.ui.eclipse.imagelibrary.widgets.ImageSelector)

Example 4 with ImageSelector

use of org.netxms.ui.eclipse.imagelibrary.widgets.ImageSelector in project netxms by netxms.

the class GeneralDCIImagePropertyPage method createContents.

@Override
protected Control createContents(Composite parent) {
    container = (NetworkMapDCIImage) getElement().getAdapter(NetworkMapDCIImage.class);
    config = container.getImageOptions();
    SingleDciConfig dciConf = config.getDci();
    Composite dialogArea = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.numColumns = 1;
    layout.makeColumnsEqualWidth = true;
    dialogArea.setLayout(layout);
    dci = new DciSelector(dialogArea, SWT.NONE, false);
    dci.setLabel(Messages.get().GeneralDCIImagePropertyPage_DataSource);
    if (dciConf != null) {
        dci.setDciId(dciConf.getNodeId(), dciConf.getDciId());
        dci.setDciObjectType(dciConf.getType());
    }
    GridData gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    dci.setLayoutData(gd);
    instanceColumn = new LabeledText(dialogArea, SWT.NONE);
    instanceColumn.setLabel(Messages.get().GeneralDCIImagePropertyPage_Column);
    if (dciConf != null)
        instanceColumn.setText(dciConf.getColumn());
    gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    instanceColumn.setLayoutData(gd);
    dataColumn = new LabeledText(dialogArea, SWT.NONE);
    dataColumn.setLabel(Messages.get().GeneralDCIImagePropertyPage_Instance);
    if (dciConf != null)
        dataColumn.setText(dciConf.getInstance());
    gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    dataColumn.setLayoutData(gd);
    image = new ImageSelector(dialogArea, SWT.NONE);
    image.setLabel(Messages.get().GeneralDCIImagePropertyPage_DefaultImage);
    gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    image.setLayoutData(gd);
    try {
        selectedImage = config.getDefaultImage();
        image.setImageGuid(selectedImage, true);
    } catch (Exception e) {
    }
    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) ImageSelector(org.netxms.ui.eclipse.imagelibrary.widgets.ImageSelector) SingleDciConfig(org.netxms.client.maps.configs.SingleDciConfig)

Example 5 with ImageSelector

use of org.netxms.ui.eclipse.imagelibrary.widgets.ImageSelector in project netxms by netxms.

the class MapBackground method createContents.

/* (non-Javadoc)
	 * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
	 */
@Override
protected Control createContents(Composite parent) {
    Composite dialogArea = new Composite(parent, SWT.NONE);
    final IPreferenceStore ps = Activator.getDefault().getPreferenceStore();
    // $NON-NLS-1$
    disableGeolocationBackground = ps.getBoolean("DISABLE_GEOLOCATION_BACKGROUND");
    object = (NetworkMap) getElement().getAdapter(NetworkMap.class);
    GridLayout layout = new GridLayout();
    layout.verticalSpacing = WidgetHelper.OUTER_SPACING;
    layout.marginWidth = 0;
    layout.marginHeight = 0;
    layout.numColumns = 1;
    dialogArea.setLayout(layout);
    Group typeGroup = new Group(dialogArea, SWT.NONE);
    typeGroup.setText(Messages.get().MapBackground_BkgndType);
    GridData gd = new GridData();
    gd.grabExcessHorizontalSpace = true;
    gd.horizontalAlignment = SWT.FILL;
    typeGroup.setLayoutData(gd);
    layout = new GridLayout();
    typeGroup.setLayout(layout);
    final SelectionListener listener = new SelectionListener() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            enableControls(radioTypeImage.getSelection(), disableGeolocationBackground ? false : radioTypeGeoMap.getSelection());
        }

        @Override
        public void widgetDefaultSelected(SelectionEvent e) {
            widgetSelected(e);
        }
    };
    radioTypeNone = new Button(typeGroup, SWT.RADIO);
    radioTypeNone.setText(Messages.get().MapBackground_None);
    radioTypeNone.setSelection(object.getBackground().equals(NXCommon.EMPTY_GUID));
    radioTypeNone.addSelectionListener(listener);
    radioTypeImage = new Button(typeGroup, SWT.RADIO);
    radioTypeImage.setText(Messages.get().MapBackground_Image);
    radioTypeImage.setSelection(!object.getBackground().equals(NXCommon.EMPTY_GUID) && !object.getBackground().equals(NetworkMap.GEOMAP_BACKGROUND));
    radioTypeImage.addSelectionListener(listener);
    if (!disableGeolocationBackground) {
        radioTypeGeoMap = new Button(typeGroup, SWT.RADIO);
        radioTypeGeoMap.setText(Messages.get().MapBackground_GeoMap);
        radioTypeGeoMap.setSelection(object.getBackground().equals(NetworkMap.GEOMAP_BACKGROUND));
        radioTypeGeoMap.addSelectionListener(listener);
    } else {
        if (object.getBackground().equals(NetworkMap.GEOMAP_BACKGROUND))
            radioTypeNone.setSelection(true);
    }
    image = new ImageSelector(dialogArea, SWT.NONE);
    image.setLabel(Messages.get().MapBackground_BkgndImage);
    if (radioTypeImage.getSelection())
        image.setImageGuid(object.getBackground(), true);
    gd = new GridData();
    gd.grabExcessHorizontalSpace = true;
    gd.horizontalAlignment = SWT.FILL;
    image.setLayoutData(gd);
    if (!disableGeolocationBackground) {
        Group geomapGroup = new Group(dialogArea, SWT.NONE);
        geomapGroup.setText(Messages.get().MapBackground_GroupGeoMap);
        gd = new GridData();
        gd.grabExcessHorizontalSpace = true;
        gd.horizontalAlignment = SWT.FILL;
        geomapGroup.setLayoutData(gd);
        layout = new GridLayout();
        geomapGroup.setLayout(layout);
        GeoLocation gl = object.getBackgroundLocation();
        latitude = new LabeledText(geomapGroup, SWT.NONE);
        latitude.setLabel(Messages.get().MapBackground_Lat);
        latitude.setText(gl.getLatitudeAsString());
        gd = new GridData();
        gd.grabExcessHorizontalSpace = true;
        gd.horizontalAlignment = SWT.FILL;
        latitude.setLayoutData(gd);
        longitude = new LabeledText(geomapGroup, SWT.NONE);
        longitude.setLabel(Messages.get().MapBackground_Lon);
        longitude.setText(gl.getLongitudeAsString());
        gd = new GridData();
        gd.grabExcessHorizontalSpace = true;
        gd.horizontalAlignment = SWT.FILL;
        longitude.setLayoutData(gd);
        Composite zoomGroup = new Composite(geomapGroup, SWT.NONE);
        layout = new GridLayout();
        layout.numColumns = 2;
        layout.horizontalSpacing = WidgetHelper.OUTER_SPACING;
        layout.marginHeight = 0;
        layout.marginWidth = 0;
        layout.marginTop = WidgetHelper.OUTER_SPACING;
        zoomGroup.setLayout(layout);
        gd = new GridData();
        gd.horizontalAlignment = SWT.FILL;
        gd.grabExcessHorizontalSpace = true;
        zoomGroup.setLayoutData(gd);
        zoomLabel = new Label(zoomGroup, SWT.NONE);
        zoomLabel.setText(Messages.get().MapBackground_ZoomLevel);
        gd = new GridData();
        gd.horizontalAlignment = SWT.LEFT;
        gd.horizontalSpan = 2;
        zoomLabel.setLayoutData(gd);
        zoomScale = new Scale(zoomGroup, SWT.HORIZONTAL);
        zoomScale.setMinimum(1);
        zoomScale.setMaximum(18);
        zoomScale.setSelection(object.getBackgroundZoom());
        gd = new GridData();
        gd.horizontalAlignment = SWT.FILL;
        gd.grabExcessHorizontalSpace = true;
        zoomScale.setLayoutData(gd);
        zoomScale.addSelectionListener(new SelectionListener() {

            @Override
            public void widgetSelected(SelectionEvent e) {
                zoomSpinner.setSelection(zoomScale.getSelection());
            }

            @Override
            public void widgetDefaultSelected(SelectionEvent e) {
                widgetSelected(e);
            }
        });
        zoomSpinner = new Spinner(zoomGroup, SWT.BORDER);
        zoomSpinner.setMinimum(1);
        zoomSpinner.setMaximum(18);
        zoomSpinner.setSelection(object.getBackgroundZoom());
        zoomSpinner.addSelectionListener(new SelectionListener() {

            @Override
            public void widgetSelected(SelectionEvent e) {
                zoomScale.setSelection(zoomSpinner.getSelection());
            }

            @Override
            public void widgetDefaultSelected(SelectionEvent e) {
                widgetSelected(e);
            }
        });
    }
    Composite colorArea = new Composite(dialogArea, SWT.NONE);
    layout = new GridLayout();
    layout.numColumns = 2;
    layout.horizontalSpacing = WidgetHelper.OUTER_SPACING;
    layout.marginWidth = 0;
    colorArea.setLayout(layout);
    gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    colorArea.setLayoutData(gd);
    Label label = new Label(colorArea, SWT.NONE);
    label.setText(Messages.get().MapBackground_BkgndColor);
    backgroundColor = new ColorSelector(colorArea);
    backgroundColor.setColorValue(ColorConverter.rgbFromInt(object.getBackgroundColor()));
    enableControls(radioTypeImage.getSelection(), disableGeolocationBackground ? false : radioTypeGeoMap.getSelection());
    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) ImageSelector(org.netxms.ui.eclipse.imagelibrary.widgets.ImageSelector) GridLayout(org.eclipse.swt.layout.GridLayout) Button(org.eclipse.swt.widgets.Button) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) GeoLocation(org.netxms.base.GeoLocation) IPreferenceStore(org.eclipse.jface.preference.IPreferenceStore) ColorSelector(org.eclipse.jface.preference.ColorSelector) SelectionListener(org.eclipse.swt.events.SelectionListener)

Aggregations

GridData (org.eclipse.swt.layout.GridData)5 GridLayout (org.eclipse.swt.layout.GridLayout)5 Composite (org.eclipse.swt.widgets.Composite)5 ImageSelector (org.netxms.ui.eclipse.imagelibrary.widgets.ImageSelector)5 SelectionEvent (org.eclipse.swt.events.SelectionEvent)2 SelectionListener (org.eclipse.swt.events.SelectionListener)2 Group (org.eclipse.swt.widgets.Group)2 ObjectSelector (org.netxms.ui.eclipse.objectbrowser.widgets.ObjectSelector)2 LabeledText (org.netxms.ui.eclipse.widgets.LabeledText)2 ColorSelector (org.eclipse.jface.preference.ColorSelector)1 IPreferenceStore (org.eclipse.jface.preference.IPreferenceStore)1 ModifyEvent (org.eclipse.swt.events.ModifyEvent)1 ModifyListener (org.eclipse.swt.events.ModifyListener)1 Button (org.eclipse.swt.widgets.Button)1 Label (org.eclipse.swt.widgets.Label)1 Scale (org.eclipse.swt.widgets.Scale)1 Spinner (org.eclipse.swt.widgets.Spinner)1 GeoLocation (org.netxms.base.GeoLocation)1 SingleDciConfig (org.netxms.client.maps.configs.SingleDciConfig)1 NetworkMap (org.netxms.client.objects.NetworkMap)1