8,6 → 8,7 |
import org.tela_botanica.client.modeles.ListeEntiteGeographiqueObservation; |
import org.tela_botanica.client.observation.ObservationMediateur; |
|
import com.google.gwt.core.client.GWT; |
import com.google.gwt.json.client.JSONArray; |
import com.google.gwt.json.client.JSONObject; |
import com.google.gwt.user.client.Window; |
113,14 → 114,18 |
// on interdit le drag and drop dans l'arbre |
arbreEntitesGeographiques.setEnableDD(false); |
arbreEntitesGeographiques.setId("x-view-tree-filter"); |
// arbreEntitesGeographiques.setAutoWidth(false); |
// arbreEntitesGeographiques.setAutoScroll(true); |
// arbreEntitesGeographiques.setBorder(false); |
arbreEntitesGeographiques.setAutoWidth(false); |
|
if (GWT.isScript()) { |
arbreEntitesGeographiques.setAutoScroll(true); |
} |
|
arbreEntitesGeographiques.setBorder(false); |
|
// on crée une racine pour l'arbre |
TreeNode root = new TreeNode("Localité"); |
TreeNode root = new TreeNode("Localités"); |
root.setId("racine_entite"); |
String[] usObject = { "Localités", "racine" }; |
String[] usObject = { "Localités" }; |
root.setUserObject(usObject); |
|
arbreEntitesGeographiques.setRootNode(root); |
161,8 → 166,10 |
if (nouvelleDonnees instanceof ListeEntiteGeographiqueObservation) { |
|
|
|
String entite=null; |
String parent=null; |
String idEntite=null; |
String idParent=null; |
|
ListeEntiteGeographiqueObservation data = (ListeEntiteGeographiqueObservation) nouvelleDonnees ; |
|
170,9 → 177,9 |
if (data.isEmpty()) { |
// on crée un arbre vide |
TreeNode root = new TreeNode(); |
root.setId("racine"); |
root.setText("Tags"); |
String[] usObj = { "Tags", "racine" }; |
root.setId("racine_entite"); |
root.setText("Localités"); |
String[] usObj = { "Localités"}; |
root.setUserObject(usObj); |
donneeEntitesGeographiques.setRootNode(root); |
|
184,16 → 191,17 |
EntiteGeographiqueObservation ent=(EntiteGeographiqueObservation) data.get(it.next()); |
|
entite=ent.getEntite(); |
parent=ent.getParent(); |
idEntite=ent.getIdEntite(); |
idParent=ent.getIdParent(); |
|
|
|
String[] usObj = { entite }; |
|
// et on construit l'arbre à partir de la racine (qui est |
// toujours le premier élément) |
if (entite.equals("racine")) { |
if (entite.equals("racine_entite")) { |
TreeNode root = new TreeNode(); |
root.setId(entite); |
root.setId(idEntite); |
root.setText(entite); |
root.setUserObject(usObj); |
donneeEntitesGeographiques.setRootNode(root); |
202,10 → 210,9 |
// dans l'ordre hierarchique de leur niveau |
// ce qui permet de les traiter séquentiellement) |
TreeNode node = new TreeNode(); |
node.setId(entite); |
node.setText(entite); |
node.setChecked(false); |
Node parentNode = donneeEntitesGeographiques.getNodeById(parent); |
node.setId(idEntite); |
node.setText(entite); |
Node parentNode = donneeEntitesGeographiques.getNodeById(idParent); |
node.setUserObject(usObj); |
parentNode.appendChild(node); |
} |
293,7 → 300,6 |
String[] usObj = (String[]) ndNodeFils[i].getUserObject(); |
TreeNode child = new TreeNode(usObj[0]); |
child.setId(usObj[0] + "_filtre"); |
child.setChecked(false); |
child.setUserObject(usObj); |
ndPereCopie.appendChild(child); |
|