Révision 3733

TXM/trunk/bundles/org.txm.chartsengine.jfreechart.core/src/org/txm/chartsengine/jfreechart/core/themes/highcharts/defaulttheme/HighchartsDefaultTheme.java (revision 3733)
173 173
		
174 174
		// Antialiasing
175 175
		// chart.setRenderingHints( new RenderingHints( RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON ) );
176
		chart.setAntiAlias(antialiasing);
177
		chart.setTextAntiAlias(antialiasing);
176
		chart.setAntiAlias(this.antialiasing);
177
		chart.setTextAntiAlias(this.antialiasing);
178 178
		
179 179
		chart.getPlot().setNoDataMessage("Loading chart...");
180 180
		chart.getPlot().setInsets(new RectangleInsets(10, 10, 10, 10));
......
194 194
		// XY Line chart / CA Factorial Map / XY Bar chart
195 195
		if (tmpPlot instanceof XYPlot) {
196 196
			
197
			
198 197
			XYPlot plot = (XYPlot) tmpPlot;
199 198
			AbstractRenderer renderer = (AbstractRenderer) plot.getRenderer();
200 199
			
......
283 282
			plot.getRangeAxis().setAxisLineVisible(false);
284 283
			plot.getRangeAxis().setTickMarksVisible(false);
285 284
			
286
			plot.getRangeAxis().setAxisLinePaint(Color.decode("#C0D0E0"));
287
			plot.getRangeAxis().setTickMarkPaint(Color.decode("#C0D0E0"));
285
			plot.getRangeAxis().setAxisLinePaint(Color.decode("#C0D0E0")); //$NON-NLS-1$
286
			plot.getRangeAxis().setTickMarkPaint(Color.decode("#C0D0E0")); //$NON-NLS-1$
288 287
			plot.getRangeAxis().setTickMarkOutsideLength(5);
289 288
			plot.getRangeAxis().setTickLabelFont(regularFont.deriveFont(Font.BOLD));
290 289
			
291 290

  
292
			// SJ: to fix a bug with unbreakable space thousand separator that is displayed as a white square glyph with some fonts
291
			// SJ: to fix a bug with unbreakable space thousands separator that is displayed as a white square glyph with some fonts (#3369)
293 292
			NumberAxis range = (NumberAxis) plot.getRangeAxis();
294 293
			DecimalFormat formatter = (DecimalFormat) DecimalFormat.getInstance();
295 294
			DecimalFormatSymbols symbols = formatter.getDecimalFormatSymbols();
296 295
			
297 296
			if((int)symbols.getGroupingSeparator() == 8239) { //unbreakable space char code
298
				symbols.setGroupingSeparator(' ');
297
				symbols.setGroupingSeparator(' '); //$NON-NLS-1$
299 298
				formatter.setDecimalFormatSymbols(symbols);
300 299
				range.setNumberFormatOverride(formatter);
301 300
			}
302 301

  
303 302
			
304
			plot.getDomainAxis().setAxisLinePaint(Color.decode("#C0D0E0"));
305
			plot.getDomainAxis().setTickMarkPaint(Color.decode("#C0D0E0"));
303
			plot.getDomainAxis().setAxisLinePaint(Color.decode("#C0D0E0")); //$NON-NLS-1$
304
			plot.getDomainAxis().setTickMarkPaint(Color.decode("#C0D0E0")); //$NON-NLS-1$
306 305
			plot.getDomainAxis().setTickMarkOutsideLength(5);
307 306
			plot.getDomainAxis().setTickLabelFont(regularFont.deriveFont(Font.BOLD));
308 307
			
309 308
			plot.setRangeZeroBaselineVisible(true);
310 309
			
311 310
			// Zero base lines colors
312
			plot.setDomainZeroBaselinePaint(Color.decode("#C0D0E0").darker());
313
			plot.setRangeZeroBaselinePaint(Color.decode("#C0D0E0").darker());
311
			plot.setDomainZeroBaselinePaint(Color.decode("#C0D0E0").darker()); //$NON-NLS-1$
312
			plot.setRangeZeroBaselinePaint(Color.decode("#C0D0E0").darker()); //$NON-NLS-1$
314 313
			
315 314
			
316 315
			// NumberAxis domainAxis = (NumberAxis) plot.getDomainAxis();
......
355 354
			
356 355
			// Zero base line
357 356
			plot.setRangeZeroBaselineVisible(true);
358
			plot.setRangeZeroBaselinePaint(Color.decode("#000000"));
357
			plot.setRangeZeroBaselinePaint(Color.decode("#000000")); //$NON-NLS-1$
359 358
			
360 359
			
361 360
			// Axis
362 361
			plot.getRangeAxis().setAxisLineVisible(false);
363 362
			plot.getRangeAxis().setTickMarksVisible(false);
364
			plot.getRangeAxis().setTickLabelPaint(Color.decode("#666666"));
363
			plot.getRangeAxis().setTickLabelPaint(Color.decode("#666666")); //$NON-NLS-1$
365 364
			plot.getRangeAxis().setTickLabelFont(regularFont.deriveFont(Font.BOLD));
366 365
			
367 366
			
368 367
			// For drawing tick marks between categories and not in theirs middle
369 368
			plot.setDomainAxis(new CategoryAxisBetweenTicks(plot.getDomainAxis()));
370 369
			
371
			plot.getDomainAxis().setAxisLinePaint(Color.decode("#C0D0E0"));
372
			plot.getDomainAxis().setTickMarkPaint(Color.decode("#C0D0E0"));
370
			plot.getDomainAxis().setAxisLinePaint(Color.decode("#C0D0E0")); //$NON-NLS-1$
371
			plot.getDomainAxis().setTickMarkPaint(Color.decode("#C0D0E0")); //$NON-NLS-1$
373 372
			plot.getDomainAxis().setTickMarkOutsideLength(5);
374 373
			plot.getDomainAxis().setTickLabelFont(regularFont.deriveFont(Font.BOLD));
375 374
			// plot.getDomainAxis().setCategoryMargin(0.3); // TODO : incompatible with CategoryAxisBetween ? need to check again
TXM/trunk/bundles/org.txm.properties.rcp/src/org/txm/properties/rcp/editors/PropertiesEditor.java (revision 3733)
1 1
package org.txm.properties.rcp.editors;
2 2

  
3 3
import java.io.File;
4
import java.net.MalformedURLException;
5 4

  
6
import org.eclipse.jface.layout.GridDataFactory;
7 5
import org.eclipse.swt.SWT;
8 6
import org.eclipse.swt.browser.Browser;
9 7
import org.eclipse.swt.custom.StyledText;
10 8
import org.eclipse.swt.events.MouseEvent;
11 9
import org.eclipse.swt.events.MouseWheelListener;
12
import org.eclipse.swt.events.SelectionEvent;
13
import org.eclipse.swt.events.SelectionListener;
14 10
import org.eclipse.swt.layout.GridData;
15
import org.eclipse.swt.layout.GridLayout;
16
import org.eclipse.swt.layout.RowData;
17 11
import org.eclipse.swt.widgets.Button;
18 12
import org.eclipse.swt.widgets.Composite;
19
import org.eclipse.swt.widgets.Group;
20
import org.eclipse.swt.widgets.Label;
21 13
import org.eclipse.swt.widgets.Spinner;
22 14
import org.eclipse.swt.widgets.Text;
23
import org.txm.core.messages.TXMCoreMessages;
24 15
import org.txm.core.results.Parameter;
25 16
import org.txm.properties.core.functions.Properties;
26 17
import org.txm.properties.core.preferences.PropertiesPreferences;
27 18
import org.txm.properties.rcp.messages.PropertiesUIMessages;
28
import org.txm.rcp.IImageKeys;
29 19
import org.txm.rcp.editors.TXMBrowserEditor;
30 20
import org.txm.rcp.editors.TXMEditor;
31
import org.txm.rcp.editors.listeners.ComputeSelectionListener;
32 21
import org.txm.rcp.swt.GLComposite;
33
import org.txm.rcp.swt.widget.LabeledSpinner;
34
import org.txm.rcp.views.corpora.CorporaView;
22
import org.txm.rcp.swt.widget.TXMParameterSpinner;
35 23
import org.txm.utils.logger.Log;
36 24

  
37 25
/**
......
71 59

  
72 60
		
73 61
		
74
		LabeledSpinner fMax = new LabeledSpinner(extendedParametersArea, this, PropertiesUIMessages.vMax);
75
		this.maxPropertiesToDisplay = fMax.getSpinner();
62
		TXMParameterSpinner fMax = new TXMParameterSpinner(extendedParametersArea, this, PropertiesUIMessages.vMax);
63
		this.maxPropertiesToDisplay = fMax.getControl();
76 64
		this.maxPropertiesToDisplay.setToolTipText(PropertiesUIMessages.theMaximumNumberOfWordPropertyValuesToShow);
77 65
		this.maxPropertiesToDisplay.setMinimum(0);
78 66
		this.maxPropertiesToDisplay.setMaximum(1000);
TXM/trunk/bundles/org.txm.properties.rcp/src/org/txm/properties/rcp/editors/PropertiesPagedEditor.java (revision 3733)
1 1
package org.txm.properties.rcp.editors;
2 2

  
3
import java.io.File;
4 3
import java.util.ArrayList;
5 4

  
6 5
import org.eclipse.swt.SWT;
......
8 7
import org.eclipse.swt.widgets.Composite;
9 8
import org.eclipse.swt.widgets.Spinner;
10 9
import org.eclipse.swt.widgets.TabFolder;
11
import org.eclipse.swt.widgets.TabItem;
10
import org.txm.core.results.Parameter;
11
import org.txm.objects.Project;
12 12
import org.txm.properties.core.functions.Properties;
13 13
import org.txm.properties.core.preferences.PropertiesPreferences;
14 14
import org.txm.properties.rcp.messages.PropertiesUIMessages;
15 15
import org.txm.rcp.editors.TXMEditor;
16 16
import org.txm.rcp.swt.GLComposite;
17
import org.txm.rcp.swt.widget.LabeledSpinner;
18
import org.txm.searchengine.cqp.corpus.CQPCorpus;
19
import org.txm.core.results.Parameter;
20
import org.txm.core.results.TXMResult;
21
import org.txm.objects.Project;
17
import org.txm.rcp.swt.widget.TXMParameterSpinner;
22 18

  
23 19
public class PropertiesPagedEditor extends TXMEditor<Properties> {
24 20
	
......
36 32
	public void _createPartControl() throws Exception {
37 33
		
38 34
		Composite extendedParametersArea = this.getExtendedParametersGroup();
39
		LabeledSpinner fMax = new LabeledSpinner(extendedParametersArea, this, PropertiesUIMessages.vMax);
40
		this.maxPropertiesToDisplay = fMax.getSpinner();
35
		TXMParameterSpinner fMax = new TXMParameterSpinner(extendedParametersArea, this, PropertiesUIMessages.vMax);
36
		this.maxPropertiesToDisplay = fMax.getControl();
41 37
		this.maxPropertiesToDisplay.setToolTipText(PropertiesUIMessages.theMaximumNumberOfWordPropertyValuesToShow);
42 38
		this.maxPropertiesToDisplay.setMinimum(0);
43 39
		this.maxPropertiesToDisplay.setMaximum(1000);
TXM/trunk/bundles/org.txm.internalview.rcp/src/org/txm/internalview/rcp/editors/InternalViewEditor.java (revision 3733)
35 35
import org.txm.rcp.editors.listeners.ComputeSelectionListener;
36 36
import org.txm.rcp.messages.TXMUIMessages;
37 37
import org.txm.rcp.swt.GLComposite;
38
import org.txm.rcp.swt.widget.LabeledSpinner;
39 38
import org.txm.rcp.swt.widget.NewNavigationWidget;
40 39
import org.txm.rcp.swt.widget.PropertiesSelector;
40
import org.txm.rcp.swt.widget.TXMParameterSpinner;
41 41
import org.txm.rcp.swt.widget.structures.StructuralUnitsComboViewer;
42 42
import org.txm.searchengine.core.Query;
43 43
import org.txm.searchengine.cqp.CQPSearchEngine;
......
163 163
		
164 164
		
165 165
		// Number of lines per page
166
		LabeledSpinner nLinesPerPagesLabeledSpinner= new LabeledSpinner(this.getExtendedParametersGroup(), this, TXMUIMessages.numberOfLines);
167
		nLinesPerPagesSpinner = nLinesPerPagesLabeledSpinner.getSpinner();
166
		TXMParameterSpinner nLinesPerPagesLabeledSpinner= new TXMParameterSpinner(this.getExtendedParametersGroup(), this, TXMUIMessages.numberOfLines);
167
		nLinesPerPagesSpinner = nLinesPerPagesLabeledSpinner.getControl();
168 168
		nLinesPerPagesSpinner.setMinimum(1);
169 169
		nLinesPerPagesSpinner.setMaximum(Integer.MAX_VALUE);
170 170

  
TXM/trunk/bundles/org.txm.chartsengine.core/src/org/txm/chartsengine/core/ChartsEngine.java (revision 3733)
49 49
	 */
50 50
	public final static int RENDERING_COLORS_MODE = 0, RENDERING_GRAYSCALE_MODE = 1, RENDERING_BLACK_AND_WHITE_MODE = 2, RENDERING_MONOCHROME_MODE = 3;
51 51
	
52
	
52 53
	/**
54
	 * Font styles definition.
55
	 */
56
	//FIXME: SJ: see if we move this in another class to share it
57
	public final static String[] FONT_STYLES = {"Regular", "Bold", "Italic", "Bold italic"};
58
	
59
	/**
60
	 * Logical font names definition.
61
	 */
62
	//FIXME: SJ: see if we move this in another class to share it
63
	public final static String[] FONTS_LOGICAL_NAMES = {"SansSerif", "Monospaced", "Serif"};//$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
64
	
65
	/**
66
	 * User-friendly font names definition.
67
	 */
68
	//FIXME: SJ: see if we move this in another class to share it
69
	public final static String[] FONTS_USER_FRIENDLY_NAMES = {"Arial", "Courier", "Times"};//$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
70
	
71
	
72
	
73
	/**
53 74
	 * The engine description.
54 75
	 */
55 76
	protected String description;
......
76 97
	protected boolean directComputing;
77 98
	
78 99
	
100
	
79 101
	// add the preference node qualifier to the preferences so the command use some preferences if they do not define themselves
80 102
	static {
81 103
		TXMPreferences.alternativeNodesQualifiers.add(ChartsEnginePreferences.getInstance().getPreferencesNodeQualifier());
......
338 360
	 * @return the decoded font
339 361
	 */
340 362
	public static Font createFont(String encodedStr) {
341
		String[] data = encodedStr.split("\\|");
342
		Font font = new Font(data[1], // font name
343
				//3, // font style
344
				Integer.valueOf(data[3]), // font style
345
					
346
					Integer.parseInt(data[2].split("\\.")[0])); // font size
363
		String[] data = encodedStr.split("\\|");///$NON-NLS-1$
364
		Font font = new Font(data[1], Integer.valueOf(data[3]), Integer.parseInt(data[2].split("\\.")[0])); // font name, font style, font size
347 365
		return font;
348 366
	}
349 367
	
TXM/trunk/bundles/org.txm.chartsengine.core/src/org/txm/chartsengine/core/preferences/ChartsEnginePreferences.java (revision 3733)
136 136
//			defaultFont = "1|Lucida Sans Unicode|11.0|1|WINDOWS|1|-16|0|0|0|400|0|0|0|0|3|2|1|34|Lucida Sans Unicode;"; //$NON-NLS-1$
137 137
//		}
138 138
		
139
		// FIXME: SJ: new version, but actually the should not be based on JFace format
139 140
		String defaultFont = "1|SansSerif|14|0"; 
140 141
		
141 142
		
TXM/trunk/bundles/org.txm.chartsengine.core/src/org/txm/chartsengine/core/results/ChartResult.java (revision 3733)
4 4
package org.txm.chartsengine.core.results;
5 5

  
6 6
import java.util.ArrayList;
7
import java.util.Arrays;
7 8
import java.util.HashMap;
8 9

  
9 10
import org.eclipse.osgi.util.NLS;
......
682 683
		this.font = font;
683 684
	}
684 685
	
686

  
687
	/**
688
	 * Sets the font.
689
	 * Internally build an encoded String in JFace StringConverter format (e.g.: "1|Lucida Sans Unicode|12.0|0|WINDOWS|1|-16|0|0|0|400|0|0|0|0|3|2|1|34|Lucida Sans Unicode;") from the specified parameters.
690
	 * Also, is convertUserFriendlyName is set to true, then the font name will be converted to it's real logical font name. 
691
	 * 
692
	 * @param fontName
693
	 * @param size
694
	 * @param style
695
	 */
696
	public void setFont(String fontName, String size, String style, boolean convertUserFriendlyName) {
697
		
698
		int styleAsInt = Arrays.asList(ChartsEngine.FONT_STYLES).indexOf(style);
699
		
700
		// force regular if style is not found
701
		if(styleAsInt < 0) {
702
			styleAsInt = 0; 
703
		}
704
		
705
		// convert user-friendly name to real logical font name
706
		if(convertUserFriendlyName) {
707
			int fontNameIndex = Arrays.asList(ChartsEngine.FONTS_USER_FRIENDLY_NAMES).indexOf(fontName);
708
			// force "SansSerif" if name is not found
709
			if(fontNameIndex < 0) {
710
				fontNameIndex = 0; 
711
			}
712
			fontName = ChartsEngine.FONTS_LOGICAL_NAMES[fontNameIndex];
713
		}
714
		
715
		this.setFont("1|" + fontName + "|" + size + "|" + String.valueOf(styleAsInt));
716
	}
717

  
685 718
	
719
	/**
720
	 * 
721
	 * @param fontName
722
	 * @param size
723
	 * @param style
724
	 */
725
	public void setFont(String fontName, String size, String style) {
726
		this.setFont(fontName, size, style, true);
727
	}
686 728
	
729
	
687 730
	/**
688 731
	 * Gets the multiple line strokes state.
689 732
	 * 
TXM/trunk/bundles/org.txm.cooccurrence.rcp/src/org/txm/cooccurrence/rcp/editors/CooccurrencesEditor.java (revision 3733)
34 34

  
35 35
import org.eclipse.core.runtime.IProgressMonitor;
36 36
import org.eclipse.jface.operation.IRunnableWithProgress;
37
import org.eclipse.jface.viewers.ColumnViewerToolTipSupport;
38 37
import org.eclipse.jface.viewers.ISelectionChangedListener;
39 38
import org.eclipse.jface.viewers.SelectionChangedEvent;
40
import org.eclipse.jface.viewers.StructuredSelection;
41 39
import org.eclipse.jface.viewers.TableViewer;
42 40
import org.eclipse.osgi.util.NLS;
43 41
import org.eclipse.swt.SWT;
......
76 74
import org.txm.core.preferences.TXMPreferences;
77 75
import org.txm.core.results.Parameter;
78 76
import org.txm.core.results.TXMParameters;
79
import org.txm.index.core.functions.Line;
80 77
import org.txm.rcp.editors.TXMEditor;
81 78
import org.txm.rcp.editors.TXMResultEditorInput;
82 79
import org.txm.rcp.editors.TableKeyListener;
......
84 81
import org.txm.rcp.editors.listeners.ComputeSelectionListener;
85 82
import org.txm.rcp.swt.widget.AssistedQueryWidget;
86 83
import org.txm.rcp.swt.widget.FloatSpinner;
87
import org.txm.rcp.swt.widget.LabeledSpinner;
88 84
import org.txm.rcp.swt.widget.PropertiesSelector;
85
import org.txm.rcp.swt.widget.TXMParameterSpinner;
89 86
import org.txm.rcp.views.QueriesView;
90 87
import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
91 88
import org.txm.searchengine.cqp.corpus.CQPCorpus;
......
300 297
		
301 298
		// Thresholds
302 299
		// Fmin
303
		LabeledSpinner fMin = new LabeledSpinner(filtercontrols, this, CooccurrenceUIMessages.thresholdsColonFmin);
304
		this.fMin = fMin.getSpinner();
300
		TXMParameterSpinner fMin = new TXMParameterSpinner(filtercontrols, this, CooccurrenceUIMessages.thresholdsColonFmin);
301
		this.fMin = fMin.getControl();
305 302
		
306 303
		// Cmin
307
		LabeledSpinner cMin = new LabeledSpinner(filtercontrols, this, CooccurrenceUIMessages.cmin);
308
		this.cMin = cMin.getSpinner();
304
		TXMParameterSpinner cMin = new TXMParameterSpinner(filtercontrols, this, CooccurrenceUIMessages.cmin);
305
		this.cMin = cMin.getControl();
309 306
		
310 307
		// Minimum score
311
		LabeledSpinner minimumScore = new LabeledSpinner(filtercontrols, this, new FloatSpinner(filtercontrols, SWT.BORDER), CooccurrenceUIMessages.score_2);
312
		this.minScore = (FloatSpinner) minimumScore.getSpinner();
308
		TXMParameterSpinner minimumScore = new TXMParameterSpinner(filtercontrols, this, new FloatSpinner(filtercontrols, SWT.BORDER), CooccurrenceUIMessages.score_2);
309
		this.minScore = (FloatSpinner) minimumScore.getControl();
313 310
		
314 311
		// empant
315 312
		empantPanel = new EmpantWidget(paramArea, SWT.NONE, this.getCorpus());
TXM/trunk/bundles/org.txm.specificities.rcp/src/org/txm/specificities/rcp/editors/SpecificitiesEditor.java (revision 3733)
37 37
import org.eclipse.swt.events.MouseEvent;
38 38
import org.eclipse.swt.events.MouseListener;
39 39
import org.eclipse.swt.layout.GridData;
40
import org.eclipse.swt.layout.GridLayout;
41 40
import org.eclipse.swt.widgets.Composite;
42 41
import org.eclipse.swt.widgets.Label;
43 42
import org.eclipse.swt.widgets.ScrollBar;
......
50 49
import org.txm.core.results.Parameter;
51 50
import org.txm.rcp.editors.TXMEditor;
52 51
import org.txm.rcp.editors.TableKeyListener;
53
import org.txm.rcp.editors.listeners.ComputeKeyListener;
54
import org.txm.rcp.editors.listeners.ComputeSelectionListener;
55 52
import org.txm.rcp.preferences.RCPPreferences;
56 53
import org.txm.rcp.swt.GLComposite;
57
import org.txm.rcp.swt.widget.LabeledSpinner;
54
import org.txm.rcp.swt.widget.TXMParameterSpinner;
58 55
import org.txm.rcp.swt.widget.ThresholdsGroup;
59 56
import org.txm.rcp.swt.widget.structures.PropertiesComboViewer;
60 57
import org.txm.searchengine.cqp.corpus.CQPCorpus;
......
65 62
import org.txm.specificities.core.preferences.SpecificitiesPreferences;
66 63
import org.txm.specificities.rcp.handlers.ComputeSpecifictiesSelectionChart;
67 64
import org.txm.specificities.rcp.messages.SpecificitiesUIMessages;
68
import org.txm.statsengine.core.StatException;
69 65
import org.txm.statsengine.r.core.messages.RCoreMessages;
70 66
import org.txm.utils.logger.Log;
71 67

  
......
150 146
			Composite extendedParametersArea = this.getExtendedParametersGroup();
151 147
			
152 148
			// max score
153
			LabeledSpinner maxScore = new LabeledSpinner(extendedParametersArea, this, SpecificitiesUIMessages.maximumScore, SpecificitiesUIMessages.maximumScoreToDisplay);
154
			this.maxScoreFilter = maxScore.getSpinner();
149
			TXMParameterSpinner maxScore = new TXMParameterSpinner(extendedParametersArea, this, SpecificitiesUIMessages.maximumScore, SpecificitiesUIMessages.maximumScoreToDisplay);
150
			this.maxScoreFilter = maxScore.getControl();
155 151
			this.maxScoreFilter.setMinimum(0);
156 152
			this.maxScoreFilter.setMaximum(100000);
157 153
			
TXM/trunk/bundles/org.txm.specificities.rcp/src/org/txm/specificities/rcp/editors/SpecificitiesSelectionEditor.java (revision 3733)
2 2

  
3 3
import org.eclipse.swt.SWT;
4 4
import org.eclipse.swt.widgets.Composite;
5
import org.eclipse.swt.widgets.Label;
6 5
import org.eclipse.swt.widgets.ToolItem;
7 6
import org.txm.chartsengine.rcp.editors.ChartEditor;
8 7
import org.txm.core.results.Parameter;
9 8
import org.txm.rcp.IImageKeys;
10
import org.txm.rcp.editors.listeners.ComputeListener;
11 9
import org.txm.rcp.editors.listeners.ComputeSelectionListener;
12 10
import org.txm.rcp.swt.widget.FloatSpinner;
13
import org.txm.rcp.swt.widget.LabeledSpinner;
11
import org.txm.rcp.swt.widget.TXMParameterSpinner;
14 12
import org.txm.specificities.core.functions.SpecificitiesSelection;
15 13
import org.txm.specificities.core.preferences.SpecificitiesPreferences;
16 14
import org.txm.specificities.rcp.handlers.ComputeSpecifities;
......
54 52
		// Banality
55 53
		Composite extendedParametersArea = this.getExtendedParametersGroup();
56 54

  
57
		LabeledSpinner banality = new LabeledSpinner(extendedParametersArea, this, new FloatSpinner(extendedParametersArea, SWT.BORDER), SpecificitiesUIMessages.banality, SpecificitiesUIMessages.banalityThreshold, true);
58
		this.banalitySpinner = (FloatSpinner) banality.getSpinner();
55
		TXMParameterSpinner banality = new TXMParameterSpinner(extendedParametersArea, this, new FloatSpinner(extendedParametersArea, SWT.BORDER), SpecificitiesUIMessages.banality, SpecificitiesUIMessages.banalityThreshold, true);
56
		this.banalitySpinner = (FloatSpinner) banality.getControl();
59 57
		this.banalitySpinner.setMaximumAsFloat(200);
60 58
		
61 59
		this.groupBarsByLines.addSelectionListener(computeSelectionListener);
TXM/trunk/bundles/org.txm.ahc.rcp/src/org/txm/ahc/rcp/editors/AHCEditor.java (revision 3733)
1 1
package org.txm.ahc.rcp.editors;
2 2

  
3 3
import org.eclipse.swt.SWT;
4
import org.eclipse.swt.custom.CLabel;
5
import org.eclipse.swt.widgets.Button;
6 4
import org.eclipse.swt.widgets.Label;
7 5
import org.eclipse.swt.widgets.Spinner;
8 6
import org.eclipse.swt.widgets.ToolItem;
......
18 16
import org.txm.index.core.functions.PartitionIndex;
19 17
import org.txm.lexicaltable.core.functions.LexicalTable;
20 18
import org.txm.rcp.IImageKeys;
21
import org.txm.rcp.editors.listeners.ComputeKeyListener;
22 19
import org.txm.rcp.editors.listeners.ComputeSelectionListener;
23 20
import org.txm.rcp.swt.GLComposite;
24
import org.txm.rcp.swt.widget.LabeledSpinner;
21
import org.txm.rcp.swt.widget.TXMParameterSpinner;
25 22
import org.txm.rcp.swt.widget.ThresholdsGroup;
26 23
import org.txm.rcp.swt.widget.structures.PropertiesComboViewer;
27
import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
28 24
import org.txm.searchengine.cqp.corpus.CQPCorpus;
29 25
import org.txm.searchengine.cqp.corpus.MainCorpus;
30 26
import org.txm.searchengine.cqp.corpus.Partition;
......
141 137
		// ComputeKeyListener computeKeyListener = new ComputeKeyListener(this);
142 138
		
143 139
		// Number of clusters
144
		LabeledSpinner clusters = new LabeledSpinner(mainParametersArea, this, AHCUIMessages.numberOfClustersColon);
145
		this.numberOfClusters = clusters.getSpinner();
140
//		LabeledSpinner clusters = new LabeledSpinner(mainParametersArea, this, AHCUIMessages.numberOfClustersColon);
141
//		this.numberOfClusters = clusters.getSpinner();
142
//		this.numberOfClusters.setMinimum(2);
143
		
144
		
145
		TXMParameterSpinner clusters = new TXMParameterSpinner(mainParametersArea, this, AHCUIMessages.numberOfClustersColon);
146
		this.numberOfClusters = clusters.getControl();
146 147
		this.numberOfClusters.setMinimum(2);
148

  
147 149
		
150
		
148 151
		// Columns
149 152
		this.columnsComputing = new ToolItem(this.chartToolBar, SWT.RADIO);
150 153
		this.columnsComputing.setToolTipText(AHCUIMessages.computeColumns);
......
162 165
		this.rendering2D.setText("2D -> 3D"); //$NON-NLS-1$
163 166
		this.rendering2D.addSelectionListener(computeSelectionListener);
164 167
		
168
		
169
		
170
		
165 171
		// FIXME: SJ: temporary fix, later must enable the font, rendering mode, etc. in R calls
166 172
		// disable all component of the rendering tool bar
167 173
		this.advancedChartToolBar.setEnabled(false);
168 174
		
169
		if (!this.getResult().getParent().isVisible() // CA parent parent is not visible
175
		if (!this.getResult().getParent().isVisible() // if CA parent parent is not visible
170 176
				&& !(this.getResult().getParent().getParent().getParent() instanceof PartitionIndex)) { // and its 2x parent is not a PartitionIndex
171 177
			ThresholdsGroup thresholdsGroup = new ThresholdsGroup(this.getExtendedParametersGroup(), SWT.NONE, this, true, true);
172 178
			this.fMinSpinner = thresholdsGroup.getFMinSpinner();
TXM/trunk/bundles/org.txm.index.rcp/src/org/txm/index/rcp/editors/IndexEditor.java (revision 3733)
61 61
import org.txm.rcp.messages.TXMUIMessages;
62 62
import org.txm.rcp.swt.GLComposite;
63 63
import org.txm.rcp.swt.widget.AssistedChoiceQueryWidget;
64
import org.txm.rcp.swt.widget.CustomThresholdsGroup;
65
import org.txm.rcp.swt.widget.LabeledSpinner;
66 64
import org.txm.rcp.swt.widget.NavigationWidget;
67 65
import org.txm.rcp.swt.widget.PropertiesSelector;
66
import org.txm.rcp.swt.widget.TXMParameterSpinner;
68 67
import org.txm.rcp.swt.widget.ThresholdsGroup;
69 68
import org.txm.rcp.views.QueriesView;
70 69
import org.txm.searchengine.core.IQuery;
......
244 243

  
245 244
		// FIXME: SJ: we should create a widget class for the number of results per page
246 245
		// Number of results per page
247
		LabeledSpinner numberOfResultsPerPage = new LabeledSpinner(this.getExtendedParametersGroup(), this, IndexUIMessages.pageSize);
248
		this.nLinesPerPageSpinner = numberOfResultsPerPage.getSpinner();
246
		TXMParameterSpinner numberOfResultsPerPage = new TXMParameterSpinner(this.getExtendedParametersGroup(), this, IndexUIMessages.pageSize);
247
		this.nLinesPerPageSpinner = numberOfResultsPerPage.getControl();
249 248
		this.nLinesPerPageSpinner.setMinimum(0);
250 249
		this.nLinesPerPageSpinner.setMaximum(99999);
251 250
		this.nLinesPerPageSpinner.setIncrement(1);
TXM/trunk/bundles/org.txm.rcp/src/main/java/org/txm/rcp/editors/TXMEditorToolBar.java (revision 3733)
147 147
		setVisible(TXMEditor.COMPUTING_PARAMETERS_GROUP_ID, visible);
148 148
	}
149 149
	
150
	//FIXME: SJ: moved to TXMParameterCopntrol class (see if we keep this or validate the class)
151
//	/**
152
//	 * Adds the specified Control to this tool bar.
153
//	 * Convenience method to add non-ToolItem Control to the tool bar using the SWT.SEPARATOR trick, plus to pack and to set the right width.
154
//	 * 
155
//	 * @param control
156
//	 */
157
//	public void addControl(final Control control) {
158
//		final ToolItem itemSeparator = new ToolItem(this, SWT.SEPARATOR);
159
//		control.pack();
160
//		itemSeparator.setWidth(control.getBounds().width);
161
//		itemSeparator.setControl(control);
162
//		Listener listener = new Listener() {
163
//			
164
//			@Override
165
//			public void handleEvent(Event event) {
166
//				control.pack();
167
//				itemSeparator.setWidth(control.getBounds().width);
168
//				//System.err.println("TXMEditorToolBar.addControl(...).new Listener() {...}.handleEvent()");
169
//			}
170
//		};
171
//
172
//		//control.addListener(SWT.RESIZE, listener);
173
//		//control.addListener(SWT.Resize, listener);
174
//		control.addListener(SWT.Modify, listener);
175
//		
176
//		//control.addListener(SWT.CHANGED, listener);
177
//		
178
//		//this.addListener(SWT.Resize, listener);
179
//		
180
//	}
150 181
	
151
	/**
152
	 * Adds the specified Control to this tool bar.
153
	 * Convenience method to add non-ToolItem Control to the tool bar using the SWT.SEPARATOR trick, plus to pack and to set the right width.
154
	 * 
155
	 * @param control
156
	 */
157
	public void addControl(final Control control) {
158
		final ToolItem itemSeparator = new ToolItem(this, SWT.SEPARATOR);
159
		control.pack();
160
		itemSeparator.setWidth(control.getBounds().width);
161
		itemSeparator.setControl(control);
162
		Listener listener = new Listener() {
163
			
164
			@Override
165
			public void handleEvent(Event event) {
166
				control.pack();
167
				itemSeparator.setWidth(control.getBounds().width);
168
				//System.err.println("TXMEditorToolBar.addControl(...).new Listener() {...}.handleEvent()");
169
			}
170
		};
171

  
172
		//control.addListener(SWT.RESIZE, listener);
173
		//control.addListener(SWT.Resize, listener);
174
		control.addListener(SWT.Modify, listener);
175
		
176
		//control.addListener(SWT.CHANGED, listener);
177
		
178
		//this.addListener(SWT.Resize, listener);
179
		
180
	}
181 182
	
182 183
	
183
	
184 184
	/**
185 185
	 * Creates a <code>GLComposite</code> in the toolbar subwidgets container.
186 186
	 * 
TXM/trunk/bundles/org.txm.rcp/src/main/java/org/txm/rcp/swt/widget/LabeledCombo.java (revision 3733)
1
/**
2
 * 
3
 */
4
package org.txm.rcp.swt.widget;
5

  
6
import org.eclipse.swt.SWT;
7
import org.eclipse.swt.widgets.Combo;
8
import org.eclipse.swt.widgets.Composite;
9
import org.eclipse.swt.widgets.Label;
10
import org.txm.rcp.editors.TXMEditor;
11

  
12
/**
13
 * Convenience class to create a labeled combo dedicated to editor parameters areas.
14
 * This class also adds all the needed computing listeners.
15
 * 
16
 * @author sjacquot
17
 *
18
 */
19
public class LabeledCombo extends LabeledControl {
20
	
21
	
22
	/**
23
	 * 
24
	 * @param parent
25
	 * @param editor
26
	 * @param labelText
27
	 * @param controlTooltip
28
	 * @param autoCompute
29
	 */
30
	public LabeledCombo(Composite parent, TXMEditor editor, String labelText, String controlTooltip, boolean autoCompute) {
31
		super(parent, editor, new Label(parent, SWT.NONE), new Combo(parent, SWT.READ_ONLY), labelText, controlTooltip, autoCompute);
32
		
33
		// add computing listener
34
		this.getCombo().addModifyListener(this.computingListener);
35
	}
36

  
37
	/**
38
	 * 
39
	 * @param parent
40
	 * @param editor
41
	 * @param labelText
42
	 */
43
	public LabeledCombo(Composite parent, TXMEditor editor, String labelText) {
44
		this(parent, editor, labelText, null, false);
45
	}
46
	
47
	/**
48
	 * 
49
	 * @param parent
50
	 * @param editor
51
	 * @param labelText
52
	 * @param controlTooltip
53
	 */
54
	public LabeledCombo(Composite parent, TXMEditor editor, String labelText, String controlTooltip) {
55
		this(parent, editor, labelText, controlTooltip, false);
56
	}
57

  
58
	
59
	/**
60
	 * Gets the combo composite.
61
	 * 
62
	 * @return the combo
63
	 */
64
	public Combo getCombo() {
65
		return (Combo) super.getControl();
66
	}
67
	
68
}
TXM/trunk/bundles/org.txm.rcp/src/main/java/org/txm/rcp/swt/widget/LabeledSpinner.java (revision 3733)
1
/**
2
 * 
3
 */
4
package org.txm.rcp.swt.widget;
5

  
6
import org.eclipse.swt.SWT;
7
import org.eclipse.swt.widgets.Composite;
8
import org.eclipse.swt.widgets.Control;
9
import org.eclipse.swt.widgets.Spinner;
10
import org.txm.rcp.editors.TXMEditor;
11

  
12
/**
13
 * Convenience class to create a labeled Spinner dedicated to editor parameters areas.
14
 * This class also adds all the needed computing listeners.
15
 * 
16
 * @author sjacquot
17
 *
18
 */
19
public class LabeledSpinner extends LabeledControl {
20
	
21
	
22
	
23
	/**
24
	 * 
25
	 * @param parent
26
	 * @param editor
27
	 * @param control
28
	 * @param labelText
29
	 * @param controlTooltip
30
	 * @param autoCompute
31
	 */
32
	public LabeledSpinner(Composite parent, TXMEditor editor, Control control, String labelText, String controlTooltip, boolean autoCompute) {
33
		super(parent, editor, null, control, labelText, controlTooltip, autoCompute);
34
		
35
		// default parameters and range
36
		this.getSpinner().setMinimum(0);
37
		this.getSpinner().setMaximum(Integer.MAX_VALUE);
38
		this.getSpinner().setIncrement(1);
39
		this.getSpinner().setPageIncrement(100);
40
		
41
		// add computing listener
42
		this.getSpinner().addModifyListener(this.computingListener);
43

  
44
	}
45

  
46
	/**
47
	 * 
48
	 * @param parent
49
	 * @param editor
50
	 * @param labelText
51
	 * @param controlTooltip
52
	 * @param autoCompute
53
	 */
54
	public LabeledSpinner(Composite parent, TXMEditor editor, String labelText, String controlTooltip, boolean autoCompute) {
55
		this(parent, editor, new Spinner(parent, SWT.BORDER), labelText, controlTooltip, autoCompute);
56
	}
57

  
58
	/**
59
	 * 
60
	 * @param parent
61
	 * @param editor
62
	 * @param control
63
	 * @param labelText
64
	 */
65
	public LabeledSpinner(Composite parent, TXMEditor editor, Control control, String labelText) {
66
		this(parent, editor, control, labelText, null, false);
67
	}
68
	
69
	 
70
	/**
71
	 * 
72
	 * @param parent
73
	 * @param editor
74
	 * @param labelText
75
	 * @param controlTooltip
76
	 */
77
	public LabeledSpinner(Composite parent, TXMEditor editor, String labelText, String controlTooltip) {
78
		this(parent, editor, labelText, controlTooltip, false);
79
	}
80

  
81
	
82

  
83
	/**
84
	 * 
85
	 * @param parent
86
	 * @param editor
87
	 * @param labelText
88
	 */
89
	public LabeledSpinner(Composite parent, TXMEditor editor, String labelText) {
90
		this(parent, editor, labelText, null, false);
91
	}
92
	
93
	
94

  
95
	/**
96
	 * Gets the spinner composite.
97
	 * 
98
	 * @return the spinner
99
	 */
100
	public Spinner getSpinner() {
101
		return (Spinner) super.getControl();
102
	}
103
	
104
}
TXM/trunk/bundles/org.txm.rcp/src/main/java/org/txm/rcp/swt/widget/LabeledControl.java (revision 3733)
1
/**
2
 * 
3
 */
4
package org.txm.rcp.swt.widget;
5

  
6
import org.eclipse.swt.SWT;
7
import org.eclipse.swt.widgets.Composite;
8
import org.eclipse.swt.widgets.Control;
9
import org.eclipse.swt.widgets.Label;
10
import org.eclipse.swt.widgets.Spinner;
11
import org.txm.rcp.editors.TXMEditor;
12
import org.txm.rcp.editors.listeners.ComputeKeyListener;
13
import org.txm.rcp.swt.GLComposite;
14

  
15
/**
16
 * Convenience class to create a labeled control dedicated to editor parameters areas.
17
 * If the parent is a GLComposite then the number of columns of its GridLayout will be adjusted to receive the label and the control.
18
 * This class also adds all the needed computing listeners.
19
 * 
20
 * @author sjacquot
21
 *
22
 */
23
public class LabeledControl {
24
	
25
	/**
26
	 * The label.
27
	 */
28
	protected Label label;
29
	
30
	
31
	/**
32
	 * The control.
33
	 */
34
	protected Control control;
35
	
36
	
37
	/**
38
	 * The computing listener.
39
	 */
40
	protected ComputeKeyListener computingListener;
41
	
42
	
43
	/**
44
	 * 
45
	 * @param parent
46
	 * @param editor
47
	 * @param label
48
	 * @param control
49
	 * @param labelText
50
	 * @param controlTooltip
51
	 * @param autoCompute
52
	 */
53
	public LabeledControl(Composite parent, TXMEditor editor, Label label, Control control, String labelText, String controlTooltip, boolean autoCompute) {
54
		
55
		this.label = label;
56
		this.control = control;
57
		
58
		if (this.label == null) {
59
			this.label = new Label(parent, SWT.NONE);
60
		}
61
		
62
		this.label.setText(labelText);
63
		
64
		if (controlTooltip != null) {
65
			this.control.setToolTipText(controlTooltip);
66
		}
67
		
68
		// add computing listeners
69
		this.computingListener = new ComputeKeyListener(editor, autoCompute);
70
		this.control.addKeyListener(this.computingListener);
71

  
72
		// adjust the parent GridLayout number of columns
73
		if(parent instanceof GLComposite) {
74
			((GLComposite) parent).getLayout().numColumns += 2;
75
		}
76
		
77
		this.label.moveAbove(this.control);
78
	}
79
	
80
	/**
81
	 * 
82
	 * @param parent
83
	 * @param editor
84
	 * @param label
85
	 * @param spinner
86
	 * @param labelText
87
	 */
88
	public LabeledControl(Composite parent, TXMEditor editor, Label label, Spinner spinner, String labelText) {
89
		this(parent, editor, label, spinner, labelText, null, false);
90
	}
91
	
92
	/**
93
	 * 
94
	 * @param parent
95
	 * @param editor
96
	 * @param labelText
97
	 * @param spinnerTooltip
98
	 */
99
	public LabeledControl(Composite parent, TXMEditor editor, String labelText, String spinnerTooltip) {
100
		this(parent, editor, null, null, labelText, spinnerTooltip, false);
101
	}
102
	
103
	/**
104
	 * 
105
	 * @param parent
106
	 * @param editor
107
	 * @param labelText
108
	 */
109
	public LabeledControl(Composite parent, TXMEditor editor, String labelText) {
110
		this(parent, editor, labelText, null);
111
	}
112
	
113
	
114
	
115
	/**
116
	 * Gets the label.
117
	 * 
118
	 * @return the label
119
	 */
120
	public Label getLabel() {
121
		return label;
122
	}
123
	
124
	
125
	/**
126
	 * Gets the control.
127
	 * 
128
	 * @return the control
129
	 */
130
	public Control getControl() {
131
		return control;
132
	}
133
	
134
}
TXM/trunk/bundles/org.txm.rcp/src/main/java/org/txm/rcp/swt/widget/TXMParameterCombo.java (revision 3733)
1
/**
2
 * 
3
 */
4
package org.txm.rcp.swt.widget;
5

  
6
import org.eclipse.swt.SWT;
7
import org.eclipse.swt.widgets.Combo;
8
import org.eclipse.swt.widgets.Composite;
9
import org.txm.rcp.editors.TXMEditor;
10

  
11
/**
12
 * Convenience class to add a SWT Combo to some editor parameters areas.
13
 * 
14
 * If the parent is a GLComposite then the number of columns of its GridLayout will be adjusted to receive the control.
15
 * If the parent is a TXMEditorToolbar, use the SWT.SEPARATOR trick, plus the packing and the right width setting to add non-ToolItem Control to a tool bar.
16
 * 
17
 * This class also adds all the needed computing listeners.
18
 * 
19
 * @author sjacquot
20
 *
21
 */
22
public class TXMParameterCombo extends TXMParameterControl {
23
	
24

  
25
	/**
26
	 * 
27
	 * @param parent
28
	 * @param editor
29
	 * @param labelText
30
	 * @param controlTooltip
31
	 * @param autoCompute
32
	 */
33
	public TXMParameterCombo(Composite parent, TXMEditor<?> editor, String labelText, String[] items, String controlTooltip, boolean autoCompute) {
34
		super(parent, editor, new Combo(parent, SWT.READ_ONLY), controlTooltip, autoCompute);
35

  
36
		this.getControl().setItems(items);
37
		
38
		// add computing listener
39
		this.getControl().addModifyListener(this.computingListener);
40

  
41
	}
42

  
43
	/**
44
	 * 
45
	 * @param parent
46
	 * @param editor
47
	 * @param labelText
48
	 * @param items
49
	 */
50
	public TXMParameterCombo(Composite parent, TXMEditor<?> editor, String labelText, String[] items) {
51
		this(parent, editor, labelText, items, null, false);
52
	}
53
	
54
	/***
55
	 * 
56
	 * @param parent
57
	 * @param editor
58
	 * @param items
59
	 * @param controlTooltip
60
	 * @param autoCompute
61
	 */
62
	public TXMParameterCombo(Composite parent, TXMEditor<?> editor, String[] items, String controlTooltip, boolean autoCompute) {
63
		this(parent, editor, null, items, controlTooltip, autoCompute);
64
	}
65
	
66
	/**
67
	 * 
68
	 * @param parent
69
	 * @param editor
70
	 * @param items
71
	 */
72
	public TXMParameterCombo(Composite parent, TXMEditor<?> editor, String[] items) {
73
		this(parent, editor, items, null, false);
74
	}
75

  
76

  
77
	@Override
78
	public Combo getControl() {
79
		return (Combo) super.getControl();
80
	}
81
	
82
}
0 83

  
TXM/trunk/bundles/org.txm.rcp/src/main/java/org/txm/rcp/swt/widget/ThresholdsGroup.java (revision 3733)
113 113
		fieldsGridData.minimumWidth = 100;
114 114
		
115 115
		// Fmin
116
		LabeledSpinner fMin = new LabeledSpinner(this, editor, TXMCoreMessages.common_fMin);
116
		TXMParameterSpinner fMin = new TXMParameterSpinner(this, editor, TXMCoreMessages.common_fMin);
117 117
		this.fMinLabel = fMin.getLabel();
118
		this.fMinSpinner = fMin.getSpinner();
118
		this.fMinSpinner = fMin.getControl();
119 119
		
120 120
		// Fmax
121 121
		if(displayFMax)	{
122
			LabeledSpinner fMax = new LabeledSpinner(this, editor, TXMCoreMessages.common_fMax);
122
			TXMParameterSpinner fMax = new TXMParameterSpinner(this, editor, TXMCoreMessages.common_fMax);
123 123
			this.fMaxLabel = fMax.getLabel();
124
			this.fMaxSpinner = fMax.getSpinner();
124
			this.fMaxSpinner = fMax.getControl();
125 125
		}
126 126
		
127 127
		// Vmax
128
		LabeledSpinner vMax = new LabeledSpinner(this, editor, TXMCoreMessages.common_vMax);
128
		TXMParameterSpinner vMax = new TXMParameterSpinner(this, editor, TXMCoreMessages.common_vMax);
129 129
		this.vMaxLabel = vMax.getLabel();
130
		this.vMaxSpinner = vMax.getSpinner();
130
		this.vMaxSpinner = vMax.getControl();
131 131
		
132 132
	}
133 133

  
TXM/trunk/bundles/org.txm.rcp/src/main/java/org/txm/rcp/swt/widget/FloatSpinner.java (revision 3733)
16 16

  
17 17
	/**
18 18
	 * Creates a FloatSpinner.
19
	 * 
19 20
	 * @param parent
20 21
	 * @param style
21 22
	 */
......
28 29

  
29 30
	/**
30 31
	 * Sets the selection as float.
32
	 * 
31 33
	 * @param value
32 34
	 */
33 35
	public void setSelection(double value) {
......
36 38
	
37 39
	/**
38 40
	 * Gets the selection as a float number.
41
	 * 
39 42
	 * @return
40 43
	 */
41 44
	public float getSelectionAsFloat() {
......
44 47
	
45 48
	/**
46 49
	 * Sets the maximum that the receiver will allow.
50
	 * 
47 51
	 * @param value
48 52
	 */
49 53
	public void setMaximumAsFloat(double value){
TXM/trunk/bundles/org.txm.rcp/src/main/java/org/txm/rcp/swt/widget/TXMParameterSpinner.java (revision 3733)
1
/**
2
 * 
3
 */
4
package org.txm.rcp.swt.widget;
5

  
6
import org.eclipse.swt.SWT;
7
import org.eclipse.swt.widgets.Composite;
8
import org.eclipse.swt.widgets.Control;
9
import org.eclipse.swt.widgets.Spinner;
10
import org.txm.rcp.editors.TXMEditor;
11

  
12
/**
13
 * Convenience class to add a SWT Spinner to some editor parameters areas.
14
 * 
15
 * If the parent is a GLComposite then the number of columns of its GridLayout will be adjusted to receive the control.
16
 * If the parent is a TXMEditorToolbar, use the SWT.SEPARATOR trick, plus the packing and the right width setting to add non-ToolItem Control to a tool bar.
17
 * 
18
 * This class also adds all the needed computing listeners.
19
 * 
20
 * @author sjacquot
21
 *
22
 */
23
public class TXMParameterSpinner extends TXMParameterControl {
24
	
25

  
26
	/**
27
	 * 
28
	 * @param parent
29
	 * @param editor
30
	 * @param labelText
31
	 * @param controlTooltip
32
	 * @param autoCompute
33
	 */
34
	public TXMParameterSpinner(Composite parent, TXMEditor<?> editor, Control control, String labelText, String controlTooltip, boolean autoCompute) {
35
		super(parent, editor, control, labelText, controlTooltip, autoCompute);
36

  
37
		// default parameters and range
38
		this.getControl().setMinimum(0);
39
		this.getControl().setMaximum(Integer.MAX_VALUE);
40
		this.getControl().setIncrement(1);
41
		this.getControl().setPageIncrement(100);
42
		
43
		// add computing listener
44
		this.getControl().addModifyListener(this.computingListener);
45

  
46
	}
47
	
48
	/**
49
	 * 
50
	 * @param parent
51
	 * @param editor
52
	 * @param labelText
53
	 * @param controlTooltip
54
	 * @param autoCompute
55
	 */
56
	public TXMParameterSpinner(Composite parent, TXMEditor<?> editor, String labelText, String controlTooltip, boolean autoCompute) {
57
		this(parent, editor, new Spinner(parent, SWT.BORDER),  labelText, controlTooltip, autoCompute);
58
	}
59
	
60
	
61
	/**
62
	 * 
63
	 * @param parent
64
	 * @param editor
65
	 * @param labelText
66
	 * @param controlTooltip
67
	 */
68
	public TXMParameterSpinner(Composite parent, TXMEditor<?> editor, String labelText, String controlTooltip) {
69
		this(parent, editor, labelText, controlTooltip, false);
70
	}
71
	
72
	/**
73
	 * 
74
	 * @param parent
75
	 * @param editor
76
	 * @param control
77
	 * @param labelText
78
	 */
79
	public TXMParameterSpinner(Composite parent, TXMEditor<?> editor, Control control, String labelText) {
80
		this(parent, editor, control, labelText, null, false);
81
	}
82
	
83

  
84
	
85
	/**
86
	 * 
87
	 * @param parent
88
	 * @param editor
89
	 * @param labelText
90
	 * @param items
91
	 */
92
	public TXMParameterSpinner(Composite parent, TXMEditor<?> editor, String labelText) {
93
		this(parent, editor, labelText, null, false);
94
	}
95
	
96
	/***
97
	 * 
98
	 * @param parent
99
	 * @param editor
100
	 * @param items
101
	 * @param controlTooltip
102
	 * @param autoCompute
103
	 */
104
	public TXMParameterSpinner(Composite parent, TXMEditor<?> editor, String controlTooltip, boolean autoCompute) {
105
		this(parent, editor, null, controlTooltip, autoCompute);
106
	}
107
	
108
	/**
109
	 * 
110
	 * @param parent
111
	 * @param editor
112
	 * @param items
113
	 */
114
	public TXMParameterSpinner(Composite parent, TXMEditor<?> editor) {
115
		this(parent, editor, null, false);
116
	}
117

  
118

  
119
	@Override
120
	public Spinner getControl() {
121
		return (Spinner) super.getControl();
122
	}
123
	
124
}
0 125

  
TXM/trunk/bundles/org.txm.rcp/src/main/java/org/txm/rcp/swt/widget/TXMParameterControl.java (revision 3733)
1
/**
2
 * 
3
 */
4
package org.txm.rcp.swt.widget;
5

  
6
import org.eclipse.swt.SWT;
7
import org.eclipse.swt.widgets.Composite;
8
import org.eclipse.swt.widgets.Control;
9
import org.eclipse.swt.widgets.Event;
10
import org.eclipse.swt.widgets.Label;
11
import org.eclipse.swt.widgets.Listener;
12
import org.eclipse.swt.widgets.ToolBar;
13
import org.eclipse.swt.widgets.ToolItem;
14
import org.txm.rcp.editors.TXMEditor;
15
import org.txm.rcp.editors.TXMEditorToolBar;
16
import org.txm.rcp.editors.listeners.ComputeKeyListener;
17
import org.txm.rcp.swt.GLComposite;
18

  
19
/**
20
 * Convenience class to add a SWT Control, labeled or not, to some editor parameters areas.
21
 * 
22
 * If the parent is a GLComposite then the number of columns of its GridLayout will be adjusted to receive the control.
23
 * If the parent is a TXMEditorToolbar, use the SWT.SEPARATOR trick, plus the packing and the right width setting to add non-ToolItem Control to a tool bar.
24
 * 
25
 * This class also adds all the needed computing listeners.
26
 * 
27
 * @author sjacquot
28
 *
29
 */
30
public class TXMParameterControl {
31
	
32
	
33
	/**
34
	 * The label.
35
	 */
36
	protected Label label;
37
	
38
	/**
39
	 * The control.
40
	 */
41
	protected Control control;
42
	
43
	
44
	/**
45
	 * The computing listener.
46
	 */
47
	protected ComputeKeyListener computingListener;
48
	
49
	
50
	
51
	
52
	/**
53
	 * 
54
	 * @param parent
55
	 * @param editor
56
	 * @param control
57
	 * @param labelText
58
	 * @param controlTooltip
59
	 * @param autoCompute
60
	 */
61
	protected TXMParameterControl(Composite parent, TXMEditor editor, Control control, String labelText, String controlTooltip, boolean autoCompute) {
62
		
63
		if(labelText != null) {
64
			this.label = new Label(parent, SWT.NONE);
65
			this.label.setText(labelText);
66
		}
67

  
68
		this.control = control;
69
		
70
		if (controlTooltip != null) {
71
			this.control.setToolTipText(controlTooltip);
72
		}
73
		
74
		// add computing listeners
75
		this.computingListener = new ComputeKeyListener(editor, autoCompute);
76
		this.control.addKeyListener(this.computingListener);
77

  
78
		// adjust the parent GridLayout number of columns
79
		if(parent instanceof GLComposite) {
80
			((GLComposite) parent).getLayout().numColumns++;
81
		}
82
		// fix the non-ToolItem Control addition to the tool bar using the SWT.SEPARATOR trick, plus the packing and the right width setting.
83
		else if(parent instanceof TXMEditorToolBar) {
84
			final ToolItem itemSeparator = new ToolItem((ToolBar) parent, SWT.SEPARATOR);
85
			this.control.pack();
86
			itemSeparator.setWidth(control.getBounds().width);
87
			itemSeparator.setControl(control);
88
			Listener listener = new Listener() {
89
				
90
				@Override
91
				public void handleEvent(Event event) {
92
					control.pack();
93
					itemSeparator.setWidth(control.getBounds().width);
94
				}
95
			};
96
			this.control.addListener(SWT.Modify, listener);
97
		}
98

  
99
		// force the label to be on the left of the control
100
		if(this.label != null) {
101
			this.label.moveAbove(this.control);	
102
		}
103
		
104
	}
105
	
106
	/**
107
	 * 
108
	 * @param parent
109
	 * @param editor
110
	 * @param control
111
	 * @param controlTooltip
112
	 * @param autoCompute
113
	 */
114
	public TXMParameterControl(Composite parent, TXMEditor editor, Control control, String controlTooltip, boolean autoCompute) {
115
		this(parent, editor, control, null, controlTooltip, autoCompute);
116
	}
117
	
118
	/**
119
	 * 
120
	 * @param parent
121
	 * @param editor
122
	 * @param control
123
	 * @param controlTooltip
124
	 */
125
	public TXMParameterControl(Composite parent, TXMEditor editor, Control control, String controlTooltip) {
126
		this(parent, editor, control, controlTooltip, false);
127
	}
128
	
129
	/**
130
	 * 
131
	 * @param parent
132
	 * @param editor
133
	 * @param control
134
	 */
135
	public TXMParameterControl(Composite parent, TXMEditor editor, Control control) {
136
		this(parent, editor, control, null, false);
137
	}
138
	
139

  
140
	
141
	/**
142
	 * Gets the label.
143
	 * 
144
	 * @return the label
145
	 */
146
	public Label getLabel() {
147
		return label;
148
	}
149

  
150
	
151
	/**
152
	 * Gets the control.
153
	 * 
154
	 * @return the control
155
	 */
156
	public Control getControl() {
157
		return control;
158
	}
159
	
160
}
0 161

  
TXM/trunk/bundles/org.txm.ca.rcp/src/org/txm/ca/rcp/editors/CAFactorialMapChartEditor.java (revision 3733)
26 26
import org.txm.rcp.editors.TXMEditor;
27 27
import org.txm.rcp.editors.listeners.ComputeSelectionListener;
28 28
import org.txm.rcp.swt.GLComposite;
29
import org.txm.rcp.swt.widget.LabeledCombo;
29
import org.txm.rcp.swt.widget.TXMParameterCombo;
30 30
import org.txm.rcp.swt.widget.ThresholdsGroup;
31 31
import org.txm.rcp.swt.widget.structures.PropertiesComboViewer;
32 32
import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
......
259 259
		//FIXME: SJ: other version
260 260
		new ToolItem(this.chartToolBar, SWT.SEPARATOR);
261 261
		
262
		LabeledCombo plansSelectionCombo = new LabeledCombo(this.getFirstLineComposite(), this, CAUIMessages.axesColon);
263
		Combo plansCombo = plansSelectionCombo.getCombo();
264 262
		
265
		
266 263
		// FIXME: commented because the infos panel is not ready to manage more axes
267 264
//		 ArrayList<String> planes = null;
268 265
//		 try {
......
291 288
		// if(couples != null && couples.size() > 3) {
292 289
		// items = couples.toArray(new String[couples.size()]);
293 290
		// }
291

  
294 292
		
295
		plansCombo.setItems(items);
293
		TXMParameterCombo plansSelectionCombo = new TXMParameterCombo(this.getFirstLineComposite(), this, CAUIMessages.axesColon, items);
294
		Combo plansCombo = plansSelectionCombo.getControl();
296 295
		
297 296
		// Preselect the plan from the CA data
298 297
		if (this.getIntParameterValue(CAPreferences.FIRST_DIMENSION) == 2) {
TXM/trunk/bundles/org.txm.chartsengine.rcp/src/org/txm/chartsengine/rcp/swt/AdvancedChartEditorToolBar.java (revision 3733)
3 3
import java.awt.Font;
4 4
import java.awt.GraphicsEnvironment;
5 5
import java.util.ArrayList;
6
import java.util.Arrays;
6 7

  
7 8
import org.apache.commons.lang.StringUtils;
8 9
import org.eclipse.swt.SWT;
......
10 11
import org.eclipse.swt.events.SelectionListener;
11 12
import org.eclipse.swt.widgets.Combo;
12 13
import org.eclipse.swt.widgets.Composite;
13
import org.eclipse.swt.widgets.Label;
14 14
import org.eclipse.swt.widgets.ToolItem;
15 15
import org.txm.Toolbox;
16 16
import org.txm.chartsengine.core.ChartCreator;
......
25 25
import org.txm.rcp.IImageKeys;
26 26
import org.txm.rcp.preferences.RCPPreferences;
27 27
import org.txm.rcp.swt.GLComposite;
28
import org.txm.rcp.swt.widget.TXMParameterCombo;
28 29

  
29 30
/**
30 31
 * The default advanced chart editor tool bar shared by every <code>ChartEditor</code>.
......
38 39
	
39 40
	public final static String ID = "AdvancedChartEditorToolBar";
40 41

  
... Ce différentiel a été tronqué car il excède la taille maximale pouvant être affichée.

Formats disponibles : Unified diff