Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

ulu.view
Class ItemImpl  view ItemImpl download ItemImpl.java

java.lang.Object
  extended byulu.view.ItemImpl
All Implemented Interfaces:
ContentSource, Handler, Invokable, Item, java.util.Observer, Propertied, Referrer, java.io.Serializable, Typed, UContained
Direct Known Subclasses:
FilterItem, ViewImpl

public class ItemImpl
extends java.lang.Object
implements Item, java.util.Observer, Handler

generic implementation of Item interface


Field Summary
protected  java.beans.PropertyChangeSupport changes
          bean support helper class
protected  UMethod defmeth
          the default method fore this item
(package private)  java.util.Hashtable methods
          collection of methods assigned to this object
static java.lang.String PROP_REFSTRING
          field name denoting the (hidden) reference string
(package private)  java.util.Hashtable props
          collection of properties assigned to this item
(package private)  java.lang.Object reference
          the reference object, as defined by Referer interface
(package private)  boolean sealed
          denotes whether methods/properties can be added
(package private) static java.util.Properties types
          mini-registry of valid Item types
(package private) static boolean useScrap
          whether to make use of the scrapbook feature - in some cases, its useful to have, in others, its an unnecessary distraction
 
Fields inherited from interface ulu.view.Item
METHOD_ADD_TO_SCRAPBOOK
 
Fields inherited from interface ulu.view.UContained
PROP_PARENT
 
Fields inherited from interface ulu.view.Propertied
PROP_DISPLAY_LOD, PROP_NAME
 
Fields inherited from interface ulu.view.Typed
PROP_TYPE
 
Fields inherited from interface ulu.view.ContentSource
PROP_CONTENT_URL
 
Constructor Summary
ItemImpl()
          default no-argument constructor for subclasses to use
ItemImpl(java.lang.String name)
          by default, the Item has no methods, and only one property, its name.
 
Method Summary
 void addDefaultMethods()
          add default methods for opening and refreshing container.
static void addJAFMethods(JAFable jaf)
          Deprecated.  
 boolean addMethod(UMethod u)
          (attempt to) add a method
 boolean addProp(java.lang.String name, java.lang.Object obj)
          convenience method to quickly add fields
 boolean addProp(UField u)
          (attempt to) add a property
 void addPropertyChangeListener(java.beans.PropertyChangeListener l)
          add a property listener for bean support
 boolean clearMethods()
          clear all methods
 boolean clearProps()
          clear all properties
 java.net.URL getContent()
          by default, a null implementation, leave this alone unless the Item does have a content source to talk to
 UMethod getDefaultMethod()
          get the default method
 UMethod getMethod(java.lang.String name)
          get a method by name
 java.lang.String getName()
          convenience method to get the name
 UContainer getParent()
          generic UContained imlementation
 View getParentView()
          convenience method to get the parent View
 UField getProp(java.lang.String name)
          get a property by name
 java.lang.Object getReference()
          convenience getter for primary reference property (Not all items will have a reference, but many will - it's the thing behind the item, the file, the resultset, the object, etc.)
static View getScrapbook(java.lang.Object obj)
          get the scrapbook View
 java.lang.String getType()
          denote the type of this item, used in the UI to differentiate between different sorts (e.g.
protected  java.lang.String inferTypeByClass()
          Deprecated. with shaper-based architecture, items aren't differentiated by subclass
 java.lang.Object invoke(UMethod u)
          implementation of Handler - this is the callback point for an invoked method.
 UMethod[] methods()
          get names of this object's invokable methods
 UField[] properties()
          get this object's properties
 boolean removeMethod(UMethod u)
          (attempt to) remove a method
 boolean removeProp(UField u)
          (attempt to) remove a property
 void removePropertyChangeListener(java.beans.PropertyChangeListener l)
          remove a property listener (for bean support)
 void seal()
          prevent any further addition/removal of methods or properties
 void setDefaultMethod(UMethod u)
          set the default method (and add it to methods list if not already there)
 void setName(java.lang.String s)
          convenience method to set the name
 void setParent(UContainer u)
          convenience method to set the parent View
 void setParentView(View v)
          convenience method to set the parent View
 void setReference(java.lang.Object o)
          conenience setter for primary reference property (Not all items will have a reference, but many will - it's the thing behind the item, the file, the resultset, the object, etc.)
 boolean setRefImpl(java.lang.Object o)
          implementation of setReference for subclasses to override - return true if successful
protected  void setRefString(java.lang.String str)
          record the reference string used to initialise this reference object (e.g.
 void setType(java.lang.String str)
          convenience method to set the type of this item
 void update(java.util.Observable o, java.lang.Object arg)
          respond to change in a field value by getting parent container to fire an update event
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

changes

protected java.beans.PropertyChangeSupport changes
bean support helper class


useScrap

static boolean useScrap
whether to make use of the scrapbook feature - in some cases, its useful to have, in others, its an unnecessary distraction


types

static java.util.Properties types
mini-registry of valid Item types


reference

java.lang.Object reference
the reference object, as defined by Referer interface


PROP_REFSTRING

public static final java.lang.String PROP_REFSTRING
field name denoting the (hidden) reference string

See Also:
Constant Field Values

props

java.util.Hashtable props
collection of properties assigned to this item


methods

java.util.Hashtable methods
collection of methods assigned to this object


defmeth

protected UMethod defmeth
the default method fore this item


sealed

boolean sealed
denotes whether methods/properties can be added

Constructor Detail

ItemImpl

public ItemImpl()
default no-argument constructor for subclasses to use


ItemImpl

public ItemImpl(java.lang.String name)
by default, the Item has no methods, and only one property, its name. This is passed in at construct-time. Every item ought to have a name!

Method Detail

addPropertyChangeListener

public void addPropertyChangeListener(java.beans.PropertyChangeListener l)
add a property listener for bean support


removePropertyChangeListener

public void removePropertyChangeListener(java.beans.PropertyChangeListener l)
remove a property listener (for bean support)


addDefaultMethods

public void addDefaultMethods()
add default methods for opening and refreshing container. These will always be restored after a call to clearMethods(), so may be useful to override this method in some cases


invoke

public java.lang.Object invoke(UMethod u)
                        throws java.lang.Exception
implementation of Handler - this is the callback point for an invoked method. The default implementation here handles the ubiquitous open() and refresh() methods of the View, so subclasses adding their own handler code should call the super.invoke() at some point in order to preserve this important functionality

Specified by:
invoke in interface Handler

getScrapbook

public static View getScrapbook(java.lang.Object obj)
get the scrapbook View


getName

public java.lang.String getName()
convenience method to get the name

Specified by:
getName in interface Propertied

setName

public void setName(java.lang.String s)
convenience method to set the name

Specified by:
setName in interface Propertied

getParent

public UContainer getParent()
generic UContained imlementation

Specified by:
getParent in interface UContained

getParentView

public View getParentView()
convenience method to get the parent View

Specified by:
getParentView in interface Item

setParent

public void setParent(UContainer u)
convenience method to set the parent View

Specified by:
setParent in interface UContained

setParentView

public void setParentView(View v)
convenience method to set the parent View

Specified by:
setParentView in interface Item

getReference

public java.lang.Object getReference()
convenience getter for primary reference property (Not all items will have a reference, but many will - it's the thing behind the item, the file, the resultset, the object, etc.)

Specified by:
getReference in interface Referrer

setReference

public void setReference(java.lang.Object o)
conenience setter for primary reference property (Not all items will have a reference, but many will - it's the thing behind the item, the file, the resultset, the object, etc.)

Specified by:
setReference in interface Referrer

setRefImpl

public boolean setRefImpl(java.lang.Object o)
implementation of setReference for subclasses to override - return true if successful


setRefString

protected void setRefString(java.lang.String str)
record the reference string used to initialise this reference object (e.g. a directory spec, or a JDBC url)


getType

public java.lang.String getType()
denote the type of this item, used in the UI to differentiate between different sorts (e.g. by assigning icons, allowing grouping by type, etc.

Specified by:
getType in interface Typed

setType

public void setType(java.lang.String str)
convenience method to set the type of this item

Specified by:
setType in interface Typed

inferTypeByClass

protected java.lang.String inferTypeByClass()
Deprecated. with shaper-based architecture, items aren't differentiated by subclass

helper to infer type by class name


properties

public UField[] properties()
get this object's properties

Specified by:
properties in interface Propertied

getProp

public UField getProp(java.lang.String name)
get a property by name

Specified by:
getProp in interface Propertied

addProp

public boolean addProp(UField u)
(attempt to) add a property

Specified by:
addProp in interface Propertied

addProp

public boolean addProp(java.lang.String name,
                       java.lang.Object obj)
convenience method to quickly add fields


removeProp

public boolean removeProp(UField u)
(attempt to) remove a property

Specified by:
removeProp in interface Propertied

clearProps

public boolean clearProps()
clear all properties

Specified by:
clearProps in interface Propertied

update

public void update(java.util.Observable o,
                   java.lang.Object arg)
respond to change in a field value by getting parent container to fire an update event

Specified by:
update in interface java.util.Observer

methods

public UMethod[] methods()
get names of this object's invokable methods

Specified by:
methods in interface Invokable

getMethod

public UMethod getMethod(java.lang.String name)
get a method by name

Specified by:
getMethod in interface Invokable

getDefaultMethod

public UMethod getDefaultMethod()
get the default method

Specified by:
getDefaultMethod in interface Invokable

setDefaultMethod

public void setDefaultMethod(UMethod u)
set the default method (and add it to methods list if not already there)

Specified by:
setDefaultMethod in interface Invokable

addMethod

public boolean addMethod(UMethod u)
(attempt to) add a method

Specified by:
addMethod in interface Invokable

removeMethod

public boolean removeMethod(UMethod u)
(attempt to) remove a method

Specified by:
removeMethod in interface Invokable

clearMethods

public boolean clearMethods()
clear all methods

Specified by:
clearMethods in interface Invokable

seal

public void seal()
prevent any further addition/removal of methods or properties


addJAFMethods

public static void addJAFMethods(JAFable jaf)
Deprecated.  

add the JAF-based methods for a JAF-enabled Item


getContent

public java.net.URL getContent()
by default, a null implementation, leave this alone unless the Item does have a content source to talk to

Specified by:
getContent in interface ContentSource