Révision 230
tmp/org.txm.chartsengine.jfreechart.core/META-INF/MANIFEST.MF (revision 230) | ||
---|---|---|
3 | 3 |
Bundle-Name: JFreeChart Charts Engine Core |
4 | 4 |
Bundle-SymbolicName: org.txm.chartsengine.jfreechart.core;singleton:=true |
5 | 5 |
Bundle-Version: 1.0.0.qualifier |
6 |
Require-Bundle: jfreechart;bundle-version="1.0.17";visibility:=reexport, |
|
6 |
Require-Bundle: org.txm.libs.itext, |
|
7 |
jfreechart;bundle-version="1.0.17";visibility:=reexport, |
|
7 | 8 |
org.eclipse.core.runtime, |
8 | 9 |
org.txm.chartsengine.core;bundle-version="1.0.0";visibility:=reexport, |
9 | 10 |
org.txm.core |
tmp/org.txm.chartsengine.jfreechart.core/src/org/txm/chartsengine/jfreechart/core/JFCChartCreator.java (revision 230) | ||
---|---|---|
10 | 10 |
import org.txm.chartsengine.core.ChartCreator; |
11 | 11 |
import org.txm.chartsengine.core.preferences.ChartsEnginePreferences; |
12 | 12 |
import org.txm.core.preferences.TXMPreferences; |
13 |
import org.txm.core.results.ITXMResult; |
|
13 | 14 |
|
14 | 15 |
|
15 | 16 |
|
... | ... | |
30 | 31 |
|
31 | 32 |
|
32 | 33 |
@Override |
33 |
public void updateChart(Object chart, Object resultData, String preferencesNode) {
|
|
34 |
this.updateChart(chart, resultData, preferencesNode, true);
|
|
34 |
public void updateChart(Object chart, ITXMResult result, String preferencesNode) {
|
|
35 |
this.updateChart(chart, result, preferencesNode, true); |
|
35 | 36 |
} |
36 | 37 |
|
37 | 38 |
|
38 | 39 |
/** |
39 | 40 |
* |
40 | 41 |
* @param chart |
41 |
* @param resultData
|
|
42 |
* @param result |
|
42 | 43 |
* @param preferencesNode |
43 | 44 |
* @param applyTheme |
44 | 45 |
*/ |
45 |
public void updateChart(Object chart, Object resultData, String preferencesNode, boolean applyTheme) {
|
|
46 |
public void updateChart(Object chart, ITXMResult result, String preferencesNode, boolean applyTheme) {
|
|
46 | 47 |
|
47 | 48 |
// Java object |
48 | 49 |
if(chart instanceof JFreeChart) { |
49 | 50 |
JFreeChart c = (JFreeChart) chart; |
51 |
|
|
52 |
// freeze rendering |
|
53 |
c.setNotify(false); |
|
54 |
|
|
55 |
|
|
50 | 56 |
if(c.getTitle() != null) { |
51 |
c.getTitle().setVisible(TXMPreferences.getBoolean(preferencesNode, resultData, ChartsEnginePreferences.SHOW_TITLE));
|
|
57 |
c.getTitle().setVisible(TXMPreferences.getBoolean(preferencesNode, result, ChartsEnginePreferences.SHOW_TITLE)); |
|
52 | 58 |
} |
53 | 59 |
if(c.getLegend() != null) { |
54 |
c.getLegend().setVisible(TXMPreferences.getBoolean(preferencesNode, resultData, ChartsEnginePreferences.SHOW_LEGEND));
|
|
60 |
c.getLegend().setVisible(TXMPreferences.getBoolean(preferencesNode, result, ChartsEnginePreferences.SHOW_LEGEND)); |
|
55 | 61 |
} |
56 | 62 |
|
57 | 63 |
// CategoryPlot |
58 | 64 |
if(c.getPlot() instanceof CategoryPlot) { |
59 | 65 |
CategoryPlot plot = (CategoryPlot) c.getPlot(); |
60 |
plot.setDomainGridlinesVisible(TXMPreferences.getBoolean(preferencesNode, resultData, ChartsEnginePreferences.SHOW_GRID));
|
|
61 |
plot.setRangeGridlinesVisible(TXMPreferences.getBoolean(preferencesNode, resultData, ChartsEnginePreferences.SHOW_GRID));
|
|
66 |
plot.setDomainGridlinesVisible(TXMPreferences.getBoolean(preferencesNode, result, ChartsEnginePreferences.SHOW_GRID)); |
|
67 |
plot.setRangeGridlinesVisible(TXMPreferences.getBoolean(preferencesNode, result, ChartsEnginePreferences.SHOW_GRID)); |
|
62 | 68 |
} |
63 | 69 |
// XYPlot |
64 | 70 |
else if(c.getPlot() instanceof XYPlot) { |
65 | 71 |
XYPlot plot = (XYPlot) c.getPlot(); |
66 |
plot.setRangeGridlinesVisible(TXMPreferences.getBoolean(preferencesNode, resultData, ChartsEnginePreferences.SHOW_GRID));
|
|
67 |
plot.setDomainGridlinesVisible(TXMPreferences.getBoolean(preferencesNode, resultData, ChartsEnginePreferences.SHOW_GRID));
|
|
72 |
plot.setRangeGridlinesVisible(TXMPreferences.getBoolean(preferencesNode, result, ChartsEnginePreferences.SHOW_GRID)); |
|
73 |
plot.setDomainGridlinesVisible(TXMPreferences.getBoolean(preferencesNode, result, ChartsEnginePreferences.SHOW_GRID)); |
|
68 | 74 |
} |
69 | 75 |
|
70 | 76 |
if(applyTheme) { |
71 |
this.getChartsEngine().getJFCTheme().applyThemeToChart(c, TXMPreferences.getInt(preferencesNode, resultData, ChartsEnginePreferences.RENDERING_COLORS_MODE));
|
|
77 |
this.getChartsEngine().getJFCTheme().applyThemeToChart(c, result, preferencesNode, false);
|
|
72 | 78 |
} |
73 | 79 |
|
74 |
|
|
80 |
c.setNotify(true); |
|
75 | 81 |
} |
76 | 82 |
// File |
77 | 83 |
else if(chart instanceof File) { |
78 | 84 |
// creates a new chart but using the same file |
79 |
this.createChartFile(resultData, (File)chart, preferencesNode);
|
|
85 |
this.createChartFile(result, (File)chart, preferencesNode); |
|
80 | 86 |
|
81 | 87 |
// FIXME: using new file |
82 | 88 |
//this.createChartFile(resultData, preferencesNode); |
... | ... | |
116 | 122 |
} |
117 | 123 |
|
118 | 124 |
/** |
119 |
* |
|
120 |
* @return |
|
125 |
* Convenience method.
|
|
126 |
* @return the casted charts engine.
|
|
121 | 127 |
*/ |
122 | 128 |
protected JFCChartsEngine getChartsEngine() { |
123 | 129 |
return (JFCChartsEngine) this.chartsEngine; |
tmp/org.txm.chartsengine.jfreechart.core/src/org/txm/chartsengine/jfreechart/core/themes/base/JFCTheme.java (revision 230) | ||
---|---|---|
32 | 32 |
import org.jfree.chart.renderer.xy.XYSplineRenderer; |
33 | 33 |
import org.jfree.chart.renderer.xy.XYStepRenderer; |
34 | 34 |
import org.jfree.chart.title.LegendTitle; |
35 |
import org.txm.chartsengine.core.ChartsEngine; |
|
36 |
import org.txm.chartsengine.core.preferences.ChartsEnginePreferences; |
|
35 | 37 |
import org.txm.chartsengine.jfreechart.core.JFCChartsEngine; |
36 | 38 |
import org.txm.chartsengine.jfreechart.core.renderers.XYCardinalSplineRenderer; |
39 |
import org.txm.core.preferences.TXMPreferences; |
|
37 | 40 |
|
38 | 41 |
public class JFCTheme extends StandardChartTheme { |
39 | 42 |
|
... | ... | |
106 | 109 |
|
107 | 110 |
|
108 | 111 |
|
112 |
|
|
109 | 113 |
/** |
110 | 114 |
* |
111 | 115 |
* @param chartsEngine |
... | ... | |
118 | 122 |
|
119 | 123 |
|
120 | 124 |
/** |
121 |
* |
|
125 |
*
|
|
122 | 126 |
* @param chart |
123 |
* @param grayscale |
|
127 |
* @param resultData |
|
128 |
* @param preferencesNode |
|
129 |
* @param applySeriesStrokes |
|
124 | 130 |
*/ |
125 |
public void applyThemeToChart(JFreeChart chart, int itemsColorsRenderingMode, boolean applySeriesStrokes) {
|
|
131 |
public void applyThemeToChart(JFreeChart chart, Object resultData, String preferencesNode, boolean applySeriesStrokes) {
|
|
126 | 132 |
// FIXME |
127 | 133 |
} |
128 | 134 |
|
129 | 135 |
|
130 | 136 |
|
131 | 137 |
/** |
132 |
* ITEMS_RENDERING_COLORS_MODE = 0, ITEMS_RENDERING_GRAYSCALE_MODE = 1, ITEMS_RENDERING_MONOCHROME_MODE = 2
|
|
138 |
* |
|
133 | 139 |
* @param chart |
134 |
* @param itemsColorsRenderingMode |
|
140 |
* @param resultData |
|
141 |
* @param preferencesNode |
|
135 | 142 |
*/ |
136 |
public void applyThemeToChart(JFreeChart chart, int itemsColorsRenderingMode) {
|
|
137 |
this.applyThemeToChart(chart, itemsColorsRenderingMode, false);
|
|
143 |
public void applyThemeToChart(JFreeChart chart, Object resultData, String preferencesNode) {
|
|
144 |
this.applyThemeToChart(chart, resultData, preferencesNode, false);
|
|
138 | 145 |
} |
139 | 146 |
|
140 |
|
|
141 | 147 |
/** |
142 |
* |
|
143 |
* @param legendTitle |
|
144 |
* @param overrideShapes |
|
145 |
* @param palette |
|
148 |
* Creates fonts from the charts engine preferences current font. |
|
146 | 149 |
*/ |
147 |
@Deprecated |
|
148 |
public void applyLegendDefaultSettings(LegendTitle legendTitle, boolean overrideShapes, ArrayList<Color> palette) { |
|
149 |
this.applyLegendDefaultSettings(legendTitle, overrideShapes, true, palette); |
|
150 |
} |
|
150 |
protected void createFonts(Object resultData, String preferencesNode) { |
|
151 |
|
|
152 |
Font baseFont = ChartsEngine.createFont(TXMPreferences.getString(preferencesNode, resultData, ChartsEnginePreferences.FONT)); |
|
153 |
|
|
154 |
// Titles |
|
155 |
this.setExtraLargeFont(baseFont.deriveFont(Font.BOLD, baseFont.getSize() + 5)); |
|
156 |
|
|
157 |
// Axis |
|
158 |
this.setLargeFont(baseFont.deriveFont(Font.BOLD, baseFont.getSize() + 4)); // axis labels |
|
151 | 159 |
|
160 |
// FIXME: use for what chart items? maybe annotations? |
|
161 |
this.setSmallFont(baseFont.deriveFont(Font.BOLD, this.getExtraLargeFont().getSize() - 1)); |
|
162 |
|
|
163 |
// Item labels, legend labels, axis ticks labels |
|
164 |
this.regularFont = baseFont.deriveFont(Font.BOLD, baseFont.getSize()); |
|
165 |
this.setRegularFont(this.regularFont); |
|
166 |
|
|
167 |
} |
|
168 |
|
|
152 | 169 |
/** |
153 | 170 |
* Disables outline shape paint and sets the new shapes. |
154 | 171 |
* @param legendTitle |
155 | 172 |
* @param legendLabelsBaseFont |
156 | 173 |
* @param overrideShapes |
174 |
* @param palette |
|
157 | 175 |
*/ |
158 |
@Deprecated |
|
159 | 176 |
public void applyLegendDefaultSettings(LegendTitle legendTitle, boolean overrideShapes, boolean linesVisible, ArrayList<Color> palette) { |
160 | 177 |
|
161 | 178 |
if(legendTitle != null) { |
... | ... | |
246 | 263 |
} |
247 | 264 |
|
248 | 265 |
/** |
249 |
* Creates a FCA map chart renderer. |
|
250 |
* @return |
|
251 |
*/ |
|
252 |
public XYLineAndShapeRenderer createFCARenderer() { |
|
253 |
return new XYLineAndShapeRenderer(false, true); |
|
254 |
} |
|
255 |
|
|
256 |
|
|
257 |
/** |
|
258 |
* Creates a Progression chart renderer. |
|
259 |
* @return |
|
260 |
*/ |
|
261 |
public XYStepRenderer createProgressionRenderer() { |
|
262 |
return new XYStepRenderer(); |
|
263 |
} |
|
264 |
|
|
265 |
|
|
266 |
/** |
|
267 |
* Creates a CA singular values bar chart renderer. |
|
268 |
* @return |
|
269 |
*/ |
|
270 |
public BarRenderer createCASingularValuesRenderer() { |
|
271 |
return this.createCategoryBarRenderer(); |
|
272 |
} |
|
273 |
|
|
274 |
|
|
275 |
/** |
|
276 | 266 |
* Creates an XY chart line and shape renderer. |
277 | 267 |
* @param linesVisible |
278 | 268 |
* @param shapesVisible |
tmp/org.txm.chartsengine.jfreechart.core/src/org/txm/chartsengine/jfreechart/core/themes/highcharts/defaulttheme/HighchartsDefaultTheme.java (revision 230) | ||
---|---|---|
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; |
|
35 | 36 |
import org.txm.chartsengine.jfreechart.core.JFCChartsEngine; |
36 | 37 |
import org.txm.chartsengine.jfreechart.core.renderers.XYCardinalSplineRenderer; |
37 | 38 |
import org.txm.chartsengine.jfreechart.core.renderers.interfaces.IRendererWithItemSelection; |
... | ... | |
46 | 47 |
import org.txm.chartsengine.jfreechart.core.themes.highcharts.defaulttheme.renderers.ItemSelectionXYLineAndShapeRenderer; |
47 | 48 |
import org.txm.chartsengine.jfreechart.core.themes.highcharts.defaulttheme.renderers.ItemSelectionXYSplineRenderer; |
48 | 49 |
import org.txm.chartsengine.jfreechart.core.themes.highcharts.defaulttheme.renderers.ItemSelectionXYStepRenderer; |
50 |
import org.txm.core.preferences.TXMPreferences; |
|
49 | 51 |
|
50 | 52 |
/** |
51 | 53 |
* Highcharts GWT library default rendering theme. |
... | ... | |
66 | 68 |
|
67 | 69 |
|
68 | 70 |
// Title |
69 |
this.setExtraLargeFont(new Font(baseFontName, Font.BOLD, 16 + fontsPointsToAdd)); |
|
70 | 71 |
this.setTitlePaint(Color.decode("#4B4B6D")); |
71 | 72 |
|
72 | 73 |
// Axis |
73 |
this.setLargeFont(new Font(baseFontName, Font.BOLD, 15 + fontsPointsToAdd)); // axis labels |
|
74 | 74 |
this.setAxisLabelPaint(Color.decode("#4D759E")); |
75 | 75 |
this.setAxisOffset(new RectangleInsets(0, 0, 0, 0)); |
76 | 76 |
|
... | ... | |
87 | 87 |
// Legends |
88 | 88 |
this.setLegendItemPaint(Color.decode("#274B6D")); |
89 | 89 |
|
90 |
// Item labels, legend labels |
|
91 |
this.regularFont = new Font(baseFontName, Font.PLAIN, 11 + fontsPointsToAdd); |
|
92 |
this.setRegularFont(regularFont); |
|
93 | 90 |
|
94 | 91 |
this.setPlotBackgroundPaint(Color.white); |
95 | 92 |
this.setTickLabelPaint(Color.decode("#666666")); |
... | ... | |
142 | 139 |
|
143 | 140 |
|
144 | 141 |
/** |
145 |
* |
|
146 |
* @param chart |
|
147 |
* @param chartType |
|
148 |
*/ |
|
149 |
public void apply(JFreeChart chart, int itemsColorsRenderingMode) { |
|
150 |
this.applyThemeToChart(chart, itemsColorsRenderingMode); |
|
151 |
} |
|
152 |
|
|
153 |
|
|
154 |
|
|
155 |
|
|
156 |
/** |
|
157 | 142 |
* Applies this theme to the specified chart. Modifies plot and renderer too. |
158 | 143 |
* (The theme can not be used with ChartFactory.setChartTheme() because of additional plot, renderer and chart settings according to the type of chart.) |
159 | 144 |
* @param chart |
160 | 145 |
*/ |
161 |
public void applyThemeToChart(JFreeChart chart, int itemsColorsRenderingMode, boolean applySeriesStrokes) {
|
|
146 |
public void applyThemeToChart(JFreeChart chart, Object resultData, String preferencesNode, boolean applySeriesStrokes) {
|
|
162 | 147 |
|
148 |
this.createFonts(resultData, preferencesNode); |
|
149 |
|
|
150 |
|
|
163 | 151 |
super.apply(chart); |
164 | 152 |
|
165 | 153 |
|
166 |
|
|
154 |
|
|
155 |
int itemsColorsRenderingMode = TXMPreferences.getInt(preferencesNode, resultData, ChartsEnginePreferences.RENDERING_COLORS_MODE); |
|
156 |
|
|
167 | 157 |
// FIXME : UI settings |
168 | 158 |
// UIManager.put("ToolTip.background", Color.gray); |
169 | 159 |
// Border border = BorderFactory.cr |
... | ... | |
181 | 171 |
chart.setAntiAlias(antialiasing); |
182 | 172 |
chart.setTextAntiAlias(antialiasing); |
183 | 173 |
|
184 |
chart.getPlot().setNoDataMessage("NO DATA");
|
|
174 |
chart.getPlot().setNoDataMessage("Loading...");
|
|
185 | 175 |
chart.getPlot().setInsets(new RectangleInsets(10, 10, 10, 10)); |
186 | 176 |
chart.getTitle().setMargin(10, 0, 0, 0); |
187 | 177 |
|
tmp/org.txm.chartsengine.jfreechart.core/src/org/txm/chartsengine/jfreechart/core/JFCChartsEngine.java (revision 230) | ||
---|---|---|
1431 | 1431 |
* @param width |
1432 | 1432 |
* @param height |
1433 | 1433 |
*/ |
1434 |
public void squareOffGraph(JFreeChart chart, double width, double height) {
|
|
1434 |
public void squareOffGraph(Object c, double width, double height) {
|
|
1435 | 1435 |
|
1436 |
JFreeChart chart = (JFreeChart) c; |
|
1437 |
|
|
1436 | 1438 |
if(chart.getPlot() instanceof XYPlot) { |
1437 | 1439 |
|
1438 | 1440 |
XYPlot plot = (XYPlot)chart.getPlot(); |
tmp/org.txm.wordcloud.core/src/org/txm/wordcloud/core/functions/WordCloud.java (revision 230) | ||
---|---|---|
5 | 5 |
import java.util.ArrayList; |
6 | 6 |
import java.util.List; |
7 | 7 |
|
8 |
import org.txm.HasResults;
|
|
8 |
import org.txm.chartsengine.core.results.IChartResult;
|
|
9 | 9 |
import org.txm.core.preferences.TXMPreferences; |
10 | 10 |
import org.txm.functions.Function; |
11 |
import org.txm.functions.TXMResult; |
|
12 | 11 |
import org.txm.index.core.functions.Index; |
13 | 12 |
import org.txm.index.core.functions.Line; |
14 | 13 |
import org.txm.searchengine.cqp.clientExceptions.CqiClientException; |
... | ... | |
23 | 22 |
import org.txm.wordcloud.core.messages.TBXWordCloudMessages; |
24 | 23 |
import org.txm.wordcloud.core.preferences.WordCloudPreferences; |
25 | 24 |
|
26 |
public class WordCloud extends Function implements TXMResult { |
|
25 |
/** |
|
26 |
* Word cloud. |
|
27 |
* |
|
28 |
* @author mdecorde |
|
29 |
* @author sjacquot |
|
30 |
* |
|
31 |
*/ |
|
32 |
public class WordCloud extends Function implements IChartResult { |
|
27 | 33 |
|
28 | 34 |
//TODO: test rw.setStringEncoding("UTF-8"); // or connection |
29 | 35 |
private int[] freqs; |
30 | 36 |
private String[] labels; |
31 |
private Corpus corpus; |
|
32 | 37 |
private Object source; |
33 | 38 |
|
39 |
/** |
|
40 |
* |
|
41 |
* @param lex |
|
42 |
*/ |
|
34 | 43 |
public WordCloud(Lexicon lex) { |
35 | 44 |
//List<Line> lines = voc.getAllLines(); |
36 |
corpus = lex.getCorpus();
|
|
45 |
super(lex);
|
|
37 | 46 |
source = lex; |
38 | 47 |
this.freqs = lex.getFreq(); |
39 | 48 |
this.labels = lex.getForms(); |
... | ... | |
57 | 66 |
* @param voc |
58 | 67 |
*/ |
59 | 68 |
public WordCloud(Index voc) { |
69 |
super(voc); |
|
60 | 70 |
initWith(voc); |
61 | 71 |
//removeDiacritics(); |
62 | 72 |
} |
63 | 73 |
|
64 |
/** |
|
65 |
* |
|
66 |
* @param voc |
|
67 |
*/ |
|
68 |
private void initWith(Index voc) { |
|
69 |
corpus = voc.getCorpus(); |
|
70 |
source = voc; |
|
71 |
List<Line> lines = voc.getAllLines(); |
|
72 |
this.freqs = new int[lines.size()]; |
|
73 |
this.labels = new String[lines.size()]; |
|
74 |
|
|
75 |
int i = 0; |
|
76 |
for (Line line : lines) { |
|
77 |
freqs[i] = line.getFrequency(); |
|
78 |
labels[i] = line.toString("_"); //$NON-NLS-1$ |
|
79 |
i++; |
|
80 |
} |
|
81 |
} |
|
82 | 74 |
|
75 |
|
|
83 | 76 |
/** |
84 | 77 |
* |
85 | 78 |
* @param corpus |
... | ... | |
88 | 81 |
* @throws CqiServerError |
89 | 82 |
*/ |
90 | 83 |
public WordCloud(Corpus corpus) throws CqiClientException, IOException, CqiServerError { |
84 |
super(); |
|
85 |
|
|
91 | 86 |
Query query; |
92 | 87 |
String lang = corpus.getLang(); |
93 | 88 |
if (corpus.getProperty(lang+"pos") != null) { |
... | ... | |
100 | 95 |
|
101 | 96 |
ArrayList<Property> props = new ArrayList<Property>(); |
102 | 97 |
props.add(corpus.getProperty("word")); |
103 |
Index voc = new Index(corpus, query, props);
|
|
98 |
Index index = new Index(corpus, query, props);
|
|
104 | 99 |
if (!query.toString().equals("[]")) { |
105 |
corpus.storeResult(voc);
|
|
100 |
corpus.addResult(index);
|
|
106 | 101 |
} |
107 |
List<Line> lines = voc.getAllLines(); |
|
102 |
|
|
103 |
|
|
104 |
index.addResult(this); |
|
105 |
|
|
106 |
List<Line> lines = index.getAllLines(); |
|
108 | 107 |
if (lines != null && lines.size() > 0) { |
109 |
this.initWith(voc);
|
|
108 |
this.initWith(index);
|
|
110 | 109 |
} else { |
111 | 110 |
Log.severe("Error: Could not build a word selection with this corpus"); |
112 | 111 |
throw new IllegalArgumentException("Error: Index failed with corpus "+corpus+" with lang "+lang+" and query "+query); |
... | ... | |
114 | 113 |
|
115 | 114 |
} |
116 | 115 |
|
116 |
|
|
117 |
/** |
|
118 |
* |
|
119 |
* @param index |
|
120 |
*/ |
|
121 |
private void initWith(Index index) { |
|
122 |
source = index; |
|
123 |
List<Line> lines = index.getAllLines(); |
|
124 |
this.freqs = new int[lines.size()]; |
|
125 |
this.labels = new String[lines.size()]; |
|
126 |
|
|
127 |
int i = 0; |
|
128 |
for (Line line : lines) { |
|
129 |
freqs[i] = line.getFrequency(); |
|
130 |
labels[i] = line.toString("_"); //$NON-NLS-1$ |
|
131 |
i++; |
|
132 |
} |
|
133 |
} |
|
134 |
|
|
135 |
|
|
117 | 136 |
// public WordCloud(QueryIndex qindex) { |
118 | 137 |
// parent = qindex.getCorpus(); |
119 | 138 |
// source = qindex; |
... | ... | |
141 | 160 |
} |
142 | 161 |
} |
143 | 162 |
|
144 |
public Corpus getCorpus() { |
|
145 |
return corpus; |
|
146 |
} |
|
147 |
|
|
163 |
|
|
148 | 164 |
public Object getSource() { |
149 | 165 |
return source; |
150 | 166 |
} |
... | ... | |
154 | 170 |
// labels[i] = AsciiUtils.convertNonAscii(labels[i]); |
155 | 171 |
} |
156 | 172 |
|
157 |
/** |
|
158 |
* |
|
159 |
* @return |
|
160 |
*/ |
|
161 |
public String getName() { |
|
162 |
return "WordCloud (" + TXMPreferences.getInt(WordCloudPreferences.PREFERENCES_NODE, this, WordCloudPreferences.FMIN) |
|
163 |
+ " / " |
|
164 |
+ TXMPreferences.getInt(WordCloudPreferences.PREFERENCES_NODE, this, WordCloudPreferences.MAX_WORDS) |
|
165 |
+ ")"; |
|
166 |
} |
|
167 | 173 |
|
168 | 174 |
|
169 | 175 |
|
... | ... | |
263 | 269 |
|
264 | 270 |
} |
265 | 271 |
|
272 |
|
|
273 |
|
|
274 |
/** |
|
275 |
* |
|
276 |
* @return |
|
277 |
*/ |
|
278 |
public String getName() { |
|
279 |
return this.getSimpleName(); |
|
280 |
} |
|
281 |
|
|
282 |
|
|
266 | 283 |
@Override |
267 |
public boolean delete() { |
|
268 |
return this.corpus.removeResult(this); |
|
284 |
public String getSimpleName() { |
|
285 |
return "WordCloud (" + TXMPreferences.getInt(WordCloudPreferences.PREFERENCES_NODE, this, WordCloudPreferences.FMIN) |
|
286 |
+ " / " |
|
287 |
+ TXMPreferences.getInt(WordCloudPreferences.PREFERENCES_NODE, this, WordCloudPreferences.MAX_WORDS) |
|
288 |
+ ")"; |
|
269 | 289 |
} |
270 | 290 |
|
271 | 291 |
@Override |
272 |
public HasResults getParent() { |
|
273 |
return this.corpus; |
|
292 |
public String getDetails() { |
|
293 |
// TODO Auto-generated method stub |
|
294 |
return null; |
|
274 | 295 |
} |
296 |
|
|
275 | 297 |
} |
298 |
|
tmp/org.txm.wordcloud.core/src/org/txm/wordcloud/core/chartsengine/r/RWordCloudChartCreator.java (revision 230) | ||
---|---|---|
2 | 2 |
|
3 | 3 |
import java.io.File; |
4 | 4 |
|
5 |
import org.txm.core.results.ITXMResult; |
|
5 | 6 |
import org.txm.chartsengine.r.core.RChartCreator; |
6 | 7 |
import org.txm.chartsengine.r.core.RChartsEngine; |
7 | 8 |
import org.txm.core.preferences.TXMPreferences; |
... | ... | |
17 | 18 |
// TODO Auto-generated constructor stub |
18 | 19 |
} |
19 | 20 |
|
20 |
@Override |
|
21 |
public Object createChart(Object resultData, String preferencesNode) { |
|
22 |
// TODO Auto-generated method stub |
|
23 |
return null; |
|
24 |
} |
|
25 | 21 |
|
26 | 22 |
@Override |
27 |
public File createChartFile(Object resultData, File file, String preferencesNode) {
|
|
23 |
public File createChartFile(ITXMResult result, File file, String preferencesNode) {
|
|
28 | 24 |
|
29 | 25 |
try { |
30 |
WordCloud wordCloud = (WordCloud) resultData;
|
|
26 |
WordCloud wordCloud = (WordCloud) result; |
|
31 | 27 |
|
32 | 28 |
|
33 | 29 |
// parameters |
34 |
int maxWords = TXMPreferences.getInt(preferencesNode, resultData, WordCloudPreferences.MAX_WORDS);
|
|
35 |
int minFreq = TXMPreferences.getInt(preferencesNode, resultData, WordCloudPreferences.FMIN);
|
|
36 |
float rotPer = TXMPreferences.getFloat(preferencesNode, resultData, WordCloudPreferences.ROT);
|
|
37 |
boolean randomOrder = TXMPreferences.getBoolean(preferencesNode, resultData, WordCloudPreferences.RANDOM_POSITION);
|
|
30 |
int maxWords = TXMPreferences.getInt(preferencesNode, result, WordCloudPreferences.MAX_WORDS); |
|
31 |
int minFreq = TXMPreferences.getInt(preferencesNode, result, WordCloudPreferences.FMIN); |
|
32 |
float rotPer = TXMPreferences.getFloat(preferencesNode, result, WordCloudPreferences.ROT); |
|
33 |
boolean randomOrder = TXMPreferences.getBoolean(preferencesNode, result, WordCloudPreferences.RANDOM_POSITION); |
|
38 | 34 |
|
39 | 35 |
|
40 | 36 |
RWorkspace rw = RWorkspace.getRWorkspaceInstance(); |
tmp/org.txm.wordcloud.core/src/org/txm/wordcloud/core/chartsengine/jfreechart/JFCWordCloudChartCreator.java (revision 230) | ||
---|---|---|
2 | 2 |
|
3 | 3 |
import org.jfree.chart.JFreeChart; |
4 | 4 |
import org.jfree.data.xy.XYSeriesCollection; |
5 |
import org.txm.core.results.ITXMResult; |
|
5 | 6 |
import org.txm.chartsengine.jfreechart.core.JFCChartCreator; |
6 | 7 |
import org.txm.wordcloud.core.functions.WordCloud; |
7 | 8 |
|
... | ... | |
12 | 13 |
} |
13 | 14 |
|
14 | 15 |
@Override |
15 |
public JFreeChart createChart(Object resultData, String preferencesNode) {
|
|
16 |
public JFreeChart createChart(ITXMResult result, String preferencesNode) {
|
|
16 | 17 |
|
17 | 18 |
// TODO Auto-generated method stub |
18 | 19 |
System.err.println("JFCWordCloudChartCreator.createChart(): Not yet implemented"); |
19 | 20 |
|
20 |
WordCloud wordCloud = (WordCloud) resultData;
|
|
21 |
WordCloud wordCloud = (WordCloud) result; |
|
21 | 22 |
|
22 | 23 |
|
23 | 24 |
|
tmp/org.txm.wordcloud.core/src/org/txm/wordcloud/core/preferences/WordCloudPreferences.java (revision 230) | ||
---|---|---|
21 | 21 |
|
22 | 22 |
public static final String PREFERENCES_PREFIX = "wordcloud_"; |
23 | 23 |
|
24 |
|
|
25 | 24 |
public static final String MAX_WORDS = PREFERENCES_PREFIX + "max_words"; //$NON-NLS-1$ |
26 | 25 |
public static final String FMIN = PREFERENCES_PREFIX + "f_min"; //$NON-NLS-1$ |
27 | 26 |
public static final String ROT = PREFERENCES_PREFIX + "rotation_percent"; //$NON-NLS-1$ |
tmp/org.txm.index.rcp/src/org/txm/index/rcp/editors/IndexEditor.java (revision 230) | ||
---|---|---|
69 | 69 |
import org.eclipse.ui.IEditorInput; |
70 | 70 |
import org.eclipse.ui.IEditorSite; |
71 | 71 |
import org.eclipse.ui.PartInitException; |
72 |
import org.eclipse.ui.part.EditorPart; |
|
73 | 72 |
import org.txm.Toolbox; |
74 | 73 |
import org.txm.index.core.functions.Index; |
75 | 74 |
import org.txm.index.core.functions.Line; |
76 | 75 |
import org.txm.index.core.functions.LineComparator.SortMode; |
76 |
import org.txm.rcp.editors.TXMEditorPart; |
|
77 | 77 |
import org.txm.rcpapplication.JobsTimer; |
78 | 78 |
import org.txm.rcpapplication.Messages; |
79 | 79 |
import org.txm.rcpapplication.StatusLine; |
... | ... | |
87 | 87 |
import org.txm.rcpapplication.swt.widget.NavigationWidget; |
88 | 88 |
import org.txm.rcpapplication.swt.widget.PropertiesSelector; |
89 | 89 |
import org.txm.rcpapplication.utils.JobHandler; |
90 |
import org.txm.rcpapplication.views.CorporaView; |
|
91 | 90 |
import org.txm.rcpapplication.views.QueriesView; |
92 | 91 |
import org.txm.rcpapplication.views.RVariablesView; |
92 |
import org.txm.rcpapplication.views.corpora.CorporaView; |
|
93 | 93 |
import org.txm.searchengine.cqp.clientExceptions.CqiClientException; |
94 | 94 |
import org.txm.searchengine.cqp.corpus.Corpus; |
95 | 95 |
import org.txm.searchengine.cqp.corpus.Partition; |
... | ... | |
103 | 103 |
* |
104 | 104 |
* @author mdecorde |
105 | 105 |
*/ |
106 |
public class IndexEditor extends EditorPart implements CustomizableEditor{ |
|
106 |
public class IndexEditor extends TXMEditorPart implements CustomizableEditor{
|
|
107 | 107 |
|
108 | 108 |
/** The corpus. */ |
109 | 109 |
protected Corpus corpus; |
... | ... | |
207 | 207 |
super(); |
208 | 208 |
} |
209 | 209 |
|
210 |
/** |
|
211 |
* Do save. |
|
212 |
* |
|
213 |
* @param arg0 the arg0 |
|
214 |
* @see org.eclipse.ui.part.EditorPart#doSave(org.eclipse.core.runtime.IProgressMonitor) |
|
215 |
*/ |
|
216 |
@Override |
|
217 |
public void doSave(IProgressMonitor arg0) { |
|
218 |
// TODO Auto-generated method stub |
|
219 |
} |
|
220 | 210 |
|
221 |
/** |
|
222 |
* Do save as. |
|
223 |
* |
|
224 |
* @see org.eclipse.lyon gournd zeroui.part.EditorPart#doSaveAs() |
|
225 |
*/ |
|
226 |
@Override |
|
227 |
public void doSaveAs() { |
|
228 |
// TODO Auto-generated method stub |
|
229 |
} |
|
230 | 211 |
|
231 | 212 |
/** |
232 | 213 |
* Inits the. |
... | ... | |
238 | 219 |
* org.eclipse.ui.IEditorInput) |
239 | 220 |
*/ |
240 | 221 |
@Override |
241 |
public void init(IEditorSite site, IEditorInput input) |
|
242 |
throws PartInitException { |
|
243 |
setSite(site); |
|
244 |
setInput(input); |
|
222 |
public void init(IEditorSite site, IEditorInput input) throws PartInitException { |
|
223 |
super.init(site, input); |
|
245 | 224 |
|
246 | 225 |
this.corpus = ((IndexEditorInput) input).getCorpus(); |
247 | 226 |
this.partition = ((IndexEditorInput) input).getPartition(); |
... | ... | |
342 | 321 |
|
343 | 322 |
this.acquireSemaphore(); |
344 | 323 |
|
345 |
if (oldIndex != null)
|
|
346 |
if (oldIndex.equals(index))
|
|
347 |
if (index.isComputedWithPartition())
|
|
348 |
partition.removeResult(oldIndex);
|
|
349 |
else
|
|
350 |
corpus.removeResult(oldIndex);
|
|
351 |
if (index.getV() > 0 && saveIndex)
|
|
352 |
if (index.isComputedWithPartition())
|
|
353 |
partition.storeResult(index);
|
|
354 |
else
|
|
355 |
corpus.storeResult(index);
|
|
324 |
if (index.equals(oldIndex)) {
|
|
325 |
index.getParent().removeResult(index);
|
|
326 |
}
|
|
327 |
// if (index.getV() > 0 && saveIndex) {
|
|
328 |
// if (index.isComputedWithPartition()) {
|
|
329 |
// partition.addResult(index);
|
|
330 |
// }
|
|
331 |
// else {
|
|
332 |
// corpus.addResult(index);
|
|
333 |
// }
|
|
334 |
// }
|
|
356 | 335 |
this.releaseSemaphore(); |
357 | 336 |
|
358 | 337 |
final String message; |
... | ... | |
375 | 354 |
System.out.println(message); |
376 | 355 |
StatusLine.setMessage(message); |
377 | 356 |
|
378 |
CorporaView.refresh(); |
|
379 |
CorporaView.expand(index.getParent()); |
|
357 |
CorporaView.refreshObject(index.getParent()); |
|
380 | 358 |
QueriesView.refresh(); |
381 | 359 |
RVariablesView.refresh(); |
382 | 360 |
if (partition != null) |
... | ... | |
396 | 374 |
} catch (ThreadDeath td) { |
397 | 375 |
return Status.CANCEL_STATUS; |
398 | 376 |
} catch (Exception e) { |
377 |
e.printStackTrace(); |
|
399 | 378 |
System.out.println(e.getLocalizedMessage()); |
400 | 379 |
try { |
401 | 380 |
System.out.println(Messages.LastCQPError+Toolbox.getCqiClient().getLastCQPError()); |
... | ... | |
1144 | 1123 |
} |
1145 | 1124 |
} |
1146 | 1125 |
|
1147 |
/* (non-Javadoc) |
|
1148 |
* @see org.eclipse.ui.part.EditorPart#getTitleToolTip() |
|
1149 |
*/ |
|
1150 |
@Override |
|
1151 |
public String getTitleToolTip() { |
|
1152 |
if (index != null) { |
|
1153 |
String str; |
|
1154 | 1126 |
|
1155 |
if (partition != null) |
|
1156 |
str = NLS.bind(Messages.IndexEditor_17, |
|
1157 |
new Object[]{partition.getName(), index.getQuery().getQueryString(), index.getProperties(), index.getFmin(), index.getFmax()}); |
|
1158 |
else |
|
1159 |
str = NLS.bind(Messages.IndexEditor_18, |
|
1160 |
new Object[]{corpus.getName(), index.getQuery().getQueryString(), index.getProperties(), index.getFmin(), index.getFmax()}); |
|
1161 |
|
|
1162 |
return str; |
|
1163 |
} |
|
1164 |
return ""; //$NON-NLS-1$ |
|
1165 |
} |
|
1166 |
|
|
1167 | 1127 |
/** |
1168 | 1128 |
* Sets the focus. |
1169 | 1129 |
* |
... | ... | |
1186 | 1146 |
} |
1187 | 1147 |
|
1188 | 1148 |
/** |
1189 |
* Gets the partition. |
|
1190 |
* |
|
1191 |
* @return the partition |
|
1192 |
*/ |
|
1193 |
public Partition getPartition() { |
|
1194 |
return this.partition; |
|
1195 |
} |
|
1196 |
|
|
1197 |
/** |
|
1198 | 1149 |
* Sets the focus. |
1199 | 1150 |
* |
1200 | 1151 |
* @param query the new focus |
... | ... | |
1203 | 1154 |
this.queryWidget.setText(query); |
1204 | 1155 |
} |
1205 | 1156 |
|
1206 |
/** |
|
1207 |
* Gets the index. |
|
1208 |
* |
|
1209 |
* @return the index |
|
1210 |
*/ |
|
1211 |
public Object getIndex() { |
|
1212 |
return this.index; |
|
1213 |
} |
|
1214 | 1157 |
|
1215 | 1158 |
/* (non-Javadoc) |
1216 | 1159 |
* @see org.txm.rcpapplication.commands.editor.CustomizableEditor#setName(java.lang.String) |
... | ... | |
1266 | 1209 |
// TODO Auto-generated method stub |
1267 | 1210 |
return false; |
1268 | 1211 |
} |
1212 |
|
|
1213 |
|
|
1214 |
/** |
|
1215 |
* Do save. |
|
1216 |
* |
|
1217 |
* @param arg0 the arg0 |
|
1218 |
* @see org.eclipse.ui.part.EditorPart#doSave(org.eclipse.core.runtime.IProgressMonitor) |
|
1219 |
*/ |
|
1220 |
@Override |
|
1221 |
public void doSave(IProgressMonitor arg0) { |
|
1222 |
// TODO Auto-generated method stub |
|
1223 |
} |
|
1224 |
|
|
1225 |
/** |
|
1226 |
* Do save as. |
|
1227 |
* |
|
1228 |
* @see org.eclipse.lyon gournd zeroui.part.EditorPart#doSaveAs() |
|
1229 |
*/ |
|
1230 |
@Override |
|
1231 |
public void doSaveAs() { |
|
1232 |
// TODO Auto-generated method stub |
|
1233 |
} |
|
1269 | 1234 |
} |
tmp/org.txm.index.rcp/src/org/txm/index/rcp/editors/IndexEditorInput.java (revision 230) | ||
---|---|---|
27 | 27 |
// |
28 | 28 |
package org.txm.index.rcp.editors; |
29 | 29 |
|
30 |
import org.eclipse.jface.resource.ImageDescriptor; |
|
31 |
import org.eclipse.ui.IEditorInput; |
|
32 |
import org.eclipse.ui.IPersistableElement; |
|
33 | 30 |
import org.txm.index.core.functions.Index; |
31 |
import org.txm.rcp.editors.TXMResultEditorInput; |
|
34 | 32 |
import org.txm.searchengine.cqp.corpus.Corpus; |
35 | 33 |
import org.txm.searchengine.cqp.corpus.Partition; |
36 | 34 |
|
... | ... | |
40 | 38 |
* |
41 | 39 |
* @author mdecorde |
42 | 40 |
*/ |
43 |
public class IndexEditorInput implements IEditorInput {
|
|
41 |
public class IndexEditorInput extends TXMResultEditorInput {
|
|
44 | 42 |
|
45 | 43 |
/** The corpus. */ |
46 | 44 |
protected Corpus corpus; |
... | ... | |
57 | 55 |
* @param corpus the corpus |
58 | 56 |
*/ |
59 | 57 |
public IndexEditorInput(final Corpus corpus) { |
60 |
super(); |
|
61 |
this.corpus = corpus; |
|
62 |
this.partition = null; |
|
63 |
this.index = null; |
|
58 |
this(corpus, null, null); |
|
64 | 59 |
} |
65 | 60 |
|
66 | 61 |
/** |
... | ... | |
69 | 64 |
* @param index the index |
70 | 65 |
*/ |
71 | 66 |
public IndexEditorInput(final Index index) { |
72 |
super(); |
|
73 |
this.corpus = index.getCorpus(); |
|
74 |
this.partition = index.getPartition(); |
|
75 |
this.index = index; |
|
67 |
this(index.getCorpus(), index.getPartition(), index); |
|
76 | 68 |
} |
77 | 69 |
|
78 | 70 |
/** |
... | ... | |
81 | 73 |
* @param partition the partition |
82 | 74 |
*/ |
83 | 75 |
public IndexEditorInput(Partition partition) { |
84 |
super(); |
|
85 |
this.corpus = partition.getCorpus(); |
|
86 |
this.partition = partition; |
|
87 |
this.index = null; |
|
76 |
this(partition.getCorpus(), partition, null); |
|
88 | 77 |
} |
89 | 78 |
|
79 |
|
|
90 | 80 |
/** |
91 |
* Exists.
|
|
92 |
* |
|
93 |
* @return true, if successful
|
|
94 |
* @see org.eclipse.ui.IEditorInput#exists()
|
|
81 |
* |
|
82 |
* @param corpus
|
|
83 |
* @param partition
|
|
84 |
* @param index
|
|
95 | 85 |
*/ |
96 |
@Override |
|
97 |
public boolean exists() { |
|
98 |
return false; |
|
86 |
public IndexEditorInput(Corpus corpus, Partition partition, Index index) { |
|
87 |
super(index); |
|
88 |
this.corpus = corpus; |
|
89 |
this.partition = partition; |
|
90 |
this.index = index; |
|
99 | 91 |
} |
100 |
|
|
92 |
|
|
101 | 93 |
/** |
102 |
* Gets the image descriptor. |
|
103 |
* |
|
104 |
* @return the image descriptor |
|
105 |
* @see org.eclipse.ui.IEditorInput#getImageDescriptor() |
|
106 |
*/ |
|
107 |
@Override |
|
108 |
public ImageDescriptor getImageDescriptor() { |
|
109 |
return null; |
|
110 |
} |
|
111 |
|
|
112 |
/** |
|
113 |
* Gets the name. |
|
114 |
* |
|
115 |
* @return the name |
|
116 |
* @see org.eclipse.ui.IEditorInput#getName() |
|
117 |
*/ |
|
118 |
@Override |
|
119 |
public String getName() { |
|
120 |
if (partition != null) |
|
121 |
return partition.getName(); |
|
122 |
else |
|
123 |
return corpus.getName(); |
|
124 |
} |
|
125 |
|
|
126 |
/** |
|
127 |
* Gets the persistable. |
|
128 |
* |
|
129 |
* @return the persistable |
|
130 |
* @see org.eclipse.ui.IEditorInput#getPersistable() |
|
131 |
*/ |
|
132 |
@Override |
|
133 |
public IPersistableElement getPersistable() { |
|
134 |
return null; |
|
135 |
} |
|
136 |
|
|
137 |
/** |
|
138 |
* Gets the tool tip text. |
|
139 |
* |
|
140 |
* @return the tool tip text |
|
141 |
* @see org.eclipse.ui.IEditorInput#getToolTipText() |
|
142 |
*/ |
|
143 |
@Override |
|
144 |
public String getToolTipText() { |
|
145 |
return getName(); |
|
146 |
} |
|
147 |
|
|
148 |
/** |
|
149 |
* Gets the adapter. |
|
150 |
* |
|
151 |
* @param arg0 the arg0 |
|
152 |
* @return the adapter |
|
153 |
* @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class) |
|
154 |
*/ |
|
155 |
@Override |
|
156 |
@SuppressWarnings("unchecked") //$NON-NLS-1$ |
|
157 |
public Object getAdapter(Class arg0) { |
|
158 |
return null; |
|
159 |
} |
|
160 |
|
|
161 |
/** |
|
162 | 94 |
* Gets the corpus. |
163 | 95 |
* |
164 | 96 |
* @return the corpus |
... | ... | |
184 | 116 |
public Index getIndex() { |
185 | 117 |
return index; |
186 | 118 |
} |
119 |
|
|
120 |
|
|
187 | 121 |
} |
tmp/org.txm.index.rcp/src/org/txm/index/rcp/adapters/IndexAdapterFactory.java (revision 230) | ||
---|---|---|
6 | 6 |
import org.eclipse.ui.plugin.AbstractUIPlugin; |
7 | 7 |
import org.osgi.framework.FrameworkUtil; |
8 | 8 |
import org.txm.index.core.functions.Index; |
9 |
import org.txm.rcp.adapters.BaseAdapterFactory;
|
|
10 |
import org.txm.stat.data.LexicalTable;
|
|
9 |
import org.txm.rcp.adapters.TXMResultAdapter;
|
|
10 |
import org.txm.rcp.adapters.TXMResultAdapterFactory;
|
|
11 | 11 |
|
12 | 12 |
|
13 | 13 |
/** |
... | ... | |
16 | 16 |
* @author mdecorde |
17 | 17 |
* @author sjacquot |
18 | 18 |
*/ |
19 |
public class IndexAdapterFactory extends BaseAdapterFactory {
|
|
19 |
public class IndexAdapterFactory extends TXMResultAdapterFactory {
|
|
20 | 20 |
|
21 | 21 |
|
22 | 22 |
public static final ImageDescriptor ICON = |
23 | 23 |
AbstractUIPlugin.imageDescriptorFromPlugin(FrameworkUtil.getBundle(IndexAdapterFactory.class).getSymbolicName(), |
24 | 24 |
"platform:/plugin/"+ FrameworkUtil.getBundle(IndexAdapterFactory.class).getSymbolicName() + "/icons/index.png"); //$NON-NLS-1$ //$NON-NLS-2$ |
25 | 25 |
|
26 |
/** |
|
27 |
* Gets the adapter. |
|
28 |
* |
|
29 |
* @param adaptableObject the adaptable object |
|
30 |
* @param adapterType the adapter type |
|
31 |
* @return the adapter |
|
32 |
* @see org.eclipse.core.runtime.IAdapterFactory#getAdapter(java.lang.Object, java.lang.Class) |
|
33 |
*/ |
|
34 | 26 |
@Override |
35 | 27 |
public Object getAdapter(Object adaptableObject, Class adapterType) { |
36 |
|
|
37 |
if(adapterType == IWorkbenchAdapter.class) { |
|
38 |
if(adaptableObject instanceof LexicalTable) { |
|
39 |
return new IWorkbenchAdapter() { |
|
40 |
@Override |
|
41 |
public Object[] getChildren(Object o) { |
|
42 |
return ((Index)o).getResults().toArray(); |
|
43 |
} |
|
44 |
|
|
45 |
@Override |
|
46 |
public ImageDescriptor getImageDescriptor(Object object) { |
|
47 |
return ICON; |
|
48 |
} |
|
49 |
|
|
50 |
@Override |
|
51 |
public String getLabel(Object o) { |
|
52 |
return ((Index) o).getName(); |
|
53 |
} |
|
54 |
|
|
55 |
@Override |
|
56 |
public Object getParent(Object o) { |
|
57 |
return ((Index) o).getParent(); |
|
58 |
} |
|
59 |
}; |
|
60 |
} |
|
28 |
if(adapterType == IWorkbenchAdapter.class && adaptableObject instanceof Index) { |
|
29 |
return new TXMResultAdapter() { |
|
30 |
@Override |
|
31 |
public ImageDescriptor getImageDescriptor(Object object) { |
|
32 |
return ICON; |
|
33 |
} |
|
34 |
}; |
|
61 | 35 |
} |
62 | 36 |
return null; |
63 | 37 |
} |
tmp/org.txm.index.rcp/plugin.xml (revision 230) | ||
---|---|---|
90 | 90 |
point="org.eclipse.core.runtime.adapters"> |
91 | 91 |
<factory |
92 | 92 |
adaptableType="org.txm.index.core.functions.Index" |
93 |
class="org.txm.rcpapplication.AdapterFactory">
|
|
93 |
class="org.txm.index.rcp.adapters.IndexAdapterFactory">
|
|
94 | 94 |
<adapter |
95 | 95 |
type="org.eclipse.ui.model.IWorkbenchAdapter"> |
96 | 96 |
</adapter> |
tmp/org.txm.cooccurrence.rcp/src/org/txm/cooccurrence/rcp/handlers/ComputeCooccurrences.java (revision 230) | ||
---|---|---|
47 | 47 |
import org.txm.rcpapplication.Messages; |
48 | 48 |
import org.txm.rcpapplication.StatusLine; |
49 | 49 |
import org.txm.rcpapplication.TXMWindows; |
50 |
import org.txm.rcpapplication.views.CorporaView; |
|
50 |
import org.txm.rcpapplication.views.corpora.CorporaView;
|
|
51 | 51 |
import org.txm.searchengine.cqp.corpus.Corpus; |
52 | 52 |
import org.txm.searchengine.cqp.corpus.Property; |
53 | 53 |
import org.txm.searchengine.cqp.corpus.StructuralUnit; |
... | ... | |
64 | 64 |
|
65 | 65 |
// adds a double click listener to the Corpus View |
66 | 66 |
static { |
67 |
CorporaView.addDoubleClickListener(Cooccurrence.class, "ComputeCooccurrences"); //$NON-NLS-1$
|
|
67 |
CorporaView.addDoubleClickListener(Cooccurrence.class, ComputeCooccurrences.class);
|
|
68 | 68 |
} |
69 | 69 |
|
70 | 70 |
|
tmp/org.txm.cooccurrence.rcp/src/org/txm/cooccurrence/rcp/adapters/CooccurrenceAdapterFactory.java (revision 230) | ||
---|---|---|
6 | 6 |
import org.eclipse.ui.plugin.AbstractUIPlugin; |
7 | 7 |
import org.osgi.framework.FrameworkUtil; |
8 | 8 |
import org.txm.cooccurrence.core.functions.Cooccurrence; |
9 |
import org.txm.rcp.adapters.BaseAdapterFactory; |
|
9 |
import org.txm.rcp.adapters.TXMResultAdapter; |
|
10 |
import org.txm.rcp.adapters.TXMResultAdapterFactory; |
|
10 | 11 |
|
11 | 12 |
|
12 | 13 |
/** |
... | ... | |
15 | 16 |
* @author mdecorde |
16 | 17 |
* @author sjacquot |
17 | 18 |
*/ |
18 |
public class CooccurrenceAdapterFactory extends BaseAdapterFactory {
|
|
19 |
public class CooccurrenceAdapterFactory extends TXMResultAdapterFactory {
|
|
19 | 20 |
|
20 | 21 |
|
21 | 22 |
public static final ImageDescriptor ICON = |
22 | 23 |
AbstractUIPlugin.imageDescriptorFromPlugin(FrameworkUtil.getBundle(CooccurrenceAdapterFactory.class).getSymbolicName(), |
23 | 24 |
"platform:/plugin/"+ FrameworkUtil.getBundle(CooccurrenceAdapterFactory.class).getSymbolicName() + "/icons/cooccurrences.png"); //$NON-NLS-1$ |
24 | 25 |
|
25 |
/** |
|
26 |
* Gets the adapter. |
|
27 |
* |
|
28 |
* @param adaptableObject the adaptable object |
|
29 |
* @param adapterType the adapter type |
|
30 |
* @return the adapter |
|
31 |
* @see org.eclipse.core.runtime.IAdapterFactory#getAdapter(java.lang.Object, java.lang.Class) |
|
32 |
*/ |
|
26 |
|
|
33 | 27 |
@Override |
34 | 28 |
public Object getAdapter(Object adaptableObject, Class adapterType) { |
35 |
|
|
36 |
if(adapterType == IWorkbenchAdapter.class) { |
|
37 |
if(adaptableObject instanceof Cooccurrence) { |
|
38 |
return new IWorkbenchAdapter() { |
|
39 |
|
|
40 |
@Override |
|
41 |
public Object[] getChildren(Object cooccurrence) { |
|
42 |
return new Object[0]; |
|
43 |
} |
|
44 |
|
|
45 |
@Override |
|
46 |
public ImageDescriptor getImageDescriptor(Object object) { |
|
47 |
return ICON; |
|
48 |
} |
|
49 |
|
|
50 |
@Override |
|
51 |
public String getLabel(Object cooccurrence) { |
|
52 |
return ((Cooccurrence) cooccurrence).getName(); |
|
53 |
} |
|
54 |
|
|
55 |
@Override |
|
56 |
public Object getParent(Object cooccurrence) { |
|
57 |
return ((Cooccurrence) cooccurrence).getCorpus(); |
|
58 |
} |
|
59 |
}; |
|
60 |
} |
|
29 |
if(adapterType == IWorkbenchAdapter.class && adaptableObject instanceof Cooccurrence) { |
|
30 |
return new TXMResultAdapter() { |
|
31 |
@Override |
|
32 |
public ImageDescriptor getImageDescriptor(Object object) { |
|
33 |
return ICON; |
|
34 |
} |
|
35 |
}; |
|
61 | 36 |
} |
62 | 37 |
return null; |
63 | 38 |
} |
tmp/org.txm.cooccurrence.rcp/src/org/txm/cooccurrence/rcp/editors/CooccurrenceEditorInput.java (revision 230) | ||
---|---|---|
32 | 32 |
import org.eclipse.ui.IPersistableElement; |
33 | 33 |
import org.eclipse.ui.plugin.AbstractUIPlugin; |
34 | 34 |
import org.txm.cooccurrence.core.functions.Cooccurrence; |
35 |
import org.txm.rcp.editors.TXMResultEditorInput; |
|
35 | 36 |
import org.txm.rcpapplication.Application; |
36 | 37 |
import org.txm.rcpapplication.IImageKeys; |
37 | 38 |
import org.txm.rcpapplication.Messages; |
... | ... | |
40 | 41 |
/** |
41 | 42 |
* The Class CooccurrenceEditorInput. |
42 | 43 |
*/ |
43 |
public class CooccurrenceEditorInput implements IEditorInput {
|
|
44 |
public class CooccurrenceEditorInput extends TXMResultEditorInput {
|
|
44 | 45 |
|
45 | 46 |
/** The cooc. */ |
46 | 47 |
private Cooccurrence cooc; |
... | ... | |
54 | 55 |
* @param cooc the cooc |
55 | 56 |
*/ |
56 | 57 |
public CooccurrenceEditorInput(Cooccurrence cooc) { |
57 |
this.cooc = cooc;
|
|
58 |
super(cooc);
|
|
58 | 59 |
this.corpus = cooc.getCorpus(); |
59 | 60 |
} |
60 | 61 |
|
... | ... | |
64 | 65 |
* @param corpus the corpus |
65 | 66 |
*/ |
66 | 67 |
public CooccurrenceEditorInput(Corpus corpus) { |
68 |
super(null); |
|
67 | 69 |
this.corpus = corpus; |
68 | 70 |
} |
69 | 71 |
|
tmp/org.txm.cooccurrence.rcp/src/org/txm/cooccurrence/rcp/editors/CooccurrencesEditor.java (revision 230) | ||
---|---|---|
86 | 86 |
import org.txm.cooccurrence.core.functions.comparators.ScoreComparator; |
87 | 87 |
import org.txm.cooccurrence.core.preferences.CooccurrencePreferences; |
88 | 88 |
import org.txm.core.preferences.TXMPreferences; |
89 |
import org.txm.rcp.editors.TXMEditorPart; |
|
89 | 90 |
import org.txm.rcpapplication.JobsTimer; |
90 | 91 |
import org.txm.rcpapplication.Messages; |
91 | 92 |
import org.txm.rcpapplication.StatusLine; |
... | ... | |
99 | 100 |
import org.txm.rcpapplication.swt.widget.PropertiesSelector; |
100 | 101 |
import org.txm.rcpapplication.utils.JobHandler; |
101 | 102 |
import org.txm.rcpapplication.utils.Logger; |
102 |
import org.txm.rcpapplication.views.CorporaView; |
|
103 | 103 |
import org.txm.rcpapplication.views.QueriesView; |
104 | 104 |
import org.txm.rcpapplication.views.RVariablesView; |
105 |
import org.txm.rcpapplication.views.corpora.CorporaView; |
|
105 | 106 |
import org.txm.searchengine.cqp.clientExceptions.CqiClientException; |
106 | 107 |
import org.txm.searchengine.cqp.corpus.Corpus; |
107 | 108 |
import org.txm.searchengine.cqp.corpus.Property; |
... | ... | |
113 | 114 |
/** |
114 | 115 |
* display the cooc parameters and result @ author mdecorde. |
115 | 116 |
*/ |
116 |
public class CooccurrencesEditor extends EditorPart implements CustomizableEditor{ |
|
117 |
public class CooccurrencesEditor extends TXMEditorPart implements CustomizableEditor{
|
|
117 | 118 |
|
118 | 119 |
/** The Constant ID. */ |
119 | 120 |
public static final String ID = "CooccurrencesEditor"; //$NON-NLS-1$ |
... | ... | |
326 | 327 |
*/ |
327 | 328 |
@Override |
328 | 329 |
public void createPartControl(final Composite parent) { |
330 |
|
|
331 |
//super.createPartControl(parent); |
|
332 |
|
|
329 | 333 |
FormLayout parentLayout = new FormLayout(); |
330 | 334 |
parent.setLayout(parentLayout); |
331 | 335 |
|
332 |
scrollComposite = new ScrolledComposite(parent, SWT.H_SCROLL |
|
333 |
| SWT.BORDER); |
|
336 |
scrollComposite = new ScrolledComposite(parent, SWT.H_SCROLL | SWT.BORDER); |
|
334 | 337 |
FormData paramLayoutData = new FormData(); |
335 | 338 |
paramLayoutData.top = new FormAttachment(0); |
336 | 339 |
paramLayoutData.left = new FormAttachment(0); |
... | ... | |
820 | 823 |
} |
821 | 824 |
}); |
822 | 825 |
|
823 |
corpus.storeResult(cooc);
|
|
826 |
corpus.addResult(cooc);
|
|
824 | 827 |
} catch(ThreadDeath e) { |
825 | 828 |
if (cooc != null) cooc.clearMemory(); |
826 | 829 |
return Status.CANCEL_STATUS; |
tmp/org.txm.progression.rcp/src/org/txm/progression/rcp/handlers/ComputeProgression.java (revision 230) | ||
---|---|---|
56 | 56 |
import org.txm.rcpapplication.Messages; |
57 | 57 |
import org.txm.rcpapplication.StatusLine; |
58 | 58 |
import org.txm.rcpapplication.utils.JobHandler; |
59 |
import org.txm.rcpapplication.views.CorporaView; |
|
59 |
import org.txm.rcpapplication.views.corpora.CorporaView;
|
|
60 | 60 |
import org.txm.searchengine.cqp.corpus.Corpus; |
61 | 61 |
import org.txm.utils.logger.Log; |
62 | 62 |
|
... | ... | |
72 | 72 |
// FIXME: should be put in an Activator? or better in an extension point loaded by the corpora view? or in a method called here as initTreeDoubleClickListener(Class resultDataType, String commandId)? |
73 | 73 |
// adds a double click listener to the Corpus View |
74 | 74 |
static { |
75 |
CorporaView.addDoubleClickListener(Progression.class, "ComputeProgression"); //$NON-NLS-1$
|
|
75 |
CorporaView.addDoubleClickListener(Progression.class, ComputeProgression.class); //$NON-NLS-1$
|
|
76 | 76 |
} |
77 | 77 |
|
78 | 78 |
|
... | ... | |
145 | 145 |
tmpSWTComponentsProvider.setChartsEngine(tmpChartsEngine); |
146 | 146 |
|
147 | 147 |
// Create and open the chart editor |
148 |
editor = tmpSWTComponentsProvider.openEditor(progression.getCorpus().getName() + ": " + progression.getName(), progression, ProgressionPreferences.PREFERENCES_NODE);
|
|
148 |
editor = tmpSWTComponentsProvider.openEditor(progression, ProgressionPreferences.PREFERENCES_NODE); |
|
149 | 149 |
} |
150 | 150 |
else { |
151 | 151 |
// Create and open the chart editor |
152 |
editor = SWTChartsComponentsProvider.getCurrent().openEditor(progression.getCorpus().getName() + ": " + progression.getName(), progression, ProgressionPreferences.PREFERENCES_NODE);
|
|
152 |
editor = SWTChartsComponentsProvider.getCurrent().openEditor(progression, ProgressionPreferences.PREFERENCES_NODE); |
|
153 | 153 |
|
154 | 154 |
|
155 | 155 |
|
... | ... | |
285 | 285 |
} catch (ThreadDeath td) { |
286 | 286 |
return Status.CANCEL_STATUS; |
287 | 287 |
} catch (Exception e) { |
288 |
e.printStackTrace(); |
|
288 | 289 |
System.out.println(NLS.bind(ProgressionCoreMessages.ComputeProgression_13, e)); |
289 | 290 |
Log.severe(ProgressionCoreMessages.ComputeProgression_13 + Log.toString(e)); |
290 | 291 |
try { |
tmp/org.txm.progression.rcp/src/org/txm/progression/rcp/adapters/ProgressionAdapterFactory.java (revision 230) | ||
---|---|---|
6 | 6 |
import org.eclipse.ui.plugin.AbstractUIPlugin; |
7 | 7 |
import org.osgi.framework.FrameworkUtil; |
8 | 8 |
import org.txm.progression.core.functions.Progression; |
9 |
import org.txm.rcp.adapters.BaseAdapterFactory; |
|
9 |
import org.txm.rcp.adapters.TXMResultAdapter; |
|
10 |
import org.txm.rcp.adapters.TXMResultAdapterFactory; |
|
10 | 11 |
|
11 | 12 |
|
12 | 13 |
/** |
... | ... | |
15 | 16 |
* @author mdecorde |
16 | 17 |
* @author sjacquot |
17 | 18 |
*/ |
18 |
public class ProgressionAdapterFactory extends BaseAdapterFactory {
|
|
19 |
public class ProgressionAdapterFactory extends TXMResultAdapterFactory {
|
|
19 | 20 |
|
20 | 21 |
|
21 | 22 |
public static final ImageDescriptor ICON = |
22 | 23 |
AbstractUIPlugin.imageDescriptorFromPlugin(FrameworkUtil.getBundle(ProgressionAdapterFactory.class).getSymbolicName(), |
23 | 24 |
"platform:/plugin/"+ FrameworkUtil.getBundle(ProgressionAdapterFactory.class).getSymbolicName() + "/icons/functions/progression.png"); //$NON-NLS-1$ |
24 | 25 |
|
25 |
/** |
|
26 |
* Gets the adapter. |
|
27 |
* |
|
28 |
* @param adaptableObject the adaptable object |
|
29 |
* @param adapterType the adapter type |
|
30 |
* @return the adapter |
|
31 |
* @see org.eclipse.core.runtime.IAdapterFactory#getAdapter(java.lang.Object, java.lang.Class) |
|
32 |
*/ |
|
33 | 26 |
@Override |
34 | 27 |
public Object getAdapter(Object adaptableObject, Class adapterType) { |
35 |
|
|
36 |
if(adapterType == IWorkbenchAdapter.class) { |
|
37 |
if(adaptableObject instanceof Progression) { |
|
38 |
return new IWorkbenchAdapter() { |
|
39 |
@Override |
|
40 |
public Object[] getChildren(Object resultData) { |
|
41 |
return new Object[0]; |
|
42 |
} |
|
43 |
|
|
44 |
@Override |
|
45 |
public ImageDescriptor getImageDescriptor(Object object) { |
|
46 |
return ICON; |
|
47 |
} |
|
48 |
|
|
49 |
@Override |
|
50 |
public String getLabel(Object resultData) { |
|
51 |
return ((Progression) resultData).getDetails(); |
|
52 |
} |
|
53 |
|
|
54 |
@Override |
|
55 |
public Object getParent(Object resultData) { |
|
56 |
return ((Progression) resultData).getCorpus(); |
|
57 |
} |
|
58 |
}; |
|
59 |
} |
|
28 |
if(adapterType == IWorkbenchAdapter.class && adaptableObject instanceof Progression) { |
|
29 |
return new TXMResultAdapter() { |
|
30 |
@Override |
|
31 |
public ImageDescriptor getImageDescriptor(Object object) { |
|
32 |
// TODO Auto-generated method stub |
|
33 |
return ICON; |
|
34 |
} |
|
35 |
}; |
|
60 | 36 |
} |
61 | 37 |
return null; |
62 | 38 |
} |
tmp/org.txm.index.core/src/org/txm/index/core/messages/messages.properties (revision 230) | ||
---|---|---|
1 |
IndexEditor_17=Index\:\n\tPartition {0}\n\tquery {1}\n\tproperties {2}\n\tFmin {3}\n\tFmax {4} |
|
2 |
IndexEditor_18=Index\:\n\tCorpus {0}\n\tquery {1}\n\tproperties {2}\n\tFmin {3}\n\tFmax {4} |
|
0 | 3 |
tmp/org.txm.index.core/src/org/txm/index/core/messages/IndexCoreMessages.java (revision 230) | ||
---|---|---|
1 |
package org.txm.index.core.messages; |
|
2 |
|
|
3 |
import org.eclipse.osgi.util.NLS; |
|
4 |
import org.txm.core.messages.TXMCoreMessages; |
|
5 |
|
|
6 |
public class IndexCoreMessages extends NLS { |
|
7 |
|
|
8 |
private static final String BUNDLE_NAME = "org.txm.index.core.messages.messages"; //$NON-NLS-1$ |
|
9 |
|
|
10 |
|
|
11 |
public static String IndexEditor_17; |
|
12 |
public static String IndexEditor_18; |
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
static { |
|
17 |
// initialize resource bundle |
|
18 |
TXMCoreMessages.initializeMessages(BUNDLE_NAME, IndexCoreMessages.class); |
|
19 |
} |
|
20 |
|
|
21 |
private IndexCoreMessages() { |
|
22 |
} |
|
23 |
} |
|
0 | 24 |
tmp/org.txm.index.core/src/org/txm/index/core/messages/messages_ru.properties (revision 230) | ||
---|---|---|
1 |
IndexEditor_17=Индекс:\n\tРаспределение {0}\n\tЗапрос {1}\n\tсвойства {2}\n\tFmin {3}\n\tFmax {4} |
|
2 |
IndexEditor_18=Индекс:\n\tКорпус {0}\n\tЗапрос {1}\n\tсвойства {2}\n\tFmin {3}\n\tFmax {4} |
|
0 | 3 |
tmp/org.txm.index.core/src/org/txm/index/core/messages/messages_fr.properties (revision 230) | ||
---|---|---|
1 |
IndexEditor_17=Index\:\n\tPartition {0}\n\tRequ\u00EAte {1}\n\tpropriétés {2}\n\tFmin {3}\n\tFmax {4} |
|
2 |
IndexEditor_18=Index\:\n\tCorpus {0}\n\tRequ\u00EAte {1}\n\tpropriétés {2}\n\tFmin {3}\n\tFmax {4} |
|
0 | 3 |
tmp/org.txm.index.core/src/org/txm/index/core/functions/Index.java (revision 230) | ||
---|---|---|
41 | 41 |
import java.util.List; |
42 | 42 |
|
43 | 43 |
import org.apache.commons.lang.StringUtils; |
44 |
import org.txm.HasResults;
|
|
44 |
import org.eclipse.osgi.util.NLS;
|
|
45 | 45 |
import org.txm.Messages; |
46 | 46 |
import org.txm.Toolbox; |
47 | 47 |
import org.txm.functions.Function; |
48 |
import org.txm.functions.TXMResult;
|
|
48 |
import org.txm.index.core.messages.IndexCoreMessages;
|
|
49 | 49 |
import org.txm.searchengine.cqp.ICqiClient; |
50 | 50 |
import org.txm.searchengine.cqp.clientExceptions.CqiClientException; |
51 | 51 |
import org.txm.searchengine.cqp.corpus.Corpus; |
... | ... | |
70 | 70 |
* may contains LexicalTable built from its values |
71 | 71 |
* @author mdecorde. |
72 | 72 |
*/ |
73 |
public class Index extends Function implements TXMResult, HasResults {
|
|
73 |
public class Index extends Function { |
|
74 | 74 |
|
75 |
/** The partition. */ |
|
76 |
protected Partition partition; |
|
77 |
|
|
78 |
/** The corpus. */ |
|
79 |
protected Corpus corpus; |
|
80 |
|
|
81 | 75 |
/** The query. */ |
82 | 76 |
protected Query query; |
83 | 77 |
|
... | ... | |
126 | 120 |
/** The symbol. */ |
127 | 121 |
private String symbol; |
128 | 122 |
|
129 |
/** |
|
130 |
* compute the index with a lexicon. |
|
131 |
* |
|
132 |
* @param corpus the corpus |
|
133 |
* @param property the property |
|
134 |
*/ |
Formats disponibles : Unified diff