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;
}
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;
}
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;
}
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;
}
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;
}
Aggregations