Revision 575

tmp/org.txm.core/src/java/org/txm/core/preferences/TXMPreferences.java (revision 575)
845 845
	}
846 846

  
847 847
	/**
848
	 * Dumps the keys and values of the specified node.
848
	 * Dumps the keys and values of the specified node of the specified scope.
849 849
	 * @param nodeQualifier
850 850
	 */
851
	public static void dump(String nodeQualifier)	{
851
	public static void dump(IScopeContext scope, String nodeQualifier)	{
852 852
		IEclipsePreferences preferences = scope.getNode(nodeQualifier);
853
		System.out.println("TXMPreferences.dump(): ***************************************************************");
853 854
		System.out.println("TXMPreferences.dump(): node qualifier = " + nodeQualifier);
855
		System.out.println("TXMPreferences.dump():" + preferences.absolutePath());
854 856
		try {
855 857
			String[] keys = preferences.keys();
856 858
			for(int i = 0; i < keys.length; i++) {
......
862 864
			e.printStackTrace();
863 865
		}
864 866
	}
867
	
868
	
869
	/**
870
	 * Dumps the keys and values of the specified node of the instance and default scopes.
871
	 * @param nodeQualifier
872
	 */
873
	public static void dump(String nodeQualifier)	{
874
		dump(DefaultScope.INSTANCE, nodeQualifier);
875
		dump(scope, nodeQualifier);
876
	}
865 877

  
866 878
	/**
867 879
	 * Dumps the keys and values of the specified node.
tmp/org.txm.core/src/java/org/txm/core/results/TXMResult.java (revision 575)
43 43
	public static final DateFormat ID_TIME_FORMAT = new SimpleDateFormat("YYYYMMDD");
44 44
	/** Editor can use this to test if the result need to be saved */
45 45
	protected boolean hasBeenComputedOnce = false;
46
	public boolean getHasBeenComputedOnce() { return hasBeenComputedOnce;}
47 46

  
48 47
	/**
49 48
	 * The weight, essentially used for sorting purpose.
......
125 124
		// + this.preferencesNodeQualifier + ", class = " + getClass());
126 125

  
127 126
		this.dirty = true;
127
		
128
		// loads parameters from local result node, current command preferences or default command preferences
129
		try {
130
			this.loadGenericParameters();
131
			
132
			// FIXME: debug
133
			System.err.println("TXMResult.TXMResult(): loading parameters into fields.");
134
			this.loadParameters();
135
		}
136
		catch (Exception e) {
137
			// TODO Auto-generated catch block
138
			e.printStackTrace();
139
		}
128 140
	}
129 141

  
130
	//	/**
131
	//	 * Creates a new TXMResult with no parent.
132
	//	 */
133
	//	public TXMResult() {
134
	//		this(null);
135
	//	}
136

  
137 142
	/**
138 143
	 * Creates and stores an UUID dedicated to persistence of this result.
139 144
	 */
......
210 215
	 * @param key
211 216
	 * @return
212 217
	 */
213
	public boolean parameterHasChanged(String key) {
218
	public boolean hasParameterChanged(String key) {
214 219
		if ("".equals(key)) {
215 220
			return false;
216 221
		}
......
389 394
	 * @return
390 395
	 */
391 396
	public void saveParameter(String key, List<?> values) {
392
		TXMPreferences.putLocal(this, key, StringUtils.join(values, UNDERSCORE));
397
		this.saveParameter(key, StringUtils.join(values, UNDERSCORE));
393 398
	}
394 399

  
395 400

  
......
459 464
	 * @throws Exception 
460 465
	 * @throws Exception 
461 466
	 */
462
	public boolean loadParameters() throws Exception {
467
	private final boolean loadGenericParameters() throws Exception {
468
		
469
		// FIXME: debug
470
		System.err.println("TXMResult.loadGenericParameters(): loading generic parameters into fields.");
471
		
463 472
		Class clazz = this.getClass();
464 473

  
465 474
		Field[] fields = clazz.getDeclaredFields();
......
511 520
	}
512 521

  
513 522
	/**
523
	 * 
524
	 * @return
525
	 * @throws Exception
526
	 */
527
	public abstract boolean loadParameters() throws Exception;
528
	
529
	/**
514 530
	 * Initialize the @Parameter class members objects
515 531
	 * 
516 532
	 * @param parameters
......
877 893
	// */
878 894
	// public abstract String getComputingMessage();
879 895

  
896
	
880 897
	/**
898
	 * Convenience method to get a shared name when the result is empty (not yet computed).
899
	 * @return the String "*"
900
	 */
901
	public String getEmptyName()	{
902
		return "*"; 
903
	}
904
	
905
	/**
881 906
	 * Returns a string representation of a unique ID of the result.
882 907
	 * 
883 908
	 * @return
......
1177 1202
	// FIXME: should be moved in an exporter extension
1178 1203
	public abstract boolean toTxt(File outfile, String encoding, String colseparator, String txtseparator) throws Exception;
1179 1204

  
1205
	
1206
	public boolean getHasBeenComputedOnce() {
1207
		return hasBeenComputedOnce;
1208
	}
1209

  
1210
	
1180 1211
	/**
1181 1212
	 * increment the process
1182 1213
	 * 
......
1198 1229
	public void worked(int amount, String message) {
1199 1230
		if (monitor != null) {
1200 1231
			monitor.worked(amount);
1201
			monitor.subTask(message);
1232
			this.subTask(message);
1202 1233
		}
1203 1234
		Log.info(message);
1204 1235
	}
tmp/org.txm.core/src/java/org/txm/objects/TxmObject.java (revision 575)
286 286
	@Override
287 287
	public boolean loadParameters() {
288 288
		// not implemented in TxmObjects
289
		return false;
289
		return true;
290 290
	}
291 291
}
tmp/org.txm.chartsengine.rcp/src/org/txm/chartsengine/rcp/SWTChartsComponentsProvider.java (revision 575)
21 21
import org.eclipse.swt.SWT;
22 22
import org.eclipse.swt.graphics.Point;
23 23
import org.eclipse.swt.layout.GridData;
24
import org.eclipse.swt.layout.RowLayout;
25 24
import org.eclipse.swt.widgets.Composite;
26 25
import org.eclipse.swt.widgets.Event;
27 26
import org.eclipse.swt.widgets.Group;
......
37 36
import org.eclipse.ui.PartInitException;
38 37
import org.eclipse.ui.PlatformUI;
39 38
import org.eclipse.ui.part.MultiPageEditorPart;
40
import org.txm.chartsengine.core.ChartCreator;
41 39
import org.txm.chartsengine.core.ChartsEngine;
42 40
import org.txm.chartsengine.core.preferences.ChartsEnginePreferences;
43 41
import org.txm.chartsengine.core.results.ChartResult;
......
50 48
import org.txm.chartsengine.rcp.swt.AdvancedChartEditorToolBar;
51 49
import org.txm.chartsengine.rcp.swt.ChartComposite;
52 50
import org.txm.chartsengine.rcp.swt.ChartEditorToolBar;
53
import org.txm.core.results.TXMResult;
51
import org.txm.core.preferences.TXMPreferences;
54 52
import org.txm.rcp.editors.SplitedGenericMultiPageEditor;
55 53
import org.txm.rcp.preferences.TXMPreferencePage;
54
import org.txm.rcp.preferences.TXMPreferenceStore;
56 55
import org.txm.utils.logger.Log;
57 56

  
58 57
/**
......
512 511
		gridData.horizontalSpan = 2;
513 512
		separator.setLayoutData(gridData);
514 513

  
515
		
516
		page.addField(new BooleanFieldEditor(ChartsEnginePreferences.SHOW_TITLE, SWTComponentsProviderMessages.SWTChartsComponentProvider_SHOW_TITLE, composite));
517
		page.addField(new BooleanFieldEditor(ChartsEnginePreferences.SHOW_LEGEND, SWTComponentsProviderMessages.SWTChartsComponentProvider_SHOW_LEGEND, composite));
518
		page.addField(new BooleanFieldEditor(ChartsEnginePreferences.SHOW_GRID, SWTComponentsProviderMessages.SWTChartsComponentProvider_SHOW_GRID, composite));
514
		String commandNodeQualifier = ((TXMPreferenceStore)page.getPreferenceStore()).getNodeQualifier(); 
519 515

  
516
		// Show title
517
		if(!TXMPreferences.isEmpty(commandNodeQualifier, ChartsEnginePreferences.SHOW_TITLE))	{
518
			page.addField(new BooleanFieldEditor(ChartsEnginePreferences.SHOW_TITLE, SWTComponentsProviderMessages.SWTChartsComponentProvider_SHOW_TITLE, composite));
519
		}
520
		// Show legend
521
		if(!TXMPreferences.isEmpty(commandNodeQualifier, ChartsEnginePreferences.SHOW_LEGEND))	{
522
			page.addField(new BooleanFieldEditor(ChartsEnginePreferences.SHOW_LEGEND, SWTComponentsProviderMessages.SWTChartsComponentProvider_SHOW_LEGEND, composite));
523
		}
524
		// Show grid
525
		if(!TXMPreferences.isEmpty(commandNodeQualifier, ChartsEnginePreferences.SHOW_GRID))	{
526
			page.addField(new BooleanFieldEditor(ChartsEnginePreferences.SHOW_GRID, SWTComponentsProviderMessages.SWTChartsComponentProvider_SHOW_GRID, composite));
527
		}
528

  
520 529
		// Rendering colors mode selection
521
		String colorsModes[][] = new String[4][2];
522
		colorsModes[0][0] = SWTComponentsProviderMessages.ChartsEnginePreferencePage_RenderingModeColors;
523
		colorsModes[0][1] = "0"; //$NON-NLS-1$
524
		colorsModes[1][0] = SWTComponentsProviderMessages.ChartsEnginePreferencePage_RenderingModeGrayscale;
525
		colorsModes[1][1] = "1"; //$NON-NLS-1$
526
		colorsModes[2][0] = SWTComponentsProviderMessages.ChartsEnginePreferencePage_RenderingModeBlackAndWhite;
527
		colorsModes[2][1] = "2"; //$NON-NLS-1$
528
		colorsModes[3][0] = SWTComponentsProviderMessages.ChartsEnginePreferencePage_RenderingModeMonochrome;
529
		colorsModes[3][1] = "3"; //$NON-NLS-1$
530
		if(!TXMPreferences.isEmpty(commandNodeQualifier, ChartsEnginePreferences.RENDERING_COLORS_MODE))	{
531
			String colorsModes[][] = new String[4][2];
532
			colorsModes[0][0] = SWTComponentsProviderMessages.ChartsEnginePreferencePage_RenderingModeColors;
533
			colorsModes[0][1] = "0"; //$NON-NLS-1$
534
			colorsModes[1][0] = SWTComponentsProviderMessages.ChartsEnginePreferencePage_RenderingModeGrayscale;
535
			colorsModes[1][1] = "1"; //$NON-NLS-1$
536
			colorsModes[2][0] = SWTComponentsProviderMessages.ChartsEnginePreferencePage_RenderingModeBlackAndWhite;
537
			colorsModes[2][1] = "2"; //$NON-NLS-1$
538
			colorsModes[3][0] = SWTComponentsProviderMessages.ChartsEnginePreferencePage_RenderingModeMonochrome;
539
			colorsModes[3][1] = "3"; //$NON-NLS-1$
540
			ComboFieldEditor renderingModeComboField = new ComboFieldEditor(ChartsEnginePreferences.RENDERING_COLORS_MODE, SWTComponentsProviderMessages.ChartsEnginePreferencePage_RenderingColorsMode, colorsModes, composite);
541
			page.addField(renderingModeComboField);
542
		}
530 543

  
531
		
532
		ComboFieldEditor renderingModeComboField = new ComboFieldEditor(ChartsEnginePreferences.RENDERING_COLORS_MODE, SWTComponentsProviderMessages.ChartsEnginePreferencePage_RenderingColorsMode, colorsModes, composite);
533
		page.addField(renderingModeComboField);
534

  
535 544
	}
536 545
	
537 546

  
tmp/org.txm.chartsengine.rcp/src/org/txm/chartsengine/rcp/editors/ChartEditorPart.java (revision 575)
26 26
import org.txm.chartsengine.rcp.swt.AdvancedChartEditorToolBar;
27 27
import org.txm.chartsengine.rcp.swt.ChartComposite;
28 28
import org.txm.chartsengine.rcp.swt.ChartEditorToolBar;
29
import org.txm.core.results.TXMResult;
30 29
import org.txm.rcp.editors.TXMEditorPart;
31 30
import org.txm.rcp.editors.TXMEditorToolBar;
32
import org.txm.rcp.editors.TXMResultEditorInput;
33 31
import org.txm.utils.logger.Log;
34 32

  
35 33
/**
......
157 155
		//this.composite.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_WHITE));
158 156
		//parent.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_WHITE));
159 157

  
160
		this.refresh(false);
158
		//this.refresh(false);
161 159
//
162 160
//		}
163 161
		
tmp/org.txm.chartsengine.rcp/src/org/txm/chartsengine/rcp/swt/AdvancedChartEditorToolBar.java (revision 575)
49 49
		super(parent, style); //$NON-NLS-1$
50 50
		
51 51
		this.chartEditorPart = chartEditorPart;
52
		// FIXME: tests
53
		//this.setLayout(new FormLayout());
54
		//this.setLayout(new GridLayout());
55
//		 GridData data = new GridData();
56
//		    data.horizontalSpan = 3;
57
//		    this.setLayoutData(data);
58

  
59
		//new ToolItem(this, SWT.SEPARATOR);
60 52
		
61 53
		final ToolItem showTitle = new ToolItem(this, SWT.CHECK);
62 54
		//showTitle.setText(SWTComponentsProviderMessages.SWTChartsComponentProvider_SHOW_HIDE_TITLE);
......
64 56
		showTitle.setDisabledImage(IImageKeys.getImage(getClass(), "icons/show_title_disabled.png"));
65 57
		showTitle.setToolTipText(SWTComponentsProviderMessages.SWTChartsComponentProvider_SHOW_HIDE_TITLE);
66 58

  
67
		if(!TXMPreferences.isEmpty(chartEditorPart.getPreferencesNodeQualifier(), ChartsEnginePreferences.SHOW_TITLE))	{
59
		if(!chartEditorPart.getResultData().isEmptyPreference(ChartsEnginePreferences.SHOW_TITLE))	{
68 60
			showTitle.setSelection(chartEditorPart.getResultData().isTitleVisible());
69 61
		}
70
		// disable if not managed
62
		// disable if not managed by the command
71 63
		else	{
72 64
			showTitle.setEnabled(false);
73 65
		}
......
79 71
		showLegend.setDisabledImage(IImageKeys.getImage(getClass(), "icons/show_legend_disabled.png"));
80 72
		showLegend.setToolTipText(SWTComponentsProviderMessages.SWTChartsComponentProvider_SHOW_HIDE_LEGEND);
81 73

  
82
		if(!TXMPreferences.isEmpty(chartEditorPart.getPreferencesNodeQualifier(), ChartsEnginePreferences.SHOW_LEGEND))	{
74
		if(!chartEditorPart.getResultData().isEmptyPreference(ChartsEnginePreferences.SHOW_LEGEND))	{
83 75
			showLegend.setSelection(chartEditorPart.getResultData().isLegendVisible());
84 76
		}
85
		// disable if not managed
77
		// disable if not managed by the command
86 78
		else	{
87 79
			showLegend.setEnabled(false);
88 80
		}
......
94 86
		showGrid.setDisabledImage(IImageKeys.getImage(getClass(), "icons/show_grid_disabled.png"));
95 87
		showGrid.setToolTipText(SWTComponentsProviderMessages.SWTChartsComponentProvider_SHOW_HIDE_GRID);
96 88
		
97
		if(!TXMPreferences.isEmpty(chartEditorPart.getPreferencesNodeQualifier(), ChartsEnginePreferences.SHOW_GRID))	{
89
		if(!chartEditorPart.getResultData().isEmptyPreference(ChartsEnginePreferences.SHOW_GRID))	{
98 90
			showGrid.setSelection(chartEditorPart.getResultData().isGridVisible());
99 91
		}
100
		// disable if not managed
92
		// disable if not managed by the command
101 93
		else	{
102 94
			showGrid.setEnabled(false);
103 95
		}
......
119 111
		renderingModeCombo.pack();
120 112
		renderingComboItem.setWidth(renderingModeCombo.getBounds().width);
121 113
		
122
		if(!TXMPreferences.isEmpty(chartEditorPart.getPreferencesNodeQualifier(), ChartsEnginePreferences.RENDERING_COLORS_MODE))	{
114
		if(!chartEditorPart.getResultData().isEmptyPreference(ChartsEnginePreferences.RENDERING_COLORS_MODE))	{
123 115
			renderingModeCombo.select(chartEditorPart.getResultData().getRenderingColorsMode());
124 116
		}
125 117
		// disable if not managed
tmp/org.txm.progression.core/src/org/txm/progression/core/chartsengine/jfreechart/JFCProgressionChartCreator.java (revision 575)
133 133
		// Match the X-axis origin value to the min x corpus (for subcorpus case)
134 134
		chart.getXYPlot().getDomainAxis().setLowerBound(progression.getXminCorpus());
135 135

  
136
		this.updateChart(result);
136
//		this.updateChart(result);
137 137
		
138 138
		return chart;
139 139
		
......
145 145

  
146 146
		Progression progression = (Progression) result;
147 147
		
148
		JFreeChart c = (JFreeChart) result.getChart();
148
		JFreeChart chart = (JFreeChart) result.getChart();
149 149
		
150 150
		// removes all existing domain marker
151
		c.getXYPlot().clearDomainMarkers();
151
		chart.getXYPlot().clearDomainMarkers();
152 152
		
153 153
		// Add the limit markers
154 154
		BasicStroke dashedStroke = new BasicStroke(0.5f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 1f, new float[] {2f}, 0f);
155 155
		Marker marker = new ValueMarker(progression.getXminCorpus());
156 156
        marker.setPaint(Color.gray);
157 157
        marker.setStroke(dashedStroke);
158
        c.getXYPlot().addDomainMarker(marker);
158
        chart.getXYPlot().addDomainMarker(marker);
159 159
		marker = new ValueMarker(progression.getXmaxCorpus());
160 160
        marker.setPaint(Color.gray);
161 161
        marker.setStroke(dashedStroke);
162
        c.getXYPlot().addDomainMarker(marker);
162
        chart.getXYPlot().addDomainMarker(marker);
163 163

  
164 164

  
165 165
//        // FIXME : limit with annotations rather than markers (marker height is dynamically adapted to the real chart height.
......
193 193

  
194 194

  
195 195

  
196
			        c.getXYPlot().addDomainMarker(marker);
196
			        chart.getXYPlot().addDomainMarker(marker);
197 197
				}
198 198
			}
199 199
		}
200 200
		
201
		c.setTitle(Utils.createProgressionChartTitle(progression, true));
201
		chart.setTitle(Utils.createProgressionChartTitle(progression, true));
202 202
		
203 203
		super.updateChart(result);
204 204
		
tmp/org.txm.progression.core/src/org/txm/progression/core/preferences/ProgressionPreferences.java (revision 575)
27 27
	 */
28 28
	public static final String QUERIES = PREFERENCES_PREFIX + "queries"; //$NON-NLS-1$
29 29
	
30
	/**
31
	 * Structural unit.
32
	 */
33
	public static final String STRUCTURAL_UNIT = PREFERENCES_PREFIX + "structural_unit"; //$NON-NLS-1$
30 34
	
35
	/***
36
	 * Structural unit property.
37
	 */
38
	public static final String STRUCTURAL_UNIT_PROPERTY = PREFERENCES_PREFIX + "structural_unit_property"; //$NON-NLS-1$
39
	
40
	
31 41
	/** The Constant CUMULATIVE. */
32 42
	public static final String CHART_CUMULATIVE = PREFERENCES_PREFIX + "chart_cumulative"; //$NON-NLS-1$
33 43
	
tmp/org.txm.progression.core/src/org/txm/progression/core/functions/Progression.java (revision 575)
62 62
 * @author sjacquot
63 63
 */
64 64
public class Progression extends ChartResult	{
65
	
66
	
67
	/** The norep. */
68
	public static int norep = 1;
65 69

  
70
	/** The prefix r. */
71
	public static String prefixR = "Progression"; //$NON-NLS-1$
72

  
73
	
66 74
	/**
67 75
	 * The corpus.
68 76
	 */
69 77
	protected Corpus corpus;
70 78

  
71
	/** The structure. */
72
	StructuralUnit structuralUnit;
73 79

  
74
	/** The property. */
75
	StructuralUnitProperty property;
76

  
77 80
	/** The propertyregex. */
78
	String propertyRegex;
81
	protected String propertyRegex;
79 82

  
80 83
	/** The Xmin corpus. */
81
	int XminCorpus;
84
	protected int XminCorpus;
82 85

  
83 86
	/** The Xmax corpus. */
84
	int XmaxCorpus;
87
	protected int XmaxCorpus;
85 88
	
86 89
	/** The writer. */
87 90
	private BufferedWriter writer;
88 91

  
89 92
	/** List of token position in the text. */
90
	List<int[]> allPositions;
93
	protected List<int[]> allPositions;
91 94

  
92 95
	/** The structurepositions. */
93
	int[] structurePositions;
96
	protected int[] structurePositions;
94 97

  
95 98
	/** The structurenames. */
96
	String[] structureNames;
99
	protected String[] structureNames;
97 100

  
98 101
	/** graph boundaries. */
99
	int maxY;
102
	protected int maxY;
100 103

  
101 104
	/** The max x. */
102
	int maxX;
105
	protected int maxX;
103 106

  
104 107

  
105 108

  
106 109
	/** The repeatvalues. */
107
	private boolean repeatValues;
110
	protected boolean repeatValues;
108 111

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

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

  
115 118
	
116
	/** The norep. */
117
	public static int norep = 1;
118 119

  
119
	/** The prefix r. */
120
	public static String prefixR = "Progression"; //$NON-NLS-1$
121 120

  
122

  
123

  
124

  
125 121
	
126 122
	/**
127
	 * The queries.
123
	 * Queries.
128 124
	 */
129 125
	@Parameter(key=ProgressionPreferences.QUERIES)
130 126
	protected List<Query> queries;
131 127

  
128
	/**
129
	 * Structural unit.
130
	 */
131
	@Parameter(key=ProgressionPreferences.STRUCTURAL_UNIT)
132
	protected StructuralUnit structuralUnit;
132 133

  
134
	/**
135
	 * Structural unit property.
136
	 */
137
	@Parameter(key=ProgressionPreferences.STRUCTURAL_UNIT_PROPERTY)
138
	protected StructuralUnitProperty structuralUnitProperty;
139

  
133 140
	
134 141
	
135 142
	
136
	
137 143
	/**
138 144
	 * Creates an empty Progression result with no parent.
139 145
	 * @param corpus
......
146 152

  
147 153
	
148 154
	@Override
155
	public boolean loadParameters() {
156
		// FIXME:
157
		System.err.println("Progression.loadParameters(): partially implemented."); //$NON-NLS-1$
158
		
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
		
171
		this.repeatValues = this.getBooleanParameterValue(ProgressionPreferences.CHART_REPEAT_VALUES);
172
		this.bandeMultiplier = this.getFloatParameterValue(ProgressionPreferences.CHART_BANDE_MULTIPLIER);
173
		
174
		
175
		return true;
176
	}
177
	
178

  
179
	
180
	
181
	@Override
149 182
	public boolean canCompute() {
150 183
		// FIXME: not yet implemented
151
		System.err.println("Progression.canCompute(): partially implemented.");
184
		System.err.println("Progression.canCompute(): partially implemented."); //$NON-NLS-1$
152 185
		
153 186
		if(this.corpus == null)	{
154
			System.err.println("Progression.canCompute(): can not compute with no corpus.");
187
			System.err.println("Progression.canCompute(): can not compute with no corpus."); //$NON-NLS-1$
155 188
			return false;
156 189
		}
157 190

  
158 191
		if(this.queries == null)	{
159
			System.err.println("Progression.canCompute(): can not compute with no query.");
192
			System.err.println("Progression.canCompute(): can not compute with no query."); //$NON-NLS-1$
160 193
			return false;
161 194
		}
162 195
		
......
166 199
	@Override
167 200
	public boolean setParameters(TXMParameters parameters) {
168 201
		// TODO Auto-generated method stub
169
		System.err.println("Progression.setParameters(): not yet implemented.");
202
		System.err.println("Progression.setParameters(): not yet implemented."); //$NON-NLS-1$
170 203
		return true;
171 204
	}
172 205

  
173 206
	
174 207
	
175
	@Override
176
	public boolean loadParameters() {
177
		// FIXME:
178
		System.err.println("Progression.loadParameters(): partially implemented.");
179
		
180
		this.repeatValues = this.getBooleanParameterValue(ProgressionPreferences.CHART_REPEAT_VALUES);
181
		this.bandeMultiplier = this.getFloatParameterValue(ProgressionPreferences.CHART_BANDE_MULTIPLIER);
182
		
183
		
184
		return true;
185
	}
186
		
187

  
188
	
189 208
	/**
190 209
	 * 
191 210
	 * @param structuralUnit
......
200 219
	 * @param structuralUnitProperty
201 220
	 */
202 221
	public void setStructuralUnitProperty(StructuralUnitProperty structuralUnitProperty)	{
203
		this.property = structuralUnitProperty;
222
		this.structuralUnitProperty = structuralUnitProperty;
204 223
	}
205 224
	
206 225
	/**
......
214 233
	 * @param repeatValues
215 234
	 * @param bandeMultiplier
216 235
	 */
217
	// FIXME : all parameters related to rendering should removed from this class and centralized in the charts engine system
236
	// FIXME : all parameters related to rendering should be removed from this class and centralized in the charts engine system
218 237
	public void setParameters(List<Query> queries, StructuralUnit structuralUnit, StructuralUnitProperty property, String propertyregex, boolean doCumulative, int lineWidth, boolean repeatValues, float bandeMultiplier)	{
219 238
		this.queries = queries; // the query of the selection
220 239
		this.structuralUnit = structuralUnit;
221
		this.property = property;
240
		this.structuralUnitProperty = property;
222 241
		this.propertyRegex = propertyregex;
223 242
		this.repeatValues = repeatValues;
224 243
		this.bandeMultiplier = bandeMultiplier;
......
246 265
	protected boolean _compute(boolean update) throws Exception {
247 266

  
248 267
		// Queries
249
		if(this.parameterHasChanged(ProgressionPreferences.QUERIES))	{
268
		if(this.hasParameterChanged(ProgressionPreferences.QUERIES))	{
250 269
			this.allPositions = new ArrayList<int[]>();
251 270
			this.structurePositions = new int[0];
252 271
			this.structureNames = new String[0];
......
272 291

  
273 292
		
274 293
		// Finalization steps
275
		if(this.parameterHasChanged(ProgressionPreferences.QUERIES))	{
294
		if(this.hasParameterChanged(ProgressionPreferences.QUERIES))	{
276 295
			this.subTask("Finalizing.");
277 296
			if (!stepFinalize())	{
278 297
				return false;
......
369 388
		// structure query
370 389
		if (structuralUnit != null) {
371 390
			Query query = new Query("<" + structuralUnit.getName() + ">[]"); //$NON-NLS-1$ //$NON-NLS-2$
372
			if (property != null) {
373
				query = new Query("<" + property.getFullName() + ">[]"); //$NON-NLS-1$ //$NON-NLS-2$
391
			if (structuralUnitProperty != null) {
392
				query = new Query("<" + structuralUnitProperty.getFullName() + ">[]"); //$NON-NLS-1$ //$NON-NLS-2$
374 393
				if (propertyRegex != null)
375 394
					query = new Query(
376
							"<"	+ property.getFullName() + "=\"" + propertyRegex + "\">[]"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
395
							"<"	+ structuralUnitProperty.getFullName() + "=\"" + propertyRegex + "\">[]"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
377 396
			}
378 397

  
379 398
			// System.out.println("Struct: "+ structure+" property: "+property);
......
395 414
			
396 415
			
397 416
			Map<Property, List<String>> refValues = new HashMap<Property, List<String>>();
398
			if (property != null) {
399
				List<String> values = CorpusManager.getCorpusManager().getCqiClient().getSingleData(property, starts);
400
				refValues.put(property, values);
417
			if (structuralUnitProperty != null) {
418
				List<String> values = CorpusManager.getCorpusManager().getCqiClient().getSingleData(structuralUnitProperty, starts);
419
				refValues.put(structuralUnitProperty, values);
401 420
			}
402 421

  
403 422
			int i = 0;
......
406 425
			int previousposition = -99999;
407 426
			int distmin = 999999;
408 427
			for (int m : starts) {
409
				if (property != null) {
410
					currentname = refValues.get(property).get(i);
428
				if (structuralUnitProperty != null) {
429
					currentname = refValues.get(structuralUnitProperty).get(i);
411 430
				}
412 431
				else {
413 432
					currentname = structuralUnit.getName() + i;
......
624 643
	 * @return the property
625 644
	 */
626 645
	public StructuralUnitProperty getProperty() {
627
		return property;
646
		return structuralUnitProperty;
628 647
	}
629 648

  
630 649
	/**
......
666 685
	 * Computes and gets a query constructed from all the queries in alternative mode (with pipe |).
667 686
	 * @return
668 687
	 */
688
	// FIXME: not used? even in synchronous editors (concordance and edition?)?
669 689
	public String getQueriesString()	{
670 690
		ArrayList<Integer> allQueriesIndexes = new ArrayList<Integer>(this.queries.size());
671 691
		for(int i = 0; i < this.queries.size(); i++) {
......
732 752
		}
733 753
		catch (Exception e) {
734 754
		}
735
		return "*";
755
		return this.getEmptyName();
736 756
	}
737 757

  
738 758

  
tmp/org.txm.chartsengine.core/src/org/txm/chartsengine/core/results/ChartResult.java (revision 575)
13 13
import org.txm.chartsengine.core.ChartCreator;
14 14
import org.txm.chartsengine.core.ChartsEngine;
15 15
import org.txm.chartsengine.core.preferences.ChartsEnginePreferences;
16
import org.txm.core.preferences.TXMPreferences;
16 17
import org.txm.core.results.Parameter;
17 18
import org.txm.core.results.TXMResult;
18 19
import org.txm.utils.logger.Log;
......
114 115
	 * @return
115 116
	 * @throws Exception
116 117
	 */
117
	public boolean loadInternalParameters() throws Exception {
118
	private final boolean loadInternalParameters() throws Exception {
119
		
120
		// FIXME: Debug
121
		System.err.println("ChartResult.loadInternalParameters(): loading shared parameters into fields.");
122
		
118 123
		this.titleVisible = this.getBooleanParameterValue(ChartsEnginePreferences.SHOW_TITLE);
119 124
		this.legendVisible = this.getBooleanParameterValue(ChartsEnginePreferences.SHOW_LEGEND);
120 125
		this.gridVisible = this.getBooleanParameterValue(ChartsEnginePreferences.SHOW_GRID);
121 126
		this.renderingColorsMode = this.getIntParameterValue(ChartsEnginePreferences.RENDERING_COLORS_MODE);
122 127
		this.font = this.getStringParameterValue(ChartsEnginePreferences.FONT);
123

  
124
		return super.loadParameters();
128
		return true;
125 129
	}
126 130
	
127 131
	
......
131 135
	 * @param key
132 136
	 * @return
133 137
	 */
134
	public boolean renderingParameterHasChanged(String key) {
138
	public boolean hasRenderingParameterChanged(String key) {
135 139
		if ("".equals(key)) {
136 140
			return false;
137 141
		}
......
146 150
	}
147 151

  
148 152

  
149
	/**
150
	 * 
151
	 * @param key
152
	 * @return
153
	 */
154
	protected Object getRenderingParameter(String key) {
155
		List<Field> fields = new ArrayList<Field>();
156
		Class<?> clazz = this.getClass();
157
		while (clazz != Object.class) {
158
			fields.addAll(Arrays.asList(clazz.getDeclaredFields()));
159
			clazz = clazz.getSuperclass();
160
		}
161 153

  
162
		for (Field f : fields) {
163
			Parameter parameter = f.getAnnotation(Parameter.class);
164
			if (parameter == null || parameter.type() != Parameter.RENDERING) {
165
				continue;
166
			}
167
			f.setAccessible(true);
168
			if (parameter.key().equals(key)) {
169
				try {
170
					return f.get(this);
171
				}
172
				catch (Exception e) {
173
					e.printStackTrace();
174
				}
175
			}
176
		}
177
		return null;
178
	}
179 154
	
180 155
	
181 156
	@Override
......
262 237
	
263 238
	/**
264 239
	 * Updates the parameters used for last rendering.
240
	 * Loop through all inherited fields/parameters except those of the TXMResult class.
265 241
	 * @throws Exception
266 242
	 */
267 243
	protected void updateLastRenderingParameters() throws Exception {
268
		Field[] fields = this.getClass().getDeclaredFields();
244

  
245
		List<Field> fields = new ArrayList<Field>();
246
		Class<?> clazz = this.getClass();
247
		while (clazz != TXMResult.class) {
248
			fields.addAll(Arrays.asList(clazz.getDeclaredFields()));
249
			clazz = clazz.getSuperclass();
250
		}
251
		
269 252
		for (Field f : fields) {
270 253
			Parameter parameter = f.getAnnotation(Parameter.class);
271 254
			if (parameter == null || parameter.type() != Parameter.RENDERING) {
......
285 268
		}
286 269
	}
287 270
	
271
	/**
272
	 * 
273
	 * @param key
274
	 * @return
275
	 */
276
	protected Object getRenderingParameter(String key) {
277
		List<Field> fields = new ArrayList<Field>();
278
		Class<?> clazz = this.getClass();
279
		while (clazz != Object.class) {
280
			fields.addAll(Arrays.asList(clazz.getDeclaredFields()));
281
			clazz = clazz.getSuperclass();
282
		}
283

  
284
		for (Field f : fields) {
285
			Parameter parameter = f.getAnnotation(Parameter.class);
286
			if (parameter == null || parameter.type() != Parameter.RENDERING) {
287
				continue;
288
			}
289
			f.setAccessible(true);
290
			if (parameter.key().equals(key)) {
291
				try {
292
					return f.get(this);
293
				}
294
				catch (Exception e) {
295
					e.printStackTrace();
296
				}
297
			}
298
		}
299
		return null;
300
	}
288 301
	
289 302
	public final boolean isChartDirtyFromHistory() throws Exception {
290 303
		Class clazz = this.getClass();
......
499 512
	}
500 513

  
501 514

  
502
	
515
	/**
516
	 * Checks if a preference is empty (equals to "") in the command preference node.
517
	 * An empty preference can be used to disable a functionality for a kind of result
518
	 * (eg. A partition dimension bar chart does not have a legend so it can be used to not offer the hide/show legend button in UI).
519
	 * @param key
520
	 * @return
521
	 */
522
	public boolean isEmptyPreference(String key)	{
523
		return TXMPreferences.isEmpty(this.preferencesNodeQualifier, key);
524
	}
503 525

  
504 526
	// FIXME
505 527
//	public Object createChart(IProgressMonitor monitor, String chartType)	{
tmp/org.txm.concordance.core/src/org/txm/concordance/core/functions/Concordance.java (revision 575)
747 747

  
748 748
	@Override
749 749
	public String getSimpleName() {
750
		if (pQuery != null) return pQuery.toString();
750
		if (pQuery != null) {
751
			return pQuery.toString();
752
		}
751 753
		return this.getName();
752 754
	}
753 755

  
tmp/org.txm.chartsengine.jfreechart.core/src/org/txm/chartsengine/jfreechart/core/JFCChartCreator.java (revision 575)
46 46

  
47 47
			
48 48
			// title visibility
49
			if(chart.getTitle() != null && result.renderingParameterHasChanged(ChartsEnginePreferences.SHOW_TITLE))	{
49
			if(chart.getTitle() != null && result.hasRenderingParameterChanged(ChartsEnginePreferences.SHOW_TITLE))	{
50 50
				chart.getTitle().setVisible(result.isTitleVisible());
51 51
			}
52 52
			// legend visibility
53
			if(chart.getLegend() != null && result.renderingParameterHasChanged(ChartsEnginePreferences.SHOW_LEGEND))	{
53
			if(chart.getLegend() != null && result.hasRenderingParameterChanged(ChartsEnginePreferences.SHOW_LEGEND))	{
54 54
				chart.getLegend().setVisible(result.isLegendVisible());
55 55
			}
56 56
			
57 57
			// grid visibility
58
			if(result.renderingParameterHasChanged(ChartsEnginePreferences.SHOW_GRID))	{
58
			if(result.hasRenderingParameterChanged(ChartsEnginePreferences.SHOW_GRID))	{
59 59
				// CategoryPlot
60 60
				if(chart.getPlot() instanceof CategoryPlot)	{
61 61
					CategoryPlot plot = (CategoryPlot) chart.getPlot();
tmp/org.txm.lexicaltable.core/src/org/txm/lexicaltable/core/functions/LexicalTable.java (revision 575)
118 118
	 */
119 119
	public LexicalTable(Partition partition) throws CqiClientException	{
120 120
		super(partition);
121
		this.loadParameters();
122 121
	}
123 122
	
124 123
	/**
tmp/org.txm.rcp/src/main/java/org/txm/rcp/preferences/TXMPreferenceStore.java (revision 575)
12 12
public class TXMPreferenceStore extends ScopedPreferenceStore {
13 13

  
14 14
	/**
15
	 * Node qualifier.
16
	 */
17
	protected String nodeQualifier;
18
	
19
	/**
15 20
	 * 
16 21
	 * @param qualifier
17 22
	 */
18 23
	public TXMPreferenceStore(String qualifier) {
19 24
		super(InstanceScope.INSTANCE, qualifier);
25
		this.nodeQualifier = qualifier;
20 26
	}
21 27

  
28
	/**
29
	 * @return the nodeQualifier
30
	 */
31
	public String getNodeQualifier() {
32
		return nodeQualifier;
33
	}
34

  
22 35
}
tmp/org.txm.rcp/src/main/java/org/txm/rcp/editors/TXMEditorPart.java (revision 575)
241 241
    }
242 242
	
243 243
	/**
244
	 * Returns the preferences node qualifier linked to the result of this editor.
245
	 * @return
246
	 */
247
	public String getPreferencesNodeQualifier() {
248
		return this.getResultData().getPreferencesNodeQualifier();
249
	}
250
	
251
	/**
252 244
	 * Returns the result object associated with the editor through its editor input.
253 245
	 * @return
254 246
	 */
......
359 351
		
360 352
		StatusLine.setMessage("Computing " + editorInput.getResult().getName());
361 353
		
362
		JobHandler job = new JobHandler("Computing "+editorInput.getResult()) {
354
		JobHandler job = new JobHandler("Computing " + editorInput.getResult().getName()) {
363 355

  
364 356
			TXMEditorPart currentEditor = null;
365 357
			
......
395 387
									currentEditor = (TXMEditorPart) page.openEditor(editorInput, editorId, true, IWorkbenchPage.MATCH_INPUT | IWorkbenchPage.MATCH_ID);
396 388
								} catch (Exception e) {
397 389
									System.err.println("TXMEditorPart.compute(): could not open editor: " + e.getLocalizedMessage());
398
									org.txm.rcp.utils.Logger.printStackTrace(e);
390
									Log.printStackTrace(e);
399 391
								}
400 392
							}
401 393
						});
tmp/org.txm.cah.core/src/org/txm/cah/core/functions/AHC.java (revision 575)
211 211
	@Override
212 212
	protected boolean _compute(boolean update)	{
213 213

  
214
		this.loadParameters();
215

  
216

  
217

  
218 214
		
219 215
		Log.info("Computing CAH...");
220 216
		try {
tmp/org.txm.partition.core/src/org/txm/partition/core/functions/PartitionDimensions.java (revision 575)
10 10
import java.util.List;
11 11

  
12 12
import org.txm.chartsengine.core.results.ChartResult;
13
import org.txm.core.preferences.TXMPreferences;
14 13
import org.txm.core.results.Parameter;
15 14
import org.txm.core.results.TXMParameters;
16 15
import org.txm.partition.core.messages.PartitionCoreMessages;
......
40 39
	
41 40
	
42 41
	
42
	/**
43
	 * To display or not the parts count in chart title.
44
	 */
43 45
	@Parameter(key=PartitionDimensionsPreferences.CHART_DIMENSIONS_DISPLAY_PARTS_COUNT_IN_TITLE, type=Parameter.RENDERING)
44
	protected boolean displayPartCountInTitle;
46
	protected boolean displayPartsCountInTitle;
45 47

  
48
	/**
49
	 * To sort or not the parts by size.
50
	 */
46 51
	@Parameter(key=PartitionDimensionsPreferences.CHART_DIMENSIONS_SORT_BY_SIZE, type=Parameter.RENDERING)
47 52
	protected boolean sortBySize;
48 53

  
49 54
	
55
	
56
	
50 57
	/**
51 58
	 * Creates a partition dimensions result from the specified <link>Partition</link>.
52 59
	 */
53 60
	public PartitionDimensions(Partition partition) {
54 61
		super(partition);
55
		this.loadParameters();
56 62
	}
57 63

  
58 64

  
59 65

  
60 66
	@Override
61 67
	public boolean loadParameters() {
62
		this.displayPartCountInTitle = this.getBooleanParameterValue(PartitionDimensionsPreferences.CHART_DIMENSIONS_DISPLAY_PARTS_COUNT_IN_TITLE);
68
		this.displayPartsCountInTitle = this.getBooleanParameterValue(PartitionDimensionsPreferences.CHART_DIMENSIONS_DISPLAY_PARTS_COUNT_IN_TITLE);
63 69
		this.sortBySize = this.getBooleanParameterValue(PartitionDimensionsPreferences.CHART_DIMENSIONS_SORT_BY_SIZE);
64 70
		return true;
65 71
	}
......
215 221
	 * @return the displayPartCountInTitle
216 222
	 */
217 223
	public boolean isDisplayingPartCountInTitle() {
218
		return displayPartCountInTitle;
224
		return displayPartsCountInTitle;
219 225
	}
220 226

  
221 227
}
tmp/org.txm.partition.core/src/org/txm/partition/core/chartsengine/jfreechart/JFCPartitionDimensionsBarChartCreator.java (revision 575)
65 65
		boolean displayPartsCountInTitle = partitionDimensions.isDisplayingPartCountInTitle();
66 66
		
67 67
		
68
		if(result.renderingParameterHasChanged(PartitionDimensionsPreferences.CHART_DIMENSIONS_SORT_BY_SIZE))	{
68
		if(result.hasRenderingParameterChanged(PartitionDimensionsPreferences.CHART_DIMENSIONS_SORT_BY_SIZE))	{
69 69
			// Fill the data set
70 70
			XYSeriesCollection dataset = (XYSeriesCollection) chart.getXYPlot().getDataset();
71 71
			dataset.removeAllSeries();
tmp/org.txm.specificities.rcp/src/org/txm/specificities/rcp/editors/SpecificitiesSelectionEditor.java (revision 575)
59 59
		banality.setIncrement(1);
60 60
		banality.setMinimum(0);
61 61
		banality.setMaximum(200);
62
		banality.setSelection(((int) (getResultData().getBanality() * Math.pow(10, nbDigits))));
62
		banality.setSelection(((int) (this.getResultData().getBanality() * Math.pow(10, nbDigits))));
63 63
		banality.addSelectionListener(new SelectionListener() {
64 64
			
65 65
			@Override
tmp/org.txm.textsbalance.core/src/org/txm/textsbalance/core/functions/TextsBalance.java (revision 575)
104 104
	 */
105 105
	protected boolean _compute(boolean update) {
106 106
		
107
		loadParameters();
108
		
109 107
		this.name = structuralUnit.getName() + "@" + suPropertyName + " (group by texts = " + groupByTexts + ")";
110 108
		if (suPropertyName == null || suPropertyName.length() == 0) {
111 109
			return false;
tmp/org.txm.specificities.core/src/org/txm/specificities/core/functions/SpecificitiesSelection.java (revision 575)
35 35

  
36 36

  
37 37
	
38
	@Parameter(type=Parameter.RENDERING)
38
	@Parameter(key=SpecificitiesPreferences.CHART_TRANSPOSE, type=Parameter.RENDERING)
39 39
	protected boolean groupByLines;
40 40
	
41
	@Parameter(type=Parameter.RENDERING)
41
	@Parameter(key=SpecificitiesPreferences.CHART_BANALITY, type=Parameter.RENDERING)
42 42
	protected float banality;
43 43

  
44
	@Parameter(type=Parameter.RENDERING)
44
	@Parameter(key=SpecificitiesPreferences.CHART_DRAW_BARS, type=Parameter.RENDERING)
45 45
	protected boolean drawBars;
46 46

  
47
	@Parameter(type=Parameter.RENDERING)
47
	@Parameter(key=SpecificitiesPreferences.CHART_DRAW_LINES, type=Parameter.RENDERING)
48 48
	protected boolean drawLines;
49 49

  
50 50
	/**
......
53 53
	 */
54 54
	public SpecificitiesSelection(Specificities parent) {
55 55
		super(parent);
56
		this.loadParameters();
57 56
	}
58 57

  
59 58
	
......
112 111
	}
113 112

  
114 113

  
115
	
116
	/* (non-Javadoc)
117
	 * @see org.txm.core.results.TXMResult#getName()
118
	 */
119 114
	@Override
120 115
	public String getName() {
121 116
		String name = "";
......
125 120
		return name;
126 121
	}
127 122

  
128
	/* (non-Javadoc)
129
	 * @see org.txm.core.results.TXMResult#getSimpleName()
130
	 */
131 123
	@Override
132 124
	public String getSimpleName() {
133 125
		// TODO Auto-generated method stub
134 126
		return this.getName();
135 127
	}
136 128

  
137
	/* (non-Javadoc)
138
	 * @see org.txm.core.results.TXMResult#getDetails()
139
	 */
140 129
	@Override
141 130
	public String getDetails() {
142 131
		// TODO Auto-generated method stub
143 132
		return this.getName();
144 133
	}
145 134

  
146
	/* (non-Javadoc)
147
	 * @see org.txm.core.results.TXMResult#clean()
148
	 */
149 135
	@Override
150 136
	public void clean() {
151 137
		//does nothing
152 138
	}
153 139

  
154
	/* (non-Javadoc)
155
	 * @see org.txm.core.results.TXMResult#canCompute()
156
	 */
157 140
	@Override
158 141
	public boolean canCompute() throws Exception {
159 142
		return this.parent != null;
160 143
	}
161 144

  
162
	/* (non-Javadoc)
163
	 * @see org.txm.core.results.TXMResult#_compute(boolean)
164
	 */
165 145
	@Override
166 146
	protected boolean _compute(boolean update) throws Exception {
167 147
		// does nothing
......
175 155
		return true;
176 156
	}
177 157

  
178

  
179
	
180
	/* (non-Javadoc)
181
	 * @see org.txm.core.results.TXMResult#toTxt(java.io.File, java.lang.String, java.lang.String, java.lang.String)
182
	 */
183 158
	@Override
184 159
	public boolean toTxt(File outfile, String encoding, String colseparator, String txtseparator) throws Exception {
185 160
		// TODO Auto-generated method stub
......
187 162
	}
188 163

  
189 164

  
190

  
191 165
	/**
192 166
	 * @return the groupByLines
193 167
	 */

Also available in: Unified diff