org.openswing.swing.form.model.client
Class VOModel

java.lang.Object
  extended byorg.openswing.swing.form.model.client.VOModel

public class VOModel
extends java.lang.Object

Title: OpenSwing Framework

Description: Data model linked to a Form panel.

Copyright: Copyright (C) 2006 Mauro Carniel

This file is part of OpenSwing Framework. This library is free software; you can redistribute it and/or modify it under the terms of the (LGPL) Lesser General Public License as published by the Free Software Foundation; GNU LESSER GENERAL PUBLIC LICENSE Version 2.1, February 1999 This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. The author may be contacted at: maurocarniel@tin.it


Constructor Summary
VOModel(java.lang.Class valueObjectClass, boolean createInnerVO, Form form)
          Constructor.
 
Method Summary
 void addValueChangeListener(ValueChangeListener listener)
          Method used to add a value changed listener.
 java.lang.Class getAttributeType(java.lang.String attributeName)
           
 java.lang.Object getValue(java.lang.String attributeName)
           
 java.lang.Object getValue(java.lang.String attributeName, ValueObject valueobject)
           
 ValueChangeListener[] getValueChangeListeners()
           
 ValueObject getValueObject()
           
 java.lang.Class getValueObjectType()
           
 void removeValueChangeListener(ValueChangeListener listener)
          Method used to remove a value changed listener.
 void setCreateInnerVO(boolean createInnerVO)
          Define if an inner v.o. must be automatically instantiated when a setter method is invoked.
 void setValue(java.lang.String attributeName, java.lang.Object value)
          Set a value in the value object for an attribute name.
 void setValueObject(java.lang.Class valueObjectClass)
          Set the value object class that this model will use.
 void setValueObject(ValueObject valueObject)
          Set the value object that this model will use.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

VOModel

public VOModel(java.lang.Class valueObjectClass,
               boolean createInnerVO,
               Form form)
        throws java.lang.Exception
Constructor.

Parameters:
valueObjectClass - value object class associated to this data model
createInnerVO - flag used to define if an inner v.o. must be automatically instantiated when a setter method is invoked
Throws:
java.lang.Exception - if an error occours
Method Detail

setValueObject

public final void setValueObject(java.lang.Class valueObjectClass)
                          throws java.lang.Exception
Set the value object class that this model will use.

Parameters:
valueObjectClass - value object class
Throws:
java.lang.Exception - if an error occours

setCreateInnerVO

public final void setCreateInnerVO(boolean createInnerVO)
Define if an inner v.o. must be automatically instantiated when a setter method is invoked.

Parameters:
createInnerVO - define if an inner v.o. must be automatically instantiated when a setter method is invoked

getValueObjectType

public final java.lang.Class getValueObjectType()
Returns:
value object class associated to this data model

setValueObject

public final void setValueObject(ValueObject valueObject)
Set the value object that this model will use.

Parameters:
valueObject - value object to store

getValueObject

public final ValueObject getValueObject()
Returns:
value object stored inside the model

getAttributeType

public final java.lang.Class getAttributeType(java.lang.String attributeName)
Parameters:
attributeName - attribute name of the value object
Returns:
type of the value associated to the specified attribute name

getValue

public final java.lang.Object getValue(java.lang.String attributeName)
Parameters:
attributeName - attribute name of the value object
Returns:
value value associated to the specified attribute name

getValue

public final java.lang.Object getValue(java.lang.String attributeName,
                                       ValueObject valueobject)
Parameters:
attributeName - attribute name of the value object
valueobject - value object used to fetch the attribute value
Returns:
value value associated to the specified attribute name

setValue

public final void setValue(java.lang.String attributeName,
                           java.lang.Object value)
Set a value in the value object for an attribute name.

Parameters:
attributeName - attribute name of the value object
Returns:
value value to set for the specified attribute name

addValueChangeListener

public final void addValueChangeListener(ValueChangeListener listener)
Method used to add a value changed listener.

Parameters:
listener - value changed listener to add

removeValueChangeListener

public final void removeValueChangeListener(ValueChangeListener listener)
Method used to remove a value changed listener.

Parameters:
listener - value changed listener to remove

getValueChangeListeners

public final ValueChangeListener[] getValueChangeListeners()
Returns:
list of value changed listeners added to this model