Révision 1153
tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/query/CQLQuery.java (revision 1153) | ||
---|---|---|
77 | 77 |
* Instantiates a new query. |
78 | 78 |
*/ |
79 | 79 |
protected CQLQuery() { |
80 |
this.queryString = ""; |
|
80 | 81 |
} |
81 | 82 |
|
82 | 83 |
/** |
... | ... | |
139 | 140 |
* |
140 | 141 |
* @return the query string |
141 | 142 |
*/ |
142 |
public String getQueryString() { |
|
143 |
public final String getQueryString() {
|
|
143 | 144 |
return queryString; |
144 | 145 |
} |
145 | 146 |
|
tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/query/QueryFocus.java (revision 1153) | ||
---|---|---|
43 | 43 |
*/ |
44 | 44 |
public QueryFocus(Focus focus) { |
45 | 45 |
this.focus = focus; |
46 |
this.queryString = focus.getQueryString(); |
|
46 | 47 |
} |
47 | 48 |
|
48 |
/* (non-Javadoc) |
|
49 |
* @see org.txm.searchengine.cqp.corpus.query.Query#getQueryString() |
|
50 |
*/ |
|
51 |
@Override |
|
52 |
public String getQueryString() { |
|
53 |
return this.focus.getQueryString(); |
|
54 |
} |
|
49 |
// /* (non-Javadoc)
|
|
50 |
// * @see org.txm.searchengine.cqp.corpus.query.Query#getQueryString()
|
|
51 |
// */
|
|
52 |
// @Override
|
|
53 |
// public String getQueryString() {
|
|
54 |
// return this.focus.getQueryString();
|
|
55 |
// }
|
|
55 | 56 |
|
56 | 57 |
} |
tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/query/QueryPart.java (revision 1153) | ||
---|---|---|
76 | 76 |
queryString = query.toString(); |
77 | 77 |
} |
78 | 78 |
|
79 |
/* |
|
80 |
* (non-Javadoc) |
|
81 |
* |
|
82 |
* @see org.txm.searchengine.cqp.corpus.query.Query#getQueryString() |
|
83 |
*/ |
|
84 |
/* |
|
85 |
* Produce a query such as: [_.struct_property="value"] expand to struct |
|
86 |
* |
|
87 |
* OLD VERSION: /region[TEI_type,a]::a.TEI_type="value" |
|
88 |
*/ |
|
89 |
@Override |
|
90 |
public String getQueryString() { |
|
91 |
return queryString; |
|
92 |
|
|
93 |
// another way to query parts less restrictif but missleading |
|
94 |
//return String.format("[_.%s=\"%s\"] expand to %s", tag, value, structure.getName()); |
|
95 |
} |
|
79 |
// /*
|
|
80 |
// * (non-Javadoc)
|
|
81 |
// *
|
|
82 |
// * @see org.txm.searchengine.cqp.corpus.query.Query#getQueryString()
|
|
83 |
// */
|
|
84 |
// /*
|
|
85 |
// * Produce a query such as: [_.struct_property="value"] expand to struct
|
|
86 |
// *
|
|
87 |
// * OLD VERSION: /region[TEI_type,a]::a.TEI_type="value"
|
|
88 |
// */
|
|
89 |
// @Override
|
|
90 |
// public String getQueryString() {
|
|
91 |
// return queryString;
|
|
92 |
// |
|
93 |
// // another way to query parts less restrictif but missleading
|
|
94 |
// //return String.format("[_.%s=\"%s\"] expand to %s", tag, value, structure.getName());
|
|
95 |
// }
|
|
96 | 96 |
} |
tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/Partition.java (revision 1153) | ||
---|---|---|
582 | 582 |
|
583 | 583 |
@Override |
584 | 584 |
public String toString() { |
585 |
if (this.userName != null) {
|
|
585 |
if (!this.userName.isEmpty()) {
|
|
586 | 586 |
return this.userName; |
587 | 587 |
} |
588 | 588 |
return super.toString(); |
tmp/org.txm.core/src/java/org/txm/core/results/Parameter.java (revision 1153) | ||
---|---|---|
21 | 21 |
/** |
22 | 22 |
* To determine what kind of parameters has been changed between to computing/rendering and do only computing, rendering or both. |
23 | 23 |
*/ |
24 |
public final int COMPUTING = 0, RENDERING = 1; |
|
24 |
public final int COMPUTING = 0, RENDERING = 1, INTERNAL = 3;
|
|
25 | 25 |
|
26 | 26 |
/** |
27 | 27 |
* String representation of the types for logging purpose. |
28 | 28 |
*/ |
29 |
public final String[] types = {"Computing", "Rendering"}; //$NON-NLS-1$ |
|
29 |
public final String[] types = {"Computing", "Rendering", "Internal"}; //$NON-NLS-1$
|
|
30 | 30 |
|
31 | 31 |
/** |
32 | 32 |
* The parameter key name. If filled with some preference key, it can be used to automatically load or save parameters from and to the preferences nodes. |
tmp/org.txm.core/src/java/org/txm/core/results/TXMResult.java (revision 1153) | ||
---|---|---|
104 | 104 |
/** |
105 | 105 |
* The visibility state. |
106 | 106 |
*/ |
107 |
protected boolean visible; |
|
107 |
@Parameter(key=TXMPreferences.VISIBLE, type=Parameter.INTERNAL) |
|
108 |
private Boolean visible; |
|
108 | 109 |
|
109 | 110 |
/** |
110 | 111 |
* The user name (to rename a result). |
111 | 112 |
*/ |
113 |
@Parameter(key=TXMPreferences.USER_NAME, type=Parameter.INTERNAL) |
|
112 | 114 |
protected String userName; |
113 | 115 |
|
114 |
|
|
115 | 116 |
/** |
116 | 117 |
* To store the simple name for unserialization and lazy loading. |
117 | 118 |
*/ |
119 |
@Parameter(key=TXMPreferences.LAZY_NAME, type=Parameter.INTERNAL) |
|
118 | 120 |
protected String lazyName; |
119 | 121 |
|
120 | 122 |
|
... | ... | |
231 | 233 |
Log.finest("TXMResult.TXMResult(): command preferences node path: " + this.commandPreferencesNodePath); |
232 | 234 |
|
233 | 235 |
|
234 |
|
|
236 |
this.visible = true; |
|
235 | 237 |
this.dirty = true; |
236 | 238 |
this.internalPersistable = false; |
237 | 239 |
this.userPersistable = TBXPreferences.getInstance().getBoolean(TBXPreferences.AUTO_PERSISTENCE_ENABLED); |
... | ... | |
260 | 262 |
} |
261 | 263 |
} |
262 | 264 |
|
263 |
// retrieving user name |
|
264 |
if (!this.getStringParameterValue(TXMPreferences.USER_NAME).isEmpty()) { |
|
265 |
this.userName = this.getStringParameterValue(TXMPreferences.USER_NAME); |
|
266 |
} |
|
267 |
|
|
268 |
// retrieving lazy name |
|
269 |
if (!this.getStringParameterValue(TXMPreferences.LAZY_NAME).isEmpty()) { |
|
270 |
this.lazyName = this.getStringParameterValue(TXMPreferences.LAZY_NAME); |
|
271 |
} |
|
272 |
|
|
273 |
// retrieving visibility state |
|
274 |
if (this.parameterExists(TXMPreferences.VISIBLE)) { |
|
275 |
this.visible = this.getBooleanParameterValue(TXMPreferences.VISIBLE); |
|
276 |
} |
|
277 |
else { |
|
278 |
this.visible = true; |
|
279 |
} |
|
280 |
|
|
281 | 265 |
// loads parameters from local result node, current command preferences or default command preferences |
282 | 266 |
try { |
283 | 267 |
this.autoLoadParametersFromAnnotations(); // auto fill from Parameter annotations |
... | ... | |
855 | 839 |
// internal data to save for unserialization |
856 | 840 |
this.saveParameter("class", this.getClass().getName()); //$NON-NLS-1$ |
857 | 841 |
// store the user name if exists, otherwise the simple name as lazy name (to display something at reloading otherwise the simple name can leads to error because the result is not computed until it will be reopen) |
858 |
if (this.userName != null) { |
|
859 |
this.saveParameter(TXMPreferences.USER_NAME, this.userName); |
|
860 |
} |
|
861 |
this.saveParameter(TXMPreferences.LAZY_NAME, this.getSimpleName()); |
|
862 |
this.saveParameter(TXMPreferences.VISIBLE, this.visible); |
|
863 | 842 |
|
864 | 843 |
this.saveParameter(TXMPreferences.RESULT_PARAMETERS_NODE_PATH, this.parametersNodePath); |
865 | 844 |
this.saveParameter(TXMPreferences.RESULT_UUID, this.uniqueID); |
... | ... | |
924 | 903 |
* @throws Exception |
925 | 904 |
*/ |
926 | 905 |
protected boolean autoLoadParametersFromAnnotations() throws Exception { |
927 |
return this.autoLoadParametersFromAnnotations(Parameter.COMPUTING);
|
|
906 |
return this.autoLoadParametersFromAnnotations(Parameter.COMPUTING) && this.autoLoadParametersFromAnnotations(Parameter.INTERNAL);
|
|
928 | 907 |
} |
929 | 908 |
|
930 | 909 |
/** |
... | ... | |
1573 | 1552 |
* @return the current name |
1574 | 1553 |
*/ |
1575 | 1554 |
public String getCurrentName() { |
1576 |
if (this.userName != null) {
|
|
1555 |
if (this.userName.length() > 0) {
|
|
1577 | 1556 |
return this.userName; |
1578 | 1557 |
} |
1579 | 1558 |
else if (this.lazyName != null) { |
tmp/org.txm.core/src/java/org/txm/objects/Edition.java (revision 1153) | ||
---|---|---|
76 | 76 |
*/ |
77 | 77 |
public Edition(Text text) { |
78 | 78 |
super(text); |
79 |
this.visible = false;
|
|
79 |
this.setVisible(false);
|
|
80 | 80 |
this.internalPersistable = true; |
81 | 81 |
} |
82 | 82 |
|
... | ... | |
87 | 87 |
*/ |
88 | 88 |
public Edition(String parametersNodePath) { |
89 | 89 |
super(parametersNodePath); |
90 |
this.visible = false;
|
|
90 |
this.setVisible(false);
|
|
91 | 91 |
this.internalPersistable = true; |
92 | 92 |
} |
93 | 93 |
|
tmp/org.txm.concordance.core/src/org/txm/concordance/core/functions/Concordance.java (revision 1153) | ||
---|---|---|
195 | 195 |
|
196 | 196 |
try { |
197 | 197 |
|
198 |
if(!this.getStringParameterValue(ConcordancePreferences.QUERY).isEmpty()) { |
|
199 |
this.setQuery(this.getStringParameterValue(ConcordancePreferences.QUERY)); |
|
200 |
} |
|
198 |
this.setQuery(this.getStringParameterValue(ConcordancePreferences.QUERY)); |
|
201 | 199 |
|
202 | 200 |
this.setCQLSeparator(this.getCorpus().getCQLLimitQuery()); |
203 | 201 |
|
... | ... | |
373 | 371 |
|
374 | 372 |
@Override |
375 | 373 |
public boolean canCompute() { |
374 |
boolean go = true; |
|
376 | 375 |
if(this.getCorpus() == null) { |
377 | 376 |
System.err.println("Concordance.canCompute(): Corpus is not set."); |
378 |
return false;
|
|
377 |
go = false;
|
|
379 | 378 |
} |
380 | 379 |
if(pQuery == null || pQuery.isEmpty()) { |
381 | 380 |
System.err.println("Concordance.canCompute(): Query is not set or empty."); |
382 |
return false;
|
|
381 |
go = false;
|
|
383 | 382 |
} |
384 |
return true;
|
|
383 |
return go;
|
|
385 | 384 |
} |
386 | 385 |
|
387 | 386 |
@Override |
tmp/org.txm.rcp/src/main/java/org/txm/rcp/adapters/TXMResultAdapter.java (revision 1153) | ||
---|---|---|
37 | 37 |
@Override |
38 | 38 |
public String getLabel(Object result) { |
39 | 39 |
if (result instanceof TXMResult) { |
40 |
String star = ((TXMResult) result).isUserPersistable()?"":" *";
|
|
40 |
String star = (((TXMResult) result).isInternalPersistable() || ((TXMResult) result).isUserPersistable())?"":" *";
|
|
41 | 41 |
return ((TXMResult) result).getCurrentName()+star; |
42 | 42 |
} |
43 | 43 |
else { |
tmp/org.txm.rcp/src/main/java/org/txm/rcp/editors/TXMEditor.java (revision 1153) | ||
---|---|---|
852 | 852 |
f.setAccessible(true); |
853 | 853 |
Object object = f.get(this); |
854 | 854 |
Object value = this.getResult().getParameter(parameter.key(), true); // propagate to parent one time |
855 |
|
|
856 |
if (value == null) { |
|
857 |
//System.out.println("Warning: "+this.getPartName()+" result "+this.getResult()+" "+parameter.key()+" is not initialized."); |
|
858 |
continue; // not initialized |
|
859 |
} |
|
855 | 860 |
if(object instanceof ToolItem) { |
856 | 861 |
((ToolItem)object).setSelection((Boolean) value); |
857 | 862 |
} |
Formats disponibles : Unified diff