use of org.netxms.ui.eclipse.widgets.LabeledText in project netxms by netxms.
the class EditColumnDialog 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 = 2;
layout.makeColumnsEqualWidth = true;
layout.marginWidth = WidgetHelper.DIALOG_WIDTH_MARGIN;
layout.marginHeight = WidgetHelper.DIALOG_HEIGHT_MARGIN;
dialogArea.setLayout(layout);
name = new LabeledText(dialogArea, SWT.NONE);
name.setLabel(Messages.get().EditColumnDialog_Name);
name.setText(column.getName());
name.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1));
displayName = new LabeledText(dialogArea, SWT.NONE);
displayName.setLabel(Messages.get().EditColumnDialog_DispName);
displayName.setText(column.getDisplayName());
displayName.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1));
dataType = WidgetHelper.createLabeledCombo(dialogArea, SWT.READ_ONLY, Messages.get().EditColumnDialog_DataType, new GridData(SWT.FILL, SWT.CENTER, true, false));
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(column.getDataType()));
aggregationFunction = WidgetHelper.createLabeledCombo(dialogArea, SWT.READ_ONLY, Messages.get().EditColumnDialog_AggFunc, new GridData(SWT.FILL, SWT.CENTER, true, false));
aggregationFunction.add(Messages.get().TableColumnLabelProvider_SUM);
aggregationFunction.add(Messages.get().TableColumnLabelProvider_AVG);
aggregationFunction.add(Messages.get().TableColumnLabelProvider_MIN);
aggregationFunction.add(Messages.get().TableColumnLabelProvider_MAX);
aggregationFunction.select(column.getAggregationFunction());
checkInstanceColumn = new Button(dialogArea, SWT.CHECK);
checkInstanceColumn.setText(Messages.get().EditColumnDialog_InstanceCol);
checkInstanceColumn.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1));
checkInstanceColumn.setSelection(column.isInstanceColumn());
checkInstanceLabelColumn = new Button(dialogArea, SWT.CHECK);
checkInstanceLabelColumn.setText(Messages.get().EditColumnDialog_InstanceLabelCol);
checkInstanceLabelColumn.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1));
checkInstanceLabelColumn.setSelection(column.isInstanceLabelColumn());
snmpOid = new LabeledText(dialogArea, SWT.NONE);
snmpOid.setLabel(Messages.get().EditColumnDialog_SNMP_OID);
// $NON-NLS-1$
snmpOid.setText((column.getSnmpObjectId() != null) ? column.getSnmpObjectId().toString() : "");
snmpOid.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1));
return dialogArea;
}
use of org.netxms.ui.eclipse.widgets.LabeledText in project netxms by netxms.
the class EditThresholdDialog method createScriptGroup.
/**
* Create "script" group
*/
private void createScriptGroup() {
scriptGroup = new Composite(conditionGroup, SWT.NONE);
scriptGroup.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
GridLayout scriptLayout = new GridLayout();
scriptLayout.numColumns = 2;
scriptLayout.marginHeight = 0;
scriptLayout.marginWidth = 0;
scriptLayout.horizontalSpacing = WidgetHelper.INNER_SPACING;
scriptGroup.setLayout(scriptLayout);
script = new LabeledText(scriptGroup, SWT.NONE);
script.setLabel(Messages.get().EditThresholdDialog_Script);
script.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
script.setText(savedScript != null ? savedScript : threshold.getScript());
final Button editButton = new Button(scriptGroup, SWT.PUSH);
editButton.setImage(SharedIcons.IMG_EDIT);
GridData gd = new GridData();
gd.verticalAlignment = SWT.BOTTOM;
gd.horizontalAlignment = SWT.FILL;
gd.heightHint = script.getTextControl().computeSize(SWT.DEFAULT, SWT.DEFAULT).y;
editButton.setLayoutData(gd);
editButton.setToolTipText(Messages.get().EditThresholdDialog_OpenScriptEditor);
editButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
openScriptEditor();
}
});
final Listener keyListener = new Listener() {
private boolean disabled = false;
@Override
public void handleEvent(Event e) {
if (((e.stateMask & SWT.MOD1) == SWT.CTRL) && (e.keyCode == 'e')) {
if (disabled)
return;
disabled = true;
openScriptEditor();
disabled = false;
}
}
};
editButton.getDisplay().addFilter(SWT.KeyDown, keyListener);
editButton.addDisposeListener(new DisposeListener() {
@Override
public void widgetDisposed(DisposeEvent e) {
editButton.getDisplay().removeFilter(SWT.KeyDown, keyListener);
}
});
value = WidgetHelper.createLabeledText(conditionGroup, SWT.BORDER, 120, Messages.get().EditThresholdDialog_Value, (savedValue != null) ? savedValue : threshold.getValue(), WidgetHelper.DEFAULT_LAYOUT_DATA);
}
use of org.netxms.ui.eclipse.widgets.LabeledText in project netxms by netxms.
the class EditDciSummaryTableColumnDlg 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);
name = new LabeledText(dialogArea, SWT.NONE);
name.setLabel(Messages.get().EditDciSummaryTableColumnDlg_Name);
name.getTextControl().setTextLimit(127);
GridData gd = new GridData();
gd.horizontalAlignment = SWT.FILL;
gd.grabExcessHorizontalSpace = true;
gd.widthHint = 300;
name.setLayoutData(gd);
name.setText(column.getName());
dciName = new LabeledText(dialogArea, SWT.NONE);
dciName.setLabel(Messages.get().EditDciSummaryTableColumnDlg_DciName);
dciName.getTextControl().setTextLimit(255);
gd = new GridData();
gd.horizontalAlignment = SWT.FILL;
gd.grabExcessHorizontalSpace = true;
dciName.setLayoutData(gd);
dciName.setText(column.getDciName());
checkRegexpMatch = new Button(dialogArea, SWT.CHECK);
checkRegexpMatch.setText(Messages.get().EditDciSummaryTableColumnDlg_UseRegExp);
checkRegexpMatch.setSelection(column.isRegexpMatch());
checkMultivalued = new Button(dialogArea, SWT.CHECK);
checkMultivalued.setText("&Multivalued column");
checkMultivalued.setSelection(column.isMultivalued());
checkMultivalued.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
separator.setEnabled(checkMultivalued.getSelection());
}
});
separator = new LabeledText(dialogArea, SWT.NONE);
separator.setLabel("&Separator for multiple values");
separator.getTextControl().setTextLimit(15);
gd = new GridData();
gd.horizontalAlignment = SWT.FILL;
gd.grabExcessHorizontalSpace = true;
separator.setLayoutData(gd);
separator.setText(column.getSeparator());
separator.setEnabled(column.isMultivalued());
return dialogArea;
}
use of org.netxms.ui.eclipse.widgets.LabeledText in project netxms by netxms.
the class RuleAlarm method createContents.
/* (non-Javadoc)
* @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
*/
@Override
protected Control createContents(Composite parent) {
editor = (RuleEditor) getElement().getAdapter(RuleEditor.class);
rule = editor.getRule();
alarmAction = calculateAlarmAction();
dialogArea = new Composite(parent, SWT.NONE);
GridLayout layout = new GridLayout();
layout.verticalSpacing = WidgetHelper.OUTER_SPACING * 2;
dialogArea.setLayout(layout);
Composite radioGroup = new Composite(dialogArea, SWT.NONE);
RowLayout rbLayout = new RowLayout(SWT.VERTICAL);
rbLayout.marginBottom = 0;
rbLayout.marginTop = 0;
rbLayout.marginLeft = 0;
rbLayout.marginRight = 0;
radioGroup.setLayout(rbLayout);
GridData gd = new GridData();
gd.verticalAlignment = SWT.TOP;
radioGroup.setLayoutData(gd);
alarmNoAction = new Button(radioGroup, SWT.RADIO);
alarmNoAction.setText(Messages.get().RuleAlarm_DoNotChange);
alarmNoAction.setSelection(alarmAction == ALARM_NO_ACTION);
alarmNoAction.addSelectionListener(new SelectionListener() {
@Override
public void widgetSelected(SelectionEvent e) {
changeAlarmAction(ALARM_NO_ACTION);
}
@Override
public void widgetDefaultSelected(SelectionEvent e) {
widgetSelected(e);
}
});
alarmCreate = new Button(radioGroup, SWT.RADIO);
alarmCreate.setText(Messages.get().RuleAlarm_CreateNew);
alarmCreate.setSelection(alarmAction == ALARM_CREATE);
alarmCreate.addSelectionListener(new SelectionListener() {
@Override
public void widgetSelected(SelectionEvent e) {
changeAlarmAction(ALARM_CREATE);
}
@Override
public void widgetDefaultSelected(SelectionEvent e) {
widgetSelected(e);
}
});
alarmResolve = new Button(radioGroup, SWT.RADIO);
alarmResolve.setText(Messages.get().RuleAlarm_Resolve);
alarmResolve.setSelection(alarmAction == ALARM_RESOLVE);
alarmResolve.addSelectionListener(new SelectionListener() {
@Override
public void widgetSelected(SelectionEvent e) {
changeAlarmAction(ALARM_RESOLVE);
}
@Override
public void widgetDefaultSelected(SelectionEvent e) {
widgetSelected(e);
}
});
alarmTerminate = new Button(radioGroup, SWT.RADIO);
alarmTerminate.setText(Messages.get().RuleAlarm_Terminate);
alarmTerminate.setSelection(alarmAction == ALARM_TERMINATE);
alarmTerminate.addSelectionListener(new SelectionListener() {
@Override
public void widgetSelected(SelectionEvent e) {
changeAlarmAction(ALARM_TERMINATE);
}
@Override
public void widgetDefaultSelected(SelectionEvent e) {
widgetSelected(e);
}
});
alarmCreationGroup = new Composite(dialogArea, SWT.NONE);
gd = new GridData();
gd.grabExcessHorizontalSpace = true;
gd.horizontalAlignment = SWT.FILL;
gd.verticalAlignment = SWT.TOP;
gd.exclude = (alarmAction != ALARM_CREATE);
alarmCreationGroup.setLayoutData(gd);
alarmCreationGroup.setVisible(alarmAction == ALARM_CREATE);
layout = new GridLayout();
layout.verticalSpacing = WidgetHelper.OUTER_SPACING;
layout.marginHeight = 0;
layout.marginWidth = 0;
alarmCreationGroup.setLayout(layout);
alarmMessage = new LabeledText(alarmCreationGroup, SWT.NONE);
alarmMessage.setLabel(Messages.get().RuleAlarm_Message);
alarmMessage.setText(rule.getAlarmMessage());
gd = new GridData();
gd.grabExcessHorizontalSpace = true;
gd.horizontalAlignment = SWT.FILL;
alarmMessage.setLayoutData(gd);
alarmKeyCreate = new LabeledText(alarmCreationGroup, SWT.NONE);
alarmKeyCreate.setLabel(Messages.get().RuleAlarm_Key);
alarmKeyCreate.setText(rule.getAlarmKey());
gd = new GridData();
gd.grabExcessHorizontalSpace = true;
gd.horizontalAlignment = SWT.FILL;
alarmKeyCreate.setLayoutData(gd);
Composite alarmCreationSubgroup = new Composite(alarmCreationGroup, SWT.NONE);
layout = new GridLayout();
layout.numColumns = 2;
layout.makeColumnsEqualWidth = true;
layout.marginHeight = 0;
layout.marginWidth = 0;
alarmCreationSubgroup.setLayout(layout);
gd = new GridData();
gd.grabExcessHorizontalSpace = true;
gd.horizontalAlignment = SWT.FILL;
alarmCreationSubgroup.setLayoutData(gd);
Composite severityGroup = new Composite(alarmCreationSubgroup, SWT.NONE);
layout = new GridLayout();
layout.marginHeight = 0;
layout.marginWidth = 0;
layout.verticalSpacing = WidgetHelper.INNER_SPACING;
severityGroup.setLayout(layout);
gd = new GridData();
gd.grabExcessHorizontalSpace = true;
gd.horizontalAlignment = SWT.FILL;
severityGroup.setLayoutData(gd);
new Label(severityGroup, SWT.NONE).setText(Messages.get().RuleAlarm_Severity);
alarmSeverity = new Combo(severityGroup, SWT.DROP_DOWN | SWT.READ_ONLY | SWT.BORDER);
for (int i = 0; i < Severity.UNKNOWN.getValue(); i++) alarmSeverity.add(StatusDisplayInfo.getStatusText(i));
alarmSeverity.add(Messages.get().RuleAlarm_FromEvent);
alarmSeverity.select(rule.getAlarmSeverity().getValue());
gd = new GridData();
gd.grabExcessHorizontalSpace = true;
gd.horizontalAlignment = SWT.FILL;
alarmSeverity.setLayoutData(gd);
alarmTimeout = new LabeledText(alarmCreationSubgroup, SWT.NONE);
alarmTimeout.setLabel(Messages.get().RuleAlarm_Timeout);
alarmTimeout.getTextControl().setTextLimit(5);
alarmTimeout.setText(Integer.toString(rule.getAlarmTimeout()));
gd = new GridData();
gd.grabExcessHorizontalSpace = true;
gd.horizontalAlignment = SWT.FILL;
alarmTimeout.setLayoutData(gd);
timeoutEvent = new EventSelector(alarmCreationGroup, SWT.NONE);
timeoutEvent.setLabel(Messages.get().RuleAlarm_TimeoutEvent);
timeoutEvent.setEventCode(rule.getAlarmTimeoutEvent());
gd = new GridData();
gd.grabExcessHorizontalSpace = true;
gd.horizontalAlignment = SWT.FILL;
timeoutEvent.setLayoutData(gd);
alarmCategory = new AlarmCategorySelector(alarmCreationGroup, SWT.NONE);
alarmCategory.setLabel("Alarm category");
alarmCategory.setCategoryId(rule.getAlarmCategories());
gd = new GridData();
gd.grabExcessHorizontalSpace = true;
gd.horizontalAlignment = SWT.FILL;
alarmCategory.setLayoutData(gd);
checkCreateHelpdeskTicket = new Button(alarmCreationGroup, SWT.CHECK);
checkCreateHelpdeskTicket.setText("Create helpdesk ticket on alarm creation");
checkCreateHelpdeskTicket.setSelection((rule.getFlags() & EventProcessingPolicyRule.CREATE_TICKET) != 0);
gd = new GridData();
gd.horizontalAlignment = SWT.LEFT;
checkCreateHelpdeskTicket.setLayoutData(gd);
alarmTerminationGroup = new Composite(dialogArea, SWT.NONE);
gd = new GridData();
gd.grabExcessHorizontalSpace = true;
gd.horizontalAlignment = SWT.FILL;
gd.verticalAlignment = SWT.TOP;
gd.exclude = ((alarmAction != ALARM_TERMINATE) && (alarmAction != ALARM_RESOLVE));
alarmTerminationGroup.setLayoutData(gd);
alarmTerminationGroup.setVisible((alarmAction == ALARM_TERMINATE) || (alarmAction == ALARM_RESOLVE));
layout = new GridLayout();
layout.verticalSpacing = WidgetHelper.OUTER_SPACING;
layout.marginHeight = 0;
layout.marginWidth = 0;
alarmTerminationGroup.setLayout(layout);
alarmKeyTerminate = new LabeledText(alarmTerminationGroup, SWT.NONE);
alarmKeyTerminate.setLabel((alarmAction == ALARM_TERMINATE) ? Messages.get().RuleAlarm_TerminateAll : Messages.get().RuleAlarm_ResolveAll);
alarmKeyTerminate.setText(rule.getAlarmKey());
gd = new GridData();
gd.horizontalAlignment = SWT.FILL;
gd.grabExcessHorizontalSpace = true;
alarmKeyTerminate.setLayoutData(gd);
checkTerminateWithRegexp = new Button(alarmTerminationGroup, SWT.CHECK);
checkTerminateWithRegexp.setText((alarmAction == ALARM_TERMINATE) ? Messages.get().RuleAlarm_UseRegexpForTerminate : Messages.get().RuleAlarm_UseRegexpForResolve);
checkTerminateWithRegexp.setSelection((rule.getFlags() & EventProcessingPolicyRule.TERMINATE_BY_REGEXP) != 0);
return dialogArea;
}
use of org.netxms.ui.eclipse.widgets.LabeledText 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;
}
Aggregations