use of org.netxms.ui.eclipse.widgets.LabeledSpinner in project netxms by netxms.
the class AcknowledgeCustomTimeDialog 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.numColumns = 3;
layout.makeColumnsEqualWidth = true;
layout.marginWidth = WidgetHelper.DIALOG_WIDTH_MARGIN;
layout.marginHeight = WidgetHelper.DIALOG_HEIGHT_MARGIN;
layout.verticalSpacing = WidgetHelper.DIALOG_SPACING;
layout.horizontalSpacing = WidgetHelper.DIALOG_SPACING;
dialogArea.setLayout(layout);
days = new LabeledSpinner(dialogArea, SWT.NONE);
days.setLabel(Messages.get().AcknowledgeCustomTimeDialog_Days);
GridData gridData = new GridData();
gridData.horizontalAlignment = SWT.FILL;
gridData.grabExcessHorizontalSpace = true;
days.setLayoutData(gridData);
days.setRange(0, 999);
days.setSelection(0);
hours = new LabeledSpinner(dialogArea, SWT.NONE);
hours.setLabel(Messages.get().AcknowledgeCustomTimeDialog_Hours);
gridData = new GridData();
gridData.horizontalAlignment = SWT.FILL;
gridData.grabExcessHorizontalSpace = true;
hours.setLayoutData(gridData);
hours.setRange(0, 23);
hours.setSelection(0);
minutes = new LabeledSpinner(dialogArea, SWT.NONE);
minutes.setLabel(Messages.get().AcknowledgeCustomTimeDialog_Minutes);
gridData = new GridData();
gridData.horizontalAlignment = SWT.FILL;
gridData.grabExcessHorizontalSpace = true;
minutes.setLayoutData(gridData);
minutes.setRange(0, 59);
minutes.setSelection(0);
info = new Label(dialogArea, SWT.WRAP);
info.setText(Messages.get().AcknowledgeCustomTimeDialog_ConfigurationInfoLabel);
gridData = new GridData();
gridData.horizontalSpan = 3;
gridData.horizontalAlignment = SWT.FILL;
gridData.grabExcessHorizontalSpace = true;
gridData.verticalAlignment = SWT.FILL;
gridData.grabExcessVerticalSpace = true;
info.setLayoutData(gridData);
return dialogArea;
}
use of org.netxms.ui.eclipse.widgets.LabeledSpinner in project netxms by netxms.
the class General method createContents.
/* (non-Javadoc)
* @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
*/
@Override
protected Control createContents(Composite parent) {
Composite dialogArea = (Composite) super.createContents(parent);
dci = editor.getObjectAsItem();
GridLayout layout = new GridLayout();
layout.verticalSpacing = WidgetHelper.OUTER_SPACING;
layout.marginWidth = 0;
layout.marginHeight = 0;
layout.numColumns = 2;
dialogArea.setLayout(layout);
/**
* description area *
*/
Group groupDescription = new Group(dialogArea, SWT.NONE);
groupDescription.setText(Messages.get().General_Description);
FillLayout descriptionLayout = new FillLayout();
descriptionLayout.marginWidth = WidgetHelper.OUTER_SPACING;
descriptionLayout.marginHeight = WidgetHelper.OUTER_SPACING;
groupDescription.setLayout(descriptionLayout);
description = new Text(groupDescription, SWT.BORDER);
description.setTextLimit(255);
description.setText(dci.getDescription());
GridData gd = new GridData();
gd.grabExcessHorizontalSpace = true;
gd.horizontalAlignment = SWT.FILL;
gd.horizontalSpan = 2;
groupDescription.setLayoutData(gd);
/**
* data area *
*/
Group groupData = new Group(dialogArea, SWT.NONE);
groupData.setText(Messages.get().General_Data);
FormLayout dataLayout = new FormLayout();
dataLayout.marginHeight = WidgetHelper.OUTER_SPACING;
dataLayout.marginWidth = WidgetHelper.OUTER_SPACING;
groupData.setLayout(dataLayout);
gd = new GridData();
gd.grabExcessHorizontalSpace = true;
gd.horizontalAlignment = SWT.FILL;
gd.horizontalSpan = 2;
groupData.setLayoutData(gd);
parameter = new LabeledText(groupData, SWT.NONE);
parameter.setLabel(Messages.get().General_Parameter);
parameter.getTextControl().setTextLimit(255);
parameter.setText(dci.getName());
selectButton = new Button(groupData, SWT.PUSH);
selectButton.setText(Messages.get().General_Select);
selectButton.addSelectionListener(new SelectionListener() {
@Override
public void widgetDefaultSelected(SelectionEvent e) {
widgetSelected(e);
}
@Override
public void widgetSelected(SelectionEvent e) {
selectParameter();
}
});
FormData fd = new FormData();
fd.left = new FormAttachment(0, 0);
fd.top = new FormAttachment(0, 0);
fd.right = new FormAttachment(selectButton, -WidgetHelper.INNER_SPACING, SWT.LEFT);
parameter.setLayoutData(fd);
fd = new FormData();
fd.right = new FormAttachment(100, 0);
fd.bottom = new FormAttachment(parameter, 0, SWT.BOTTOM);
fd.width = WidgetHelper.BUTTON_WIDTH_HINT;
selectButton.setLayoutData(fd);
fd = new FormData();
fd.left = new FormAttachment(0, 0);
fd.top = new FormAttachment(parameter, WidgetHelper.OUTER_SPACING, SWT.BOTTOM);
fd.right = new FormAttachment(50, -WidgetHelper.OUTER_SPACING / 2);
origin = WidgetHelper.createLabeledCombo(groupData, SWT.READ_ONLY, Messages.get().General_Origin, fd);
origin.add(Messages.get().General_SourceInternal);
origin.add(Messages.get().General_SourceAgent);
origin.add(Messages.get().General_SourceSNMP);
origin.add(Messages.get().General_SourceCPSNMP);
origin.add(Messages.get().General_SourcePush);
origin.add(Messages.get().General_WinPerf);
origin.add(Messages.get().General_SMCLP);
origin.add(Messages.get().General_Script);
origin.add(Messages.get().General_SourceSSH);
origin.add(Messages.get().General_SourceMQTT);
origin.add(Messages.get().General_SourceDeviceDriver);
origin.select(dci.getOrigin());
origin.addSelectionListener(new SelectionListener() {
@Override
public void widgetDefaultSelected(SelectionEvent e) {
widgetSelected(e);
}
@Override
public void widgetSelected(SelectionEvent e) {
onOriginChange();
}
});
fd = new FormData();
fd.left = new FormAttachment(50, WidgetHelper.OUTER_SPACING / 2);
fd.top = new FormAttachment(parameter, WidgetHelper.OUTER_SPACING, SWT.BOTTOM);
fd.right = new FormAttachment(100, 0);
dataType = WidgetHelper.createLabeledCombo(groupData, SWT.READ_ONLY, Messages.get().General_DataType, fd);
dataType.add(DataCollectionDisplayInfo.getDataTypeName(DataType.INT32));
dataType.add(DataCollectionDisplayInfo.getDataTypeName(DataType.UINT32));
dataType.add(DataCollectionDisplayInfo.getDataTypeName(DataType.COUNTER32));
dataType.add(DataCollectionDisplayInfo.getDataTypeName(DataType.INT64));
dataType.add(DataCollectionDisplayInfo.getDataTypeName(DataType.UINT64));
dataType.add(DataCollectionDisplayInfo.getDataTypeName(DataType.COUNTER64));
dataType.add(DataCollectionDisplayInfo.getDataTypeName(DataType.FLOAT));
dataType.add(DataCollectionDisplayInfo.getDataTypeName(DataType.STRING));
dataType.select(getDataTypePosition(dci.getDataType()));
checkInterpretRawSnmpValue = new Button(groupData, SWT.CHECK);
checkInterpretRawSnmpValue.setText(Messages.get().General_InterpretRawValue);
checkInterpretRawSnmpValue.setSelection(dci.isSnmpRawValueInOctetString());
checkInterpretRawSnmpValue.addSelectionListener(new SelectionListener() {
@Override
public void widgetSelected(SelectionEvent e) {
snmpRawType.setEnabled(checkInterpretRawSnmpValue.getSelection());
}
@Override
public void widgetDefaultSelected(SelectionEvent e) {
widgetSelected(e);
}
});
fd = new FormData();
fd.left = new FormAttachment(0, 0);
fd.top = new FormAttachment(origin.getParent(), WidgetHelper.OUTER_SPACING, SWT.BOTTOM);
checkInterpretRawSnmpValue.setLayoutData(fd);
checkInterpretRawSnmpValue.setEnabled(dci.getOrigin() == DataCollectionItem.SNMP);
snmpRawType = new Combo(groupData, SWT.BORDER | SWT.READ_ONLY);
for (int i = 0; i < snmpRawTypes.length; i++) snmpRawType.add(snmpRawTypes[i]);
snmpRawType.select(dci.getSnmpRawValueType());
snmpRawType.setEnabled((dci.getOrigin() == DataCollectionItem.SNMP) && dci.isSnmpRawValueInOctetString());
fd = new FormData();
fd.left = new FormAttachment(0, 0);
fd.top = new FormAttachment(checkInterpretRawSnmpValue, WidgetHelper.OUTER_SPACING, SWT.BOTTOM);
fd.right = new FormAttachment(checkInterpretRawSnmpValue, 0, SWT.RIGHT);
snmpRawType.setLayoutData(fd);
checkUseCustomSnmpPort = new Button(groupData, SWT.CHECK);
checkUseCustomSnmpPort.setText(Messages.get().General_UseCustomPort);
checkUseCustomSnmpPort.setSelection(dci.getSnmpPort() != 0);
checkUseCustomSnmpPort.addSelectionListener(new SelectionListener() {
@Override
public void widgetSelected(SelectionEvent e) {
customSnmpPort.setEnabled(checkUseCustomSnmpPort.getSelection());
}
@Override
public void widgetDefaultSelected(SelectionEvent e) {
widgetSelected(e);
}
});
fd = new FormData();
fd.left = new FormAttachment(checkInterpretRawSnmpValue, WidgetHelper.OUTER_SPACING, SWT.RIGHT);
fd.right = new FormAttachment(100, 0);
fd.top = new FormAttachment(dataType.getParent(), WidgetHelper.OUTER_SPACING, SWT.BOTTOM);
checkUseCustomSnmpPort.setLayoutData(fd);
checkUseCustomSnmpPort.setEnabled(dci.getOrigin() == DataCollectionItem.SNMP);
customSnmpPort = new Spinner(groupData, SWT.BORDER);
customSnmpPort.setMinimum(1);
customSnmpPort.setMaximum(65535);
if ((dci.getOrigin() == DataCollectionItem.SNMP) && (dci.getSnmpPort() != 0)) {
customSnmpPort.setEnabled(true);
customSnmpPort.setSelection(dci.getSnmpPort());
} else {
customSnmpPort.setEnabled(false);
}
fd = new FormData();
fd.left = new FormAttachment(checkInterpretRawSnmpValue, WidgetHelper.OUTER_SPACING, SWT.RIGHT);
fd.right = new FormAttachment(100, 0);
fd.top = new FormAttachment(checkUseCustomSnmpPort, WidgetHelper.OUTER_SPACING, SWT.BOTTOM);
customSnmpPort.setLayoutData(fd);
sampleCount = new LabeledSpinner(groupData, SWT.NONE);
sampleCount.setLabel(Messages.get().General_SampleCountForAvg);
sampleCount.setRange(0, 65535);
sampleCount.setSelection(dci.getSampleCount());
sampleCount.setEnabled(dci.getOrigin() == DataCollectionItem.WINPERF);
fd = new FormData();
fd.left = new FormAttachment(0, 0);
fd.top = new FormAttachment(snmpRawType, WidgetHelper.OUTER_SPACING, SWT.BOTTOM);
fd.right = new FormAttachment(100, 0);
sampleCount.setLayoutData(fd);
sourceNode = new ObjectSelector(groupData, SWT.NONE, true);
sourceNode.setLabel(Messages.get().General_ProxyNode);
sourceNode.setObjectClass(Node.class);
sourceNode.setObjectId(dci.getSourceNode());
sourceNode.setEnabled(dci.getOrigin() != DataCollectionItem.PUSH);
fd = new FormData();
fd.top = new FormAttachment(sampleCount, WidgetHelper.OUTER_SPACING, SWT.BOTTOM);
fd.right = new FormAttachment(100, 0);
agentCacheMode = WidgetHelper.createLabeledCombo(groupData, SWT.READ_ONLY, Messages.get().General_AgentCacheMode, fd);
agentCacheMode.add(Messages.get().General_Default);
agentCacheMode.add(Messages.get().General_On);
agentCacheMode.add(Messages.get().General_Off);
agentCacheMode.select(dci.getCacheMode().getValue());
agentCacheMode.setEnabled((dci.getOrigin() == DataCollectionItem.AGENT) || (dci.getOrigin() == DataCollectionItem.SNMP));
fd = new FormData();
fd.left = new FormAttachment(0, 0);
fd.top = new FormAttachment(sampleCount, WidgetHelper.OUTER_SPACING, SWT.BOTTOM);
fd.right = new FormAttachment(agentCacheMode.getParent(), -WidgetHelper.OUTER_SPACING, SWT.LEFT);
sourceNode.setLayoutData(fd);
/**
* polling area *
*/
Group groupPolling = new Group(dialogArea, SWT.NONE);
groupPolling.setText(Messages.get().General_Polling);
FormLayout pollingLayout = new FormLayout();
pollingLayout.marginHeight = WidgetHelper.OUTER_SPACING;
pollingLayout.marginWidth = WidgetHelper.OUTER_SPACING;
groupPolling.setLayout(pollingLayout);
gd = new GridData();
gd.grabExcessHorizontalSpace = true;
gd.horizontalAlignment = SWT.FILL;
gd.verticalAlignment = SWT.FILL;
groupPolling.setLayoutData(gd);
fd = new FormData();
fd.left = new FormAttachment(0, 0);
fd.right = new FormAttachment(50, -WidgetHelper.OUTER_SPACING / 2);
fd.top = new FormAttachment(0, 0);
schedulingMode = WidgetHelper.createLabeledCombo(groupPolling, SWT.READ_ONLY, Messages.get().General_PollingMode, fd);
schedulingMode.add(Messages.get().General_FixedIntervalsDefault);
schedulingMode.add(Messages.get().General_FixedIntervalsCustom);
schedulingMode.add(Messages.get().General_CustomSchedule);
schedulingMode.select(dci.isUseAdvancedSchedule() ? 2 : ((dci.getPollingInterval() > 0) ? 1 : 0));
schedulingMode.setEnabled(dci.getOrigin() != DataCollectionItem.PUSH);
schedulingMode.addSelectionListener(new SelectionListener() {
@Override
public void widgetDefaultSelected(SelectionEvent e) {
widgetSelected(e);
}
@Override
public void widgetSelected(SelectionEvent e) {
pollingInterval.setEnabled(schedulingMode.getSelectionIndex() == 1);
}
});
pollingInterval = new LabeledSpinner(groupPolling, SWT.NONE);
pollingInterval.setLabel(Messages.get().General_PollingInterval);
pollingInterval.setRange(1, 99999);
pollingInterval.setSelection((dci.getPollingInterval() > 0) ? dci.getPollingInterval() : ConsoleSharedData.getSession().getDefaultDciPollingInterval());
pollingInterval.setEnabled(!dci.isUseAdvancedSchedule() && (dci.getPollingInterval() > 0) && (dci.getOrigin() != DataCollectionItem.PUSH));
fd = new FormData();
fd.left = new FormAttachment(50, WidgetHelper.OUTER_SPACING / 2);
fd.right = new FormAttachment(100, 0);
fd.top = new FormAttachment(0, 0);
pollingInterval.setLayoutData(fd);
/**
* status *
*/
Group groupStatus = new Group(dialogArea, SWT.NONE);
groupStatus.setText(Messages.get().General_Status);
gd = new GridData();
gd.horizontalAlignment = SWT.FILL;
gd.verticalAlignment = SWT.FILL;
groupStatus.setLayoutData(gd);
RowLayout statusLayout = new RowLayout();
statusLayout.type = SWT.VERTICAL;
groupStatus.setLayout(statusLayout);
statusActive = new Button(groupStatus, SWT.RADIO);
statusActive.setText(Messages.get().General_Active);
statusActive.setSelection(dci.getStatus() == DataCollectionItem.ACTIVE);
statusDisabled = new Button(groupStatus, SWT.RADIO);
statusDisabled.setText(Messages.get().General_Disabled);
statusDisabled.setSelection(dci.getStatus() == DataCollectionItem.DISABLED);
statusUnsupported = new Button(groupStatus, SWT.RADIO);
statusUnsupported.setText(Messages.get().General_NotSupported);
statusUnsupported.setSelection(dci.getStatus() == DataCollectionItem.NOT_SUPPORTED);
/**
* storage *
*/
Group groupStorage = new Group(dialogArea, SWT.NONE);
groupStorage.setText(Messages.get().General_Storage);
gd = new GridData();
gd.horizontalAlignment = SWT.FILL;
gd.verticalAlignment = SWT.FILL;
gd.horizontalSpan = 2;
groupStorage.setLayoutData(gd);
GridLayout storageLayout = new GridLayout();
storageLayout.numColumns = 2;
storageLayout.horizontalSpacing = WidgetHelper.OUTER_SPACING;
groupStorage.setLayout(storageLayout);
gd = new GridData();
gd.grabExcessHorizontalSpace = true;
gd.horizontalAlignment = SWT.FILL;
retentionMode = WidgetHelper.createLabeledCombo(groupStorage, SWT.READ_ONLY, Messages.get().General_RetentionMode, gd);
retentionMode.add(Messages.get().General_UseDefaultRetention);
retentionMode.add(Messages.get().General_UseCustomRetention);
retentionMode.add(Messages.get().General_NoStorage);
retentionMode.select(((dci.getFlags() & DataCollectionObject.DCF_NO_STORAGE) != 0) ? 2 : ((dci.getRetentionTime() > 0) ? 1 : 0));
retentionMode.addSelectionListener(new SelectionListener() {
@Override
public void widgetDefaultSelected(SelectionEvent e) {
widgetSelected(e);
}
@Override
public void widgetSelected(SelectionEvent e) {
int mode = retentionMode.getSelectionIndex();
retentionTime.setEnabled(mode == 1);
}
});
retentionTime = new LabeledSpinner(groupStorage, SWT.NONE);
retentionTime.setLabel(Messages.get().General_RetentionTime);
retentionTime.setRange(1, 99999);
retentionTime.setSelection((dci.getRetentionTime() > 0) ? dci.getRetentionTime() : ConsoleSharedData.getSession().getDefaultDciRetentionTime());
retentionTime.setEnabled(((dci.getFlags() & DataCollectionObject.DCF_NO_STORAGE) == 0) && (dci.getRetentionTime() > 0));
gd = new GridData();
gd.horizontalAlignment = SWT.FILL;
gd.grabExcessHorizontalSpace = true;
retentionTime.setLayoutData(gd);
int mode = 0;
if ((dci.getFlags() & DataCollectionObject.DCF_NO_STORAGE) != 0)
mode = 2;
else if (dci.getRetentionTime() > 0)
mode = 1;
retentionMode.select(mode);
retentionTime.setEnabled(mode == 1);
onOriginChange();
return dialogArea;
}
use of org.netxms.ui.eclipse.widgets.LabeledSpinner in project netxms by netxms.
the class RackPassiveElementEditDialog method createDialogArea.
/* (non-Javadoc)
* @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
*/
@Override
protected Control createDialogArea(Composite parent) {
Composite dialogArea = new Composite(parent, SWT.NONE);
GridLayout layout = new GridLayout();
layout.marginHeight = WidgetHelper.DIALOG_HEIGHT_MARGIN;
layout.numColumns = 3;
dialogArea.setLayout(layout);
GridData gd = new GridData();
gd.grabExcessHorizontalSpace = true;
gd.horizontalAlignment = SWT.FILL;
gd.horizontalSpan = 3;
gd.widthHint = 400;
name = new LabeledText(dialogArea, SWT.NONE);
name.setLabel("Name");
name.setText(element.getName());
name.setLayoutData(gd);
gd = new GridData();
gd.grabExcessHorizontalSpace = true;
gd.horizontalAlignment = SWT.FILL;
type = WidgetHelper.createLabeledCombo(dialogArea, SWT.READ_ONLY, "Type", gd);
type.setItems(TYPE);
type.setText(TYPE[element.getType().getValue()]);
position = new LabeledSpinner(dialogArea, SWT.NONE);
position.setLabel(Messages.get().RackPlacement_Position);
position.setRange(1, 50);
position.setSelection(element.getPosition());
gd = new GridData();
gd.grabExcessHorizontalSpace = true;
gd.horizontalAlignment = SWT.FILL;
position.setLayoutData(gd);
gd = new GridData();
gd.grabExcessHorizontalSpace = true;
gd.horizontalAlignment = SWT.FILL;
orientation = WidgetHelper.createLabeledCombo(dialogArea, SWT.READ_ONLY, "Orientation", gd);
orientation.setItems(ORIENTATION);
orientation.setText(ORIENTATION[element.getOrientation().getValue()]);
return dialogArea;
}
use of org.netxms.ui.eclipse.widgets.LabeledSpinner 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.widgets.LabeledSpinner in project netxms by netxms.
the class ObjectToolInputDialog 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;
layout.verticalSpacing = WidgetHelper.DIALOG_SPACING;
dialogArea.setLayout(layout);
for (int i = 0; i < fields.length; i++) {
LabeledControl c;
switch(fields[i].getType()) {
case NUMBER:
c = new LabeledSpinner(dialogArea, SWT.NONE);
break;
case PASSWORD:
c = new LabeledText(dialogArea, SWT.NONE, SWT.PASSWORD);
break;
default:
c = new LabeledText(dialogArea, SWT.NONE);
break;
}
c.setLabel(fields[i].getDisplayName());
GridData gd = new GridData();
gd.horizontalAlignment = SWT.FILL;
gd.grabExcessHorizontalSpace = true;
gd.widthHint = 300;
c.setLayoutData(gd);
controls[i] = c;
}
return dialogArea;
}
Aggregations