]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.charts/src/org/simantics/charts/preference/ChartDefaultsPage.java
Fixed all line endings of the repository
[simantics/platform.git] / bundles / org.simantics.charts / src / org / simantics / charts / preference / ChartDefaultsPage.java
1 /*******************************************************************************
2  * Copyright (c) 2007, 2011 Association for Decentralized Information Management in
3  * Industry THTH ry.
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
8  *
9  * Contributors:
10  *     VTT Technical Research Centre of Finland - initial API and implementation
11  *******************************************************************************/
12 package org.simantics.charts.preference;
13
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;
22
23 public class ChartDefaultsPage extends FieldEditorPreferencePage implements
24                 IWorkbenchPreferencePage {
25
26         private RadioGroupFieldEditor fTimeWindowTemplateEditor = null;
27     private RadioGroupFieldEditor fAxisModeEditor = null;
28     //private RadioGroupFieldEditor fDrawModeEditor = null;
29     private RadioGroupFieldEditor fScaleModeEditor = null;
30
31         public ChartDefaultsPage() {
32         super(GRID);
33
34         //setDescription("Chart prefrences");
35         setPreferenceStore(Activator.getDefault().getPreferenceStore());
36         }
37     @Override
38     public void createControl(Composite parent) {
39         super.createControl(parent);
40     }
41
42         @Override
43         public void init(IWorkbench workbench) {
44                 // TODO Auto-generated method stub
45
46         }
47
48     /**
49      * Create all field editors for this page
50      */
51     @Override
52     public void createFieldEditors() {
53         Label label = new Label(getFieldEditorParent(), 0);
54         label.setText("Default values for new charts and chart items:");
55         
56         fTimeWindowTemplateEditor = new RadioGroupFieldEditor(
57                         ChartPreferences.P_TIMEWINDOW_TEMPLATE,
58                         "Time window template",
59                         1,
60                         ChartTimeWindowTemplate.radioGroup,
61                         getFieldEditorParent());
62         addField(fTimeWindowTemplateEditor);
63         
64         fAxisModeEditor = new RadioGroupFieldEditor(
65                         ChartPreferences.P_AXISMODE,
66                         "Axis Mode",
67                         1,
68                         new String[][] {
69                                 new String[] {"Single axis", YAxisMode.SingleAxis.name()},      
70                                 new String[] {"Multi axis", YAxisMode.MultiAxis.name()} 
71                         },
72                         getFieldEditorParent());
73         addField(fAxisModeEditor);
74         
75 //        fDrawModeEditor = new RadioGroupFieldEditor(
76 //                      ChartPreferences.P_DRAWMODE,
77 //                      "Draw Mode",
78 //                      1,
79 //                      new String[][] {
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()}     
87 //                      },
88 //                      getFieldEditorParent());
89 //        addField(fDrawModeEditor);
90         
91         fScaleModeEditor = new RadioGroupFieldEditor(
92                         ChartPreferences.P_SCALEMODE,
93                         "Scale Mode",
94                         1,
95                         new String[][] {
96                                 new String[] {"Auto", "Auto"},  
97                                 new String[] {"Manual", "Manual"}       
98                         },
99                         getFieldEditorParent());
100         addField(fScaleModeEditor);
101         
102     }
103
104 }