Revision 2691

tmp/org.txm.chartsengine.core/src/org/txm/chartsengine/core/results/ChartResult.java (revision 2691)
184 184
			Log.finest("*** ChartResult._compute(): " + this.getClass().getSimpleName() + ": starting computing process...");
185 185
			
186 186
			// computes the result only if at least one computing parameter has changed
187
			if (super.hasParameterChanged()) {
188
				
189
				// Debug
190
				Log.finest("+++ ChartResult._compute(): " + this.getClass().getSimpleName() + ": computing result of type " + this.getClass() + "...");
191
				
192
				computingState = this.__compute(monitor.createNewMonitor(90));
187
			boolean changed = super.hasParameterChanged();
188
			boolean rchanged = this.hasRenderingParameterChanged();
189
			if (isDirty()) {
190
				computingState = this.__compute(monitor.createNewMonitor(90)) && this.renderChart(monitor.createNewMonitor(10));
193 191
			}
194 192
			else {
195
				// Debug
196
				Log.finest("--- ChartResult._compute(): " + this.getClass().getSimpleName() + ": result parameters have not changed since last computing, computing skipped.");
193
				if (changed) { // no parameter changed but result is dirty
194
					computingState = this.__compute(monitor.createNewMonitor(90)) && this.renderChart(monitor.createNewMonitor(10));
195
				}
196
				else if (rchanged) {
197
					computingState = this.renderChart(monitor.createNewMonitor(100));
198
				}
199
				else {
200
					Log.warning("ChartResult _compute has been called without parameter changed and not dirty?");
201
				}
197 202
			}
198 203
			
199
			// rendering the chart
200
			if (computingState && (this.hasRenderingParameterChanged() || super.hasParameterChanged())) {
201
				computingState = this.renderChart(monitor.createNewMonitor(10));
202
			}
203
			else {
204
				// FIXME: Debug
205
				Log.finest("--- ChartResult.renderChart(): chart rendering parameters have not changed since last rendering, rendering skipped."); //$NON-NLS-1$
206
			}
204
			// if (changed // dirty because parameters changed
205
			// || (!changed && isDirty())) { // dirty because the result has been marked dirty
206
			//
207
			// // Debug
208
			// Log.finest("+++ ChartResult._compute(): " + this.getClass().getSimpleName() + ": computing result of type " + this.getClass() + "...");
209
			//
210
			// computingState = this.__compute(monitor.createNewMonitor(90));
211
			// }
212
			// else {
213
			// // Debug
214
			// Log.finest("--- ChartResult._compute(): " + this.getClass().getSimpleName() + ": result parameters have not changed since last computing, computing skipped.");
215
			// }
216
			//
217
			// // rendering the chart
218
			// if (computingState && (this.hasRenderingParameterChanged() || changed || this.isDirty())) {
219
			// computingState = this.renderChart(monitor.createNewMonitor(10));
220
			// }
221
			// else {
222
			// // FIXME: Debug
223
			// Log.finest("--- ChartResult.renderChart(): chart rendering parameters have not changed since last rendering, rendering skipped."); //$NON-NLS-1$
224
			// }
225
			// }
207 226
		}
208 227
		catch (Exception e) {
209 228
			e.printStackTrace();
......
367 386
	 * @return
368 387
	 * @throws Exception
369 388
	 */
370
	public boolean hasRenderingParameterChanged() throws Exception {
389
	protected boolean hasRenderingParameterChanged() throws Exception {
371 390
		return this.hasParameterChanged(this.getLastParametersFromHistory(), Parameter.RENDERING);
372 391
	}
373 392
	
393
	/**
394
	 * Checks if at least one rendering parameter value has changed since last computing.
395
	 * 
396
	 * @return
397
	 * @throws Exception
398
	 */
374 399
	@Override
375
	public void updateDirtyFromHistory() throws Exception {
376
		
377
		super.updateDirtyFromHistory();
378
		
379
		if (!this.isDirty() && this.hasRenderingParameterChanged()) {
380
			this.setDirty(false); // FIXME: SJ: temporary but breaks the dirty computing state and rendering computing state management
381
			// problem here is that if the object is not dirty, TXMResult.compute() doesn't call ChartResult._compute() so the rendering is not done
382
		}
400
	public boolean hasParameterChanged() throws Exception {
401
		return super.hasParameterChanged() || this.hasRenderingParameterChanged();
383 402
	}
384 403
	
404
	// @Override
405
	// public void updateDirtyFromHistory() throws Exception {
406
	//
407
	// super.updateDirtyFromHistory();
408
	//
409
	// if (!this.isDirty() && this.hasRenderingParameterChanged()) {
410
	// this.setDirty(false); // FIXME: SJ: temporary but breaks the dirty computing state and rendering computing state management
411
	// // problem here is that if the object is not dirty, TXMResult.compute() doesn't call ChartResult._compute() so the rendering is not done
412
	// }
413
	// }
385 414
	
415
	
386 416
	/**
387 417
	 * Sets the chart dirty state to true if a rendering parameter has changed since last computing.
388 418
	 * Also sets the chart dirty to true if the computing dirty state is equals to true.
tmp/org.txm.core/src/java/org/txm/core/results/TXMResult.java (revision 2691)
832 832
	 * 
833 833
	 * @throws Exception
834 834
	 */
835
	public void updateDirtyFromHistory() throws Exception {
835
	private void updateDirtyFromHistory() throws Exception {
836 836
		//
837 837
		//// // result has never been computed
838 838
		//// if(this.getLastParametersFromHistory() == null) {
......
891 891
		if (this.hasParameterChanged()) {
892 892
			this.dirty = true;
893 893
		}
894
		
895 894
	}
896 895
	
897
	
898 896
	/**
899 897
	 * Gets the list of parameters used during last computing or null if the result has not been computed yet.
900 898
	 * 
......
2394 2392
			}
2395 2393
			
2396 2394
			// update the dirty state from history if a parameter has changed since last computing
2397
			this.updateDirtyFromHistory();
2395
			// this.updateDirtyFromHistory();
2398 2396
			
2399 2397
			// check if the result is dirty
2400
			if (!this.isDirty()) {
2398
			if (!this.isDirty() && !hasParameterChanged()) {
2401 2399
				Log.finest("--- TXMResult.compute(): " + this.getClass().getSimpleName() + ": result parameters have not changed since last computing, computing skipped.");
2402 2400
				skipComputing = true;
2403 2401
			}

Also available in: Unified diff