Révision 579
tmp/org.txm.rcp/src/main/java/org/txm/rcp/views/cmdparameters/ParametersView.java (revision 579) | ||
---|---|---|
94 | 94 |
try { |
95 | 95 |
// Preferences |
96 | 96 |
String[] keys = result.getParametersKeys(); |
97 |
buffer.append("Command preferences (count = " + keys.length + ", node path = " + result.getPreferencesNodeQualifier() + "): \n"); |
|
97 | 98 |
buffer.append("Command preferences (" + keys.length + "): \n"); |
98 | 99 |
for (String key : keys) { |
99 | 100 |
buffer.append(key + "=" + result.getStringParameterValue(key) + "\n"); |
tmp/org.txm.chartsengine.core/src/org/txm/chartsengine/core/results/ChartResult.java (revision 579) | ||
---|---|---|
116 | 116 |
* @return |
117 | 117 |
* @throws Exception |
118 | 118 |
*/ |
119 |
// FIXME: became useless, the parameters seems to be now well loaded with loadGenericParameters(); |
|
119 | 120 |
private final boolean loadInternalParameters() throws Exception { |
120 | 121 |
|
121 | 122 |
// FIXME: Debug |
122 | 123 |
System.err.println("ChartResult.loadInternalParameters(): loading shared parameters into fields."); |
123 | 124 |
|
124 |
this.titleVisible = this.getBooleanParameterValue(ChartsEnginePreferences.SHOW_TITLE); |
|
125 |
this.legendVisible = this.getBooleanParameterValue(ChartsEnginePreferences.SHOW_LEGEND); |
|
126 |
this.gridVisible = this.getBooleanParameterValue(ChartsEnginePreferences.SHOW_GRID); |
|
127 |
this.renderingColorsMode = this.getIntParameterValue(ChartsEnginePreferences.RENDERING_COLORS_MODE); |
|
128 |
this.font = this.getStringParameterValue(ChartsEnginePreferences.FONT); |
|
129 |
this.chartType = this.getStringParameterValue(ChartsEnginePreferences.CHART_TYPE); |
|
125 |
// this.titleVisible = this.getBooleanParameterValue(ChartsEnginePreferences.SHOW_TITLE);
|
|
126 |
// this.legendVisible = this.getBooleanParameterValue(ChartsEnginePreferences.SHOW_LEGEND);
|
|
127 |
// this.gridVisible = this.getBooleanParameterValue(ChartsEnginePreferences.SHOW_GRID);
|
|
128 |
// this.renderingColorsMode = this.getIntParameterValue(ChartsEnginePreferences.RENDERING_COLORS_MODE);
|
|
129 |
// this.font = this.getStringParameterValue(ChartsEnginePreferences.FONT);
|
|
130 |
// this.chartType = this.getStringParameterValue(ChartsEnginePreferences.CHART_TYPE);
|
|
130 | 131 |
return true; |
131 | 132 |
} |
132 | 133 |
|
134 |
@Override |
|
135 |
protected boolean loadGenericParameters() throws Exception { |
|
136 |
return (super.loadGenericParameters() |
|
137 |
&& super.loadGenericParameters(Parameter.RENDERING)); |
|
138 |
} |
|
139 |
|
|
133 | 140 |
|
134 | 141 |
|
135 | 142 |
/** |
tmp/org.txm.core/src/java/org/txm/core/preferences/TXMPreferences.java (revision 579) | ||
---|---|---|
876 | 876 |
} |
877 | 877 |
|
878 | 878 |
/** |
879 |
* Dumps the keys and values of the specified node.
|
|
879 |
* |
|
880 | 880 |
* @param nodeQualifier |
881 | 881 |
* @throws BackingStoreException |
882 | 882 |
*/ |
tmp/org.txm.core/src/java/org/txm/core/results/TXMResult.java (revision 579) | ||
---|---|---|
513 | 513 |
return true; |
514 | 514 |
} |
515 | 515 |
|
516 |
|
|
517 |
protected boolean loadGenericParameters() throws Exception { |
|
518 |
return this.loadGenericParameters(Parameter.COMPUTING); |
|
519 |
} |
|
520 |
|
|
516 | 521 |
/** |
517 | 522 |
* Initialize the @Parameter class members objects using the default and persisted values in the Preference Store |
518 | 523 |
* |
... | ... | |
522 | 527 |
* @throws Exception |
523 | 528 |
* @throws Exception |
524 | 529 |
*/ |
525 |
private final boolean loadGenericParameters() throws Exception {
|
|
530 |
protected boolean loadGenericParameters(int parameterType) throws Exception {
|
|
526 | 531 |
|
527 | 532 |
// FIXME: debug |
528 | 533 |
System.err.println("TXMResult.loadGenericParameters(): loading generic parameters into fields."); |
529 | 534 |
|
530 |
Class clazz = this.getClass(); |
|
535 |
List<Field> fields = new ArrayList<Field>(); |
|
536 |
Class<?> clazz = this.getClass(); |
|
537 |
while (clazz != Object.class) { |
|
538 |
fields.addAll(Arrays.asList(clazz.getDeclaredFields())); |
|
539 |
clazz = clazz.getSuperclass(); |
|
540 |
} |
|
531 | 541 |
|
532 |
Field[] fields = clazz.getDeclaredFields(); |
|
533 | 542 |
for (Field f : fields) { |
534 | 543 |
|
535 | 544 |
Parameter parameter = f.getAnnotation(Parameter.class); |
536 |
if (parameter == null || parameter.type() != Parameter.COMPUTING) {
|
|
545 |
if (parameter == null || parameter.type() != parameterType) {
|
|
537 | 546 |
continue; |
538 | 547 |
} |
539 | 548 |
String key = parameter.key(); |
540 |
if ("".equals(key)) { |
|
549 |
|
|
550 |
// FIXME: debug |
|
551 |
if(key.equals("charts_engine_show_title")) { |
|
552 |
System.out.println("TXMResult.loadGenericParameters() " + key); |
|
553 |
System.out.println("TXMResult.loadGenericParameters() class = " + f.getType()); |
|
554 |
System.out.println("TXMResult.loadGenericParameters() test = " + f.getType().isAssignableFrom(boolean.class)); |
|
555 |
} |
|
556 |
|
|
557 |
|
|
558 |
if (key.isEmpty()) { |
|
541 | 559 |
continue; // no preference key defined |
542 | 560 |
} |
543 | 561 |
try { |
544 | 562 |
f.setAccessible(true); // set accessible to test the field values |
545 | 563 |
|
546 | 564 |
// only manage simple persisted types |
547 |
if (f.getClass().equals(String.class)) {
|
|
565 |
if(f.getType().isAssignableFrom(String.class)) {
|
|
548 | 566 |
String persistedValue = this.getStringParameterValue(key); |
549 | 567 |
if (persistedValue != null) { |
550 | 568 |
f.set(this, persistedValue); |
551 | 569 |
} |
552 |
} else if (f.getClass().equals(Integer.class)) { |
|
570 |
} |
|
571 |
else if (f.getType().isAssignableFrom(int.class)) { |
|
553 | 572 |
Integer persistedValue = this.getIntParameterValue(key); |
554 | 573 |
if (persistedValue != null) { |
555 | 574 |
f.set(this, persistedValue); |
556 | 575 |
} |
557 |
} else if (f.getClass().equals( Double.class)) { |
|
576 |
} |
|
577 |
else if (f.getType().isAssignableFrom(double.class)) { |
|
558 | 578 |
Double persistedValue = this.getDoubleParameterValue(key); |
559 | 579 |
if (persistedValue != null) { |
560 | 580 |
f.set(this, persistedValue); |
561 | 581 |
} |
562 |
} else if (f.getClass().equals(Float.class)) { |
|
582 |
} |
|
583 |
else if (f.getType().isAssignableFrom(float.class)) { |
|
563 | 584 |
Float persistedValue = this.getFloatParameterValue(key); |
564 | 585 |
if (persistedValue != null) { |
565 | 586 |
f.set(this, persistedValue); |
566 | 587 |
} |
567 |
} else if (f.getClass().equals(Boolean.class)) { |
|
588 |
} |
|
589 |
// FIXME: doesn't work |
|
590 |
//else if (f.getClass().equals(Boolean.class)) { |
|
591 |
else if (f.getType().isAssignableFrom(boolean.class)) { |
|
592 |
|
|
568 | 593 |
Boolean persistedValue = this.getBooleanParameterValue(key); |
569 | 594 |
if (persistedValue != null) { |
570 | 595 |
f.set(this, persistedValue); |
Formats disponibles : Unified diff