1 /*******************************************************************************
2 * Copyright (c) 2007, 2011 Association for Decentralized Information Management in
4 * All rights reserved. This program and the accompanying materials
5 * are made available under the terms of the Eclipse Public License v1.0
6 * which accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
10 * VTT Technical Research Centre of Finland - initial API and implementation
11 *******************************************************************************/
12 package org.simantics.charts.preference;
14 import org.eclipse.jface.preference.FieldEditorPreferencePage;
15 import org.eclipse.jface.preference.RadioGroupFieldEditor;
16 import org.eclipse.swt.widgets.Composite;
17 import org.eclipse.swt.widgets.Label;
18 import org.eclipse.ui.IWorkbench;
19 import org.eclipse.ui.IWorkbenchPreferencePage;
20 import org.simantics.charts.Activator;
21 import org.simantics.trend.configuration.YAxisMode;
23 public class ChartDefaultsPage extends FieldEditorPreferencePage implements
24 IWorkbenchPreferencePage {
26 private RadioGroupFieldEditor fTimeWindowTemplateEditor = null;
27 private RadioGroupFieldEditor fAxisModeEditor = null;
28 //private RadioGroupFieldEditor fDrawModeEditor = null;
29 private RadioGroupFieldEditor fScaleModeEditor = null;
31 public ChartDefaultsPage() {
34 //setDescription("Chart prefrences");
35 setPreferenceStore(Activator.getDefault().getPreferenceStore());
38 public void createControl(Composite parent) {
39 super.createControl(parent);
43 public void init(IWorkbench workbench) {
44 // TODO Auto-generated method stub
49 * Create all field editors for this page
52 public void createFieldEditors() {
53 Label label = new Label(getFieldEditorParent(), 0);
54 label.setText("Default values for new charts and chart items:");
56 fTimeWindowTemplateEditor = new RadioGroupFieldEditor(
57 ChartPreferences.P_TIMEWINDOW_TEMPLATE,
58 "Time window template",
60 ChartTimeWindowTemplate.radioGroup,
61 getFieldEditorParent());
62 addField(fTimeWindowTemplateEditor);
64 fAxisModeEditor = new RadioGroupFieldEditor(
65 ChartPreferences.P_AXISMODE,
69 new String[] {"Single axis", YAxisMode.SingleAxis.name()},
70 new String[] {"Multi axis", YAxisMode.MultiAxis.name()}
72 getFieldEditorParent());
73 addField(fAxisModeEditor);
75 // fDrawModeEditor = new RadioGroupFieldEditor(
76 // ChartPreferences.P_DRAWMODE,
80 // new String[] {"Line", DrawMode.Line.name()},
81 // new String[] {"Sample", DrawMode.Sample.name()},
82 // new String[] {"Average", DrawMode.Average.name()},
83 // new String[] {"Deviation", DrawMode.Deviation.name()},
84 // new String[] {"Line and deviation", DrawMode.DeviationAndLine.name()},
85 // new String[] {"Sample and deviation", DrawMode.DeviationAndSample.name()},
86 // new String[] {"Average and deviation", DrawMode.DeviationAndAverage.name()}
88 // getFieldEditorParent());
89 // addField(fDrawModeEditor);
91 fScaleModeEditor = new RadioGroupFieldEditor(
92 ChartPreferences.P_SCALEMODE,
96 new String[] {"Auto", "Auto"},
97 new String[] {"Manual", "Manual"}
99 getFieldEditorParent());
100 addField(fScaleModeEditor);