Révision 537
tmp/org.txm.chartsengine.r.core/src/org/txm/chartsengine/r/core/themes/DefaultTheme.java (revision 537) | ||
---|---|---|
50 | 50 |
1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3 }; |
51 | 51 |
|
52 | 52 |
/** The monowidths. */ |
53 |
public static int[] monowidths = {
|
|
53 |
public static int[] monoWidths = {
|
|
54 | 54 |
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }; |
55 | 55 |
|
56 | 56 |
public DefaultTheme() { |
tmp/org.txm.chartsengine.svgbatik.rcp/src/org/txm/chartsengine/svgbatik/rcp/swt/SVGComposite.java (revision 537) | ||
---|---|---|
1 | 1 |
package org.txm.chartsengine.svgbatik.rcp.swt; |
2 | 2 |
import java.awt.BorderLayout; |
3 |
import java.awt.Component; |
|
3 | 4 |
import java.awt.EventQueue; |
4 | 5 |
import java.awt.Frame; |
5 | 6 |
import java.awt.Graphics2D; |
... | ... | |
13 | 14 |
import java.io.IOException; |
14 | 15 |
import java.net.MalformedURLException; |
15 | 16 |
|
17 |
import javax.swing.JPanel; |
|
18 |
|
|
16 | 19 |
import org.eclipse.swt.awt.SWT_AWT; |
17 | 20 |
import org.eclipse.swt.widgets.Composite; |
21 |
import org.txm.chartsengine.rcp.IChartComponent; |
|
18 | 22 |
import org.txm.chartsengine.rcp.editors.ChartEditorPart; |
19 | 23 |
import org.txm.chartsengine.rcp.events.EventCallBackHandler; |
20 | 24 |
import org.txm.chartsengine.rcp.swt.ChartComposite; |
... | ... | |
43 | 47 |
*/ |
44 | 48 |
protected File file; |
45 | 49 |
|
46 |
|
|
50 |
protected Frame frame; |
|
47 | 51 |
|
52 |
protected JPanel rootPanel; |
|
53 |
|
|
54 |
|
|
48 | 55 |
/** |
49 | 56 |
* Creates a Batik SVG composite. |
50 | 57 |
* @param parent |
... | ... | |
55 | 62 |
|
56 | 63 |
this.file = null; |
57 | 64 |
|
58 |
Frame frame = SWT_AWT.new_Frame(this); |
|
65 |
this.frame = SWT_AWT.new_Frame(this); |
|
66 |
// Need to add an AWT Panel to fix mouse events and mouse cursors changes on Swing JPanel |
|
67 |
this.rootPanel = new JPanel(new BorderLayout()); |
|
59 | 68 |
|
60 |
// Need to add an AWT Panel to fix mouse events and mouse cursors changes on Swing JPanel |
|
61 |
Panel rootPanel = new Panel(new BorderLayout()); |
|
62 |
this.chartComponent = new SVGPanel(chartEditor, frame); |
|
63 |
rootPanel.add(this.getPanel()); |
|
64 |
frame.add(rootPanel); |
|
65 |
frame.pack(); |
|
69 |
this.frame.add(this.rootPanel); |
|
70 |
|
|
71 |
//this.frame.pack(); |
|
72 |
this.frame.setVisible(true); |
|
73 |
|
|
66 | 74 |
} |
67 | 75 |
|
68 | 76 |
|
... | ... | |
118 | 126 |
|
119 | 127 |
@Override |
120 | 128 |
public void loadChart() { |
121 |
this.file = (File) this.chartEditor.getEditorInput().getChartContainer(); |
|
122 |
this.loadSVGDocument(this.file); |
|
129 |
if(!this.chartEditor.getResultData().isChartDirty()) { |
|
130 |
// creates components if they not exist |
|
131 |
if(this.chartComponent == null) { |
|
132 |
|
|
133 |
this.chartEditor.getSWTChartsComponentsProvider().createChartContainer(this.chartEditor.getEditorInput()); |
|
134 |
this.chartComponent = (IChartComponent) this.chartEditor.getEditorInput().getChartContainer(); |
|
135 |
|
|
136 |
this.rootPanel.add((Component) this.chartComponent); |
|
137 |
|
|
138 |
this.frame.setVisible(true); |
|
139 |
} |
|
140 |
// loads the chart from the result |
|
141 |
Object chart = this.chartEditor.getEditorInput().getChart(); |
|
142 |
// recreates the chart if not of right type |
|
143 |
if(!(chart instanceof File)) { |
|
144 |
this.file = this.chartEditor.getSWTChartsComponentsProvider().getChartsEngine().getChartCreator(this.chartEditor.getResultData()).createChartFile(this.chartEditor.getResultData()); |
|
145 |
} |
|
146 |
else { |
|
147 |
this.file = (File) chart; |
|
148 |
} |
|
149 |
|
|
150 |
this.loadSVGDocument(this.file); |
|
151 |
} |
|
123 | 152 |
} |
124 | 153 |
|
125 | 154 |
|
tmp/org.txm.chartsengine.svgbatik.rcp/src/org/txm/chartsengine/svgbatik/rcp/SVGSWTChartsComponentsProvider.java (revision 537) | ||
---|---|---|
22 | 22 |
import org.txm.chartsengine.rcp.editors.ChartEditorInput; |
23 | 23 |
import org.txm.chartsengine.rcp.editors.ChartEditorPart; |
24 | 24 |
import org.txm.chartsengine.rcp.swt.ChartComposite; |
25 |
import org.txm.chartsengine.svgbatik.rcp.swing.SVGPanel; |
|
25 | 26 |
import org.txm.chartsengine.svgbatik.rcp.swt.SVGComposite; |
26 | 27 |
import org.w3c.dom.Element; |
27 | 28 |
|
... | ... | |
50 | 51 |
@Override |
51 | 52 |
public boolean createChartContainer(ChartsEngine chartsEngine, ChartEditorInput chartEditorInput) { |
52 | 53 |
|
53 |
Object chart = chartEditorInput.getChart();
|
|
54 |
if (!chartEditorInput.getResult().isChartDirty()) {
|
|
54 | 55 |
|
55 |
//if(chart != null) { |
|
56 |
chartEditorInput.setChartContainer(chart); |
|
56 |
chartEditorInput.setChartContainer(new SVGPanel()); |
|
57 | 57 |
|
58 | 58 |
// sets and updates the local preferences node qualifier from the result data |
59 | 59 |
chartEditorInput.syncLocalPreferencesNode(); |
60 |
|
|
61 |
|
|
62 | 60 |
|
63 | 61 |
return true; |
64 |
//} |
|
65 |
|
|
66 |
|
|
67 |
//return false; |
|
62 |
} |
|
63 |
return false; |
|
68 | 64 |
} |
69 | 65 |
|
70 | 66 |
|
tmp/org.txm.chartsengine.svgbatik.rcp/src/org/txm/chartsengine/svgbatik/rcp/swing/SVGPanel.java (revision 537) | ||
---|---|---|
29 | 29 |
|
30 | 30 |
|
31 | 31 |
import java.awt.BorderLayout; |
32 |
import java.awt.Frame; |
|
33 | 32 |
import java.awt.event.InputEvent; |
34 | 33 |
import java.awt.event.MouseEvent; |
35 | 34 |
import java.awt.event.MouseWheelEvent; |
... | ... | |
49 | 48 |
import org.txm.chartsengine.rcp.SWTChartsComponentsProvider; |
50 | 49 |
import org.txm.chartsengine.rcp.editors.ChartEditorPart; |
51 | 50 |
import org.txm.chartsengine.rcp.events.ChartKeyListener; |
52 |
import org.txm.utils.logger.Log; |
|
53 | 51 |
import org.w3c.dom.svg.SVGDocument; |
54 | 52 |
|
55 | 53 |
/** |
... | ... | |
91 | 89 |
* |
92 | 90 |
* @param frame the frame |
93 | 91 |
*/ |
94 |
public SVGPanel(ChartEditorPart editor, Frame frame) {
|
|
92 |
public SVGPanel() { |
|
95 | 93 |
super(new BorderLayout()); |
96 | 94 |
|
97 | 95 |
this.svgCanvas = new JSVGCanvas(null, true, false); |
... | ... | |
209 | 207 |
// add default chart key listener |
210 | 208 |
this.addKeyListener(new ChartKeyListener(SWTChartsComponentsProvider.getCurrent(), this, 10.5)); |
211 | 209 |
|
212 |
this.setChartEditor(editor); |
|
210 |
//this.setChartEditor(editor);
|
|
213 | 211 |
|
214 | 212 |
|
215 | 213 |
} |
tmp/org.txm.cah.core/src/org/txm/cah/core/functions/AHC.java (revision 537) | ||
---|---|---|
124 | 124 |
this.target = ca.getSymbol(); |
125 | 125 |
} |
126 | 126 |
|
127 |
|
|
127 | 128 |
public void setParameters(Boolean columns, String metric, Integer nCluster, String method) { |
128 | 129 |
if (columns != null) this.pColumns = columns; |
129 | 130 |
if (metric != null) this.pMetric = metric; |
... | ... | |
134 | 135 |
|
135 | 136 |
@Override |
136 | 137 |
public boolean setParameters(TXMParameters parameters) { |
137 |
this.parameters = parameters; |
|
138 |
|
|
139 | 138 |
try { |
140 | 139 |
Boolean columns = this.getBooleanParameterValue(AHCPreferences.COLUMNS_COMPUTING); |
141 | 140 |
String metric = this.getStringParameterValue(AHCPreferences.METRIC); |
... | ... | |
149 | 148 |
return true; |
150 | 149 |
} |
151 | 150 |
|
151 |
// @Override |
|
152 |
// public void loadParameters() { |
|
153 |
// this.setParameters( |
|
154 |
// this.getBooleanParameterValue(AHCPreferences.COLUMNS_COMPUTING), |
|
155 |
// this.getStringParameterValue(AHCPreferences.METRIC), |
|
156 |
// this.getIntParameterValue(AHCPreferences.N_CLUSTERS), |
|
157 |
// this.getStringParameterValue(AHCPreferences.METHOD) |
|
158 |
// ); |
|
159 |
// } |
|
160 |
|
|
161 |
|
|
162 |
@Override |
|
163 |
public boolean canCompute() { |
|
164 |
return ca != null |
|
165 |
&& Arrays.binarySearch(AHC.getMethods(), pMethod) >= 0 |
|
166 |
&& Arrays.binarySearch(AHC.getMetrics(), pMetric) >= 0 |
|
167 |
&& pNCluster >= 2; |
|
168 |
} |
|
169 |
|
|
152 | 170 |
/** |
153 | 171 |
* Resets the cached data so the next getter calls will request the values from R. |
154 | 172 |
*/ |
... | ... | |
592 | 610 |
return this.getName(); |
593 | 611 |
} |
594 | 612 |
|
595 |
@Override |
|
596 |
public boolean canCompute() { |
|
597 | 613 |
|
598 |
return ca != null |
|
599 |
&& Arrays.binarySearch(AHC.getMethods(), pMethod) >= 0 |
|
600 |
&& Arrays.binarySearch(AHC.getMetrics(), pMetric) >= 0 |
|
601 |
&& pNCluster >= 2; |
|
602 |
} |
|
614 |
|
|
603 | 615 |
} |
tmp/org.txm.partition.core/src/org/txm/partition/core/functions/PartitionDimensions.java (revision 537) | ||
---|---|---|
10 | 10 |
import java.util.List; |
11 | 11 |
|
12 | 12 |
import org.txm.chartsengine.core.results.ChartResult; |
13 |
import org.txm.core.preferences.TXMPreferences; |
|
13 | 14 |
import org.txm.core.results.TXMParameters; |
14 | 15 |
import org.txm.partition.core.messages.PartitionCoreMessages; |
16 |
import org.txm.partition.core.preferences.PartitionDimensionsPreferences; |
|
15 | 17 |
import org.txm.searchengine.cqp.clientExceptions.CqiClientException; |
16 | 18 |
import org.txm.searchengine.cqp.corpus.Corpus; |
17 | 19 |
import org.txm.searchengine.cqp.corpus.Part; |
... | ... | |
26 | 28 |
public class PartitionDimensions extends ChartResult { |
27 | 29 |
|
28 | 30 |
|
31 |
|
|
29 | 32 |
/** |
30 | 33 |
* Creates a partition dimensions result from the specified <link>Partition</link>. |
31 | 34 |
*/ |
... | ... | |
54 | 57 |
|
55 | 58 |
@Override |
56 | 59 |
public boolean setParameters(TXMParameters parameters) { |
60 |
try { |
|
61 |
this.setParameters((boolean)parameters.get(PartitionDimensionsPreferences.CHART_DIMENSIONS_SORTED_BY_SIZE)); |
|
62 |
return true; |
|
63 |
} |
|
64 |
catch(Exception e) { |
|
65 |
// TODO Auto-generated catch block |
|
66 |
e.printStackTrace(); |
|
67 |
} |
|
57 | 68 |
return false; |
58 | 69 |
} |
59 | 70 |
|
60 | 71 |
|
61 | 72 |
/** |
73 |
* |
|
74 |
* @param sortByPartSize |
|
75 |
*/ |
|
76 |
public void setParameters(boolean sortByPartSize) { |
|
77 |
TXMPreferences.putLocal(this, PartitionDimensionsPreferences.CHART_DIMENSIONS_SORTED_BY_SIZE, sortByPartSize); |
|
78 |
this.setDirty(); |
|
79 |
this.setChartDirty(); |
|
80 |
} |
|
81 |
|
|
82 |
/** |
|
62 | 83 |
* Convenience method. |
63 | 84 |
*/ |
64 | 85 |
public Partition getPartition() { |
... | ... | |
148 | 169 |
public String getDetails() { |
149 | 170 |
return this.getName(); |
150 | 171 |
} |
151 |
|
|
152 | 172 |
|
153 | 173 |
|
154 |
|
|
155 |
|
|
156 | 174 |
@Override |
157 | 175 |
public boolean toTxt(File arg0, String arg1, String arg2, String arg3) throws Exception { |
158 | 176 |
// TODO Auto-generated method stub |
... | ... | |
160 | 178 |
} |
161 | 179 |
|
162 | 180 |
|
181 |
|
|
163 | 182 |
} |
tmp/org.txm.wordcloud.rcp/src/org/txm/wordcloud/rcp/editors/WordCloudEditor.java (revision 537) | ||
---|---|---|
97 | 97 |
TXMPreferences.putLocalFloat(getResultData(), WordCloudPreferences.ROT, rotPerSpinner.getSelection()); |
98 | 98 |
TXMPreferences.putLocalBoolean(getResultData(), WordCloudPreferences.RANDOM_POSITION, randomOrderButton.getSelection()); |
99 | 99 |
|
100 |
computeChart("Compute Wordcloud", true, true);
|
|
100 |
computeChart(true, true, true);
|
|
101 | 101 |
} |
102 | 102 |
|
103 | 103 |
|
... | ... | |
110 | 110 |
p.pack(); |
111 | 111 |
|
112 | 112 |
this.computeResult(); |
113 |
this.computeChart("Compute Wordcloud", false);
|
|
113 |
this.computeChart(false); |
|
114 | 114 |
|
115 | 115 |
Log.info(WordCloudUIMessages.Log_WordCloud_ready + this.getResultData()); |
116 | 116 |
|
tmp/org.txm.wordcloud.core/src/org/txm/wordcloud/core/functions/WordCloud.java (revision 537) | ||
---|---|---|
211 | 211 |
return this.getSimpleName(); |
212 | 212 |
} |
213 | 213 |
|
214 |
|
|
214 | 215 |
@Override |
216 |
public boolean canCompute() { |
|
217 |
return source != null; |
|
218 |
} |
|
219 |
|
|
220 |
@Override |
|
221 |
public boolean setParameters(TXMParameters parameters) { |
|
222 |
return false; |
|
223 |
} |
|
224 |
|
|
225 |
@Override |
|
215 | 226 |
protected boolean _compute(boolean update) { |
216 | 227 |
// from corpus |
217 | 228 |
if (source instanceof Corpus) {// TODO: source must always be an Index because the corpus source produces an Index |
... | ... | |
262 | 273 |
return true; |
263 | 274 |
} |
264 | 275 |
|
265 |
@Override |
|
266 |
public boolean canCompute() { |
|
267 |
return source != null; |
|
268 |
} |
|
269 | 276 |
|
270 |
@Override |
|
271 |
public boolean setParameters(TXMParameters parameters) { |
|
272 |
return false; |
|
273 |
} |
|
274 | 277 |
} |
tmp/org.txm.partition.rcp/src/org/txm/partition/rcp/editors/PartitionDimensionsEditor.java (revision 537) | ||
---|---|---|
9 | 9 |
import org.eclipse.swt.widgets.Composite; |
10 | 10 |
import org.eclipse.swt.widgets.ToolItem; |
11 | 11 |
import org.txm.chartsengine.rcp.editors.ChartEditorPart; |
12 |
import org.txm.core.preferences.TXMPreferences;
|
|
12 |
import org.txm.partition.core.functions.PartitionDimensions;
|
|
13 | 13 |
import org.txm.partition.core.preferences.PartitionDimensionsPreferences; |
14 |
import org.txm.partition.rcp.handlers.ComputePartitionDimensionsBarChart; |
|
15 | 14 |
import org.txm.partition.rcp.messages.PartitionUIMessages; |
16 | 15 |
import org.txm.rcp.IImageKeys; |
17 | 16 |
|
... | ... | |
33 | 32 |
// extend the tool bar |
34 | 33 |
new ToolItem(this.getToolBar(), SWT.SEPARATOR); |
35 | 34 |
final ToolItem sortByPartSize = new ToolItem(this.getToolBar(), SWT.CHECK); |
36 |
sortByPartSize.setImage(IImageKeys.getImage(ComputePartitionDimensionsBarChart.class, "icons/silk_sort_by_size.png"));
|
|
35 |
sortByPartSize.setImage(IImageKeys.getImage(this.getClass(), "icons/silk_sort_by_size.png"));
|
|
37 | 36 |
sortByPartSize.setToolTipText(PartitionUIMessages.PreferencesPage_DIMENSIONS_SORT_BY_PARTS_SIZE); |
38 | 37 |
sortByPartSize.setSelection(this.getBooleanParameterValue(PartitionDimensionsPreferences.CHART_DIMENSIONS_SORTED_BY_SIZE)); |
39 | 38 |
|
... | ... | |
41 | 40 |
|
42 | 41 |
@Override |
43 | 42 |
public void widgetSelected(SelectionEvent e) { |
44 |
TXMPreferences.putLocal(getResultData(), PartitionDimensionsPreferences.CHART_DIMENSIONS_SORTED_BY_SIZE, sortByPartSize.getSelection());
|
|
43 |
((PartitionDimensions)getResultData()).setParameters(sortByPartSize.getSelection());
|
|
45 | 44 |
computeChart(true, false, true); |
46 | 45 |
} |
47 | 46 |
|
tmp/org.txm.partition.rcp/src/org/txm/partition/rcp/handlers/ComputePartitionDimensionsBarChart.java (revision 537) | ||
---|---|---|
71 | 71 |
Object selection = this.getSelection(event); |
72 | 72 |
PartitionDimensions partitionDimensions = null; |
73 | 73 |
|
74 |
|
|
75 | 74 |
// Creating from Partition |
76 | 75 |
if (selection instanceof Partition) { |
77 | 76 |
Partition partition = (Partition) selection; |
... | ... | |
87 | 86 |
partitionDimensions = (PartitionDimensions) selection; |
88 | 87 |
} |
89 | 88 |
|
90 |
// final ChartEditorPart editor = SWTChartsComponentsProvider.getCurrent().openEditor(partitionDimensions, "Partition Dimensions Bar Chart"); //$NON-NLS-1$ |
|
91 | 89 |
|
92 |
final ChartEditorPart editor = ChartEditorPart.openEditor(partitionDimensions); //$NON-NLS-1$ |
|
93 |
|
|
94 | 90 |
// FIXME: Pie chart tests |
95 |
//final ChartEditorPart editor2 = SWTChartsComponentsProvider.getCurrent().openEditor(partitionDimensions, "Partition Dimensions Pie Chart"); |
|
96 |
|
|
91 |
// partitionDimensions.setChartType("Partition Dimensions Pie Chart"); //$NON-NLS-1$ |
|
97 | 92 |
|
98 |
|
|
93 |
ChartEditorPart.compute(partitionDimensions); //$NON-NLS-1$ |
|
94 |
|
|
99 | 95 |
return null; |
100 | 96 |
} |
101 | 97 |
|
tmp/org.txm.partition.rcp/META-INF/MANIFEST.MF (revision 537) | ||
---|---|---|
3 | 3 |
Bundle-Name: %Bundle-Name |
4 | 4 |
Bundle-SymbolicName: org.txm.partition.rcp;singleton:=true |
5 | 5 |
Bundle-Version: 1.0.0.qualifier |
6 |
Require-Bundle: org.txm.utils;bundle-version="1.0.0", |
|
6 |
Require-Bundle: org.txm.chartsengine.core, |
|
7 |
org.txm.utils;bundle-version="1.0.0", |
|
7 | 8 |
org.eclipse.osgi;bundle-version="3.10.2", |
8 | 9 |
org.eclipse.core.runtime;bundle-version="3.10.0", |
9 | 10 |
org.eclipse.ui, |
... | ... | |
12 | 13 |
org.txm.chartsengine.rcp, |
13 | 14 |
org.txm.partition.core, |
14 | 15 |
org.txm.rcp;bundle-version="0.7.8", |
15 |
org.txm.chartsengine.core, |
|
16 | 16 |
org.eclipse.core.expressions;bundle-version="3.4.600" |
17 | 17 |
Bundle-RequiredExecutionEnvironment: JavaSE-1.6 |
18 | 18 |
Bundle-ActivationPolicy: lazy |
tmp/org.txm.cooccurrence.core/src/org/txm/cooccurrence/core/functions/Cooccurrence.java (revision 537) | ||
---|---|---|
953 | 953 |
|
954 | 954 |
@Override |
955 | 955 |
public boolean setParameters(TXMParameters parameters) { |
956 |
this.parameters = parameters; |
|
957 | 956 |
try { |
958 | 957 |
Corpus corpus = this.getCorpus(); |
959 | 958 |
boolean includeXpivot = (Boolean) this.getBooleanParameterValue(CooccurrencePreferences.INCLUDE_X_PIVOT); |
960 |
Query query = new Query(this.parameters.get(CooccurrencePreferences.QUERY).toString());
|
|
959 |
Query query = new Query(parameters.get(CooccurrencePreferences.QUERY).toString()); |
|
961 | 960 |
|
962 | 961 |
StructuralUnit limit = corpus.getStructuralUnit(this.getStringParameterValue(CooccurrencePreferences.LIMIT)); |
963 | 962 |
|
964 |
List<Property> properties = (List<Property>)this.parameters.get(CooccurrencePreferences.PROPERTIES);
|
|
963 |
List<Property> properties = (List<Property>)parameters.get(CooccurrencePreferences.PROPERTIES); |
|
965 | 964 |
|
966 | 965 |
int maxLeft = this.getIntParameterValue(CooccurrencePreferences.MAX_LEFT); |
967 | 966 |
int minLeft = this.getIntParameterValue(CooccurrencePreferences.MIN_LEFT); |
tmp/org.txm.textsbalance.core/src/org/txm/textsbalance/core/functions/TextsBalance.java (revision 537) | ||
---|---|---|
60 | 60 |
this.fMax = 0; |
61 | 61 |
} |
62 | 62 |
|
63 |
|
|
64 |
// @Override |
|
65 |
// public void loadParameters() { |
|
66 |
// // TODO Auto-generated method stub |
|
67 |
// try { |
|
68 |
// StructuralUnit su = this.getCorpus().getStructuralUnit(this.getStringParameterValue(TextsBalancePreferences.STRUCTURAL_UNIT)); |
|
69 |
// String prop = su.getProperties().get(this.getIntParameterValue(TextsBalancePreferences.STRUCTURAL_UNIT_PROPERTY_INDEX)).getName(); |
|
70 |
// this.setParameters(this.getIntParameterValue(TextsBalancePreferences.METHOD), su, prop, this.getBooleanParameterValue(TextsBalancePreferences.GROUP_BY_WORDS)); |
|
71 |
// } |
|
72 |
// catch(CqiClientException e) { |
|
73 |
// // TODO Auto-generated catch block |
|
74 |
// e.printStackTrace(); |
|
75 |
// } |
|
76 |
// } |
|
77 |
|
|
78 |
/** |
|
79 |
* |
|
80 |
* @param method |
|
81 |
* @param su |
|
82 |
* @param suPropertyName |
|
83 |
* @param groupByTexts |
|
84 |
*/ |
|
85 |
public void setParameters(int method, StructuralUnit su, String suPropertyName, boolean groupByTexts) { |
|
86 |
this.su = su; |
|
87 |
this.suPropertyName = suPropertyName; |
|
88 |
this.groupByTexts = groupByTexts; |
|
89 |
this.method = method; |
|
90 |
|
|
91 |
this.setDirty(); |
|
92 |
this.setChartDirty(); |
|
93 |
} |
|
94 |
|
|
95 |
|
|
96 |
|
|
63 | 97 |
@Override |
64 | 98 |
public boolean setParameters(TXMParameters parameters) { |
65 |
this.parameters = parameters; |
|
66 | 99 |
try { |
67 | 100 |
StructuralUnit su = this.getCorpus().getStructuralUnit((String) parameters.get(TextsBalancePreferences.STRUCTURAL_UNIT)); |
68 | 101 |
int method = (Integer)parameters.get(TextsBalancePreferences.METHOD); |
... | ... | |
78 | 111 |
} |
79 | 112 |
return true; |
80 | 113 |
} |
81 |
|
|
82 |
public void setParameters(int method, StructuralUnit su, String suPropertyName, boolean groupByTexts) { |
|
83 |
this.su = su; |
|
84 |
this.suPropertyName = suPropertyName; |
|
85 |
this.groupByTexts = groupByTexts; |
|
86 |
this.method = method; |
|
87 |
} |
|
88 |
|
|
89 | 114 |
|
90 | 115 |
/** |
91 | 116 |
* @param method 1: use CQL to solve matches, 2 uses corpus struct indexes, 2 is faster ! |
... | ... | |
306 | 331 |
public boolean canCompute() { |
307 | 332 |
return getCorpus() != null; |
308 | 333 |
} |
334 |
|
|
335 |
|
|
309 | 336 |
} |
tmp/org.txm.ca.rcp/src/org/txm/ca/rcp/editors/CAEditor.java (revision 537) | ||
---|---|---|
326 | 326 |
|
327 | 327 |
// FIXME: need to create ChartResult for CASingularValues + some ChartCreators |
328 | 328 |
// Editor part |
329 |
EditorPart caSingularValuesEditorPart = new ChartEditorPart(SWTChartsComponentsProvider.getCurrent().createChartEditorInput(ca)); //$NON-NLS-1$ |
|
329 |
EditorPart caSingularValuesEditorPart = new ChartEditorPart(SWTChartsComponentsProvider.getCurrent().createChartEditorInput(ca, "Singular Values")); //$NON-NLS-1$
|
|
330 | 330 |
editors.add(caSingularValuesEditorPart); |
331 | 331 |
|
332 | 332 |
// Editor input |
tmp/org.txm.ca.rcp/.classpath (revision 537) | ||
---|---|---|
1 | 1 |
<?xml version="1.0" encoding="UTF-8"?> |
2 | 2 |
<classpath> |
3 | 3 |
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/> |
4 |
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"> |
|
5 |
<accessrules> |
|
6 |
<accessrule kind="accessible" pattern="*"/> |
|
7 |
</accessrules> |
|
8 |
</classpathentry> |
|
4 |
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> |
|
9 | 5 |
<classpathentry kind="src" path="src"/> |
10 | 6 |
<classpathentry kind="output" path="bin"/> |
11 | 7 |
</classpath> |
tmp/org.txm.core/src/java/org/txm/core/preferences/TXMPreferences.java (revision 537) | ||
---|---|---|
1078 | 1078 |
//FIXME: Debug |
1079 | 1079 |
System.err.println("TXMPreferences.putLocal(): error, can't find a put method that matches the value type: " + value.getClass() + "=" + value + "."); |
1080 | 1080 |
} |
1081 |
|
|
1081 | 1082 |
} |
1082 | 1083 |
|
1083 | 1084 |
private static void putLocalSerializable(TXMResult result, String key, Serializable value) { |
tmp/org.txm.core/src/java/org/txm/core/results/TXMResult.java (revision 537) | ||
---|---|---|
1 |
/** |
|
2 |
* |
|
3 |
*/ |
|
4 | 1 |
package org.txm.core.results; |
5 | 2 |
|
6 | 3 |
import java.io.File; |
... | ... | |
65 | 62 |
*/ |
66 | 63 |
protected boolean visible; |
67 | 64 |
|
68 |
protected TXMParameters parameters = null; |
|
69 |
|
|
70 | 65 |
/** |
71 | 66 |
* The command preferences node qualifier. |
72 | 67 |
*/ |
... | ... | |
92 | 87 |
* @param parent |
93 | 88 |
*/ |
94 | 89 |
public TXMResult(TXMResult parent) { |
95 |
this(parent, null); |
|
96 |
} |
|
97 |
|
|
98 |
/** |
|
99 |
* Creates a new TXMResult, child of the specified parent. |
|
100 |
* |
|
101 |
* @param parent |
|
102 |
* @param parameters |
|
103 |
*/ |
|
104 |
public TXMResult(TXMResult parent, TXMParameters parameters) { |
|
105 |
|
|
106 |
// FIXME: discuss about this method and validate it. Also discuss about |
|
107 |
// a getInternalName() method that should also return an unique ID. |
|
108 | 90 |
this.parent = parent; |
109 | 91 |
this.createUUID(); |
110 | 92 |
|
... | ... | |
115 | 97 |
} |
116 | 98 |
this.children = new ArrayList<TXMResult>(1); |
117 | 99 |
this.preferencesNodeQualifier = FrameworkUtil.getBundle(getClass()).getSymbolicName(); |
118 |
this.parameters = parameters; |
|
119 | 100 |
|
120 | 101 |
this.constructorCalled = true; // if not set the compute method will |
121 | 102 |
// always return false |
122 | 103 |
// FIXME: Debug |
123 | 104 |
// System.out.println("TXMResult.TXMResult(): default preferences node qualifier = " |
124 | 105 |
// + this.preferencesNodeQualifier + ", class = " + getClass()); |
106 |
|
|
107 |
this.dirty = true; |
|
125 | 108 |
} |
126 | 109 |
|
127 | 110 |
/** |
111 |
* Creates a new TXMResult, child of the specified parent. |
|
112 |
* |
|
113 |
* @param parent |
|
114 |
* @param parameters |
|
115 |
*/ |
|
116 |
public TXMResult(TXMResult parent, TXMParameters parameters) { |
|
117 |
|
|
118 |
} |
|
119 |
|
|
120 |
/** |
|
128 | 121 |
* Creates and stores an UUID dedicated to persistence for this result. |
129 | 122 |
*/ |
130 | 123 |
protected void createUUID() { |
... | ... | |
187 | 180 |
* @return |
188 | 181 |
*/ |
189 | 182 |
public int getIntParameterValue(String key) { |
190 |
return TXMPreferences.getInt(key, this.parameters, this, this.preferencesNodeQualifier);
|
|
183 |
return TXMPreferences.getInt(key, this, this.preferencesNodeQualifier); |
|
191 | 184 |
} |
192 | 185 |
|
193 | 186 |
/** |
... | ... | |
198 | 191 |
* @return |
199 | 192 |
*/ |
200 | 193 |
public float getFloatParameterValue(String key) { |
201 |
return TXMPreferences.getFloat(key, this.parameters, this, this.preferencesNodeQualifier);
|
|
194 |
return TXMPreferences.getFloat(key, this, this.preferencesNodeQualifier); |
|
202 | 195 |
} |
203 | 196 |
|
204 | 197 |
/** |
... | ... | |
209 | 202 |
* @return |
210 | 203 |
*/ |
211 | 204 |
public double getDoubleParameterValue(String key) { |
212 |
return TXMPreferences.getDouble(key, this.parameters, this, this.preferencesNodeQualifier);
|
|
205 |
return TXMPreferences.getDouble(key, this, this.preferencesNodeQualifier); |
|
213 | 206 |
} |
214 | 207 |
|
215 | 208 |
/** |
... | ... | |
220 | 213 |
* @return |
221 | 214 |
*/ |
222 | 215 |
public boolean getBooleanParameterValue(String key) { |
223 |
return TXMPreferences.getBoolean(key, this.parameters, this, this.preferencesNodeQualifier);
|
|
216 |
return TXMPreferences.getBoolean(key, this, this.preferencesNodeQualifier); |
|
224 | 217 |
} |
225 | 218 |
|
226 | 219 |
/** |
... | ... | |
231 | 224 |
* @return |
232 | 225 |
*/ |
233 | 226 |
public long getLongParameterValue(String key) { |
234 |
return TXMPreferences.getLong(key, this.parameters, this, this.preferencesNodeQualifier);
|
|
227 |
return TXMPreferences.getLong(key, this, this.preferencesNodeQualifier); |
|
235 | 228 |
} |
236 | 229 |
|
237 | 230 |
/** |
... | ... | |
242 | 235 |
* @return |
243 | 236 |
*/ |
244 | 237 |
public String getStringParameterValue(String key) { |
245 |
return TXMPreferences.getString(key, this.parameters, this, this.preferencesNodeQualifier);
|
|
238 |
return TXMPreferences.getString(key, this, this.preferencesNodeQualifier); |
|
246 | 239 |
} |
247 | 240 |
|
248 | 241 |
/** |
249 |
* Read the parameter stored in the Java class membres : the pXXXXX named |
|
250 |
* members |
|
242 |
* Copies the parameters stored in the Java class members : the pXXXXX named members to the local preferences node. |
|
243 |
* Commands must define this method to persist their parameters. |
|
244 |
* Just returns <b>true</b> if you don't want to bother with this. |
|
251 | 245 |
* |
252 |
* Commands must define this method to persist their parameters |
|
253 |
* |
|
254 |
* just return 'true' if you don't want to bother with this |
|
255 |
* |
|
256 | 246 |
* @return |
257 | 247 |
*/ |
258 | 248 |
public boolean saveParameters() { |
... | ... | |
288 | 278 |
this.parent = null; |
289 | 279 |
return true; |
290 | 280 |
} catch (NullPointerException e) { |
291 |
// do nothing |
|
281 |
// does nothing
|
|
292 | 282 |
} catch (Exception e) { |
293 | 283 |
e.printStackTrace(); |
294 | 284 |
} |
... | ... | |
727 | 717 |
// FIXME: Debug |
728 | 718 |
System.err.println("TXMResult.compute(): computing result of type " + this.getClass() + "..."); |
729 | 719 |
|
730 |
if (!hasBeenConstructorCalled()) { |
|
720 |
if(!this.isDirty()) { |
|
721 |
|
|
722 |
// FIXME: Debug |
|
723 |
System.err.println("TXMResult.compute(): result is not dirty, computing skipped."); |
|
724 |
|
|
725 |
return true; |
|
726 |
} |
|
727 |
|
|
728 |
|
|
729 |
if(!hasBeenConstructorCalled()) { |
|
731 | 730 |
return false; |
732 | 731 |
} |
733 | 732 |
|
734 | 733 |
if (!canCompute()) { |
734 |
// FIXME: Debug |
|
735 |
System.err.println("TXMResult.compute(): missing or wrong parameters, computing aborted."); |
|
736 |
|
|
735 | 737 |
return false; |
736 | 738 |
} |
737 | 739 |
|
738 | 740 |
if (!_compute(update)) { |
741 |
|
|
742 |
// FIXME: Debug |
|
743 |
System.err.println("TXMResult.compute(): computing failed."); |
|
744 |
|
|
739 | 745 |
return false; |
740 | 746 |
} |
741 | 747 |
|
... | ... | |
783 | 789 |
return constructorCalled; |
784 | 790 |
} |
785 | 791 |
|
786 |
// /** |
|
787 |
// * Copy the parameters from the local preference node if exists. Also |
|
788 |
// fills the non existent parameters with the command default preferences. |
|
789 |
// * @return |
|
790 |
// */ |
|
791 |
// public abstract boolean loadParameters(); |
|
792 |
|
|
793 | 792 |
/** |
793 |
* Copies the parameters from the local preference node if exists. Also fills the non existent parameters with the command default preferences. |
|
794 |
*/ |
|
795 |
//public abstract void loadParameters(); |
|
796 |
|
|
797 |
/** |
|
794 | 798 |
* |
795 | 799 |
* @return the array of extensions to show in the FileDialog SWT widget |
796 | 800 |
*/ |
tmp/org.txm.core/src/java/org/txm/objects/TxmObject.java (revision 537) | ||
---|---|---|
70 | 70 |
metadatas = new HashMap<String, Property>(); |
71 | 71 |
} |
72 | 72 |
|
73 |
|
|
73 | 74 |
/** |
74 | 75 |
* Gets the name. |
75 | 76 |
* |
tmp/org.txm.core/src/java/org/txm/objects/Partition.java (revision 537) | ||
---|---|---|
61 | 61 |
return false; |
62 | 62 |
} |
63 | 63 |
|
64 |
|
|
65 |
|
|
64 | 66 |
} |
tmp/org.txm.progression.rcp/src/org/txm/progression/rcp/editors/___ProgressionEditorInput.java (revision 537) | ||
---|---|---|
1 |
// Copyright © 2010-2013 ENS de Lyon. |
|
2 |
// Copyright © 2007-2010 ENS de Lyon, CNRS, INRP, University of |
|
3 |
// Lyon 2, University of Franche-Comté, University of Nice |
|
4 |
// Sophia Antipolis, University of Paris 3. |
|
5 |
// |
|
6 |
// The TXM platform is free software: you can redistribute it |
|
7 |
// and/or modify it under the terms of the GNU General Public |
|
8 |
// License as published by the Free Software Foundation, |
|
9 |
// either version 2 of the License, or (at your option) any |
|
10 |
// later version. |
|
11 |
// |
|
12 |
// The TXM platform is distributed in the hope that it will be |
|
13 |
// useful, but WITHOUT ANY WARRANTY; without even the implied |
|
14 |
// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR |
|
15 |
// PURPOSE. See the GNU General Public License for more |
|
16 |
// details. |
|
17 |
// |
|
18 |
// You should have received a copy of the GNU General |
|
19 |
// Public License along with the TXM platform. If not, see |
|
20 |
// http://www.gnu.org/licenses. |
|
21 |
// |
|
22 |
// |
|
23 |
// |
|
24 |
// $LastChangedDate:$ |
|
25 |
// $LastChangedRevision:$ |
|
26 |
// $LastChangedBy:$ |
|
27 |
// |
|
28 |
package org.txm.progression.rcp.editors; |
|
29 |
|
|
30 |
import org.eclipse.jface.resource.ImageDescriptor; |
|
31 |
import org.eclipse.ui.IEditorInput; |
|
32 |
import org.eclipse.ui.IPersistableElement; |
|
33 |
import org.eclipse.ui.plugin.AbstractUIPlugin; |
|
34 |
import org.txm.progression.core.functions.Progression; |
|
35 |
import org.txm.rcp.Application; |
|
36 |
import org.txm.rcp.IImageKeys; |
|
37 |
import org.txm.rcp.RCPMessages; |
|
38 |
// TODO: Auto-generated Javadoc |
|
39 |
/** |
|
40 |
* The Class ProgressionEditorInput. |
|
41 |
* |
|
42 |
* @author mdecorde |
|
43 |
*/ |
|
44 |
public class ___ProgressionEditorInput implements IEditorInput { |
|
45 |
|
|
46 |
/** The progression. */ |
|
47 |
private Progression progression; |
|
48 |
|
|
49 |
/** |
|
50 |
* Instantiates a new progression editor input. |
|
51 |
* |
|
52 |
* @param progression the progression |
|
53 |
*/ |
|
54 |
public ___ProgressionEditorInput(Progression progression) { |
|
55 |
super(); |
|
56 |
this.progression = progression; |
|
57 |
} |
|
58 |
|
|
59 |
/** |
|
60 |
* Exists. |
|
61 |
* |
|
62 |
* @return true, if successful |
|
63 |
* @see org.eclipse.ui.IEditorInput#exists() |
|
64 |
*/ |
|
65 |
@Override |
|
66 |
public boolean exists() { |
|
67 |
return false; |
|
68 |
} |
|
69 |
|
|
70 |
/** |
|
71 |
* Gets the image descriptor. |
|
72 |
* |
|
73 |
* @return the image descriptor |
|
74 |
* @see org.eclipse.ui.IEditorInput#getImageDescriptor() |
|
75 |
*/ |
|
76 |
@Override |
|
77 |
public ImageDescriptor getImageDescriptor() { |
|
78 |
return AbstractUIPlugin.imageDescriptorFromPlugin( |
|
79 |
Application.PLUGIN_ID, IImageKeys.ACTION_PROGRESSION); |
|
80 |
} |
|
81 |
|
|
82 |
/** |
|
83 |
* Gets the name. |
|
84 |
* |
|
85 |
* @return the name |
|
86 |
* @see org.eclipse.ui.IEditorInput#getName() |
|
87 |
*/ |
|
88 |
@Override |
|
89 |
public String getName() { |
|
90 |
return RCPMessages.ProgressionEditorInput_0; |
|
91 |
} |
|
92 |
|
|
93 |
/** |
|
94 |
* Gets the persistable. |
|
95 |
* |
|
96 |
* @return the persistable |
|
97 |
* @see org.eclipse.ui.IEditorInput#getPersistable() |
|
98 |
*/ |
|
99 |
@Override |
|
100 |
public IPersistableElement getPersistable() { |
|
101 |
return null; |
|
102 |
} |
|
103 |
|
|
104 |
/** |
|
105 |
* Gets the tool tip text. |
|
106 |
* |
|
107 |
* @return the tool tip text |
|
108 |
* @see org.eclipse.ui.IEditorInput#getToolTipText() |
|
109 |
*/ |
|
110 |
@Override |
|
111 |
public String getToolTipText() { |
|
112 |
return this.progression.getQueries().toString(); |
|
113 |
} |
|
114 |
|
|
115 |
/** |
|
116 |
* Gets the adapter. |
|
117 |
* |
|
118 |
* @param arg0 the arg0 |
|
119 |
* @return the adapter |
|
120 |
* @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class) |
|
121 |
*/ |
|
122 |
@Override |
|
123 |
@SuppressWarnings("unchecked") //$NON-NLS-1$ |
|
124 |
public Object getAdapter(Class arg0) { |
|
125 |
return null; |
|
126 |
} |
|
127 |
|
|
128 |
/** |
|
129 |
* Gets the progression. |
|
130 |
* |
|
131 |
* @return the progression |
|
132 |
*/ |
|
133 |
public Progression getProgression() { |
|
134 |
return progression; |
|
135 |
} |
|
136 |
} |
tmp/org.txm.progression.rcp/src/org/txm/progression/rcp/editors/ProgressionEditor.java (revision 537) | ||
---|---|---|
3 | 3 |
*/ |
4 | 4 |
package org.txm.progression.rcp.editors; |
5 | 5 |
|
6 |
import java.util.ArrayList; |
|
7 |
import java.util.List; |
|
8 |
import java.util.regex.Pattern; |
|
9 |
import java.util.regex.PatternSyntaxException; |
|
10 |
|
|
6 | 11 |
import org.eclipse.swt.SWT; |
12 |
import org.eclipse.swt.custom.ScrolledComposite; |
|
13 |
import org.eclipse.swt.events.SelectionEvent; |
|
14 |
import org.eclipse.swt.events.SelectionListener; |
|
15 |
import org.eclipse.swt.layout.FormAttachment; |
|
16 |
import org.eclipse.swt.layout.FormData; |
|
17 |
import org.eclipse.swt.layout.FormLayout; |
|
18 |
import org.eclipse.swt.layout.GridData; |
|
19 |
import org.eclipse.swt.layout.GridLayout; |
|
20 |
import org.eclipse.swt.widgets.Button; |
|
21 |
import org.eclipse.swt.widgets.Combo; |
|
7 | 22 |
import org.eclipse.swt.widgets.Composite; |
23 |
import org.eclipse.swt.widgets.Event; |
|
24 |
import org.eclipse.swt.widgets.Group; |
|
25 |
import org.eclipse.swt.widgets.Label; |
|
26 |
import org.eclipse.swt.widgets.Listener; |
|
27 |
import org.eclipse.swt.widgets.Text; |
|
28 |
import org.txm.chartsengine.r.core.themes.DefaultTheme; |
|
8 | 29 |
import org.txm.chartsengine.rcp.editors.ChartEditorPart; |
9 |
import org.txm.progression.rcp.forms.ProgressionParametersComposite; |
|
30 |
import org.txm.core.messages.TXMCoreMessages; |
|
31 |
import org.txm.progression.core.functions.Progression; |
|
32 |
import org.txm.progression.core.preferences.ProgressionPreferences; |
|
33 |
import org.txm.progression.rcp.dialogs.ProgressionDialog; |
|
34 |
import org.txm.rcp.RCPMessages; |
|
35 |
import org.txm.rcp.StatusLine; |
|
36 |
import org.txm.rcp.swt.widget.AssistedQueryWidget; |
|
37 |
import org.txm.searchengine.cqp.corpus.Corpus; |
|
38 |
import org.txm.searchengine.cqp.corpus.StructuralUnit; |
|
39 |
import org.txm.searchengine.cqp.corpus.StructuralUnitProperty; |
|
40 |
import org.txm.searchengine.cqp.corpus.query.Query; |
|
41 |
import org.txm.utils.logger.Log; |
|
10 | 42 |
|
11 | 43 |
/** |
12 | 44 |
* Progression command chart editor. |
... | ... | |
14 | 46 |
* |
15 | 47 |
*/ |
16 | 48 |
public class ProgressionEditor extends ChartEditorPart { |
49 |
|
|
17 | 50 |
|
51 |
/** The query widgets. */ |
|
52 |
protected List<AssistedQueryWidget> queryWidgets = new ArrayList<AssistedQueryWidget>(); |
|
53 |
|
|
54 |
/** The queries. */ |
|
55 |
List<Query> queries; |
|
56 |
|
|
57 |
/** The corpus. */ |
|
58 |
private Corpus corpus; |
|
59 |
|
|
60 |
/** The selected structural unit. */ |
|
61 |
private StructuralUnit selectedStructuralUnit; |
|
62 |
|
|
63 |
/** The selected structural unit property. */ |
|
64 |
private StructuralUnitProperty selectedStructuralUnitProperty; |
|
65 |
|
|
66 |
/** The regexproperty value. */ |
|
67 |
private String regexpropertyValue; |
|
68 |
|
|
69 |
/** The graphtype. */ |
|
70 |
private boolean cumulative = true; |
|
71 |
|
|
72 |
private boolean blackAndWhite = true; |
|
73 |
|
|
74 |
/** The monostyle. */ |
|
75 |
private boolean monostyle = true; |
|
76 |
|
|
77 |
/** The repeatvalues. */ |
|
78 |
private boolean repeatvalues = false; |
|
79 |
|
|
80 |
/** The linewidth. */ |
|
81 |
private int linewidth = 2; |
|
82 |
|
|
83 |
/** The bandemultiplier. */ |
|
84 |
private float bandemultiplier = 2; |
|
85 |
|
|
86 |
|
|
87 |
/** The structural units combo. */ |
|
88 |
Combo structuralUnitsCombo; |
|
89 |
|
|
90 |
/** The structural units. */ |
|
91 |
List<StructuralUnit> structuralUnits; |
|
92 |
|
|
93 |
/** The structural units properties. */ |
|
94 |
List<StructuralUnitProperty> structuralUnitsProperties; |
|
95 |
|
|
96 |
/** The property combo. */ |
|
97 |
private Combo propertyCombo; |
|
98 |
|
|
99 |
/** The regex value. */ |
|
100 |
private Text regexValue; |
|
101 |
|
|
102 |
/** The focus composite. */ |
|
103 |
Composite queriesFocusComposite; |
|
104 |
|
|
105 |
/** The main panel. */ |
|
106 |
Composite mainPanel; |
|
107 |
|
|
108 |
/** The bande field. */ |
|
109 |
Text bandeField; |
|
110 |
|
|
111 |
/** The cumu button. */ |
|
112 |
Button cumuButton; |
|
113 |
|
|
114 |
/** The repeat button. */ |
|
115 |
Button repeatButton; |
|
116 |
|
|
117 |
/** The style button. */ |
|
118 |
Button styleButton; |
|
119 |
|
|
120 |
/** The colors. */ |
|
121 |
String[] colors = DefaultTheme.colors; |
|
122 |
|
|
123 |
/** The self. */ |
|
124 |
ProgressionDialog self; |
|
125 |
|
|
126 |
/** The parent. */ |
|
127 |
private Composite parent; |
|
128 |
|
|
129 |
private ScrolledComposite sc1; |
|
130 |
|
|
131 |
|
|
18 | 132 |
@Override |
19 | 133 |
public void createPartControl(Composite parent) { |
20 | 134 |
super.createPartControl(parent); |
21 | 135 |
|
22 | 136 |
|
23 | 137 |
// FIXME: tests parameters composite extension |
24 |
new ProgressionParametersComposite(this.getCommandParametersGroup(), SWT.NONE); |
|
25 |
this.getCommandParametersGroup().pack(); |
|
138 |
// new ProgressionParametersComposite(this.getCommandParametersGroup(), SWT.NONE);
|
|
139 |
// this.getCommandParametersGroup().pack();
|
|
26 | 140 |
|
27 | 141 |
// FIXME: tests to use Fields editor and ScopedPreferenceStore for command parameters |
28 | 142 |
// BooleanFieldEditor field = new BooleanFieldEditor(ChartsEnginePreferences.SHOW_TITLE, "test2 show title store", editor.getParametersComposite()); |
... | ... | |
60 | 174 |
// sendToCoorccurrence.setImage(IImageKeys.getImage(IImageKeys.ACTION_COOCCURRENCE)); |
61 | 175 |
// sendToCoorccurrence.addSelectionListener(new ProgressionSelectionListener(editor, BaseSelectionListener.SEND_TO_COOCCURRENCE)); |
62 | 176 |
// //***************************************************** |
177 |
|
|
63 | 178 |
|
179 |
try { |
|
180 |
|
|
181 |
monostyle = this.getBooleanParameterValue(ProgressionPreferences.CHART_MONO_STYLE); |
|
182 |
cumulative = this.getBooleanParameterValue(ProgressionPreferences.CHART_CUMULATIVE); |
|
183 |
repeatvalues = this.getBooleanParameterValue(ProgressionPreferences.CHART_REPEAT_VALUES); |
|
184 |
bandemultiplier = this.getFloatParameterValue(ProgressionPreferences.CHART_BANDE_MULTIPLIER); |
|
185 |
|
|
186 |
// System.out.println(parent.getLayout()); |
|
187 |
FormLayout mainlayout = new FormLayout(); |
|
188 |
Composite mainPanel = this.getCommandParametersGroup(); |
|
189 |
mainPanel.setLayout(mainlayout); |
|
190 |
GridData gridData = new GridData(GridData.FILL, GridData.FILL, true, true); |
|
191 |
mainPanel.setLayoutData(gridData); |
|
192 |
|
|
193 |
Composite paramPanel = new Composite(mainPanel, SWT.NONE); |
|
194 |
|
|
195 |
FormData paramPanelData = new FormData(); |
|
196 |
paramPanelData.top = new FormAttachment(0); |
|
197 |
paramPanelData.left = new FormAttachment(0); |
|
198 |
paramPanelData.right = new FormAttachment(100); |
|
199 |
paramPanel.setLayoutData(paramPanelData); |
|
200 |
|
|
201 |
|
|
202 |
paramPanel.setLayout(new GridLayout(3, true)); |
|
203 |
|
|
204 |
// controls |
|
205 |
// graph param |
|
206 |
Label typeLabel = new Label(paramPanel, SWT.NONE); |
|
207 |
typeLabel.setText(RCPMessages.ProgressionDialog_1); |
|
208 |
typeLabel.setAlignment(SWT.CENTER); |
|
209 |
|
|
210 |
cumuButton = new Button(paramPanel, SWT.RADIO); |
|
211 |
cumuButton.setText(RCPMessages.ProgressionDialog_2); |
|
212 |
cumuButton.setSelection(cumulative); |
|
213 |
|
|
214 |
Button densityButton = new Button(paramPanel, SWT.RADIO); |
|
215 |
densityButton.setText(RCPMessages.ProgressionDialog_3); |
|
216 |
densityButton.setSelection(!cumulative); |
|
217 |
|
|
218 |
//Bande size |
|
219 |
typeLabel = new Label(paramPanel, SWT.NONE); |
|
220 |
typeLabel.setText(RCPMessages.ProgressionDialog_11); |
|
221 |
typeLabel.setAlignment(SWT.CENTER); |
|
222 |
|
|
223 |
bandeField = new Text(paramPanel, SWT.BORDER); |
|
224 |
bandeField.setText("" + bandemultiplier); //$NON-NLS-1$ |
|
225 |
bandeField.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true, 2, 1)); |
|
226 |
|
|
227 |
// Structural units |
|
228 |
// Group displayParam = new Group(paramPanel, SWT.BORDER); |
|
229 |
// displayParam.setText(RCPMessages.ProgressionDialog_13); |
|
230 |
// displayParam.setLayout(new GridLayout(3, true)); |
|
231 |
// displayParam.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true, 3, 1)); |
|
232 |
|
|
233 |
Label structLabel = new Label(paramPanel, SWT.NONE); |
|
234 |
structLabel.setText(RCPMessages.ProgressionDialog_4); |
|
235 |
structLabel.setAlignment(SWT.CENTER); |
|
236 |
|
|
237 |
structuralUnitsCombo = new Combo(paramPanel, SWT.READ_ONLY); |
|
238 |
structuralUnitsCombo.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true, 2, 1)); |
|
239 |
|
|
240 |
structuralUnitsCombo.addSelectionListener(new SelectionListener() { |
|
241 |
@Override |
|
242 |
public void widgetDefaultSelected(SelectionEvent e) { |
|
243 |
} |
|
244 |
|
|
245 |
@Override |
|
246 |
public void widgetSelected(SelectionEvent event) { |
|
247 |
getSite().getShell().getDisplay().syncExec(new Runnable() { |
|
248 |
@Override |
|
249 |
public void run() { |
|
250 |
reloadSUProperties(); |
|
251 |
getResultData().setStructuralUnit(structuralUnits.get(structuralUnitsCombo.getSelectionIndex() - 1)); |
|
252 |
getResultData().setDirty(); |
|
253 |
computeChart(true); |
|
254 |
} |
|
255 |
}); |
|
256 |
} |
|
257 |
}); |
|
258 |
|
|
259 |
|
|
260 |
int selectedSUIndex = 0; |
|
261 |
// get |
|
262 |
try { |
|
263 |
structuralUnitsCombo.add(" "); //$NON-NLS-1$ |
|
264 |
structuralUnits = this.getResultData().getCorpus().getOrderedStructuralUnits(); |
|
265 |
for(int i = 0; i < structuralUnits.size(); i++) { |
|
266 |
structuralUnitsCombo.add(structuralUnits.get(i).getName()); |
|
267 |
if(getResultData().getStructure() == structuralUnits.get(i)) { |
|
268 |
selectedSUIndex = (i + 1); |
|
269 |
} |
|
270 |
} |
|
271 |
} catch (Exception e) { |
|
272 |
Log.severe(RCPMessages.ObjectExplorer_9 + Log.toString(e)); |
|
273 |
e.printStackTrace(); |
|
274 |
} |
|
275 |
structuralUnitsCombo.select(selectedSUIndex); |
|
276 |
|
|
277 |
// Structural unit properties |
|
278 |
Label propLabel = new Label(paramPanel, SWT.NONE); |
|
279 |
propLabel.setText(TXMCoreMessages.PROPERTY_1); |
|
280 |
propLabel.setAlignment(SWT.CENTER); |
|
281 |
|
|
282 |
propertyCombo = new Combo(paramPanel, SWT.READ_ONLY); |
|
283 |
propertyCombo.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true, 2, 1)); |
|
284 |
reloadSUProperties(); |
|
285 |
|
|
286 |
propertyCombo.addSelectionListener(new SelectionListener() { |
|
287 |
@Override |
|
288 |
public void widgetDefaultSelected(SelectionEvent e) { |
|
289 |
} |
|
290 |
|
|
291 |
@Override |
|
292 |
public void widgetSelected(SelectionEvent event) { |
|
293 |
getSite().getShell().getDisplay().syncExec(new Runnable() { |
|
294 |
@Override |
|
295 |
public void run() { |
|
296 |
getResultData().setStructuralUnitProperty(structuralUnitsProperties.get(propertyCombo.getSelectionIndex() - 1)); |
|
297 |
getResultData().setDirty(); |
|
298 |
computeChart(true); |
|
299 |
} |
|
300 |
}); |
|
301 |
} |
|
302 |
}); |
|
303 |
|
|
304 |
|
|
305 |
|
|
306 |
// property value field |
|
307 |
Label regexLabel = new Label(paramPanel, SWT.NONE); |
|
308 |
regexLabel.setText(RCPMessages.ProgressionDialog_7); |
|
309 |
regexLabel.setAlignment(SWT.CENTER); |
|
310 |
|
|
311 |
regexValue = new Text(paramPanel, SWT.SINGLE | SWT.BORDER); |
|
312 |
regexValue.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true, 2, 1)); |
|
313 |
if(this.getResultData().getPropertyRegex() != null) { |
|
314 |
regexValue.setText(getResultData().getPropertyRegex()); |
|
315 |
} |
|
316 |
|
|
317 |
//spacer |
|
318 |
styleButton = new Button(paramPanel, SWT.CHECK); |
|
319 |
styleButton.setText(RCPMessages.ProgressionDialog_14); |
|
320 |
styleButton.setSelection(monostyle); |
|
321 |
|
|
322 |
//Repeat options |
|
323 |
repeatButton = new Button(paramPanel, SWT.CHECK); |
|
324 |
repeatButton.setText(RCPMessages.ProgressionDialog_15); |
|
325 |
repeatButton.setSelection(repeatvalues); |
|
326 |
|
|
327 |
|
|
328 |
|
|
329 |
// Queries |
|
330 |
sc1 = new ScrolledComposite(mainPanel, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER); |
|
331 |
sc1.setLayout(new GridLayout(1, true)); |
|
332 |
sc1.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true)); |
|
333 |
sc1.setExpandHorizontal(true); |
|
334 |
sc1.setExpandVertical(true); |
|
335 |
sc1.setMinSize(0, 120); |
|
336 |
|
|
337 |
FormData queriesPanelData = new FormData(); |
|
338 |
queriesPanelData.top = new FormAttachment(paramPanel); |
|
339 |
queriesPanelData.left = new FormAttachment(0); |
|
340 |
queriesPanelData.right = new FormAttachment(100); |
|
341 |
queriesPanelData.bottom = new FormAttachment(100); |
|
342 |
sc1.setLayoutData(queriesPanelData); |
|
343 |
|
|
344 |
queriesFocusComposite = new Composite(sc1, SWT.NONE); |
|
345 |
queriesFocusComposite.setLayout(new GridLayout(1, true)); |
|
346 |
sc1.setContent(queriesFocusComposite); |
|
347 |
|
|
348 |
// queries parameters |
|
349 |
Label focusLabel = new Label(queriesFocusComposite, SWT.NONE); |
|
350 |
focusLabel.setText(RCPMessages.ProgressionDialog_8); |
|
351 |
focusLabel.setAlignment(SWT.CENTER); |
|
352 |
|
|
353 |
// add query button |
|
354 |
Button plusButton = new Button(queriesFocusComposite, SWT.NONE); |
|
355 |
plusButton.setLayoutData(new GridData(GridData.FILL, GridData.FILL, |
|
356 |
true, true)); |
|
357 |
plusButton.setText(RCPMessages.ProgressionDialog_9); |
|
358 |
|
|
359 |
plusButton.addListener(SWT.Selection, new Listener() { |
|
360 |
@Override |
|
361 |
public void handleEvent(Event event) { |
|
362 |
if (colors.length > queryWidgets.size()) { |
|
363 |
Log.info("add query field"); |
|
364 |
addFocusQueryField(); |
|
365 |
sc1.layout(true); |
|
366 |
queriesFocusComposite.layout(true); |
|
367 |
sc1.setMinSize(queriesFocusComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT)); |
|
368 |
} |
|
369 |
} |
|
370 |
}); |
|
371 |
|
|
372 |
// delete query button |
|
373 |
Button minusButton = new Button(queriesFocusComposite, SWT.NONE); |
|
374 |
minusButton.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true)); |
|
375 |
minusButton.setText(RCPMessages.ProgressionDialog_5); |
|
376 |
minusButton.addListener(SWT.Selection, new Listener() { |
|
377 |
@Override |
|
378 |
public void handleEvent(Event event) { |
|
379 |
if (queryWidgets.size() > 0) { |
|
380 |
// System.out.println("remove field"); |
|
381 |
AssistedQueryWidget lastwidget = queryWidgets.get(queryWidgets.size() - 1); |
|
382 |
lastwidget.setSize(200, 30); |
|
383 |
queryWidgets.remove(queryWidgets.size() - 1); |
|
384 |
lastwidget.dispose(); |
|
385 |
sc1.layout(true); |
|
386 |
queriesFocusComposite.layout(true); |
|
387 |
sc1.setMinSize(queriesFocusComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT)); |
|
388 |
} |
|
389 |
} |
|
390 |
}); |
|
391 |
|
|
392 |
// fill fields from result data |
|
393 |
queries = this.getResultData().getQueries(); |
|
394 |
if (queries == null) { |
|
395 |
addFocusQueryField(); |
|
396 |
} |
|
397 |
else { |
|
398 |
for (Query q : queries) { |
|
399 |
addFocusQueryField().setText(q.getQueryString()); |
|
400 |
} |
|
401 |
} |
|
402 |
|
|
403 |
|
|
404 |
// Compute button |
|
405 |
Button computeButton = new Button(paramPanel, SWT.NONE); |
|
406 |
computeButton.setText("Compute"); |
|
407 |
computeButton.addSelectionListener(new SelectionListener() { |
|
408 |
|
|
409 |
@Override |
|
410 |
public void widgetSelected(SelectionEvent evt) { |
|
411 |
// TODO Auto-generated method stub |
|
412 |
queries = new ArrayList<Query>(); |
|
413 |
for (AssistedQueryWidget wid : queryWidgets) { |
|
414 |
if (!wid.getQueryString().equals("\"\"")) { //$NON-NLS-1$ |
|
415 |
queries.add(new Query(wid.getQueryString())); |
|
416 |
wid.memorize(); |
|
417 |
} |
|
418 |
} |
|
419 |
|
|
420 |
if (propertyCombo.getSelectionIndex() > 0) { |
|
421 |
selectedStructuralUnitProperty = structuralUnitsProperties.get(propertyCombo.getSelectionIndex() - 1); |
|
422 |
} |
|
423 |
else { |
|
424 |
selectedStructuralUnitProperty = null; |
|
425 |
} |
|
426 |
if (structuralUnitsCombo.getSelectionIndex() > 0) { |
|
427 |
selectedStructuralUnit = structuralUnits.get(structuralUnitsCombo.getSelectionIndex() - 1); |
|
428 |
} |
|
429 |
else { |
|
430 |
selectedStructuralUnit = null; |
|
431 |
selectedStructuralUnitProperty = null;// need a structuralunit |
|
432 |
} |
|
433 |
|
|
434 |
try { |
|
435 |
Pattern.compile(regexValue.getText()); |
|
436 |
regexpropertyValue = regexValue.getText(); |
|
437 |
|
|
438 |
if (regexpropertyValue.length() == 0) { |
|
439 |
regexpropertyValue = null; |
|
440 |
} |
|
441 |
} catch (PatternSyntaxException e) { |
|
442 |
System.out.println(RCPMessages.ProgressionDialog_10 + e); |
|
443 |
} |
|
444 |
|
|
445 |
cumulative = cumuButton.getSelection(); |
|
446 |
monostyle = styleButton.getSelection(); |
|
447 |
repeatvalues = repeatButton.getSelection(); |
|
448 |
String smultibande = bandeField.getText(); |
|
449 |
if (smultibande != null && smultibande.length() > 0) { |
|
450 |
try { |
|
451 |
bandemultiplier = Float.parseFloat(smultibande); |
|
452 |
} catch(Exception e) { |
|
453 |
bandemultiplier = 1.0f; |
|
454 |
System.out.println(RCPMessages.ProgressionDialog_17+e); |
|
455 |
StatusLine.error(RCPMessages.ProgressionDialog_17+e); |
|
456 |
} |
|
457 |
} |
|
458 |
else { |
|
459 |
bandemultiplier = 1.0f; |
|
460 |
} |
|
461 |
|
|
462 |
((Progression)getResultData()).setParameters(queries, selectedStructuralUnit, selectedStructuralUnitProperty, regexpropertyValue, cumulative, linewidth, repeatvalues, bandemultiplier); |
|
463 |
computeChart(false); |
|
464 |
|
|
465 |
} |
|
466 |
|
|
467 |
@Override |
|
468 |
public void widgetDefaultSelected(SelectionEvent e) { |
|
469 |
// TODO Auto-generated method stub |
|
470 |
|
|
471 |
} |
|
472 |
}); |
|
473 |
|
|
474 |
} catch (Exception e) { |
|
475 |
Log.printStackTrace(e); |
|
476 |
} |
|
477 |
|
|
478 |
|
|
64 | 479 |
} |
65 | 480 |
|
481 |
/** |
|
482 |
* Reloads the properties of the current selected structural unit. |
|
483 |
*/ |
|
484 |
private void reloadSUProperties() { |
|
485 |
|
|
486 |
propertyCombo.removeAll(); |
|
487 |
propertyCombo.add(" "); //$NON-NLS-1$ |
|
488 |
|
|
489 |
int selectedSUPIndex = 0; |
|
490 |
|
|
491 |
if (structuralUnitsCombo.getSelectionIndex() > 0) { |
|
492 |
selectedStructuralUnit = structuralUnits.get(structuralUnitsCombo.getSelectionIndex() - 1); |
|
493 |
structuralUnitsProperties = selectedStructuralUnit.getOrderedProperties(); |
|
494 |
|
|
495 |
for(int i = 0; i < structuralUnitsProperties.size(); i++) { |
|
496 |
propertyCombo.add(structuralUnitsProperties.get(i).getName()); |
|
497 |
if(getResultData().getProperty() == structuralUnitsProperties.get(i)) { |
|
498 |
selectedSUPIndex = (i + 1); |
|
499 |
} |
|
500 |
} |
|
501 |
} |
|
502 |
if (propertyCombo.getItemCount() > 0) { |
|
503 |
propertyCombo.select(selectedSUPIndex); |
|
504 |
} |
|
505 |
} |
|
506 |
|
|
507 |
/** |
|
508 |
* Adds a query field. |
|
509 |
* |
|
510 |
* @return the assisted query widget |
|
511 |
*/ |
|
512 |
private AssistedQueryWidget addFocusQueryField(String text) { |
|
513 |
AssistedQueryWidget focusTextBox = new AssistedQueryWidget(queriesFocusComposite, SWT.BORDER, this.getResultData().getCorpus()); |
|
514 |
GridData gridData = new GridData(GridData.FILL, GridData.FILL, true, false); |
|
515 |
focusTextBox.setLayoutData(gridData); |
|
516 |
focusTextBox.setFocus(); |
|
517 |
queryWidgets.add(focusTextBox); |
|
518 |
return focusTextBox; |
|
519 |
} |
|
520 |
|
|
521 |
/** |
|
522 |
* Adds an empty query field. |
|
523 |
* @return |
|
524 |
*/ |
|
525 |
private AssistedQueryWidget addFocusQueryField() { |
|
526 |
return this.addFocusQueryField(""); |
|
527 |
} |
|
528 |
|
|
529 |
|
|
530 |
@Override |
|
531 |
public Progression getResultData() { |
|
532 |
return (Progression) super.getResultData(); |
|
533 |
} |
|
66 | 534 |
} |
tmp/org.txm.progression.rcp/src/org/txm/progression/rcp/handlers/ComputeProgression.java (revision 537) | ||
---|---|---|
29 | 29 |
|
30 | 30 |
import org.eclipse.core.commands.ExecutionEvent; |
31 | 31 |
import org.eclipse.core.commands.ExecutionException; |
32 |
import org.eclipse.core.runtime.IProgressMonitor; |
|
33 |
import org.eclipse.core.runtime.IStatus; |
|
34 |
import org.eclipse.core.runtime.Status; |
|
35 |
import org.eclipse.core.runtime.jobs.Job; |
|
36 |
import org.eclipse.jface.window.Window; |
|
37 |
import org.eclipse.osgi.util.NLS; |
|
38 |
import org.eclipse.swt.widgets.Shell; |
|
39 |
import org.eclipse.ui.handlers.HandlerUtil; |
|
40 | 32 |
import org.txm.chartsengine.core.ChartsEngine; |
41 |
import org.txm.chartsengine.core.preferences.ChartsEnginePreferences; |
|
42 | 33 |
import org.txm.chartsengine.r.core.RChartsEngine; |
43 | 34 |
import org.txm.chartsengine.rcp.SWTChartsComponentsProvider; |
44 | 35 |
import org.txm.chartsengine.rcp.editors.ChartEditorPart; |
45 | 36 |
import org.txm.chartsengine.svgbatik.rcp.SVGSWTChartsComponentsProvider; |
46 |
import org.txm.core.preferences.TXMPreferences; |
|
47 | 37 |
import org.txm.progression.core.functions.Progression; |
48 | 38 |
import org.txm.progression.core.messages.ProgressionCoreMessages; |
49 | 39 |
import org.txm.progression.core.preferences.ProgressionPreferences; |
50 | 40 |
import org.txm.progression.rcp.dialogs.ProgressionDialog; |
51 |
import org.txm.rcp.JobsTimer; |
|
52 |
import org.txm.rcp.RCPMessages; |
|
53 |
import org.txm.rcp.StatusLine; |
|
54 | 41 |
import org.txm.rcp.handlers.BaseAbstractHandler; |
55 |
import org.txm.rcp.utils.JobHandler; |
|
56 | 42 |
import org.txm.rcp.views.corpora.CorporaView; |
57 |
import org.txm.searchengine.cqp.CQPEngine; |
|
58 | 43 |
import org.txm.searchengine.cqp.corpus.Corpus; |
59 | 44 |
import org.txm.utils.logger.Log; |
60 | 45 |
|
Formats disponibles : Unified diff