Révision 3571

TXM/trunk/org.txm.index.rcp/src/org/txm/index/rcp/editors/IndexEditor.java (revision 3571)
59 59
import org.txm.rcp.messages.TXMUIMessages;
60 60
import org.txm.rcp.swt.GLComposite;
61 61
import org.txm.rcp.swt.widget.AssistedChoiceQueryWidget;
62
import org.txm.rcp.swt.widget.CustomThresholdsGroup;
62 63
import org.txm.rcp.swt.widget.LabeledSpinner;
63 64
import org.txm.rcp.swt.widget.NavigationWidget;
64 65
import org.txm.rcp.swt.widget.PropertiesSelector;
......
225 226
		// Extended parameters
226 227
		
227 228
		// Filters
228
		ThresholdsGroup thresholdsGroup = new ThresholdsGroup(this.getExtendedParametersGroup(), this);
229
		//CustomThresholdsGroup thresholdsGroup = new CustomThresholdsGroup(this.getExtendedParametersGroup(), this, new CustomThresholdsGroup.Configuration("F", 0, 100, 0, true, true), new CustomThresholdsGroup.Configuration("V", 0, 100, 0, false, true));
230
		ThresholdsGroup thresholdsGroup = new ThresholdsGroup(this.getExtendedParametersGroup(), this, true);
231
		
229 232
		this.fMinSpinner = thresholdsGroup.getFMinSpinner();
230 233
		this.fMaxSpinner = thresholdsGroup.getFMaxSpinner();
231 234
		this.vMaxSpinner = thresholdsGroup.getVMaxSpinner();
TXM/trunk/org.txm.partition.core/src/org/txm/partition/core/functions/PartitionDimensions.java (revision 3571)
248 248
		writer.println("id"+colseparator+"F");
249 249
		
250 250
		for (Part b : this.parts) {
251
			writer.println(txtseparator+b.getName().replaceAll(txtseparator, txtseparator+txtseparator)+txtseparator+colseparator+txtseparator+b.getSize()+txtseparator);
251
			String name = b.getName();
252
			if (name.contains(" ∩ ")) {
253
				
254
				String[] split = name.split(" ∩ ");
255
				name = "";
256
				for (int i = 0 ; i < split.length ; i++) {
257
					String s  = split[i];
258
					System.out.println("s="+s);
259
					if (i > 0) name += colseparator;
260
					name += txtseparator + s.replaceAll(txtseparator, txtseparator+txtseparator) + txtseparator;
261
				}
262
			}
263
			
264
			writer.println(name+colseparator+txtseparator+b.getSize()+txtseparator);
252 265
		}
253 266
		
254 267
		writer.close();
TXM/trunk/org.txm.rcp/src/main/java/org/txm/rcp/swt/widget/CustomThresholdsGroup.java (revision 3571)
1
/**
2
 * 
3
 */
4
package org.txm.rcp.swt.widget;
5

  
6
import java.util.LinkedHashMap;
7

  
8
import org.eclipse.swt.SWT;
9
import org.eclipse.swt.events.SelectionEvent;
10
import org.eclipse.swt.events.SelectionListener;
11
import org.eclipse.swt.layout.GridData;
12
import org.eclipse.swt.layout.RowLayout;
13
import org.eclipse.swt.widgets.Composite;
14
import org.eclipse.swt.widgets.Group;
15
import org.eclipse.swt.widgets.Label;
16
import org.eclipse.swt.widgets.Spinner;
17
import org.txm.core.messages.TXMCoreMessages;
18
import org.txm.core.results.TXMResult;
19
import org.txm.rcp.editors.TXMEditor;
20
import org.txm.rcp.swt.GLComposite;
21

  
22
/**
23
 * Widget to manage shared threshold filters : fmin, fmax and vmax.
24
 * 
25
 * @author sjacquot
26
 *
27
 */
28
public class CustomThresholdsGroup extends Group {
29
	
30
	public static final String F = "F";
31
	public static final String V = "V";
32
	public static final String S = "S";
33
	
34
	TXMEditor<? extends TXMResult> editor;
35
	LinkedHashMap<String, ThresholdField> fields;
36
	Configuration[] configurations;
37
	
38
	/**
39
	 * 
40
	 * @param parent
41
	 * @param editor
42
	 */
43
	public CustomThresholdsGroup(Composite parent, TXMEditor<? extends TXMResult> editor, Configuration... configurations) {
44
		super(parent, SWT.NONE);
45
		
46
		this.setText(TXMCoreMessages.common_thresholds);
47
		
48
		this.setLayout(new RowLayout());
49
		this.editor = editor;
50
		this.configurations = configurations;
51

  
52
		this.fields = new LinkedHashMap<>();
53
		for (int i = 0 ; i < configurations.length ; i++) {
54
			Configuration c = configurations[i];
55
			
56
			//if (i > 0) new Label(this, SWT.NONE).setText("|");
57
			
58
			ThresholdField tf = new ThresholdField(this, c);
59
			fields.put(c.name, tf);
60
			
61
			
62
		}
63
	}
64
	
65
	@Override
66
	protected void checkSubclass() { // mandatory to avoid subclass exception
67
	}
68
	
69
	public Spinner getMinField(String key) {
70
		ThresholdField f = this.fields.get(key);
71
		if (f != null) {
72
			return f.getMinField();
73
		}
74
		return null;
75
	}
76
	
77
	public Spinner getMaxField(String key) {
78
		ThresholdField f = this.fields.get(key);
79
		if (f != null) {
80
			return f.getMaxField();
81
		}
82
		return null;
83
	}
84
	
85
	/**
86
	 * @return the fMinSpinner
87
	 */
88
	public Spinner getFMinSpinner() {
89
		return fields.get(F).getMinField();
90
	}
91

  
92
	/**
93
	 * @return the fMaxSpinner
94
	 */
95
	public Spinner getFMaxSpinner() {
96
		return fields.get(F).getMaxField();
97
	}
98
	
99
	/**
100
	 * @return the vMaxSpinner
101
	 */
102
	public Spinner getVMinSpinner() {
103
		return fields.get(V).getMinField();
104
	}
105

  
106
	/**
107
	 * @return the vMaxSpinner
108
	 */
109
	public Spinner getVMaxSpinner() {
110
		return fields.get(V).getMaxField();
111
	}
112
	
113
	/**
114
	 * @return the vMaxSpinner
115
	 */
116
	public Spinner getSMinSpinner() {
117
		return fields.get(S).getMinField();
118
	}
119

  
120
	/**
121
	 * @return the vMaxSpinner
122
	 */
123
	public Spinner getSMaxSpinner() {
124
		return fields.get(S).getMaxField();
125
	}
126
	
127
	public static class Configuration {
128
		public String name;
129
		public int min;
130
		public int max;
131
		public int digits;
132
		public boolean showMin;
133
		public boolean showMax;
134
		public Configuration(String name, int min, int max, int digits, boolean showMin, boolean showMax) {
135
			this.name = name;
136
			this.min = min;
137
			this.max = max;
138
			this.digits = digits;
139
			this.showMin = showMin;
140
			this.showMax = showMax;
141
		}
142
	}
143
	
144
	public static class ThresholdField extends GLComposite {
145
		
146
		Spinner minField;
147
		Spinner maxField;
148
		
149
		public ThresholdField(Composite parent, Configuration c) {
150
			
151
			super(parent, SWT.NONE, c.name);
152
			this.getLayout().numColumns = 3;
153
			this.getLayout().horizontalSpacing = 2;
154
			
155
			if (c.showMin && !c.showMax) {
156
				Label l = new Label(this, SWT.NONE);
157
				l.setLayoutData(new GridData());
158
				l.setText(c.name+" ≤ ");
159
			}
160
			
161
			if (c.showMin) {
162
				minField = new Spinner(this, SWT.BORDER);
163
				minField.setLayoutData(new GridData());
164
				minField.setMinimum(c.min);
165
				minField.setMaximum(c.max);
166
				minField.setDigits(c.digits);
167
				minField.addSelectionListener(new SelectionListener() {
168
					
169
					@Override
170
					public void widgetSelected(SelectionEvent e) {
171
						if (minField != null) maxField.setMinimum(minField.getSelection());
172
					}
173
					
174
					@Override
175
					public void widgetDefaultSelected(SelectionEvent e) { }
176
				});
177
			}
178
			
179
			if (c.showMin && c.showMax) {
180
				Label l = new Label(this, SWT.NONE);
181
				l.setLayoutData(new GridData());
182
				l.setText(" ≤ "+c.name+" ≤ ");
183
			}
184
			
185
			if (!c.showMin && c.showMax) {
186
				Label l = new Label(this, SWT.NONE);
187
				l.setLayoutData(new GridData());
188
				l.setText(c.name+" ≤ ");
189
			}
190
			
191
			if (c.showMax) {
192
				maxField = new Spinner(this, SWT.BORDER);
193
				maxField.setLayoutData(new GridData());
194
				maxField.setMinimum(c.min);
195
				maxField.setMaximum(c.max);
196
				maxField.setDigits(c.digits);
197
				maxField.addSelectionListener(new SelectionListener() {
198
					
199
					@Override
200
					public void widgetSelected(SelectionEvent e) {
201
						if (maxField != null) minField.setMaximum(maxField.getSelection());
202
					}
203
					
204
					@Override
205
					public void widgetDefaultSelected(SelectionEvent e) { }
206
				});
207
			}
208
		}
209
		
210
		public Spinner getMinField() {
211
			
212
			return minField;
213
		}
214
		
215
		public Spinner getMaxField() {
216
			
217
			return maxField;
218
		}		
219
	}
220
}
0 221

  
TXM/trunk/org.txm.rcp/src/main/java/org/txm/rcp/swt/widget/ThresholdsGroup.java (revision 3571)
111 111
		gridLayout.makeColumnsEqualWidth = false;
112 112
		this.setLayout(gridLayout);
113 113

  
114
		
115 114
		GridData fieldsGridData = new GridData(SWT.LEFT, SWT.CENTER, false, false);
116 115
		fieldsGridData.minimumWidth = 100;
117 116
		

Formats disponibles : Unified diff