Révision 2720
tmp/org.txm.chartsengine.rcp/src/org/txm/chartsengine/rcp/preferences/ChartsEnginePreferencePage.java (revision 2720) | ||
---|---|---|
28 | 28 |
* |
29 | 29 |
*/ |
30 | 30 |
public class ChartsEnginePreferencePage extends TXMPreferencePage { |
31 |
|
|
31 |
|
|
32 | 32 |
/** |
33 | 33 |
* The charts engine selection combo box. |
34 | 34 |
*/ |
35 | 35 |
private ComboFieldEditor chartsEngineSelectionComboField; |
36 |
|
|
36 |
|
|
37 | 37 |
/** |
38 | 38 |
* The charts engine export formats selection combo box. |
39 | 39 |
*/ |
40 | 40 |
private ComboFieldEditor chartsEngineExportFormatsComboField; |
41 |
|
|
41 |
|
|
42 | 42 |
protected boolean charsEngineHasChanged = false; |
43 | 43 |
|
44 |
|
|
44 |
|
|
45 | 45 |
@Override |
46 | 46 |
protected void createFieldEditors() { |
47 |
|
|
47 |
|
|
48 | 48 |
// Charts engine selection |
49 | 49 |
String chartsEngines[][] = new String[ChartsEnginesManager.getInstance().size()][2]; |
50 | 50 |
|
... | ... | |
60 | 60 |
|
61 | 61 |
|
62 | 62 |
// FIXME: SJ: test to select the chart engine order rather than a exclusive one since the engines are not exclusive anymore, eg. some to create charts and other to create graphs |
63 |
// ListEditor listEditor = new ListEditor(ChartsEnginePreferences.CHARTS_ENGINES_ORDER, "Ordre de préférence des moteurs", this.getFieldEditorParent()) {
|
|
64 |
//
|
|
65 |
// @Override
|
|
66 |
// protected String[] parseString(String enginesOrder) {
|
|
67 |
// return ChartsEnginePreferences.getEnginesOrder(enginesOrder);
|
|
68 |
// }
|
|
69 |
//
|
|
70 |
// @Override
|
|
71 |
// protected String getNewInputObject() {
|
|
72 |
//// InputDialog dialog = new InputDialog(getShell(), "New Buildconfiguration", "Enter the name of the Buildconfiguration to add", "", null);
|
|
73 |
//// if (dialog.open() == InputDialog.OK) {
|
|
74 |
//// return dialog.getValue();
|
|
75 |
//// }
|
|
76 |
// return null;
|
|
77 |
// }
|
|
78 |
//
|
|
79 |
// @Override
|
|
80 |
// protected String createList(String[] engineNames) {
|
|
81 |
// return ChartsEnginePreferences.createEnginesOrder(engineNames);
|
|
82 |
// }
|
|
83 |
// };
|
|
84 |
//
|
|
85 |
// // default initialization
|
|
86 |
// if(!TXMPreferences.keyExists("/" + InstanceScope.SCOPE +"/" + ChartsEnginePreferences.getInstance().getPreferencesNodeQualifier(), ChartsEnginePreferences.CHARTS_ENGINES_ORDER)) {
|
|
87 |
// ChartsEnginePreferences.getInstance().put(ChartsEnginePreferences.CHARTS_ENGINES_ORDER, ChartsEnginesManager.getInstance().createEnginesOrder());
|
|
88 |
// }
|
|
89 |
//
|
|
90 |
// listEditor.setPreferenceName(ChartsEnginePreferences.CHARTS_ENGINES_ORDER);
|
|
91 |
// listEditor.load();
|
|
92 |
//
|
|
93 |
// // hide the "New" and "Remove" buttons
|
|
94 |
// listEditor.getButtonBoxControl(this.getFieldEditorParent()).getChildren()[0].setVisible(false);;
|
|
95 |
// listEditor.getButtonBoxControl(this.getFieldEditorParent()).getChildren()[1].setVisible(false);
|
|
96 |
// |
|
97 |
// this.addField(listEditor);
|
|
63 |
// ListEditor listEditor = new ListEditor(ChartsEnginePreferences.CHARTS_ENGINES_ORDER, "Ordre de préférence des moteurs", this.getFieldEditorParent()) {
|
|
64 |
//
|
|
65 |
// @Override
|
|
66 |
// protected String[] parseString(String enginesOrder) {
|
|
67 |
// return ChartsEnginePreferences.getEnginesOrder(enginesOrder);
|
|
68 |
// }
|
|
69 |
//
|
|
70 |
// @Override
|
|
71 |
// protected String getNewInputObject() {
|
|
72 |
//// InputDialog dialog = new InputDialog(getShell(), "New Buildconfiguration", "Enter the name of the Buildconfiguration to add", "", null);
|
|
73 |
//// if (dialog.open() == InputDialog.OK) {
|
|
74 |
//// return dialog.getValue();
|
|
75 |
//// }
|
|
76 |
// return null;
|
|
77 |
// }
|
|
78 |
//
|
|
79 |
// @Override
|
|
80 |
// protected String createList(String[] engineNames) {
|
|
81 |
// return ChartsEnginePreferences.createEnginesOrder(engineNames);
|
|
82 |
// }
|
|
83 |
// };
|
|
84 |
//
|
|
85 |
// // default initialization
|
|
86 |
// if(!TXMPreferences.keyExists("/" + InstanceScope.SCOPE +"/" + ChartsEnginePreferences.getInstance().getPreferencesNodeQualifier(), ChartsEnginePreferences.CHARTS_ENGINES_ORDER)) {
|
|
87 |
// ChartsEnginePreferences.getInstance().put(ChartsEnginePreferences.CHARTS_ENGINES_ORDER, ChartsEnginesManager.getInstance().createEnginesOrder());
|
|
88 |
// }
|
|
89 |
//
|
|
90 |
// listEditor.setPreferenceName(ChartsEnginePreferences.CHARTS_ENGINES_ORDER);
|
|
91 |
// listEditor.load();
|
|
92 |
//
|
|
93 |
// // hide the "New" and "Remove" buttons
|
|
94 |
// listEditor.getButtonBoxControl(this.getFieldEditorParent()).getChildren()[0].setVisible(false);;
|
|
95 |
// listEditor.getButtonBoxControl(this.getFieldEditorParent()).getChildren()[1].setVisible(false);
|
|
96 |
//
|
|
97 |
// this.addField(listEditor);
|
|
98 | 98 |
|
99 |
|
|
100 |
|
|
101 |
|
|
99 |
|
|
100 |
|
|
101 |
|
|
102 | 102 |
// current engine supported export formats |
103 |
this.createExportFormatComboField(ChartsEnginesManager.getInstance().getCurrentEngine());
|
|
104 |
|
|
105 |
|
|
103 |
this.createExportFormatComboField(ChartsEnginesManager.getInstance().getCurrentEngine());
|
|
104 |
|
|
105 |
|
|
106 | 106 |
// other shared preferences |
107 | 107 |
SWTChartsComponentsProvider.createChartsRenderingPreferencesFields(this, this.getFieldEditorParent()); |
108 | 108 |
|
... | ... | |
112 | 112 |
FontFieldEditor font = new FontFieldEditor(ChartsEnginePreferences.FONT, "Font", "Specificities / Spécificités / Специфичность", this.getFieldEditorParent()); //$NON-NLS-1$ //$NON-NLS-2$ |
113 | 113 |
this.addField(font); |
114 | 114 |
// FIXME: preview area tests |
115 |
//font.fillIntoGrid(this.getFieldEditorParent(), 4); |
|
116 |
//((Text)font.getPreviewControl()).setLayoutData(new GridData(GridData.FILL_BOTH)); |
|
117 |
//System.out.println("ChartsEnginePreferencePage.createFieldEditors() " + font.getPreviewControl()); |
|
115 |
// font.fillIntoGrid(this.getFieldEditorParent(), 4);
|
|
116 |
// ((Text)font.getPreviewControl()).setLayoutData(new GridData(GridData.FILL_BOTH));
|
|
117 |
// System.out.println("ChartsEnginePreferencePage.createFieldEditors() " + font.getPreviewControl());
|
|
118 | 118 |
|
119 | 119 |
|
120 | 120 |
} |
... | ... | |
124 | 124 |
* |
125 | 125 |
* @param engine |
126 | 126 |
*/ |
127 |
protected void createExportFormatComboField(ChartsEngine engine) { |
|
128 |
this.chartsEngineExportFormatsComboField = new ComboFieldEditor(ChartsEnginePreferences.DEFAULT_EXPORT_FORMAT, ChartsUIMessages.defaultExportFormat, ChartsEnginesManager.getExportFormatsEntryNamesAndValues(engine), this.getFieldEditorParent()); |
|
127 |
protected void createExportFormatComboField(ChartsEngine engine) { |
|
128 |
this.chartsEngineExportFormatsComboField = new ComboFieldEditor(ChartsEnginePreferences.DEFAULT_EXPORT_FORMAT, ChartsUIMessages.defaultExportFormat, ChartsEnginesManager |
|
129 |
.getExportFormatsEntryNamesAndValues(engine), this.getFieldEditorParent()); |
|
129 | 130 |
this.addField(this.chartsEngineExportFormatsComboField); |
130 | 131 |
} |
131 | 132 |
|
... | ... | |
133 | 134 |
@Override |
134 | 135 |
public void propertyChange(PropertyChangeEvent event) { |
135 | 136 |
super.propertyChange(event); |
136 |
|
|
137 |
|
|
137 | 138 |
// FIXME: SJ: test to try to update the Export formats combo box when changing of current charts engine |
138 | 139 |
// NOTE: SJ: warning, event.getProperty() seems bugged and does not return the correct property name but the string "field_value_editor" |
139 |
if(event.getSource() == this.chartsEngineSelectionComboField && !event.getNewValue().equals(event.getOldValue())) {
|
|
140 |
if (event.getSource() == this.chartsEngineSelectionComboField && !event.getNewValue().equals(event.getOldValue())) {
|
|
140 | 141 |
this.charsEngineHasChanged = true; |
141 |
// this.chartsEngineExportFormatsComboField.dispose();
|
|
142 |
// this.createExportFormatComboField(ChartsEnginesManager.getInstance().getEngine((String) event.getNewValue()));
|
|
143 |
// this.adjustGridLayout();
|
|
144 |
// this.getFieldEditorParent().layout();
|
|
142 |
// this.chartsEngineExportFormatsComboField.dispose();
|
|
143 |
// this.createExportFormatComboField(ChartsEnginesManager.getInstance().getEngine((String) event.getNewValue()));
|
|
144 |
// this.adjustGridLayout();
|
|
145 |
// this.getFieldEditorParent().layout();
|
|
145 | 146 |
} |
146 | 147 |
|
147 | 148 |
} |
148 | 149 |
|
149 |
|
|
150 | 150 |
|
151 |
|
|
151 | 152 |
@Override |
152 | 153 |
public void init(IWorkbench workbench) { |
153 | 154 |
this.setPreferenceStore(new TXMPreferenceStore(ChartsEnginePreferences.getInstance().getPreferencesNodeQualifier())); |
154 | 155 |
this.setDescription(ChartsUIMessages.thesePreferencesWillApplyToNewChartsPreviouslyCreatedChartsWillNotBeAffected); |
155 | 156 |
} |
156 |
|
|
157 |
|
|
157 | 158 |
@Override |
158 | 159 |
public boolean performOk() { |
159 |
|
|
160 |
|
|
160 | 161 |
super.performOk(); |
161 |
|
|
162 | 162 |
|
163 |
|
|
163 | 164 |
// Set the new monochrome color for all charts engine theme |
164 |
for(int i = 0; i < ChartsEngine.getChartsEngines().size(); i++) {
|
|
165 |
ChartsEngine.getChartsEngines().get(i).getTheme().setMonochromeColor(ChartsEnginePreferences.getInstance().getString(ChartsEnginePreferences.MONOCHROME_COLOR));
|
|
165 |
for (ChartsEngine engine : ChartsEnginesManager.getChartsEngines()) {
|
|
166 |
engine.getTheme().setMonochromeColor(ChartsEnginePreferences.getInstance().getString(ChartsEnginePreferences.MONOCHROME_COLOR));
|
|
166 | 167 |
} |
167 | 168 |
|
168 | 169 |
Log.info(ChartsUIMessages.recreatingChartsEngineAndSWTChartComponentsProvider); |
169 |
|
|
170 |
|
|
170 | 171 |
ChartsEnginesManager.getInstance().setCurrentEngine(this.getPreferenceStore().getString(ChartsEnginePreferences.CURRENT_NAME)); |
171 | 172 |
|
172 | 173 |
// Sets the new current charts SWT component provider according to the new current charts engine |
173 | 174 |
SWTChartsComponentsProvider.setCurrrentComponentsProvider(ChartsEnginesManager.getInstance().getCurrentEngine()); |
174 | 175 |
|
175 | 176 |
// Reset the default export format to the new current charts engine first supported export file format |
176 |
//ChartsEnginePreferences.getInstance().put(ChartsEnginePreferences.DEFAULT_EXPORT_FORMAT, ChartsEngine.getCurrent().getSupportedOutputFileFormats().get(0)); |
|
177 |
|
|
178 |
|
|
177 |
// ChartsEnginePreferences.getInstance().put(ChartsEnginePreferences.DEFAULT_EXPORT_FORMAT, ChartsEngine.getCurrent().getSupportedOutputFileFormats().get(0));
|
|
178 |
|
|
179 |
|
|
179 | 180 |
return true; |
180 | 181 |
} |
181 |
} |
|
182 |
} |
tmp/org.txm.chartsengine.rcp/src/org/txm/chartsengine/rcp/editors/ChartEditor.java (revision 2720) | ||
---|---|---|
197 | 197 |
} |
198 | 198 |
|
199 | 199 |
// Chart composite |
200 |
this.chartComposite = this.swtChartsComponentsProvider.createComposite(this, this.getResultArea());
|
|
200 |
this.chartComposite = this.getSWTChartsComponentsProvider().createComposite(this, this.getResultArea());
|
|
201 | 201 |
|
202 | 202 |
GridData gd = new GridData(GridData.FILL_BOTH); |
203 | 203 |
this.chartComposite.setLayoutData(gd); |
tmp/org.txm.chartsengine.rcp/src/org/txm/chartsengine/rcp/IChartComponent.java (revision 2720) | ||
---|---|---|
12 | 12 |
* |
13 | 13 |
*/ |
14 | 14 |
public interface IChartComponent { |
15 |
|
|
16 | 15 |
|
17 | 16 |
|
17 |
|
|
18 | 18 |
/** |
19 | 19 |
* Zooms the view at x and y coordinates. |
20 |
* |
|
20 | 21 |
* @param x |
21 | 22 |
* @param y |
22 | 23 |
* @param zoomIn |
23 | 24 |
*/ |
24 | 25 |
public abstract void zoom(double x, double y, boolean zoomIn); |
25 |
|
|
26 |
|
|
26 | 27 |
/** |
27 | 28 |
* Resets the view. |
28 | 29 |
*/ |
... | ... | |
30 | 31 |
|
31 | 32 |
/** |
32 | 33 |
* Pans the view. |
34 |
* |
|
33 | 35 |
* @param srcX |
34 | 36 |
* @param srcY |
35 | 37 |
* @param dstX |
... | ... | |
40 | 42 |
|
41 | 43 |
/** |
42 | 44 |
* Gets the linked editor. |
45 |
* |
|
43 | 46 |
* @return |
44 | 47 |
*/ |
45 | 48 |
public ChartEditor getChartEditor(); |
46 | 49 |
|
47 | 50 |
/** |
48 | 51 |
* Sets the linked editor. |
52 |
* |
|
49 | 53 |
* @param editor |
50 | 54 |
*/ |
51 | 55 |
public void setChartEditor(ChartEditor editor); |
52 | 56 |
|
53 | 57 |
/** |
54 | 58 |
* Updates the mouse over item selection according to the specified mouse event. |
59 |
* |
|
55 | 60 |
* @param event |
56 | 61 |
*/ |
57 | 62 |
public void updateMouseOverItem(MouseEvent event); |
58 | 63 |
|
59 | 64 |
/** |
60 | 65 |
* Checks if the component has the focus. |
66 |
* |
|
61 | 67 |
* @return |
62 | 68 |
*/ |
63 | 69 |
public boolean hasFocus(); |
64 | 70 |
|
65 |
|
|
71 |
|
|
66 | 72 |
/** |
67 |
* Constrains axes ticks to square aspect ratio.
|
|
73 |
* Constrains axes ticks to square aspect ratio. |
|
68 | 74 |
*/ |
69 | 75 |
public void squareOff(); |
70 | 76 |
|
tmp/org.txm.chartsengine.rcp/src/org/txm/chartsengine/rcp/swt/AdvancedChartEditorToolBar.java (revision 2720) | ||
---|---|---|
14 | 14 |
import org.txm.Toolbox; |
15 | 15 |
import org.txm.chartsengine.core.ChartCreator; |
16 | 16 |
import org.txm.chartsengine.core.ChartsEngine; |
17 |
import org.txm.chartsengine.core.ChartsEnginesManager; |
|
17 | 18 |
import org.txm.chartsengine.core.preferences.ChartsEnginePreferences; |
18 | 19 |
import org.txm.chartsengine.core.results.ChartResult; |
19 | 20 |
import org.txm.chartsengine.rcp.editors.ChartEditor; |
... | ... | |
165 | 166 |
ArrayList<String> chartsEngineNames = new ArrayList<>(); |
166 | 167 |
ArrayList<ChartCreator> allChartCreators = new ArrayList<>(); |
167 | 168 |
|
168 |
for (int i = 0; i < ChartsEngine.getChartsEngines().size(); i++) { |
|
169 |
ArrayList<ChartCreator> chartCreators = ChartsEngine.getChartsEngines().get(i).getChartCreators(this.getEditorPart().getResult()); |
|
170 |
for (int j = 0; j < chartCreators.size(); j++) { |
|
171 |
chartsEngineNames.add(ChartsEngine.getChartsEngines().get(i).getName()); |
|
172 |
allChartCreators.add(chartCreators.get(j)); |
|
169 |
for (ChartsEngine engine : ChartsEnginesManager.getChartsEngines()) { |
|
170 |
for (ChartCreator creator : engine.getChartCreators(this.getEditorPart().getResult())) { |
|
171 |
chartsEngineNames.add(engine.getName()); |
|
172 |
allChartCreators.add(creator); |
|
173 | 173 |
} |
174 | 174 |
} |
175 | 175 |
|
tmp/org.txm.chartsengine.rcp/src/org/txm/chartsengine/rcp/swt/ChartComposite.java (revision 2720) | ||
---|---|---|
21 | 21 |
import org.txm.utils.logger.Log; |
22 | 22 |
|
23 | 23 |
/** |
24 |
* Chart drawing area base SWT composite.
|
|
24 |
* Chart drawing area based on a SWT composite. this composite should be extended to implement specific draw component (Swing, etc.)
|
|
25 | 25 |
* |
26 |
* This composite can only be used with a ChartEditor and a ChartResult |
|
27 |
* |
|
26 | 28 |
* @author sjacquot |
27 | 29 |
* |
28 | 30 |
*/ |
29 | 31 |
public abstract class ChartComposite extends Composite { |
30 |
|
|
31 |
|
|
32 |
|
|
33 |
protected static final String CONTEXT_MENU_EMPTY_AREA_ID = "ChartEditorContextMenuEmptyArea"; //$NON-NLS-1$ |
|
34 |
protected static final String CONTEXT_MENU_ITEM_AREA_ID = "ChartEditorContextMenuItemArea"; //$NON-NLS-1$ |
|
35 | 32 |
|
36 |
|
|
33 |
|
|
34 |
|
|
35 |
protected static final String CONTEXT_MENU_EMPTY_AREA_ID = "ChartEditorContextMenuEmptyArea"; //$NON-NLS-1$ |
|
36 |
|
|
37 |
protected static final String CONTEXT_MENU_ITEM_AREA_ID = "ChartEditorContextMenuItemArea"; //$NON-NLS-1$ |
|
38 |
|
|
37 | 39 |
/** |
38 | 40 |
* Custom tool tip. |
39 | 41 |
*/ |
40 | 42 |
// FIXME: tests HTML tool tips |
41 | 43 |
protected ___CustomHTMLToolTip toolTip; |
42 |
|
|
44 |
|
|
43 | 45 |
/** |
44 | 46 |
* The chart component. |
45 | 47 |
*/ |
46 | 48 |
protected IChartComponent chartComponent; |
47 |
|
|
49 |
|
|
48 | 50 |
/** |
49 | 51 |
* Context menus. |
50 | 52 |
*/ |
... | ... | |
60 | 62 |
*/ |
61 | 63 |
public ChartComposite(ChartEditor<ChartResult> chartEditor, Composite parent, int style) { |
62 | 64 |
super(parent, style); |
63 |
|
|
65 |
|
|
64 | 66 |
this.chartEditor = chartEditor; |
65 | 67 |
|
66 |
this.contextMenus = new ArrayList<Menu>();
|
|
68 |
this.contextMenus = new ArrayList<>(); |
|
67 | 69 |
this.contextMenus.add(null); |
68 | 70 |
this.contextMenus.add(null); |
69 | 71 |
} |
70 |
|
|
71 | 72 |
|
72 | 73 |
|
74 |
|
|
73 | 75 |
/** |
74 | 76 |
* Loads the chart from specified data object (can be a File, an UI component, etc.). |
75 | 77 |
* |
76 | 78 |
* @param chart |
77 | 79 |
*/ |
78 | 80 |
public abstract void loadChart(Object chart); |
79 |
|
|
80 | 81 |
|
82 |
|
|
81 | 83 |
/** |
82 | 84 |
* Loads or reloads the chart from the chart object stored in the linked editor input. |
83 | 85 |
* This method is especially used for file based implementations of charts engine for reloading a file that has been externally modified. |
... | ... | |
87 | 89 |
|
88 | 90 |
/** |
89 | 91 |
* Loads or reloads the chart from the chart object stored in the linked editor input. |
92 |
* |
|
90 | 93 |
* @param resetView |
91 | 94 |
* @param clearChartItemsSelection |
92 | 95 |
* @param squareOff |
93 | 96 |
*/ |
94 |
public void loadChart(boolean resetView, boolean clearChartItemsSelection, boolean squareOff) {
|
|
97 |
public void loadChart(boolean resetView, boolean clearChartItemsSelection, boolean squareOff) {
|
|
95 | 98 |
this.loadChart(); |
96 |
|
|
97 |
if(squareOff) {
|
|
99 |
|
|
100 |
if (squareOff) {
|
|
98 | 101 |
this.squareOff(); |
99 | 102 |
} |
100 | 103 |
|
101 |
if(clearChartItemsSelection) {
|
|
104 |
if (clearChartItemsSelection) {
|
|
102 | 105 |
this.clearChartItemsSelection(); |
103 | 106 |
} |
104 |
|
|
105 |
if(resetView) {
|
|
107 |
|
|
108 |
if (resetView) {
|
|
106 | 109 |
this.resetView(); |
107 | 110 |
} |
108 | 111 |
} |
109 |
|
|
112 |
|
|
110 | 113 |
/** |
111 | 114 |
* Loads or reloads the chart from the chart object stored in the linked editor input. |
115 |
* |
|
112 | 116 |
* @param resetView |
113 | 117 |
* @param clearChartItemsSelection |
114 | 118 |
*/ |
115 |
public void loadChart(boolean resetView, boolean clearChartItemsSelection) {
|
|
119 |
public void loadChart(boolean resetView, boolean clearChartItemsSelection) {
|
|
116 | 120 |
this.loadChart(resetView, clearChartItemsSelection, false); |
117 | 121 |
} |
118 | 122 |
|
119 | 123 |
/** |
120 | 124 |
* Creates a new chart component. |
121 |
*
|
|
125 |
* |
|
122 | 126 |
* @param chartsEngine |
123 | 127 |
* @param chartEditorInput |
124 | 128 |
* @return |
... | ... | |
132 | 136 |
* @param chartEditorInput |
133 | 137 |
* @return |
134 | 138 |
*/ |
135 |
public void createChartComponent() {
|
|
139 |
public void createChartComponent() {
|
|
136 | 140 |
|
137 |
// if (!this.chartEditor.getResult().isChartDirty()) {
|
|
138 |
|
|
139 |
Log.finest(this.getClass().getSimpleName() + ": creating a chart component...");
|
|
140 |
|
|
141 |
this.chartComponent = this._createChartComponent();
|
|
142 |
this.chartComponent.setChartEditor(this.chartEditor);
|
|
143 |
|
|
144 |
// initialize the default shared context menus as Export, etc.
|
|
145 |
this.initDefaultContextMenus();
|
|
146 |
// initialize Listeners.
|
|
147 |
this.initEventsListeners();
|
|
148 |
// register user entries event call back extensions
|
|
149 |
this.registerEventCallBackExtensions();
|
|
150 |
|
|
151 |
|
|
152 |
// return true;
|
|
153 |
// }
|
|
154 |
// else {
|
|
155 |
// return false;
|
|
156 |
// }
|
|
141 |
// if (!this.chartEditor.getResult().isChartDirty()) {
|
|
142 |
|
|
143 |
Log.finest(this.getClass().getSimpleName() + ": creating a chart component..."); |
|
144 |
|
|
145 |
this.chartComponent = this._createChartComponent(); |
|
146 |
this.chartComponent.setChartEditor(this.chartEditor); |
|
147 |
|
|
148 |
// initialize the default shared context menus as Export, etc. |
|
149 |
this.initDefaultContextMenus(); |
|
150 |
// initialize Listeners. |
|
151 |
this.initEventsListeners(); |
|
152 |
// register user entries event call back extensions |
|
153 |
this.registerEventCallBackExtensions(); |
|
154 |
|
|
155 |
|
|
156 |
// return true;
|
|
157 |
// }
|
|
158 |
// else {
|
|
159 |
// return false;
|
|
160 |
// }
|
|
157 | 161 |
} |
158 | 162 |
|
159 | 163 |
/** |
... | ... | |
165 | 169 |
/** |
166 | 170 |
* Creates the pop up menu dedicated to empty area location click event that is populated from plugin.xml. |
167 | 171 |
*/ |
168 |
public void initEmptyAreaContextMenu() {
|
|
172 |
public void initEmptyAreaContextMenu() {
|
|
169 | 173 |
Menu menu = TXMEditor.initContextMenu(this, CONTEXT_MENU_EMPTY_AREA_ID); |
170 |
this.contextMenus.set(EventCallBack.AREA_EMPTY, menu);
|
|
174 |
this.contextMenus.set(EventCallBack.AREA_EMPTY, menu);
|
|
171 | 175 |
} |
172 |
|
|
173 | 176 |
|
177 |
|
|
174 | 178 |
/** |
175 | 179 |
* Creates the pop up menu dedicated to chart item location click event. |
176 | 180 |
*/ |
177 |
public void initItemAreaContextMenu() {
|
|
181 |
public void initItemAreaContextMenu() {
|
|
178 | 182 |
Menu menu = TXMEditor.initContextMenu(this, CONTEXT_MENU_ITEM_AREA_ID); |
179 | 183 |
|
180 |
//Menu menu = new Menu(this); |
|
181 |
//MenuItem chartEntityLabelItem = new MenuItem(menu, SWT.NONE);
|
|
182 |
//chartEntityLabelItem.setText(""); // this string is dedicated to be overridden by the current selected chart entity label/name
|
|
183 |
|
|
184 |
// FIXME : tests
|
|
185 |
// MenuItem refreshItem = new MenuItem(menu, SWT.NONE);
|
|
186 |
// refreshItem.setText("Refresh");
|
|
187 |
// MenuItem deleteItem = new MenuItem(menu, SWT.NONE);
|
|
188 |
// deleteItem.setText("Delete");
|
|
189 |
// |
|
190 |
// sub-menu for selected items
|
|
191 |
// Menu newMenu = new Menu(menu);
|
|
192 |
// chartEntityLabelItem.setMenu(newMenu);
|
|
193 |
|
|
194 |
// MenuItem shortcutItem = new MenuItem(newMenu, SWT.NONE);
|
|
195 |
// shortcutItem.setText("Shortcut");
|
|
196 |
// MenuItem iconItem = new MenuItem(newMenu, SWT.NONE);
|
|
197 |
// iconItem.setText("Icon");
|
|
198 |
|
|
199 |
this.contextMenus.set(EventCallBack.AREA_ITEM, menu);
|
|
184 |
// Menu menu = new Menu(this);
|
|
185 |
// MenuItem chartEntityLabelItem = new MenuItem(menu, SWT.NONE);
|
|
186 |
// chartEntityLabelItem.setText(""); // this string is dedicated to be overridden by the current selected chart entity label/name
|
|
187 |
|
|
188 |
// FIXME : tests
|
|
189 |
// MenuItem refreshItem = new MenuItem(menu, SWT.NONE);
|
|
190 |
// refreshItem.setText("Refresh");
|
|
191 |
// MenuItem deleteItem = new MenuItem(menu, SWT.NONE);
|
|
192 |
// deleteItem.setText("Delete");
|
|
193 |
//
|
|
194 |
// sub-menu for selected items
|
|
195 |
// Menu newMenu = new Menu(menu);
|
|
196 |
// chartEntityLabelItem.setMenu(newMenu);
|
|
197 |
|
|
198 |
// MenuItem shortcutItem = new MenuItem(newMenu, SWT.NONE);
|
|
199 |
// shortcutItem.setText("Shortcut");
|
|
200 |
// MenuItem iconItem = new MenuItem(newMenu, SWT.NONE);
|
|
201 |
// iconItem.setText("Icon");
|
|
202 |
|
|
203 |
this.contextMenus.set(EventCallBack.AREA_ITEM, menu);
|
|
200 | 204 |
} |
201 | 205 |
|
202 | 206 |
/** |
203 | 207 |
* Defines the current context menu to display on menu event. |
208 |
* |
|
204 | 209 |
* @param index |
205 | 210 |
*/ |
206 |
public void setCurrentContextMenu(int index) {
|
|
211 |
public void setCurrentContextMenu(int index) {
|
|
207 | 212 |
|
208 | 213 |
// Debug |
209 | 214 |
Log.finest("ChartComposite.setCurrentContextMenu(): setting menu to " + index + " / " + this.contextMenus.get(index)); //$NON-NLS-1$ |
... | ... | |
211 | 216 |
this.setMenu(this.contextMenus.get(index)); |
212 | 217 |
} |
213 | 218 |
|
214 |
|
|
219 |
|
|
215 | 220 |
/** |
216 | 221 |
* Gets the menu specified by its index. |
222 |
* |
|
217 | 223 |
* @param index |
218 | 224 |
* @return |
219 | 225 |
*/ |
220 |
public Menu getContextMenu(int index) {
|
|
226 |
public Menu getContextMenu(int index) {
|
|
221 | 227 |
return this.contextMenus.get(index); |
222 | 228 |
} |
223 | 229 |
|
224 |
|
|
230 |
|
|
225 | 231 |
/** |
226 | 232 |
* Resets the chart view (zoom, pan, rotation). |
227 | 233 |
*/ |
228 |
public void resetView() {
|
|
229 |
if(this.chartComponent != null) {
|
|
234 |
public void resetView() {
|
|
235 |
if (this.chartComponent != null) {
|
|
230 | 236 |
this.chartComponent.resetView(); |
231 |
|
|
232 |
if(this.chartComponent.getChartEditor().getResult().needsToSquareOff()) {
|
|
237 |
|
|
238 |
if (this.chartComponent.getChartEditor().getResult().needsToSquareOff()) {
|
|
233 | 239 |
this.chartComponent.squareOff(); |
234 | 240 |
} |
235 | 241 |
} |
... | ... | |
240 | 246 |
* Copies the chart view as image in the clipboard from the specified chart component. |
241 | 247 |
*/ |
242 | 248 |
public abstract void copyChartViewToClipboard(); |
243 |
|
|
244 | 249 |
|
250 |
|
|
245 | 251 |
/** |
246 | 252 |
* Exports the current view of the composite in the specified file. |
247 | 253 |
* |
... | ... | |
266 | 272 |
|
267 | 273 |
/** |
268 | 274 |
* Gets the chart object. |
275 |
* |
|
269 | 276 |
* @return |
270 | 277 |
*/ |
271 |
public Object getChart() {
|
|
278 |
public Object getChart() {
|
|
272 | 279 |
return this.getChartResult().getChart(); |
273 | 280 |
}; |
274 |
|
|
275 | 281 |
|
282 |
|
|
276 | 283 |
/** |
277 | 284 |
* Gets the linked result. |
285 |
* |
|
278 | 286 |
* @return |
279 | 287 |
*/ |
280 |
public ChartResult getChartResult() {
|
|
288 |
public ChartResult getChartResult() {
|
|
281 | 289 |
return this.chartEditor.getResult(); |
282 | 290 |
} |
283 | 291 |
|
284 | 292 |
/** |
285 | 293 |
* Gets the charts engine of the linked result. |
294 |
* |
|
286 | 295 |
* @return |
287 | 296 |
*/ |
288 |
public ChartsEngine getChartsEngine() {
|
|
297 |
public ChartsEngine getChartsEngine() {
|
|
289 | 298 |
return this.getChartResult().getChartsEngine(); |
290 | 299 |
} |
291 | 300 |
|
292 | 301 |
/** |
293 | 302 |
* Zooms the chart view at x and y coordinates. |
303 |
* |
|
294 | 304 |
* @param x |
295 | 305 |
* @param y |
296 | 306 |
* @param zoomIn |
297 | 307 |
*/ |
298 |
public void zoom(double x, double y, boolean zoomIn) {
|
|
308 |
public void zoom(double x, double y, boolean zoomIn) {
|
|
299 | 309 |
this.chartComponent.zoom(x, y, zoomIn); |
300 | 310 |
} |
301 |
|
|
311 |
|
|
302 | 312 |
/** |
303 | 313 |
* Pans the chart view. |
314 |
* |
|
304 | 315 |
* @param chartComponent |
305 | 316 |
* @param srcX |
306 | 317 |
* @param srcY |
... | ... | |
308 | 319 |
* @param dstY |
309 | 320 |
* @param panFactor |
310 | 321 |
*/ |
311 |
public void pan(double srcX, double srcY, double dstX, double dstY, double panFactor) {
|
|
322 |
public void pan(double srcX, double srcY, double dstX, double dstY, double panFactor) {
|
|
312 | 323 |
this.chartComponent.pan(srcX, srcY, dstX, dstY, panFactor); |
313 | 324 |
} |
314 |
|
|
325 |
|
|
315 | 326 |
/** |
316 |
* Constrains axes ticks to square aspect ratio.
|
|
327 |
* Constrains axes ticks to square aspect ratio. |
|
317 | 328 |
*/ |
318 |
public void squareOff() {
|
|
319 |
if(this.chartComponent != null) {
|
|
329 |
public void squareOff() {
|
|
330 |
if (this.chartComponent != null) {
|
|
320 | 331 |
this.chartComponent.squareOff(); |
321 | 332 |
} |
322 | 333 |
} |
323 |
|
|
334 |
|
|
324 | 335 |
/** |
325 | 336 |
* Checks if the composite AND the chart component have the focus. |
337 |
* |
|
326 | 338 |
* @return |
327 | 339 |
*/ |
328 |
public boolean hasFocus() {
|
|
340 |
public boolean hasFocus() {
|
|
329 | 341 |
return this.chartComponent.hasFocus() && this.isFocusControl(); |
330 | 342 |
} |
331 | 343 |
|
332 | 344 |
/** |
333 | 345 |
* Gets the mouse call back handler registered for the chart component. |
346 |
* |
|
334 | 347 |
* @return |
335 | 348 |
*/ |
336 | 349 |
public abstract EventCallBackHandler getMouseCallBackHandler(); |
337 |
|
|
338 |
|
|
350 |
|
|
351 |
|
|
339 | 352 |
/** |
340 | 353 |
* Gets the key call back handler registered for the chart component. |
354 |
* |
|
341 | 355 |
* @return |
342 | 356 |
*/ |
343 | 357 |
public abstract EventCallBackHandler getKeyCallBackHandler(); |
344 |
|
|
345 |
|
|
358 |
|
|
359 |
|
|
346 | 360 |
/** |
347 | 361 |
* Gets the mouse call back handler registered for the specified component. |
362 |
* |
|
348 | 363 |
* @param component |
349 | 364 |
* @return |
350 | 365 |
*/ |
351 | 366 |
public EventCallBackHandler getMouseCallBackHandler(Component component) { |
352 | 367 |
EventCallBackHandler handler = null; |
353 | 368 |
EventListener[] listeners = component.getMouseListeners(); |
354 |
|
|
355 |
for(int i = 0; i < listeners.length; i++) { |
|
356 |
if(listeners[i] instanceof EventCallBackHandler) {
|
|
369 |
|
|
370 |
for (int i = 0; i < listeners.length; i++) {
|
|
371 |
if (listeners[i] instanceof EventCallBackHandler) {
|
|
357 | 372 |
handler = (EventCallBackHandler) listeners[i]; |
358 | 373 |
break; |
359 | 374 |
} |
360 | 375 |
} |
361 | 376 |
return handler; |
362 | 377 |
} |
363 |
|
|
364 |
|
|
378 |
|
|
379 |
|
|
365 | 380 |
/** |
366 | 381 |
* Gets the key call back handler registered for the specified component. |
382 |
* |
|
367 | 383 |
* @param component |
368 | 384 |
* @return |
369 | 385 |
*/ |
370 | 386 |
public EventCallBackHandler getKeyCallBackHandler(Component component) { |
371 | 387 |
EventCallBackHandler handler = null; |
372 | 388 |
EventListener[] listeners = component.getKeyListeners(); |
373 |
|
|
374 |
for(int i = 0; i < listeners.length; i++) { |
|
375 |
if(listeners[i] instanceof EventCallBackHandler) {
|
|
389 |
|
|
390 |
for (int i = 0; i < listeners.length; i++) {
|
|
391 |
if (listeners[i] instanceof EventCallBackHandler) {
|
|
376 | 392 |
handler = (EventCallBackHandler) listeners[i]; |
377 | 393 |
break; |
378 | 394 |
} |
379 | 395 |
} |
380 | 396 |
return handler; |
381 | 397 |
} |
382 |
|
|
398 |
|
|
383 | 399 |
/** |
384 | 400 |
* Gets the event call back handler of the specified class. |
401 |
* |
|
385 | 402 |
* @param listenerType |
386 | 403 |
* @return |
387 | 404 |
*/ |
388 |
public EventCallBackHandler getCallBackHandler(Class listenerType) {
|
|
405 |
public EventCallBackHandler getCallBackHandler(Class listenerType) {
|
|
389 | 406 |
EventCallBackHandler handler = null; |
390 | 407 |
EventListener[] listeners = ((Component) this.chartComponent).getListeners(listenerType); |
391 |
|
|
392 |
for(int i = 0; i < listeners.length; i++) { |
|
393 |
if(listeners[i] instanceof EventCallBackHandler) {
|
|
408 |
|
|
409 |
for (int i = 0; i < listeners.length; i++) {
|
|
410 |
if (listeners[i] instanceof EventCallBackHandler) {
|
|
394 | 411 |
handler = (EventCallBackHandler) listeners[i]; |
395 | 412 |
break; |
396 | 413 |
} |
397 | 414 |
} |
398 | 415 |
return handler; |
399 | 416 |
} |
400 |
|
|
417 |
|
|
401 | 418 |
/** |
402 | 419 |
* Initializes the default context menus. |
420 |
* |
|
403 | 421 |
* @param composite |
404 | 422 |
*/ |
405 |
public void initDefaultContextMenus() {
|
|
423 |
public void initDefaultContextMenus() {
|
|
406 | 424 |
this.initItemAreaContextMenu(); |
407 | 425 |
this.initEmptyAreaContextMenu(); |
408 | 426 |
this.setCurrentContextMenu(EventCallBack.AREA_EMPTY); |
409 | 427 |
} |
410 |
|
|
411 | 428 |
|
429 |
|
|
412 | 430 |
/** |
413 | 431 |
* Registers user entries event call back extensions. |
414 | 432 |
*/ |
415 |
public void registerEventCallBackExtensions() {
|
|
433 |
public void registerEventCallBackExtensions() {
|
|
416 | 434 |
|
417 | 435 |
ChartResult result = this.chartEditor.getResult(); |
418 | 436 |
|
419 | 437 |
String extensionPointId = "org.txm.chartsengine.eventcallback"; //$NON-NLS-1$ |
420 | 438 |
IConfigurationElement[] contributions = Platform.getExtensionRegistry().getConfigurationElementsFor(extensionPointId); |
421 | 439 |
|
422 |
for(int i = 0; i < contributions.length; i++) { |
|
423 |
if( |
|
424 |
( |
|
425 |
contributions[i].getAttribute("chartsEngineName") == null || //$NON-NLS-1$ // for callback that can be used for all charts engine implementations |
|
426 |
contributions[i].getAttribute("chartsEngineName").equals(result.getChartsEngine().getName()) //$NON-NLS-1$ |
|
427 |
) |
|
428 |
&& |
|
429 |
contributions[i].getAttribute("resultDataClass") != null //$NON-NLS-1$ |
|
430 |
&& contributions[i].getAttribute("resultDataClass").equals(result.getClass().getName()) //$NON-NLS-1$ |
|
431 |
|
|
432 |
&& ((contributions[i].getAttribute("chartType") == null && result.getChartType().equals(ChartsEnginePreferences.DEFAULT_CHART_TYPE) //$NON-NLS-1$ |
|
433 |
|| |
|
434 |
contributions[i].getAttribute("chartType") != null && !result.getChartType().equals(ChartsEnginePreferences.DEFAULT_CHART_TYPE) && contributions[i].getAttribute("chartType").equals(result.getChartType()) //$NON-NLS-1$ //$NON-NLS-2$ |
|
435 |
) //$NON-NLS-1$ |
|
436 |
) |
|
437 |
|
|
438 |
) { |
|
440 |
for (int i = 0; i < contributions.length; i++) { |
|
441 |
if ((contributions[i].getAttribute("chartsEngineName") == null || //$NON-NLS-1$ // for callback that can be used for all charts engine implementations |
|
442 |
contributions[i].getAttribute("chartsEngineName").equals(result.getChartsEngine().getName()) //$NON-NLS-1$ |
|
443 |
) |
|
444 |
&& |
|
445 |
contributions[i].getAttribute("resultDataClass") != null //$NON-NLS-1$ |
|
446 |
&& contributions[i].getAttribute("resultDataClass").equals(result.getClass().getName()) //$NON-NLS-1$ |
|
447 |
|
|
448 |
&& ((contributions[i].getAttribute("chartType") == null && result.getChartType().equals(ChartsEnginePreferences.DEFAULT_CHART_TYPE) //$NON-NLS-1$ |
|
449 |
|| |
|
450 |
contributions[i].getAttribute("chartType") != null && !result.getChartType().equals(ChartsEnginePreferences.DEFAULT_CHART_TYPE) && contributions[i].getAttribute( //$NON-NLS-1$ |
|
451 |
"chartType").equals(result.getChartType()) //$NON-NLS-1$ |
|
452 |
)) |
|
453 |
|
|
454 |
) { |
|
439 | 455 |
try { |
440 |
EventCallBack eventCallBack = (EventCallBack)contributions[i].createExecutableExtension("class"); //$NON-NLS-1$ |
|
456 |
EventCallBack eventCallBack = (EventCallBack) contributions[i].createExecutableExtension("class"); //$NON-NLS-1$
|
|
441 | 457 |
|
442 | 458 |
eventCallBack.setChartEditor(this.chartEditor); |
443 | 459 |
|
444 | 460 |
EventCallBackHandler mouseHandler = this.getMouseCallBackHandler(); |
445 |
if(mouseHandler != null && mouseHandler.getEventCallBack(eventCallBack.getClass()) == null) {
|
|
446 |
|
|
461 |
if (mouseHandler != null && mouseHandler.getEventCallBack(eventCallBack.getClass()) == null) {
|
|
462 |
|
|
447 | 463 |
Log.fine("ChartEditor.registerEventCallBackExtensions(): call back of type " + eventCallBack.getClass() //$NON-NLS-1$ |
448 | 464 |
+ " registered in mouse handler (chart editor = " + this.chartEditor.getClass() //$NON-NLS-1$ |
449 | 465 |
+ ", result data class = " + result.getClass() //$NON-NLS-1$ |
... | ... | |
453 | 469 |
mouseHandler.registerEventCallBack(eventCallBack); |
454 | 470 |
} |
455 | 471 |
EventCallBackHandler keyboardHandler = this.getKeyCallBackHandler(); |
456 |
if(keyboardHandler != null && keyboardHandler.getEventCallBack(eventCallBack.getClass()) == null) {
|
|
472 |
if (keyboardHandler != null && keyboardHandler.getEventCallBack(eventCallBack.getClass()) == null) {
|
|
457 | 473 |
|
458 | 474 |
Log.fine("ChartEditor.registerEventCallBackExtensions(): call back of type " + eventCallBack.getClass() //$NON-NLS-1$ |
459 | 475 |
+ " registered in key handler (chart editor = " + this.chartEditor.getClass() //$NON-NLS-1$ |
... | ... | |
464 | 480 |
keyboardHandler.registerEventCallBack(eventCallBack); |
465 | 481 |
} |
466 | 482 |
} |
467 |
catch(CoreException e) { |
|
483 |
catch (CoreException e) {
|
|
468 | 484 |
e.printStackTrace(); |
469 | 485 |
} |
470 | 486 |
break; |
... | ... | |
475 | 491 |
|
476 | 492 |
/** |
477 | 493 |
* Gets the chart component dedicated to rendering the chart. |
494 |
* |
|
478 | 495 |
* @return the chartComponent |
479 | 496 |
*/ |
480 | 497 |
public IChartComponent getChartComponent() { |
tmp/org.txm.chartsengine.rcp/src/org/txm/chartsengine/rcp/handlers/ExportChart.java (revision 2720) | ||
---|---|---|
64 | 64 |
*/ |
65 | 65 |
// FIXME: SJ: this class should not used the SWTChartsComponentsProvider but directly the current charts engine |
66 | 66 |
public class ExportChart extends BaseAbstractHandler { |
67 |
|
|
67 |
|
|
68 | 68 |
private static final String ID = "ExportChart"; //$NON-NLS-1$ |
69 |
|
|
70 |
|
|
69 |
|
|
70 |
|
|
71 | 71 |
@Override |
72 | 72 |
public Object execute(ExecutionEvent event) throws ExecutionException { |
73 |
|
|
73 |
|
|
74 | 74 |
Object selection = this.getCorporaViewSelectedObject(event); |
75 |
|
|
76 |
if(!(selection instanceof ChartResult)) {
|
|
75 |
|
|
76 |
if (!(selection instanceof ChartResult)) {
|
|
77 | 77 |
return null; |
78 | 78 |
} |
79 | 79 |
|
80 | 80 |
final ChartResult chartResult = (ChartResult) selection; |
81 | 81 |
|
82 | 82 |
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); |
83 |
|
|
83 |
|
|
84 | 84 |
final FileDialog dialog = new FileDialog(shell, SWT.SAVE); |
85 |
|
|
85 |
|
|
86 | 86 |
// Create the extensions from the current charts engine supported file formats |
87 | 87 |
String extensions[] = new String[SWTChartsComponentsProvider.getCurrent().getChartsEngineSupportedExportFileFormats().size()]; |
88 | 88 |
int defaultChartFormatIndex = 0; |
89 | 89 |
for (int i = 0; i < SWTChartsComponentsProvider.getCurrent().getChartsEngineSupportedExportFileFormats().size(); i++) { |
90 | 90 |
extensions[i] = "*." + SWTChartsComponentsProvider.getCurrent().getChartsEngineSupportedExportFileFormats().get(i); //$NON-NLS-1$ |
91 |
|
|
91 |
|
|
92 | 92 |
// Store the default chart export file format index |
93 |
if(ChartsEnginePreferences.getInstance().getString(ChartsEnginePreferences.DEFAULT_EXPORT_FORMAT).equals(SWTChartsComponentsProvider.getCurrent().getChartsEngineSupportedExportFileFormats().get(i))) { |
|
93 |
if (ChartsEnginePreferences.getInstance().getString(ChartsEnginePreferences.DEFAULT_EXPORT_FORMAT).equals(SWTChartsComponentsProvider.getCurrent() |
|
94 |
.getChartsEngineSupportedExportFileFormats().get(i))) { |
|
94 | 95 |
defaultChartFormatIndex = i; |
95 | 96 |
} |
96 | 97 |
} |
97 |
|
|
98 |
|
|
98 | 99 |
dialog.setFilterExtensions(extensions); |
99 | 100 |
// Select default chart export file format |
100 | 101 |
dialog.setFilterIndex(defaultChartFormatIndex); |
101 |
|
|
102 |
|
|
102 | 103 |
dialog.setOverwrite(true); |
103 |
|
|
104 |
|
|
104 | 105 |
if (LastOpened.getFile(ID) != null) { |
105 | 106 |
dialog.setFilterPath(LastOpened.getFolder(ID)); |
106 | 107 |
} |
107 |
|
|
108 |
|
|
108 | 109 |
dialog.setFileName(chartResult.getValidFileName()); |
109 | 110 |
|
110 | 111 |
if (dialog.open() != null) { |
111 | 112 |
StatusLine.setMessage("Exporting chart..."); |
112 |
|
|
113 |
|
|
113 | 114 |
String filepath = dialog.getFilterPath() + "/" + dialog.getFileName(); //$NON-NLS-1$ |
114 | 115 |
final File file = new File(filepath); |
115 |
|
|
116 |
|
|
116 | 117 |
LastOpened.set(ID, file.getParent(), file.getName()); |
117 |
|
|
118 |
|
|
118 | 119 |
try { |
119 | 120 |
file.createNewFile(); |
120 |
} catch (IOException e1) { |
|
121 |
} |
|
122 |
catch (IOException e1) { |
|
121 | 123 |
Log.severe(NLS.bind(TXMUIMessages.exportColonCantCreateFileP0ColonP1, file, e1)); |
122 | 124 |
} |
123 | 125 |
if (!file.canWrite()) { |
... | ... | |
126 | 128 |
if (!file.isFile()) { |
127 | 129 |
Log.severe("Error: " + file + " is not a file"); //$NON-NLS-1$ //$NON-NLS-2$ |
128 | 130 |
} |
129 |
|
|
131 |
|
|
130 | 132 |
JobHandler jobhandler = new JobHandler(TXMUIMessages.exportingResults) { |
133 |
|
|
131 | 134 |
@Override |
132 | 135 |
protected IStatus run(IProgressMonitor monitor) { |
133 | 136 |
try { |
134 | 137 |
this.runInit(monitor); |
135 | 138 |
monitor.beginTask(TXMUIMessages.exporting, 100); |
136 |
|
|
139 |
|
|
137 | 140 |
// compute the result if needed |
138 |
if (!chartResult.hasBeenComputedOnce()) {
|
|
141 |
if (!chartResult.hasBeenComputedOnce()) {
|
|
139 | 142 |
chartResult.compute(monitor); |
140 | 143 |
} |
141 | 144 |
|
142 | 145 |
String outputFormat = SWTChartsComponentsProvider.getCurrent().getChartsEngineSupportedExportFileFormats().get(dialog.getFilterIndex()); |
143 |
ChartsEngine.getCurrent().createChartFile(chartResult, file, outputFormat);
|
|
144 |
|
|
146 |
ChartsEngine.getCurrent().exportChart(chartResult, file, 1024, 576, outputFormat);
|
|
147 |
|
|
145 | 148 |
if (file.exists()) { |
146 |
|
|
149 |
|
|
147 | 150 |
Log.info(NLS.bind(TXMUIMessages.p1ExportSavedInFileColonP0, file.getAbsolutePath(), outputFormat.toUpperCase())); |
148 |
|
|
151 |
|
|
149 | 152 |
// Open internal editor in the UI thread |
150 |
if (TBXPreferences.getInstance().getBoolean(TBXPreferences.EXPORT_SHOW)) {
|
|
153 |
if (TBXPreferences.getInstance().getBoolean(TBXPreferences.EXPORT_SHOW)) {
|
|
151 | 154 |
this.syncExec(new Runnable() { |
155 |
|
|
152 | 156 |
@Override |
153 | 157 |
public void run() { |
154 | 158 |
OpenGraph.OpenFile(file.getAbsolutePath()); |
155 | 159 |
} |
156 | 160 |
}); |
157 | 161 |
} |
158 |
} else { |
|
162 |
} |
|
163 |
else { |
|
159 | 164 |
System.out.println(NLS.bind(TXMUIMessages.failedToExportInFileP0WithFormatP1, file.getAbsolutePath(), outputFormat)); |
160 | 165 |
} |
161 |
} catch (ThreadDeath td) { |
|
166 |
} |
|
167 |
catch (ThreadDeath td) { |
|
162 | 168 |
return Status.CANCEL_STATUS; |
163 |
} catch (Exception e) { |
|
169 |
} |
|
170 |
catch (Exception e) { |
|
164 | 171 |
org.txm.utils.logger.Log.printStackTrace(e); |
165 | 172 |
return Status.CANCEL_STATUS; |
166 |
} finally { |
|
173 |
} |
|
174 |
finally { |
|
167 | 175 |
monitor.done(); |
168 | 176 |
JobsTimer.stopAndPrint(); |
169 | 177 |
} |
170 | 178 |
return Status.OK_STATUS; |
171 | 179 |
} |
172 | 180 |
}; |
173 |
|
|
181 |
|
|
174 | 182 |
jobhandler.startJob(); |
175 | 183 |
} |
176 | 184 |
return null; |
177 | 185 |
} |
178 |
} |
|
186 |
} |
tmp/org.txm.specificities.rcp/src/org/txm/specificities/rcp/editors/SpecificitiesEditor.java (revision 2720) | ||
---|---|---|
53 | 53 |
import org.txm.rcp.swt.widget.ThresholdsGroup; |
54 | 54 |
import org.txm.rcp.swt.widget.structures.PropertiesComboViewer; |
55 | 55 |
import org.txm.searchengine.cqp.corpus.CQPCorpus; |
56 |
import org.txm.searchengine.cqp.corpus.MainCorpus; |
|
56 | 57 |
import org.txm.searchengine.cqp.corpus.Subcorpus; |
57 | 58 |
import org.txm.specificities.core.functions.Specificities; |
58 | 59 |
import org.txm.specificities.core.preferences.SpecificitiesPreferences; |
... | ... | |
209 | 210 |
this.fMaxSpinner = thresholdsGroup.getFMaxSpinner(); |
210 | 211 |
this.vMaxSpinner = thresholdsGroup.getVMaxSpinner(); |
211 | 212 |
this.vMaxSpinner.setMinimum(2); |
213 |
CQPCorpus corpus = getResult().getFirstParent(MainCorpus.class); |
|
214 |
if (corpus != null) { |
|
215 |
this.vMaxSpinner.setMaximum(corpus.getSize()); |
|
216 |
this.fMaxSpinner.setMaximum(corpus.getSize()); |
|
217 |
this.fMinSpinner.setMaximum(corpus.getSize()); |
|
218 |
} |
|
212 | 219 |
} |
213 | 220 |
|
214 | 221 |
} |
tmp/org.txm.chartsengine.jfreechart.core/src/org/txm/chartsengine/jfreechart/core/JFCChartsEngine.java (revision 2720) | ||
---|---|---|
32 | 32 |
import org.txm.chartsengine.jfreechart.core.themes.base.JFCTheme; |
33 | 33 |
import org.txm.chartsengine.jfreechart.core.themes.base.SymbolAxisBetweenTicks; |
34 | 34 |
import org.txm.chartsengine.jfreechart.core.themes.highcharts.defaulttheme.HighchartsDefaultTheme; |
35 |
import org.txm.utils.logger.Log; |
|
35 | 36 |
|
36 | 37 |
import com.lowagie.text.Document; |
37 | 38 |
import com.lowagie.text.Rectangle; |
... | ... | |
436 | 437 |
return jfcTheme; |
437 | 438 |
} |
438 | 439 |
|
439 |
|
|
440 |
// |
|
440 | 441 |
@Override |
441 |
public File createChartFile(Object chart, File file) { |
|
442 |
return this.export((JFreeChart) chart, file); |
|
442 |
public File exportChart(ChartResult result, File file, int imageWidth, int imageHeight, String outputFormat) { |
|
443 |
Object chart = result.getChart(); |
|
444 |
if (chart == null) { |
|
445 |
Log.severe("Error: null chart in " + result); |
|
446 |
return null; |
|
447 |
} |
|
448 |
if (chart instanceof JFreeChart) { |
|
449 |
return exportChart(chart, file, outputFormat, imageWidth, imageHeight); // create & write a |
|
450 |
} |
|
451 |
else { |
|
452 |
Log.severe("Error: the chart is not a JFreeChart " + chart + " " + result); |
|
453 |
return null; |
|
454 |
} |
|
443 | 455 |
} |
444 | 456 |
|
457 |
// @Override |
|
458 |
// public File createChartFile(Object chart, File file, String outputFormat) { |
|
459 |
// return this.export((JFreeChart) chart, file); |
|
460 |
// } |
|
461 |
|
|
445 | 462 |
@Override |
446 | 463 |
public File exportChart(Object chart, File file, String outputFormat, int imageWidth, int imageHeight, int drawingAreaX, int drawingAreaY, int drawingAreaWidth, int drawingAreaHeight) { |
447 | 464 |
return JFCChartsEngine.export(chart, file, outputFormat, imageWidth, imageHeight, drawingAreaX, drawingAreaY, drawingAreaWidth, drawingAreaHeight); |
... | ... | |
578 | 595 |
public static File exportRasterImage(JFreeChart chart, File file, String outputFormat, int imageWidth, int imageHeight, int drawingAreaX, int drawingAreaY, int drawingAreaWidth, |
579 | 596 |
int drawingAreaHeight) { |
580 | 597 |
|
581 |
BufferedImage bufferedImage = ((JFreeChart) chart).createBufferedImage(imageWidth, imageHeight, BufferedImage.TYPE_INT_RGB, null);
|
|
598 |
BufferedImage bufferedImage = chart.createBufferedImage(imageWidth, imageHeight, BufferedImage.TYPE_INT_RGB, null);
|
|
582 | 599 |
|
583 | 600 |
// Crop |
584 | 601 |
bufferedImage = bufferedImage.getSubimage(drawingAreaX, drawingAreaY, drawingAreaWidth, drawingAreaHeight); |
... | ... | |
854 | 871 |
|
855 | 872 |
@Override |
856 | 873 |
public ArrayList<String> getSupportedOutputDisplayFormats() { |
857 |
ArrayList<String> formats = new ArrayList<String>(1);
|
|
874 |
ArrayList<String> formats = new ArrayList<>(1); |
|
858 | 875 |
|
859 | 876 |
formats.add(OUTPUT_FORMAT_JFC_JAVA2D); |
860 | 877 |
|
... | ... | |
863 | 880 |
|
864 | 881 |
@Override |
865 | 882 |
public ArrayList<String> getSupportedOutputFileFormats() { |
866 |
ArrayList<String> formats = new ArrayList<String>(6);
|
|
883 |
ArrayList<String> formats = new ArrayList<>(6); |
|
867 | 884 |
|
868 | 885 |
formats.add(OUTPUT_FORMAT_SVG); // Default format |
869 | 886 |
|
tmp/org.txm.chartsengine.jfreechart.core/src/org/txm/chartsengine/jfreechart/core/JFCChartCreator.java (revision 2720) | ||
---|---|---|
1 | 1 |
package org.txm.chartsengine.jfreechart.core; |
2 | 2 |
|
3 | 3 |
import java.awt.Color; |
4 |
import java.io.File; |
|
5 | 4 |
import java.util.ArrayList; |
6 | 5 |
|
7 | 6 |
import org.jfree.chart.JFreeChart; |
8 |
import org.jfree.chart.axis.SymbolAxis; |
|
9 | 7 |
import org.jfree.chart.plot.CategoryPlot; |
10 | 8 |
import org.jfree.chart.plot.XYPlot; |
11 | 9 |
import org.txm.chartsengine.core.ChartCreator; |
12 | 10 |
import org.txm.chartsengine.core.preferences.ChartsEnginePreferences; |
13 | 11 |
import org.txm.chartsengine.core.results.ChartResult; |
14 | 12 |
import org.txm.chartsengine.jfreechart.core.renderers.interfaces.IRendererWithItemSelection; |
13 |
import org.txm.utils.logger.Log; |
|
15 | 14 |
|
16 | 15 |
|
17 |
|
|
18 | 16 |
/** |
19 | 17 |
* JFreeChart base chart creator. |
20 | 18 |
* |
... | ... | |
25 | 23 |
* @author sjacquot |
26 | 24 |
* |
27 | 25 |
*/ |
28 |
public abstract class JFCChartCreator extends ChartCreator {
|
|
26 |
public abstract class JFCChartCreator<R extends ChartResult> extends ChartCreator<JFCChartsEngine, R> {
|
|
29 | 27 |
|
28 |
// @Override |
|
29 |
// public final Object createChart(ChartResult result) { |
|
30 |
// if ("java".equals(this.getChartsEngine().getOutputFormat())) { |
|
31 |
// return _createJFreeChart(result); |
|
32 |
// } |
|
33 |
// else { |
|
34 |
// return createChartFile(result); |
|
35 |
// } |
|
36 |
// } |
|
30 | 37 |
|
31 | 38 |
@Override |
32 |
public void updateChart(ChartResult result) { |
|
39 |
public abstract JFreeChart createChart(R result); |
|
40 |
|
|
41 |
@Override |
|
42 |
public void updateChart(R result) { |
|
33 | 43 |
this.updateChart(result, true); |
34 | 44 |
} |
35 | 45 |
|
36 |
|
|
37 | 46 |
/** |
38 | 47 |
* Updates the chart according to the shared parameters, also applies the current theme to the chart and the user renderer settings. |
39 | 48 |
* |
40 | 49 |
* @param result |
41 | 50 |
* @param applyTheme |
42 | 51 |
*/ |
43 |
public void updateChart(ChartResult result, boolean applyTheme) {
|
|
52 |
public void updateChart(R result, boolean applyTheme) {
|
|
44 | 53 |
|
45 | 54 |
// Java object |
46 | 55 |
if (result.getChart() instanceof JFreeChart) { |
... | ... | |
102 | 111 |
|
103 | 112 |
chart.setNotify(true); |
104 | 113 |
} |
105 |
// File |
|
106 |
else if (result.getChart() instanceof File) { |
|
107 |
// creates a new chart but using the same file |
|
108 |
this.createChartFile(result, (File) result.getChart()); |
|
114 |
else { |
|
115 |
Log.severe("Error: JFCChartCreator only manage JFC charts: " + result.getChart()); |
|
109 | 116 |
} |
117 |
// // File |
|
118 |
// else if (result.getChart() instanceof File) { |
|
119 |
// // creates a new chart but using the same file |
|
120 |
// this.createChartFile(result, (File) result.getChart()); |
|
121 |
// } |
|
122 |
// else { // FIXME hack to set the chart File |
|
123 |
// result.setChart(this.createChartFile(result)); |
|
124 |
// } |
|
110 | 125 |
} |
111 | 126 |
|
112 | 127 |
|
... | ... | |
130 | 145 |
return colors; |
131 | 146 |
} |
132 | 147 |
|
133 |
|
|
134 |
|
|
135 |
|
|
136 | 148 |
@Override |
137 |
public Class getChartsEngineClass() { |
|
149 |
public Class<JFCChartsEngine> getChartsEngineClass() {
|
|
138 | 150 |
return JFCChartsEngine.class; |
139 | 151 |
} |
140 |
|
|
141 |
/** |
|
142 |
* Convenience method. |
|
143 |
* |
|
144 |
* @return the casted charts engine. |
|
145 |
*/ |
|
146 |
protected JFCChartsEngine getChartsEngine() { |
|
147 |
return (JFCChartsEngine) this.chartsEngine; |
|
148 |
} |
|
149 |
|
|
150 | 152 |
} |
tmp/org.txm.ahc.core/src/org/txm/ahc/core/chartsengine/r/RAHCChartCreator.java (revision 2720) | ||
---|---|---|
3 | 3 |
import java.io.File; |
4 | 4 |
|
5 | 5 |
import org.txm.ahc.core.functions.AHC; |
6 |
import org.txm.chartsengine.core.results.ChartResult; |
|
7 | 6 |
import org.txm.chartsengine.r.core.RChartCreator; |
8 | 7 |
|
9 | 8 |
/** |
... | ... | |
13 | 12 |
* @author sjacquot |
14 | 13 |
* |
15 | 14 |
*/ |
16 |
public class RAHCChartCreator extends RChartCreator { |
|
15 |
public class RAHCChartCreator extends RChartCreator<AHC> {
|
|
17 | 16 |
|
18 |
|
|
19 | 17 |
@Override |
20 |
public File createChartFile(ChartResult result, File file) {
|
|
18 |
public File createChart(AHC result, File file) {
|
|
21 | 19 |
|
22 |
AHC ahc = (AHC) result;
|
|
20 |
AHC ahc = result; |
|
23 | 21 |
|
24 | 22 |
String cmd = null; |
25 | 23 |
// 2D |
... | ... | |
43 | 41 |
|
44 | 42 |
|
45 | 43 |
@Override |
46 |
public Class getResultDataClass() { |
|
44 |
public Class<AHC> getResultDataClass() {
|
|
47 | 45 |
return AHC.class; |
48 | 46 |
} |
49 |
|
|
50 |
|
|
51 |
|
|
52 | 47 |
} |
tmp/org.txm.cooccurrence.chartsengine/src/org/txm/cooccurrence/chartsengine/CooccurrenceGSChartCreator.java (revision 2720) | ||
---|---|---|
23 | 23 |
*/ |
24 | 24 |
// FIXME: simulation tests for cooccurrence chart |
25 | 25 |
public class CooccurrenceGSChartCreator extends GSChartCreator { |
26 |
|
|
26 |
|
|
27 | 27 |
/** |
28 | 28 |
* |
29 | 29 |
*/ |
30 | 30 |
public CooccurrenceGSChartCreator() { |
31 | 31 |
// TODO Auto-generated constructor stub |
32 | 32 |
} |
33 |
|
|
33 |
|
|
34 | 34 |
@Override |
35 | 35 |
public Object createChart(ChartResult result) { |
36 |
// |
|
37 |
// String styleSheet =
|
|
38 |
// "node {" +
|
|
39 |
// " fill-mode: dyn-plain;" +
|
|
40 |
// " fill-color: grey;" +
|
|
41 |
// " size-mode: dyn-size;" +
|
|
42 |
// " size: 5px;" +
|
|
43 |
//// " size: 30px, 30px;" +
|
|
44 |
//// " text-size: 12px;" +
|
|
45 |
//// " shape: freeplane;" +
|
|
46 |
//// // " size-mode: fit;" +
|
|
47 |
//// " fill-mode: none;" +
|
|
48 |
//// " stroke-mode: plain;" +
|
|
49 |
// "}" +
|
|
50 |
// "edge {" +
|
|
51 |
// " shape: cubic-curve;" +
|
|
52 |
// |
|
53 |
// |
|
54 |
// |
|
55 |
//// " stroke-mode: plain;" +
|
|
56 |
//
|
|
57 |
// "}" +
|
|
58 |
// /*"node.marked {" +
|
|
59 |
// " fill-color: red;" +
|
|
60 |
// "}" +*/
|
|
61 |
//
|
|
62 |
// "node.titre {" +
|
|
63 |
// " size: 55px, 45px;" +
|
|
64 |
// " fill-color: blue;" +
|
|
65 |
// " text-color: red;" +
|
|
66 |
// " shape: diamond;" +
|
|
67 |
// "}" +
|
|
68 |
// |
|
69 |
// "node.axe {" +
|
|
70 |
// " fill-color: blue;" +
|
|
71 |
// " text-color: blue;" +
|
|
72 |
// " shape: box;" +
|
|
73 |
// "}" +
|
|
74 |
// /*
|
|
75 |
// "node.mot {" +
|
|
76 |
// " fill-color: green;" +
|
|
77 |
// " text-color: green;" +
|
|
78 |
// "}" +*/
|
|
79 |
// "node.auteur {" +
|
|
80 |
// " fill-color: red;" +
|
|
81 |
// " text-color: gray;" +
|
|
82 |
// " shape: diamond;" +
|
|
83 |
// "}";
|
|
84 |
//
|
|
36 |
//
|
|
37 |
// String styleSheet =
|
|
38 |
// "node {" +
|
|
39 |
// " fill-mode: dyn-plain;" +
|
|
40 |
// " fill-color: grey;" +
|
|
41 |
// " size-mode: dyn-size;" +
|
|
42 |
// " size: 5px;" +
|
|
43 |
//// " size: 30px, 30px;" +
|
|
44 |
//// " text-size: 12px;" +
|
|
45 |
//// " shape: freeplane;" +
|
|
46 |
//// // " size-mode: fit;" +
|
|
47 |
//// " fill-mode: none;" +
|
|
48 |
//// " stroke-mode: plain;" +
|
|
49 |
// "}" +
|
|
50 |
// "edge {" +
|
|
51 |
// " shape: cubic-curve;" +
|
|
52 |
//
|
|
53 |
//
|
|
54 |
//
|
|
55 |
//// " stroke-mode: plain;" +
|
|
56 |
//
|
|
57 |
// "}" +
|
|
58 |
// /*"node.marked {" +
|
|
59 |
// " fill-color: red;" +
|
|
60 |
// "}" +*/
|
|
61 |
//
|
|
62 |
// "node.titre {" +
|
|
63 |
// " size: 55px, 45px;" +
|
|
64 |
// " fill-color: blue;" +
|
|
65 |
// " text-color: red;" +
|
|
66 |
// " shape: diamond;" +
|
|
67 |
// "}" +
|
|
68 |
//
|
|
69 |
// "node.axe {" +
|
|
70 |
// " fill-color: blue;" +
|
|
71 |
// " text-color: blue;" +
|
|
72 |
// " shape: box;" +
|
|
73 |
// "}" +
|
|
74 |
// /*
|
|
75 |
// "node.mot {" +
|
|
76 |
// " fill-color: green;" +
|
|
77 |
// " text-color: green;" +
|
|
78 |
// "}" +*/
|
|
79 |
// "node.auteur {" +
|
|
80 |
// " fill-color: red;" +
|
|
81 |
// " text-color: gray;" +
|
|
82 |
// " shape: diamond;" +
|
|
83 |
// "}";
|
|
84 |
//
|
|
85 | 85 |
|
86 | 86 |
Cooccurrence cooccurrence = (Cooccurrence) result.getParent(); |
87 |
//Graph graph = (Graph) result.getChart(); |
|
87 |
// Graph graph = (Graph) result.getChart();
|
|
88 | 88 |
|
89 | 89 |
Graph graph = new SingleGraph(cooccurrence.getSimpleName()); |
90 |
// graph.addAttribute("ui.stylesheet", styleSheet); |
|
91 |
|
|
90 |
// graph.addAttribute("ui.stylesheet", styleSheet); |
|
92 | 91 |
|
93 |
// graph.clear(); |
|
94 |
// graph.clearSinks(); |
|
95 |
// |
|
96 |
// Generator gen = new DorogovtsevMendesGenerator(); |
|
97 |
// gen.addSink(graph); |
|
98 |
// gen.begin(); |
|
99 |
// for(int i=0; i<500; i++) { |
|
100 |
// gen.nextEvents(); |
|
101 |
// } |
|
102 |
// gen.end(); |
|
103 |
|
|
104 |
//graph.addAttribute("ui.stylesheet", styleSheet); |
|
105 |
//System.setProperty("org.graphstream.ui.renderer", "org.graphstream.ui.j2dviewer.J2DGraphRenderer"); // Pour les fonctionnalités avancées des CSS |
|
106 |
|
|
107 |
// int maxSize = 20; |
|
108 |
// |
|
109 |
// // add query node |
|
110 |
// Node rootNode = graph.addNode(cooccurrence.getQuery().getQueryString()); |
|
111 |
// rootNode.addAttribute("ui.size", 5); |
|
112 |
// rootNode.addAttribute("ui.color", Color.RED); |
|
113 |
// |
|
114 |
// // add cooccurrents nodes |
|
115 |
// for (int i = 0; i < cooccurrence.getLines().size(); i++) { |
|
116 |
// |
|
117 |
// Node n2 = graph.addNode(cooccurrence.getLines().get(i).occ); |
|
118 |
// n2.addAttribute("ui.size", cooccurrence.getLines().get(i).freq / 5); |
|
119 |
// |
|
120 |
// graph.addEdge(String.valueOf(i), rootNode, n2); |
|
121 |
// |
|
122 |
// } |
|
123 |
// |
|
124 |
//// graph.addNode("A"); |
|
125 |
//// graph.addNode("B"); |
|
126 |
//// graph.addNode("C"); |
|
127 |
//// graph.addEdge("AB", "A", "B"); |
|
128 |
//// graph.addEdge("BC", "B", "C"); |
|
129 |
//// graph.addEdge("CA", "C", "A"); |
|
130 |
// |
|
131 |
// // set text labels |
|
132 |
// for (Node n : graph) { |
|
133 |
// n.setAttribute("ui.label", n.getId()); |
|
134 |
// } |
|
135 |
|
|
136 |
|
|
92 |
|
|
93 |
// graph.clear(); |
|
94 |
// graph.clearSinks(); |
|
95 |
// |
|
96 |
// Generator gen = new DorogovtsevMendesGenerator(); |
|
97 |
// gen.addSink(graph); |
|
98 |
// gen.begin(); |
|
99 |
// for(int i=0; i<500; i++) { |
|
100 |
// gen.nextEvents(); |
|
101 |
// } |
|
102 |
// gen.end(); |
|
103 |
|
|
104 |
// graph.addAttribute("ui.stylesheet", styleSheet); |
|
105 |
// System.setProperty("org.graphstream.ui.renderer", "org.graphstream.ui.j2dviewer.J2DGraphRenderer"); // Pour les fonctionnalités avancées des CSS |
|
106 |
|
|
107 |
// int maxSize = 20; |
|
108 |
// |
|
109 |
// // add query node |
|
110 |
// Node rootNode = graph.addNode(cooccurrence.getQuery().getQueryString()); |
|
111 |
// rootNode.addAttribute("ui.size", 5); |
|
112 |
// rootNode.addAttribute("ui.color", Color.RED); |
|
113 |
// |
|
114 |
// // add cooccurrents nodes |
|
115 |
// for (int i = 0; i < cooccurrence.getLines().size(); i++) { |
|
116 |
// |
|
117 |
// Node n2 = graph.addNode(cooccurrence.getLines().get(i).occ); |
|
118 |
// n2.addAttribute("ui.size", cooccurrence.getLines().get(i).freq / 5); |
|
119 |
// |
Formats disponibles : Unified diff