use of org.eclipse.swt.widgets.Spinner in project netxms by netxms.
the class NetworkMap method createContents.
/* (non-Javadoc)
* @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
*/
@Override
protected Control createContents(Composite parent) {
config = (NetworkMapConfig) getElement().getAdapter(NetworkMapConfig.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(Messages.get().NetworkMap_NetworkMap);
objectSelector.setObjectClass(org.netxms.client.objects.NetworkMap.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(Messages.get().NetworkMap_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(Messages.get().NetworkMap_ZoomLevel);
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(Messages.get().NetworkMap_EnableDoubleClickAction);
enableObjectDoubleClick.setSelection(config.isObjectDoubleClickEnabled());
return dialogArea;
}
use of org.eclipse.swt.widgets.Spinner in project netxms by netxms.
the class ConditionDciEditDialog 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;
dialogArea.setLayout(layout);
LabeledText node = new LabeledText(dialogArea, SWT.NONE, SWT.BORDER | SWT.READ_ONLY);
node.setLabel(Messages.get().ConditionDciEditDialog_Node);
node.setText(nodeName);
GridData gd = new GridData();
gd.horizontalSpan = 2;
gd.horizontalAlignment = SWT.FILL;
gd.grabExcessHorizontalSpace = true;
gd.widthHint = 400;
node.setLayoutData(gd);
LabeledText parameter = new LabeledText(dialogArea, SWT.NONE, SWT.BORDER | SWT.READ_ONLY);
parameter.setLabel(Messages.get().ConditionDciEditDialog_Parameter);
parameter.setText(dciName);
gd = new GridData();
gd.horizontalSpan = 2;
gd.horizontalAlignment = SWT.FILL;
gd.grabExcessHorizontalSpace = true;
parameter.setLayoutData(gd);
if (dci.getType() != DataCollectionObject.DCO_TYPE_TABLE) {
gd = new GridData();
gd.horizontalAlignment = SWT.FILL;
gd.grabExcessHorizontalSpace = true;
function = WidgetHelper.createLabeledCombo(dialogArea, SWT.NONE, Messages.get().ConditionDciEditDialog_Function, gd);
function.add(Messages.get().ConditionDciEditDialog_FuncLast);
function.add(Messages.get().ConditionDciEditDialog_FuncAvg);
function.add(Messages.get().ConditionDciEditDialog_FuncDeviation);
function.add(Messages.get().ConditionDciEditDialog_FuncDiff);
function.add(Messages.get().ConditionDciEditDialog_FuncError);
function.add(Messages.get().ConditionDciEditDialog_FuncSum);
function.select(dci.getFunction());
function.addSelectionListener(new SelectionListener() {
@Override
public void widgetSelected(SelectionEvent e) {
polls.setEnabled(isFunctionWithArgs());
}
@Override
public void widgetDefaultSelected(SelectionEvent e) {
widgetSelected(e);
}
});
final WidgetFactory factory = new WidgetFactory() {
@Override
public Control createControl(Composite parent, int style) {
Spinner spinner = new Spinner(parent, style);
spinner.setMinimum(1);
spinner.setMaximum(255);
return spinner;
}
};
polls = (Spinner) WidgetHelper.createLabeledControl(dialogArea, SWT.BORDER, factory, Messages.get().ConditionDciEditDialog_Polls, gd);
polls.setSelection(dci.getPolls());
polls.setEnabled(isFunctionWithArgs());
}
return dialogArea;
}
use of org.eclipse.swt.widgets.Spinner in project netxms by netxms.
the class ParamMappingEditDialog 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.OUTER_SPACING;
dialogArea.setLayout(layout);
description = WidgetHelper.createLabeledText(dialogArea, SWT.BORDER, 300, Messages.get().ParamMappingEditDialog_Description, pm.getDescription(), WidgetHelper.DEFAULT_LAYOUT_DATA);
Group varbind = new Group(dialogArea, SWT.NONE);
varbind.setText(Messages.get().ParamMappingEditDialog_Varbind);
GridData gd = new GridData();
gd.horizontalAlignment = SWT.FILL;
gd.grabExcessHorizontalSpace = true;
varbind.setLayoutData(gd);
layout = new GridLayout();
layout.verticalSpacing = WidgetHelper.OUTER_SPACING;
varbind.setLayout(layout);
radioByOid = new Button(varbind, SWT.RADIO);
radioByOid.setText(Messages.get().ParamMappingEditDialog_ByOID);
radioByOid.setSelection(pm.getType() == SnmpTrapParameterMapping.BY_OBJECT_ID);
radioByOid.addSelectionListener(new SelectionListener() {
@Override
public void widgetSelected(SelectionEvent e) {
enableControls(radioByOid.getSelection());
}
@Override
public void widgetDefaultSelected(SelectionEvent e) {
widgetSelected(e);
}
});
Composite oidSelection = new Composite(varbind, SWT.NONE);
layout = new GridLayout();
layout.horizontalSpacing = WidgetHelper.INNER_SPACING;
layout.marginHeight = 0;
layout.marginWidth = 0;
layout.numColumns = 2;
oidSelection.setLayout(layout);
objectId = new Text(oidSelection, SWT.BORDER);
if (pm.getType() == SnmpTrapParameterMapping.BY_OBJECT_ID)
objectId.setText(pm.getObjectId().toString());
gd = new GridData();
gd.horizontalAlignment = SWT.FILL;
gd.grabExcessHorizontalSpace = true;
gd.widthHint = 300;
objectId.setLayoutData(gd);
buttonSelect = new Button(oidSelection, SWT.PUSH);
buttonSelect.setText(Messages.get().ParamMappingEditDialog_Select);
gd = new GridData();
gd.widthHint = WidgetHelper.BUTTON_WIDTH_HINT;
buttonSelect.setLayoutData(gd);
buttonSelect.addSelectionListener(new SelectionListener() {
@Override
public void widgetSelected(SelectionEvent e) {
selectObjectId();
}
@Override
public void widgetDefaultSelected(SelectionEvent e) {
widgetSelected(e);
}
});
radioByPosition = new Button(varbind, SWT.RADIO);
radioByPosition.setText(Messages.get().ParamMappingEditDialog_ByPos);
radioByPosition.setSelection(pm.getType() == SnmpTrapParameterMapping.BY_POSITION);
radioByPosition.addSelectionListener(new SelectionListener() {
@Override
public void widgetSelected(SelectionEvent e) {
enableControls(!radioByPosition.getSelection());
}
@Override
public void widgetDefaultSelected(SelectionEvent e) {
widgetSelected(e);
}
});
Composite positionSelection = new Composite(varbind, SWT.NONE);
layout = new GridLayout();
layout.horizontalSpacing = WidgetHelper.OUTER_SPACING;
layout.marginHeight = 0;
layout.marginWidth = 0;
layout.numColumns = 2;
positionSelection.setLayout(layout);
position = new Spinner(positionSelection, SWT.BORDER);
position.setIncrement(1);
position.setMaximum(255);
position.setMinimum(1);
gd = new GridData();
gd.widthHint = 40;
position.setLayoutData(gd);
new Label(positionSelection, SWT.NONE).setText(Messages.get().ParamMappingEditDialog_EnterVarbindPos);
final Group optionsGroup = new Group(dialogArea, SWT.NONE);
optionsGroup.setText(Messages.get().ParamMappingEditDialog_Options);
gd = new GridData();
gd.horizontalAlignment = SWT.FILL;
gd.grabExcessHorizontalSpace = true;
optionsGroup.setLayoutData(gd);
optionsGroup.setLayout(new RowLayout(SWT.VERTICAL));
checkForceText = new Button(optionsGroup, SWT.CHECK);
checkForceText.setText(Messages.get().ParamMappingEditDialog_NeverConvertToHex);
checkForceText.setSelection((pm.getFlags() & SnmpTrapParameterMapping.FORCE_TEXT) != 0);
enableControls(pm.getType() == SnmpTrapParameterMapping.BY_OBJECT_ID);
return dialogArea;
}
use of org.eclipse.swt.widgets.Spinner in project netxms by netxms.
the class NumericConditionFieldEditor method createContent.
/* (non-Javadoc)
* @see org.netxms.ui.eclipse.reporter.widgets.FieldEditor#createContent(org.eclipse.swt.widgets.Composite)
*/
@Override
protected Control createContent(Composite parent) {
Composite content = toolkit.createComposite(parent, SWT.NONE);
GridLayout layout = new GridLayout();
layout.numColumns = 2;
layout.horizontalSpacing = WidgetHelper.INNER_SPACING;
layout.marginHeight = 0;
layout.marginWidth = 0;
content.setLayout(layout);
condition = new Combo(content, SWT.BORDER | SWT.DROP_DOWN | SWT.READ_ONLY);
// $NON-NLS-1$
condition.add("=");
// $NON-NLS-1$
condition.add("<>");
// $NON-NLS-1$
condition.add("<");
// $NON-NLS-1$
condition.add("<=");
// $NON-NLS-1$
condition.add(">");
// $NON-NLS-1$
condition.add(">=");
condition.select(0);
condition.setLayoutData(new GridData(SWT.FILL, SWT.BOTTOM, false, false));
value = new Spinner(content, SWT.BORDER);
value.setSelection(0);
value.setLayoutData(new GridData(SWT.FILL, SWT.BOTTOM, true, false));
return content;
}
use of org.eclipse.swt.widgets.Spinner 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) {
config = (ChartConfig) getElement().getAdapter(ChartConfig.class);
Composite dialogArea = new Composite(parent, SWT.NONE);
GridLayout layout = new GridLayout();
layout.verticalSpacing = WidgetHelper.OUTER_SPACING;
layout.marginWidth = 0;
layout.marginHeight = 0;
dialogArea.setLayout(layout);
title = new LabeledText(dialogArea, SWT.NONE, SWT.BORDER);
title.setLabel(Messages.get().General_Title);
title.setText(config.getTitle());
GridData gd = new GridData();
gd.horizontalAlignment = SWT.FILL;
gd.grabExcessHorizontalSpace = true;
title.setLayoutData(gd);
Group optionsGroup = new Group(dialogArea, SWT.NONE);
optionsGroup.setText(Messages.get().General_Options);
layout = new GridLayout();
layout.marginWidth = WidgetHelper.OUTER_SPACING;
layout.marginHeight = WidgetHelper.OUTER_SPACING;
layout.verticalSpacing = WidgetHelper.OUTER_SPACING;
layout.makeColumnsEqualWidth = true;
layout.numColumns = 3;
optionsGroup.setLayout(layout);
gd = new GridData();
gd.horizontalAlignment = SWT.FILL;
gd.grabExcessHorizontalSpace = true;
optionsGroup.setLayoutData(gd);
checkShowGrid = new Button(optionsGroup, SWT.CHECK);
checkShowGrid.setText(Messages.get().General_ShowGridLines);
checkShowGrid.setSelection(config.isShowGrid());
checkLogScale = new Button(optionsGroup, SWT.CHECK);
checkLogScale.setText(Messages.get().General_LogScale);
checkLogScale.setSelection(config.isLogScale());
lineWidth = new LabeledSpinner(optionsGroup, SWT.NONE);
lineWidth.setLabel(Messages.get().General_LineWidth);
lineWidth.setRange(1, 99);
lineWidth.setSelection(config.getLineWidth());
gd = new GridData();
gd.verticalAlignment = SWT.TOP;
gd.verticalSpan = 2;
lineWidth.setLayoutData(gd);
checkStacked = new Button(optionsGroup, SWT.CHECK);
checkStacked.setText(Messages.get().General_Stacked);
checkStacked.setSelection(config.isStacked());
checkTranslucent = new Button(optionsGroup, SWT.CHECK);
checkTranslucent.setText(Messages.get().General_Translucent);
checkTranslucent.setSelection(config.isTranslucent());
checkShowLegend = new Button(optionsGroup, SWT.CHECK);
checkShowLegend.setText(Messages.get().General_ShowLegend);
checkShowLegend.setSelection(config.isShowLegend());
checkShowLegend.addSelectionListener(new SelectionListener() {
@Override
public void widgetSelected(SelectionEvent e) {
checkExtendedLegend.setEnabled(checkShowLegend.getSelection());
legendLocation.setEnabled(checkShowLegend.getSelection());
checkShowHostNames.setEnabled(checkShowLegend.getSelection());
}
@Override
public void widgetDefaultSelected(SelectionEvent e) {
widgetSelected(e);
}
});
checkShowHostNames = new Button(optionsGroup, SWT.CHECK);
checkShowHostNames.setText(Messages.get().General_ShowHostNames);
checkShowHostNames.setSelection(config.isShowHostNames());
checkShowHostNames.setEnabled(config.isShowLegend());
gd = new GridData();
gd.horizontalAlignment = GridData.FILL;
gd.grabExcessHorizontalSpace = true;
gd.verticalSpan = 2;
gd.verticalAlignment = SWT.TOP;
legendLocation = WidgetHelper.createLabeledCombo(optionsGroup, SWT.READ_ONLY, Messages.get().General_LegendPosition, gd);
legendLocation.add(Messages.get().General_Left);
legendLocation.add(Messages.get().General_Right);
legendLocation.add(Messages.get().General_Top);
legendLocation.add(Messages.get().General_Bottom);
legendLocation.select(31 - Integer.numberOfLeadingZeros(config.getLegendPosition()));
legendLocation.setEnabled(config.isShowLegend());
checkExtendedLegend = new Button(optionsGroup, SWT.CHECK);
checkExtendedLegend.setText(Messages.get().General_8);
checkExtendedLegend.setSelection(config.isExtendedLegend());
checkExtendedLegend.setEnabled(config.isShowLegend());
checkAreaChart = new Button(optionsGroup, SWT.CHECK);
checkAreaChart.setText("Area chart");
checkAreaChart.setSelection(config.isArea());
checkUseMultipliers = new Button(optionsGroup, SWT.CHECK);
checkUseMultipliers.setText("Use multipliers");
checkUseMultipliers.setSelection(config.isUseMultipliers());
Composite refreshGroup = new Composite(optionsGroup, SWT.NONE);
layout = new GridLayout();
layout.horizontalSpacing = WidgetHelper.OUTER_SPACING;
layout.marginHeight = 0;
layout.marginWidth = 0;
layout.marginTop = WidgetHelper.OUTER_SPACING;
refreshGroup.setLayout(layout);
gd = new GridData();
gd.horizontalAlignment = SWT.FILL;
gd.grabExcessHorizontalSpace = true;
gd.horizontalSpan = 3;
refreshGroup.setLayoutData(gd);
checkAutoRefresh = new Button(refreshGroup, SWT.CHECK);
checkAutoRefresh.setText(Messages.get().General_Autorefresh);
checkAutoRefresh.setSelection(config.isAutoRefresh());
checkAutoRefresh.addSelectionListener(new SelectionListener() {
@Override
public void widgetSelected(SelectionEvent e) {
refreshIntervalSpinner.setEnabled(checkAutoRefresh.getSelection());
refreshIntervalScale.setEnabled(checkAutoRefresh.getSelection());
}
@Override
public void widgetDefaultSelected(SelectionEvent e) {
widgetSelected(e);
}
});
Composite refreshIntervalGroup = new Composite(refreshGroup, SWT.NONE);
layout = new GridLayout();
layout.numColumns = 2;
layout.horizontalSpacing = WidgetHelper.OUTER_SPACING;
layout.marginHeight = 0;
layout.marginWidth = 0;
layout.marginTop = WidgetHelper.OUTER_SPACING;
refreshIntervalGroup.setLayout(layout);
gd = new GridData();
gd.horizontalAlignment = SWT.FILL;
gd.grabExcessHorizontalSpace = true;
gd.horizontalSpan = 2;
refreshIntervalGroup.setLayoutData(gd);
Label label = new Label(refreshIntervalGroup, SWT.NONE);
label.setText(Messages.get().General_RefreshInterval);
gd = new GridData();
gd.horizontalAlignment = SWT.LEFT;
gd.horizontalSpan = 2;
label.setLayoutData(gd);
refreshIntervalScale = new Scale(refreshIntervalGroup, SWT.HORIZONTAL);
refreshIntervalScale.setMinimum(1);
refreshIntervalScale.setMaximum(600);
refreshIntervalScale.setSelection(config.getRefreshRate());
gd = new GridData();
gd.horizontalAlignment = SWT.FILL;
gd.grabExcessHorizontalSpace = true;
refreshIntervalScale.setLayoutData(gd);
refreshIntervalScale.addSelectionListener(new SelectionListener() {
@Override
public void widgetSelected(SelectionEvent e) {
refreshIntervalSpinner.setSelection(refreshIntervalScale.getSelection());
}
@Override
public void widgetDefaultSelected(SelectionEvent e) {
widgetSelected(e);
}
});
refreshIntervalScale.setEnabled(config.isAutoRefresh());
refreshIntervalSpinner = new Spinner(refreshIntervalGroup, SWT.BORDER);
refreshIntervalSpinner.setMinimum(1);
refreshIntervalSpinner.setMaximum(600);
refreshIntervalSpinner.setSelection(config.getRefreshRate());
refreshIntervalSpinner.addSelectionListener(new SelectionListener() {
@Override
public void widgetSelected(SelectionEvent e) {
refreshIntervalScale.setSelection(refreshIntervalSpinner.getSelection());
}
@Override
public void widgetDefaultSelected(SelectionEvent e) {
widgetSelected(e);
}
});
refreshIntervalSpinner.setEnabled(config.isAutoRefresh());
timeSelector = new TimePeriodSelector(dialogArea, SWT.NONE, config.timePeriod());
gd = new GridData();
gd.horizontalAlignment = SWT.FILL;
gd.grabExcessHorizontalSpace = true;
timeSelector.setLayoutData(gd);
yAxisRange = new YAxisRangeEditor(dialogArea, SWT.NONE);
gd = new GridData();
gd.horizontalAlignment = SWT.FILL;
gd.grabExcessHorizontalSpace = true;
yAxisRange.setLayoutData(gd);
yAxisRange.setSelection(config.isAutoScale(), config.modifyYBase(), config.getMinYScaleValue(), config.getMaxYScaleValue());
return dialogArea;
}
Aggregations