ca.sqlpower.wabit.rs.query
Class WabitContainer<T extends WabitItem>

java.lang.Object
  extended by ca.sqlpower.object.AbstractSPObject
      extended by ca.sqlpower.wabit.AbstractWabitObject
          extended by ca.sqlpower.wabit.rs.query.WabitContainer<T>
All Implemented Interfaces:
ca.sqlpower.object.SPObject, WabitObject
Direct Known Subclasses:
WabitConstantsContainer, WabitTableContainer

public abstract class WabitContainer<T extends WabitItem>
extends AbstractWabitObject

This container wraps any other kind of Container to allow attaching SPListeners that will be notified appropriately when events happen on the container.


Field Summary
protected  java.util.List<T> children
          This is a list of WabitItems that mimics the items in the delegate.
 
Fields inherited from class ca.sqlpower.object.AbstractSPObject
uuid
 
Constructor Summary
WabitContainer(ca.sqlpower.query.Container delegate)
           
WabitContainer(ca.sqlpower.query.Container delegate, boolean createItemWrappers)
          Creates a WabitObject that wraps any Container object.
 
Method Summary
protected  void addChildImpl(ca.sqlpower.object.SPObject child, int index)
           
 boolean allowsChildren()
           
 int childPositionOffset(java.lang.Class<? extends ca.sqlpower.object.SPObject> childType)
           
 ca.sqlpower.object.CleanupExceptions cleanup()
          Default cleanup method that does nothing.
protected abstract  T createWabitItemChild(ca.sqlpower.query.Item item)
          Creates a child of the type this class contains
 java.lang.String getAlias()
           
protected abstract  java.lang.Class<T> getChildClass()
          Returns the class type of the children this container contains.
 java.util.List<? extends WabitObject> getChildren()
           
 ca.sqlpower.query.Container getDelegate()
           
 java.util.List<WabitObject> getDependencies()
           
 java.awt.geom.Point2D getPosition()
           
protected  boolean removeChildImpl(ca.sqlpower.object.SPObject child)
           
 void removeDependency(ca.sqlpower.object.SPObject dependency)
           
 void setAlias(java.lang.String alias)
           
 void setPosition(java.awt.geom.Point2D position)
           
 
Methods inherited from class ca.sqlpower.wabit.AbstractWabitObject
commit, equals, generateNewUUID, getParent, getSession, isForegroundThread, removeChild, rollback, runInBackground, runInForeground, toString
 
Methods inherited from class ca.sqlpower.object.AbstractSPObject
addChild, addSPListener, begin, fireChildAdded, fireChildRemoved, firePropertyChange, firePropertyChange, firePropertyChange, fireTransactionEnded, fireTransactionRollback, fireTransactionStarted, getChildren, getName, getUUID, removeSPListener, setName, setParent, setUUID
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface ca.sqlpower.object.SPObject
addChild, addSPListener, begin, getChildren, getName, getUUID, removeSPListener, setName, setParent, setUUID
 

Field Detail

children

protected final java.util.List<T extends WabitItem> children
This is a list of WabitItems that mimics the items in the delegate. Items should be added to and removed from this list as they are added to and removed from the delegate. These children will also be returned instead of the delegate's children when they are requested. The children of the delegate contain a parent pointer to the delegate and the WabitItems point to this container instead.

Constructor Detail

WabitContainer

public WabitContainer(ca.sqlpower.query.Container delegate)

WabitContainer

public WabitContainer(ca.sqlpower.query.Container delegate,
                      boolean createItemWrappers)
Creates a WabitObject that wraps any Container object.

Parameters:
delegate - The Container to wrap.
createItemWrappers - If true the children of the container will be wrapped to start. If false there will be no WabitObject children to this container.
Method Detail

createWabitItemChild

protected abstract T createWabitItemChild(ca.sqlpower.query.Item item)
Creates a child of the type this class contains

Parameters:
item - The item to wrap in a WabitItem.
Returns:
A new WabitItem that is the correct sub-type for this class.

getChildClass

protected abstract java.lang.Class<T> getChildClass()
Returns the class type of the children this container contains.


cleanup

public ca.sqlpower.object.CleanupExceptions cleanup()
Description copied from class: AbstractWabitObject
Default cleanup method that does nothing. Override and implement this method if cleanup is necessary.

Specified by:
cleanup in interface ca.sqlpower.object.SPObject
Overrides:
cleanup in class AbstractWabitObject

getDelegate

public ca.sqlpower.query.Container getDelegate()

removeChildImpl

protected boolean removeChildImpl(ca.sqlpower.object.SPObject child)
Specified by:
removeChildImpl in class ca.sqlpower.object.AbstractSPObject

addChildImpl

protected void addChildImpl(ca.sqlpower.object.SPObject child,
                            int index)
Overrides:
addChildImpl in class ca.sqlpower.object.AbstractSPObject

allowsChildren

public boolean allowsChildren()

childPositionOffset

public int childPositionOffset(java.lang.Class<? extends ca.sqlpower.object.SPObject> childType)

getChildren

public java.util.List<? extends WabitObject> getChildren()

getDependencies

public java.util.List<WabitObject> getDependencies()

removeDependency

public void removeDependency(ca.sqlpower.object.SPObject dependency)

getAlias

public java.lang.String getAlias()

setAlias

public void setAlias(java.lang.String alias)

getPosition

public java.awt.geom.Point2D getPosition()

setPosition

public void setPosition(java.awt.geom.Point2D position)


Copyright © 2009. All Rights Reserved.