info.magnolia.ui.form.field.transformer.multi
Class MultiValueSubChildrenNodePropertiesTransformer

java.lang.Object
  extended by info.magnolia.ui.form.field.transformer.basic.BasicTransformer<com.vaadin.data.util.PropertysetItem>
      extended by info.magnolia.ui.form.field.transformer.multi.MultiValueChildrenNodeTransformer
          extended by info.magnolia.ui.form.field.transformer.multi.MultiValueSubChildrenNodePropertiesTransformer
All Implemented Interfaces:
info.magnolia.ui.api.i18n.I18NAwareHandler, Transformer<com.vaadin.data.util.PropertysetItem>

public class MultiValueSubChildrenNodePropertiesTransformer
extends MultiValueChildrenNodeTransformer

Sub Nodes implementation of Transformer storing and retrieving properties (as PropertysetItem) displayed in MultiField.
In opposition to MultiValueChildrenNodeTransformer this implementation handle multiple properties stored under a child node.
These multiple properties are put/retrieve into/from a PropertysetItem.
Storage strategy:
- root node (relatedFormItem)
-- main child node (nodeName = field name)
--- child node 1 (used to store the first values set of the MultiField as a property)
---- property 1 (store the first property of the first value of the MultiField)
---- property 2 (store the second property of the first value of the MultiField)
---- property 3 (store the third property of the first value of the MultiField)
---- ... --- child node 2 (used to store the second values of the MultiField as a property)
---- property 1 (store the first property of the second value of the MultiField)
---- property 2 (store the second property of the second value of the MultiField)
---- property 3 (store the third property of the second value of the MultiField)
...
This implementation store/retrieve the PropertysetItem properties under the child node.
Used in the case of a MultiField contains a CompositeField or a SwitchableField.
In this case, CompositeField or SwitchableField will have to declare a NoOpCompositeTransformer.


Field Summary
 
Fields inherited from class info.magnolia.ui.form.field.transformer.multi.MultiValueChildrenNodeTransformer
childNodeType
 
Fields inherited from class info.magnolia.ui.form.field.transformer.basic.BasicTransformer
basePropertyName, definition, i18NPropertyName, relatedFormItem, type
 
Constructor Summary
MultiValueSubChildrenNodePropertiesTransformer(com.vaadin.data.Item relatedFormItem, ConfiguredFieldDefinition definition, Class<com.vaadin.data.util.PropertysetItem> type)
           
 
Method Summary
protected  info.magnolia.ui.vaadin.integration.jcr.JcrNodeAdapter getRootItem()
          Define the root Item used in order to set the SubNodes list.
protected  com.vaadin.data.util.PropertysetItem getValueFromChildNode(javax.jcr.Node child)
          Return a specific value from the child node.
protected  void handleRootitemAndParent(info.magnolia.ui.vaadin.integration.jcr.JcrNodeAdapter rootItem)
          Handle the relation between parent and rootItem.
protected  void setChildItemValue(info.magnolia.ui.vaadin.integration.jcr.JcrNodeAdapter childItem, Object newValues)
          Set the value as property to the childItem.
 
Methods inherited from class info.magnolia.ui.form.field.transformer.multi.MultiValueChildrenNodeTransformer
createChildItemName, createPredicateToEvaluateChildNode, getOrCreateChildNode, getStoredChildNodes, hasI18NSupport, initializeChildItem, readFromItem, setChildValuePropertyName, setNewChildItem, writeToItem
 
Methods inherited from class info.magnolia.ui.form.field.transformer.basic.BasicTransformer
definePropertyName, getBasePropertyName, getLocale, getOrCreateProperty, getOrCreateProperty, getType, setI18NPropertyName, setLocale, setType
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MultiValueSubChildrenNodePropertiesTransformer

public MultiValueSubChildrenNodePropertiesTransformer(com.vaadin.data.Item relatedFormItem,
                                                      ConfiguredFieldDefinition definition,
                                                      Class<com.vaadin.data.util.PropertysetItem> type)
Method Detail

getRootItem

protected info.magnolia.ui.vaadin.integration.jcr.JcrNodeAdapter getRootItem()
Description copied from class: MultiValueChildrenNodeTransformer
Define the root Item used in order to set the SubNodes list.

Overrides:
getRootItem in class MultiValueChildrenNodeTransformer

handleRootitemAndParent

protected void handleRootitemAndParent(info.magnolia.ui.vaadin.integration.jcr.JcrNodeAdapter rootItem)
Description copied from class: MultiValueChildrenNodeTransformer
Handle the relation between parent and rootItem.
Typically, if rootItem would be a child of parentItem:

if (childItem.getChildren() != null && !childItem.getChildren().isEmpty()) { ((JcrNodeAdapter) parent).addChild(childItem); } else { ((JcrNodeAdapter) parent).removeChild(childItem); }

Overrides:
handleRootitemAndParent in class MultiValueChildrenNodeTransformer

getValueFromChildNode

protected com.vaadin.data.util.PropertysetItem getValueFromChildNode(javax.jcr.Node child)
Description copied from class: MultiValueChildrenNodeTransformer
Return a specific value from the child node.

Overrides:
getValueFromChildNode in class MultiValueChildrenNodeTransformer

setChildItemValue

protected void setChildItemValue(info.magnolia.ui.vaadin.integration.jcr.JcrNodeAdapter childItem,
                                 Object newValues)
Description copied from class: MultiValueChildrenNodeTransformer
Set the value as property to the childItem.

Overrides:
setChildItemValue in class MultiValueChildrenNodeTransformer


Copyright © 2013 Magnolia International Ltd.. All Rights Reserved.