X-Git-Url: http://git.phpeclipse.com diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/bookmark/GroupNode.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/bookmark/GroupNode.java index 974dcd7..354edd3 100644 --- a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/bookmark/GroupNode.java +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/bookmark/GroupNode.java @@ -1,7 +1,3 @@ -/* - * Created on 27/06/2003 - * - */ package com.quantum.view.bookmark; import java.sql.SQLException; @@ -26,12 +22,17 @@ import com.quantum.model.SchemaHolder; public class GroupNode extends TreeNode implements Comparable, SchemaHolder { private String type = null; private Schema schema = null; + private boolean initialized = false; public GroupNode(TreeNode parent, Schema schema, String type) { super(parent); this.schema = schema; this.type = type; } + + protected boolean isInitialized() { + return this.initialized; + } public boolean hasChildren() { if (!isInitialized()) { return true; @@ -48,7 +49,6 @@ public class GroupNode extends TreeNode implements Comparable, SchemaHolder { protected void initializeChildren() { try { boolean firstTimeInitialization = !isInitialized(); - boolean changed = false; Map temp = new HashMap(); for (Iterator i = this.children.iterator(); i.hasNext();) { TreeNode treeNode = (TreeNode) i.next(); @@ -67,15 +67,21 @@ public class GroupNode extends TreeNode implements Comparable, SchemaHolder { EntityNode entityNode = (EntityNode) temp.remove(name); if (entityNode == null) { this.children.add(new EntityNode(this, entities[i])); - changed = true; } else { + entityNode.setEntity(entities[i]); this.children.add(entityNode); } } + for (Iterator i = temp.values().iterator(); i.hasNext();) { + ((TreeNode) i.next()).dispose(); + } + Collections.sort(this.children); - if ((temp.size() > 0 || changed ) && !firstTimeInitialization) { + if (!firstTimeInitialization) { firePropertyChange("children", null, null); } + + this.initialized = true; } catch (SQLException e) { } } @@ -91,4 +97,7 @@ public class GroupNode extends TreeNode implements Comparable, SchemaHolder { public Schema getSchema() { return schema; } + public String getType() { + return this.type; + } }