34 |
34 |
|
35 |
35 |
// FIXME: try to automate that
|
36 |
36 |
// a solution is to stop using to int in CA but a members int[] dimensions, then use a ComboViewer in this editor
|
37 |
|
// /**
|
38 |
|
// * First dimension.
|
39 |
|
// */
|
40 |
|
// @Parameter(key=CAPreferences.FIRST_DIMENSION)
|
41 |
|
// protected int firstDimension = 1;
|
42 |
|
//
|
43 |
|
// /**
|
44 |
|
// * Second dimension.
|
45 |
|
// */
|
46 |
|
// @Parameter(key=CAPreferences.SECOND_DIMENSION)
|
47 |
|
// protected int secondDimension = 2;
|
48 |
|
|
|
37 |
// /**
|
|
38 |
// * First dimension.
|
|
39 |
// */
|
|
40 |
// @Parameter(key=CAPreferences.FIRST_DIMENSION)
|
|
41 |
// protected int firstDimension = 1;
|
|
42 |
//
|
|
43 |
// /**
|
|
44 |
// * Second dimension.
|
|
45 |
// */
|
|
46 |
// @Parameter(key=CAPreferences.SECOND_DIMENSION)
|
|
47 |
// protected int secondDimension = 2;
|
49 |
48 |
|
|
49 |
|
50 |
50 |
/**
|
51 |
51 |
* To show/hide individuals.
|
52 |
52 |
*/
|
... | ... | |
64 |
64 |
*/
|
65 |
65 |
@Parameter(key=CAPreferences.SHOW_POINT_SHAPES)
|
66 |
66 |
protected ToolItem showPointShapes;
|
67 |
|
|
68 |
|
|
|
67 |
|
|
68 |
|
69 |
69 |
/**
|
70 |
70 |
* Unit property.
|
71 |
71 |
*/
|
72 |
72 |
@Parameter(key=TXMPreferences.UNIT_PROPERTY)
|
73 |
73 |
protected PropertiesComboViewer unitPropertyComboViewer;
|
74 |
|
|
75 |
74 |
|
|
75 |
|
76 |
76 |
/**
|
77 |
77 |
* Minimum frequency filtering spinner.
|
78 |
78 |
*/
|
... | ... | |
80 |
80 |
protected Spinner fMinSpinner;
|
81 |
81 |
|
82 |
82 |
/**
|
83 |
|
* Maximum frequency filtering spinner.
|
84 |
|
*/
|
85 |
|
@Parameter(key=TXMPreferences.F_MAX)
|
86 |
|
protected Spinner fMaxSpinner;
|
87 |
|
|
88 |
|
/**
|
89 |
83 |
* Maximum number of lines filtering.
|
90 |
84 |
*/
|
91 |
85 |
@Parameter(key=TXMPreferences.V_MAX)
|
92 |
86 |
protected Spinner vMaxSpinner;
|
93 |
|
|
94 |
|
|
|
87 |
|
|
88 |
|
95 |
89 |
/**
|
96 |
90 |
*
|
97 |
91 |
* @param chartEditorInput
|
... | ... | |
105 |
99 |
public void __createPartControl() {
|
106 |
100 |
|
107 |
101 |
// Main parameters
|
108 |
|
|
|
102 |
|
109 |
103 |
try {
|
110 |
104 |
GLComposite mainParametersArea = this.getMainParametersComposite();
|
111 |
105 |
mainParametersArea.getLayout().numColumns = 2;
|
112 |
|
|
|
106 |
|
113 |
107 |
// unit property
|
114 |
108 |
new Label(mainParametersArea, SWT.NONE).setText(TXMCoreMessages.common_property);
|
115 |
109 |
this.unitPropertyComboViewer = new PropertiesComboViewer(mainParametersArea, this, true,
|
... | ... | |
122 |
116 |
e.printStackTrace();
|
123 |
117 |
}
|
124 |
118 |
|
125 |
|
|
126 |
|
// Extend the chart editor tool bar
|
127 |
|
new ToolItem(this.chartToolBar, SWT.SEPARATOR);
|
128 |
119 |
|
129 |
|
ComputeSelectionListener computeSelectionListener = new ComputeSelectionListener(this, true);
|
130 |
|
|
131 |
|
// Show/hide columns
|
132 |
|
showIndividuals = new ToolItem(this.chartToolBar, SWT.CHECK);
|
133 |
|
// FIXME: keep this for offering an option "large icons" with text in buttons ?
|
134 |
|
//showColumns.setText(SWTComponentsProviderMessages.SWTChartsComponentProvider_CA_TOOLBAR_BUTTON_SHOW_COLUMS_LABEL);
|
135 |
|
showIndividuals.setToolTipText(CAUIMessages.showhideTheColumnPoints);
|
136 |
|
showIndividuals.setImage(IImageKeys.getImage(CAFactorialMapChartEditor.class, "icons/show_columns.png")); //$NON-NLS-1$
|
137 |
|
showIndividuals.addSelectionListener(computeSelectionListener);
|
|
120 |
// Extend the chart editor tool bar
|
|
121 |
new ToolItem(this.chartToolBar, SWT.SEPARATOR);
|
138 |
122 |
|
139 |
|
// Show/hide rows
|
140 |
|
showVariables = new ToolItem(this.chartToolBar, SWT.CHECK);
|
141 |
|
// FIXME: keep this for offering an option "large icons" with text in buttons ?
|
142 |
|
//this.showRows.setText(SWTComponentsProviderMessages.SWTChartsComponentProvider_CA_TOOLBAR_BUTTON_SHOW_ROWS_LABEL);
|
143 |
|
showVariables.setToolTipText(CAUIMessages.showhideTheRowPoints);
|
144 |
|
showVariables.setImage(IImageKeys.getImage(CAFactorialMapChartEditor.class, "icons/show_rows.png")); //$NON-NLS-1$
|
145 |
|
showVariables.addSelectionListener(computeSelectionListener);
|
|
123 |
ComputeSelectionListener computeSelectionListener = new ComputeSelectionListener(this, true);
|
146 |
124 |
|
147 |
|
|
148 |
|
// Show/hide point shapes
|
149 |
|
showPointShapes = new ToolItem(this.chartToolBar, SWT.CHECK);
|
150 |
|
// FIXME: keep this for offering an option "large icons" with text in buttons ?
|
151 |
|
//showPointShapes.setText(CAUIMessages.SHOW_HIDE_POINT_SHAPES);
|
152 |
|
showPointShapes.setToolTipText(CAUIMessages.showhidePointShapes);
|
153 |
|
showPointShapes.setImage(IImageKeys.getImage(CAFactorialMapChartEditor.class, "icons/show_point_shapes.png")); //$NON-NLS-1$
|
154 |
|
showPointShapes.addSelectionListener(computeSelectionListener);
|
|
125 |
// Show/hide columns
|
|
126 |
showIndividuals = new ToolItem(this.chartToolBar, SWT.CHECK);
|
|
127 |
// FIXME: keep this for offering an option "large icons" with text in buttons ?
|
|
128 |
//showColumns.setText(SWTComponentsProviderMessages.SWTChartsComponentProvider_CA_TOOLBAR_BUTTON_SHOW_COLUMS_LABEL);
|
|
129 |
showIndividuals.setToolTipText(CAUIMessages.showhideTheColumnPoints);
|
|
130 |
showIndividuals.setImage(IImageKeys.getImage(CAFactorialMapChartEditor.class, "icons/show_columns.png")); //$NON-NLS-1$
|
|
131 |
showIndividuals.addSelectionListener(computeSelectionListener);
|
155 |
132 |
|
156 |
|
|
157 |
|
// Factors plane selection
|
158 |
|
CLabel factorsLabel = new CLabel(this.chartToolBar, SWT.CENTER);
|
159 |
|
factorsLabel.setText(CAUIMessages.axesColon);
|
160 |
|
this.chartToolBar.addControl(factorsLabel);
|
161 |
|
|
162 |
|
final Combo plansCombo = new Combo(this.chartToolBar, SWT.READ_ONLY);
|
|
133 |
// Show/hide rows
|
|
134 |
showVariables = new ToolItem(this.chartToolBar, SWT.CHECK);
|
|
135 |
// FIXME: keep this for offering an option "large icons" with text in buttons ?
|
|
136 |
//this.showRows.setText(SWTComponentsProviderMessages.SWTChartsComponentProvider_CA_TOOLBAR_BUTTON_SHOW_ROWS_LABEL);
|
|
137 |
showVariables.setToolTipText(CAUIMessages.showhideTheRowPoints);
|
|
138 |
showVariables.setImage(IImageKeys.getImage(CAFactorialMapChartEditor.class, "icons/show_rows.png")); //$NON-NLS-1$
|
|
139 |
showVariables.addSelectionListener(computeSelectionListener);
|
163 |
140 |
|
164 |
|
// FIXME: commented because the infos panel is not ready to manage more axes
|
165 |
|
// ArrayList<String> planes = null;
|
166 |
|
// try {
|
167 |
|
// int nbsv = ((CA) editorPart.getResultData()).getSingularValues().length;
|
168 |
|
// planes = new ArrayList<String>();
|
169 |
|
// for(int i = 1 ; i < nbsv ; i ++) {
|
170 |
|
// for(int j = i ; j < nbsv ; j++) {
|
171 |
|
// if(i != j) {
|
172 |
|
// planes.add("("+i+","+j+")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
173 |
|
// }
|
174 |
|
// }
|
175 |
|
// }
|
176 |
|
// }
|
177 |
|
// catch (StatException e1) {
|
178 |
|
// // TODO Auto-generated catch block
|
179 |
|
// org.txm.rcp.utils.Logger.printStackTrace(e1);
|
180 |
|
// }
|
181 |
|
// String [] items = planes.toArray(new String[planes.size()]);
|
182 |
141 |
|
183 |
|
String items[] = { "(1,2)", "(1,3)", "(2,3)" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
|
142 |
// Show/hide point shapes
|
|
143 |
showPointShapes = new ToolItem(this.chartToolBar, SWT.CHECK);
|
|
144 |
// FIXME: keep this for offering an option "large icons" with text in buttons ?
|
|
145 |
//showPointShapes.setText(CAUIMessages.SHOW_HIDE_POINT_SHAPES);
|
|
146 |
showPointShapes.setToolTipText(CAUIMessages.showhidePointShapes);
|
|
147 |
showPointShapes.setImage(IImageKeys.getImage(CAFactorialMapChartEditor.class, "icons/show_point_shapes.png")); //$NON-NLS-1$
|
|
148 |
showPointShapes.addSelectionListener(computeSelectionListener);
|
184 |
149 |
|
185 |
|
// TODO : commented because the infos panel is not ready to manage more axes
|
186 |
|
// if(couples != null && couples.size() > 3) {
|
187 |
|
// items = couples.toArray(new String[couples.size()]);
|
188 |
|
//}
|
189 |
150 |
|
|
151 |
// Factors plane selection
|
|
152 |
CLabel factorsLabel = new CLabel(this.chartToolBar, SWT.CENTER);
|
|
153 |
factorsLabel.setText(CAUIMessages.axesColon);
|
|
154 |
this.chartToolBar.addControl(factorsLabel);
|
190 |
155 |
|
191 |
|
plansCombo.setItems(items);
|
|
156 |
final Combo plansCombo = new Combo(this.chartToolBar, SWT.READ_ONLY);
|
192 |
157 |
|
193 |
|
// Preselect the plan from the CA data
|
194 |
|
if(this.getIntParameterValue(CAPreferences.FIRST_DIMENSION) == 2) {
|
195 |
|
plansCombo.select(2);
|
196 |
|
}
|
197 |
|
else if(this.getIntParameterValue(CAPreferences.SECOND_DIMENSION) == 3) {
|
198 |
|
plansCombo.select(1);
|
199 |
|
}
|
200 |
|
else {
|
201 |
|
plansCombo.select(0);
|
202 |
|
}
|
|
158 |
// FIXME: commented because the infos panel is not ready to manage more axes
|
|
159 |
// ArrayList<String> planes = null;
|
|
160 |
// try {
|
|
161 |
// int nbsv = ((CA) editorPart.getResultData()).getSingularValues().length;
|
|
162 |
// planes = new ArrayList<String>();
|
|
163 |
// for(int i = 1 ; i < nbsv ; i ++) {
|
|
164 |
// for(int j = i ; j < nbsv ; j++) {
|
|
165 |
// if(i != j) {
|
|
166 |
// planes.add("("+i+","+j+")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
|
167 |
// }
|
|
168 |
// }
|
|
169 |
// }
|
|
170 |
// }
|
|
171 |
// catch (StatException e1) {
|
|
172 |
// // TODO Auto-generated catch block
|
|
173 |
// org.txm.rcp.utils.Logger.printStackTrace(e1);
|
|
174 |
// }
|
|
175 |
// String [] items = planes.toArray(new String[planes.size()]);
|
203 |
176 |
|
204 |
|
this.chartToolBar.addControl(plansCombo);
|
205 |
|
|
206 |
|
// Listeners
|
207 |
|
SelectionListener listener = new SelectionListener() {
|
208 |
|
|
209 |
|
@Override
|
210 |
|
public void widgetSelected(SelectionEvent e) {
|
|
177 |
String items[] = { "(1,2)", "(1,3)", "(2,3)" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
211 |
178 |
|
212 |
|
boolean resetView = false;
|
213 |
|
|
214 |
|
// Change factors
|
215 |
|
if(e.getSource() == plansCombo) {
|
|
179 |
// TODO : commented because the infos panel is not ready to manage more axes
|
|
180 |
// if(couples != null && couples.size() > 3) {
|
|
181 |
// items = couples.toArray(new String[couples.size()]);
|
|
182 |
//}
|
216 |
183 |
|
217 |
|
Combo plans = (Combo) e.getSource();
|
218 |
184 |
|
219 |
|
int dimension1 = 1;
|
220 |
|
int dimension2 = 2;
|
|
185 |
plansCombo.setItems(items);
|
221 |
186 |
|
222 |
|
String str = plans.getItem(plans.getSelectionIndex());
|
223 |
|
str = str.substring(1, str.length() -1); // remove ( and )
|
224 |
|
String[] split = str.split(","); // 2 items //$NON-NLS-1$
|
225 |
|
dimension1 = Integer.parseInt(split[0]);
|
226 |
|
dimension2 = Integer.parseInt(split[1]);
|
|
187 |
// Preselect the plan from the CA data
|
|
188 |
if(this.getIntParameterValue(CAPreferences.FIRST_DIMENSION) == 2) {
|
|
189 |
plansCombo.select(2);
|
|
190 |
}
|
|
191 |
else if(this.getIntParameterValue(CAPreferences.SECOND_DIMENSION) == 3) {
|
|
192 |
plansCombo.select(1);
|
|
193 |
}
|
|
194 |
else {
|
|
195 |
plansCombo.select(0);
|
|
196 |
}
|
227 |
197 |
|
228 |
|
getResult().setFirstDimension(dimension1);
|
229 |
|
getResult().setSecondDimension(dimension2);
|
|
198 |
this.chartToolBar.addControl(plansCombo);
|
230 |
199 |
|
231 |
|
resetView = true;
|
232 |
|
}
|
233 |
|
getResult().setChartDirty();
|
234 |
|
getResult().setNeedsToResetView(resetView);
|
235 |
|
compute(true);
|
236 |
|
// synchronize the part names
|
237 |
|
((CAEditor)getParentMultiPagesEditor()).setName(getResult().getName());
|
238 |
|
forceFocus();
|
|
200 |
// Listeners
|
|
201 |
SelectionListener listener = new SelectionListener() {
|
|
202 |
|
|
203 |
@Override
|
|
204 |
public void widgetSelected(SelectionEvent e) {
|
|
205 |
|
|
206 |
boolean resetView = false;
|
|
207 |
|
|
208 |
// Change factors
|
|
209 |
if(e.getSource() == plansCombo) {
|
|
210 |
|
|
211 |
Combo plans = (Combo) e.getSource();
|
|
212 |
|
|
213 |
int dimension1 = 1;
|
|
214 |
int dimension2 = 2;
|
|
215 |
|
|
216 |
String str = plans.getItem(plans.getSelectionIndex());
|
|
217 |
str = str.substring(1, str.length() -1); // remove ( and )
|
|
218 |
String[] split = str.split(","); // 2 items //$NON-NLS-1$
|
|
219 |
dimension1 = Integer.parseInt(split[0]);
|
|
220 |
dimension2 = Integer.parseInt(split[1]);
|
|
221 |
|
|
222 |
getResult().setFirstDimension(dimension1);
|
|
223 |
getResult().setSecondDimension(dimension2);
|
|
224 |
|
|
225 |
resetView = true;
|
239 |
226 |
}
|
240 |
|
|
241 |
|
@Override
|
242 |
|
public void widgetDefaultSelected(SelectionEvent e) {
|
243 |
|
// TODO Auto-generated method stub
|
244 |
|
}
|
245 |
|
};
|
246 |
|
plansCombo.addSelectionListener(listener);
|
247 |
|
|
248 |
|
|
249 |
|
|
250 |
|
// advanced parameters
|
251 |
|
// thresholds
|
|
227 |
getResult().setChartDirty();
|
|
228 |
getResult().setNeedsToResetView(resetView);
|
|
229 |
compute(true);
|
|
230 |
// synchronize the part names
|
|
231 |
((CAEditor)getParentMultiPagesEditor()).setName(getResult().getName());
|
|
232 |
forceFocus();
|
|
233 |
}
|
|
234 |
|
|
235 |
@Override
|
|
236 |
public void widgetDefaultSelected(SelectionEvent e) {
|
|
237 |
// TODO Auto-generated method stub
|
|
238 |
}
|
|
239 |
};
|
|
240 |
plansCombo.addSelectionListener(listener);
|
|
241 |
|
|
242 |
// advanced parameters
|
|
243 |
// thresholds
|
|
244 |
if (!getResult().isParentVisible()) {
|
252 |
245 |
ThresholdsGroup thresholdsGroup = new ThresholdsGroup(this.getExtendedParametersGroup(), SWT.NONE, this, true, false);
|
253 |
246 |
this.fMinSpinner = thresholdsGroup.getFMinSpinner();
|
254 |
|
this.fMaxSpinner = thresholdsGroup.getFMaxSpinner();
|
255 |
247 |
this.vMaxSpinner = thresholdsGroup.getVMaxSpinner();
|
256 |
248 |
this.vMaxSpinner.setMinimum(1);
|
257 |
|
|
258 |
|
|
|
249 |
}
|
259 |
250 |
}
|
260 |
251 |
|
261 |
|
|
262 |
252 |
@Override
|
263 |
253 |
public void updateEditorFromChart(boolean update) {
|
264 |
254 |
// nothing to do
|
265 |
255 |
}
|
266 |
256 |
|
267 |
|
|
268 |
|
|
269 |
257 |
}
|