-/*
- * Created on 27/06/2003
- *
- */
package com.quantum.view.bookmark;
import java.sql.SQLException;
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;
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();
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) {
}
}
public Schema getSchema() {
return schema;
}
+ public String getType() {
+ return this.type;
+ }
}