Savarese.Org

org.savarese.unicorn.ui
Class JavaBeanPanelModel

java.lang.Object
  extended by org.savarese.unicorn.ui.AbstractObjectPanelModel<java.lang.Object>
      extended by org.savarese.unicorn.ui.JavaBeanPanelModel
All Implemented Interfaces:
ObjectPanelModel<java.lang.Object>

public class JavaBeanPanelModel
extends AbstractObjectPanelModel<java.lang.Object>

An ObjectPanelModel implementation for JavaBeans.


Field Summary
 
Fields inherited from class org.savarese.unicorn.ui.AbstractObjectPanelModel
_listeners_, _object_
 
Constructor Summary
JavaBeanPanelModel(java.lang.Object bean)
          Instantiates a JavaBeanPanelModel wrapping the provided bean.
 
Method Summary
 java.lang.Object getAttribute(java.lang.String attribute)
          Retrieves a named attribute from the adapted object.
 javax.management.MBeanInfo getObjectInfo()
          Returns a description of the object.
 java.lang.Object invoke(java.lang.String operation, java.lang.Object[] params, java.lang.Class[] types, java.lang.String[] signature)
          Invokes an operation of the adapted object and returns its result, if any.
 boolean isValid()
          Determines if the model is in a valid state.
 void setAttribute(java.lang.String attribute, java.lang.Object value)
          Sets the value of a named attribute of the adapted object.
 void setObject(java.lang.Object bean)
          Sets the object to be adapted to the interface.
 
Methods inherited from class org.savarese.unicorn.ui.AbstractObjectPanelModel
_notifyListeners_, addObjectPanelModelListener, getObject, getObjectName, removeObjectPanelModelListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JavaBeanPanelModel

public JavaBeanPanelModel(java.lang.Object bean)
Instantiates a JavaBeanPanelModel wrapping the provided bean.

Parameters:
bean - The JavaBean to wrap.
Method Detail

setAttribute

public void setAttribute(java.lang.String attribute,
                         java.lang.Object value)
                  throws java.lang.IllegalAccessException,
                         java.lang.reflect.InvocationTargetException
Description copied from interface: ObjectPanelModel
Sets the value of a named attribute of the adapted object.

Parameters:
attribute - The name of the attribute to set.
value - The new value of the attribute.
Throws:
java.lang.IllegalAccessException
java.lang.reflect.InvocationTargetException

getAttribute

public java.lang.Object getAttribute(java.lang.String attribute)
                              throws java.lang.IllegalAccessException,
                                     java.lang.reflect.InvocationTargetException
Description copied from interface: ObjectPanelModel
Retrieves a named attribute from the adapted object.

Parameters:
attribute - The name of the attribute to retrieve.
Returns:
The attribute corresponding to the provided name.
Throws:
java.lang.IllegalAccessException
java.lang.reflect.InvocationTargetException

setObject

public void setObject(java.lang.Object bean)
Description copied from interface: ObjectPanelModel
Sets the object to be adapted to the interface.

Specified by:
setObject in interface ObjectPanelModel<java.lang.Object>
Overrides:
setObject in class AbstractObjectPanelModel<java.lang.Object>
Parameters:
bean - The object to be adapted.

invoke

public java.lang.Object invoke(java.lang.String operation,
                               java.lang.Object[] params,
                               java.lang.Class[] types,
                               java.lang.String[] signature)
                        throws java.lang.NoSuchMethodException,
                               java.lang.reflect.InvocationTargetException,
                               java.lang.ClassNotFoundException,
                               java.lang.IllegalAccessException
Description copied from interface: ObjectPanelModel
Invokes an operation of the adapted object and returns its result, if any.

Parameters:
operation - The name of the operation to invoke.
params - An array of parameters for the operation.
types - An array containing the types of the operation parameters.
signature - A string representation of the types (i.e., the fully qualified class names) of the operation parameters.
Returns:
The result of the operation, if any.
Throws:
java.lang.NoSuchMethodException
java.lang.reflect.InvocationTargetException
java.lang.ClassNotFoundException
java.lang.IllegalAccessException

getObjectInfo

public javax.management.MBeanInfo getObjectInfo()
Description copied from interface: ObjectPanelModel
Returns a description of the object.

Returns:
The a description of the object.

isValid

public boolean isValid()
Description copied from interface: ObjectPanelModel
Determines if the model is in a valid state. A model may be rendered invalid if it has no object, if an exception is occurs during a remote invocation operation, or any number of reasons specific to the model implementation.

Specified by:
isValid in interface ObjectPanelModel<java.lang.Object>
Overrides:
isValid in class AbstractObjectPanelModel<java.lang.Object>
Returns:
True if the model is in a valid state, false if not.

Savarese.Org

Copyright © 2006 Daniel F. Savarese. All Rights Reserved.