Revision 41056
trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.fmap.control/src/main/java/org/gvsig/fmap/mapcontrol/dal/feature/swing/table/ConfigurationTableModel.java | ||
---|---|---|
29 | 29 |
|
30 | 30 |
import javax.swing.table.AbstractTableModel; |
31 | 31 |
|
32 |
import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor; |
|
32 | 33 |
import org.gvsig.i18n.Messages; |
33 | 34 |
|
34 | 35 |
/** |
... | ... | |
46 | 47 |
private static final int VISIBILITY_COLUMN = 0; |
47 | 48 |
private static final int NAME_COLUMN = 1; |
48 | 49 |
private static final int ALIAS_COLUMN = 2; |
50 |
private static final int TYPE_COLUMN = 3; |
|
51 |
private static final int SIZE_COLUMN = 4; |
|
49 | 52 |
|
50 | 53 |
private ConfigurableFeatureTableModel configurable; |
51 | 54 |
|
... | ... | |
55 | 58 |
} |
56 | 59 |
|
57 | 60 |
public int getColumnCount() { |
58 |
// 1: visibility, 2: field name, 3: alias |
|
59 |
return 3;
|
|
61 |
// 1: visibility, 2: field name, 3: alias, 4:Type, 5:size
|
|
62 |
return 5;
|
|
60 | 63 |
} |
61 | 64 |
|
62 | 65 |
public int getRowCount() { |
... | ... | |
64 | 67 |
} |
65 | 68 |
|
66 | 69 |
public Object getValueAt(int rowIndex, int columnIndex) { |
70 |
FeatureAttributeDescriptor fad = null; |
|
67 | 71 |
String name = configurable.getOriginalColumnName(rowIndex); |
68 | 72 |
switch (columnIndex) { |
69 | 73 |
case VISIBILITY_COLUMN: |
... | ... | |
72 | 76 |
return name; |
73 | 77 |
case ALIAS_COLUMN: |
74 | 78 |
return configurable.getAliasForColumn(name); |
79 |
case TYPE_COLUMN: |
|
80 |
fad = configurable.internalGetFeatureDescriptorForColumn(rowIndex); |
|
81 |
if( fad == null ) { |
|
82 |
return null; |
|
83 |
} |
|
84 |
return fad.getDataType().getName(); |
|
85 |
case SIZE_COLUMN: |
|
86 |
fad = configurable.internalGetFeatureDescriptorForColumn(rowIndex); |
|
87 |
if( fad == null ) { |
|
88 |
return null; |
|
89 |
} |
|
90 |
return fad.getSize(); |
|
75 | 91 |
default: |
76 | 92 |
return null; |
77 | 93 |
} |
... | ... | |
108 | 124 |
return Boolean.class; |
109 | 125 |
case NAME_COLUMN: |
110 | 126 |
case ALIAS_COLUMN: |
127 |
case TYPE_COLUMN: |
|
111 | 128 |
return String.class; |
129 |
case SIZE_COLUMN: |
|
130 |
return int.class; |
|
112 | 131 |
default: |
113 | 132 |
return Object.class; |
114 | 133 |
} |
... | ... | |
124 | 143 |
return Messages.getText("Nombre"); |
125 | 144 |
case ALIAS_COLUMN: |
126 | 145 |
return Messages.getText("Alias"); |
146 |
case SIZE_COLUMN: |
|
147 |
return Messages.getText("Size"); |
|
148 |
case TYPE_COLUMN: |
|
149 |
return Messages.getText("Type"); |
|
127 | 150 |
default: |
128 | 151 |
return ""; |
129 | 152 |
} |
Also available in: Unified diff