public class MultiValueChildrenNodeTransformer extends BasicTransformer<com.vaadin.data.util.PropertysetItem>
Transformer
storing and retrieving properties (as PropertysetItem
) displayed in MultiField.createChildItemName(Set, Object, JcrNodeAdapter)
to define the child node name.setChildValuePropertyName(String)
to change the property name used to store the MultiField value element.Modifier and Type | Field and Description |
---|---|
protected String |
childNodeType |
basePropertyName, definition, i18NPropertyName, relatedFormItem, type
Constructor and Description |
---|
MultiValueChildrenNodeTransformer(com.vaadin.data.Item relatedFormItem,
ConfiguredFieldDefinition definition,
Class<com.vaadin.data.util.PropertysetItem> type)
Deprecated.
since 5.4.2 - use
MultiValueChildrenNodeTransformer(Item, ConfiguredFieldDefinition, Class, I18NAuthoringSupport) instead. |
MultiValueChildrenNodeTransformer(com.vaadin.data.Item relatedFormItem,
ConfiguredFieldDefinition definition,
Class<com.vaadin.data.util.PropertysetItem> type,
I18NAuthoringSupport i18NAuthoringSupport) |
Modifier and Type | Method and Description |
---|---|
protected String |
createChildItemName(Set<String> childNames,
Object value,
JcrNodeAdapter rootItem)
Basic Implementation that create child Nodes with increasing number as Name.
|
protected org.apache.jackrabbit.commons.predicate.Predicate |
createPredicateToEvaluateChildNode()
Create a
Predicate used to evaluate the child node of the root to handle.Only return child node that have a number name's. |
protected JcrNodeAdapter |
getOrCreateChildNode(String childNodeName,
String childNodeType)
Retrieve or create a child node as
JcrNodeAdapter . |
protected JcrNodeAdapter |
getRootItem()
Define the root Item used in order to set the SubNodes list.
|
protected List<javax.jcr.Node> |
getStoredChildNodes(JcrNodeAdapter parent)
Get all childNodes of parent passing the
Predicate created by createPredicateToEvaluateChildNode() or with type NodeTypes.ContentNode.NAME if the Predicate is null. |
protected Object |
getValueFromChildNode(javax.jcr.Node child)
Return a specific value from the child node.
|
protected void |
handleRootitemAndParent(JcrNodeAdapter rootItem)
Handle the relation between parent and rootItem.
Typically, if rootItem would be a child of parentItem: |
boolean |
hasI18NSupport()
No I18N Support implemented for subNode.
|
protected JcrNodeAdapter |
initializeChildItem(JcrNodeAdapter rootItem,
javax.jcr.Node rootNode,
String childName)
Create a Child Item.
- if the related node already has a Child Node called 'childName', initialize the ChildItem based on this child Node. - else create a new JcrNodeAdapter. |
com.vaadin.data.util.PropertysetItem |
readFromItem()
Retrieve a list of values based on the sub nodes.
- get a list of childNodes to handle - for each childNode retrieve the value to set to the PropertysetItem If no childNodes are present, return an empty PropertysetItem . |
protected void |
setChildItemValue(JcrNodeAdapter childItem,
Object value)
Set the value as property to the childItem.
|
void |
setChildValuePropertyName(String newName) |
protected void |
setNewChildItem(JcrNodeAdapter rootItem,
com.vaadin.data.util.PropertysetItem newValue) |
void |
writeToItem(com.vaadin.data.util.PropertysetItem newValue)
Create new Child Items based on the newValues.
|
definePropertyName, deriveLocaleAwareName, getBasePropertyName, getI18NAuthoringSupport, getLocale, getOrCreateProperty, getOrCreateProperty, getRelatedFormItem, getType, isReadOnly, setI18NPropertyName, setLocale, setReadOnly, setType
protected String childNodeType
@Inject public MultiValueChildrenNodeTransformer(com.vaadin.data.Item relatedFormItem, ConfiguredFieldDefinition definition, Class<com.vaadin.data.util.PropertysetItem> type, I18NAuthoringSupport i18NAuthoringSupport)
@Deprecated public MultiValueChildrenNodeTransformer(com.vaadin.data.Item relatedFormItem, ConfiguredFieldDefinition definition, Class<com.vaadin.data.util.PropertysetItem> type)
MultiValueChildrenNodeTransformer(Item, ConfiguredFieldDefinition, Class, I18NAuthoringSupport)
instead.public boolean hasI18NSupport()
hasI18NSupport
in interface Transformer<com.vaadin.data.util.PropertysetItem>
hasI18NSupport
in class BasicTransformer<com.vaadin.data.util.PropertysetItem>
public com.vaadin.data.util.PropertysetItem readFromItem()
PropertysetItem
PropertysetItem
.readFromItem
in interface Transformer<com.vaadin.data.util.PropertysetItem>
readFromItem
in class BasicTransformer<com.vaadin.data.util.PropertysetItem>
public void writeToItem(com.vaadin.data.util.PropertysetItem newValue)
writeToItem
in interface Transformer<com.vaadin.data.util.PropertysetItem>
writeToItem
in class BasicTransformer<com.vaadin.data.util.PropertysetItem>
protected JcrNodeAdapter getRootItem()
protected List<javax.jcr.Node> getStoredChildNodes(JcrNodeAdapter parent)
Predicate
created by createPredicateToEvaluateChildNode()
or NodeTypes.ContentNode.NAME
if the Predicate
is null.protected org.apache.jackrabbit.commons.predicate.Predicate createPredicateToEvaluateChildNode()
Predicate
used to evaluate the child node of the root to handle.protected Object getValueFromChildNode(javax.jcr.Node child)
protected void setNewChildItem(JcrNodeAdapter rootItem, com.vaadin.data.util.PropertysetItem newValue)
protected void setChildItemValue(JcrNodeAdapter childItem, Object value)
protected JcrNodeAdapter initializeChildItem(JcrNodeAdapter rootItem, javax.jcr.Node rootNode, String childName) throws javax.jcr.PathNotFoundException, javax.jcr.RepositoryException
javax.jcr.PathNotFoundException
javax.jcr.RepositoryException
protected void handleRootitemAndParent(JcrNodeAdapter rootItem)
if (childItem.getChildren() != null && !childItem.getChildren().isEmpty()) { ((JcrNodeAdapter) parent).addChild(childItem); } else { ((JcrNodeAdapter) parent).removeChild(childItem); }
protected String createChildItemName(Set<String> childNames, Object value, JcrNodeAdapter rootItem)
public void setChildValuePropertyName(String newName)
protected JcrNodeAdapter getOrCreateChildNode(String childNodeName, String childNodeType) throws javax.jcr.RepositoryException
JcrNodeAdapter
. Method will return null for any none JcrNodeAdapter releated form items.javax.jcr.RepositoryException
Copyright © 2015 Magnolia International Ltd.. All rights reserved.