Revision 8663 trunk/extensions/extWFS2/src/com/iver/cit/gvsig/gui/panels/attributesTree/AttributesTreeTableModel.java
AttributesTreeTableModel.java | ||
---|---|---|
4 | 4 |
|
5 | 5 |
import org.gvsig.gui.beans.swing.treeTable.AbstractTreeTableModel; |
6 | 6 |
import org.gvsig.gui.beans.swing.treeTable.TreeTableModel; |
7 |
import org.gvsig.remoteClient.gml.schemas.GMLGeometryType; |
|
7 | 8 |
import org.gvsig.remoteClient.gml.schemas.IXMLType; |
8 | 9 |
import org.gvsig.remoteClient.gml.schemas.XMLComplexType; |
9 | 10 |
import org.gvsig.remoteClient.gml.schemas.XMLElement; |
... | ... | |
55 | 56 |
* |
56 | 57 |
* $Id$ |
57 | 58 |
* $Log$ |
58 |
* Revision 1.4 2006-11-01 17:29:07 jorpiell |
|
59 |
* Revision 1.5 2006-11-10 09:04:33 ppiqueras |
|
60 |
* La geometría no se visualiza en el árbol del panel de filtro, pero sí en el de atributos |
|
61 |
* |
|
62 |
* Revision 1.4 2006/11/01 17:29:07 jorpiell |
|
59 | 63 |
* Se ha elimiado el nodo virtual de la raiz. Adem?s ya se cargan los valores de un campo complejo en la pesta?a del filtro |
60 | 64 |
* |
61 | 65 |
* Revision 1.3 2006/10/31 13:51:15 ppiqueras |
... | ... | |
85 | 89 |
* @author Jorge Piera Llodr? (piera_jor@gva.es) |
86 | 90 |
*/ |
87 | 91 |
public class AttributesTreeTableModel extends AbstractTreeTableModel { |
92 |
private boolean showGeometry; |
|
88 | 93 |
private String[] cNames = {PluginServices.getText(this,"attributeName"), |
89 | 94 |
PluginServices.getText(this,"attributeType")}; |
90 | 95 |
private Class[] cTypes = {TreeTableModel.class,String.class}; |
91 | 96 |
|
92 | 97 |
public AttributesTreeTableModel(Object root) { |
93 |
super(root); |
|
94 |
} |
|
98 |
super(root); |
|
99 |
showGeometry = true; |
|
100 |
} |
|
95 | 101 |
|
102 |
public AttributesTreeTableModel(Object root, boolean show_Geometry) { |
|
103 |
super(root); |
|
104 |
showGeometry = show_Geometry; |
|
105 |
} |
|
106 |
|
|
96 | 107 |
public AttributesTreeTableModel() { |
97 |
super(null); |
|
108 |
super(null); |
|
109 |
showGeometry = true; |
|
98 | 110 |
} |
99 | 111 |
|
112 |
public boolean getShowGeometry() { |
|
113 |
return showGeometry; |
|
114 |
} |
|
115 |
|
|
100 | 116 |
// |
101 | 117 |
// The TreeModel interface |
102 | 118 |
// |
... | ... | |
104 | 120 |
public int getChildCount(Object node) { |
105 | 121 |
XMLElement element = (XMLElement)node; |
106 | 122 |
if (element.getEntityType().getType() == IXMLType.COMPLEX){ |
107 |
return ((XMLComplexType)element.getEntityType()).getAttributes().size(); |
|
123 |
|
|
124 |
// It's supposed that geometry is on level 1 |
|
125 |
Vector attributes = ((XMLComplexType)element.getEntityType()).getAttributes(); |
|
126 |
int size = attributes.size(); |
|
127 |
|
|
128 |
if (!showGeometry) { |
|
129 |
for (int i = 0; i < attributes.size(); i++) { |
|
130 |
if (((XMLElement)attributes.get(i)).getEntityType().getType() == IXMLType.GML_GEOMETRY) |
|
131 |
size --; |
|
132 |
} |
|
133 |
} |
|
134 |
|
|
135 |
return size; |
|
108 | 136 |
}else{ |
109 | 137 |
return 0; |
110 | 138 |
} |
... | ... | |
113 | 141 |
public Object getChild(Object node, int i) { |
114 | 142 |
XMLElement element = (XMLElement)node; |
115 | 143 |
if (element.getEntityType().getType() == IXMLType.COMPLEX){ |
116 |
Vector vector = ((XMLComplexType)element.getEntityType()).getAttributes(); |
|
117 |
XMLElement child = (XMLElement) vector.get(i); |
|
144 |
Vector attributes = ((XMLComplexType)element.getEntityType()).getAttributes(); |
|
145 |
XMLElement child = null; |
|
146 |
int k = -1; |
|
147 |
|
|
148 |
if (!showGeometry) { |
|
149 |
for (int j = 0; j < attributes.size(); j++) { |
|
150 |
child = (XMLElement) attributes.get(j); |
|
151 |
|
|
152 |
if (child.getEntityType().getType() != IXMLType.GML_GEOMETRY) |
|
153 |
k++; |
|
154 |
|
|
155 |
if (i == k) |
|
156 |
break; |
|
157 |
} |
|
158 |
} |
|
159 |
else { |
|
160 |
child = (XMLElement) attributes.get(i); |
|
161 |
} |
|
162 |
|
|
118 | 163 |
child.setParentElement(element); |
164 |
|
|
119 | 165 |
return child; |
120 | 166 |
} |
121 | 167 |
return null; |
Also available in: Unified diff