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

Quick Search    Search Deep

org.modama.tools.beans
Class BeanUtil  view BeanUtil download BeanUtil.java

java.lang.Object
  extended byorg.modama.tools.beans.BeanUtil

public class BeanUtil
extends java.lang.Object

a util class for creating gui elements for a bean


Field Summary
private  java.lang.Object bean
          the bean
private  java.beans.BeanDescriptor beanDescriptor
          the bean descriptor class
private  java.beans.BeanInfo info
          the beaninfo object
private static java.util.HashMap propEditors
          Cached property editors
private  java.util.HashMap props
          the properties of the bean, the key for a prop is the name
 
Constructor Summary
BeanUtil()
           
 
Method Summary
 java.lang.Object getBean()
           
 java.awt.Component getEditor(java.lang.String name)
           
 java.awt.Component getEditor(java.lang.String name, java.util.List controllers)
          returns a component that shows an editor for the property, listens for changes of this prop and updates it
 javax.swing.JPanel getParameterLayoutPanel(java.lang.String[] props)
           
 javax.swing.JPanel getParameterLayoutPanel(java.lang.String[] props, java.util.List controllers)
          returns a JPanel with editors for the props given in the inputarray
 java.beans.PropertyEditor getPropertyEditor(java.lang.String name)
          Returns a new instance of the property editor for a given class.
 java.beans.PropertyDescriptor getPropertyForName(java.lang.String name)
          get a propertydescriptor for the name of the property
 java.lang.String[] getPropertyNames()
          get an array with the names of the propertys
 java.lang.Object getValue(java.lang.String name)
          get value of a property
private static void registerPropertyEditors()
          Method which registers property editors for types.
 void setBean(java.lang.Object bean)
          set the bean, do introspection and build the hashmap with the props, the introspection is only done for the beanclass, not for superclasses
 void setBean(java.lang.Object bean, java.lang.Class stopClass)
          set the bean, do introspection and build the hashmap with the props
 void setValue(java.lang.String name, java.lang.Object value)
          Set the value of property
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

bean

private java.lang.Object bean
the bean


info

private java.beans.BeanInfo info
the beaninfo object


beanDescriptor

private java.beans.BeanDescriptor beanDescriptor
the bean descriptor class


props

private java.util.HashMap props
the properties of the bean, the key for a prop is the name


propEditors

private static java.util.HashMap propEditors
Cached property editors

Constructor Detail

BeanUtil

public BeanUtil()
Method Detail

getEditor

public java.awt.Component getEditor(java.lang.String name)

getEditor

public java.awt.Component getEditor(java.lang.String name,
                                    java.util.List controllers)
returns a component that shows an editor for the property, listens for changes of this prop and updates it


getParameterLayoutPanel

public javax.swing.JPanel getParameterLayoutPanel(java.lang.String[] props)

getParameterLayoutPanel

public javax.swing.JPanel getParameterLayoutPanel(java.lang.String[] props,
                                                  java.util.List controllers)
returns a JPanel with editors for the props given in the inputarray


getPropertyEditor

public java.beans.PropertyEditor getPropertyEditor(java.lang.String name)
Returns a new instance of the property editor for a given class. If an editor is not specified in the property descriptor then it is looked up in the PropertyEditorManager.


getPropertyForName

public java.beans.PropertyDescriptor getPropertyForName(java.lang.String name)
get a propertydescriptor for the name of the property


getPropertyNames

public java.lang.String[] getPropertyNames()
get an array with the names of the propertys


getBean

public java.lang.Object getBean()

setBean

public void setBean(java.lang.Object bean)
set the bean, do introspection and build the hashmap with the props, the introspection is only done for the beanclass, not for superclasses


setBean

public void setBean(java.lang.Object bean,
                    java.lang.Class stopClass)
set the bean, do introspection and build the hashmap with the props


getValue

public java.lang.Object getValue(java.lang.String name)
get value of a property


setValue

public void setValue(java.lang.String name,
                     java.lang.Object value)
Set the value of property


registerPropertyEditors

private static void registerPropertyEditors()
Method which registers property editors for types.