-/*
- * Created on 27/06/2003
- *
- */
package com.quantum.view.bookmark;
import java.sql.SQLException;
+import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
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);
}
}
- if (changed && !firstTimeInitialization) {
+ for (Iterator i = temp.values().iterator(); i.hasNext();) {
+ ((TreeNode) i.next()).dispose();
+ }
+
+ Collections.sort(this.children);
+ if (!firstTimeInitialization) {
firePropertyChange("children", null, null);
}
+
+ this.initialized = true;
} catch (SQLException e) {
}
}
public Schema getSchema() {
return schema;
}
+ public String getType() {
+ return this.type;
+ }
}