Révision 3563
TXM/trunk/org.txm.partition.core/src/org/txm/partition/core/preferences/PartitionDimensionsPreferences.java (revision 3563) | ||
---|---|---|
7 | 7 |
|
8 | 8 |
/** |
9 | 9 |
* Default preferences initializer. |
10 |
* |
|
10 | 11 |
* @author sjacquot |
11 | 12 |
* |
12 | 13 |
*/ |
... | ... | |
26 | 27 |
return TXMPreferences.instances.get(PartitionDimensionsPreferences.class); |
27 | 28 |
} |
28 | 29 |
|
30 |
|
|
29 | 31 |
@Override |
30 | 32 |
public void initializeDefaultPreferences() { |
31 | 33 |
super.initializeDefaultPreferences(); |
TXM/trunk/org.txm.chartsengine.r.core/src/org/txm/chartsengine/r/core/RChartsEngine.java (revision 3563) | ||
---|---|---|
41 | 41 |
/** |
42 | 42 |
* Constants for extra output formats. |
43 | 43 |
*/ |
44 |
// FIXME : for tests or further output formats implementations
|
|
44 |
// FIXME: SJ: for tests or further output formats implementations
|
|
45 | 45 |
// public final static String OUTPUT_FORMAT_RGRAPHICS = "rgraphics", OUTPUT_FORMAT_IPLOT = "iplots", OUTPUT_FORMAT_JAVAGD = "javagd"; //$NON-NLS-1$ //$NON-NLS-2$ |
46 | 46 |
|
47 | 47 |
|
... | ... | |
215 | 215 |
*/ |
216 | 216 |
public String getTitlePlotCmd(String title) { |
217 | 217 |
|
218 |
// FIXME: Tests |
|
219 |
// title(main = "Titre principal", sub = "Sous-titre", |
|
220 |
// xlab = "Axe des x", ylab = "Axe des y", |
|
221 |
// cex.main = 2, font.main= 4, col.main= "red", |
|
222 |
// cex.sub = 0.75, font.sub = 3, col.sub = "green", |
|
223 |
// col.lab ="darkblue" |
|
224 |
// ) |
|
225 |
|
|
218 |
// FIXME: SJ: old version without truncated title |
|
226 | 219 |
// return String.format("title(main = \"%s\");\n", title); //$NON-NLS-1$ |
227 | 220 |
|
228 |
// FIXME: tests for adaptive not truncated title |
|
221 |
// FIXME: SJ: tests for adaptive not truncated title
|
|
229 | 222 |
return String.format("title(main = paste(strwrap(\"%s\", width = 50), collapse = \"\n\"));\n", title); //$NON-NLS-1$ |
230 | 223 |
|
231 | 224 |
|
... | ... | |
238 | 231 |
* @return |
239 | 232 |
*/ |
240 | 233 |
public String getSubtitlePlotCmd(String subtitle) { |
241 |
// NOTE: SJ: sub title always drawn the string at bottom of the plot
|
|
234 |
// FIXME: SJ: subtitle always drawn the string at bottom of the plot
|
|
242 | 235 |
// return String.format("title(sub = \"%s\");\n", subtitle); //$NON-NLS-1$ |
243 | 236 |
return String.format("title(main = \"\n\n\n%s\");\n", subtitle); //$NON-NLS-1$ |
244 | 237 |
} |
... | ... | |
284 | 277 |
public void setOutputFormat(String outputFormat) { |
285 | 278 |
this.outputFormat = outputFormat; |
286 | 279 |
|
287 |
// FIXME : SJ: voir comment gérer cela autrement + supprimer certaines méthodes du RDevice devenues inutiles depuis qu'on stocke outputFormat ?
|
|
280 |
// FIXME: SJ: voir comment gérer cela autrement + supprimer certaines méthodes du RDevice devenues inutiles depuis qu'on stocke outputFormat ? |
|
288 | 281 |
if (outputFormat.equals(ChartsEngine.OUTPUT_FORMAT_JPEG)) { |
289 | 282 |
this.rDevice = RDevice.JPEG; |
290 | 283 |
} |
... | ... | |
309 | 302 |
public ArrayList<String> getSupportedOutputDisplayFormats() { |
310 | 303 |
ArrayList<String> formats = new ArrayList<>(1); |
311 | 304 |
|
312 |
// FIXME: UI display output format, only SVG |
|
305 |
// FIXME: SJ: UI display output format, only SVG
|
|
313 | 306 |
// formats.add(outputFormatDefinitions.get(JFCChartsEngine.OUTPUT_FORMAT_SVG)); |
314 | 307 |
|
315 | 308 |
return formats; |
TXM/trunk/org.txm.progression.core/src/org/txm/progression/core/functions/Progression.java (revision 3563) | ||
---|---|---|
145 | 145 |
@Parameter(key = ProgressionPreferences.PROPERTY_REGEX) |
146 | 146 |
protected String propertyRegex; |
147 | 147 |
|
148 |
|
|
149 | 148 |
/** |
150 | 149 |
* Repeats or not the same value when displaying the section markers. |
151 | 150 |
*/ |
TXM/trunk/org.txm.links.rcp/src/org/txm/links/rcp/handlers/SendSelectionToQueryable.java (revision 3563) | ||
---|---|---|
92 | 92 |
|
93 | 93 |
if (selection != null && !selection.isEmpty()) { |
94 | 94 |
|
95 |
|
|
96 |
|
|
97 | 95 |
String query = this.createQuery(event, selection); |
98 | 96 |
String queries = this.createQueries(event, selection); |
99 | 97 |
Integer index = this.getIndexResult(event, selection); |
... | ... | |
107 | 105 |
// create a local result node in the project node, store in some parameters and call the linked command |
108 | 106 |
String id = event.getCommand().getId(); |
109 | 107 |
TXMResult result = this.getResultParent(event, id); |
110 |
String resultParametersNodePath = result.getProject().getParametersNodeRootPath() + TXMResult.createUUID() + "_link"; // FIXME: we can't put the class name here since //$NON-NLS-1$ |
|
111 |
// we does not know the target class |
|
108 |
// FIXME: we can't put the class name here since we does not know the target class |
|
109 |
String resultParametersNodePath = result.getProject().getParametersNodeRootPath() + TXMResult.createUUID() + "_link"; //$NON-NLS-1$ |
|
110 |
|
|
112 | 111 |
TXMPreferences.put(resultParametersNodePath, TXMPreferences.PARENT_PARAMETERS_NODE_PATH, result.getParametersNodePath()); |
113 | 112 |
TXMPreferences.put(resultParametersNodePath, TXMPreferences.QUERY, query); |
114 | 113 |
TXMPreferences.put(resultParametersNodePath, TXMPreferences.QUERIES, queries); |
TXM/trunk/org.txm.links.rcp/src/org/txm/links/rcp/handlers/SendSelectionToMatchable.java (revision 3563) | ||
---|---|---|
41 | 41 |
import org.txm.links.rcp.messages.Messages; |
42 | 42 |
|
43 | 43 |
/** |
44 |
* Base command to send a selection to a command that needs a query to compute the new result.
|
|
44 |
* Base command to send a selection to a command that needs a result of query (List<Match>) to compute the new result.
|
|
45 | 45 |
* |
46 | 46 |
* @author mdecorde |
47 | 47 |
* @author sjacquot |
... | ... | |
77 | 77 |
Log.severe(Messages.bind(Messages.NoResultFondWithP0, event)); |
78 | 78 |
return null; |
79 | 79 |
} |
80 |
String resultParametersNodePath = result.getProject().getParametersNodeRootPath() + TXMResult.createUUID() + "_link"; // FIXME: we can't put the class name here since we does not know the //$NON-NLS-1$ |
|
81 |
// target class |
|
80 |
// FIXME: SJ: we can't put the class name here since we does not know the target class |
|
81 |
String resultParametersNodePath = result.getProject().getParametersNodeRootPath() + TXMResult.createUUID() + "_link"; //$NON-NLS-1$ |
|
82 |
|
|
82 | 83 |
TXMPreferences.put(resultParametersNodePath, TXMPreferences.PARENT_PARAMETERS_NODE_PATH, result.getParametersNodePath()); |
83 | 84 |
TXMPreferences.put(resultParametersNodePath, TXMPreferences.MATCHES, matches.toString()); |
84 | 85 |
|
TXM/trunk/org.txm.chartsengine.jfreechart.core/src/org/txm/chartsengine/jfreechart/core/themes/base/JFCTheme.java (revision 3563) | ||
---|---|---|
144 | 144 |
Font baseFont = ChartsEngine.createFont(result.getFont()); |
145 | 145 |
|
146 | 146 |
// Titles |
147 |
this.setExtraLargeFont(baseFont.deriveFont(Font.BOLD, baseFont.getSize() + 5));
|
|
147 |
this.setExtraLargeFont(baseFont.deriveFont(baseFont.getStyle(), baseFont.getSize() + 5));
|
|
148 | 148 |
|
149 | 149 |
// Axis |
150 |
this.setLargeFont(baseFont.deriveFont(Font.BOLD, baseFont.getSize() + 4)); // axis labels
|
|
150 |
this.setLargeFont(baseFont.deriveFont(baseFont.getStyle(), baseFont.getSize() + 4)); // axis labels
|
|
151 | 151 |
|
152 |
// FIXME: use for what chart items? maybe annotations?
|
|
153 |
this.setSmallFont(baseFont.deriveFont(Font.BOLD, this.getExtraLargeFont().getSize() - 1));
|
|
152 |
// FIXME: SJ: used for what chart items? maybe annotations?
|
|
153 |
this.setSmallFont(baseFont.deriveFont(baseFont.getStyle(), this.getExtraLargeFont().getSize() - 1));
|
|
154 | 154 |
|
155 | 155 |
// Item labels, legend labels, axis ticks labels |
156 |
this.regularFont = baseFont.deriveFont(Font.BOLD, baseFont.getSize());
|
|
156 |
this.regularFont = baseFont.deriveFont(baseFont.getStyle(), baseFont.getSize());
|
|
157 | 157 |
this.setRegularFont(this.regularFont); |
158 | 158 |
|
159 | 159 |
} |
... | ... | |
240 | 240 |
|
241 | 241 |
/** |
242 | 242 |
* Creates a chart panel with theme settings. |
243 |
* The overriding methods of subclass should manually call :
|
|
243 |
* The overriding methods of subclass should manually calls:
|
|
244 | 244 |
* <code> |
245 | 245 |
* // Apply theme to the chart |
246 | 246 |
* if(chartPanel.getChart() != null) { |
TXM/trunk/org.txm.chartsengine.core/src/org/txm/chartsengine/core/preferences/ChartsEnginePreferences.java (revision 3563) | ||
---|---|---|
16 | 16 |
public class ChartsEnginePreferences extends TXMPreferences { |
17 | 17 |
|
18 | 18 |
|
19 |
// Engine preferences |
|
19 | 20 |
/** |
20 | 21 |
* The name of the current charts engine. |
21 | 22 |
*/ |
... | ... | |
35 | 36 |
|
36 | 37 |
|
37 | 38 |
|
39 |
// Result preferences |
|
38 | 40 |
/** |
39 | 41 |
* Constant for showing title or not in the charts. |
40 | 42 |
*/ |
... | ... | |
74 | 76 |
*/ |
75 | 77 |
public static final String MULTIPLE_LINE_STROKES = "multiple_line_strokes"; //$NON-NLS-1$ |
76 | 78 |
|
77 |
|
|
78 |
// local result preferences |
|
79 | 79 |
/** |
80 | 80 |
* Chart type. |
81 | 81 |
*/ |
... | ... | |
87 | 87 |
public final static String DEFAULT_CHART_TYPE = "[Default]"; //$NON-NLS-1$ |
88 | 88 |
|
89 | 89 |
|
90 |
|
|
90 | 91 |
/** |
91 | 92 |
* Gets the instance. |
92 | 93 |
* |
... | ... | |
125 | 126 |
preferences.put(MONOCHROME_COLOR, "0,220,20"); //$NON-NLS-1$ |
126 | 127 |
preferences.putBoolean(MULTIPLE_LINE_STROKES, false); |
127 | 128 |
|
128 |
// Check the target OS and set the default font from the JVM embedded font
|
|
129 |
// Check the target OS and set the default font using encoded String in JFace StringConverter format (?|Font name|size|style|?|?|...)
|
|
129 | 130 |
String defaultFont; |
130 | 131 |
if (OSDetector.isFamilyUnix()) { |
131 |
defaultFont = "1|Lucida Sans|11.0|0|GTK|1|"; //$NON-NLS-1$ // other version if needed later: "1|Lucida Sans|11|0"
|
|
132 |
defaultFont = "1|Lucida Sans|11.0|1|GTK|1|"; //$NON-NLS-1$
|
|
132 | 133 |
} |
133 | 134 |
else { |
134 |
defaultFont = "1|Lucida Sans Unicode|11.0|0|WINDOWS|1|-16|0|0|0|400|0|0|0|0|3|2|1|34|Lucida Sans Unicode;"; //$NON-NLS-1$
|
|
135 |
defaultFont = "1|Lucida Sans Unicode|11.0|1|WINDOWS|1|-16|0|0|0|400|0|0|0|0|3|2|1|34|Lucida Sans Unicode;"; //$NON-NLS-1$
|
|
135 | 136 |
} |
136 | 137 |
|
137 | 138 |
preferences.put(FONT, defaultFont); |
... | ... | |
144 | 145 |
* @param enginesOrder |
145 | 146 |
* @return |
146 | 147 |
*/ |
148 |
//FIXME: SJ: not fully tested and unfinished feature |
|
147 | 149 |
public static String[] getEnginesOrder(String enginesOrder) { |
148 | 150 |
|
149 |
String[] orderedEnginesNames = enginesOrder.split("\\|"); |
|
151 |
String[] orderedEnginesNames = enginesOrder.split("\\|"); //$NON-NLS-1$
|
|
150 | 152 |
|
151 | 153 |
if (orderedEnginesNames.length == 1 && orderedEnginesNames[0].isEmpty()) { |
152 | 154 |
return null; |
... | ... | |
163 | 165 |
* @param enginesNames |
164 | 166 |
* @return |
165 | 167 |
*/ |
168 |
//FIXME: SJ: not fully tested and unfinished feature |
|
166 | 169 |
public static String createEnginesOrder(String[] enginesNames) { |
167 | 170 |
StringBuilder sb = new StringBuilder(); |
168 | 171 |
for (int i = 0; i < enginesNames.length; i++) { |
169 | 172 |
if (i > 0) { |
170 |
sb.append("|"); |
|
173 |
sb.append("|"); //$NON-NLS-1$
|
|
171 | 174 |
} |
172 | 175 |
sb.append(enginesNames[i]); |
173 | 176 |
} |
174 | 177 |
|
175 |
Log.finest("ChartsEnginePreferences.createChartsEnginesOrder():" + sb); |
|
178 |
Log.finest("ChartsEnginePreferences.createChartsEnginesOrder():" + sb); //$NON-NLS-1$
|
|
176 | 179 |
|
177 | 180 |
return sb.toString(); |
178 | 181 |
} |
... | ... | |
183 | 186 |
* @param enginesOrder |
184 | 187 |
* @return |
185 | 188 |
*/ |
189 |
//FIXME: SJ: not fully tested and unfinished feature |
|
186 | 190 |
public static String getFirstEngineName() { |
187 | 191 |
return getEnginesOrder(getInstance().getString(CHARTS_ENGINES_ORDER))[0]; |
188 | 192 |
} |
... | ... | |
193 | 197 |
* |
194 | 198 |
* @return |
195 | 199 |
*/ |
200 |
//FIXME: SJ: not fully tested and unfinished feature |
|
196 | 201 |
public String[] getEnginesOrder() { |
197 | 202 |
return getEnginesOrder(this.getString(ChartsEnginePreferences.CHARTS_ENGINES_ORDER)); |
198 | 203 |
} |
TXM/trunk/org.txm.chartsengine.core/src/org/txm/chartsengine/core/results/ChartResult.java (revision 3563) | ||
---|---|---|
676 | 676 |
|
677 | 677 |
|
678 | 678 |
/** |
679 |
* Sets the font. |
|
679 |
* Sets the font using encoded String in JFace StringConverter format (e.g.: "1|Lucida Sans Unicode|12.0|0|WINDOWS|1|-16|0|0|0|400|0|0|0|0|3|2|1|34|Lucida Sans Unicode;").
|
|
680 | 680 |
* |
681 | 681 |
* @param font the font to set |
682 | 682 |
*/ |
TXM/trunk/org.txm.chartsengine.core/src/org/txm/chartsengine/core/ChartsEngine.java (revision 3563) | ||
---|---|---|
331 | 331 |
} |
332 | 332 |
|
333 | 333 |
/** |
334 |
* Creates a font from the specified encoded String in JFace format (e.g.: "1|Lucida Sans Unicode|12.0|0|WINDOWS|1|-16|0|0|0|400|0|0|0|0|3|2|1|34|Lucida Sans Unicode;")
|
|
334 |
* Creates a AWT font from the specified encoded String (in JFace StringConverter format, e.g.: "1|Lucida Sans Unicode|12.0|0|WINDOWS|1|-16|0|0|0|400|0|0|0|0|3|2|1|34|Lucida Sans Unicode;").
|
|
335 | 335 |
* |
336 | 336 |
* @param encodedStr |
337 | 337 |
* @return the decoded font |
... | ... | |
339 | 339 |
public static Font createFont(String encodedStr) { |
340 | 340 |
String[] data = encodedStr.split("\\|"); |
341 | 341 |
Font font = new Font(data[1], // font name |
342 |
Integer.valueOf(data[3]), // font style |
|
342 |
//3, // font style |
|
343 |
Integer.valueOf(data[3]), // font style |
|
344 |
|
|
343 | 345 |
Integer.parseInt(data[2].split("\\.")[0])); // font size |
344 | 346 |
return font; |
345 | 347 |
} |
346 | 348 |
|
347 | 349 |
/** |
348 |
* Creates a font from the current global charts engine font preference.
|
|
350 |
* Creates a AWT font from the current global charts engine font preference encoded String (in JFace StringConverter format, e.g.: "1|Lucida Sans Unicode|12.0|0|WINDOWS|1|-16|0|0|0|400|0|0|0|0|3|2|1|34|Lucida Sans Unicode;").
|
|
349 | 351 |
* |
350 | 352 |
* @return |
351 | 353 |
*/ |
TXM/trunk/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/CQPPreferences.java (revision 3563) | ||
---|---|---|
1 | 1 |
package org.txm.searchengine.cqp; |
2 | 2 |
|
3 |
import org.osgi.service.prefs.Preferences; |
|
4 | 3 |
import org.txm.core.preferences.TXMPreferences; |
5 | 4 |
|
6 | 5 |
/** |
... | ... | |
14 | 13 |
|
15 | 14 |
|
16 | 15 |
/** |
17 |
* List of part names |
|
16 |
* List of part names.
|
|
18 | 17 |
*/ |
19 | 18 |
public static final String PART_NAMES = "part_names"; //$NON-NLS-1$ |
20 | 19 |
|
... | ... | |
34 | 33 |
@Override |
35 | 34 |
public void initializeDefaultPreferences() { |
36 | 35 |
super.initializeDefaultPreferences(); |
37 |
Preferences preferences = this.getDefaultPreferencesNode(); |
|
38 | 36 |
} |
39 | 37 |
} |
TXM/trunk/org.txm.progression.rcp/src/org/txm/progression/rcp/handlers/ComputeProgression.java (revision 3563) | ||
---|---|---|
58 | 58 |
Progression progression = null; |
59 | 59 |
|
60 | 60 |
// From link: creating from parameter node |
61 |
//FIXME: SJ: all "Send to" commands have a different node path schema since we do not know the target class in the source handler (the class string is replaced with "_link") |
|
61 | 62 |
String parametersNodePath = event.getParameter(TXMPreferences.RESULT_PARAMETERS_NODE_PATH); |
62 | 63 |
if (parametersNodePath != null && !parametersNodePath.isEmpty()) { |
63 | 64 |
progression = new Progression(parametersNodePath); |
TXM/trunk/org.txm.rcp/src/main/java/org/txm/rcp/editors/TXMEditorToolBar.java (revision 3563) | ||
---|---|---|
11 | 11 |
import org.eclipse.swt.layout.FillLayout; |
12 | 12 |
import org.eclipse.swt.layout.GridData; |
13 | 13 |
import org.eclipse.swt.layout.RowLayout; |
14 |
import org.eclipse.swt.widgets.Combo; |
|
14 | 15 |
import org.eclipse.swt.widgets.Composite; |
15 | 16 |
import org.eclipse.swt.widgets.Control; |
16 | 17 |
import org.eclipse.swt.widgets.Event; |
... | ... | |
70 | 71 |
public TXMEditorToolBar(TXMEditor<? extends TXMResult> editor, Composite parent, GLComposite subWidgetComposite, int style, String toolbarId) { |
71 | 72 |
super(parent, style); |
72 | 73 |
|
73 |
this.setLayout(new FillLayout()); |
|
74 |
FillLayout layout = new FillLayout(); |
|
75 |
this.setLayout(layout); |
|
74 | 76 |
|
75 | 77 |
this.editorPart = editor; |
76 | 78 |
this.subWidgetComposite = subWidgetComposite; |
... | ... | |
147 | 149 |
|
148 | 150 |
|
149 | 151 |
/** |
150 |
* Adds the specified control to this toolbar.
|
|
151 |
* Convenience method to add non-ToolItem controls to the toolbar using the SWT.SEPARATOR trick, plus packing and setting the right width.
|
|
152 |
* Adds the specified Combo to this tool bar.
|
|
153 |
* Convenience method to add non-ToolItem Combo to the tool bar using the SWT.SEPARATOR trick, plus to pack and to set the right width.
|
|
152 | 154 |
* |
153 |
* Warning: the item size is not synchronized with the control size |
|
154 |
* |
|
155 |
* @param control |
|
155 |
* @param combo |
|
156 | 156 |
*/ |
157 |
public void addControl(final Control control) {
|
|
157 |
public void addControl(final Combo combo) {
|
|
158 | 158 |
final ToolItem itemSeparator = new ToolItem(this, SWT.SEPARATOR); |
159 |
control.pack();
|
|
160 |
itemSeparator.setWidth(control.getBounds().width);
|
|
161 |
itemSeparator.setControl(control);
|
|
162 |
control.addListener(SWT.RESIZE, new Listener() {
|
|
159 |
combo.pack();
|
|
160 |
itemSeparator.setWidth(combo.getBounds().width);
|
|
161 |
itemSeparator.setControl(combo);
|
|
162 |
Listener listener = new Listener() {
|
|
163 | 163 |
|
164 | 164 |
@Override |
165 | 165 |
public void handleEvent(Event event) { |
166 |
itemSeparator.setWidth(control.getBounds().width); |
|
166 |
combo.pack(); |
|
167 |
itemSeparator.setWidth(combo.getBounds().width); |
|
167 | 168 |
} |
168 |
}); |
|
169 |
}; |
|
170 |
|
|
171 |
|
|
172 |
combo.addListener(SWT.RESIZE, listener); |
|
173 |
combo.addListener(SWT.Modify, listener); |
|
169 | 174 |
} |
170 | 175 |
|
171 | 176 |
/** |
... | ... | |
270 | 275 |
layout.wrap = true; |
271 | 276 |
layout.center = true; |
272 | 277 |
layout.spacing = 8; |
273 |
layout.marginWidth = layout.marginBottom = layout.marginHeight = layout.marginTop = 0; |
|
278 |
layout.marginWidth = 0; |
|
279 |
layout.marginBottom = 0; |
|
280 |
layout.marginHeight = 0; |
|
281 |
layout.marginTop = 0; |
|
274 | 282 |
|
275 | 283 |
group.setLayout(layout); |
276 | 284 |
|
TXM/trunk/org.txm.rcp/src/main/java/org/txm/rcp/editors/TXMEditor.java (revision 3563) | ||
---|---|---|
994 | 994 |
|
995 | 995 |
notifyExtensions("notifyStartOfCompute"); //$NON-NLS-1$ |
996 | 996 |
|
997 |
|
|
998 |
// FIXME: SJ: tests for using the delay managed ComputeProgressMonitorDialog. |
|
999 |
// Purpose is to display a Modal Dialog only after an amount of time |
|
1000 |
// At this time the monitor is only used in OpenEditor, need to see if we need it for all computing process |
|
1001 |
// Actually the system may be robust enough now to not use a modal dialog event in OpenEditor? |
|
1002 |
// this.syncExec(new Runnable() { |
|
1003 |
// |
|
1004 |
// @Override |
|
1005 |
// public void run() { |
|
1006 |
// |
|
1007 |
// try { |
|
1008 |
// ComputeProgressMonitorDialog dialog = new ComputeProgressMonitorDialog(getShell(), TXMEditor.this.getResult()); |
|
1009 |
// dialog.runComputingProcess(true); |
|
1010 |
// } |
|
1011 |
// catch (Exception e) { |
|
1012 |
// Log.printStackTrace(e); |
|
1013 |
// } |
|
1014 |
// } |
|
1015 |
// }); |
|
1016 |
|
|
997 | 1017 |
if (!TXMEditor.this.getResult().compute(subMonitor.split(50))) { |
998 | 1018 |
Log.fine("TXMEditor.compute(): " + TXMEditor.this.getClass().getSimpleName() + ": computing failed."); //$NON-NLS-1$ //$NON-NLS-2$ |
999 | 1019 |
} |
1000 | 1020 |
|
1021 |
|
|
1022 |
|
|
1023 |
|
|
1024 |
|
|
1001 | 1025 |
notifyExtensions("notifyEndOfCompute"); //$NON-NLS-1$ |
1002 | 1026 |
|
1003 | 1027 |
// monitor.worked(50); |
TXM/trunk/org.txm.rcp/src/main/java/org/txm/rcp/handlers/results/ComputeTXMResult.java (revision 3563) | ||
---|---|---|
13 | 13 |
import org.txm.rcp.editors.TXMEditorToolBar; |
14 | 14 |
|
15 | 15 |
/** |
16 |
* Calls TXMEditor.ompute() on the current active editor. |
|
16 |
* Calls TXMEditor.compute() on the current active editor.
|
|
17 | 17 |
* |
18 | 18 |
* @author mdecorde |
19 | 19 |
* @author sjacquot |
TXM/trunk/org.txm.chartsengine.rcp/src/org/txm/chartsengine/rcp/swt/ChartEditorToolBar.java (revision 3563) | ||
---|---|---|
14 | 14 |
* @author sjacquot |
15 | 15 |
* |
16 | 16 |
*/ |
17 |
// FIXME: became useless? could now directly use TXMEditorToolBar |
|
17 |
// FIXME: SJ: became useless? could now directly use TXMEditorToolBar |
|
18 |
// If remove, check that the ID is not used and/or replace it in plugin.xml |
|
18 | 19 |
public class ChartEditorToolBar extends TXMEditorToolBar { |
19 | 20 |
|
20 | 21 |
|
... | ... | |
41 | 42 |
*/ |
42 | 43 |
public ChartEditorToolBar(ChartEditor<? extends ChartResult> chartEditor, Composite parent, GLComposite subWidgetsComposite, int style, String toolbarId) { |
43 | 44 |
super(chartEditor, parent, subWidgetsComposite, style, toolbarId); |
44 |
|
|
45 |
|
|
46 |
// FIXME: tests |
|
47 |
// new ToolItem(this, SWT.SEPARATOR); |
|
48 |
// |
|
49 |
// final ToolItem showTitle = new ToolItem(this, SWT.CHECK); |
|
50 |
// //showTitle.setText(SWTComponentsProviderMessages.showhideTitle); |
|
51 |
// showTitle.setImage(IImageKeys.getImage(this, "icons/show_title.png")); |
|
52 |
// showTitle.setDisabledImage(IImageKeys.getImage(this, "icons/show_title_disabled.png")); |
|
53 |
// showTitle.setToolTipText(SWTComponentsProviderMessages.showhideTitle); |
|
54 |
// |
|
55 |
// if(!TXMPreferences.isEmpty(chartEditorPart.getPreferencesNodeQualifier(), ChartsEnginePreferences.SHOW_TITLE)) { |
|
56 |
// showTitle.setSelection(TXMPreferences.getBoolean(chartEditorPart.getPreferencesNodeQualifier(), chartEditorPart.getResultData(), ChartsEnginePreferences.SHOW_TITLE)); |
|
57 |
// } |
|
58 |
// // disable if not managed |
|
59 |
// else { |
|
60 |
// showTitle.setEnabled(false); |
|
61 |
// } |
|
62 |
// |
|
63 |
// |
|
64 |
// final ToolItem showLegend = new ToolItem(this, SWT.CHECK); |
|
65 |
// //showLegend.setText(SWTComponentsProviderMessages.showhideLegend); |
|
66 |
// showLegend.setImage(IImageKeys.getImage(this, "icons/show_legend.png")); |
|
67 |
// showLegend.setDisabledImage(IImageKeys.getImage(this, "icons/show_legend_disabled.png")); |
|
68 |
// showLegend.setToolTipText(SWTComponentsProviderMessages.showhideLegend); |
|
69 |
// |
|
70 |
// if(!TXMPreferences.isEmpty(chartEditorPart.getPreferencesNodeQualifier(), ChartsEnginePreferences.SHOW_LEGEND)) { |
|
71 |
// showLegend.setSelection(TXMPreferences.getBoolean(chartEditorPart.getPreferencesNodeQualifier(), chartEditorPart.getResultData(), ChartsEnginePreferences.SHOW_LEGEND)); |
|
72 |
// } |
|
73 |
// // disable if not managed |
|
74 |
// else { |
|
75 |
// showLegend.setEnabled(false); |
|
76 |
// } |
|
77 |
// |
|
78 |
// |
|
79 |
// final ToolItem showGrid = new ToolItem(this, SWT.CHECK); |
|
80 |
// //showGrid.setText(SWTComponentsProviderMessages.showhideGrid); |
|
81 |
// showGrid.setImage(IImageKeys.getImage(this, "icons/show_grid.png")); |
|
82 |
// showGrid.setDisabledImage(IImageKeys.getImage(this, "icons/show_grid_disabled.png")); |
|
83 |
// showGrid.setToolTipText(SWTComponentsProviderMessages.showhideGrid); |
|
84 |
// |
|
85 |
// if(!TXMPreferences.isEmpty(chartEditorPart.getPreferencesNodeQualifier(), ChartsEnginePreferences.SHOW_GRID)) { |
|
86 |
// showGrid.setSelection(TXMPreferences.getBoolean(chartEditorPart.getPreferencesNodeQualifier(), chartEditorPart.getResultData(), ChartsEnginePreferences.SHOW_GRID)); |
|
87 |
// } |
|
88 |
// // disable if not managed |
|
89 |
// else { |
|
90 |
// showGrid.setEnabled(false); |
|
91 |
// } |
|
92 |
// |
|
93 |
// |
|
94 |
// |
|
95 |
// SelectionListener listener = new SelectionListener() { |
|
96 |
// |
|
97 |
// @Override |
|
98 |
// public void widgetSelected(final SelectionEvent e) { |
|
99 |
// |
|
100 |
// // Accessing the source must be done outside the Job |
|
101 |
// if(e.getSource() == showTitle) { |
|
102 |
// TXMPreferences.putLocalBoolean(chartEditorPart.getResultData(), ChartsEnginePreferences.SHOW_TITLE,showTitle.getSelection()); |
|
103 |
// } |
|
104 |
// if(e.getSource() == showLegend) { |
|
105 |
// TXMPreferences.putLocalBoolean(chartEditorPart.getResultData(), ChartsEnginePreferences.SHOW_LEGEND, showLegend.getSelection()); |
|
106 |
// } |
|
107 |
// if(e.getSource() == showGrid) { |
|
108 |
// TXMPreferences.putLocalBoolean(chartEditorPart.getResultData(), ChartsEnginePreferences.SHOW_GRID, showGrid.getSelection()); |
|
109 |
// } |
|
110 |
// |
|
111 |
// |
|
112 |
// // updates existing chart |
|
113 |
// Job job = new Job("Update chart") { |
|
114 |
// |
|
115 |
// @Override |
|
116 |
// protected IStatus run(final IProgressMonitor monitor) { |
|
117 |
// |
|
118 |
// |
|
119 |
// |
|
120 |
// // updating and reloading |
|
121 |
// monitor.beginTask("Updating", IProgressMonitor.UNKNOWN); |
|
122 |
// chartEditorPart.updateChart(); |
|
123 |
// |
|
124 |
// |
|
125 |
// |
|
126 |
// // cancel |
|
127 |
// if(monitor.isCanceled()) { |
|
128 |
// return Status.CANCEL_STATUS; |
|
129 |
// } |
|
130 |
// |
|
131 |
// // refreshes |
|
132 |
// chartEditorPart.getSite().getShell().getDisplay().asyncExec(new Runnable() { |
|
133 |
// @Override |
|
134 |
// public void run() { |
|
135 |
// CorporaView.refresh(); |
|
136 |
// } |
|
137 |
// }); |
|
138 |
// |
|
139 |
// |
|
140 |
// // loading |
|
141 |
// monitor.setTaskName("Loading"); |
|
142 |
// chartEditorPart.loadChart(); |
|
143 |
// |
|
144 |
// |
|
145 |
// |
|
146 |
// // FIXME: persistence test, saving local preferences/parameters to file |
|
147 |
// //TXMPreferences.flush(chartEditorPart.getResultData()); |
|
148 |
// |
|
149 |
// |
|
150 |
// // done |
|
151 |
// monitor.done(); |
|
152 |
// |
|
153 |
// |
|
154 |
//// } |
|
155 |
//// }); |
|
156 |
// |
|
157 |
// |
|
158 |
// return Status.OK_STATUS; |
|
159 |
// } |
|
160 |
// |
|
161 |
// }; |
|
162 |
// //job.setUser(true); // show progress bar, without that the progress is located to bottom right |
|
163 |
// job.schedule(); |
|
164 |
// |
|
165 |
// |
|
166 |
// |
|
167 |
// |
|
168 |
// } |
|
169 |
// |
|
170 |
// @Override |
|
171 |
// public void widgetDefaultSelected(SelectionEvent e) { |
|
172 |
// // TODO Auto-generated method stub |
|
173 |
// |
|
174 |
// } |
|
175 |
// }; |
|
176 |
// showTitle.addSelectionListener(listener); |
|
177 |
// showLegend.addSelectionListener(listener); |
|
178 |
// showGrid.addSelectionListener(listener); |
|
179 | 45 |
} |
180 | 46 |
|
181 | 47 |
|
TXM/trunk/org.txm.chartsengine.rcp/src/org/txm/chartsengine/rcp/swt/AdvancedChartEditorToolBar.java (revision 3563) | ||
---|---|---|
5 | 5 |
import java.util.ArrayList; |
6 | 6 |
|
7 | 7 |
import org.apache.commons.lang.StringUtils; |
8 |
import org.eclipse.jface.resource.StringConverter; |
|
8 | 9 |
import org.eclipse.swt.SWT; |
9 | 10 |
import org.eclipse.swt.events.SelectionEvent; |
10 | 11 |
import org.eclipse.swt.events.SelectionListener; |
12 |
import org.eclipse.swt.graphics.FontData; |
|
11 | 13 |
import org.eclipse.swt.widgets.Combo; |
12 | 14 |
import org.eclipse.swt.widgets.Composite; |
13 | 15 |
import org.eclipse.swt.widgets.ToolItem; |
... | ... | |
21 | 23 |
import org.txm.chartsengine.rcp.messages.ChartsUIMessages; |
22 | 24 |
import org.txm.core.engines.EngineType; |
23 | 25 |
import org.txm.core.preferences.TBXPreferences; |
24 |
import org.txm.core.preferences.TXMPreferences; |
|
25 | 26 |
import org.txm.rcp.IImageKeys; |
26 | 27 |
import org.txm.rcp.preferences.RCPPreferences; |
27 | 28 |
import org.txm.rcp.swt.GLComposite; |
... | ... | |
30 | 31 |
* The default advanced chart editor tool bar shared by every <code>ChartEditor</code>. |
31 | 32 |
* The tool bar is accessible and usable in plugin.xml with the URI toolbar:AdvancedChartEditorToolBar. |
32 | 33 |
* |
34 |
* @author mdecorde |
|
33 | 35 |
* @author sjacquot |
34 | 36 |
* |
35 | 37 |
*/ |
... | ... | |
44 | 46 |
private Combo fontSizeCombo; |
45 | 47 |
private Combo chartTypeCombo; |
46 | 48 |
private Font currentFont; |
47 |
//private Combo fontStyleCombo;
|
|
49 |
private Combo fontStyleCombo; |
|
48 | 50 |
|
49 | 51 |
/** |
50 |
* |
|
52 |
* Creates a new chart editor tool bar dedicated to advanced parameters.
|
|
51 | 53 |
* @param parent |
52 | 54 |
* @param style |
53 | 55 |
*/ |
... | ... | |
56 | 58 |
|
57 | 59 |
if (!chartEditor.getResult().isEmptyPreference(ChartsEnginePreferences.SHOW_TITLE)) { |
58 | 60 |
showTitleButton = new ToolItem(this, SWT.CHECK); |
59 |
// showTitle.setText(SWTComponentsProviderMessages.showhideTitle); |
|
60 |
showTitleButton.setImage(IImageKeys.getImage(getClass(), "icons/show_title.png")); |
|
61 |
showTitleButton.setDisabledImage(IImageKeys.getImage(getClass(), "icons/show_title_disabled.png")); |
|
61 |
// showTitleButton.setText(SWTComponentsProviderMessages.showhideTitle);
|
|
62 |
showTitleButton.setImage(IImageKeys.getImage(getClass(), "icons/show_title.png")); //$NON-NLS-1$
|
|
63 |
showTitleButton.setDisabledImage(IImageKeys.getImage(getClass(), "icons/show_title_disabled.png")); //$NON-NLS-1$
|
|
62 | 64 |
showTitleButton.setToolTipText(ChartsUIMessages.showhideTitle); |
63 | 65 |
|
64 | 66 |
showTitleButton.setSelection(chartEditor.getResult().isTitleVisible()); |
... | ... | |
70 | 72 |
|
71 | 73 |
if (!chartEditor.getResult().isEmptyPreference(ChartsEnginePreferences.SHOW_LEGEND)) { |
72 | 74 |
showLegendButton = new ToolItem(this, SWT.CHECK); |
73 |
// showLegend.setText(SWTComponentsProviderMessages.showhideLegend); |
|
74 |
showLegendButton.setImage(IImageKeys.getImage(getClass(), "icons/show_legend.png")); |
|
75 |
showLegendButton.setDisabledImage(IImageKeys.getImage(getClass(), "icons/show_legend_disabled.png")); |
|
75 |
// showLegendButton.setText(SWTComponentsProviderMessages.showhideLegend);
|
|
76 |
showLegendButton.setImage(IImageKeys.getImage(getClass(), "icons/show_legend.png")); //$NON-NLS-1$
|
|
77 |
showLegendButton.setDisabledImage(IImageKeys.getImage(getClass(), "icons/show_legend_disabled.png")); //$NON-NLS-1$
|
|
76 | 78 |
showLegendButton.setToolTipText(ChartsUIMessages.showhideLegend); |
77 | 79 |
|
78 | 80 |
showLegendButton.setSelection(chartEditor.getResult().isLegendVisible()); |
... | ... | |
84 | 86 |
|
85 | 87 |
if (!chartEditor.getResult().isEmptyPreference(ChartsEnginePreferences.SHOW_GRID)) { |
86 | 88 |
showGridButton = new ToolItem(this, SWT.CHECK); |
87 |
// showGrid.setText(SWTComponentsProviderMessages.showhideGrid); |
|
88 |
showGridButton.setImage(IImageKeys.getImage(getClass(), "icons/show_grid.png")); |
|
89 |
showGridButton.setDisabledImage(IImageKeys.getImage(getClass(), "icons/show_grid_disabled.png")); |
|
89 |
// showGridButton.setText(SWTComponentsProviderMessages.showhideGrid);
|
|
90 |
showGridButton.setImage(IImageKeys.getImage(getClass(), "icons/show_grid.png")); //$NON-NLS-1$
|
|
91 |
showGridButton.setDisabledImage(IImageKeys.getImage(getClass(), "icons/show_grid_disabled.png")); //$NON-NLS-1$
|
|
90 | 92 |
showGridButton.setToolTipText(ChartsUIMessages.showhideGrid); |
91 | 93 |
|
92 |
|
|
93 | 94 |
showGridButton.setSelection(chartEditor.getResult().isGridVisible()); |
94 | 95 |
} |
95 | 96 |
// // disable if not managed by the command |
... | ... | |
109 | 110 |
}; |
110 | 111 |
renderingModeCombo.setItems(colorsModes); |
111 | 112 |
|
112 |
ToolItem renderingComboItem = new ToolItem(this, SWT.SEPARATOR); |
|
113 |
renderingComboItem.setControl(renderingModeCombo); |
|
114 |
renderingModeCombo.pack(); |
|
115 |
renderingComboItem.setWidth(renderingModeCombo.getBounds().width); |
|
113 |
// ToolItem renderingComboItem = new ToolItem(this, SWT.SEPARATOR);
|
|
114 |
// renderingComboItem.setControl(renderingModeCombo);
|
|
115 |
// renderingModeCombo.pack();
|
|
116 |
// renderingComboItem.setWidth(renderingModeCombo.getBounds().width);
|
|
116 | 117 |
|
118 |
this.addControl(renderingModeCombo); |
|
117 | 119 |
|
118 | 120 |
renderingModeCombo.select(chartEditor.getResult().getRenderingColorsMode()); |
119 | 121 |
} |
... | ... | |
125 | 127 |
|
126 | 128 |
// Font selection |
127 | 129 |
currentFont = ChartsEngine.createFont(chartEditor.getResult().getFont()); |
128 |
|
|
130 |
|
|
131 |
// FIXME: SJ: may be better here to get the fonts from SWT rather than from Java, see java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment().getAllFonts(); |
|
129 | 132 |
fontCombo = new Combo(this, SWT.READ_ONLY); |
130 |
String fonts[] = GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames(); // FIXME: SJ: may be better here to get the fonts from SWT rather than from Java, see java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment().getAllFonts();
|
|
133 |
String fonts[] = GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames(); |
|
131 | 134 |
fontCombo.setItems(fonts); |
132 | 135 |
|
133 |
ToolItem fontsComboItem = new ToolItem(this, SWT.SEPARATOR); |
|
134 |
fontsComboItem.setControl(fontCombo); |
|
135 |
fontCombo.pack(); |
|
136 |
fontsComboItem.setWidth(fontCombo.getBounds().width); |
|
136 |
// ToolItem fontsComboItem = new ToolItem(this, SWT.SEPARATOR);
|
|
137 |
// fontsComboItem.setControl(fontCombo);
|
|
138 |
// fontCombo.pack();
|
|
139 |
// fontsComboItem.setWidth(fontCombo.getBounds().width);
|
|
137 | 140 |
|
141 |
this.addControl(fontCombo); |
|
142 |
|
|
138 | 143 |
int currentFontIndex = 0; |
139 | 144 |
for (int i = 0; i < fonts.length; i++) { |
140 | 145 |
if (fonts[i].equals(currentFont.getName())) { |
... | ... | |
157 | 162 |
} |
158 | 163 |
fontSizeCombo.setItems(fontSizes); |
159 | 164 |
|
160 |
ToolItem fontSizeComboItem = new ToolItem(this, SWT.SEPARATOR); |
|
161 |
fontSizeComboItem.setControl(fontSizeCombo); |
|
162 |
fontSizeCombo.pack(); |
|
163 |
fontSizeComboItem.setWidth(fontSizeCombo.getBounds().width); |
|
165 |
// ToolItem fontSizeComboItem = new ToolItem(this, SWT.SEPARATOR);
|
|
166 |
// fontSizeComboItem.setControl(fontSizeCombo);
|
|
167 |
// fontSizeCombo.pack();
|
|
168 |
// fontSizeComboItem.setWidth(fontSizeCombo.getBounds().width);
|
|
164 | 169 |
|
170 |
this.addControl(fontSizeCombo); |
|
171 |
|
|
165 | 172 |
fontSizeCombo.select(currentFontSizeIndex); |
166 | 173 |
|
167 |
// Font size |
|
168 |
// fontStyleCombo = new Combo(this, SWT.READ_ONLY); |
|
169 |
// String fontStyles[] = new String[] {"normal", "bold", "italic"}; |
|
170 |
// int currentFontStyleIndex = 0; |
|
171 |
// fontStyleCombo.setItems(fontStyles); |
|
174 |
|
|
175 |
// Font style |
|
176 |
fontStyleCombo = new Combo(this, SWT.READ_ONLY); |
|
177 |
|
|
178 |
|
|
179 |
//FIXME: SJ: the styles list should be builded from the available styles of the current selected font. |
|
180 |
// Here are some tests to try to get the available styles |
|
181 |
|
|
182 |
// AWT |
|
183 |
// for (Entry<TextAttribute, ?> mapElement : currentFont.getAttributes().entrySet()) { |
|
184 |
// TextAttribute key = mapElement.getKey(); |
|
185 |
// System.out.println(key + " : " + mapElement.getValue()); |
|
186 |
// } |
|
172 | 187 |
// |
188 |
// for (Attribute a : currentFont.getAvailableAttributes()) { |
|
189 |
// System.out.println("AdvancedChartEditorToolBar.AdvancedChartEditorToolBar()" + a); |
|
190 |
// } |
|
191 |
// SWT/JFace |
|
192 |
// FontData[] fontsData = this.getDisplay().getFontList(null, true); |
|
193 |
// for (int i = 0; i < fontsData.length; i++) { |
|
194 |
// System.out.println("AdvancedChartEditorToolBar.AdvancedChartEditorToolBar() - Fonts from SWT: " + fontsData[i].getName() |
|
195 |
// + " - " + fontsData[i].getLocale() |
|
196 |
// + " - " + fontsData[i].getHeight() |
|
197 |
// + " - " + fontsData[i].toString() |
|
198 |
// ); |
|
199 |
// System.out.println("AdvancedChartEditorToolBar.AdvancedChartEditorToolBar() " + StringConverter.asString(fontsData[i])); |
|
200 |
// } |
|
201 |
|
|
202 |
|
|
203 |
String fontStyles[] = new String[] {"Regular", "Bold", "Italic", "Bold italic"}; |
|
204 |
int currentFontStyleIndex = currentFont.getStyle(); |
|
205 |
fontStyleCombo.setItems(fontStyles); |
|
206 |
|
|
173 | 207 |
// ToolItem fontStyleComboItem = new ToolItem(this, SWT.SEPARATOR); |
174 | 208 |
// fontStyleComboItem.setControl(fontStyleCombo); |
175 | 209 |
// fontStyleCombo.pack(); |
176 | 210 |
// fontStyleComboItem.setWidth(fontStyleCombo.getBounds().width); |
177 |
// |
|
178 |
// fontStyleCombo.select(currentFontStyleIndex); |
|
179 | 211 |
|
212 |
this.addControl(fontStyleCombo); |
|
180 | 213 |
|
214 |
fontStyleCombo.select(currentFontStyleIndex); |
|
181 | 215 |
|
216 |
|
|
217 |
|
|
182 | 218 |
// Chart types from installed chart creators in all installed charts engines |
183 |
|
|
219 |
chartTypeCombo = new Combo(this, SWT.READ_ONLY); |
|
184 | 220 |
if (TBXPreferences.getInstance().getBoolean(TBXPreferences.EXPERT_USER)) { |
185 | 221 |
|
186 |
chartTypeCombo = new Combo(this, SWT.READ_ONLY); |
|
187 |
|
|
188 | 222 |
ArrayList<String> chartsEngineNames = new ArrayList<>(); |
189 | 223 |
ArrayList<ChartCreator> allChartCreators = new ArrayList<>(); |
190 | 224 |
|
191 |
if (allChartCreators.size() > 1) { |
|
192 |
for (ChartsEngine engine : ChartsEnginesManager.getChartsEngines()) { |
|
193 |
for (ChartCreator creator : engine.getChartCreators(this.getEditorPart().getResult())) { |
|
194 |
chartsEngineNames.add(engine.getName()); |
|
195 |
allChartCreators.add(creator); |
|
196 |
} |
|
225 |
for (ChartsEngine engine : ChartsEnginesManager.getChartsEngines()) { |
|
226 |
for (ChartCreator creator : engine.getChartCreators(this.getEditorPart().getResult())) { |
|
227 |
chartsEngineNames.add(engine.getName()); |
|
228 |
allChartCreators.add(creator); |
|
197 | 229 |
} |
230 |
} |
|
231 |
|
|
232 |
|
|
233 |
String chartTypes[] = new String[allChartCreators.size()]; |
|
234 |
int currentChartCreatorIndex = 0; |
|
235 |
|
|
236 |
for (int i = 0; i < allChartCreators.size(); i++) { |
|
198 | 237 |
|
238 |
chartTypes[i] = allChartCreators.get(i).getChartType(); |
|
239 |
if (chartTypes[i] == null) { |
|
240 |
chartTypes[i] = ChartsEnginePreferences.DEFAULT_CHART_TYPE; |
|
241 |
} |
|
199 | 242 |
|
200 |
String chartTypes[] = new String[allChartCreators.size()]; |
|
201 |
int currentChartCreatorIndex = 0; |
|
202 |
|
|
203 |
for (int i = 0; i < allChartCreators.size(); i++) { |
|
204 |
|
|
205 |
chartTypes[i] = allChartCreators.get(i).getChartType(); |
|
206 |
if (chartTypes[i] == null) { |
|
207 |
chartTypes[i] = ChartsEnginePreferences.DEFAULT_CHART_TYPE; |
|
208 |
} |
|
209 |
|
|
210 |
// preselected combo index |
|
211 |
if (this.getEditorPart().getChartType() != null && this.getEditorPart().getChartType().equals(chartTypes[i]) |
|
212 |
&& this.getEditorPart().getResult().getChartsEngine().getName().equals(chartsEngineNames.get(i))) { |
|
213 |
currentChartCreatorIndex = i; |
|
214 |
} |
|
215 |
|
|
216 |
chartTypes[i] = chartsEngineNames.get(i) + " / " + chartTypes[i]; //$NON-NLS-1$ |
|
217 |
|
|
243 |
// preselected combo index |
|
244 |
if (this.getEditorPart().getChartType() != null && this.getEditorPart().getChartType().equals(chartTypes[i]) |
|
245 |
&& this.getEditorPart().getResult().getChartsEngine().getName().equals(chartsEngineNames.get(i))) { |
|
246 |
currentChartCreatorIndex = i; |
|
218 | 247 |
} |
219 |
chartTypeCombo.setItems(chartTypes); |
|
220 |
chartTypeCombo.select(currentChartCreatorIndex); |
|
221 | 248 |
|
222 |
ToolItem chartTypeComboItem = new ToolItem(this, SWT.SEPARATOR); |
|
223 |
chartTypeComboItem.setControl(chartTypeCombo); |
|
224 |
chartTypeCombo.pack(); |
|
225 |
chartTypeComboItem.setWidth(chartTypeCombo.getBounds().width); |
|
249 |
chartTypes[i] = chartsEngineNames.get(i) + " / " + chartTypes[i]; //$NON-NLS-1$ |
|
226 | 250 |
|
227 |
|
|
228 |
|
|
229 |
//chartTypeCombo.setVisible(false); |
|
230 | 251 |
} |
252 |
chartTypeCombo.setItems(chartTypes); |
|
253 |
|
|
254 |
// ToolItem chartTypeComboItem = new ToolItem(this, SWT.SEPARATOR); |
|
255 |
// chartTypeComboItem.setControl(chartTypeCombo); |
|
256 |
// chartTypeCombo.pack(); |
|
257 |
// chartTypeComboItem.setWidth(chartTypeCombo.getBounds().width); |
|
258 |
|
|
259 |
|
|
260 |
this.addControl(chartTypeCombo); |
|
261 |
|
|
262 |
|
|
263 |
chartTypeCombo.select(currentChartCreatorIndex); |
|
264 |
|
|
265 |
|
|
266 |
if (allChartCreators.size() < 2) { |
|
267 |
chartTypeCombo.setVisible(false); |
|
268 |
} |
|
231 | 269 |
} |
232 | 270 |
|
233 | 271 |
|
... | ... | |
254 | 292 |
} |
255 | 293 |
// end of FIXME |
256 | 294 |
|
257 |
// Font |
|
258 |
else if (e.getSource() == fontCombo || e.getSource() == fontSizeCombo) { // || e.getSource() == fontStyleCombo) {
|
|
259 |
getEditorPart().getResult().setFont("1|" + fontCombo.getItem(fontCombo.getSelectionIndex()) + "|" + fontSizeCombo.getItem(fontSizeCombo.getSelectionIndex()) + "|1"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ +fontStyleCombo.getSelectionIndex()
|
|
295 |
// Font
|
|
296 |
else if (e.getSource() == fontCombo || e.getSource() == fontSizeCombo || e.getSource() == fontStyleCombo) { |
|
297 |
getEditorPart().getResult().setFont("1|" + fontCombo.getItem(fontCombo.getSelectionIndex()) + "|" + fontSizeCombo.getItem(fontSizeCombo.getSelectionIndex()) + "|" + fontStyleCombo.getSelectionIndex()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
|
260 | 298 |
} |
261 | 299 |
// Chart type / chart creators |
262 | 300 |
else if (e.getSource() == chartTypeCombo) { |
... | ... | |
300 | 338 |
if (renderingModeCombo != null) renderingModeCombo.addSelectionListener(listener); |
301 | 339 |
if (fontCombo != null) fontCombo.addSelectionListener(listener); |
302 | 340 |
if (fontSizeCombo != null) fontSizeCombo.addSelectionListener(listener); |
303 |
//if (fontStyleCombo != null) fontStyleCombo.addSelectionListener(listener);
|
|
341 |
if (fontStyleCombo != null) fontStyleCombo.addSelectionListener(listener); |
|
304 | 342 |
if (chartTypeCombo != null) chartTypeCombo.addSelectionListener(listener); |
305 | 343 |
} |
306 | 344 |
|
TXM/trunk/org.txm.chartsengine.rcp/src/org/txm/chartsengine/rcp/preferences/ChartsEnginePreferencePage.java (revision 3563) | ||
---|---|---|
111 | 111 |
|
112 | 112 |
FontFieldEditor font = new FontFieldEditor(ChartsEnginePreferences.FONT, "Font", "Specificities / Spécificités / Специфичность", this.getFieldEditorParent()); //$NON-NLS-1$ //$NON-NLS-2$ |
113 | 113 |
this.addField(font); |
114 |
// FIXME: preview area tests |
|
114 |
// FIXME: SJ: preview area tests
|
|
115 | 115 |
// font.fillIntoGrid(this.getFieldEditorParent(), 4); |
116 | 116 |
// ((Text)font.getPreviewControl()).setLayoutData(new GridData(GridData.FILL_BOTH)); |
117 | 117 |
// System.out.println("ChartsEnginePreferencePage.createFieldEditors() " + font.getPreviewControl()); |
TXM/trunk/org.txm.statsengine.r.core/src/org/txm/statsengine/r/core/RResult.java (revision 3563) | ||
---|---|---|
1 | 1 |
package org.txm.statsengine.r.core; |
2 | 2 |
|
3 |
//FIXME: SJ: find a better way to manage this, eg. define a getInternalId() method in TXMResult |
|
4 |
// Using this create a too strong link between result and engine |
|
3 | 5 |
public interface RResult { |
4 | 6 |
/** |
5 | 7 |
* |
TXM/trunk/org.txm.internalview.rcp/src/org/txm/internalview/rcp/handlers/SendInternalViewTo.java (revision 3563) | ||
---|---|---|
29 | 29 |
|
30 | 30 |
import org.eclipse.core.commands.ExecutionEvent; |
31 | 31 |
import org.eclipse.jface.viewers.ISelection; |
32 |
import org.eclipse.jface.viewers.IStructuredSelection; |
|
33 | 32 |
import org.eclipse.jface.viewers.StructuredSelection; |
34 | 33 |
import org.eclipse.ui.handlers.HandlerUtil; |
35 | 34 |
import org.txm.internalview.rcp.editors.InternalViewEditor; |
... | ... | |
48 | 47 |
public String createQuery(ExecutionEvent event, ISelection selection) { |
49 | 48 |
if (selection instanceof StructuredSelection) { |
50 | 49 |
StructuredSelection sselection = (StructuredSelection) selection; |
50 |
//FIXME: SJ: the selection is not used |
|
51 | 51 |
return ((InternalViewEditor) HandlerUtil.getActiveWorkbenchWindow(event).getActivePage().getActivePart()).createQuery(); |
52 | 52 |
} |
53 | 53 |
return null; |
TXM/trunk/org.txm.core/src/java/org/txm/core/preferences/TXMPreferences.java (revision 3563) | ||
---|---|---|
38 | 38 |
|
39 | 39 |
/** |
40 | 40 |
* Base preferences initializer and manager. |
41 |
* Getters return either a value looking in this order:
|
|
42 |
* - local node linked to a TXM result if exists
|
|
43 |
* - command global value (InstanceScope)
|
|
44 |
* - command default value (DefaultScope)
|
|
45 |
* - alternative specified global value
|
|
46 |
* - alternative specified default value
|
|
47 |
* TODO: methods that puts a value in the local node does not check if the value is the default value of the parent, it should be removed from the local node if it's the default value
|
|
48 |
* of command scope or alternative scope so the preference will not be saved in the local scope .prefs file if its a default value.
|
|
49 |
* TODO: when we'll use IProject for managing Corporas, the local node should be stored in the ProjectScope instead of in the InstanceScope.
|
|
50 |
* TODO: need to determine if we'll use this class to persistence of TXM results. At this moment, we persist result by calling flush() that creates a file named by the result node qualifier,
|
|
51 |
* eg. org.txm.partition.core.functions.PartitionDimensions@732982cb.prefs
|
|
52 |
* (We can also define a custom Scope to do that, for example to change the saved object location or the filename)
|
|
41 |
* |
|
42 |
* Getters return a value of preference looking in this order:
|
|
43 |
* 1) local node linked to a TXM result if exists (ProjectScope - /project/<project_name>/<UUID of TXMResult>/<preference key>)
|
|
44 |
* 2) command global value (InstanceScope - /instance/<bundle_id>/<preference key>)
|
|
45 |
* 3) alternative specified global value,
|
|
46 |
* eg. engine preference added to TXMPreference.alternativeNodesQualifiers (InstanceScope - /instance/<bundle_id>/<preference key>)
|
|
47 |
* 4) alternative specified default value,
|
|
48 |
* eg. engine preference added to TXMPreference.alternativeNodesQualifiers (DefaultScope - /bundle_defaults/<bundle_id>/<preference key>)
|
|
49 |
* 5) command default value (DefaultScope - /bundle_defaults/<bundle_id>/<preference key>)
|
|
50 |
* 6) hard coded in getters
|
|
51 |
* |
|
52 |
* Persistence of TXM results is done by calling flush() that creates a file named by the result node qualifier,
|
|
53 | 53 |
* |
54 | 54 |
* |
55 | 55 |
* @author mdecorde |
56 | 56 |
* @author sjacquot |
57 | 57 |
* |
58 | 58 |
*/ |
59 |
// FIXME: AFTER some tests, the local nodes are flushed when editing a Charts engine preference from the UI, actually the prefs are flushed if we change a charts engine preference and then it becomes |
|
60 |
// different from the local result, eg. "Show Legend" or "Rendering colors mode". See if it's what we want. |
|
61 |
// Otherwise, to avoid that we need to define our own Scope, but the problem will disappear when |
|
62 |
// we'll use the ProjectScope. |
|
63 | 59 |
public abstract class TXMPreferences extends AbstractPreferenceInitializer { |
64 | 60 |
|
65 | 61 |
/** |
66 |
* Scope used for storing the command preferences.
|
|
62 |
* Root node of the Eclipse preference hierarchy.
|
|
67 | 63 |
*/ |
68 |
// public static IScopeContext scope = InstanceScope.INSTANCE; |
|
69 |
|
|
70 |
|
|
71 | 64 |
public static IEclipsePreferences preferencesRootNode = Platform.getPreferencesService().getRootNode(); |
72 | 65 |
|
73 | 66 |
/** |
... | ... | |
77 | 70 |
|
78 | 71 |
|
79 | 72 |
// TXMResult internal parameters, essentially for Links and Persistence |
73 |
/** |
|
74 |
* Result parameters node path in preferences. |
|
75 |
*/ |
|
80 | 76 |
public final static String RESULT_PARAMETERS_NODE_PATH = "result_parameters_node_path"; //$NON-NLS-1$ |
81 | 77 |
|
78 |
/** |
|
79 |
* Parent parameters node path in preferences. |
|
80 |
*/ |
|
82 | 81 |
public final static String PARENT_PARAMETERS_NODE_PATH = "parent_parameters_node_path"; //$NON-NLS-1$ |
83 | 82 |
|
83 |
/** |
|
84 |
* The class of the TXMResult. |
|
85 |
*/ |
|
84 | 86 |
public final static String CLASS = "class"; //$NON-NLS-1$ |
85 | 87 |
|
88 |
/** |
|
89 |
* The bundle id of the result. |
|
90 |
*/ |
|
86 | 91 |
public final static String BUNDLE_ID = "bundle_id"; //$NON-NLS-1$ |
87 | 92 |
|
88 | 93 |
public final static String USER_NAME = "user_name"; //$NON-NLS-1$ |
89 | 94 |
|
90 | 95 |
public final static String LAZY_NAME = "lazy_name"; //$NON-NLS-1$ |
91 |
|
|
92 | 96 |
public final static String VISIBLE = "visible"; //$NON-NLS-1$ |
93 | 97 |
|
94 | 98 |
public static final String LOCK = "locked_result"; //$NON-NLS-1$ |
... | ... | |
102 | 106 |
* Last computing date of a result. |
103 | 107 |
*/ |
104 | 108 |
public static final String LAST_COMPUTING_DATE = "last_computing_date"; |
105 |
// end of TXMResult internal parameters |
|
109 |
// End of TXMResult internal parameters |
|
110 |
|
|
106 | 111 |
|
112 |
// FIXME: SJ: do not store the "persistable" state in the preferences and file |
|
113 |
public static final String PERSITABLE = "persistable"; |
|
114 |
|
|
115 |
// FIXME: SJ: became useless? |
|
116 |
public static final String INTERNAL_PERSITABLE = "internal_persistable"; |
|
117 |
|
|
107 | 118 |
|
108 | 119 |
|
109 | 120 |
|
110 |
// Command preferences shared strings |
|
121 |
|
|
122 |
// Command preferences shared keys strings |
|
111 | 123 |
/** |
112 | 124 |
* Queries. |
113 | 125 |
*/ |
... | ... | |
184 | 196 |
public static final String V_MAX = "v_max"; //$NON-NLS-1$ |
185 | 197 |
|
186 | 198 |
/** |
187 |
* Separator used when converting list from and to string.
|
|
199 |
* Separator used when converting a list from and to a string.
|
|
188 | 200 |
*/ |
189 | 201 |
public static final String LIST_SEPARATOR = "\t"; //$NON-NLS-1$ |
190 | 202 |
|
191 |
|
|
192 | 203 |
/** |
193 | 204 |
* Separator used when building some name based on a parent name and the result name (e.g. VOEUX/text@loc). |
194 | 205 |
*/ |
195 | 206 |
public static final String PARENT_NAME_SEPARATOR = "/"; //$NON-NLS-1$ |
196 | 207 |
|
197 |
|
|
198 | 208 |
/** |
199 | 209 |
* Number of lines to display per result page. |
200 | 210 |
*/ |
... | ... | |
226 | 236 |
public final static String DEFAULT_STRUCTURAL_UNIT_PROPERTY = "text_id"; //$NON-NLS-1$ |
227 | 237 |
// End of command preferences shared strings |
228 | 238 |
|
229 |
public static final String PERSITABLE = "persistable"; |
|
230 |
|
|
231 |
public static final String INTERNAL_PERSITABLE = "internal_persistable"; |
|
232 | 239 |
|
240 |
|
|
241 |
|
|
233 | 242 |
/** |
234 |
* Preferences node qualifier of the instance. |
|
243 |
* Preferences node qualifier of the instance of the preferences initializer and manager.
|
|
235 | 244 |
*/ |
236 | 245 |
protected String commandPreferencesNodeQualifier; |
237 | 246 |
|
... | ... | |
245 | 254 |
* Sub classes should not forget to call this to set TXMResults main behavior (visible, etc...) |
246 | 255 |
*/ |
247 | 256 |
@Override |
248 |
// FIXME: SJ: defines an abstract method as _initializeDefaultPreferences() called here and that must be implemented by subclasses
|
|
257 |
// FIXME: SJ: define an abstract method as _initializeDefaultPreferences() called here and that must be implemented by subclasses |
|
249 | 258 |
public void initializeDefaultPreferences() { |
250 |
|
|
251 | 259 |
Preferences preferences = this.getDefaultPreferencesNode(); |
252 | 260 |
preferences.putBoolean(TBXPreferences.VISIBLE, true); |
253 | 261 |
preferences.putBoolean(TBXPreferences.LOCK, false); |
... | ... | |
332 | 340 |
|
333 | 341 |
|
334 | 342 |
|
335 |
|
|
343 |
//FIXME |
|
336 | 344 |
// /** |
337 | 345 |
// * Stores a pairs of key / value in a local node dedicated to the specified result. The node qualifier is generated by the <code>Object.toString()</code> method. |
338 | 346 |
// * |
... | ... | |
484 | 492 |
return getBoolean(key, result, nodePath); |
485 | 493 |
} |
486 | 494 |
|
487 |
|
|
495 |
/** |
|
496 |
* |
|
497 |
* @param key |
|
498 |
* @param commandParameters |
|
499 |
* @param result |
|
500 |
* @return |
|
501 |
*/ |
|
488 | 502 |
public static boolean getBoolean(String key, TXMParameters commandParameters, TXMResult result) { |
489 | 503 |
return getBoolean(key, commandParameters, result, result.getCommandPreferencesNodePath()); |
490 | 504 |
} |
... | ... | |
1040 | 1054 |
return getFloat(key, commandParameters, result, result.getCommandPreferencesNodePath()); |
1041 | 1055 |
} |
1042 | 1056 |
|
1057 |
|
|
1058 |
|
|
1043 | 1059 |
/** |
1044 | 1060 |
* Looks for the value of the specified <code>key</code> in preference nodes. |
1045 | 1061 |
* Returns the value of the local result node if exists. |
1046 | 1062 |
* Otherwise try to get it from the specified node qualifier if exists. |
1047 | 1063 |
* Otherwise try to get it from the specified alternative node qualifiers defined in the list <code>TXMPreferences.alternativeNodesQualifiers</code>. |
1064 |
* Returns 0f if no value has been found for the specified key. |
|
1065 |
* |
|
1066 |
* @param nodePath |
|
1067 |
* @param result |
|
1068 |
* @param key |
|
1069 |
* @return |
|
1070 |
*/ |
|
1071 |
public static float getFloat(String key, TXMResult result, String nodePath) { |
|
1072 |
return getFloat(key, nodePath, result, 0f); |
|
1073 |
} |
|
1074 |
|
|
1075 |
|
|
1076 |
/** |
|
1077 |
* |
|
1078 |
* @param nodePath |
|
1079 |
* @param key |
|
1080 |
* @return |
|
1081 |
*/ |
|
1082 |
public static float getFloat(String key, String nodePath) { |
|
1083 |
return getFloat(key, null, nodePath); |
|
1084 |
} |
|
1085 |
|
|
1086 |
/** |
|
1087 |
* |
|
1088 |
* @param result |
|
1089 |
* @param key |
|
1090 |
* @return |
|
1091 |
*/ |
|
1092 |
public static float getFloat(String key, TXMResult result) { |
|
1093 |
return getFloat(key, result, null); |
|
1094 |
} |
|
1095 |
|
|
1096 |
/** |
|
1097 |
* Looks for the value of the specified <code>key</code> in preference nodes. |
|
1098 |
* Returns the value of the local result node if exists. |
|
1099 |
* Otherwise try to get it from the specified node qualifier if exists. |
|
1100 |
* Otherwise try to get it from the specified alternative node qualifiers defined in the list <code>TXMPreferences.alternativeNodesQualifiers</code>. |
|
1048 | 1101 |
* Returns defaultValue if no value has been found for the specified key. |
1049 | 1102 |
* |
1050 | 1103 |
* @param nodePath |
... | ... | |
1097 | 1150 |
return null; |
1098 | 1151 |
} |
1099 | 1152 |
|
1100 |
|
|
1153 |
|
|
1101 | 1154 |
/** |
1102 |
* Looks for the value of the specified <code>key</code> in preference nodes. |
|
1103 |
* Returns the value of the local result node if exists. |
|
1104 |
* Otherwise try to get it from the specified node qualifier if exists. |
|
1105 |
* Otherwise try to get it from the specified alternative node qualifiers defined in the list <code>TXMPreferences.alternativeNodesQualifiers</code>. |
|
1106 |
* Returns 0f if no value has been found for the specified key. |
|
1107 |
* |
|
1108 |
* @param nodePath |
|
1109 |
* @param result |
|
1110 |
* @param key |
|
1111 |
* @return |
|
1112 |
*/ |
|
1113 |
public static float getFloat(String key, TXMResult result, String nodePath) { |
|
1114 |
return getFloat(key, nodePath, result, 0f); |
|
1115 |
} |
|
1116 |
|
|
1117 |
|
|
1118 |
/** |
|
1119 |
* |
|
1120 |
* @param nodePath |
|
1121 |
* @param key |
|
1122 |
* @return |
|
1123 |
*/ |
|
1124 |
public static float getFloat(String key, String nodePath) { |
|
1125 |
return getFloat(key, null, nodePath); |
|
1126 |
} |
|
1127 |
|
|
1128 |
/** |
|
1129 |
* |
|
1130 |
* @param result |
|
1131 |
* @param key |
|
1132 |
* @return |
|
1133 |
*/ |
|
1134 |
public static float getFloat(String key, TXMResult result) { |
|
1135 |
return getFloat(key, result, null); |
|
1136 |
} |
|
1137 |
|
|
1138 |
|
|
1139 |
/** |
|
1140 | 1155 |
* Checks if a local node exists for the specified TXM result. |
1141 | 1156 |
* |
1142 | 1157 |
* @param result |
... | ... | |
1559 | 1574 |
if (keyExists) { |
1560 | 1575 |
return result.getParametersNodePath(); |
1561 | 1576 |
} |
1562 |
// look in the instance scope |
|
1577 |
// look in the instance scope (user command preference)
|
|
1563 | 1578 |
else if (keyExists("instance/" + nodePath, key)) { |
1564 | 1579 |
return "instance/" + nodePath; |
1565 | 1580 |
} |
1566 | 1581 |
// look in the global alternative preferences nodes |
1567 | 1582 |
else { |
1568 | 1583 |
for (int i = 0; i < alternativeNodesQualifiers.size(); i++) { |
1584 |
// user preference |
|
1569 | 1585 |
if (keyExists("instance/" + alternativeNodesQualifiers.get(i), key)) { |
1570 | 1586 |
return "instance/" + alternativeNodesQualifiers.get(i); |
1571 | 1587 |
} |
1588 |
// default preference |
|
1572 | 1589 |
else if (keyExists("default/" + alternativeNodesQualifiers.get(i), key)) { |
1573 | 1590 |
return "default/" + alternativeNodesQualifiers.get(i); |
1574 | 1591 |
} |
1575 | 1592 |
} |
1576 |
|
|
1593 |
// default command preference |
|
1577 | 1594 |
return "default/" + nodePath; |
1578 | 1595 |
} |
1579 | 1596 |
|
TXM/trunk/org.txm.core/src/java/org/txm/core/results/TXMResult.java (revision 3563) | ||
---|---|---|
8 | 8 |
import java.text.DateFormat; |
9 | 9 |
import java.text.SimpleDateFormat; |
10 | 10 |
import java.util.ArrayList; |
11 |
import java.util.Arrays; |
|
11 | 12 |
import java.util.Calendar; |
12 | 13 |
import java.util.Date; |
13 | 14 |
import java.util.HashMap; |
... | ... | |
67 | 68 |
* </pre> |
68 | 69 |
* |
69 | 70 |
* @author mdecorde |
70 |
* |
|
71 | 71 |
* @author sjacquot |
72 |
* |
|
72 | 73 |
*/ |
73 | 74 |
public abstract class TXMResult implements Cloneable, Comparable<TXMResult> { |
74 | 75 |
|
... | ... | |
106 | 107 |
private boolean dirty = true; |
107 | 108 |
|
108 | 109 |
/** |
109 |
* if a method changed the internal data without **recomputing** the result, the result must be marked "altered"
|
|
110 |
* If a method changed the internal data without **recomputing** the result, the result must be marked "altered"
|
|
110 | 111 |
*/ |
111 | 112 |
private boolean altered = false; |
112 | 113 |
|
... | ... | |
124 | 125 |
* Command preferences node path. |
125 | 126 |
*/ |
126 | 127 |
protected String commandPreferencesNodePath; |
127 |
// protected IEclipsePreferences preferencesNode; // TODO: directly use a preferences node rather than a node path? |
|
128 | 128 |
|
129 | 129 |
/** |
130 | 130 |
* Parameters node path. Concatenation of the Project scope path + the result uuid |
... | ... | |
139 | 139 |
/** |
140 | 140 |
* To manage the computing cancel with TreadDeath. |
141 | 141 |
*/ |
142 |
// FIXME: SJ: became useless? |
|
142 | 143 |
private Semaphore progressSemaphore = new Semaphore(1); |
143 | 144 |
|
144 | 145 |
/** |
... | ... | |
194 | 195 |
/** |
195 | 196 |
* Current computing state. |
196 | 197 |
* True if the result is in the process of computing (is in compute(,) method) |
197 |
* |
|
198 | 198 |
*/ |
199 | 199 |
private boolean computing = false; |
200 | 200 |
|
... | ... | |
216 | 216 |
|
217 | 217 |
/** |
218 | 218 |
* Creates a new TXMResult with no parent. |
219 |
* If a local node exist with the parent_uuid, the parent will be retrieved and this result will be added to it.
|
|
219 |
* If a local preference node exists with parent_parameters_node_path value, the parent will be retrieved and this result will be added to it.
|
|
220 | 220 |
* |
221 | 221 |
* @param parametersNodePath |
222 | 222 |
*/ |
... | ... | |
250 | 250 |
|
251 | 251 |
this.parametersNodePath = parametersNodePath + createUUID() + "_" + this.getClass().getSimpleName(); //$NON-NLS-1$ ; |
252 | 252 |
} |
253 |
// lazy or linked result
|
|
253 |
// lazy result (persistence / import) or linked result ("send to" commands)
|
|
254 | 254 |
else { |
255 | 255 |
this.parametersNodePath = parametersNodePath; |
256 | 256 |
} |
... | ... | |
273 | 273 |
this.saveParameter(TXMPreferences.PERSITABLE, true); |
274 | 274 |
} |
275 | 275 |
|
276 |
// retrieving parent from UUID |
|
276 |
// retrieving parent from UUID/node path
|
|
277 | 277 |
String parentNodePath = this.getStringParameterValue(TXMPreferences.PARENT_PARAMETERS_NODE_PATH); |
278 | 278 |
|
279 | 279 |
// System.out.println("TXMResult.TXMResult(): parent UUID = " + parentUUID); |
280 | 280 |
|
281 |
if (!("ROOT".equals(this.parametersNodePath)) && // search for parent only if UUID != "ROOT" |
|
281 |
// search for parent only if UUID != "ROOT" |
|
282 |
if (!("ROOT".equals(this.parametersNodePath)) && //$NON-NLS-1$ |
|
282 | 283 |
parent == null && |
283 | 284 |
this.parametersNodePath != null && |
284 | 285 |
!parentNodePath.isEmpty()) { |
285 | 286 |
|
286 |
Log.finest("Searching parent with UUID " + parentNodePath + "..."); //$NON-NLS-1$ //$NON-NLS-2$ |
|
287 |
Log.finest("Searching parent with UUID/node path " + parentNodePath + "..."); //$NON-NLS-1$ //$NON-NLS-2$
|
|
287 | 288 |
|
288 | 289 |
// FIXME: MD: this is quite CPU expensive because 'retrievedParent' researches in all projects |
289 | 290 |
TXMResult retrievedParent = TXMResult.getResult(parentNodePath); |
290 | 291 |
if (retrievedParent != null) { |
291 |
Log.finest("Parent retrieved from UUID: " + retrievedParent + "."); //$NON-NLS-1$ //$NON-NLS-2$ |
|
292 |
Log.finest("Parent retrieved from UUID/node path: " + retrievedParent + "."); //$NON-NLS-1$ //$NON-NLS-2$
|
|
292 | 293 |
retrievedParent.addChild(this); |
293 | 294 |
} |
294 | 295 |
else { |
295 |
Log.severe("Warning: no parent was found in project for path=" + parametersNodePath + " and puuid=" + parentNodePath + " preferences=" + this.dumpParameters()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
|
296 |
Log.severe("Warning: no parent was found in project for result parameters UUID/node path=" + parametersNodePath + " and parent UUID/node path=" + parentNodePath + " - current parameters=" + this.dumpParameters()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
|
296 | 297 |
try { |
297 | 298 |
TBXPreferences.delete(this); |
298 | 299 |
} |
... | ... | |
309 | 310 |
this.loadParameters(); // subclasses manual settings |
310 | 311 |
|
311 | 312 |
try { |
312 |
if (creationDate == null) { |
|
313 |
creationDate = Calendar.getInstance().getTime(); |
|
314 |
this.saveParameter(TBXPreferences.CREATION_DATE, ID_TIME_FORMAT.format(creationDate)); |
|
313 |
if (this.creationDate == null) {
|
|
314 |
this.creationDate = Calendar.getInstance().getTime();
|
|
315 |
this.saveParameter(TBXPreferences.CREATION_DATE, ID_TIME_FORMAT.format(this.creationDate));
|
|
315 | 316 |
} |
316 | 317 |
} |
317 | 318 |
catch (Exception e) { |
... | ... | |
326 | 327 |
|
327 | 328 |
// Log |
328 | 329 |
if (this.parent == null) { |
329 |
Log.finest("Warning: the TXMResult of " + this.getClass() + " is attached to no parent. (uuid = " + this.parametersNodePath + ")"); //$NON-NLS-1$ //$NON-NLS-2$ |
|
330 |
Log.finest("Warning: the TXMResult of " + this.getClass() + " is attached to no parent. (uuid = " + this.parametersNodePath + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-1$
|
|
330 | 331 |
} |
331 | 332 |
} |
332 | 333 |
|
333 | 334 |
/** |
334 | 335 |
* Sets the user name. |
335 | 336 |
* |
336 |
* @param name |
|
337 |
* @param name a string dedicated to be defined by the user
|
|
337 | 338 |
*/ |
338 | 339 |
public void setUserName(String name) { |
339 | 340 |
this.userName = name; |
340 | 341 |
} |
341 | 342 |
|
342 | 343 |
/** |
343 |
* @return true is the internal data has been modified
|
|
344 |
* @return true if the internal data has been modified
|
|
344 | 345 |
*/ |
345 | 346 |
public boolean isAltered() { |
346 | 347 |
return altered; |
... | ... | |
391 | 392 |
} |
392 | 393 |
|
393 | 394 |
/** |
394 |
* Creates an UUID dedicated to persistence of this result.
|
|
395 |
* Creates an UUID dedicated to preferences/parameters storing and to persistence of a result.
|
|
395 | 396 |
* |
396 | 397 |
* @return |
397 | 398 |
*/ |
398 | 399 |
public static String createUUID() { |
399 |
// FIXME: SJ: see if it's useful to put the class name or not, should be better to save it in the .prefs |
|
400 |
// this.uniqueID = this.getClass().getName() + '@' + ID_TIME_FORMAT.format(new Date(System.currentTimeMillis())) + "_" + UUID.randomUUID(); |
|
401 | 400 |
return UUID_PREFIX + ID_TIME_FORMAT.format(new Date(System.currentTimeMillis())) + "_" + nextInt(); |
402 | 401 |
} |
403 | 402 |
|
... | ... | |
410 | 409 |
} |
411 | 410 |
|
412 | 411 |
/** |
413 |
* Checks if the result at least one child. |
|
412 |
* Checks if the result has at least one child.
|
|
414 | 413 |
* |
415 | 414 |
* @return |
416 | 415 |
*/ |
... | ... | |
420 | 419 |
|
421 | 420 |
|
422 | 421 |
/** |
423 |
* Gets the preferences node path of the result command. |
|
422 |
* Gets the preferences node path of the result linked command.
|
|
424 | 423 |
* |
425 | 424 |
* @return |
426 | 425 |
*/ |
... | ... | |
474 | 473 |
} |
475 | 474 |
|
476 | 475 |
/** |
477 |
* Stores the parameters of the specified types used for last computing in the specified HashMap.
|
|
476 |
* Stores the parameters of the specified types used during last computing in the specified HashMap.
|
|
478 | 477 |
* |
479 | 478 |
* @param parameterTypes |
480 | 479 |
* @param appendToLastParameters |
... | ... | |
518 | 517 |
} |
519 | 518 |
|
520 | 519 |
/** |
521 |
* Stores the last parameters of the specified types used for computing.
|
|
520 |
* Stores the last parameters of the specified types used during last computing.
|
|
522 | 521 |
* |
523 | 522 |
* @param parametersTypes |
524 | 523 |
* @throws Exception |
... | ... | |
528 | 527 |
} |
529 | 528 |
|
Formats disponibles : Unified diff