edu.umd.cfar.lamp.apploader.propertysheets
Class ExplicitPropertyDescriptor

java.lang.Object
  extended byedu.umd.cfar.lamp.apploader.propertysheets.ExplicitPropertyDescriptor
All Implemented Interfaces:
InstancePropertyDescriptor
Direct Known Subclasses:
ForClassPropertyDescriptor

public class ExplicitPropertyDescriptor
extends java.lang.Object
implements InstancePropertyDescriptor

An object for manipulating a field on a property sheet. It includes methods for setting and getting the values of the field, as well as displaying it and editing it. It uses the AppLoader preferences model to get information about how to edit the property.

For example, given the RDF description of a property below:

	[	lal:propertyName "AttrName" ;
		props:interfacer :setAttrName ;
		props:renderer :attrConfigNameEditor ;
		props:editor :attrConfigNameEditor ;
		rdfs:label "Name"@en , "Nom"@fr ]
 

Then there must exist a bean with a property given the text description "Name" (in english) that has the java name "AttrName". The preferences must also define an interfacer, as a java bean (see the apploader information) with the uri :setAttrName and the same bean for the renderer and editor with the uri :setConfigNameEditor. These are described below:

 :setAttrName
 		a lal:Bean ;
		rdfs:label "Function Object to Set an Attribute Name"@en ;
		lal:className "edu.umd.cfar.lamp.viper.gui.config.SetAttrName" .
 :attrConfigNameEditor
		a props:Editor ;
		lal:className "edu.umd.cfar.lamp.viper.gui.config.AttrNameEditor" ;
		lal:setProperty [ 
			lal:propertyName "Text" ] .
 
The setAttrName is a PropertyInterfacer, impelemnted by the class specified by lal:className. The label isn't used currently.


Constructor Summary
ExplicitPropertyDescriptor(PrefsManager prefs, com.hp.hpl.jena.rdf.model.Resource prop, java.lang.Object bean)
          Creates a new descriptor for the property of the given instance as described in the preferences by the resource prop
 
Method Summary
 java.lang.Object applyGetter(java.lang.Object bean)
          Get the value from the bean instance.
 void applySetter(java.lang.Object bean, java.lang.Object toValue)
          Set the value of this property on the given bean
 boolean equals(java.lang.Object o)
          Tests to see that this and the other object are both explicit property descriptors with the same proxy.
 java.lang.Class getBeanType()
          Gets the class of the bean.
 javax.swing.JComponent getEditor(java.lang.Object bean, AppLoader core)
          Gets the associated cell editor for the property
 PropertyInterfacer getInterfacer()
          Gets the property functor.
 java.lang.String getName()
          Gets the display name of the property.
 javax.swing.JComponent getRenderer(java.lang.Object bean, AppLoader core)
          Gets the associated cell renderer for the property.
 int hashCode()
          Computes the hash code on the proxy object.
 boolean isSettable(java.lang.Object bean)
          Checks to see if the property is currently settable on the given instance bean.
 void setInterfacer(PropertyInterfacer functor)
          Sets the property functor.
protected  void setProxy(PropertyInterfacer proxy)
          Set the interfacer proxy.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ExplicitPropertyDescriptor

public ExplicitPropertyDescriptor(PrefsManager prefs,
                                  com.hp.hpl.jena.rdf.model.Resource prop,
                                  java.lang.Object bean)
                           throws PreferenceException
Creates a new descriptor for the property of the given instance as described in the preferences by the resource prop

Parameters:
prefs - The apploader prefs that describe this resource.
prop - The RDF node that represents this kind of bean property
bean - The instance to describe
Throws:
PreferenceException
Method Detail

equals

public boolean equals(java.lang.Object o)
Tests to see that this and the other object are both explicit property descriptors with the same proxy.

Parameters:
o - the object to compare to
Returns:
true when this and o refer to equal proxies

hashCode

public int hashCode()
Computes the hash code on the proxy object.

Returns:
a hash code

setProxy

protected void setProxy(PropertyInterfacer proxy)
Set the interfacer proxy.

Parameters:
proxy -

applyGetter

public java.lang.Object applyGetter(java.lang.Object bean)
Get the value from the bean instance.

Specified by:
applyGetter in interface InstancePropertyDescriptor
Parameters:
bean - The instance to get this property from
Returns:
The value of the bean
Throws:
PropertyException - When the value can't be extracted.

applySetter

public void applySetter(java.lang.Object bean,
                        java.lang.Object toValue)
Set the value of this property on the given bean

Specified by:
applySetter in interface InstancePropertyDescriptor
Parameters:
bean - The instance to set this property of
toValue - The new value for the property
Throws:
PropertyException - When the value can't be set.

isSettable

public boolean isSettable(java.lang.Object bean)
Checks to see if the property is currently settable on the given instance bean.

Specified by:
isSettable in interface InstancePropertyDescriptor
Parameters:
bean - the instance to check
Returns:
false if the bean may not be set

getEditor

public javax.swing.JComponent getEditor(java.lang.Object bean,
                                        AppLoader core)
                                 throws PreferenceException
Description copied from interface: InstancePropertyDescriptor
Gets the associated cell editor for the property

Specified by:
getEditor in interface InstancePropertyDescriptor
Parameters:
bean -
core -
Returns:
Throws:
PreferenceException
See Also:
InstancePropertyDescriptor.getEditor(java.lang.Object, edu.umd.cfar.lamp.apploader.AppLoader)

getRenderer

public javax.swing.JComponent getRenderer(java.lang.Object bean,
                                          AppLoader core)
                                   throws PreferenceException
Description copied from interface: InstancePropertyDescriptor
Gets the associated cell renderer for the property.

Specified by:
getRenderer in interface InstancePropertyDescriptor
Parameters:
bean -
core -
Returns:
Throws:
PreferenceException
See Also:
InstancePropertyDescriptor.getRenderer(java.lang.Object, edu.umd.cfar.lamp.apploader.AppLoader)

getInterfacer

public PropertyInterfacer getInterfacer()
Gets the property functor.

Specified by:
getInterfacer in interface InstancePropertyDescriptor
Returns:
functor the property interfacer for the current property on the current instance object, as set by setInterfacer(PropertyInterfacer).

setInterfacer

public void setInterfacer(PropertyInterfacer functor)
Sets the property functor.

Specified by:
setInterfacer in interface InstancePropertyDescriptor
Parameters:
functor - the property interfacer for the current property on the current instance object

getBeanType

public java.lang.Class getBeanType()
Gets the class of the bean.

Specified by:
getBeanType in interface InstancePropertyDescriptor
Returns:
The java class that the associated bean is an instnce of

getName

public java.lang.String getName()
Gets the display name of the property.

Specified by:
getName in interface InstancePropertyDescriptor
Returns:
The (possibly localized) display name