net.javaprog.ui.wizard
Class DefaultDataLookup

java.lang.Object
  extended by net.javaprog.ui.wizard.DefaultDataLookup
All Implemented Interfaces:
DataLookup

public class DefaultDataLookup
extends Object
implements DataLookup

Default implementation for DataLookup using reflection. This is how you would register a text field with a data model using this default implementation:

 DataModel dataModel;
 JTextField textField;
 ...
 Method method = null;
 try {
     method = textField.getClass().getMethod("getText", null);
 } catch (NoSuchMethodException nsme) {}
 DataLookup dataLookup = new DefaultDataLookup(textField, method, null);
 dataModel.registerDataLookup("MyTextField", dataLookup);
 

Author:
Michael Rudolf
See Also:
DataModel

Field Summary
protected  Method lookupMethod
           
protected  Object object
           
protected  Object[] parameterList
           
 
Constructor Summary
DefaultDataLookup(Object object, Method lookupMethod, Object[] arguments)
          Creates a new data lookup mechanism using the given method on the specified object passing the given parameters.
DefaultDataLookup(Object object, PropertyDescriptor property)
          Creates a new data lookup mechanism using the given property on the specified object.
DefaultDataLookup(Object object, String property)
          Creates a new data lookup mechanism using the given property on the specified object.
 
Method Summary
 Object lookupData()
          Returns the value of the data source this object is registered with.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

lookupMethod

protected Method lookupMethod

parameterList

protected Object[] parameterList

object

protected Object object
Constructor Detail

DefaultDataLookup

public DefaultDataLookup(Object object,
                         Method lookupMethod,
                         Object[] arguments)
Creates a new data lookup mechanism using the given method on the specified object passing the given parameters.

Parameters:
object - the object on which the given method will be invoked
lookupMethod - the method that should be invoked on the given object
arguments - the arguments that should be passed when invoking the given method on the given object

DefaultDataLookup

public DefaultDataLookup(Object object,
                         PropertyDescriptor property)
Creates a new data lookup mechanism using the given property on the specified object.

Parameters:
object - the object of which the given property will be queried
property - the property that will be queried of the given object
Since:
0.1.4

DefaultDataLookup

public DefaultDataLookup(Object object,
                         String property)
                  throws IntrospectionException
Creates a new data lookup mechanism using the given property on the specified object.

Parameters:
object - the object of which the given property will be queried
property - the property that will be queried of the given object
Throws:
IntrospectionException
Since:
0.1.4
Method Detail

lookupData

public Object lookupData()
Description copied from interface: DataLookup
Returns the value of the data source this object is registered with.

Specified by:
lookupData in interface DataLookup