1 package com.quantum.view.bookmark;
3 import java.sql.SQLException;
5 import com.quantum.model.Bookmark;
6 import com.quantum.model.NotConnectedException;
7 import com.quantum.model.Schema;
8 import com.quantum.model.SchemaHolder;
13 public class SchemaNode extends TreeNode implements SchemaHolder {
15 private Schema schema;
19 public SchemaNode(TreeNode parent, Schema schema) {
25 * @see com.quantum.view.bookmark.TreeNode#getChildren()
27 public Object[] getChildren() {
28 Bookmark bookmark = getBookmark();
29 if (!bookmark.isConnected()) {
30 return BookmarkListNode.EMPTY_ARRAY;
32 if (this.children.isEmpty()) {
36 return (TreeNode[]) this.children.toArray(new TreeNode[this.children.size()]);
39 protected void initializeChildren() {
40 this.children.clear();
41 Bookmark bookmark = getBookmark();
43 String[] types = bookmark.getDatabase().getEntityTypes();
44 for (int i = 0, length = (types == null) ? 0 : types.length;
47 this.children.add(new GroupNode(this, this.schema, types[i]));
49 } catch (NotConnectedException e) {
50 } catch (SQLException e) {
55 * @see com.quantum.view.bookmark.TreeNode#hasChildren()
57 public boolean hasChildren() {
58 return getBookmark().isConnected();
62 * @see com.quantum.view.bookmark.TreeNode#getName()
64 public String getName() {
65 return this.schema.getDisplayName();
69 * @see com.quantum.view.bookmark.TreeNode#getImageName()
71 protected String getImageName() {
72 return this.schema.isDefault() ? "user.gif" : "schema.gif";
76 * @see com.quantum.model.SchemaHolder#getSchema()
78 public Schema getSchema() {