Groovy Documentation

org.grails.plugin.vaadin.data
[Groovy] Class DomainItem

java.lang.Object
  com.vaadin.data.util.PropertysetItem
      org.grails.plugin.vaadin.data.DomainItem

class DomainItem
extends PropertysetItem

Similar to BeanItem but for GrailsDomainClass instances.

Main benefits over BeanItem is that this class supports embedded property types, and arbitrary nesting of properties.

Authors:
Francis McKenzie


Field Summary
protected Map changedProperties

All changed properties for the domain instance.

 
Property Summary
org.codehaus.groovy.grails.commons.GrailsDomainClass domainClass

The domain class of the domain instance

Object domainInstance

The domain instance of this item

 
Constructor Summary
DomainItem(org.codehaus.groovy.grails.commons.GrailsApplication grailsApplication, Object domainInstance)

Create a domain item for the specified domain instance.

DomainItem(org.codehaus.groovy.grails.commons.GrailsDomainClass domainClass, Object domainInstance)

Create a domain item for the specified domain instance with the specified domain class.

 
Method Summary
Property getItemProperty(Object id)

Gets the property with the specified name from the domainInstance stored in this item.

protected List getPropertyDescriptors(org.codehaus.groovy.grails.commons.GrailsDomainClass domainClass)

Get GrailsDomainClass properties as VaadinPropertyDescriptors

 
Methods inherited from class PropertysetItem
equals, toString, hashCode, clone, getListeners, addListener, removeListener, getItemProperty, getItemPropertyIds, removeItemProperty, addItemProperty, wait, wait, wait, getClass, notify, notifyAll
 
Methods inherited from class Object
wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll
 

Field Detail

changedProperties

protected Map changedProperties
All changed properties for the domain instance. Whenever a field value is changed, all the properties are re-applied to the domain instance using domainInstance.properties = changedProperties.

This ensures that errors are not lost for other fields, whenever we set a value on a particular field.


 
Property Detail

domainClass

final org.codehaus.groovy.grails.commons.GrailsDomainClass domainClass
The domain class of the domain instance


domainInstance

final Object domainInstance
The domain instance of this item


 
Constructor Detail

DomainItem

DomainItem(org.codehaus.groovy.grails.commons.GrailsApplication grailsApplication, Object domainInstance)
Create a domain item for the specified domain instance.
Parameters:
grailsApplication - Required to obtain the domain instance's domain class.
domainInstance - The domain instance for which the item will be created.


DomainItem

DomainItem(org.codehaus.groovy.grails.commons.GrailsDomainClass domainClass, Object domainInstance)
Create a domain item for the specified domain instance with the specified domain class.
Parameters:
domainClass - The domain class of the specified instance.
domainInstance - The domain instance for which the item will be created.


 
Method Detail

getItemProperty

Property getItemProperty(Object id)
Gets the property with the specified name from the domainInstance stored in this item.

Note that the property may be arbitrarily-nested, for example foo.bar.tick.tock

If the property is valid, and has not been accessed before, its name is added to the list of property id's for this item.

Parameters:
id - the identifier (name) of the Property to get.
Returns:
the Property with the given ID or null


getPropertyDescriptors

protected List getPropertyDescriptors(org.codehaus.groovy.grails.commons.GrailsDomainClass domainClass)
Get GrailsDomainClass properties as VaadinPropertyDescriptors
Parameters:
domainClass - The Grails domain class to get properties for.
Returns:
a list of property descriptors


 

Groovy Documentation