ca.sqlpower.architect
Class SQLTable.Folder<T extends SQLObject>

java.lang.Object
  extended by ca.sqlpower.architect.SQLObject
      extended by ca.sqlpower.architect.SQLTable.Folder<T>
All Implemented Interfaces:
java.io.Serializable
Enclosing class:
SQLTable

public static class SQLTable.Folder<T extends SQLObject>
extends SQLObject

The Folder class is a SQLObject that holds a SQLTable's child folders (columns and relationships).

See Also:
Serialized Form

Field Summary
static int COLUMNS
           
static int EXPORTED_KEYS
           
static int IMPORTED_KEYS
           
static int INDICES
           
protected  java.lang.String name
           
protected  SQLTable parent
           
protected  int type
           
 
Fields inherited from class ca.sqlpower.architect.SQLObject
children, magicDisableCount, populated, undoEventListeners
 
Constructor Summary
SQLTable.Folder(int type, boolean populated)
           
 
Method Summary
protected  void addChildImpl(int index, SQLObject child)
          All other addChild() methods call this one.
 boolean allowsChildren()
          Returns true if and only if this object can have child SQLObjects.
 java.util.List getChildren(java.sql.DatabaseMetaData dbmd)
          Returns an unmodifiable view of the child list.
 java.lang.Class<? extends SQLObject> getChildType()
           
 java.lang.String getName()
          This is the name of the object.
 SQLTable getParent()
          Returns the parent of this SQLObject or null if it is a root object such as SQLDatabase.
 java.lang.String getShortDisplayName()
          Returns a short string that should be displayed to the user for representing this SQLObject as a label.
 int getType()
          Returns the type code of this folder.
 void populate()
          Causes this SQLObject to load its children (if any exist).
 void populate(java.sql.DatabaseMetaData dbmd)
           
protected  SQLObject removeImpl(int index)
          Overrides default remove behaviour to normalize the primary key in the case of a removed SQLColumn and to check for locked (imported) columns.
 void setName(java.lang.String n)
          Sets the value of sql object name
protected  void setParent(SQLObject newParentTable)
          Sets the parent reference in this folder.
 java.lang.String toString()
           
 
Methods inherited from class ca.sqlpower.architect.SQLObject
addChild, addChild, addSQLObjectListener, addSQLObjectPreEventListener, addUndoEventListener, endCompoundEdit, fireDbChildInserted, fireDbChildPreRemove, fireDbChildRemoved, fireDbChildrenInserted, fireDbChildrenPreRemove, fireDbChildrenRemoved, fireDbObjectChanged, fireDbStructureChanged, getChild, getChildByName, getChildByNameIgnoreCase, getChildCount, getChildren, getIndexOfChildByName, getPhysicalName, getSQLObjectListeners, getSQLObjectPreEventListeners, getUndoEventListeners, isMagicEnabled, isPopulated, removeChild, removeChild, removeSQLObjectListener, removeSQLObjectPreEventListener, removeUndoEventListener, setMagicEnabled, setPhysicalName, setPopulated, startCompoundEdit
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

type

protected int type

name

protected java.lang.String name

parent

protected SQLTable parent

COLUMNS

public static final int COLUMNS
See Also:
Constant Field Values

IMPORTED_KEYS

public static final int IMPORTED_KEYS
See Also:
Constant Field Values

EXPORTED_KEYS

public static final int EXPORTED_KEYS
See Also:
Constant Field Values

INDICES

public static final int INDICES
See Also:
Constant Field Values
Constructor Detail

SQLTable.Folder

public SQLTable.Folder(int type,
                       boolean populated)
Method Detail

getName

public java.lang.String getName()
Description copied from class: SQLObject
This is the name of the object. For tables, it returns the table name; for catalogs, the catalog name, and so on.

Overrides:
getName in class SQLObject

setName

public void setName(java.lang.String n)
Description copied from class: SQLObject
Sets the value of sql object name

Overrides:
setName in class SQLObject
Parameters:
n - Value to assign to this.name

getParent

public SQLTable getParent()
Description copied from class: SQLObject
Returns the parent of this SQLObject or null if it is a root object such as SQLDatabase.

Specified by:
getParent in class SQLObject

setParent

protected void setParent(SQLObject newParentTable)
Sets the parent reference in this folder.

Specified by:
setParent in class SQLObject
Throws:
java.lang.ClassCastException - if newParent is not an instance of SQLTable.

populate

public void populate()
              throws ArchitectException
Description copied from class: SQLObject
Causes this SQLObject to load its children (if any exist). This method will be called lots of times, so track whether or not you need to do anything and return right away whenever possible.

Specified by:
populate in class SQLObject
Throws:
ArchitectException

populate

public void populate(java.sql.DatabaseMetaData dbmd)
              throws ArchitectException
Throws:
ArchitectException

addChildImpl

protected void addChildImpl(int index,
                            SQLObject child)
                     throws ArchitectException
Description copied from class: SQLObject
All other addChild() methods call this one. If you want to override the addChild behaviour, override this method only.

Overrides:
addChildImpl in class SQLObject
Parameters:
index - The index that the new child will have
child - The new child to add (must be same type as all other children)
Throws:
ArchitectException - If you try to add a child of a different type than the existing children.

removeImpl

protected SQLObject removeImpl(int index)
Overrides default remove behaviour to normalize the primary key in the case of a removed SQLColumn and to check for locked (imported) columns. In both cases, the special checking is not performed if magic is disabled or this folder has no parent.

Overrides:
removeImpl in class SQLObject
Throws:
LockedColumnException - If this is a folder of columns, and the column you attempt to remove is "owned" by a relationship.

getShortDisplayName

public java.lang.String getShortDisplayName()
Description copied from class: SQLObject
Returns a short string that should be displayed to the user for representing this SQLObject as a label.

Specified by:
getShortDisplayName in class SQLObject

allowsChildren

public boolean allowsChildren()
Description copied from class: SQLObject
Returns true if and only if this object can have child SQLObjects. Your implementation of this method must not cause JDBC activity, or the lazy loading properties of your SQLObjects will be wasted! Typically, you will implement this with a hardcoded "return true" or "return false" depending on object type.

Specified by:
allowsChildren in class SQLObject

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getType

public int getType()
Returns the type code of this folder.

Returns:
One of COLUMNS, IMPORTED_KEYS, or EXPORTED_KEYS.

getChildren

public java.util.List getChildren(java.sql.DatabaseMetaData dbmd)
                           throws ArchitectException
Returns an unmodifiable view of the child list. All list members will be SQLObject subclasses (SQLTable, SQLRelationship, SQLColumn, etc.) which are directly contained within this SQLObject.

Throws:
ArchitectException

getChildType

public java.lang.Class<? extends SQLObject> getChildType()
Specified by:
getChildType in class SQLObject


Copyright © 2003-2007 SQL Power Group Inc. www.sqlpower.ca