Révision 3568

TXM/trunk/org.txm.cooccurrence.chartsengine/META-INF/MANIFEST.MF (revision 3568)
1 1
Manifest-Version: 1.0
2 2
Bundle-ManifestVersion: 2
3 3
Bundle-Name: Cooccurrence Graphs
4
Bundle-SymbolicName: org.txm.cooccurrence.chartsengine;singleton:=true
4
Bundle-SymbolicName: org.txm.dev.cooccurrence.chartsengine;singleton:=true
5 5
Bundle-Version: 1.0.0.qualifier
6 6
Bundle-Vendor: Textometrie.org
7 7
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
TXM/trunk/org.txm.cooccurrence.chartsengine/.project (revision 3568)
1 1
<?xml version="1.0" encoding="UTF-8"?>
2 2
<projectDescription>
3
	<name>org.txm.cooccurrence.chartsengine</name>
3
	<name>org.txm.dev.cooccurrence.chartsengine</name>
4 4
	<comment></comment>
5 5
	<projects>
6 6
	</projects>
TXM/trunk/org.txm.index.rcp/src/org/txm/index/rcp/handlers/ComputeIndex.java (revision 3568)
56 56
		
57 57
		Index index = null;
58 58
		
59
		// From link: creating from parameters node
59
		// From link/"send to command": creating from a prebuilt parameter node path
60
		//FIXME: SJ: all "Send to" commands have a different node path schema than normal result creation since we do not know the target class in the source handler (the class string is replaced with "_link")  
60 61
		String parametersNodePath = event.getParameter(TXMPreferences.RESULT_PARAMETERS_NODE_PATH);
61 62
		if (parametersNodePath != null && !parametersNodePath.isEmpty()) {
62 63
			index = new Index(parametersNodePath);
TXM/trunk/org.txm.progression.rcp/src/org/txm/progression/rcp/handlers/ComputeProgression.java (revision 3568)
57 57

  
58 58
		Progression progression = null;
59 59
		
60
		// From link: creating from parameter node
61
		//FIXME: SJ: all "Send to" commands have a different node path schema since we do not know the target class in the source handler (the class string is replaced with "_link")  
60
		// From link/"send to command": creating from a prebuilt parameter node path
61
		//FIXME: SJ: all "Send to" commands have a different node path schema than normal result creation since we do not know the target class in the source handler (the class string is replaced with "_link")  
62 62
		String parametersNodePath = event.getParameter(TXMPreferences.RESULT_PARAMETERS_NODE_PATH);
63 63
		if (parametersNodePath != null && !parametersNodePath.isEmpty()) {
64 64
			progression = new Progression(parametersNodePath);
TXM/trunk/org.txm.concordance.rcp/src/org/txm/concordance/rcp/handlers/ComputeConcordance.java (revision 3568)
58 58
		
59 59
		Concordance concordance = null;
60 60
		
61
		// From link: creating from parameter node
61
		// From link/"send to command": creating from a prebuilt parameter node path
62
		//FIXME: SJ: all "Send to" commands have a different node path schema than normal result creation since we do not know the target class in the source handler (the class string is replaced with "_link")  
62 63
		String parametersNodePath = event.getParameter(TXMPreferences.RESULT_PARAMETERS_NODE_PATH);
63 64
		if (parametersNodePath != null && !parametersNodePath.isEmpty()) {
64 65
			if ("none".equals(parametersNodePath)) {
TXM/trunk/org.txm.rcp/src/main/java/org/txm/rcp/editors/TXMEditorToolBar.java (revision 3568)
154 154
	 * 
155 155
	 * @param combo
156 156
	 */
157
	public void addControl(final Combo combo) {
157
	public void addCombo(final Combo combo) {
158 158
		final ToolItem itemSeparator = new ToolItem(this, SWT.SEPARATOR);
159 159
		combo.pack();
160 160
		itemSeparator.setWidth(combo.getBounds().width);
......
168 168
			}
169 169
		};
170 170

  
171
		
172 171
		combo.addListener(SWT.RESIZE, listener);
173 172
		combo.addListener(SWT.Modify, listener);
174 173
	}
TXM/trunk/org.txm.links.rcp/src/org/txm/links/rcp/handlers/SendSelectionToQueryable.java (revision 3568)
45 45
 * 
46 46
 */
47 47
// FIXME: SJ: improvements:
48
// - create an interface as SeletionSendableAsQueries with method createQueries() or buildQueries() or getQueries()
49
// - instead of subclassing this class, Editors can implement SeletionSendableAsQueries interface and the method
48
// solution 1 - create an interface as SelectionSendableAsQueries with method createQueries() or buildQueries() or getQueries()
49
// - instead of subclassing this class, Editors can implement SeletionSendableAsQueries interface and the method?
50
// solution 2 - create a unique interface as SelectionSendable with 1 method as createTargetParameters() that directly returns a map of parameters
51
// eg. {TXMPreferences.QUERY, "[word=faire]"}
52

  
53

  
50 54
public abstract class SendSelectionToQueryable extends BaseAbstractHandler {
51 55
	
52 56
	/**
......
94 98
		ISelection selection = HandlerUtil.getCurrentSelection(event);
95 99
		
96 100
		if (selection != null && !selection.isEmpty()) {
97
			
101

  
98 102
			String query = this.createQuery(event, selection);
99 103
			String queries = this.createQueries(event, selection);
100 104
			Integer index = this.getIndexResult(event, selection);
......
108 112
			// create a local result node in the project node, store in some parameters and call the linked command
109 113
			String id = event.getCommand().getId();
110 114
			TXMResult result = this.getResultParent(event, id);
111
			// FIXME: we can't put the class name here since we does not know the target class
115
			// FIXME: SJ: we can't put the class name in the result node path here since we does not know the target class
112 116
			String resultParametersNodePath = result.getProject().getParametersNodeRootPath() + TXMResult.createUUID() + "_link";  //$NON-NLS-1$
113 117

  
114 118
			TXMPreferences.put(resultParametersNodePath, TXMPreferences.PARENT_PARAMETERS_NODE_PATH, result.getParametersNodePath());
TXM/trunk/org.txm.chartsengine.rcp/src/org/txm/chartsengine/rcp/swt/AdvancedChartEditorToolBar.java (revision 3568)
5 5
import java.util.ArrayList;
6 6

  
7 7
import org.apache.commons.lang.StringUtils;
8
import org.eclipse.jface.resource.StringConverter;
9 8
import org.eclipse.swt.SWT;
10 9
import org.eclipse.swt.events.SelectionEvent;
11 10
import org.eclipse.swt.events.SelectionListener;
12
import org.eclipse.swt.graphics.FontData;
13 11
import org.eclipse.swt.widgets.Combo;
14 12
import org.eclipse.swt.widgets.Composite;
15 13
import org.eclipse.swt.widgets.ToolItem;
......
38 36
public class AdvancedChartEditorToolBar extends ChartEditorToolBar {
39 37
	
40 38
	public final static String ID = "AdvancedChartEditorToolBar";
41
	private ToolItem showTitleButton;
42
	private ToolItem showLegendButton;
43
	private ToolItem showGridButton;
44
	private Combo renderingModeCombo;
45
	private Combo fontCombo;
46
	private Combo fontSizeCombo;
47
	private Combo chartTypeCombo;
48
	private Font currentFont;
49
	private Combo fontStyleCombo;
39

  
50 40
	
41

  
51 42
	/**
52 43
	 * Creates a new chart editor tool bar dedicated to advanced parameters.
53 44
	 * @param parent
......
55 46
	 */
56 47
	public AdvancedChartEditorToolBar(ChartEditor<? extends ChartResult> chartEditor, Composite parent, GLComposite subWidgetsComposite, int style) {
57 48
		super(chartEditor, parent, subWidgetsComposite, style, AdvancedChartEditorToolBar.ID);
49

  
58 50
		
51
		// Show/hide chart title button
52
		final ToolItem showTitleButton = new ToolItem(this, SWT.CHECK);
53
		// showTitleButton.setText(SWTComponentsProviderMessages.showhideTitle);
54
		showTitleButton.setImage(IImageKeys.getImage(getClass(), "icons/show_title.png")); //$NON-NLS-1$
55
		showTitleButton.setDisabledImage(IImageKeys.getImage(getClass(), "icons/show_title_disabled.png")); //$NON-NLS-1$
56
		showTitleButton.setToolTipText(ChartsUIMessages.showhideTitle);
57

  
59 58
		if (!chartEditor.getResult().isEmptyPreference(ChartsEnginePreferences.SHOW_TITLE)) {
60
			showTitleButton = new ToolItem(this, SWT.CHECK);
61
			// showTitleButton.setText(SWTComponentsProviderMessages.showhideTitle);
62
			showTitleButton.setImage(IImageKeys.getImage(getClass(), "icons/show_title.png")); //$NON-NLS-1$
63
			showTitleButton.setDisabledImage(IImageKeys.getImage(getClass(), "icons/show_title_disabled.png")); //$NON-NLS-1$
64
			showTitleButton.setToolTipText(ChartsUIMessages.showhideTitle);
65
			
66 59
			showTitleButton.setSelection(chartEditor.getResult().isTitleVisible());
67 60
		}
68
		//		// disable if not managed by the command
69
		//		else {
70
		//			showTitleButton.setEnabled(false);
71
		//		}
61
		// disable if not managed by the command
62
		else {
63
			showTitleButton.setEnabled(false);
64
		}
72 65
		
66
		
67
		// Show/hide chart legend button
68
		final ToolItem showLegendButton = new ToolItem(this, SWT.CHECK);
69
		// showLegendButton.setText(SWTComponentsProviderMessages.showhideLegend);
70
		showLegendButton.setImage(IImageKeys.getImage(getClass(), "icons/show_legend.png")); //$NON-NLS-1$
71
		showLegendButton.setDisabledImage(IImageKeys.getImage(getClass(), "icons/show_legend_disabled.png")); //$NON-NLS-1$
72
		showLegendButton.setToolTipText(ChartsUIMessages.showhideLegend);
73

  
73 74
		if (!chartEditor.getResult().isEmptyPreference(ChartsEnginePreferences.SHOW_LEGEND)) {
74
			showLegendButton = new ToolItem(this, SWT.CHECK);
75
			// showLegendButton.setText(SWTComponentsProviderMessages.showhideLegend);
76
			showLegendButton.setImage(IImageKeys.getImage(getClass(), "icons/show_legend.png")); //$NON-NLS-1$
77
			showLegendButton.setDisabledImage(IImageKeys.getImage(getClass(), "icons/show_legend_disabled.png")); //$NON-NLS-1$
78
			showLegendButton.setToolTipText(ChartsUIMessages.showhideLegend);
79
			
80 75
			showLegendButton.setSelection(chartEditor.getResult().isLegendVisible());
81 76
		}
82
		//		// disable if not managed by the command
83
		//		else {
84
		//			showLegendButton.setEnabled(false);
85
		//		}
77
		// disable if not managed by the command
78
		else {
79
			showLegendButton.setEnabled(false);
80
		}
86 81
		
82
		
83
		// Show/hide chart background grid button
84
		final ToolItem showGridButton = new ToolItem(this, SWT.CHECK);
85
		// showGridButton.setText(SWTComponentsProviderMessages.showhideGrid);
86
		showGridButton.setImage(IImageKeys.getImage(getClass(), "icons/show_grid.png")); //$NON-NLS-1$
87
		showGridButton.setDisabledImage(IImageKeys.getImage(getClass(), "icons/show_grid_disabled.png")); //$NON-NLS-1$
88
		showGridButton.setToolTipText(ChartsUIMessages.showhideGrid);
89

  
87 90
		if (!chartEditor.getResult().isEmptyPreference(ChartsEnginePreferences.SHOW_GRID)) {
88
			showGridButton = new ToolItem(this, SWT.CHECK);
89
			// showGridButton.setText(SWTComponentsProviderMessages.showhideGrid);
90
			showGridButton.setImage(IImageKeys.getImage(getClass(), "icons/show_grid.png")); //$NON-NLS-1$
91
			showGridButton.setDisabledImage(IImageKeys.getImage(getClass(), "icons/show_grid_disabled.png")); //$NON-NLS-1$
92
			showGridButton.setToolTipText(ChartsUIMessages.showhideGrid);
93
			
94 91
			showGridButton.setSelection(chartEditor.getResult().isGridVisible());
95 92
		}
96
		//		// disable if not managed by the command
97
		//		else {
98
		//			showGridButton.setEnabled(false);
99
		//		}
93
		// disable if not managed by the command
94
		else {
95
			showGridButton.setEnabled(false);
96
		}
97

  
98

  
99
		// Rendering colors mode selection
100
		new ToolItem(this, SWT.SEPARATOR);
101
		final Combo renderingModeCombo = new Combo(this, SWT.READ_ONLY);
102
		String colorsModes[] = new String[] { ChartsUIMessages.colors,
103
				ChartsUIMessages.grayscale,
104
				ChartsUIMessages.blackAndWhite,
105
				ChartsUIMessages.monochrome
106
		};
107
		renderingModeCombo.setItems(colorsModes);
100 108
		
109
		this.addCombo(renderingModeCombo);
101 110
		
102 111
		if (!chartEditor.getResult().isEmptyPreference(ChartsEnginePreferences.RENDERING_COLORS_MODE)) {
103
			// Rendering colors mode selection
104
			new ToolItem(this, SWT.SEPARATOR);
105
			renderingModeCombo = new Combo(this, SWT.READ_ONLY);
106
			String colorsModes[] = new String[] { ChartsUIMessages.colors,
107
					ChartsUIMessages.grayscale,
108
					ChartsUIMessages.blackAndWhite,
109
					ChartsUIMessages.monochrome
110
			};
111
			renderingModeCombo.setItems(colorsModes);
112
			
113
//			ToolItem renderingComboItem = new ToolItem(this, SWT.SEPARATOR);
114
//			renderingComboItem.setControl(renderingModeCombo);
115
//			renderingModeCombo.pack();
116
//			renderingComboItem.setWidth(renderingModeCombo.getBounds().width);
117
			
118
			this.addControl(renderingModeCombo);
119
			
120 112
			renderingModeCombo.select(chartEditor.getResult().getRenderingColorsMode());
121 113
		}
122
		//		// disable if not managed
123
		//		else {
124
		//			renderingModeCombo.setEnabled(false);
125
		//		}
114
		// disable if not managed
115
		else {
116
			renderingModeCombo.setEnabled(false);
117
		}
118

  
126 119
		
127
		
128 120
		// Font selection
129
		currentFont = ChartsEngine.createFont(chartEditor.getResult().getFont());
121
		final Font currentFont = ChartsEngine.createFont(chartEditor.getResult().getFont());
130 122

  
131 123
		 // FIXME: SJ: may be better here to get the fonts from SWT rather than from Java, see  java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment().getAllFonts();
132
		fontCombo = new Combo(this, SWT.READ_ONLY);
124
		final Combo fontCombo = new Combo(this, SWT.READ_ONLY);
133 125
		String fonts[] = GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames();
134 126
		fontCombo.setItems(fonts);
135 127
		
136
//		ToolItem fontsComboItem = new ToolItem(this, SWT.SEPARATOR);
137
//		fontsComboItem.setControl(fontCombo);
138
//		fontCombo.pack();
139
//		fontsComboItem.setWidth(fontCombo.getBounds().width);
128
		this.addCombo(fontCombo);
140 129
		
141
		this.addControl(fontCombo);
142
		
143 130
		int currentFontIndex = 0;
144 131
		for (int i = 0; i < fonts.length; i++) {
145 132
			if (fonts[i].equals(currentFont.getName())) {
......
148 135
			}
149 136
		}
150 137
		fontCombo.select(currentFontIndex);
151
		
138

  
139

  
152 140
		// Font size
153
		fontSizeCombo = new Combo(this, SWT.READ_ONLY);
141
		final Combo fontSizeCombo = new Combo(this, SWT.READ_ONLY);
154 142
		String fontSizes[] = new String[30];
155 143
		int currentFontSizeIndex = 0;
156 144
		for (int i = 0; i < fontSizes.length; i++) {
......
162 150
		}
163 151
		fontSizeCombo.setItems(fontSizes);
164 152
		
165
//		ToolItem fontSizeComboItem = new ToolItem(this, SWT.SEPARATOR);
166
//		fontSizeComboItem.setControl(fontSizeCombo);
167
//		fontSizeCombo.pack();
168
//		fontSizeComboItem.setWidth(fontSizeCombo.getBounds().width);
153
		this.addCombo(fontSizeCombo);
169 154
		
170
		this.addControl(fontSizeCombo);
171
		
172 155
		fontSizeCombo.select(currentFontSizeIndex);
173 156
		
174
		
157

  
175 158
		// Font style
176
		fontStyleCombo = new Combo(this, SWT.READ_ONLY);
159
		final Combo fontStyleCombo = new Combo(this, SWT.READ_ONLY);
177 160

  
178
		
179 161
		//FIXME: SJ: the styles list should be builded from the available styles of the current selected font.
180 162
		// Here are some tests to try to get the available styles
181 163
		
......
204 186
		int currentFontStyleIndex = currentFont.getStyle();
205 187
		fontStyleCombo.setItems(fontStyles);
206 188
		
207
//		ToolItem fontStyleComboItem = new ToolItem(this, SWT.SEPARATOR);
208
//		fontStyleComboItem.setControl(fontStyleCombo);
209
//		fontStyleCombo.pack();
210
//		fontStyleComboItem.setWidth(fontStyleCombo.getBounds().width);
189
		this.addCombo(fontStyleCombo);
211 190
		
212
		this.addControl(fontStyleCombo);
213
		
214 191
		fontStyleCombo.select(currentFontStyleIndex);
215 192
		
216 193
		
217
		
194
		// FIXME: SJ: this Combo may not be created if is not in expert mode. At this moment, it's created and hidden
218 195
		// Chart types from installed chart creators in all installed charts engines
219
		chartTypeCombo = new Combo(this, SWT.READ_ONLY);
196
		final Combo chartTypeCombo = new Combo(this, SWT.READ_ONLY);
220 197
		if (TBXPreferences.getInstance().getBoolean(TBXPreferences.EXPERT_USER)) {
221 198
			
222 199
			ArrayList<String> chartsEngineNames = new ArrayList<>();
......
251 228
			}
252 229
			chartTypeCombo.setItems(chartTypes);
253 230
			
254
//			ToolItem chartTypeComboItem = new ToolItem(this, SWT.SEPARATOR);
255
//			chartTypeComboItem.setControl(chartTypeCombo);
256
//			chartTypeCombo.pack();
257
//			chartTypeComboItem.setWidth(chartTypeCombo.getBounds().width);
231
			this.addCombo(chartTypeCombo);
258 232
			
259

  
260
			this.addControl(chartTypeCombo);
261 233
			
262
			
263 234
			chartTypeCombo.select(currentChartCreatorIndex);
264 235
			
265 236
			
......
267 238
				chartTypeCombo.setVisible(false);
268 239
			}
269 240
		}
241
		else  {
242
			chartTypeCombo.setVisible(false);
243
		}
270 244
		
271 245
		
272 246
		// Listeners
......
332 306
				
333 307
			}
334 308
		};
335
		if (showTitleButton != null) showTitleButton.addSelectionListener(listener);
336
		if (showLegendButton != null) showLegendButton.addSelectionListener(listener);
337
		if (showGridButton != null) showGridButton.addSelectionListener(listener);
338
		if (renderingModeCombo != null) renderingModeCombo.addSelectionListener(listener);
339
		if (fontCombo != null) fontCombo.addSelectionListener(listener);
340
		if (fontSizeCombo != null) fontSizeCombo.addSelectionListener(listener);
341
		if (fontStyleCombo != null) fontStyleCombo.addSelectionListener(listener);
342
		if (chartTypeCombo != null) chartTypeCombo.addSelectionListener(listener);
309
		
310
		
311
		// Add listener
312
		if (showTitleButton.isEnabled()) {
313
			showTitleButton.addSelectionListener(listener);
314
		}
315
		if (showLegendButton != null) {
316
			showLegendButton.addSelectionListener(listener);
317
		}
318
		if (showGridButton != null) {
319
			showGridButton.addSelectionListener(listener);
320
		}
321
		if (renderingModeCombo != null) {
322
			renderingModeCombo.addSelectionListener(listener);
323
		}
324
		fontCombo.addSelectionListener(listener);
325
		fontSizeCombo.addSelectionListener(listener);
326
		fontStyleCombo.addSelectionListener(listener);
327
		if (chartTypeCombo.isVisible()) {
328
			chartTypeCombo.addSelectionListener(listener);
329
		}
343 330
	}
344 331
	
345 332
	

Formats disponibles : Unified diff