Révision 3381

TXM/trunk/org.txm.ca.rcp/src/org/txm/ca/rcp/editors/EigenvaluesTableEditor.java (revision 3381)
41 41
import org.eclipse.swt.layout.GridData;
42 42
import org.eclipse.swt.widgets.Event;
43 43
import org.eclipse.swt.widgets.Listener;
44
import org.eclipse.swt.widgets.TableColumn;
44 45
import org.eclipse.swt.widgets.TableItem;
45 46
import org.txm.Toolbox;
46 47
import org.txm.ca.core.functions.CA;
......
98 99
				"%", CAUIMessages.CorrespondanceAnalysisEditorInput_11, "", ""}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$;
99 100

  
100 101

  
102
		int sizes [] = {50, 120, 70, 70, 100, 100};
101 103
		for (int i = 0; i < titles.length; i++) {
102 104
			final TableViewerColumn column;
103 105

  
104 106
			int alignment = SWT.RIGHT;
105 107
			// Align the bar plot to the left
106
			if(i == 4)	{
108
			if (i == 4)	{
107 109
				alignment = SWT.LEFT;
108 110
			}
109 111

  
110 112
			column = new TableViewerColumn(viewer, alignment);
111 113

  
112 114
			column.getColumn().setText(titles[i]);
113
			column.getColumn().setWidth(100);
115
			column.getColumn().setWidth(sizes[i]);
114 116
			column.getColumn().setResizable(true);
115 117
			column.getColumn().setMoveable(true);
116 118
		}
......
172 174
		}
173 175
		
174 176
		
175
		// Pack the columns except the bar plot column
176
		for(int i = 0; i < viewer.getTable().getColumnCount(); i++)	{
177
			if(i != 4)	{
178
				this.viewer.getTable().getColumn(i).pack();
179
			}
180
		}
181

  
177
////		// Pack the columns except the bar plot column
178
////		for(int i = 0; i < viewer.getTable().getColumnCount(); i++)	{
179
////			if(i != 4)	{
180
////				this.viewer.getTable().getColumn(i).pack();
181
////			}
182
////		}
183
//		
184
//		
185
//		float W = 6.5f ;
186
//		
187
//		int n = 0;
188
//		TableColumn[] columns = viewer.getTable().getColumns();
189
//		for (int i = 0; i < columns.length; i++) {
190
//			TableColumn column = columns[i];
191
//			if (column.getWidth() == 0) continue; // skip closed columns
192
//			
193
//			int max = column.getText().length();
194
//			if (max == 0) continue; // skip no-title columns
195
//			
196
//			n = 0;
197
//			for (TableItem item : viewer.getTable().getItems()) {
198
//				if (max < item.getText(i).length()) max = item.getText(i).length();
199
//				if (n++ > 100) break; // stop testing after 100 lines
200
//			}
201
//			
202
//			column.setWidth(15 + (int) (max * W));
203
//		}
204
		
205
		viewer.getTable().layout(true, true);
182 206
		this.viewer.refresh();
183 207

  
184 208
	}

Formats disponibles : Unified diff