uk.ac.kcl.cch.jb.pliny.views.utils
Class ResourceExplorerItemBase

java.lang.Object
  extended byuk.ac.kcl.cch.jb.pliny.views.utils.ResourceExplorerItemBase
All Implemented Interfaces:
EventListener, IResourceExplorerItem, PropertyChangeListener
Direct Known Subclasses:
ResourceExplorerFavGroupItem, ResourceExplorerInitialLetterItem, ResourceExplorerNamedModelItem, ResourceExplorerRoot, ResourceExplorerSurrogateListItemBase

public abstract class ResourceExplorerItemBase
extends Object
implements IResourceExplorerItem, PropertyChangeListener

provides an abstract base class that provides functionality shared by many of the classes that make up the Resource Explorer's data model.

Implementors can provide a tracking event that, when it occurs triggers this item's #propertyChange that will both request a recreation of this item's children, and then will ask the associated TreeViewer to redisplay.

Author:
John Bradley

Field Summary
protected  Vector myChildren
           
protected  IResourceTreeView myView
           
 
Constructor Summary
ResourceExplorerItemBase(IResourceTreeView myView, BaseObject obj, String trackingProperty)
           
 
Method Summary
abstract  boolean canModify()
          return true if this item's name can be edited within the Resource Explorer.
abstract  Iterator createListIterator()
           
 void dispose()
          performs data cleanup.
 Object getAssociatedObject()
          returns the Pliny model object associated with this item.
protected  BaseObject getBaseObject()
           
 List getChildren()
          returns a list of IResourceExplorerItem items that are children of this item.
protected  List getChildrenList()
           
abstract  org.eclipse.swt.graphics.Image getIcon()
          returns the Image to be used as the Icon displayed beside the item in the Resource Explorer tree.
 IResourceTreeView getMyView()
           
 int getNumberChildren()
          returns number of children owned by this item.
 int getPageNumber()
          return the page number data associated with the Pliny model object associated wtih this item.
abstract  IResourceExplorerItem getParent()
          returns the parent item of this item in the Resource Explorer display tree.
abstract  String getText()
          returns text to be used as the textual label for the tree item display.
 boolean hasChildren()
          returns true if this item has children items.
abstract  IResourceExplorerItem makeChild(Object item)
           
 void propertyChange(PropertyChangeEvent arg0)
           
protected  void setBaseObject(BaseObject obj)
           
abstract  void setText(String name)
          changes text to be displayed as the label to the given text.
protected  void updateMyChildren()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

myChildren

protected Vector myChildren

myView

protected IResourceTreeView myView
Constructor Detail

ResourceExplorerItemBase

public ResourceExplorerItemBase(IResourceTreeView myView,
                                BaseObject obj,
                                String trackingProperty)
Method Detail

getBaseObject

protected BaseObject getBaseObject()

setBaseObject

protected void setBaseObject(BaseObject obj)

getMyView

public IResourceTreeView getMyView()

dispose

public void dispose()
Description copied from interface: IResourceExplorerItem
performs data cleanup. This will be called then the item is no longer needed.

Specified by:
dispose in interface IResourceExplorerItem

propertyChange

public void propertyChange(PropertyChangeEvent arg0)
Specified by:
propertyChange in interface PropertyChangeListener

updateMyChildren

protected void updateMyChildren()

getAssociatedObject

public Object getAssociatedObject()
Description copied from interface: IResourceExplorerItem
returns the Pliny model object associated with this item. Return null if there is not Pliny model object.

Specified by:
getAssociatedObject in interface IResourceExplorerItem
Returns:
Object representing associated Pliny model object.

getText

public abstract String getText()
Description copied from interface: IResourceExplorerItem
returns text to be used as the textual label for the tree item display.

Specified by:
getText in interface IResourceExplorerItem
Returns:
String text to be displayed.

setText

public abstract void setText(String name)
Description copied from interface: IResourceExplorerItem
changes text to be displayed as the label to the given text. This should result in changes in the backing Pliny model as well.

Specified by:
setText in interface IResourceExplorerItem
Parameters:
name - text to be used as the name of this item.

canModify

public abstract boolean canModify()
Description copied from interface: IResourceExplorerItem
return true if this item's name can be edited within the Resource Explorer.

Specified by:
canModify in interface IResourceExplorerItem
Returns:
true if editable.

getIcon

public abstract org.eclipse.swt.graphics.Image getIcon()
Description copied from interface: IResourceExplorerItem
returns the Image to be used as the Icon displayed beside the item in the Resource Explorer tree. The image must be disposed of by this object -- it will not be disposed by the caller.

Specified by:
getIcon in interface IResourceExplorerItem
Returns:
SWT Image to act as the icon.

getParent

public abstract IResourceExplorerItem getParent()
Description copied from interface: IResourceExplorerItem
returns the parent item of this item in the Resource Explorer display tree.

Specified by:
getParent in interface IResourceExplorerItem

getChildrenList

protected List getChildrenList()

getNumberChildren

public int getNumberChildren()
Description copied from interface: IResourceExplorerItem
returns number of children owned by this item.

Specified by:
getNumberChildren in interface IResourceExplorerItem

hasChildren

public boolean hasChildren()
Description copied from interface: IResourceExplorerItem
returns true if this item has children items.

Specified by:
hasChildren in interface IResourceExplorerItem

getChildren

public List getChildren()
Description copied from interface: IResourceExplorerItem
returns a list of IResourceExplorerItem items that are children of this item.

Specified by:
getChildren in interface IResourceExplorerItem

createListIterator

public abstract Iterator createListIterator()

makeChild

public abstract IResourceExplorerItem makeChild(Object item)

getPageNumber

public int getPageNumber()
Description copied from interface: IResourceExplorerItem
return the page number data associated with the Pliny model object associated wtih this item. Return 0 if there is no associated page number.

Specified by:
getPageNumber in interface IResourceExplorerItem
Returns:
page number associated with the item.