use of org.netxms.ui.eclipse.widgets.TimePeriodSelector in project netxms by netxms.
the class TimeSelectionDialog 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);
timeSelector = new TimePeriodSelector(dialogArea, SWT.NONE, timePeriod);
GridData gd = new GridData();
gd.horizontalAlignment = SWT.FILL;
gd.grabExcessHorizontalSpace = true;
timeSelector.setLayoutData(gd);
return dialogArea;
}
use of org.netxms.ui.eclipse.widgets.TimePeriodSelector 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