Révision 3736

TXM/trunk/bundles/org.txm.rcp/src/main/java/org/txm/rcp/editors/listeners/BaseAbstractComputeListener.java (revision 3736)
74 74
		return false;
75 75
	}
76 76

  
77
	/**
78
	 * 
79
	 * @param autoCompute
80
	 */
81
	public void setAutoCompute(boolean autoCompute) {
82
		this.autoCompute = autoCompute;
83
	}
84

  
77 85
	
78 86
}
TXM/trunk/bundles/org.txm.rcp/src/main/java/org/txm/rcp/swt/widget/TXMParameterCombo.java (revision 3736)
7 7
import org.eclipse.swt.widgets.Combo;
8 8
import org.eclipse.swt.widgets.Composite;
9 9
import org.txm.rcp.editors.TXMEditor;
10
import org.txm.rcp.editors.listeners.ComputeSelectionListener;
10 11

  
11 12
/**
12 13
 * Convenience class to add a SWT Combo to some editor parameters areas.
......
35 36

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

  
39
		// add computing listeners
40
		this.getControl().addModifyListener(this.computingKeyListener);
41
		this.computingSelectionListener = new ComputeSelectionListener(editor, autoCompute);
42
		this.getControl().addSelectionListener(this.computingSelectionListener);
41 43
	}
42 44

  
43 45
	/**
TXM/trunk/bundles/org.txm.rcp/src/main/java/org/txm/rcp/swt/widget/TXMParameterSpinner.java (revision 3736)
41 41
		this.getControl().setPageIncrement(100);
42 42
		
43 43
		// add computing listener
44
		this.getControl().addModifyListener(this.computingListener);
44
		this.getControl().addModifyListener(this.computingKeyListener);
45 45

  
46 46
	}
47 47
	
TXM/trunk/bundles/org.txm.rcp/src/main/java/org/txm/rcp/swt/widget/TXMParameterControl.java (revision 3736)
14 14
import org.txm.rcp.editors.TXMEditor;
15 15
import org.txm.rcp.editors.TXMEditorToolBar;
16 16
import org.txm.rcp.editors.listeners.ComputeKeyListener;
17
import org.txm.rcp.editors.listeners.ComputeSelectionListener;
17 18
import org.txm.rcp.swt.GLComposite;
18 19

  
19 20
/**
......
42 43
	
43 44
	
44 45
	/**
45
	 * The computing listener.
46
	 * The computing key listener.
46 47
	 */
47
	protected ComputeKeyListener computingListener;
48
	protected ComputeKeyListener computingKeyListener;
48 49
	
49 50
	
51
	/**
52
	 * The computing selection listener.
53
	 */
54
	protected ComputeSelectionListener computingSelectionListener;
50 55
	
51 56
	
52 57
	/**
......
72 77
		}
73 78
		
74 79
		// add computing listeners
75
		this.computingListener = new ComputeKeyListener(editor, autoCompute);
76
		this.control.addKeyListener(this.computingListener);
80
		this.computingKeyListener = new ComputeKeyListener(editor, autoCompute);
81
		this.control.addKeyListener(this.computingKeyListener);
77 82

  
78 83
		// adjust the parent GridLayout number of columns
79 84
		if(parent instanceof GLComposite) {
......
159 164
	public Control getControl() {
160 165
		return control;
161 166
	}
167

  
168
	public ComputeKeyListener getComputingKeyListener() {
169
		return computingKeyListener;
170
	}
171

  
172
	public ComputeSelectionListener getComputingSelectionListener() {
173
		return computingSelectionListener;
174
	}
162 175
	
163 176
}
TXM/trunk/bundles/org.txm.ahc.core/src/org/txm/ahc/core/functions/AHC.java (revision 3736)
136 136
	/**
137 137
	 * To display in 2D or 3D.
138 138
	 */
139
	@Parameter(key = AHCPreferences.RENDERING_2D)
140
	protected boolean rendering2D;
139
	//FIXME: SJ: should be done using ChartCreator
140
	@Parameter(key = AHCPreferences.RENDERING)
141
	protected String rendering;
141 142
	
142 143
	
143 144
	
......
751 752
	 * @return the rendering2D
752 753
	 */
753 754
	public boolean isRendering2D() {
754
		return rendering2D;
755
		return this.rendering.equals("2D");
755 756
	}
756 757
	
757 758
	/**
......
761 762
	 * @param rendering2d the rendering2D to set
762 763
	 */
763 764
	public void setRendering2D(boolean rendering2d) {
764
		rendering2D = rendering2d;
765
		if(rendering2d) {
766
			this.rendering = "2D";
767
		}
768
		else {
769
			this.rendering = "3D";
770
		}
765 771
	}
766 772
	
767 773
	@Override
TXM/trunk/bundles/org.txm.ahc.core/src/org/txm/ahc/core/preferences/AHCPreferences.java (revision 3736)
17 17
	/**
18 18
	 * To display in 2D or 3D.
19 19
	 */
20
	public static final String RENDERING_2D = "rendering_2d"; //$NON-NLS-1$
20
	public static final String RENDERING = "rendering"; //$NON-NLS-1$
21 21
	
22 22
	/**
23 23
	 * The method (METHODS <- c("average", "single", "complete", "ward", "weighted", "flexible")).
......
58 58
		super.initializeDefaultPreferences();
59 59
		Preferences preferences = this.getDefaultPreferencesNode();
60 60
		
61
		preferences.putBoolean(RENDERING_2D, true);
61
		preferences.put(RENDERING, "2D");
62 62
		preferences.putInt(N_CLUSTERS, 2);
63 63
		preferences.put(METHOD, "ward"); //$NON-NLS-1$
64 64
		preferences.put(METRIC, "euclidean"); //$NON-NLS-1$
TXM/trunk/bundles/org.txm.ahc.rcp/src/org/txm/ahc/rcp/preferences/AHCPreferencePage.java (revision 3736)
77 77
		// Charts
78 78
		Composite chartsTab = SWTChartsComponentsProvider.createChartsRenderingPreferencesTabFolderComposite(getFieldEditorParent());
79 79
		
80
		String[][] labelAndValues = { { "2D", "true" }, { "3D", "false" } }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
81
		RadioGroupFieldEditor default2D3Ddisplay = new RadioGroupFieldEditor(AHCPreferences.RENDERING_2D, AHCUIMessages.displayChartsIn2D, 2, labelAndValues, chartsTab);
80
		String[][] labelAndValues = { { "2D", "2D" }, { "3D", "3D" } }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
81
		RadioGroupFieldEditor default2D3Ddisplay = new RadioGroupFieldEditor(AHCPreferences.RENDERING, AHCUIMessages.displayChartsIn2D, 2, labelAndValues, chartsTab);
82 82
		addField(default2D3Ddisplay);
83 83
		
84 84
		
TXM/trunk/bundles/org.txm.ahc.rcp/src/org/txm/ahc/rcp/editors/AHCEditor.java (revision 3736)
1 1
package org.txm.ahc.rcp.editors;
2 2

  
3
import java.awt.Font;
4
import java.util.Arrays;
5

  
3 6
import org.eclipse.swt.SWT;
7
import org.eclipse.swt.widgets.Combo;
4 8
import org.eclipse.swt.widgets.Label;
5 9
import org.eclipse.swt.widgets.Spinner;
6 10
import org.eclipse.swt.widgets.ToolItem;
......
8 12
import org.txm.ahc.core.preferences.AHCPreferences;
9 13
import org.txm.ahc.rcp.messages.AHCUIMessages;
10 14
import org.txm.ca.core.functions.CA;
15
import org.txm.chartsengine.core.ChartsEngine;
11 16
import org.txm.chartsengine.rcp.editors.ChartEditor;
12 17
import org.txm.core.messages.TXMCoreMessages;
13 18
import org.txm.core.preferences.TXMPreferences;
......
18 23
import org.txm.rcp.IImageKeys;
19 24
import org.txm.rcp.editors.listeners.ComputeSelectionListener;
20 25
import org.txm.rcp.swt.GLComposite;
26
import org.txm.rcp.swt.widget.TXMParameterCombo;
21 27
import org.txm.rcp.swt.widget.TXMParameterSpinner;
22 28
import org.txm.rcp.swt.widget.ThresholdsGroup;
23 29
import org.txm.rcp.swt.widget.structures.PropertiesComboViewer;
......
92 98
	/**
93 99
	 * To render in 2D or 3D.
94 100
	 */
95
	@Parameter(key = AHCPreferences.RENDERING_2D)
96
	protected ToolItem rendering2D;
101
	@Parameter(key = AHCPreferences.RENDERING)
102
	protected Combo rendering;
97 103
	
98 104
	
99 105
	@Override
......
137 143
		// ComputeKeyListener computeKeyListener = new ComputeKeyListener(this);
138 144
		
139 145
		// Number of clusters
140
//		LabeledSpinner clusters = new LabeledSpinner(mainParametersArea, this, AHCUIMessages.numberOfClustersColon);
141
//		this.numberOfClusters = clusters.getSpinner();
142
//		this.numberOfClusters.setMinimum(2);
143
		
144
		
145 146
		TXMParameterSpinner clusters = new TXMParameterSpinner(mainParametersArea, this, AHCUIMessages.numberOfClustersColon);
146 147
		this.numberOfClusters = clusters.getControl();
147 148
		this.numberOfClusters.setMinimum(2);
148

  
149 149
		
150 150
		
151 151
		// Columns
......
161 161
		
162 162
		
163 163
		// 2D/3D rendering
164
		this.rendering2D = new ToolItem(this.chartToolBar, SWT.CHECK);
165
		this.rendering2D.setText("2D -> 3D"); //$NON-NLS-1$
166
		this.rendering2D.addSelectionListener(computeSelectionListener);
164
		TXMParameterCombo renderingParameterCombo = new TXMParameterCombo(this.getFirstLineComposite(), this, new String[] {"2D", "3D"});
165
		renderingParameterCombo.getComputingSelectionListener().setAutoCompute(true);
166
		this.rendering = renderingParameterCombo.getControl();
167
		if(this.getResult().isRendering2D()) {
168
			this.rendering.select(0);	
169
		}
170
		else {
171
			this.rendering.select(1);
172
		}
167 173
		
168 174
		
169
		
170
		
171 175
		// FIXME: SJ: temporary fix, later must enable the font, rendering mode, etc. in R calls
172 176
		// disable all component of the rendering tool bar
173 177
		this.advancedChartToolBar.setEnabled(false);
......
201 205
		
202 206
		this.rowsComputing.setSelection(!ahc.isColumnsComputing());
203 207
		
204
		if (this.getResult().isRendering2D()) {
205
			this.rendering2D.setText("2D -> 3D"); //$NON-NLS-1$
206
		}
207
		else { 
208
			this.rendering2D.setText("3D -> 2D"); //$NON-NLS-1$
209
		}
210 208
	}
211 209
	
212 210
}

Formats disponibles : Unified diff