Révision 647
tmp/org.txm.chartsengine.raster.rcp/src/org/txm/chartsengine/raster/rcp/RasterImageChartsComponentProvider.java (revision 647) | ||
---|---|---|
58 | 58 |
this.createChartContainer(chartEditorInput); |
59 | 59 |
//ChartEditor editor = new ChartEditor(this, chartEditorInput); |
60 | 60 |
|
61 |
//ChartEditor editor = new ChartEditor(this, editorInputName, resultData, preferencesNode, chartType, this.getChartsEngine().getChartCreator(resultData.getClass(), chartType).createChartFile(resultData, preferencesNode));
|
|
61 |
//ChartEditor editor = new ChartEditor(this, editorInputName, result, preferencesNode, chartType, this.getChartsEngine().getChartCreator(result.getClass(), chartType).createChartFile(result, preferencesNode));
|
|
62 | 62 |
|
63 | 63 |
// sets and updates the local preferences node qualifier from the result data |
64 | 64 |
//editor.getEditorInput().syncLocalPreferencesNode(); |
tmp/org.txm.para.rcp/META-INF/MANIFEST.MF (revision 647) | ||
---|---|---|
1 | 1 |
Manifest-Version: 1.0 |
2 | 2 |
Bundle-ManifestVersion: 2 |
3 |
Bundle-Name: Rcp
|
|
3 |
Bundle-Name: Para RCP
|
|
4 | 4 |
Bundle-SymbolicName: org.txm.para.rcp;singleton:=true |
5 | 5 |
Bundle-Version: 1.0.0.qualifier |
6 |
Bundle-Activator: org.txm.para.rcp.Activator |
|
7 | 6 |
Require-Bundle: org.txm.utils;bundle-version="1.0.0", |
8 | 7 |
org.eclipse.core.runtime;bundle-version="3.10.0", |
9 | 8 |
org.eclipse.osgi;bundle-version="3.10.2", |
... | ... | |
16 | 15 |
org.txm.searchengine.core;bundle-version="1.0.0" |
17 | 16 |
Bundle-RequiredExecutionEnvironment: JavaSE-1.6 |
18 | 17 |
Bundle-ActivationPolicy: lazy |
19 |
Export-Package: org.txm.para.rcp, |
|
20 |
org.txm.para.rcp.editors |
|
18 |
Export-Package: org.txm.para.rcp.editors |
tmp/org.txm.para.rcp/src/org/txm/para/rcp/Activator.java (revision 647) | ||
---|---|---|
1 |
package org.txm.para.rcp; |
|
2 |
|
|
3 |
import org.eclipse.ui.plugin.AbstractUIPlugin; |
|
4 |
import org.osgi.framework.BundleContext; |
|
5 |
|
|
6 |
/** |
|
7 |
* The activator class controls the plug-in life cycle |
|
8 |
*/ |
|
9 |
public class Activator extends AbstractUIPlugin { |
|
10 |
|
|
11 |
// The plug-in ID |
|
12 |
public static final String PLUGIN_ID = "org.txm.para.rcp"; //$NON-NLS-1$ |
|
13 |
|
|
14 |
// The shared instance |
|
15 |
private static Activator plugin; |
|
16 |
|
|
17 |
/** |
|
18 |
* The constructor |
|
19 |
*/ |
|
20 |
public Activator() { |
|
21 |
} |
|
22 |
|
|
23 |
/* |
|
24 |
* (non-Javadoc) |
|
25 |
* @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) |
|
26 |
*/ |
|
27 |
public void start(BundleContext context) throws Exception { |
|
28 |
super.start(context); |
|
29 |
plugin = this; |
|
30 |
} |
|
31 |
|
|
32 |
/* |
|
33 |
* (non-Javadoc) |
|
34 |
* @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) |
|
35 |
*/ |
|
36 |
public void stop(BundleContext context) throws Exception { |
|
37 |
plugin = null; |
|
38 |
super.stop(context); |
|
39 |
} |
|
40 |
|
|
41 |
/** |
|
42 |
* Returns the shared instance |
|
43 |
* |
|
44 |
* @return the shared instance |
|
45 |
*/ |
|
46 |
public static Activator getDefault() { |
|
47 |
return plugin; |
|
48 |
} |
|
49 |
|
|
50 |
} |
tmp/org.txm.para.rcp/src/org/txm/para/rcp/editors/ParaBrowserEditor.java (revision 647) | ||
---|---|---|
57 | 57 |
import org.eclipse.ui.IEditorSite; |
58 | 58 |
import org.eclipse.ui.PartInitException; |
59 | 59 |
import org.eclipse.ui.part.EditorPart; |
60 |
import org.txm.para.functions.ParaBrowser; |
|
60 |
import org.txm.para.core.functions.ParaBrowser;
|
|
61 | 61 |
import org.txm.rcp.Messages; |
62 | 62 |
import org.txm.rcp.StatusLine; |
63 | 63 |
import org.txm.rcp.editors.input.ParaBrowserEditorInput; |
tmp/org.txm.para.core/META-INF/MANIFEST.MF (revision 647) | ||
---|---|---|
1 | 1 |
Manifest-Version: 1.0 |
2 | 2 |
Bundle-ManifestVersion: 2 |
3 |
Bundle-Name: Core |
|
4 |
Bundle-SymbolicName: org.txm.para.core |
|
3 |
Bundle-Name: Para Core
|
|
4 |
Bundle-SymbolicName: org.txm.para.core;singleton:=true
|
|
5 | 5 |
Bundle-Version: 1.0.0.qualifier |
6 |
Bundle-Activator: org.txm.para.core.Activator |
|
7 | 6 |
Require-Bundle: org.txm.libs.groovy-all;bundle-version="2.3.3", |
8 | 7 |
org.txm.utils;bundle-version="1.0.0", |
9 | 8 |
org.eclipse.osgi;bundle-version="3.10.2", |
... | ... | |
14 | 13 |
org.txm.searchengine.core;bundle-version="1.0.0" |
15 | 14 |
Bundle-RequiredExecutionEnvironment: JavaSE-1.6 |
16 | 15 |
Bundle-ActivationPolicy: lazy |
17 |
Export-Package: org.txm.para.core, |
|
18 |
org.txm.para.functions |
|
16 |
Export-Package: org.txm.para.core.functions |
tmp/org.txm.para.core/src/org/txm/para/core/Activator.java (revision 647) | ||
---|---|---|
1 |
package org.txm.para.core; |
|
2 |
|
|
3 |
import org.eclipse.ui.plugin.AbstractUIPlugin; |
|
4 |
import org.osgi.framework.BundleContext; |
|
5 |
|
|
6 |
/** |
|
7 |
* The activator class controls the plug-in life cycle |
|
8 |
*/ |
|
9 |
public class Activator extends AbstractUIPlugin { |
|
10 |
|
|
11 |
// The plug-in ID |
|
12 |
public static final String PLUGIN_ID = "org.txm.para.core"; //$NON-NLS-1$ |
|
13 |
|
|
14 |
// The shared instance |
|
15 |
private static Activator plugin; |
|
16 |
|
|
17 |
/** |
|
18 |
* The constructor |
|
19 |
*/ |
|
20 |
public Activator() { |
|
21 |
} |
|
22 |
|
|
23 |
/* |
|
24 |
* (non-Javadoc) |
|
25 |
* @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) |
|
26 |
*/ |
|
27 |
public void start(BundleContext context) throws Exception { |
|
28 |
super.start(context); |
|
29 |
plugin = this; |
|
30 |
} |
|
31 |
|
|
32 |
/* |
|
33 |
* (non-Javadoc) |
|
34 |
* @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) |
|
35 |
*/ |
|
36 |
public void stop(BundleContext context) throws Exception { |
|
37 |
plugin = null; |
|
38 |
super.stop(context); |
|
39 |
} |
|
40 |
|
|
41 |
/** |
|
42 |
* Returns the shared instance |
|
43 |
* |
|
44 |
* @return the shared instance |
|
45 |
*/ |
|
46 |
public static Activator getDefault() { |
|
47 |
return plugin; |
|
48 |
} |
|
49 |
|
|
50 |
} |
tmp/org.txm.para.core/src/org/txm/para/core/functions/ParallelContexts.java (revision 647) | ||
---|---|---|
1 |
package org.txm.para.core.functions; |
|
2 |
|
|
3 |
import groovy.lang.IntRange; |
|
4 |
|
|
5 |
import java.io.IOException; |
|
6 |
import java.util.ArrayList; |
|
7 |
import java.util.Collections; |
|
8 |
import java.util.HashMap; |
|
9 |
import java.util.LinkedHashMap; |
|
10 |
import java.util.List; |
|
11 |
|
|
12 |
import org.txm.Toolbox; |
|
13 |
import org.txm.searchengine.cqp.AbstractCqiClient; |
|
14 |
import org.txm.searchengine.cqp.CQPEngine; |
|
15 |
import org.txm.searchengine.cqp.clientExceptions.CqiClientException; |
|
16 |
import org.txm.searchengine.cqp.corpus.Corpus; |
|
17 |
import org.txm.searchengine.cqp.corpus.CorpusManager; |
|
18 |
import org.txm.searchengine.cqp.corpus.Property; |
|
19 |
import org.txm.searchengine.cqp.corpus.QueryResult; |
|
20 |
import org.txm.searchengine.cqp.corpus.StructuralUnitProperty; |
|
21 |
import org.txm.searchengine.cqp.corpus.query.Match; |
|
22 |
import org.txm.searchengine.cqp.corpus.query.Query; |
|
23 |
import org.txm.searchengine.cqp.serverException.CqiServerError; |
|
24 |
|
|
25 |
public class ParallelContexts { |
|
26 |
|
|
27 |
ArrayList<String> queries; |
|
28 |
String struct; |
|
29 |
ArrayList<Corpus> corpora; |
|
30 |
ArrayList<String> props; |
|
31 |
ArrayList<String> refs; |
|
32 |
ArrayList<Integer> CGs; |
|
33 |
ArrayList<Integer> CDs; |
|
34 |
ArrayList<Boolean> participates; |
|
35 |
|
|
36 |
// TODO : manage |
|
37 |
HashMap<String, Match[]> keywordsStartsEnds = new HashMap<String, Match[]>(); |
|
38 |
HashMap<String, ParaCell[]> keywordsStrings = new HashMap<String, ParaCell[]>(); |
|
39 |
ArrayList<String> segKeys; |
|
40 |
private String structprop; |
|
41 |
|
|
42 |
public ParallelContexts(ArrayList<String> queries, String struct, String structprop, ArrayList<Corpus> corpora, |
|
43 |
ArrayList<String> props, ArrayList<String> refs, |
|
44 |
ArrayList<Integer> CGs, ArrayList<Integer> CDs, |
|
45 |
ArrayList<Boolean> participates) throws CqiClientException, IOException, CqiServerError |
|
46 |
{ |
|
47 |
this.queries = queries; |
|
48 |
this.corpora = corpora; |
|
49 |
this.struct = struct; |
|
50 |
this.structprop = structprop; |
|
51 |
this.props = props; |
|
52 |
this.refs = refs; |
|
53 |
this.CGs = CGs; |
|
54 |
this.CDs = CDs; |
|
55 |
this.participates = participates; |
|
56 |
|
|
57 |
for (int num = 0; num < corpora.size() ; num++) { |
|
58 |
if (!participates.get(num)) |
|
59 |
continue; |
|
60 |
Corpus corpus = corpora.get(num); |
|
61 |
//String lang = corpus.getLang(); |
|
62 |
String query = queries.get(num); |
|
63 |
System.out.println(corpus.getName()+" query: "+query); |
|
64 |
QueryResult result = corpus.query(new Query(query), "TMP", true); |
|
65 |
|
|
66 |
try { |
|
67 |
List<Match> matches = result.getMatches(); |
|
68 |
int[] positions = result.getStarts(); |
|
69 |
|
|
70 |
StructuralUnitProperty align_id = corpus.getStructuralUnit(struct).getProperty(structprop); |
|
71 |
System.out.println("struct: "+struct+" prop: "+structprop+" -> "+align_id); |
|
72 |
int[] struct_pos = CQPEngine.getCqiClient().cpos2Struc(align_id.getQualifiedName(), positions); |
|
73 |
String[] struct_ids = CQPEngine.getCqiClient().struc2Str(align_id.getQualifiedName(), struct_pos); |
|
74 |
|
|
75 |
// fill allsegments |
|
76 |
for (int i = 0 ; i < struct_ids.length ; i++) { |
|
77 |
String id = struct_ids[i]; |
|
78 |
if (!keywordsStartsEnds.containsKey(id)) { |
|
79 |
keywordsStartsEnds.put(id, new Match[corpora.size()]); |
|
80 |
keywordsStrings.put(id, new ParaCell[corpora.size()]); |
|
81 |
} |
|
82 |
keywordsStartsEnds.get(id)[num] = matches.get(i); // take the first one |
|
83 |
} |
|
84 |
} catch(Exception e) { |
|
85 |
System.out.println("Result is NULL ! "+e.toString()); |
|
86 |
org.txm.utils.logger.Log.printStackTrace(e); |
|
87 |
} |
|
88 |
} |
|
89 |
|
|
90 |
//sort allsegments |
|
91 |
segKeys = new ArrayList<String>(keywordsStartsEnds.keySet()); |
|
92 |
Collections.sort(segKeys); |
|
93 |
System.out.println("segKeys : "+segKeys.size()); |
|
94 |
} |
|
95 |
|
|
96 |
/** |
|
97 |
* @return the keywordsStartsEnds |
|
98 |
*/ |
|
99 |
public HashMap<String, Match[]> getKeywordsStartsEnds() { |
|
100 |
return keywordsStartsEnds; |
|
101 |
} |
|
102 |
|
|
103 |
/** |
|
104 |
* @return the keywordsStrings |
|
105 |
* @throws CqiServerError |
|
106 |
* @throws IOException |
|
107 |
* @throws CqiClientException |
|
108 |
*/ |
|
109 |
public HashMap<String, ParaCell[]> getKeywordsStrings() throws CqiClientException, IOException, CqiServerError { |
|
110 |
return getKeywordsStrings(0, segKeys.size()); |
|
111 |
} |
|
112 |
|
|
113 |
/** |
|
114 |
* @return the keywordsStrings |
|
115 |
* @throws CqiClientException |
|
116 |
* @throws CqiServerError |
|
117 |
* @throws IOException |
|
118 |
*/ |
|
119 |
public LinkedHashMap<String, ParaCell[]> getKeywordsStrings(int from, int to) throws CqiClientException, IOException, CqiServerError { |
|
120 |
if (from < 0 ) from = 0; |
|
121 |
if (to > segKeys.size()) to = segKeys.size(); |
|
122 |
|
|
123 |
LinkedHashMap<String, ParaCell[]> rez = new LinkedHashMap<String, ParaCell[]>(); |
|
124 |
getMissingValues(from, to); |
|
125 |
if (segKeys.size()>0) { |
|
126 |
for (int i = from ; i < to ; i++) |
|
127 |
rez.put(segKeys.get(i), keywordsStrings.get(segKeys.get(i))); |
|
128 |
//System.out.println("getKeywordsStrings [REZ="+rez+"]"); |
|
129 |
} else { |
|
130 |
System.out.println("getKeywordsStrings - NO SEG KEYS !!"); |
|
131 |
} |
|
132 |
|
|
133 |
return rez; |
|
134 |
} |
|
135 |
|
|
136 |
private void getMissingValues(int from , int to) throws CqiClientException, IOException, CqiServerError |
|
137 |
{ |
|
138 |
AbstractCqiClient cqiClient = CorpusManager.getCorpusManager().getCqiClient(); |
|
139 |
if (segKeys.size()>0){ |
|
140 |
String segquery = "<"+struct+"_"+structprop+"=\""; //\"]"; |
|
141 |
for (int i = from ; i < to ; i++) { |
|
142 |
segquery += segKeys.get(i)+"|"; |
|
143 |
} |
|
144 |
segquery = segquery.substring(0, segquery.length() -1 ); |
|
145 |
segquery += "\">[]"; |
|
146 |
System.out.println("align_seg_query : "+segquery); |
|
147 |
|
|
148 |
// loop over corpus to minimize the number of queries |
|
149 |
for (int nocorpus = 0; nocorpus < corpora.size() ; nocorpus++) { |
|
150 |
Corpus corpus = corpora.get(nocorpus); |
|
151 |
int MAXPOSITION = corpus.getSize(); |
|
152 |
StructuralUnitProperty align_id = corpus.getStructuralUnit(struct).getProperty(structprop); |
|
153 |
Property prop = corpus.getProperty(props.get(nocorpus)); |
|
154 |
//PropertyHashMap<CqpDataProxy> proxies = CorpusManager.getCorpusManager().getCorpusProxies(corpus); |
|
155 |
int iCG = CGs.get(nocorpus); |
|
156 |
int iCD = CDs.get(nocorpus); |
|
157 |
//System.out.println("iCG "+iCG+" iCD "+iCD); |
|
158 |
//CqpDataProxy wordp = cqiClient.get(prop); |
|
159 |
String[] split = refs.get(nocorpus).split("_", 2); |
|
160 |
//System.out.println("refs : "+refs); |
|
161 |
StructuralUnitProperty ref = null; |
|
162 |
if (split.length == 2) |
|
163 |
ref = corpus.getStructuralUnit(split[0]).getProperty(split[1]); |
|
164 |
|
|
165 |
// get the seg that actually are in the corpus |
|
166 |
QueryResult resul2t = corpus.query(new Query(segquery), "TMP", true); |
|
167 |
int[] struct_starts = resul2t.getStarts(); |
|
168 |
int[] struct_pos = CQPEngine.getCqiClient().cpos2Struc(align_id.getQualifiedName(), struct_starts); |
|
169 |
String[] struct_ids = CQPEngine.getCqiClient().struc2Str(align_id.getQualifiedName(), struct_pos); |
|
170 |
|
|
171 |
//System.out.println("segs: "+Arrays.toString(struct_ids)); |
|
172 |
|
|
173 |
// get ref if asked |
|
174 |
String[] ref_values = null; |
|
175 |
if (ref != null) { |
|
176 |
int[] struct_pos2 = CQPEngine.getCqiClient().cpos2Struc(ref.getQualifiedName(), struct_starts); |
|
177 |
ref_values = CQPEngine.getCqiClient().struc2Str(ref.getQualifiedName(), struct_pos2); |
|
178 |
} |
|
179 |
//System.out.println("ref values: "+Arrays.toString(ref_values)); |
|
180 |
|
|
181 |
// get the words values of segs |
|
182 |
QueryResult result = corpus.query(new Query(segquery+"+</"+struct+">"), "TMP", false); |
|
183 |
List<Match> matches = result.getMatches(); |
|
184 |
//System.out.println("seg matches: "+matches); |
|
185 |
ArrayList<Integer> positions = new ArrayList<Integer>(); |
|
186 |
for (Match m : matches) { |
|
187 |
groovy.lang.IntRange range = (IntRange) m.getRange(); |
|
188 |
|
|
189 |
int minpos = range.get(0); |
|
190 |
int maxpos = range.get(range.size()-1); |
|
191 |
//System.out.println("range size "+range.size()+" minpos "+minpos+" maxpos "+maxpos); |
|
192 |
//int n = 0; |
|
193 |
for (int i = iCG ; i > 0 ; i--) { |
|
194 |
if (minpos - i >= 0) { |
|
195 |
positions.add(minpos - i); |
|
196 |
//System.out.println("CG add "+(minpos-i)); |
|
197 |
} |
|
198 |
} |
|
199 |
positions.addAll(range); |
|
200 |
//System.out.println("add "+range); |
|
201 |
for (int i = 1 ; i <= iCD ; i++) { |
|
202 |
if (maxpos+i < MAXPOSITION) { |
|
203 |
positions.add(maxpos + i); |
|
204 |
//System.out.println("CD add "+(maxpos+i)); |
|
205 |
} |
|
206 |
} |
|
207 |
} |
|
208 |
|
|
209 |
int[] cpos = new int[positions.size()]; |
|
210 |
for (int i = 0 ; i < positions.size() ; i++) |
|
211 |
cpos[i] = positions.get(i); |
|
212 |
|
|
213 |
List<String> words = cqiClient.getSingleData(prop, cpos); |
|
214 |
//System.out.println("words: "+(words)); |
|
215 |
|
|
216 |
int wordIterator = 0; |
|
217 |
//System.out.println("loop"); |
|
218 |
for (int i = 0 ; i < struct_ids.length ; i++) // for each seg actually in the corpus |
|
219 |
{ |
|
220 |
if (keywordsStrings.get(struct_ids[i])[nocorpus] != null) |
|
221 |
continue; // this cell has already been computed |
|
222 |
if (wordIterator >= words.size()) |
|
223 |
break; // no more words to process |
|
224 |
Match m = matches.get(i); |
|
225 |
|
|
226 |
Match keyWordMatch = keywordsStartsEnds.get(struct_ids[i])[nocorpus]; |
|
227 |
//System.out.println("wordIterator "+wordIterator+" str "+words.get(wordIterator)+ " str2 "+words.get(wordIterator+1)+" pos "+cpos[wordIterator]+" seg no "+i+" match "+m+" keyword "+keyWordMatch); |
|
228 |
//if ((m.getStart() - cpos[wordIterator]) < iCG) System.out.println("WARNING CG"); |
|
229 |
String CCG="", CG ="", keyword="", CD="", CCD="", refValue = ""; |
|
230 |
int state = 1; // 0 CCG, 1 CG 2 keyword 3 CD 4 CCD |
|
231 |
int previouspos = -1; |
|
232 |
while (wordIterator < cpos.length |
|
233 |
&& cpos[wordIterator] <= m.getEnd() + iCD |
|
234 |
&& previouspos <= cpos[wordIterator]) |
|
235 |
{ // concat word value |
|
236 |
int pos = cpos[wordIterator]; |
|
237 |
previouspos = pos ; |
|
238 |
//if (keyWordMatch != null) { |
|
239 |
if (pos < m.getStart()) |
|
240 |
state = 0; |
|
241 |
else if (keyWordMatch != null && pos < keyWordMatch.getStart()) |
|
242 |
state = 1; |
|
243 |
else if (keyWordMatch != null && pos <= keyWordMatch.getEnd()) |
|
244 |
state = 2; |
|
245 |
else if (pos <= m.getEnd()) |
|
246 |
state = 3; |
|
247 |
else |
|
248 |
state = 4; |
|
249 |
//} |
|
250 |
switch (state) { |
|
251 |
case 0: |
|
252 |
CCG += words.get(wordIterator)+" "; break; |
|
253 |
case 1: |
|
254 |
CG += words.get(wordIterator)+" "; break; |
|
255 |
case 2: |
|
256 |
keyword += words.get(wordIterator)+" "; break; |
|
257 |
case 3: |
|
258 |
CD += words.get(wordIterator)+" "; break; |
|
259 |
case 4: |
|
260 |
CCD += words.get(wordIterator)+" "; break; |
|
261 |
} |
|
262 |
wordIterator++; |
|
263 |
} |
|
264 |
|
|
265 |
if (ref_values != null) { |
|
266 |
refValue = ref_values[i]; |
|
267 |
//System.out.println("ref: "+refValue); |
|
268 |
} |
|
269 |
|
|
270 |
// set ParaCell |
|
271 |
ParaCell cell = new ParaCell(CCG, CG, keyword, CD, CCD, refValue); |
|
272 |
keywordsStrings.get(struct_ids[i])[nocorpus] = cell; |
|
273 |
} |
|
274 |
} |
|
275 |
} |
|
276 |
} |
|
277 |
|
|
278 |
/** |
|
279 |
* @return the segKeys |
|
280 |
*/ |
|
281 |
public ArrayList<String> getSegKeys() { |
|
282 |
return segKeys; |
|
283 |
} |
|
284 |
|
|
285 |
/** |
|
286 |
* @return the queries |
|
287 |
*/ |
|
288 |
public ArrayList<String> getQueries() { |
|
289 |
return queries; |
|
290 |
} |
|
291 |
|
|
292 |
/** |
|
293 |
* @return the struct |
|
294 |
*/ |
|
295 |
public String getStruct() { |
|
296 |
return struct; |
|
297 |
} |
|
298 |
|
|
299 |
/** |
|
300 |
* @return the corpora |
|
301 |
*/ |
|
302 |
public ArrayList<Corpus> getCorpora() { |
|
303 |
return corpora; |
|
304 |
} |
|
305 |
|
|
306 |
/** |
|
307 |
* @return the props |
|
308 |
*/ |
|
309 |
public ArrayList<String> getProps() { |
|
310 |
return props; |
|
311 |
} |
|
312 |
|
|
313 |
/** |
|
314 |
* @return the refs |
|
315 |
*/ |
|
316 |
public ArrayList<String> getRefs() { |
|
317 |
return refs; |
|
318 |
} |
|
319 |
|
|
320 |
/** |
|
321 |
* @return the cGs |
|
322 |
*/ |
|
323 |
public ArrayList<Integer> getCGs() { |
|
324 |
return CGs; |
|
325 |
} |
|
326 |
|
|
327 |
/** |
|
328 |
* @return the cDs |
|
329 |
*/ |
|
330 |
public ArrayList<Integer> getCDs() { |
|
331 |
return CDs; |
|
332 |
} |
|
333 |
|
|
334 |
/** |
|
335 |
* @return the participates |
|
336 |
*/ |
|
337 |
public ArrayList<Boolean> getParticipates() { |
|
338 |
return participates; |
|
339 |
} |
|
340 |
|
|
341 |
/* (non-Javadoc) |
|
342 |
* @see java.lang.Object#hashCode() |
|
343 |
*/ |
|
344 |
@Override |
|
345 |
public int hashCode() { |
|
346 |
final int prime = 31; |
|
347 |
int result = 1; |
|
348 |
result = prime * result + ((CDs == null) ? 0 : CDs.hashCode()); |
|
349 |
result = prime * result + ((CGs == null) ? 0 : CGs.hashCode()); |
|
350 |
result = prime * result + ((corpora == null) ? 0 : corpora.hashCode()); |
|
351 |
result = prime * result |
|
352 |
+ ((participates == null) ? 0 : participates.hashCode()); |
|
353 |
result = prime * result + ((props == null) ? 0 : props.hashCode()); |
|
354 |
result = prime * result + ((queries == null) ? 0 : queries.hashCode()); |
|
355 |
result = prime * result + ((refs == null) ? 0 : refs.hashCode()); |
|
356 |
result = prime * result + ((struct == null) ? 0 : struct.hashCode()); |
|
357 |
return result; |
|
358 |
} |
|
359 |
|
|
360 |
/* (non-Javadoc) |
|
361 |
* @see java.lang.Object#equals(java.lang.Object) |
|
362 |
*/ |
|
363 |
@Override |
|
364 |
public boolean equals(Object obj) { |
|
365 |
if (this == obj) |
|
366 |
return true; |
|
367 |
if (obj == null) |
|
368 |
return false; |
|
369 |
if (getClass() != obj.getClass()) |
|
370 |
return false; |
|
371 |
ParallelContexts other = (ParallelContexts) obj; |
|
372 |
if (CDs == null) { |
|
373 |
if (other.CDs != null) |
|
374 |
return false; |
|
375 |
} else if (!CDs.equals(other.CDs)) |
|
376 |
return false; |
|
377 |
if (CGs == null) { |
|
378 |
if (other.CGs != null) |
|
379 |
return false; |
|
380 |
} else if (!CGs.equals(other.CGs)) |
|
381 |
return false; |
|
382 |
if (corpora == null) { |
|
383 |
if (other.corpora != null) |
|
384 |
return false; |
|
385 |
} else if (!corpora.equals(other.corpora)) |
|
386 |
return false; |
|
387 |
if (participates == null) { |
|
388 |
if (other.participates != null) |
|
389 |
return false; |
|
390 |
} else if (!participates.equals(other.participates)) |
|
391 |
return false; |
|
392 |
if (props == null) { |
|
393 |
if (other.props != null) |
|
394 |
return false; |
|
395 |
} else if (!props.equals(other.props)) |
|
396 |
return false; |
|
397 |
if (queries == null) { |
|
398 |
if (other.queries != null) |
|
399 |
return false; |
|
400 |
} else if (!queries.equals(other.queries)) |
|
401 |
return false; |
|
402 |
if (refs == null) { |
|
403 |
if (other.refs != null) |
|
404 |
return false; |
|
405 |
} else if (!refs.equals(other.refs)) |
|
406 |
return false; |
|
407 |
if (struct == null) { |
|
408 |
if (other.struct != null) |
|
409 |
return false; |
|
410 |
} else if (!struct.equals(other.struct)) |
|
411 |
return false; |
|
412 |
return true; |
|
413 |
} |
|
414 |
|
|
415 |
/* (non-Javadoc) |
|
416 |
* @see java.lang.Object#toString() |
|
417 |
*/ |
|
418 |
@Override |
|
419 |
public String toString() { |
|
420 |
return "ParallelContexts [queries=" + queries + ", struct=" + struct |
|
421 |
+ ", corpora=" + corpora + ", props=" + props + ", refs=" |
|
422 |
+ refs + ", CGs=" + CGs + ", CDs=" + CDs + ", participates=" |
|
423 |
+ participates + "]"; |
|
424 |
} |
|
425 |
} |
|
0 | 426 |
tmp/org.txm.para.core/src/org/txm/para/core/functions/ParaBrowser.java (revision 647) | ||
---|---|---|
1 |
package org.txm.para.core.functions; |
|
2 |
|
|
3 |
import java.io.File; |
|
4 |
import java.util.ArrayList; |
|
5 |
import java.util.HashMap; |
|
6 |
import java.util.LinkedHashMap; |
|
7 |
import java.util.List; |
|
8 |
import java.util.Map; |
|
9 |
|
|
10 |
import org.eclipse.core.runtime.IProgressMonitor; |
|
11 |
import org.txm.core.results.TXMParameters; |
|
12 |
import org.txm.core.results.TXMResult; |
|
13 |
import org.txm.searchengine.cqp.CqpDataProxy; |
|
14 |
import org.txm.searchengine.cqp.ReferencePattern; |
|
15 |
import org.txm.searchengine.cqp.clientExceptions.CqiClientException; |
|
16 |
import org.txm.searchengine.cqp.corpus.MainCorpus; |
|
17 |
import org.txm.searchengine.cqp.corpus.Property; |
|
18 |
import org.txm.searchengine.cqp.corpus.QueryResult; |
|
19 |
import org.txm.searchengine.cqp.corpus.StructuralUnit; |
|
20 |
import org.txm.searchengine.cqp.corpus.StructuralUnitProperty; |
|
21 |
import org.txm.searchengine.cqp.corpus.query.Match; |
|
22 |
import org.txm.searchengine.cqp.corpus.query.Query; |
|
23 |
import org.txm.searchengine.cqp.corpus.query.QueryPart; |
|
24 |
import org.txm.utils.Pair; |
|
25 |
import org.txm.utils.i18n.LangFormater; |
|
26 |
|
|
27 |
public class ParaBrowser extends TXMResult { |
|
28 |
|
|
29 |
/** |
|
30 |
* Gets the nextor previous. |
|
31 |
* |
|
32 |
* @param unit the unit |
|
33 |
* @param property the property |
|
34 |
* @param value the value |
|
35 |
* @param isNext the is next |
|
36 |
* @return the nextor previous |
|
37 |
*/ |
|
38 |
public String getNextOrPrevious(MainCorpus corpus, StructuralUnit unit, |
|
39 |
StructuralUnitProperty property, String value, boolean isNext) { |
|
40 |
String next = ""; |
|
41 |
Query query = null; |
|
42 |
System.out.println("GET NEXT or PREVIOUS : " + value + " unit " + unit |
|
43 |
+ " property " + property + " next? " + isNext); |
|
44 |
if (isNext) { |
|
45 |
query = new Query("<" + unit.getName() + "_id=\"" + value |
|
46 |
+ "\">[]+</" + unit.getName() + ">[]"); |
|
47 |
} else { |
|
48 |
query = new Query("<" + unit.getName() + ">[]+" + "</" |
|
49 |
+ unit.getName() + "><" + unit.getName() + "_id=\"" + value |
|
50 |
+ "\">[]+"); |
|
51 |
} |
|
52 |
Property text_id = unit.getProperty("id"); //$NON-NLS-1$ |
|
53 |
// System.out.println("text_id = unit "+unit+" get props de id"); |
|
54 |
// System.out.println("Query : "+query); |
|
55 |
if (property != null) { |
|
56 |
// List<Line> lines; |
|
57 |
int nLines; |
|
58 |
|
|
59 |
ReferencePattern referencePattern = new ReferencePattern(); |
|
60 |
referencePattern.addProperty(text_id); |
|
61 |
|
|
62 |
QueryResult queryResult; |
|
63 |
try { |
|
64 |
Map<Property, List<List<String>>> wordPropValues = new HashMap<Property, List<List<String>>>(); |
|
65 |
|
|
66 |
queryResult = corpus.query(query, query.getQueryString().replace( |
|
67 |
" ", "_") |
|
68 |
+ "_parallel", false); |
|
69 |
nLines = queryResult.getNMatch(); // get number of tokens |
|
70 |
// System.out.println("nLines : "+nLines); |
|
71 |
// lines = new ArrayList<Line>(); |
|
72 |
|
|
73 |
List<Match> matches = null; |
|
74 |
if (nLines > 0) |
|
75 |
matches = queryResult.getMatches(0, nLines - 1); // get the |
|
76 |
// indexes |
|
77 |
// sequences |
|
78 |
// of |
|
79 |
// result's |
|
80 |
// tokens |
|
81 |
else |
|
82 |
matches = new ArrayList<Match>(); |
|
83 |
|
|
84 |
List<Integer> beginingOfKeywordsPositions = new ArrayList<Integer>(); |
|
85 |
List<Integer> lengthOfKeywords = new ArrayList<Integer>(); |
|
86 |
// keywordsViewPropValues = new HashMap<Property, |
|
87 |
// List<List<String>>>(); |
|
88 |
int nb = 0; |
|
89 |
for (int j = 0; j < nLines; j++) { |
|
90 |
Match match = matches.get(j); |
|
91 |
beginingOfKeywordsPositions.add(match.getStart()); // get |
|
92 |
// the first |
|
93 |
// index |
|
94 |
lengthOfKeywords.add(match.getEnd() - match.getStart() + 1);// get |
|
95 |
// the last index |
|
96 |
nb = match.getEnd() - match.getStart() + 1; |
|
97 |
} |
|
98 |
|
|
99 |
if (!isNext) { |
|
100 |
nb = 1; |
|
101 |
} |
|
102 |
|
|
103 |
// get all reference values of all lines |
|
104 |
for (Property prop : referencePattern) { |
|
105 |
// List<List<String>> propVals = cache.get(prop).getData( |
|
106 |
// beginingOfKeywordsPositions, |
|
107 |
// Collections.nCopies(beginingOfKeywordsPositions |
|
108 |
// .size(), nb)); |
|
109 |
// // for the first word = 1 |
|
110 |
// // for the last word = nb |
|
111 |
// |
|
112 |
// for (List<String> propVal : propVals) { |
|
113 |
// for (String str : propVal) { |
|
114 |
// // System.out.println("Next = "+str); |
|
115 |
// next = str; |
|
116 |
// } |
|
117 |
// } |
|
118 |
} |
|
119 |
|
|
120 |
} catch (CqiClientException e1) { |
|
121 |
org.txm.utils.logger.Log.printStackTrace(e1); |
|
122 |
} |
|
123 |
} |
|
124 |
return next; |
|
125 |
} |
|
126 |
|
|
127 |
|
|
128 |
/** |
|
129 |
* Gets the text region. |
|
130 |
* |
|
131 |
* @param unit the unit |
|
132 |
* @param property the property |
|
133 |
* @param value the value |
|
134 |
* @return the text region |
|
135 |
*/ |
|
136 |
public Pair<String, QueryResult> getTextRegion(MainCorpus corpus, StructuralUnit unit, |
|
137 |
StructuralUnitProperty property, String value) { |
|
138 |
Query query = new QueryPart(unit, property, value); |
|
139 |
System.out.println("GET REGION : " + value); |
|
140 |
|
|
141 |
String text = ""; |
|
142 |
|
|
143 |
if (property != null) { |
|
144 |
LinkedHashMap<String, Integer> counts; |
|
145 |
// List<Line> lines; |
|
146 |
int nLines; |
|
147 |
|
|
148 |
CqpDataProxy cache; |
|
149 |
try { |
|
150 |
cache = new CqpDataProxy(null, corpus.getProperty("word")); // TODO: not null |
|
151 |
} catch (CqiClientException e1) { |
|
152 |
org.txm.utils.logger.Log.printStackTrace(e1); |
|
153 |
return new Pair<String, QueryResult>( |
|
154 |
"error can't get word property", null); |
|
155 |
} |
|
156 |
|
|
157 |
// get the cqp result of the query |
|
158 |
QueryResult result; |
|
159 |
try { |
|
160 |
result = corpus.query(query, query.getQueryString().replace(" ", |
|
161 |
"_") |
|
162 |
+ "_parallel", false); |
|
163 |
nLines = result.getNMatch(); // get number of tokens |
|
164 |
System.out.println("nMatchs : " + nLines); |
|
165 |
// lines = new ArrayList<Line>(); |
|
166 |
|
|
167 |
List<Match> matches = null; |
|
168 |
if (nLines > 0) |
|
169 |
matches = result.getMatches(0, nLines - 1); // get the |
|
170 |
// indexes |
|
171 |
// sequences of |
|
172 |
// result's |
|
173 |
// tokens |
|
174 |
else |
|
175 |
matches = new ArrayList<Match>(); |
|
176 |
|
|
177 |
List<Integer> beginingOfKeywordsPositions = new ArrayList<Integer>(); |
|
178 |
List<Integer> lengthOfKeywords = new ArrayList<Integer>(); |
|
179 |
// keywordsViewPropValues = new HashMap<Property, |
|
180 |
// List<List<String>>>(); |
|
181 |
|
|
182 |
for (int j = 0; j < nLines; j++) { |
|
183 |
Match match = matches.get(j); |
|
184 |
beginingOfKeywordsPositions.add(match.getStart()); // get |
|
185 |
// the |
|
186 |
// first |
|
187 |
// index |
|
188 |
lengthOfKeywords.add(match.getEnd() - match.getStart() + 1);// get |
|
189 |
// the |
|
190 |
// last |
|
191 |
// index |
|
192 |
} |
|
193 |
|
|
194 |
List<List<String>> propVals = cache.getData( |
|
195 |
beginingOfKeywordsPositions, lengthOfKeywords); |
|
196 |
for (List<String> prop : propVals) { |
|
197 |
text += "\n\n"; |
|
198 |
for (String str : prop) { |
|
199 |
text += str + " "; |
|
200 |
// System.out.println("Region word = "+str); |
|
201 |
} |
|
202 |
} |
|
203 |
} catch (CqiClientException e) { |
|
204 |
org.txm.utils.logger.Log.printStackTrace(e); |
|
205 |
return new Pair<String, QueryResult>("error", null); |
|
206 |
} |
|
207 |
return new Pair<String, QueryResult>(LangFormater.format(text, corpus |
|
208 |
.getAttribute("lang")), result); |
|
209 |
} |
|
210 |
// return keywordsViewPropValues; |
|
211 |
return new Pair<String, QueryResult>("error no property", null); |
|
212 |
} |
|
213 |
|
|
214 |
|
|
215 |
@Override |
|
216 |
public String getName() { |
|
217 |
// TODO Auto-generated method stub |
|
218 |
return null; |
|
219 |
} |
|
220 |
|
|
221 |
|
|
222 |
@Override |
|
223 |
public String getSimpleName() { |
|
224 |
// TODO Auto-generated method stub |
|
225 |
return null; |
|
226 |
} |
|
227 |
|
|
228 |
|
|
229 |
@Override |
|
230 |
public String getDetails() { |
|
231 |
// TODO Auto-generated method stub |
|
232 |
return null; |
|
233 |
} |
|
234 |
|
|
235 |
|
|
236 |
@Override |
|
237 |
public void clean() { |
|
238 |
// TODO Auto-generated method stub |
|
239 |
|
|
240 |
} |
|
241 |
|
|
242 |
|
|
243 |
@Override |
|
244 |
public boolean compute(IProgressMonitor watcher) throws Exception { |
|
245 |
System.out.println("ParaBrower.compute() not implemented"); |
|
246 |
return false; |
|
247 |
} |
|
248 |
|
|
249 |
|
|
250 |
@Override |
|
251 |
public boolean toTxt(File outfile, String encoding, String colseparator, String txtseparator) throws Exception { |
|
252 |
// TODO Auto-generated method stub |
|
253 |
return false; |
|
254 |
} |
|
255 |
|
|
256 |
|
|
257 |
@Override |
|
258 |
public boolean setParameters(TXMParameters parameters) { |
|
259 |
return false; |
|
260 |
} |
|
261 |
} |
|
0 | 262 |
tmp/org.txm.para.core/src/org/txm/para/core/functions/package.html (revision 647) | ||
---|---|---|
1 |
<html> |
|
2 |
<body> |
|
3 |
<p>Prototype of aligned edition browser</p> |
|
4 |
</body> |
|
5 |
</html> |
|
0 | 6 |
tmp/org.txm.para.core/src/org/txm/para/core/functions/ParaCell.java (revision 647) | ||
---|---|---|
1 |
package org.txm.para.core.functions; |
|
2 |
|
|
3 |
public class ParaCell { |
|
4 |
public String CCG, CCD, CG, keyword, CD, ref; |
|
5 |
public ParaCell(String CCG, String CG, String keyword, String CD, String CCD, String ref) |
|
6 |
{ |
|
7 |
this.CCG = CCG; |
|
8 |
this.CG = CG; |
|
9 |
this.CD = CD; |
|
10 |
this.CCD = CCD; |
|
11 |
this.keyword = keyword; |
|
12 |
this.ref = ref; |
|
13 |
} |
|
14 |
/* (non-Javadoc) |
|
15 |
* @see java.lang.Object#toString() |
|
16 |
*/ |
|
17 |
@Override |
|
18 |
public String toString() { |
|
19 |
return ref + ": " + CCG + ">" + CG + "|" + keyword + "|" + CD + "<" + CCD; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ |
|
20 |
} |
|
21 |
} |
|
0 | 22 |
tmp/org.txm.core/src/java/org/txm/core/results/TXMResult.java (revision 647) | ||
---|---|---|
602 | 602 |
*/ |
603 | 603 |
public boolean autoSaveParametersFromAnnotations() throws Exception { |
604 | 604 |
|
605 |
System.out.println("TXMResult.autoSaveParametersFromAnnotations(): saving parameters to local node..."); |
|
606 |
|
|
605 | 607 |
List<Field> fields = this.getAllFields(); |
606 | 608 |
|
607 | 609 |
for (Field f : fields) { |
... | ... | |
703 | 705 |
f.set(this, value); |
704 | 706 |
|
705 | 707 |
// FIXME: Debug |
706 |
System.err.println("TXMResult.loadGenericParameters(): setting parameter " + key + " = " + value + " for " + this.getClass());
|
|
708 |
System.err.println("TXMResult.autoLoadParametersFromAnnotations(): setting parameter " + key + " = " + value + " for " + this.getClass());
|
|
707 | 709 |
|
708 | 710 |
} catch (Exception e) { |
709 | 711 |
e.printStackTrace(); |
tmp/org.txm.chartsengine.rcp/src/org/txm/chartsengine/rcp/editors/ChartEditor.java (revision 647) | ||
---|---|---|
209 | 209 |
// check that the charts engine used for the result matches the SWT components provider otherwise fin a suitable components provider |
210 | 210 |
if(this.getResult().getChartsEngine() != this.getSWTChartsComponentsProvider().getChartsEngine()) { |
211 | 211 |
this.getEditorInput().setSWTChartsComponentsProvider(SWTChartsComponentsProvider.getComponentsProvider(this.getResult().getChartsEngine())); |
212 |
//this.getSWTChartsComponentsProvider().setChartsEngine(this.getResult().getChartsEngine()); |
|
212 | 213 |
System.err.println("ChartEditor.__updateEditorFromResult(): charts engine used to create the chart is not the current one. The SWT components provider has been changed to match it: " + this.getSWTChartsComponentsProvider() + "."); |
213 | 214 |
|
214 | 215 |
// recreating the chart composite |
tmp/org.txm.partition.core/src/org/txm/partition/core/chartsengine/r/RPartitionDimensionsBarChartCreator.java (revision 647) | ||
---|---|---|
65 | 65 |
// colors |
66 | 66 |
this.getChartsEngine().setColors(result.getRenderingColorsMode(), 1); |
67 | 67 |
// FIXME: one color by part |
68 |
//this.getChartsEngine().setColors(TXMPreferences.getInt(preferencesNode, resultData, ChartsEnginePreferences.RENDERING_COLORS_MODE), parts.size());
|
|
68 |
//this.getChartsEngine().setColors(TXMPreferences.getInt(preferencesNode, result, ChartsEnginePreferences.RENDERING_COLORS_MODE), parts.size()); |
|
69 | 69 |
|
70 | 70 |
String ylab = PartitionCoreMessages.CHARTSENGINE_PARTITION_DIMENSIONS_Y_AXIS_LABEL; |
71 | 71 |
|
tmp/org.txm.progression.core/src/org/txm/progression/core/chartsengine/jfreechart/themes/highcharts/renderers/ProgressionItemSelectionRenderer.java (revision 647) | ||
---|---|---|
283 | 283 |
Property prop; |
284 | 284 |
|
285 | 285 |
// Ref |
286 |
prop = ((Progression)this.multipleItemsSelector.getResultData()).getCorpus().getProperty("ref"); //$NON-NLS-1$
|
|
286 |
prop = ((Progression)this.multipleItemsSelector.getResult()).getCorpus().getProperty("ref"); //$NON-NLS-1$ |
|
287 | 287 |
// Text id |
288 | 288 |
if(prop == null) { |
289 |
prop = ((Progression)this.multipleItemsSelector.getResultData()).getCorpus().getStructuralUnit("text").getProperty("id"); //$NON-NLS-1$ //$NON-NLS-2$
|
|
289 |
prop = ((Progression)this.multipleItemsSelector.getResult()).getCorpus().getStructuralUnit("text").getProperty("id"); //$NON-NLS-1$ //$NON-NLS-2$ |
|
290 | 290 |
} |
291 | 291 |
|
292 | 292 |
Match selectedWordMatch = new Match(globalPosition, globalPosition); |
tmp/org.txm.progression.core/src/org/txm/progression/core/chartsengine/jfreechart/JFCProgressionCumulativeChartCreator.java (revision 647) | ||
---|---|---|
102 | 102 |
|
103 | 103 |
|
104 | 104 |
((IRendererWithItemSelection) chart.getXYPlot().getRenderer()).setChartType(ChartsEngine.CHART_TYPE_PROGRESSION); |
105 |
((IRendererWithItemSelection) chart.getXYPlot().getRenderer()).getItemsSelector().setResultData(progression);
|
|
105 |
((IRendererWithItemSelection) chart.getXYPlot().getRenderer()).getItemsSelector().setResult(progression); |
|
106 | 106 |
|
107 | 107 |
|
108 | 108 |
return chart; |
tmp/org.txm.chartsengine.svgbatik.rcp/src/org/txm/chartsengine/svgbatik/rcp/swt/SVGComposite.java (revision 647) | ||
---|---|---|
4 | 4 |
import java.awt.EventQueue; |
5 | 5 |
import java.awt.Frame; |
6 | 6 |
import java.awt.Graphics2D; |
7 |
import java.awt.Panel; |
|
8 | 7 |
import java.awt.Toolkit; |
9 | 8 |
import java.awt.datatransfer.DataFlavor; |
10 | 9 |
import java.awt.datatransfer.Transferable; |
... | ... | |
127 | 126 |
|
128 | 127 |
@Override |
129 | 128 |
public void loadChart() { |
130 |
if(!this.chartEditor.getResult().isChartDirty()) { |
|
129 |
|
|
130 |
// loads the chart from the result |
|
131 |
Object chart = this.chartEditor.getChart(); |
|
132 |
|
|
133 |
if(chart != null) { |
|
131 | 134 |
// creates components if they not exist |
132 | 135 |
if(this.chartComponent == null) { |
133 | 136 |
|
137 |
// recreates the chart if not of right type |
|
138 |
if(!(chart instanceof File)) { |
|
139 |
try { |
|
140 |
this.chartEditor.getResult().clearLastRenderingParameters(); |
|
141 |
this.chartEditor.getResult().compute(); |
|
142 |
} |
|
143 |
catch (Exception e) { |
|
144 |
// TODO Auto-generated catch block |
|
145 |
e.printStackTrace(); |
|
146 |
} |
|
147 |
} |
|
148 |
|
|
149 |
|
|
134 | 150 |
this.chartEditor.getSWTChartsComponentsProvider().createChartContainer(this.chartEditor.getEditorInput()); |
135 | 151 |
this.chartComponent = (IChartComponent) this.chartEditor.getEditorInput().getChartContainer(); |
136 | 152 |
|
... | ... | |
138 | 154 |
|
139 | 155 |
this.frame.setVisible(true); |
140 | 156 |
} |
141 |
// loads the chart from the result |
|
142 |
Object chart = this.chartEditor.getEditorInput().getChart(); |
|
143 |
// recreates the chart if not of right type |
|
144 |
if(!(chart instanceof File)) { |
|
145 |
this.file = this.chartEditor.getSWTChartsComponentsProvider().getChartsEngine().getChartCreator(this.chartEditor.getResult()).createChartFile(this.chartEditor.getResult()); |
|
146 |
} |
|
147 |
else { |
|
148 |
this.file = (File) chart; |
|
149 |
} |
|
150 |
|
|
157 |
this.file = (File) chart; |
|
151 | 158 |
this.loadSVGDocument(this.file); |
152 | 159 |
} |
153 | 160 |
} |
tmp/org.txm.chartsengine.jfreechart.core/src/org/txm/chartsengine/jfreechart/core/renderers/MouseOverItemSelector.java (revision 647) | ||
---|---|---|
7 | 7 |
|
8 | 8 |
import org.jfree.chart.ChartPanel; |
9 | 9 |
import org.jfree.chart.event.RendererChangeEvent; |
10 |
import org.txm.chartsengine.core.results.ChartResult; |
|
10 | 11 |
import org.txm.chartsengine.jfreechart.core.renderers.interfaces.IRendererWithItemSelection; |
11 | 12 |
import org.txm.chartsengine.jfreechart.core.themes.highcharts.defaulttheme.renderers.ItemSelectionXYLineAndShapeRenderer; |
12 | 13 |
|
... | ... | |
53 | 54 |
protected int chartType; |
54 | 55 |
|
55 | 56 |
/** |
56 |
* User object result data linked to the chart.
|
|
57 |
* Linked chart result.
|
|
57 | 58 |
*/ |
58 |
protected Object resultData;
|
|
59 |
protected ChartResult result;
|
|
59 | 60 |
|
60 | 61 |
/** |
61 | 62 |
* The active state. |
... | ... | |
222 | 223 |
|
223 | 224 |
|
224 | 225 |
/** |
225 |
* @return the resultData |
|
226 |
* Gets the linked result. |
|
227 |
* @return the result |
|
226 | 228 |
*/ |
227 |
public Object getResultData() {
|
|
228 |
return resultData;
|
|
229 |
public ChartResult getResult() {
|
|
230 |
return result; |
|
229 | 231 |
} |
230 | 232 |
|
231 | 233 |
|
232 | 234 |
/** |
233 |
* @param resultData the resultData to set |
|
235 |
* Sets the linked result. |
|
236 |
* @param result the result to set |
|
234 | 237 |
*/ |
235 |
public void setResultData(Object resultData) {
|
|
236 |
this.resultData = resultData;
|
|
238 |
public void setResult(ChartResult result) {
|
|
239 |
this.result = result;
|
|
237 | 240 |
} |
238 | 241 |
|
239 | 242 |
|
tmp/org.txm.chartsengine.jfreechart.core/src/org/txm/chartsengine/jfreechart/core/JFCChartCreator.java (revision 647) | ||
---|---|---|
72 | 72 |
|
73 | 73 |
|
74 | 74 |
if(applyTheme) { |
75 |
this.getChartsEngine().getJFCTheme().applyThemeToChart(result, result.isMultipleLineStrokes());
|
|
75 |
this.getChartsEngine().getJFCTheme().applyThemeToChart(result); |
|
76 | 76 |
} |
77 | 77 |
|
78 | 78 |
chart.setNotify(true); |
... | ... | |
83 | 83 |
this.createChartFile(result, (File)result.getChart()); |
84 | 84 |
|
85 | 85 |
// FIXME: using new file |
86 |
//this.createChartFile(resultData, preferencesNode);
|
|
86 |
//this.createChartFile(result, preferencesNode); |
|
87 | 87 |
|
88 | 88 |
} |
89 | 89 |
|
tmp/org.txm.chartsengine.jfreechart.core/src/org/txm/chartsengine/jfreechart/core/themes/highcharts/defaulttheme/HighchartsDefaultTheme.java (revision 647) | ||
---|---|---|
32 | 32 |
import org.jfree.ui.RectangleInsets; |
33 | 33 |
import org.jfree.util.ShapeUtilities; |
34 | 34 |
import org.txm.chartsengine.core.ChartsEngine; |
35 |
import org.txm.chartsengine.core.preferences.ChartsEnginePreferences; |
|
36 | 35 |
import org.txm.chartsengine.core.results.ChartResult; |
37 | 36 |
import org.txm.chartsengine.jfreechart.core.JFCChartsEngine; |
38 | 37 |
import org.txm.chartsengine.jfreechart.core.renderers.XYCardinalSplineRenderer; |
... | ... | |
143 | 142 |
* (The theme can not be used with ChartFactory.setChartTheme() because of additional plot, renderer and chart settings according to the type of chart.) |
144 | 143 |
* @param chart |
145 | 144 |
*/ |
146 |
public void applyThemeToChart(ChartResult result, boolean applySeriesStrokes) {
|
|
145 |
public void applyThemeToChart(ChartResult result) { |
|
147 | 146 |
|
148 | 147 |
this.createFonts(result); |
149 | 148 |
|
... | ... | |
172 | 171 |
chart.setAntiAlias(antialiasing); |
173 | 172 |
chart.setTextAntiAlias(antialiasing); |
174 | 173 |
|
175 |
chart.getPlot().setNoDataMessage("Loading..."); |
|
174 |
chart.getPlot().setNoDataMessage("Loading chart...");
|
|
176 | 175 |
chart.getPlot().setInsets(new RectangleInsets(10, 10, 10, 10)); |
177 | 176 |
if(chart.getTitle() != null) { |
178 | 177 |
chart.getTitle().setMargin(10, 0, 0, 0); |
... | ... | |
203 | 202 |
LegendTitle legendTitle = chart.getLegend(0); |
204 | 203 |
|
205 | 204 |
|
206 |
// Series line width
|
|
207 |
if(applySeriesStrokes) {
|
|
205 |
// Series lines width and style
|
|
206 |
if(result.isMultipleLineStrokes()) {
|
|
208 | 207 |
this.applySeriesStrokes(plot); |
209 | 208 |
} |
210 | 209 |
else { |
... | ... | |
416 | 415 |
// Category Line chart |
417 | 416 |
else { |
418 | 417 |
|
419 |
// Series line width
|
|
420 |
if(applySeriesStrokes) {
|
|
418 |
// Series lines width and style
|
|
419 |
if(result.isMultipleLineStrokes()) {
|
|
421 | 420 |
this.applySeriesStrokes(plot); |
422 | 421 |
} |
423 | 422 |
else { |
... | ... | |
503 | 502 |
ArrayList<Color> palette = this.applySeriesPaint(plot, itemsColorsRenderingMode); |
504 | 503 |
|
505 | 504 |
|
506 |
// Series line width
|
|
507 |
if(applySeriesStrokes) {
|
|
505 |
// Series lines width and style
|
|
506 |
if(result.isMultipleLineStrokes()) {
|
|
508 | 507 |
this.applySeriesStrokes(plot); |
509 | 508 |
} |
510 | 509 |
|
tmp/org.txm.chartsengine.jfreechart.core/src/org/txm/chartsengine/jfreechart/core/themes/base/JFCTheme.java (revision 647) | ||
---|---|---|
125 | 125 |
/** |
126 | 126 |
* |
127 | 127 |
* @param chart |
128 |
* @param resultData
|
|
128 |
* @param result |
|
129 | 129 |
* @param preferencesNode |
130 | 130 |
* @param applySeriesStrokes |
131 | 131 |
*/ |
132 |
public void applyThemeToChart(ChartResult result, boolean applySeriesStrokes) {
|
|
132 |
public void applyThemeToChart(ChartResult result) { |
|
133 | 133 |
// FIXME |
134 | 134 |
} |
135 | 135 |
|
136 | 136 |
|
137 | 137 |
|
138 | 138 |
/** |
139 |
* |
|
140 |
* @param chart |
|
141 |
* @param result |
|
142 |
* @param preferencesNode |
|
143 |
*/ |
|
144 |
public void applyThemeToChart(ChartResult result) { |
|
145 |
this.applyThemeToChart(result, false); |
|
146 |
} |
|
147 |
|
|
148 |
/** |
|
149 | 139 |
* Creates fonts from the charts engine preferences current font. |
150 | 140 |
*/ |
151 |
protected void createFonts(ChartResult result) {
|
|
141 |
public void createFonts(ChartResult result) {
|
|
152 | 142 |
|
153 | 143 |
Font baseFont = ChartsEngine.createFont(result.getFont()); |
154 | 144 |
|
tmp/org.txm.ca.rcp/src/org/txm/ca/rcp/editors/CAEditor.java (revision 647) | ||
---|---|---|
329 | 329 |
public void initCAFactorialMapEditor() { |
330 | 330 |
|
331 | 331 |
// Editor part |
332 |
ChartEditor caFactorialMapEditorPart = new CAFactorialMapChartEditor(new ChartEditorInput(ca)); |
|
332 |
ChartEditor caFactorialMapEditorPart = new CAFactorialMapChartEditor(new ChartEditorInput<CA>(ca));
|
|
333 | 333 |
editors.add(caFactorialMapEditorPart); |
334 | 334 |
|
335 | 335 |
// Editor input |
... | ... | |
342 | 342 |
*/ |
343 | 343 |
public void initCASingularValuesBarChartEditor() { |
344 | 344 |
|
345 |
// Restores or creates new Eigen values result
|
|
345 |
// Restores or creates new Eigenvalues result |
|
346 | 346 |
Eigenvalues eigenvalues = (Eigenvalues) ca.getFirstChild(); |
347 | 347 |
if(eigenvalues == null) { |
348 | 348 |
eigenvalues = new Eigenvalues(ca); |
349 | 349 |
} |
350 | 350 |
|
351 | 351 |
// Editor part |
352 |
ChartEditor caSingularValuesEditorPart = new ChartEditor(SWTChartsComponentsProvider.getCurrent().createChartEditorInput(eigenvalues));
|
|
353 |
caSingularValuesEditorPart.compute(false);
|
|
354 |
editors.add(caSingularValuesEditorPart);
|
|
352 |
EigenvaluesChartEditor eigenvaluesEditor = new EigenvaluesChartEditor(SWTChartsComponentsProvider.getCurrent().createChartEditorInput(eigenvalues));
|
|
353 |
eigenvaluesEditor.compute(false);
|
|
354 |
editors.add(eigenvaluesEditor);
|
|
355 | 355 |
|
356 | 356 |
// Editor input |
357 |
inputs.add(caSingularValuesEditorPart.getEditorInput());
|
|
357 |
inputs.add(eigenvaluesEditor.getEditorInput());
|
|
358 | 358 |
} |
359 | 359 |
|
360 | 360 |
/** |
tmp/org.txm.ca.rcp/src/org/txm/ca/rcp/editors/CAFactorialMapChartEditor.java (revision 647) | ||
---|---|---|
70 | 70 |
@Override |
71 | 71 |
public void _createPartControl(Composite parent) { |
72 | 72 |
|
73 |
// super.createPartControl(parent); |
|
74 |
|
|
75 | 73 |
// Extend the chart editor tool bar |
76 | 74 |
ToolItem separator = new ToolItem(this.topToolBar, SWT.SEPARATOR); |
77 | 75 |
|
tmp/org.txm.ca.rcp/src/org/txm/ca/rcp/editors/EigenvaluesChartEditor.java (revision 647) | ||
---|---|---|
1 |
/** |
|
2 |
* |
|
3 |
*/ |
|
4 |
package org.txm.ca.rcp.editors; |
|
5 |
|
|
6 |
import org.eclipse.swt.widgets.Composite; |
|
7 |
import org.txm.ca.core.functions.Eigenvalues; |
|
8 |
import org.txm.chartsengine.rcp.editors.ChartEditor; |
|
9 |
import org.txm.chartsengine.rcp.editors.ChartEditorInput; |
|
10 |
|
|
11 |
/** |
|
12 |
* |
|
13 |
* Eigenvalues chart editor. |
|
14 |
* |
|
15 |
* @author sjacquot |
|
16 |
* |
|
17 |
*/ |
|
18 |
public class EigenvaluesChartEditor extends ChartEditor<Eigenvalues> { |
|
19 |
|
|
20 |
/** |
|
21 |
* |
|
22 |
* @param createChartEditorInput |
|
23 |
*/ |
|
24 |
public EigenvaluesChartEditor(ChartEditorInput chartEditorInput) { |
|
25 |
super(chartEditorInput); |
|
26 |
} |
|
27 |
|
|
28 |
@Override |
|
29 |
public void _createPartControl(Composite parent) { |
|
30 |
// TODO Auto-generated method stub |
|
31 |
|
|
32 |
} |
|
33 |
|
|
34 |
} |
|
0 | 35 |
tmp/org.txm.ca.rcp/plugin.xml (revision 647) | ||
---|---|---|
104 | 104 |
id="org.txm.ca.rcp.editors.CAFactorialMapChartEditor" |
105 | 105 |
name="CA Factorial Map editor"> |
106 | 106 |
</editor> |
107 |
<editor |
|
108 |
class="org.txm.ca.rcp.editors.EigenvaluesChartEditor" |
|
109 |
default="false" |
|
110 |
id="org.txm.ca.rcp.editors.EigenvaluesChartEditor" |
|
111 |
name="Eigenvalues"> |
|
112 |
</editor> |
|
107 | 113 |
</extension> |
108 | 114 |
<extension |
109 | 115 |
point="org.eclipse.core.runtime.adapters"> |
tmp/org.txm.chartsengine.jfreechart.rcp/src/org/txm/chartsengine/jfreechart/rcp/events/DefaultChartMouseListener.java (revision 647) | ||
---|---|---|
19 | 19 |
import org.jfree.chart.plot.XYPlot; |
20 | 20 |
import org.jfree.data.category.CategoryDataset; |
21 | 21 |
import org.jfree.data.xy.XYSeriesCollection; |
22 |
import org.txm.ca.core.chartsengine.jfreechart.datasets.FCAXYDataset;
|
|
22 |
import org.txm.ca.core.chartsengine.jfreechart.datasets.CAXYDataset; |
|
23 | 23 |
import org.txm.chartsengine.jfreechart.core.renderers.MultipleItemsSelector; |
24 | 24 |
import org.txm.chartsengine.jfreechart.core.renderers.interfaces.IRendererWithItemSelection; |
25 | 25 |
import org.txm.chartsengine.rcp.IChartComponent; |
... | ... | |
169 | 169 |
menuText += (String)((SymbolAxis) ((XYPlot) plot).getDomainAxis()).getSymbols()[selectedItems[j]] + "\n"; |
170 | 170 |
} |
171 | 171 |
// CA |
172 |
else if(itemEntity.getDataset() instanceof FCAXYDataset) {
|
|
173 |
menuText += ((FCAXYDataset) ((XYPlot)plot).getDataset()).getLabel(selectedSeries, selectedItems[j]);
|
|
172 |
else if(itemEntity.getDataset() instanceof CAXYDataset) { |
|
173 |
menuText += ((CAXYDataset) ((XYPlot)plot).getDataset()).getLabel(selectedSeries, selectedItems[j]); |
|
174 | 174 |
} |
175 | 175 |
// Progression |
176 | 176 |
else if(itemEntity.getDataset() instanceof XYSeriesCollection) { |
tmp/org.txm.chartsengine.jfreechart.rcp/src/org/txm/chartsengine/jfreechart/rcp/themes/base/swing/ItemSelectionJFCChartPanel.java (revision 647) | ||
---|---|---|
177 | 177 |
|
178 | 178 |
// FIXME: this code must be moved to the CA plugin |
179 | 179 |
// FCA |
180 |
// if(((XYPlot)plot).getRenderer() instanceof FCAItemSelectionRenderer) {
|
|
180 |
// if(((XYPlot)plot).getRenderer() instanceof CAItemSelectionRenderer) { |
|
181 | 181 |
// |
182 | 182 |
// // Axis unit square ratio constraint |
183 | 183 |
// this.squareOffGraph(); |
tmp/org.txm.chartsengine.jfreechart.rcp/src/org/txm/chartsengine/jfreechart/rcp/swt/JFCComposite.java (revision 647) | ||
---|---|---|
288 | 288 |
// loads the chart from the result |
289 | 289 |
Object chart = this.chartEditor.getChart(); |
290 | 290 |
|
291 |
//FIXME: old version |
|
292 |
//if(!this.chartEditor.getResultData().isChartDirty()) { |
|
293 |
if(chart != null) { |
|
291 |
if(chart != null) { |
|
294 | 292 |
// creates components if they not exist |
295 |
if(this.chartComponent == null) {
|
|
293 |
if(this.chartComponent == null) {
|
|
296 | 294 |
|
297 | 295 |
// recreates the chart if not of right type |
298 | 296 |
if(!(chart instanceof JFreeChart)) { |
... | ... | |
313 | 311 |
|
314 | 312 |
this.frame.setVisible(true); |
315 | 313 |
} |
316 |
|
|
317 |
// recreates the chart if not of right type |
|
318 |
// FIXME: does not work? step to reproduce : create a chart with R/SVG, close the editor, select JFC/Java2d as chart engine, double click on the result |
|
319 |
// if(!(chart instanceof JFreeChart)) { |
|
320 |
// this.loadChart(this.chartEditor.getSWTChartsComponentsProvider().getChartsEngine().getChartCreator(this.chartEditor.getResult()).createChart(this.chartEditor.getResult())); |
|
321 |
// } |
|
322 |
// else { |
|
323 |
this.loadChart(this.chartEditor.getChart()); |
|
324 |
// } |
|
325 |
|
|
314 |
this.loadChart(this.chartEditor.getChart()); |
|
326 | 315 |
this.forceFocus(); |
327 | 316 |
} |
328 | 317 |
} |
tmp/org.txm.ca.core/src/org/txm/ca/core/functions/CA.java (revision 647) | ||
---|---|---|
160 | 160 |
this.cex = Math.abs(cex); |
161 | 161 |
if (col.matches(pattern)) { |
162 | 162 |
this.colfilter = col; |
163 |
} else { |
|
163 |
} |
|
164 |
else { |
|
164 | 165 |
System.out.println("Col filter malformed follow this pattern " + pattern); |
165 | 166 |
} |
166 | 167 |
|
167 | 168 |
if (row.matches(pattern)) { |
168 | 169 |
this.rowfilter = row; |
169 |
} else { |
|
170 |
} |
|
171 |
else { |
|
170 | 172 |
System.out.println("Row filter malformed follow this pattern " + pattern); |
171 | 173 |
} |
172 | 174 |
} |
... | ... | |
197 | 199 |
for (int i = 0 ; i < infos.length ; i++) { |
198 | 200 |
List<Object> list = (List<Object>) infos[i]; |
199 | 201 |
writer.write(textseparator + list.get(0) + textseparator + colseparator); |
200 |
for (int j = 1 ; j < list.size() ; j++) |
|
202 |
for (int j = 1 ; j < list.size() ; j++) {
|
|
201 | 203 |
writer.write(list.get(j) + colseparator); |
204 |
} |
|
202 | 205 |
writer.write("\n"); //$NON-NLS-1$ |
203 | 206 |
} |
204 | 207 |
writer.flush(); |
... | ... | |
580 | 583 |
* @throws StatException the stat exception |
581 | 584 |
*/ |
582 | 585 |
public String[] getRowNames() throws StatException { |
583 |
if (rownames == null) |
|
586 |
if (rownames == null) {
|
|
584 | 587 |
rownames = getLexicalTable().getRowNames().asStringsArray(); |
588 |
} |
|
585 | 589 |
return rownames; |
586 | 590 |
} |
587 | 591 |
|
tmp/org.txm.ca.core/src/org/txm/ca/core/chartsengine/jfreechart/themes/highcharts/renderers/FCAItemSelectionRenderer.java (revision 647) | ||
---|---|---|
1 |
package org.txm.ca.core.chartsengine.jfreechart.themes.highcharts.renderers; |
|
2 |
|
|
3 |
import java.awt.Color; |
|
4 |
import java.awt.Font; |
|
5 |
import java.awt.Graphics2D; |
|
6 |
import java.awt.Paint; |
|
7 |
import java.awt.Shape; |
|
8 |
import java.awt.font.GlyphVector; |
|
9 |
import java.awt.geom.AffineTransform; |
|
10 |
import java.awt.geom.Area; |
|
11 |
import java.awt.geom.Rectangle2D; |
|
12 |
import java.awt.geom.RoundRectangle2D; |
|
13 |
import java.text.DecimalFormat; |
|
14 |
import java.util.ArrayList; |
|
15 |
|
|
16 |
import org.jfree.chart.labels.XYItemLabelGenerator; |
|
17 |
import org.jfree.chart.labels.XYToolTipGenerator; |
|
18 |
import org.jfree.data.xy.XYDataset; |
Formats disponibles : Unified diff