Search in sources :

Example 1 with YAxisRangeEditor

use of org.netxms.ui.eclipse.perfview.widgets.YAxisRangeEditor in project netxms by netxms.

the class PerfTab 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();
    try {
        settings = PerfTabGraphSettings.createFromXml(dci.getPerfTabSettings());
    } catch (Exception e) {
        // Create default empty settings
        settings = new PerfTabGraphSettings();
    }
    GridLayout layout = new GridLayout();
    layout.verticalSpacing = WidgetHelper.OUTER_SPACING;
    layout.marginWidth = 0;
    layout.marginHeight = 0;
    layout.numColumns = 4;
    dialogArea.setLayout(layout);
    checkShow = new Button(dialogArea, SWT.CHECK);
    checkShow.setText(Messages.get().PerfTab_ShowOnPerfTab);
    checkShow.setSelection(settings.isEnabled());
    GridData gd = new GridData();
    gd.horizontalSpan = layout.numColumns;
    checkShow.setLayoutData(gd);
    title = new LabeledText(dialogArea, SWT.NONE);
    title.setLabel(Messages.get().PerfTab_Title);
    title.setText(settings.getTitle());
    gd = new GridData();
    gd.grabExcessHorizontalSpace = true;
    gd.horizontalAlignment = SWT.FILL;
    title.setLayoutData(gd);
    Composite colors = new Composite(dialogArea, SWT.NONE);
    colors.setLayout(new RowLayout(SWT.VERTICAL));
    new Label(colors, SWT.NONE).setText(Messages.get().PerfTab_Color);
    color = new ColorSelector(colors);
    color.setColorValue(ColorConverter.rgbFromInt(settings.getColorAsInt()));
    type = WidgetHelper.createLabeledCombo(dialogArea, SWT.READ_ONLY, Messages.get().PerfTab_Type, new GridData(SWT.LEFT, SWT.CENTER, false, false));
    type.add(Messages.get().PerfTab_Line);
    type.add(Messages.get().PerfTab_Area);
    type.select(settings.getType());
    orderNumber = WidgetHelper.createLabeledSpinner(dialogArea, SWT.BORDER, Messages.get().PerfTab_Order, 0, 65535, new GridData(SWT.LEFT, SWT.CENTER, false, false));
    orderNumber.setSelection(settings.getOrder());
    groupName = new LabeledText(dialogArea, SWT.NONE);
    groupName.setLabel("Group");
    groupName.setText(settings.getGroupName());
    gd = new GridData();
    gd.horizontalSpan = layout.numColumns;
    gd.grabExcessHorizontalSpace = true;
    gd.horizontalAlignment = SWT.FILL;
    groupName.setLayoutData(gd);
    name = new LabeledText(dialogArea, SWT.NONE);
    name.setLabel(Messages.get().PerfTab_NameInLegend);
    name.setText(settings.getName());
    gd = new GridData();
    gd.grabExcessHorizontalSpace = true;
    gd.horizontalAlignment = SWT.FILL;
    gd.horizontalSpan = layout.numColumns;
    name.setLayoutData(gd);
    Group timeGroup = new Group(dialogArea, SWT.NONE);
    timeGroup.setText(Messages.get().PerfTab_TeimePeriod);
    GridLayout timeGroupLayout = new GridLayout();
    timeGroupLayout.marginWidth = WidgetHelper.OUTER_SPACING;
    timeGroupLayout.marginHeight = WidgetHelper.OUTER_SPACING;
    timeGroupLayout.horizontalSpacing = 16;
    timeGroupLayout.makeColumnsEqualWidth = true;
    timeGroupLayout.numColumns = 1;
    timeGroup.setLayout(timeGroupLayout);
    gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    gd.horizontalSpan = timeGroupLayout.numColumns;
    timeGroup.setLayoutData(gd);
    Composite timeRangeArea = new Composite(timeGroup, SWT.NONE);
    timeGroupLayout = new GridLayout();
    timeGroupLayout.numColumns = 2;
    timeGroupLayout.marginWidth = 0;
    timeGroupLayout.marginHeight = 0;
    timeGroupLayout.horizontalSpacing = WidgetHelper.DIALOG_SPACING;
    timeRangeArea.setLayout(timeGroupLayout);
    gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    timeRangeArea.setLayoutData(gd);
    timeRange = WidgetHelper.createLabeledSpinner(timeRangeArea, SWT.BORDER, Messages.get().PerfTab_TimeInterval, 1, 10000, WidgetHelper.DEFAULT_LAYOUT_DATA);
    timeRange.setSelection(settings.getTimeRange());
    timeUnits = WidgetHelper.createLabeledCombo(timeRangeArea, SWT.READ_ONLY, Messages.get().PerfTab_TimeUnits, WidgetHelper.DEFAULT_LAYOUT_DATA);
    timeUnits.add(Messages.get().PerfTab_Minutes);
    timeUnits.add(Messages.get().PerfTab_Hours);
    timeUnits.add(Messages.get().PerfTab_Days);
    timeUnits.select(settings.getTimeUnits());
    Group optionsGroup = new Group(dialogArea, SWT.NONE);
    optionsGroup.setText(Messages.get().PerfTab_Options);
    gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    gd.horizontalSpan = 3;
    gd.verticalSpan = 2;
    optionsGroup.setLayoutData(gd);
    GridLayout optionsLayout = new GridLayout();
    optionsGroup.setLayout(optionsLayout);
    checkShowThresholds = new Button(optionsGroup, SWT.CHECK);
    checkShowThresholds.setText(Messages.get().PerfTab_ShowThresholds);
    checkShowThresholds.setSelection(settings.isShowThresholds());
    gd = new GridData();
    gd.horizontalSpan = layout.numColumns;
    checkShowThresholds.setLayoutData(gd);
    checkLogScale = new Button(optionsGroup, SWT.CHECK);
    checkLogScale.setText(Messages.get().PerfTab_LogarithmicScale);
    checkLogScale.setSelection(settings.isLogScaleEnabled());
    gd = new GridData();
    gd.horizontalSpan = layout.numColumns;
    checkLogScale.setLayoutData(gd);
    checkStacked = new Button(optionsGroup, SWT.CHECK);
    checkStacked.setText("&Stacked");
    checkStacked.setSelection(settings.isStacked());
    gd = new GridData();
    gd.horizontalSpan = layout.numColumns;
    checkStacked.setLayoutData(gd);
    checkShowLegendAlways = new Button(optionsGroup, SWT.CHECK);
    checkShowLegendAlways.setText("Always show &legend");
    checkShowLegendAlways.setSelection(settings.isShowLegendAlways());
    gd = new GridData();
    gd.horizontalSpan = layout.numColumns;
    checkShowLegendAlways.setLayoutData(gd);
    checkExtendedLegend = new Button(optionsGroup, SWT.CHECK);
    checkExtendedLegend.setText("&Extended legend");
    checkExtendedLegend.setSelection(settings.isExtendedLegend());
    gd = new GridData();
    gd.horizontalSpan = layout.numColumns;
    checkExtendedLegend.setLayoutData(gd);
    checkInvertValues = new Button(optionsGroup, SWT.CHECK);
    checkInvertValues.setText("&Inverted values");
    checkInvertValues.setSelection(settings.isInvertedValues());
    gd = new GridData();
    gd.horizontalSpan = layout.numColumns;
    checkInvertValues.setLayoutData(gd);
    yAxisRange = new YAxisRangeEditor(dialogArea, SWT.NONE);
    gd = new GridData();
    gd.horizontalSpan = layout.numColumns;
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    yAxisRange.setLayoutData(gd);
    yAxisRange.setSelection(settings.isAutoScale(), settings.modifyYBase(), settings.getMinYScaleValue(), settings.getMaxYScaleValue());
    return dialogArea;
}
Also used : Group(org.eclipse.swt.widgets.Group) GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) Button(org.eclipse.swt.widgets.Button) LabeledText(org.netxms.ui.eclipse.widgets.LabeledText) RowLayout(org.eclipse.swt.layout.RowLayout) PerfTabGraphSettings(org.netxms.ui.eclipse.perfview.PerfTabGraphSettings) GridData(org.eclipse.swt.layout.GridData) Label(org.eclipse.swt.widgets.Label) YAxisRangeEditor(org.netxms.ui.eclipse.perfview.widgets.YAxisRangeEditor) ColorSelector(org.eclipse.jface.preference.ColorSelector)

Example 2 with YAxisRangeEditor

use of org.netxms.ui.eclipse.perfview.widgets.YAxisRangeEditor 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;
}
Also used : Group(org.eclipse.swt.widgets.Group) Composite(org.eclipse.swt.widgets.Composite) LabeledText(org.netxms.ui.eclipse.widgets.LabeledText) Spinner(org.eclipse.swt.widgets.Spinner) LabeledSpinner(org.netxms.ui.eclipse.widgets.LabeledSpinner) Label(org.eclipse.swt.widgets.Label) Scale(org.eclipse.swt.widgets.Scale) LabeledSpinner(org.netxms.ui.eclipse.widgets.LabeledSpinner) GridLayout(org.eclipse.swt.layout.GridLayout) Button(org.eclipse.swt.widgets.Button) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) YAxisRangeEditor(org.netxms.ui.eclipse.perfview.widgets.YAxisRangeEditor) TimePeriodSelector(org.netxms.ui.eclipse.widgets.TimePeriodSelector) SelectionListener(org.eclipse.swt.events.SelectionListener)

Example 3 with YAxisRangeEditor

use of org.netxms.ui.eclipse.perfview.widgets.YAxisRangeEditor in project netxms by netxms.

the class TableComparisonChart method createContents.

/* (non-Javadoc)
	 * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
	 */
@Override
protected Control createContents(Composite parent) {
    config = (TableComparisonChartConfig) getElement().getAdapter(TableComparisonChartConfig.class);
    Composite dialogArea = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.numColumns = 2;
    layout.makeColumnsEqualWidth = true;
    dialogArea.setLayout(layout);
    title = new LabeledText(dialogArea, SWT.NONE);
    title.setLabel(Messages.get().TableComparisonChart_Title);
    title.setText(config.getTitle());
    GridData gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    gd.horizontalSpan = 2;
    title.setLayoutData(gd);
    legendPosition = WidgetHelper.createLabeledCombo(dialogArea, SWT.READ_ONLY, Messages.get().TableComparisonChart_LegendPosition, WidgetHelper.DEFAULT_LAYOUT_DATA);
    legendPosition.add(Messages.get().TableComparisonChart_Left);
    legendPosition.add(Messages.get().TableComparisonChart_Right);
    legendPosition.add(Messages.get().TableComparisonChart_Top);
    legendPosition.add(Messages.get().TableComparisonChart_Bottom);
    legendPosition.select(positionIndexFromValue(config.getLegendPosition()));
    Group optionsGroup = new Group(dialogArea, SWT.NONE);
    optionsGroup.setText(Messages.get().TableComparisonChart_Options);
    gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    gd.verticalSpan = 2;
    optionsGroup.setLayoutData(gd);
    GridLayout optionsLayout = new GridLayout();
    optionsGroup.setLayout(optionsLayout);
    checkShowTitle = new Button(optionsGroup, SWT.CHECK);
    checkShowTitle.setText(Messages.get().TableComparisonChart_ShowTitle);
    checkShowTitle.setSelection(config.isShowTitle());
    gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    checkShowTitle.setLayoutData(gd);
    checkShowLegend = new Button(optionsGroup, SWT.CHECK);
    checkShowLegend.setText(Messages.get().TableComparisonChart_ShowLegend);
    checkShowLegend.setSelection(config.isShowLegend());
    gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    checkShowLegend.setLayoutData(gd);
    checkShowIn3D = new Button(optionsGroup, SWT.CHECK);
    checkShowIn3D.setText(Messages.get().TableComparisonChart_3DView);
    checkShowIn3D.setSelection(config.isShowIn3D());
    gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    checkShowIn3D.setLayoutData(gd);
    checkTranslucent = new Button(optionsGroup, SWT.CHECK);
    checkTranslucent.setText(Messages.get().TableComparisonChart_Translucent);
    checkTranslucent.setSelection(config.isTranslucent());
    gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    checkTranslucent.setLayoutData(gd);
    if ((config instanceof TableBarChartConfig) || (config instanceof TableTubeChartConfig)) {
        checkTransposed = new Button(optionsGroup, SWT.CHECK);
        checkTransposed.setText(Messages.get().TableComparisonChart_Transposed);
        checkTransposed.setSelection((config instanceof TableBarChartConfig) ? ((TableBarChartConfig) config).isTransposed() : ((TableTubeChartConfig) config).isTransposed());
        gd = new GridData();
        gd.horizontalAlignment = SWT.FILL;
        gd.grabExcessHorizontalSpace = true;
        checkTransposed.setLayoutData(gd);
    }
    gd = new GridData();
    gd.verticalAlignment = SWT.TOP;
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    refreshRate = WidgetHelper.createLabeledSpinner(dialogArea, SWT.BORDER, Messages.get().TableComparisonChart_RefreshInterval, 1, 10000, gd);
    refreshRate.setSelection(config.getRefreshRate());
    if (!(config instanceof TablePieChartConfig)) {
        yAxisRange = new YAxisRangeEditor(dialogArea, SWT.NONE);
        gd = new GridData();
        gd.horizontalSpan = layout.numColumns;
        gd.horizontalAlignment = SWT.FILL;
        gd.grabExcessHorizontalSpace = true;
        yAxisRange.setLayoutData(gd);
        yAxisRange.setSelection(config.isAutoScale(), config.modifyYBase(), config.getMinYScaleValue(), config.getMaxYScaleValue());
    }
    return dialogArea;
}
Also used : TableBarChartConfig(org.netxms.ui.eclipse.dashboard.widgets.internal.TableBarChartConfig) TableTubeChartConfig(org.netxms.ui.eclipse.dashboard.widgets.internal.TableTubeChartConfig) Group(org.eclipse.swt.widgets.Group) GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) LabeledText(org.netxms.ui.eclipse.widgets.LabeledText) Button(org.eclipse.swt.widgets.Button) GridData(org.eclipse.swt.layout.GridData) YAxisRangeEditor(org.netxms.ui.eclipse.perfview.widgets.YAxisRangeEditor) TablePieChartConfig(org.netxms.ui.eclipse.dashboard.widgets.internal.TablePieChartConfig)

Example 4 with YAxisRangeEditor

use of org.netxms.ui.eclipse.perfview.widgets.YAxisRangeEditor in project netxms by netxms.

the class AbstractChart method createContents.

/* (non-Javadoc)
	 * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
	 */
@Override
protected Control createContents(Composite parent) {
    config = (AbstractChartConfig) getElement().getAdapter(AbstractChartConfig.class);
    Composite dialogArea = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.numColumns = 2;
    layout.makeColumnsEqualWidth = false;
    dialogArea.setLayout(layout);
    title = new LabeledText(dialogArea, SWT.NONE);
    title.setLabel(Messages.get().AbstractChart_Title);
    title.setText(config.getTitle());
    GridData gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    gd.horizontalSpan = 2;
    title.setLayoutData(gd);
    legendPosition = WidgetHelper.createLabeledCombo(dialogArea, SWT.READ_ONLY, Messages.get().AbstractChart_LegendPosition, WidgetHelper.DEFAULT_LAYOUT_DATA);
    legendPosition.add(Messages.get().AbstractChart_Left);
    legendPosition.add(Messages.get().AbstractChart_Right);
    legendPosition.add(Messages.get().AbstractChart_Top);
    legendPosition.add(Messages.get().AbstractChart_Bottom);
    legendPosition.select(positionIndexFromValue(config.getLegendPosition()));
    Group optionsGroup = new Group(dialogArea, SWT.NONE);
    optionsGroup.setText(Messages.get().AbstractChart_Options);
    gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    gd.verticalSpan = (config instanceof LineChartConfig) ? 3 : 2;
    optionsGroup.setLayoutData(gd);
    GridLayout optionsLayout = new GridLayout();
    optionsGroup.setLayout(optionsLayout);
    checkShowTitle = new Button(optionsGroup, SWT.CHECK);
    checkShowTitle.setText(Messages.get().AbstractChart_ShowTitle);
    checkShowTitle.setSelection(config.isShowTitle());
    gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    checkShowTitle.setLayoutData(gd);
    checkShowLegend = new Button(optionsGroup, SWT.CHECK);
    checkShowLegend.setText(Messages.get().AbstractChart_ShowLegend);
    checkShowLegend.setSelection(config.isShowLegend());
    gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    checkShowLegend.setLayoutData(gd);
    if (config instanceof LineChartConfig) {
        checkExtendedLegend = new Button(optionsGroup, SWT.CHECK);
        checkExtendedLegend.setText(Messages.get().AbstractChart_ExtendedLegend);
        checkExtendedLegend.setSelection(((LineChartConfig) config).isExtendedLegend());
        gd = new GridData();
        gd.horizontalAlignment = SWT.FILL;
        gd.grabExcessHorizontalSpace = true;
        checkExtendedLegend.setLayoutData(gd);
        checkLogScale = new Button(optionsGroup, SWT.CHECK);
        checkLogScale.setText(Messages.get().AbstractChart_LogartithmicScale);
        checkLogScale.setSelection(((LineChartConfig) config).isLogScaleEnabled());
        gd = new GridData();
        gd.horizontalSpan = layout.numColumns;
        checkLogScale.setLayoutData(gd);
        checkStacked = new Button(optionsGroup, SWT.CHECK);
        checkStacked.setText(Messages.get().AbstractChart_Stacked);
        checkStacked.setSelection(((LineChartConfig) config).isStacked());
        gd = new GridData();
        gd.horizontalSpan = layout.numColumns;
        checkStacked.setLayoutData(gd);
        checkAreaChart = new Button(optionsGroup, SWT.CHECK);
        checkAreaChart.setText("&Area chart");
        checkAreaChart.setSelection(((LineChartConfig) config).isArea());
        gd = new GridData();
        gd.horizontalSpan = layout.numColumns;
        checkAreaChart.setLayoutData(gd);
    }
    checkTranslucent = new Button(optionsGroup, SWT.CHECK);
    checkTranslucent.setText(Messages.get().AbstractChart_Translucent);
    checkTranslucent.setSelection(config.isTranslucent());
    gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    checkTranslucent.setLayoutData(gd);
    if (config instanceof ComparisonChartConfig) {
        checkShowIn3D = new Button(optionsGroup, SWT.CHECK);
        checkShowIn3D.setText(Messages.get().AbstractChart_3DView);
        checkShowIn3D.setSelection(((ComparisonChartConfig) config).isShowIn3D());
        gd = new GridData();
        gd.horizontalAlignment = SWT.FILL;
        gd.grabExcessHorizontalSpace = true;
        checkShowIn3D.setLayoutData(gd);
        if ((config instanceof BarChartConfig) || (config instanceof TubeChartConfig)) {
            checkTransposed = new Button(optionsGroup, SWT.CHECK);
            checkTransposed.setText(Messages.get().AbstractChart_Transposed);
            checkTransposed.setSelection((config instanceof BarChartConfig) ? ((BarChartConfig) config).isTransposed() : ((TubeChartConfig) config).isTransposed());
            gd = new GridData();
            gd.horizontalAlignment = SWT.FILL;
            gd.grabExcessHorizontalSpace = true;
            checkTransposed.setLayoutData(gd);
        }
    }
    if (config instanceof LineChartConfig) {
        checkShowGrid = new Button(optionsGroup, SWT.CHECK);
        checkShowGrid.setText(Messages.get().AbstractChart_ShowGrid);
        checkShowGrid.setSelection(((LineChartConfig) config).isShowGrid());
        gd = new GridData();
        gd.horizontalAlignment = SWT.FILL;
        gd.grabExcessHorizontalSpace = true;
        checkShowGrid.setLayoutData(gd);
        checkInteractive = new Button(optionsGroup, SWT.CHECK);
        checkInteractive.setText("&Interactive");
        checkInteractive.setSelection(((LineChartConfig) config).isInteractive());
        gd = new GridData();
        gd.horizontalSpan = layout.numColumns;
        checkInteractive.setLayoutData(gd);
        Composite timeRangeArea = new Composite(dialogArea, SWT.NONE);
        layout = new GridLayout();
        layout.numColumns = 2;
        layout.marginWidth = 0;
        layout.marginHeight = 0;
        layout.horizontalSpacing = WidgetHelper.DIALOG_SPACING;
        timeRangeArea.setLayout(layout);
        gd = new GridData();
        gd.horizontalAlignment = SWT.FILL;
        gd.grabExcessHorizontalSpace = true;
        timeRangeArea.setLayoutData(gd);
        timeRange = WidgetHelper.createLabeledSpinner(timeRangeArea, SWT.BORDER, Messages.get().AbstractChart_TimeInterval, 1, 10000, WidgetHelper.DEFAULT_LAYOUT_DATA);
        timeRange.setSelection(((LineChartConfig) config).getTimeRange());
        timeUnits = WidgetHelper.createLabeledCombo(timeRangeArea, SWT.READ_ONLY, Messages.get().AbstractChart_TimeUnits, WidgetHelper.DEFAULT_LAYOUT_DATA);
        timeUnits.add(Messages.get().AbstractChart_Minutes);
        timeUnits.add(Messages.get().AbstractChart_Hours);
        timeUnits.add(Messages.get().AbstractChart_Days);
        timeUnits.select(((LineChartConfig) config).getTimeUnits());
    }
    Composite rateAndWidthArea = new Composite(dialogArea, SWT.NONE);
    layout = new GridLayout();
    layout.numColumns = (config instanceof LineChartConfig) ? 2 : 1;
    layout.marginWidth = 0;
    layout.marginHeight = 0;
    layout.horizontalSpacing = WidgetHelper.DIALOG_SPACING;
    layout.makeColumnsEqualWidth = true;
    rateAndWidthArea.setLayout(layout);
    gd = new GridData();
    gd.verticalAlignment = SWT.TOP;
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    rateAndWidthArea.setLayoutData(gd);
    refreshRate = new LabeledSpinner(rateAndWidthArea, SWT.NONE);
    refreshRate.setLabel(Messages.get().AbstractChart_RefreshInterval);
    refreshRate.setRange(1, 10000);
    refreshRate.setSelection(config.getRefreshRate());
    gd = new GridData();
    gd.verticalAlignment = SWT.TOP;
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    refreshRate.setLayoutData(gd);
    if (config instanceof LineChartConfig) {
        lineWidth = new LabeledSpinner(rateAndWidthArea, SWT.NONE);
        lineWidth.setLabel(Messages.get().AbstractChart_LineWidth);
        lineWidth.setRange(1, 32);
        lineWidth.setSelection(((LineChartConfig) config).getLineWidth());
        gd = new GridData();
        gd.verticalAlignment = SWT.TOP;
        gd.horizontalAlignment = SWT.FILL;
        gd.grabExcessHorizontalSpace = true;
        lineWidth.setLayoutData(gd);
    }
    if (!(config instanceof PieChartConfig)) {
        yAxisRange = new YAxisRangeEditor(dialogArea, SWT.NONE);
        gd = new GridData();
        gd.horizontalSpan = layout.numColumns;
        gd.horizontalAlignment = SWT.FILL;
        gd.grabExcessHorizontalSpace = true;
        yAxisRange.setLayoutData(gd);
        yAxisRange.setSelection(config.isAutoScale(), config.modifyYBase(), config.getMinYScaleValue(), config.getMaxYScaleValue());
    }
    return dialogArea;
}
Also used : Group(org.eclipse.swt.widgets.Group) Composite(org.eclipse.swt.widgets.Composite) LabeledText(org.netxms.ui.eclipse.widgets.LabeledText) BarChartConfig(org.netxms.ui.eclipse.dashboard.widgets.internal.BarChartConfig) TubeChartConfig(org.netxms.ui.eclipse.dashboard.widgets.internal.TubeChartConfig) PieChartConfig(org.netxms.ui.eclipse.dashboard.widgets.internal.PieChartConfig) LabeledSpinner(org.netxms.ui.eclipse.widgets.LabeledSpinner) GridLayout(org.eclipse.swt.layout.GridLayout) ComparisonChartConfig(org.netxms.ui.eclipse.dashboard.widgets.internal.ComparisonChartConfig) Button(org.eclipse.swt.widgets.Button) LineChartConfig(org.netxms.ui.eclipse.dashboard.widgets.internal.LineChartConfig) GridData(org.eclipse.swt.layout.GridData) YAxisRangeEditor(org.netxms.ui.eclipse.perfview.widgets.YAxisRangeEditor)

Aggregations

GridData (org.eclipse.swt.layout.GridData)4 GridLayout (org.eclipse.swt.layout.GridLayout)4 Button (org.eclipse.swt.widgets.Button)4 Composite (org.eclipse.swt.widgets.Composite)4 Group (org.eclipse.swt.widgets.Group)4 YAxisRangeEditor (org.netxms.ui.eclipse.perfview.widgets.YAxisRangeEditor)4 LabeledText (org.netxms.ui.eclipse.widgets.LabeledText)4 Label (org.eclipse.swt.widgets.Label)2 LabeledSpinner (org.netxms.ui.eclipse.widgets.LabeledSpinner)2 ColorSelector (org.eclipse.jface.preference.ColorSelector)1 SelectionEvent (org.eclipse.swt.events.SelectionEvent)1 SelectionListener (org.eclipse.swt.events.SelectionListener)1 RowLayout (org.eclipse.swt.layout.RowLayout)1 Scale (org.eclipse.swt.widgets.Scale)1 Spinner (org.eclipse.swt.widgets.Spinner)1 BarChartConfig (org.netxms.ui.eclipse.dashboard.widgets.internal.BarChartConfig)1 ComparisonChartConfig (org.netxms.ui.eclipse.dashboard.widgets.internal.ComparisonChartConfig)1 LineChartConfig (org.netxms.ui.eclipse.dashboard.widgets.internal.LineChartConfig)1 PieChartConfig (org.netxms.ui.eclipse.dashboard.widgets.internal.PieChartConfig)1 TableBarChartConfig (org.netxms.ui.eclipse.dashboard.widgets.internal.TableBarChartConfig)1