Revision 1422

tmp/org.txm.specificities.rcp/src/org/txm/specificities/rcp/editors/SpecificitiesEditor.java (revision 1422)
49 49
import org.txm.rcp.editors.listeners.ComputeKeyListener;
50 50
import org.txm.rcp.editors.listeners.ComputeSelectionListener;
51 51
import org.txm.rcp.swt.GLComposite;
52
import org.txm.rcp.swt.widget.ThresholdsGroup;
52 53
import org.txm.rcp.swt.widget.structures.PropertiesComboViewer;
53 54
import org.txm.searchengine.cqp.corpus.CQPCorpus;
54 55
import org.txm.specificities.core.functions.Specificities;
......
95 96
	@Parameter(key=SpecificitiesPreferences.MAX_SCORE)
96 97
	protected Spinner maxScoreFilter;
97 98

  
99
	/**
100
	 * Minimum frequency filtering spinner.
101
	 */
102
	@Parameter(key=TXMPreferences.F_MIN)
103
	protected Spinner fMinSpinner;
104

  
105
	/**
106
	 * Maximum number of lines filtering.
107
	 */
108
	@Parameter(key=TXMPreferences.V_MAX)
109
	protected Spinner vMaxSpinner;
98 110
	
99 111
	
100 112
	@Override
......
118 130
			// Extended parameters
119 131
			Composite extendedParametersArea = this.getExtendedParametersGroup();
120 132
			GridLayout gridLayout = new GridLayout();
121
			gridLayout.numColumns = 2;
133
			gridLayout.numColumns = 3;
122 134
			extendedParametersArea.setLayout(gridLayout);
123 135
			
124 136
			// Computing listeners
......
132 144
			this.maxScoreFilter = new Spinner(extendedParametersArea, SWT.BORDER);
133 145
			this.maxScoreFilter.setToolTipText("The maximum score to display");
134 146
			this.maxScoreFilter.setMinimum(0);
147
			this.maxScoreFilter.setMaximum(100000);
135 148
			
136 149
			this.maxScoreFilter.addKeyListener(computeKeyListener);
137 150
			this.maxScoreFilter.addSelectionListener(computeSelectionListener);
......
197 210
			specificitesTable.setSortColumn(unitColumn);
198 211
			specificitesTable.setSortDirection(SWT.UP);
199 212
			
213
			if (!getResult().isParentVisible()) {
214
				ThresholdsGroup thresholdsGroup = new ThresholdsGroup(this.getExtendedParametersGroup(), SWT.NONE, this, true, false);
215
				this.fMinSpinner = thresholdsGroup.getFMinSpinner();
216
				this.vMaxSpinner = thresholdsGroup.getVMaxSpinner();
217
				this.vMaxSpinner.setMinimum(1);
218
			}
219
			
200 220
		} catch (Exception e) {
201 221
			Log.severe(NLS.bind(SpecificitiesUIMessages.failedToComputeSpecificities, e.getMessage()));
202 222
			Log.printStackTrace(e);
......
212 232
			String[] lexicalTableColumnNames = null;
213 233
			int[] lexicalTableColumnTotalFrequencies = null;
214 234

  
215

  
216 235
			try {
217 236
				lexicalTableColumnNames = this.getResult().getColumnsNames();
218 237
				lexicalTableColumnTotalFrequencies = this.getResult().getColumnsFrequenciesSums();
tmp/org.txm.ahc.rcp/src/org/txm/ahc/rcp/editors/AHCEditor.java (revision 1422)
50 50
	protected Spinner fMinSpinner;
51 51

  
52 52
	/**
53
	 * Maximum frequency filtering spinner.
54
	 */
55
	@Parameter(key=TXMPreferences.F_MAX)
56
	protected Spinner fMaxSpinner;
57

  
58
	/**
59 53
	 * Maximum number of lines filtering.
60 54
	 */
61 55
	@Parameter(key=TXMPreferences.V_MAX)
62 56
	protected Spinner vMaxSpinner;
63
	
64
	
57

  
58

  
65 59
	/**
66 60
	 * The metric (euclidean, manhattan).
67 61
	 */
......
150 144
		// disable all component of the rendering tool bar
151 145
		this.advancedChartToolBar.setEnabled(false);
152 146

  
153
		ThresholdsGroup thresholdsGroup = new ThresholdsGroup(this.getExtendedParametersGroup(), SWT.NONE, this, true, false);
154
		this.fMinSpinner = thresholdsGroup.getFMinSpinner();
155
		this.fMaxSpinner = thresholdsGroup.getFMaxSpinner();
156
		this.vMaxSpinner = thresholdsGroup.getVMaxSpinner();
157
		this.vMaxSpinner.setMinimum(1);
158

  
147
		if (!getResult().isParentVisible()) {
148
			ThresholdsGroup thresholdsGroup = new ThresholdsGroup(this.getExtendedParametersGroup(), SWT.NONE, this, true, false);
149
			this.fMinSpinner = thresholdsGroup.getFMinSpinner();
150
			this.vMaxSpinner = thresholdsGroup.getVMaxSpinner();
151
			this.vMaxSpinner.setMinimum(1);
152
		}
159 153
	}
160 154

  
161 155

  
tmp/org.txm.rcp/src/main/java/org/txm/rcp/editors/TXMEditor.java (revision 1422)
965 965
			try {
966 966
				f.setAccessible(true);
967 967
				object = f.get(this);
968
				if (object == null) {
969
					continue; // widget not set
970
				}
968 971
				value = this.getResult().getParameter(parameter.key(), true); // propagate to parent one time
969 972

  
970 973
				if (value == null) {
......
1096 1099
			try {
1097 1100
				f.setAccessible(true);
1098 1101
				Object object = f.get(this);
1102
				if (object == null) {
1103
					continue; // widget not set
1104
				}
1099 1105
				Object value = null;
1100 1106
				if(object instanceof ToolItem)	{
1101 1107
					value = ((ToolItem)object).getSelection(); 
tmp/org.txm.lexicaltable.rcp/src/org/txm/lexicaltable/rcp/editors/LexicalTableEditor.java (revision 1422)
156 156
	 */
157 157
	@Parameter(key=LexicalTablePreferences.V_MAX)
158 158
	protected Spinner vMaxSpinner;
159

  
160

  
161 159
	
162
	
163
	
164 160
	/**
165 161
	 * Creates the part control.
166 162
	 *
tmp/org.txm.ca.rcp/src/org/txm/ca/rcp/editors/CAFactorialMapChartEditor.java (revision 1422)
34 34

  
35 35
	// FIXME: try to automate that
36 36
	// a solution is to stop using to int in CA but a members int[] dimensions, then use a ComboViewer in this editor
37
//	/**
38
//	 * First dimension.
39
//	 */
40
//	@Parameter(key=CAPreferences.FIRST_DIMENSION)
41
//	protected int firstDimension = 1;
42
//
43
//	/**
44
//	 * Second dimension.
45
//	 */
46
//	@Parameter(key=CAPreferences.SECOND_DIMENSION)
47
//	protected int secondDimension = 2;
48
	
37
	//	/**
38
	//	 * First dimension.
39
	//	 */
40
	//	@Parameter(key=CAPreferences.FIRST_DIMENSION)
41
	//	protected int firstDimension = 1;
42
	//
43
	//	/**
44
	//	 * Second dimension.
45
	//	 */
46
	//	@Parameter(key=CAPreferences.SECOND_DIMENSION)
47
	//	protected int secondDimension = 2;
49 48

  
49

  
50 50
	/**
51 51
	 * To show/hide individuals.
52 52
	 */
......
64 64
	 */
65 65
	@Parameter(key=CAPreferences.SHOW_POINT_SHAPES)
66 66
	protected ToolItem showPointShapes;
67
	
68
	
67

  
68

  
69 69
	/**
70 70
	 * Unit property.
71 71
	 */
72 72
	@Parameter(key=TXMPreferences.UNIT_PROPERTY)
73 73
	protected PropertiesComboViewer unitPropertyComboViewer;
74
	
75 74

  
75

  
76 76
	/**
77 77
	 * Minimum frequency filtering spinner.
78 78
	 */
......
80 80
	protected Spinner fMinSpinner;
81 81

  
82 82
	/**
83
	 * Maximum frequency filtering spinner.
84
	 */
85
	@Parameter(key=TXMPreferences.F_MAX)
86
	protected Spinner fMaxSpinner;
87

  
88
	/**
89 83
	 * Maximum number of lines filtering.
90 84
	 */
91 85
	@Parameter(key=TXMPreferences.V_MAX)
92 86
	protected Spinner vMaxSpinner;
93
	
94
	
87

  
88

  
95 89
	/**
96 90
	 *
97 91
	 * @param chartEditorInput
......
105 99
	public void __createPartControl() {
106 100

  
107 101
		// Main parameters
108
		
102

  
109 103
		try {
110 104
			GLComposite mainParametersArea = this.getMainParametersComposite();
111 105
			mainParametersArea.getLayout().numColumns = 2;
112
			
106

  
113 107
			// unit property
114 108
			new Label(mainParametersArea, SWT.NONE).setText(TXMCoreMessages.common_property);
115 109
			this.unitPropertyComboViewer = new PropertiesComboViewer(mainParametersArea, this, true,
......
122 116
			e.printStackTrace();
123 117
		}
124 118

  
125
			
126
			// Extend the chart editor tool bar
127
			new ToolItem(this.chartToolBar, SWT.SEPARATOR);
128 119

  
129
			ComputeSelectionListener computeSelectionListener = new ComputeSelectionListener(this, true); 
130
			
131
			// Show/hide columns
132
			showIndividuals = new ToolItem(this.chartToolBar, SWT.CHECK);
133
			// FIXME: keep this for offering an option "large icons" with text in buttons ?
134
			//showColumns.setText(SWTComponentsProviderMessages.SWTChartsComponentProvider_CA_TOOLBAR_BUTTON_SHOW_COLUMS_LABEL);
135
			showIndividuals.setToolTipText(CAUIMessages.showhideTheColumnPoints);
136
			showIndividuals.setImage(IImageKeys.getImage(CAFactorialMapChartEditor.class, "icons/show_columns.png")); //$NON-NLS-1$
137
			showIndividuals.addSelectionListener(computeSelectionListener);
120
		// Extend the chart editor tool bar
121
		new ToolItem(this.chartToolBar, SWT.SEPARATOR);
138 122

  
139
			// Show/hide rows
140
			showVariables = new ToolItem(this.chartToolBar, SWT.CHECK);
141
			// FIXME: keep this for offering an option "large icons" with text in buttons ?
142
			//this.showRows.setText(SWTComponentsProviderMessages.SWTChartsComponentProvider_CA_TOOLBAR_BUTTON_SHOW_ROWS_LABEL);
143
			showVariables.setToolTipText(CAUIMessages.showhideTheRowPoints);
144
			showVariables.setImage(IImageKeys.getImage(CAFactorialMapChartEditor.class, "icons/show_rows.png")); //$NON-NLS-1$
145
			showVariables.addSelectionListener(computeSelectionListener);
123
		ComputeSelectionListener computeSelectionListener = new ComputeSelectionListener(this, true); 
146 124

  
147
			
148
			// Show/hide point shapes
149
			showPointShapes = new ToolItem(this.chartToolBar, SWT.CHECK);
150
			// FIXME: keep this for offering an option "large icons" with text in buttons ?
151
			//showPointShapes.setText(CAUIMessages.SHOW_HIDE_POINT_SHAPES);
152
			showPointShapes.setToolTipText(CAUIMessages.showhidePointShapes);
153
			showPointShapes.setImage(IImageKeys.getImage(CAFactorialMapChartEditor.class, "icons/show_point_shapes.png")); //$NON-NLS-1$
154
			showPointShapes.addSelectionListener(computeSelectionListener);
125
		// Show/hide columns
126
		showIndividuals = new ToolItem(this.chartToolBar, SWT.CHECK);
127
		// FIXME: keep this for offering an option "large icons" with text in buttons ?
128
		//showColumns.setText(SWTComponentsProviderMessages.SWTChartsComponentProvider_CA_TOOLBAR_BUTTON_SHOW_COLUMS_LABEL);
129
		showIndividuals.setToolTipText(CAUIMessages.showhideTheColumnPoints);
130
		showIndividuals.setImage(IImageKeys.getImage(CAFactorialMapChartEditor.class, "icons/show_columns.png")); //$NON-NLS-1$
131
		showIndividuals.addSelectionListener(computeSelectionListener);
155 132

  
156
			
157
			// Factors plane selection
158
			CLabel factorsLabel = new CLabel(this.chartToolBar, SWT.CENTER);
159
			factorsLabel.setText(CAUIMessages.axesColon);
160
			this.chartToolBar.addControl(factorsLabel);
161
			
162
			final Combo plansCombo = new Combo(this.chartToolBar, SWT.READ_ONLY);
133
		// Show/hide rows
134
		showVariables = new ToolItem(this.chartToolBar, SWT.CHECK);
135
		// FIXME: keep this for offering an option "large icons" with text in buttons ?
136
		//this.showRows.setText(SWTComponentsProviderMessages.SWTChartsComponentProvider_CA_TOOLBAR_BUTTON_SHOW_ROWS_LABEL);
137
		showVariables.setToolTipText(CAUIMessages.showhideTheRowPoints);
138
		showVariables.setImage(IImageKeys.getImage(CAFactorialMapChartEditor.class, "icons/show_rows.png")); //$NON-NLS-1$
139
		showVariables.addSelectionListener(computeSelectionListener);
163 140

  
164
			// FIXME: commented because the infos panel is not ready to manage more axes
165
//		ArrayList<String> planes = null;
166
//		try {
167
//			int nbsv = ((CA) editorPart.getResultData()).getSingularValues().length;
168
//			planes = new ArrayList<String>();
169
//			for(int i = 1 ; i < nbsv ; i ++)	{
170
//				for(int j = i ; j < nbsv ; j++)	{
171
//					if(i != j)	{
172
//						planes.add("("+i+","+j+")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
173
//					}
174
//				}
175
//			}
176
//		}
177
//		catch (StatException e1) {
178
//			// TODO Auto-generated catch block
179
//			org.txm.rcp.utils.Logger.printStackTrace(e1);
180
//		}
181
//		String [] items = planes.toArray(new String[planes.size()]);
182 141

  
183
			String items[] = { "(1,2)", "(1,3)", "(2,3)" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
142
		// Show/hide point shapes
143
		showPointShapes = new ToolItem(this.chartToolBar, SWT.CHECK);
144
		// FIXME: keep this for offering an option "large icons" with text in buttons ?
145
		//showPointShapes.setText(CAUIMessages.SHOW_HIDE_POINT_SHAPES);
146
		showPointShapes.setToolTipText(CAUIMessages.showhidePointShapes);
147
		showPointShapes.setImage(IImageKeys.getImage(CAFactorialMapChartEditor.class, "icons/show_point_shapes.png")); //$NON-NLS-1$
148
		showPointShapes.addSelectionListener(computeSelectionListener);
184 149

  
185
			// TODO : commented because the infos panel is not ready to manage more axes
186
			//		if(couples != null && couples.size() > 3)	{
187
			//			items = couples.toArray(new String[couples.size()]);
188
			//}
189 150

  
151
		// Factors plane selection
152
		CLabel factorsLabel = new CLabel(this.chartToolBar, SWT.CENTER);
153
		factorsLabel.setText(CAUIMessages.axesColon);
154
		this.chartToolBar.addControl(factorsLabel);
190 155

  
191
			plansCombo.setItems(items);
156
		final Combo plansCombo = new Combo(this.chartToolBar, SWT.READ_ONLY);
192 157

  
193
			// Preselect the plan from the CA data
194
			if(this.getIntParameterValue(CAPreferences.FIRST_DIMENSION) == 2)	{
195
				plansCombo.select(2);
196
			}
197
			else if(this.getIntParameterValue(CAPreferences.SECOND_DIMENSION) == 3)	{
198
				plansCombo.select(1);
199
			}
200
			else	{
201
				plansCombo.select(0);
202
			}
158
		// FIXME: commented because the infos panel is not ready to manage more axes
159
		//		ArrayList<String> planes = null;
160
		//		try {
161
		//			int nbsv = ((CA) editorPart.getResultData()).getSingularValues().length;
162
		//			planes = new ArrayList<String>();
163
		//			for(int i = 1 ; i < nbsv ; i ++)	{
164
		//				for(int j = i ; j < nbsv ; j++)	{
165
		//					if(i != j)	{
166
		//						planes.add("("+i+","+j+")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
167
		//					}
168
		//				}
169
		//			}
170
		//		}
171
		//		catch (StatException e1) {
172
		//			// TODO Auto-generated catch block
173
		//			org.txm.rcp.utils.Logger.printStackTrace(e1);
174
		//		}
175
		//		String [] items = planes.toArray(new String[planes.size()]);
203 176

  
204
			this.chartToolBar.addControl(plansCombo);
205
			
206
			// Listeners
207
			SelectionListener listener = new SelectionListener() {
208
				
209
				@Override
210
				public void widgetSelected(SelectionEvent e) {
177
		String items[] = { "(1,2)", "(1,3)", "(2,3)" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
211 178

  
212
					boolean resetView = false;
213
					
214
					// Change factors
215
					if(e.getSource() == plansCombo)	{
179
		// TODO : commented because the infos panel is not ready to manage more axes
180
		//		if(couples != null && couples.size() > 3)	{
181
		//			items = couples.toArray(new String[couples.size()]);
182
		//}
216 183

  
217
						Combo plans = (Combo) e.getSource();
218 184

  
219
						int dimension1 = 1;
220
						int dimension2 = 2;
185
		plansCombo.setItems(items);
221 186

  
222
						String str = plans.getItem(plans.getSelectionIndex());
223
						str = str.substring(1, str.length() -1); // remove ( and )
224
						String[] split = str.split(","); // 2 items //$NON-NLS-1$
225
						dimension1 = Integer.parseInt(split[0]);
226
						dimension2 = Integer.parseInt(split[1]);
187
		// Preselect the plan from the CA data
188
		if(this.getIntParameterValue(CAPreferences.FIRST_DIMENSION) == 2)	{
189
			plansCombo.select(2);
190
		}
191
		else if(this.getIntParameterValue(CAPreferences.SECOND_DIMENSION) == 3)	{
192
			plansCombo.select(1);
193
		}
194
		else	{
195
			plansCombo.select(0);
196
		}
227 197

  
228
						getResult().setFirstDimension(dimension1);
229
						getResult().setSecondDimension(dimension2);
198
		this.chartToolBar.addControl(plansCombo);
230 199

  
231
						resetView = true;
232
					}
233
					getResult().setChartDirty();
234
					getResult().setNeedsToResetView(resetView);
235
					compute(true);
236
					// synchronize the part names
237
					((CAEditor)getParentMultiPagesEditor()).setName(getResult().getName());
238
					forceFocus();
200
		// Listeners
201
		SelectionListener listener = new SelectionListener() {
202

  
203
			@Override
204
			public void widgetSelected(SelectionEvent e) {
205

  
206
				boolean resetView = false;
207

  
208
				// Change factors
209
				if(e.getSource() == plansCombo)	{
210

  
211
					Combo plans = (Combo) e.getSource();
212

  
213
					int dimension1 = 1;
214
					int dimension2 = 2;
215

  
216
					String str = plans.getItem(plans.getSelectionIndex());
217
					str = str.substring(1, str.length() -1); // remove ( and )
218
					String[] split = str.split(","); // 2 items //$NON-NLS-1$
219
					dimension1 = Integer.parseInt(split[0]);
220
					dimension2 = Integer.parseInt(split[1]);
221

  
222
					getResult().setFirstDimension(dimension1);
223
					getResult().setSecondDimension(dimension2);
224

  
225
					resetView = true;
239 226
				}
240
				
241
				@Override
242
				public void widgetDefaultSelected(SelectionEvent e) {
243
					// TODO Auto-generated method stub
244
				}
245
			};
246
			plansCombo.addSelectionListener(listener);
247
			
248
			
249
			
250
			// advanced parameters
251
			// thresholds
227
				getResult().setChartDirty();
228
				getResult().setNeedsToResetView(resetView);
229
				compute(true);
230
				// synchronize the part names
231
				((CAEditor)getParentMultiPagesEditor()).setName(getResult().getName());
232
				forceFocus();
233
			}
234

  
235
			@Override
236
			public void widgetDefaultSelected(SelectionEvent e) {
237
				// TODO Auto-generated method stub
238
			}
239
		};
240
		plansCombo.addSelectionListener(listener);
241

  
242
		// advanced parameters
243
		// thresholds
244
		if (!getResult().isParentVisible()) {
252 245
			ThresholdsGroup thresholdsGroup = new ThresholdsGroup(this.getExtendedParametersGroup(), SWT.NONE, this, true, false);
253 246
			this.fMinSpinner = thresholdsGroup.getFMinSpinner();
254
			this.fMaxSpinner = thresholdsGroup.getFMaxSpinner();
255 247
			this.vMaxSpinner = thresholdsGroup.getVMaxSpinner();
256 248
			this.vMaxSpinner.setMinimum(1);
257
			
258
	
249
		}
259 250
	}
260 251

  
261

  
262 252
	@Override
263 253
	public void updateEditorFromChart(boolean update) {
264 254
		// nothing to do
265 255
	}
266 256

  
267

  
268

  
269 257
}
tmp/org.txm.core/src/java/org/txm/core/results/TXMResult.java (revision 1422)
1680 1680
	public boolean isVisible() {
1681 1681
		return this.visible;
1682 1682
	}
1683
	
1684
	public boolean isParentVisible() {
1685
		return parent != null && (parent.isVisible() || parent.isInternalPersistable());
1686
	}
1683 1687

  
1684 1688
	/**
1685 1689
	 * Sets the result visibility state.

Also available in: Unified diff