Revision 3566 trunk/applications/appCatalogYNomenclatorClient/src/es/gva/cit/gazetteer/utils/ThesaurusJTree/ThesaurusJTree.java
ThesaurusJTree.java | ||
---|---|---|
1 |
|
|
1 | 2 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
2 | 3 |
* |
3 | 4 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana. |
... | ... | |
39 | 40 |
* dac@iver.es |
40 | 41 |
*/ |
41 | 42 |
package es.gva.cit.gazetteer.utils.ThesaurusJTree; |
42 |
|
|
43 |
import es.gva.cit.gazetteer.querys.ThesaurusName; |
|
43 | 44 |
import java.util.Vector; |
44 |
|
|
45 | 45 |
import javax.swing.JTree; |
46 | 46 |
import javax.swing.tree.DefaultMutableTreeNode; |
47 | 47 |
import javax.swing.tree.DefaultTreeCellRenderer; |
48 | 48 |
import javax.swing.tree.DefaultTreeModel; |
49 | 49 |
|
50 |
import es.gva.cit.gazetteer.querys.ThesaurusName; |
|
51 |
|
|
52 | 50 |
/** |
53 | 51 |
* This class is a kind of Jtree that loads a Thesaurus in it |
54 | 52 |
* |
53 |
* |
|
55 | 54 |
* @author Jorge Piera Llodra (piera_jor@gva.es) |
56 | 55 |
*/ |
57 |
public class ThesaurusJTree extends JTree{ |
|
58 |
|
|
59 |
/** |
|
60 |
* @param features |
|
61 |
* Features to load |
|
62 |
* @param rootName |
|
63 |
* Name to the root left |
|
64 |
*/ |
|
65 |
public ThesaurusJTree(Vector features,String rootName){ |
|
56 |
public class ThesaurusJTree extends JTree { |
|
57 |
|
|
58 |
/** |
|
59 |
* |
|
60 |
* |
|
61 |
* |
|
62 |
* @param features Features to load |
|
63 |
* @param rootName Name to the root left |
|
64 |
*/ |
|
65 |
public ThesaurusJTree(Vector features, String rootName) { |
|
66 | 66 |
super(); |
67 | 67 |
creteTreeNodes(features,rootName); |
68 | 68 |
setStyle(); |
69 |
} |
|
70 |
|
|
71 |
private void setStyle(){ |
|
69 |
} |
|
70 |
|
|
71 |
/** |
|
72 |
* |
|
73 |
* |
|
74 |
*/ |
|
75 |
private void setStyle() { |
|
72 | 76 |
DefaultTreeCellRenderer renderer = (DefaultTreeCellRenderer)this.getCellRenderer(); |
73 | 77 |
renderer.setLeafIcon(null); |
74 | 78 |
renderer.setClosedIcon(null); |
75 | 79 |
renderer.setOpenIcon(null); |
76 |
} |
|
77 |
|
|
78 |
private void creteTreeNodes(Vector features,String rootName){ |
|
80 |
} |
|
81 |
|
|
82 |
/** |
|
83 |
* |
|
84 |
* |
|
85 |
* |
|
86 |
* @param features |
|
87 |
* @param rootName |
|
88 |
*/ |
|
89 |
private void creteTreeNodes(Vector features, String rootName) { |
|
79 | 90 |
ThesaurusName tes = new ThesaurusName("ThesaurusRoot"); |
80 | 91 |
tes.setTitle(rootName); |
81 | 92 |
DefaultMutableTreeNode top = new DefaultMutableTreeNode(tes); |
82 | 93 |
createNodes(top,features); |
83 | 94 |
DefaultTreeModel model = new DefaultTreeModel(top); |
84 | 95 |
this.setModel(model); |
85 |
} |
|
86 |
|
|
87 |
|
|
88 |
private void createNodes(DefaultMutableTreeNode top,Vector features) { |
|
96 |
} |
|
97 |
|
|
98 |
/** |
|
99 |
* |
|
100 |
* |
|
101 |
* |
|
102 |
* @param top |
|
103 |
* @param features |
|
104 |
*/ |
|
105 |
private void createNodes(DefaultMutableTreeNode top, Vector features) { |
|
89 | 106 |
if (features == null) |
90 | 107 |
return; |
91 | 108 |
|
... | ... | |
95 | 112 |
createNodes(top.getLastLeaf(),feature.getFeatures()); |
96 | 113 |
} |
97 | 114 |
|
98 |
} |
|
99 |
} |
|
115 |
} |
|
116 |
} |
Also available in: Unified diff