Search in sources :

Example 1 with TimePeriodSelector

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;
}
Also used : Composite(org.eclipse.swt.widgets.Composite) GridData(org.eclipse.swt.layout.GridData) TimePeriodSelector(org.netxms.ui.eclipse.widgets.TimePeriodSelector)

Example 2 with TimePeriodSelector

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;
}
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)

Aggregations

GridData (org.eclipse.swt.layout.GridData)2 Composite (org.eclipse.swt.widgets.Composite)2 TimePeriodSelector (org.netxms.ui.eclipse.widgets.TimePeriodSelector)2 SelectionEvent (org.eclipse.swt.events.SelectionEvent)1 SelectionListener (org.eclipse.swt.events.SelectionListener)1 GridLayout (org.eclipse.swt.layout.GridLayout)1 Button (org.eclipse.swt.widgets.Button)1 Group (org.eclipse.swt.widgets.Group)1 Label (org.eclipse.swt.widgets.Label)1 Scale (org.eclipse.swt.widgets.Scale)1 Spinner (org.eclipse.swt.widgets.Spinner)1 YAxisRangeEditor (org.netxms.ui.eclipse.perfview.widgets.YAxisRangeEditor)1 LabeledSpinner (org.netxms.ui.eclipse.widgets.LabeledSpinner)1 LabeledText (org.netxms.ui.eclipse.widgets.LabeledText)1