Revision 585

tmp/org.txm.progression.rcp/src/org/txm/progression/rcp/preferences/ProgressionPreferencePage.java (revision 585)
64 64
		
65 65
		this.addField(new BooleanFieldEditor(ProgressionPreferences.CHART_CUMULATIVE, ProgressionUIMessages.ProgressionPreferencePage_3, chartsTab));
66 66
		this.addField(new BooleanFieldEditor(ProgressionPreferences.CHART_MONO_STYLE, ProgressionUIMessages.ProgressionPreferencePage_5, chartsTab));
67
		this.addField(new BooleanFieldEditor(ProgressionPreferences.CHART_REPEAT_VALUES, ProgressionUIMessages.ProgressionPreferencePage_6, chartsTab));
67
		this.addField(new BooleanFieldEditor(ProgressionPreferences.REPEAT_VALUES, ProgressionUIMessages.ProgressionPreferencePage_6, chartsTab));
68 68
				
69
		DoubleFieldEditor bandemultiplierfield = new DoubleFieldEditor(ProgressionPreferences.CHART_BANDE_MULTIPLIER, ProgressionUIMessages.ProgressionPreferencePage_7, chartsTab);
69
		DoubleFieldEditor bandemultiplierfield = new DoubleFieldEditor(ProgressionPreferences.BANDE_MULTIPLIER, ProgressionUIMessages.ProgressionPreferencePage_7, chartsTab);
70 70
		this.addField(bandemultiplierfield);
71 71
		// FIXME: valid range
72 72
		//if (bandemultiplierfield.getIntValue() == 0)
tmp/org.txm.progression.rcp/src/org/txm/progression/rcp/editors/ProgressionEditor.java (revision 585)
74 74
	/** The monostyle. */
75 75
	private boolean monostyle = true;
76 76
	
77
	/** The repeatvalues. */
78
	private boolean repeatvalues = false;
79
	
80 77
	/** The linewidth. */
81 78
	private int linewidth = 2;
82 79
	
83
	/** The bandemultiplier. */
84
	private float bandemultiplier = 2;
85

  
86
	
87 80
	/** The structural units combo. */
88 81
	Combo structuralUnitsCombo;
89 82
	
......
177 170

  
178 171
			monostyle = this.getBooleanParameterValue(ProgressionPreferences.CHART_MONO_STYLE);
179 172
			cumulative = this.getBooleanParameterValue(ProgressionPreferences.CHART_CUMULATIVE);
180
			repeatvalues = this.getBooleanParameterValue(ProgressionPreferences.CHART_REPEAT_VALUES);
181
			bandemultiplier = this.getFloatParameterValue(ProgressionPreferences.CHART_BANDE_MULTIPLIER);
182 173

  
183 174
			// System.out.println(parent.getLayout());
184 175
			FormLayout mainlayout = new FormLayout();
......
218 209
			typeLabel.setAlignment(SWT.CENTER);
219 210

  
220 211
			bandeField = new Text(paramPanel, SWT.BORDER);
221
			bandeField.setText("" + bandemultiplier); //$NON-NLS-1$
212
			bandeField.setText("" + this.getResultData().getBandeMultiplier()); //$NON-NLS-1$
222 213
			bandeField.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true, 2, 1));
223 214
			
224 215
			// Structural units
......
257 248
							
258 249
							reloadSUProperties();
259 250
							getResultData().setStructuralUnit(su);
260
							getResultData().setDirty();
261 251
							compute(true);
262 252
						}
263 253
					});
......
302 292
					if(propertyCombo.getSelectionIndex() != 0)	{
303 293
						sup = structuralUnitsProperties.get(propertyCombo.getSelectionIndex() - 1);
304 294
					}
305
					getResultData().setStructuralUnitProperty(sup);
306
					
307
					getResultData().setDirty();
295
					//getResultData().setStructuralUnitProperty(sup);
308 296
					compute(true);
309 297
				}
310 298
			});
......
330 318
			//Repeat options
331 319
			repeatButton = new Button(paramPanel, SWT.CHECK);
332 320
			repeatButton.setText(ProgressionUIMessages.ProgressionDialog_15);
333
			repeatButton.setSelection(repeatvalues);
334

  
321
			repeatButton.setSelection(this.getResultData().isRepeatingValues());
322
			repeatButton.addSelectionListener(new SelectionListener() {
323
				
324
				@Override
325
				public void widgetSelected(SelectionEvent e) {
326
					//getResultData().setRepeatValues(repeatButton.getSelection());
327
					compute(true);
328
				}
329
				
330
				@Override
331
				public void widgetDefaultSelected(SelectionEvent e) {
332
					// TODO Auto-generated method stub
333
					
334
				}
335
			});
335 336
			
336 337
			
337 338
			// Queries
......
409 410
			}
410 411
			
411 412
			
412
			// Compute button
413
			Button computeButton = new Button(paramPanel, SWT.NONE);
414
			computeButton.setText("Compute");
415
			computeButton.addSelectionListener(new SelectionListener() {
416
				
417
				@Override
418
				public void widgetSelected(SelectionEvent evt) {
419

  
420
					updateResultFromEditor();
421
					compute(false);
422
					
423
				}
424
				
425
				@Override
426
				public void widgetDefaultSelected(SelectionEvent e) {
427
					// TODO Auto-generated method stub
428
					
429
				}
430
			});
431
			
432 413
		} catch (Exception e) {
433 414
			Log.printStackTrace(e);
434 415
		}
......
552 533

  
553 534
				cumulative = cumuButton.getSelection();
554 535
				monostyle = styleButton.getSelection();
555
				repeatvalues = repeatButton.getSelection();
556 536
				String smultibande = bandeField.getText();
537
				float bandeMultiplier = 1.0f;
557 538
				if (smultibande != null && smultibande.length() > 0) {
558 539
					try {
559
						bandemultiplier = Float.parseFloat(smultibande);
540
						bandeMultiplier = Float.parseFloat(smultibande);
560 541
					} catch(Exception e) {
561
						bandemultiplier = 1.0f;
542
						bandeMultiplier = 1.0f;
562 543
						System.out.println(ProgressionUIMessages.ProgressionDialog_17+e);
563 544
						StatusLine.error(ProgressionUIMessages.ProgressionDialog_17+e);
564 545
					}
565 546
				}
566 547
				else	{
567
					bandemultiplier = 1.0f;
548
					bandeMultiplier = 1.0f;
568 549
				}
569 550

  
570
				((Progression)getResultData()).setParameters(queries, selectedStructuralUnit, selectedStructuralUnitProperty, regexpropertyValue, cumulative, linewidth, repeatvalues, bandemultiplier);
551
				((Progression)getResultData()).setParameters(queries, selectedStructuralUnit, selectedStructuralUnitProperty, regexpropertyValue, cumulative, linewidth, repeatButton.getSelection(), bandeMultiplier);
571 552
			}
572 553
		});
573 554

  
tmp/org.txm.rcp/src/main/java/org/txm/rcp/editors/TXMEditorPart.java (revision 585)
365 365

  
366 366
		    		
367 367
		    		currentEditor = editor;
368
			    		
368

  
369
		    		
370
		    		// FIXME: define if we update here the result from the editor fields
371
		    		if (currentEditor != null)	{
372
						this.syncExec(new Runnable() {
373
							@Override
374
							public void run() {
375
								currentEditor.updateResultFromEditor();
376
							}
377
						});
378
		    		}
379
		    		
380
		    		
369 381
		    		// computing result
370 382
					monitor.beginTask("Computing", 100);
371 383

  
tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/ComputeTXMResult.java (revision 585)
18 18
		}
19 19

  
20 20
		TXMEditorPart editor = (TXMEditorPart) page;
21
		editor.updateResultFromEditor();
21
		//editor.updateResultFromEditor();
22 22
		editor.compute(false);
23 23

  
24 24
		return null;
tmp/org.txm.partition.rcp/src/org/txm/partition/rcp/editors/PartitionDimensionsEditor.java (revision 585)
14 14
import org.txm.rcp.IImageKeys;
15 15

  
16 16
/**
17
 * Partition dimensions chart editor.
17 18
 * @author sjacquot
18 19
 *
19 20
 */
tmp/org.txm.progression.core/src/org/txm/progression/core/preferences/ProgressionPreferences.java (revision 585)
36 36
	 * Structural unit property.
37 37
	 */
38 38
	public static final String STRUCTURAL_UNIT_PROPERTY = PREFERENCES_PREFIX + "structural_unit_property"; //$NON-NLS-1$
39

  
39 40
	
41
	/** The Constant REPEAT_VALUES. */
42
	public static final String REPEAT_VALUES = PREFERENCES_PREFIX + "repeat_values"; //$NON-NLS-1$
40 43
	
44
	/** The Constant BANDE_MULTIPLIER. */
45
	public static final String BANDE_MULTIPLIER = PREFERENCES_PREFIX + "bande_multiplier"; //$NON-NLS-1$
46
	
47

  
48
	
41 49
	/** The Constant CUMULATIVE. */
42 50
	public static final String CHART_CUMULATIVE = PREFERENCES_PREFIX + "chart_cumulative"; //$NON-NLS-1$
43 51
	
44
	/** The Constant REPEAT_VALUES. */
45
	public static final String CHART_REPEAT_VALUES = PREFERENCES_PREFIX + "chart_repeat_values"; //$NON-NLS-1$
46
	
47
	/** The Constant BANDE_MULTIPLIER. */
48
	public static final String CHART_BANDE_MULTIPLIER = PREFERENCES_PREFIX + "chart_bande_multiplier"; //$NON-NLS-1$
49
	
50 52
	/** The Constant MONO_STYLE. */
51 53
	public static final String CHART_MONO_STYLE = PREFERENCES_PREFIX + "chart_mono_style"; //$NON-NLS-1$
52 54
	
......
63 65
	public void initializeDefaultPreferences() {
64 66
		Preferences preferences = DefaultScope.INSTANCE.getNode(PREFERENCES_NODE);
65 67
		preferences.putBoolean(CHART_CUMULATIVE, true);
66
		preferences.putBoolean(CHART_REPEAT_VALUES, false);
67
		preferences.putDouble(CHART_BANDE_MULTIPLIER, 1.0d);
68
		preferences.putBoolean(REPEAT_VALUES, false);
69
		preferences.putDouble(BANDE_MULTIPLIER, 1.0d);
68 70
		preferences.putBoolean(CHART_MONO_STYLE, true);
69 71
		
70 72
		// shared charts rendering preferences
tmp/org.txm.progression.core/src/org/txm/progression/core/functions/Progression.java (revision 585)
106 106

  
107 107

  
108 108

  
109
	/** The repeatvalues. */
110
	protected boolean repeatValues;
111 109

  
112 110
	/** The bande. */
113 111
	protected float bande = 0.0f;
114 112

  
115
	/** The bandemultiplier. */
116
	protected float bandeMultiplier;
113
	
117 114

  
118 115
	
119 116

  
......
137 134
	@Parameter(key=ProgressionPreferences.STRUCTURAL_UNIT_PROPERTY)
138 135
	protected StructuralUnitProperty structuralUnitProperty;
139 136

  
137

  
138
	/**
139
	 * 
140
	 */
141
	@Parameter(key=ProgressionPreferences.REPEAT_VALUES)
142
	protected boolean repeatValues;
143

  
144
	/**
145
	 * 
146
	 */
147
	@Parameter(key=ProgressionPreferences.BANDE_MULTIPLIER)
148
	protected float bandeMultiplier;
149

  
140 150
	
141 151
	
142 152
	
......
155 165
	public boolean loadParameters() {
156 166
		// FIXME:
157 167
		System.err.println("Progression.loadParameters(): partially implemented."); //$NON-NLS-1$
168
//		
169
//		// FIXME: to validate
170
////		String queryString = this.getStringParameterValue(ProgressionPreferences.QUERIES);
171
////		if(!queryString.isEmpty()) {
172
////			this.queries = new ArrayList<Query>();
173
////			
174
////			String[] queriesAsStrings =  queryString.split("_");
175
////			
176
////			for (String query : queriesAsStrings) {
177
////				this.queries.add(new Query(query));
178
////			}
179
////		}
180
//		
181
//		this.repeatValues = this.getBooleanParameterValue(ProgressionPreferences.REPEAT_VALUES);
182
//		this.bandeMultiplier = this.getFloatParameterValue(ProgressionPreferences.CHART_BANDE_MULTIPLIER);
158 183
		
159
		// FIXME: to validate
160
//		String queryString = this.getStringParameterValue(ProgressionPreferences.QUERIES);
161
//		if(!queryString.isEmpty()) {
162
//			this.queries = new ArrayList<Query>();
163
//			
164
//			String[] queriesAsStrings =  queryString.split("_");
165
//			
166
//			for (String query : queriesAsStrings) {
167
//				this.queries.add(new Query(query));
168
//			}
169
//		}
170 184
		
171
		this.repeatValues = this.getBooleanParameterValue(ProgressionPreferences.CHART_REPEAT_VALUES);
172
		this.bandeMultiplier = this.getFloatParameterValue(ProgressionPreferences.CHART_BANDE_MULTIPLIER);
173
		
174
		
175 185
		return true;
176 186
	}
177 187
	
......
432 442
					currentname = structuralUnit.getName() + i;
433 443
				}
434 444

  
435
				if (repeatValues) {
445
//				if (repeatValues) {
436 446
					structureNames[i] = currentname;
437 447
					structurePositions[i] = m;
438
				}
439
				else {
440
					if (!previousname.equals(currentname)) {
441
						structureNames[i] = currentname;
442
						structurePositions[i] = m;
443
					}
444
				}
448
//				}
449
//				else {
450
//					if (!previousname.equals(currentname)) {
451
//						structureNames[i] = currentname;
452
//						structurePositions[i] = m;
453
//					}
454
//				}
445 455
				if (i == 0) {
446 456
					structurePositions[i] += 1;
447 457
				}
......
560 570
	 *
561 571
	 * @return true, if is repeatvalues
562 572
	 */
563
	public boolean isRepeatvalues() {
573
	public boolean isRepeatingValues() {
564 574
		return repeatValues;
565 575
	}
566 576

  
......
749 759
	}
750 760

  
751 761

  
762

  
763
	/**
764
	 * @return the bandeMultiplier
765
	 */
766
	public float getBandeMultiplier() {
767
		return bandeMultiplier;
768
	}
769

  
770

  
771

  
772
	/**
773
	 * @param bandeMultiplier the bandeMultiplier to set
774
	 */
775
	public void setBandeMultiplier(float bandeMultiplier) {
776
		this.bandeMultiplier = bandeMultiplier;
777
	}
778

  
779

  
780

  
781
	/**
782
	 * @param repeatValues the repeatValues to set
783
	 */
784
	public void setRepeatValues(boolean repeatValues) {
785
		this.repeatValues = repeatValues;
786
	}
787

  
788

  
752 789
}
tmp/org.txm.progression.core/src/org/txm/progression/core/chartsengine/jfreechart/JFCProgressionChartCreator.java (revision 585)
181 181
//        chart.getXYPlot().addAnnotation(annotation, true);
182 182

  
183 183
		// Add the part markers
184
        String previousPartName = ""; //$NON-NLS-1$
184 185
		if(progression.getStructurePositions().length > 0)	{
185 186
			for(int i = 0; i < progression.getStructurePositions().length; i++) {
186 187
				if(progression.getStructurePositions()[i] != 0)	{
187
					marker = new ValueMarker(progression.getStructurePositions()[i]);
188
			        marker.setPaint(Color.black);
189
			        marker.setLabel(progression.getStructureNames()[i]);
190
			        marker.setLabelAnchor(RectangleAnchor.TOP_RIGHT);
191
			        marker.setLabelTextAnchor(TextAnchor.HALF_ASCENT_LEFT);
192

  
193

  
194
			        // FIXME: test of rotated annotations rather than using marker label. The problem with this is that the position of annotation is not adjusted when zooming/dezooming.
195
			        // FIXME: the best approach is to redefine the drawing method of
196
////			        double start = marker.getStartValue();
197
////			        double end = TempIntervalMarker.getEndValue();
198
////			        double middle = (end - start)/2;
199
//			        XYTextAnnotation updateLabel = new XYTextAnnotation("Update", progression.getStructurePositions()[i], 0);
200
//			        updateLabel.setFont(new Font("Sans Serif", Font.BOLD, 10));
201
//			        updateLabel.setRotationAnchor(TextAnchor.BASELINE_CENTER);
202
//			        updateLabel.setTextAnchor(TextAnchor.BASELINE_CENTER);
203
//			        updateLabel.setRotationAngle(3.14 / 2);
204
//			        updateLabel.setPaint(Color.black);
205
//			        chart.getXYPlot().addAnnotation(updateLabel);
206

  
207

  
208

  
209
			        chart.getXYPlot().addDomainMarker(marker);
188
					
189
					String currentPartName = progression.getStructureNames()[i];
190
					
191
					if(progression.isRepeatingValues() || !currentPartName.equals(previousPartName))	{
192
					
193
						marker = new ValueMarker(progression.getStructurePositions()[i]);
194
				        marker.setPaint(Color.black);
195
				        marker.setLabel(progression.getStructureNames()[i]);
196
				        marker.setLabelAnchor(RectangleAnchor.TOP_RIGHT);
197
				        marker.setLabelTextAnchor(TextAnchor.HALF_ASCENT_LEFT);
198
	
199
	
200
				        // FIXME: test of rotated annotations rather than using marker label. The problem with this is that the position of annotation is not adjusted when zooming/dezooming.
201
				        // FIXME: the best approach is to redefine the drawing method of
202
	////			        double start = marker.getStartValue();
203
	////			        double end = TempIntervalMarker.getEndValue();
204
	////			        double middle = (end - start)/2;
205
	//			        XYTextAnnotation updateLabel = new XYTextAnnotation("Update", progression.getStructurePositions()[i], 0);
206
	//			        updateLabel.setFont(new Font("Sans Serif", Font.BOLD, 10));
207
	//			        updateLabel.setRotationAnchor(TextAnchor.BASELINE_CENTER);
208
	//			        updateLabel.setTextAnchor(TextAnchor.BASELINE_CENTER);
209
	//			        updateLabel.setRotationAngle(3.14 / 2);
210
	//			        updateLabel.setPaint(Color.black);
211
	//			        chart.getXYPlot().addAnnotation(updateLabel);
212
	
213
				        chart.getXYPlot().addDomainMarker(marker);
214
					}
215
					
216
					previousPartName = currentPartName;
210 217
				}
211 218
			}
212 219
		}

Also available in: Unified diff