org.progeeks.util
Class DefaultViewContext

java.lang.Object
  extended by org.progeeks.util.beans.BeanChangeSupport
      extended by org.progeeks.util.DefaultViewContext
All Implemented Interfaces:
java.io.Serializable, StandardBean, ViewContext
Direct Known Subclasses:
DefaultMultiFocusedContext, DefaultObjectViewContext, MetaPropertyContext

public class DefaultViewContext
extends BeanChangeSupport
implements ViewContext, java.io.Serializable

Default implementation of the ViewContext interface.

Version:
$Revision: 1.4 $
Author:
Paul Speed
See Also:
Serialized Form

Constructor Summary
DefaultViewContext()
          Creates a default view context with null as a parent.
DefaultViewContext(ViewContext parent)
          Creates a default view context with the specified parent.
 
Method Summary
static ViewContext findContext(ViewContext context, java.lang.Class type)
          Searches up the hierarchy and returns the first context of the specified class that is encountered.
protected  boolean getBooleanProperty(java.lang.String property, boolean defaultValue)
          Retrieves the boolean-typed property value for the specified property name.
protected  double getDoubleProperty(java.lang.String property, double defaultValue)
          Retrieves the double-typed property value for the specified property name.
protected  int getIntProperty(java.lang.String property, int defaultValue)
          Retrieves the int-typed property value for the specified property name.
protected  java.lang.Object getObjectProperty(java.lang.String property)
          Retrieves the object-typed property value for the specified property name.
protected  java.lang.Object getObjectProperty(java.lang.String property, java.lang.Object defaultValue)
          Retrieves the object-typed property value for the specified property name.
 ViewContext getParentContext()
          Returns the parent context upon which this context depends, or null if this is a root-level context.
static ViewContext getRootContext(ViewContext context)
          Searches up the hierarchy and returns the highest non-null parent of the specified context.
protected  java.lang.String getStringProperty(java.lang.String property, java.lang.String defaultValue)
          Retrieves the string-typed property value for the specified property name.
protected  boolean setBooleanProperty(java.lang.String property, boolean b)
          Sets the specified property to the specified value firing a change notification as appropriate.
protected  boolean setDoubleProperty(java.lang.String property, double d)
          Sets the specified property to the specified value firing a change notification as appropriate.
protected  boolean setIntProperty(java.lang.String property, int i)
          Sets the specified property to the specified value firing a change notification as appropriate.
protected  boolean setObjectProperty(java.lang.String property, java.lang.Object obj)
          Sets the specified property to the specified value firing a change notification as appropriate.
 void setParentContext(ViewContext parent)
          Sets the parent context of this context.
protected  boolean setStringProperty(java.lang.String property, java.lang.String value)
          Sets the specified property to the specified value firing a change notification as appropriate.
 
Methods inherited from class org.progeeks.util.beans.BeanChangeSupport
addPropertyChangeListener, addPropertyChangeListener, clearAllListeners, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, hasListeners, hasListeners, removePropertyChangeListener, removePropertyChangeListener, removePropertyChangeListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.progeeks.util.beans.StandardBean
addPropertyChangeListener, addPropertyChangeListener, hasListeners, hasListeners, removePropertyChangeListener, removePropertyChangeListener, removePropertyChangeListener
 

Constructor Detail

DefaultViewContext

public DefaultViewContext()
Creates a default view context with null as a parent.


DefaultViewContext

public DefaultViewContext(ViewContext parent)
Creates a default view context with the specified parent.

Method Detail

setParentContext

public void setParentContext(ViewContext parent)
Sets the parent context of this context.

Specified by:
setParentContext in interface ViewContext

getParentContext

public ViewContext getParentContext()
Returns the parent context upon which this context depends, or null if this is a root-level context.

Specified by:
getParentContext in interface ViewContext

getRootContext

public static ViewContext getRootContext(ViewContext context)
Searches up the hierarchy and returns the highest non-null parent of the specified context. May want to break these search methods out into their own utility class.


findContext

public static ViewContext findContext(ViewContext context,
                                      java.lang.Class type)
Searches up the hierarchy and returns the first context of the specified class that is encountered. May want to break these search methods out into their own utility class.


setObjectProperty

protected boolean setObjectProperty(java.lang.String property,
                                    java.lang.Object obj)
Sets the specified property to the specified value firing a change notification as appropriate.


getObjectProperty

protected java.lang.Object getObjectProperty(java.lang.String property)
Retrieves the object-typed property value for the specified property name.


getObjectProperty

protected java.lang.Object getObjectProperty(java.lang.String property,
                                             java.lang.Object defaultValue)
Retrieves the object-typed property value for the specified property name. The defaultValue is returned if the property value does not exist. Note: this is different than being null.


setStringProperty

protected boolean setStringProperty(java.lang.String property,
                                    java.lang.String value)
Sets the specified property to the specified value firing a change notification as appropriate. This is a convenience method and defers to the Object-based method.


getStringProperty

protected java.lang.String getStringProperty(java.lang.String property,
                                             java.lang.String defaultValue)
Retrieves the string-typed property value for the specified property name. The defaultValue is returned if the property value does not exist. This is a convenience method and defers to the Object-based method.


setIntProperty

protected boolean setIntProperty(java.lang.String property,
                                 int i)
Sets the specified property to the specified value firing a change notification as appropriate. This is a convenience method and defers to the Object-based method.


getIntProperty

protected int getIntProperty(java.lang.String property,
                             int defaultValue)
Retrieves the int-typed property value for the specified property name. The defaultValue is returned if the property value does not exist. This is a convenience method and defers to the Object-based method.


setDoubleProperty

protected boolean setDoubleProperty(java.lang.String property,
                                    double d)
Sets the specified property to the specified value firing a change notification as appropriate. This is a convenience method and defers to the Object-based method.


getDoubleProperty

protected double getDoubleProperty(java.lang.String property,
                                   double defaultValue)
Retrieves the double-typed property value for the specified property name. The defaultValue is returned if the property value does not exist. This is a convenience method and defers to the Object-based method.


setBooleanProperty

protected boolean setBooleanProperty(java.lang.String property,
                                     boolean b)
Sets the specified property to the specified value firing a change notification as appropriate. This is a convenience method and defers to the Object-based method.


getBooleanProperty

protected boolean getBooleanProperty(java.lang.String property,
                                     boolean defaultValue)
Retrieves the boolean-typed property value for the specified property name. The defaultValue is returned if the property value does not exist. This is a convenience method and defers to the Object-based method.



Copyright © 2002-2003 Paul Speed. All Rights Reserved.