Révision 1935
| tmp/org.txm.ca.rcp/src/org/txm/ca/rcp/editors/CAFactorialMapChartEditor.java (revision 1935) | ||
|---|---|---|
| 4 | 4 |
import java.awt.event.ComponentEvent; |
| 5 | 5 |
import java.awt.event.ComponentListener; |
| 6 | 6 |
|
| 7 |
import org.eclipse.jface.viewers.ArrayContentProvider; |
|
| 8 |
import org.eclipse.jface.viewers.ComboViewer; |
|
| 9 |
import org.eclipse.jface.viewers.ISelectionChangedListener; |
|
| 10 |
import org.eclipse.jface.viewers.SelectionChangedEvent; |
|
| 7 | 11 |
import org.eclipse.swt.SWT; |
| 8 | 12 |
import org.eclipse.swt.custom.CLabel; |
| 9 | 13 |
import org.eclipse.swt.events.SelectionEvent; |
| ... | ... | |
| 180 | 184 |
|
| 181 | 185 |
|
| 182 | 186 |
// Factors plane selection |
| 183 |
CLabel factorsLabel = new CLabel(this.chartToolBar, SWT.CENTER);
|
|
| 187 |
Label factorsLabel = new Label(this.chartToolBar, SWT.CENTER);
|
|
| 184 | 188 |
factorsLabel.setText(CAUIMessages.axesColon); |
| 185 | 189 |
this.chartToolBar.addControl(factorsLabel); |
| 186 | 190 |
|
| 187 |
final Combo plansCombo = new Combo(this.chartToolBar, SWT.READ_ONLY); |
|
| 188 |
|
|
| 189 |
// FIXME: commented because the infos panel is not ready to manage more axes |
|
| 190 |
// ArrayList<String> planes = null; |
|
| 191 |
// try {
|
|
| 192 |
// int nbsv = ((CA) editorPart.getResultData()).getSingularValues().length; |
|
| 193 |
// planes = new ArrayList<String>(); |
|
| 194 |
// for(int i = 1 ; i < nbsv ; i ++) {
|
|
| 195 |
// for(int j = i ; j < nbsv ; j++) {
|
|
| 196 |
// if(i != j) {
|
|
| 197 |
// planes.add("("+i+","+j+")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
|
| 198 |
// } |
|
| 199 |
// } |
|
| 200 |
// } |
|
| 201 |
// } |
|
| 202 |
// catch (StatException e1) {
|
|
| 203 |
// // TODO Auto-generated catch block |
|
| 204 |
// org.txm.utils.logger.Log.printStackTrace(e1); |
|
| 205 |
// } |
|
| 206 |
// String [] items = planes.toArray(new String[planes.size()]); |
|
| 207 |
|
|
| 208 | 191 |
String items[] = { "(1,2)", "(1,3)", "(2,3)" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
| 209 | 192 |
|
| 210 |
// TODO : commented because the infos panel is not ready to manage more axes |
|
| 211 |
// if(couples != null && couples.size() > 3) {
|
|
| 212 |
// items = couples.toArray(new String[couples.size()]); |
|
| 213 |
//} |
|
| 214 |
|
|
| 215 |
|
|
| 216 |
plansCombo.setItems(items); |
|
| 217 |
|
|
| 193 |
|
|
| 194 |
|
|
| 195 |
final ComboViewer plansComboViewer = new ComboViewer(this.chartToolBar); |
|
| 196 |
plansComboViewer.setContentProvider(ArrayContentProvider.getInstance()); |
|
| 197 |
plansComboViewer.setInput(items); |
|
| 198 |
|
|
| 218 | 199 |
// Preselect the plan from the CA data |
| 219 | 200 |
if(this.getIntParameterValue(CAPreferences.FIRST_DIMENSION) == 2) {
|
| 220 |
plansCombo.select(2); |
|
| 201 |
plansComboViewer.getCombo().select(2);
|
|
| 221 | 202 |
} |
| 222 | 203 |
else if(this.getIntParameterValue(CAPreferences.SECOND_DIMENSION) == 3) {
|
| 223 |
plansCombo.select(1); |
|
| 204 |
plansComboViewer.getCombo().select(1);
|
|
| 224 | 205 |
} |
| 225 | 206 |
else {
|
| 226 |
plansCombo.select(0); |
|
| 207 |
plansComboViewer.getCombo().select(0);
|
|
| 227 | 208 |
} |
| 228 |
|
|
| 229 |
this.chartToolBar.addControl(plansCombo); |
|
| 230 |
|
|
| 231 |
// Listeners |
|
| 232 |
SelectionListener listener = new SelectionListener() {
|
|
| 233 |
|
|
| 209 |
|
|
| 210 |
plansComboViewer.getControl().pack(); |
|
| 211 |
|
|
| 212 |
plansComboViewer.addSelectionChangedListener(new ISelectionChangedListener() {
|
|
| 213 |
|
|
| 234 | 214 |
@Override |
| 235 |
public void widgetSelected(SelectionEvent e) {
|
|
| 236 |
|
|
| 215 |
public void selectionChanged(SelectionChangedEvent e) {
|
|
| 216 |
// TODO Auto-generated method stub |
|
| 237 | 217 |
boolean resetView = false; |
| 238 | 218 |
|
| 239 | 219 |
// Change factors |
| 240 |
if(e.getSource() == plansCombo) {
|
|
| 220 |
if(e.getSource() == plansComboViewer) {
|
|
| 241 | 221 |
|
| 242 | 222 |
Combo plans = (Combo) e.getSource(); |
| 243 | 223 |
|
| ... | ... | |
| 258 | 238 |
getResult().setChartDirty(); |
| 259 | 239 |
getResult().setNeedsToResetView(resetView); |
| 260 | 240 |
compute(true); |
| 261 |
//forceFocus(); |
|
| 262 | 241 |
} |
| 242 |
}); |
|
| 243 |
|
|
| 244 |
// final Combo plansCombo = new Combo(this.chartToolBar, SWT.READ_ONLY); |
|
| 245 |
// |
|
| 246 |
// // FIXME: commented because the infos panel is not ready to manage more axes |
|
| 247 |
// // ArrayList<String> planes = null; |
|
| 248 |
// // try {
|
|
| 249 |
// // int nbsv = ((CA) editorPart.getResultData()).getSingularValues().length; |
|
| 250 |
// // planes = new ArrayList<String>(); |
|
| 251 |
// // for(int i = 1 ; i < nbsv ; i ++) {
|
|
| 252 |
// // for(int j = i ; j < nbsv ; j++) {
|
|
| 253 |
// // if(i != j) {
|
|
| 254 |
// // planes.add("("+i+","+j+")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
|
| 255 |
// // } |
|
| 256 |
// // } |
|
| 257 |
// // } |
|
| 258 |
// // } |
|
| 259 |
// // catch (StatException e1) {
|
|
| 260 |
// // // TODO Auto-generated catch block |
|
| 261 |
// // org.txm.utils.logger.Log.printStackTrace(e1); |
|
| 262 |
// // } |
|
| 263 |
// // String [] items = planes.toArray(new String[planes.size()]); |
|
| 264 |
// |
|
| 265 |
// |
|
| 266 |
// // TODO : commented because the infos panel is not ready to manage more axes |
|
| 267 |
// // if(couples != null && couples.size() > 3) {
|
|
| 268 |
// // items = couples.toArray(new String[couples.size()]); |
|
| 269 |
// //} |
|
| 270 |
// |
|
| 271 |
// |
|
| 272 |
// plansCombo.setItems(items); |
|
| 273 |
// |
|
| 274 |
// // Preselect the plan from the CA data |
|
| 275 |
// if(this.getIntParameterValue(CAPreferences.FIRST_DIMENSION) == 2) {
|
|
| 276 |
// plansCombo.select(2); |
|
| 277 |
// } |
|
| 278 |
// else if(this.getIntParameterValue(CAPreferences.SECOND_DIMENSION) == 3) {
|
|
| 279 |
// plansCombo.select(1); |
|
| 280 |
// } |
|
| 281 |
// else {
|
|
| 282 |
// plansCombo.select(0); |
|
| 283 |
// } |
|
| 284 |
// |
|
| 285 |
// this.chartToolBar.addControl(plansCombo); |
|
| 286 |
// |
|
| 287 |
// // Listeners |
|
| 288 |
// SelectionListener listener = new SelectionListener() {
|
|
| 289 |
// |
|
| 290 |
// @Override |
|
| 291 |
// public void widgetSelected(SelectionEvent e) {
|
|
| 292 |
// |
|
| 293 |
// boolean resetView = false; |
|
| 294 |
// |
|
| 295 |
// // Change factors |
|
| 296 |
// if(e.getSource() == plansCombo) {
|
|
| 297 |
// |
|
| 298 |
// Combo plans = (Combo) e.getSource(); |
|
| 299 |
// |
|
| 300 |
// int dimension1 = 1; |
|
| 301 |
// int dimension2 = 2; |
|
| 302 |
// |
|
| 303 |
// String str = plans.getItem(plans.getSelectionIndex()); |
|
| 304 |
// str = str.substring(1, str.length() -1); // remove ( and ) |
|
| 305 |
// String[] split = str.split(","); // 2 items //$NON-NLS-1$
|
|
| 306 |
// dimension1 = Integer.parseInt(split[0]); |
|
| 307 |
// dimension2 = Integer.parseInt(split[1]); |
|
| 308 |
// |
|
| 309 |
// getResult().setFirstDimension(dimension1); |
|
| 310 |
// getResult().setSecondDimension(dimension2); |
|
| 311 |
// |
|
| 312 |
// resetView = true; |
|
| 313 |
// } |
|
| 314 |
// getResult().setChartDirty(); |
|
| 315 |
// getResult().setNeedsToResetView(resetView); |
|
| 316 |
// compute(true); |
|
| 317 |
// //forceFocus(); |
|
| 318 |
// } |
|
| 319 |
// |
|
| 320 |
// @Override |
|
| 321 |
// public void widgetDefaultSelected(SelectionEvent e) {
|
|
| 322 |
// // TODO Auto-generated method stub |
|
| 323 |
// } |
|
| 324 |
// }; |
|
| 325 |
// plansCombo.addSelectionListener(listener); |
|
| 263 | 326 |
|
| 264 |
@Override |
|
| 265 |
public void widgetDefaultSelected(SelectionEvent e) {
|
|
| 266 |
// TODO Auto-generated method stub |
|
| 267 |
} |
|
| 268 |
}; |
|
| 269 |
plansCombo.addSelectionListener(listener); |
|
| 270 |
|
|
| 271 | 327 |
// parent parameters |
| 272 | 328 |
// thresholds |
| 273 | 329 |
if (!this.getResult().getParent().isVisible() // the LT parent is not visible |
Formats disponibles : Unified diff