T
- property type used by the related field.public class FileTransformer<T extends UploadReceiver> extends Object implements Transformer<T>
Transformer
that handle a Binary Item instead of a simple property.Modifier and Type | Field and Description |
---|---|
protected String |
basePropertyName |
protected BasicUploadFieldDefinition |
definition |
protected String |
i18NPropertyName |
protected com.vaadin.data.Item |
relatedFormItem |
protected Class<T> |
type |
Constructor and Description |
---|
FileTransformer(com.vaadin.data.Item relatedFormItem,
BasicUploadFieldDefinition definition,
Class<T> type) |
Modifier and Type | Method and Description |
---|---|
T |
createPropertyFromItem(com.vaadin.data.Item item) |
String |
getBasePropertyName()
Returns the property base name that the
I18NAuthoringSupport should use. |
protected String |
getItemName()
Based on the i18n information, define the item name to use.
|
Locale |
getLocale() |
protected com.vaadin.data.Item |
getOrCreateFileItem() |
protected com.vaadin.data.Property |
getOrCreateProperty(com.vaadin.data.Item item,
String propertyName,
Class<?> type)
Get the required property from the Item, or create it if it does not exist.
|
protected JcrNodeAdapter |
getRootItem()
Defines the root item used to retrieve and create child items.
|
protected List<javax.jcr.Node> |
getStoredChildNodes(JcrNodeAdapter parent)
Fetches child nodes of the given parent from JCR, filtered using the
NodeUtil.MAGNOLIA_FILTER predicate. |
Class<T> |
getType() |
protected void |
handleInvalid(T newValue,
com.vaadin.data.Item item)
Handle the related Item in case
FileTransformer#isValid(Object, Item) return false. |
boolean |
hasI18NSupport()
Return true if this Property has to support i18n.
|
protected T |
initializeUploadReceiver() |
boolean |
isReadOnly() |
protected boolean |
isValid(T newValue,
com.vaadin.data.Item item) |
com.vaadin.data.Item |
populateItem(T newValue,
com.vaadin.data.Item item)
Populate the related Item with the values of 'newItem' in case
FileTransformer#isValid(Object, Item) return true. |
protected void |
populateStoredChildItems(JcrNodeAdapter rootItem)
Populates the given root item with its child items.
|
T |
readFromItem()
Get the stored Item, and based of this Item, return
createPropertyFromItem(Item) . |
void |
setI18NPropertyName(String i18nPropertyName) |
void |
setLocale(Locale locale) |
void |
setReadOnly(boolean isReadOnly) |
void |
writeToItem(T newValue)
Base on the validity of the received property, populate or not the property to the related Item.
Call FileTransformer#populateItem(Object, Item) in case FileTransformer#isValid(Object, Item) return true. |
protected com.vaadin.data.Item relatedFormItem
protected final BasicUploadFieldDefinition definition
protected final Class<T extends UploadReceiver> type
protected String basePropertyName
protected String i18NPropertyName
@Inject public FileTransformer(com.vaadin.data.Item relatedFormItem, BasicUploadFieldDefinition definition, Class<T> type)
public void writeToItem(T newValue)
FileTransformer#populateItem(Object, Item)
in case FileTransformer#isValid(Object, Item)
return true. FileTransformer#handleInvalid(Object, Item)
.writeToItem
in interface Transformer<T extends UploadReceiver>
public T readFromItem()
createPropertyFromItem(Item)
.readFromItem
in interface Transformer<T extends UploadReceiver>
protected com.vaadin.data.Item getOrCreateFileItem()
protected String getItemName()
public T createPropertyFromItem(com.vaadin.data.Item item)
protected T initializeUploadReceiver()
protected boolean isValid(T newValue, com.vaadin.data.Item item)
FileTransformer#populateItem(Object, Item)
.public com.vaadin.data.Item populateItem(T newValue, com.vaadin.data.Item item)
FileTransformer#isValid(Object, Item)
return true.FileTransformer#writeToItem(Object)}.
protected void handleInvalid(T newValue, com.vaadin.data.Item item)
FileTransformer#isValid(Object, Item)
return false.FileTransformer#writeToItem(Object)}.
protected com.vaadin.data.Property getOrCreateProperty(com.vaadin.data.Item item, String propertyName, Class<?> type)
protected JcrNodeAdapter getRootItem()
protected void populateStoredChildItems(JcrNodeAdapter rootItem)
protected List<javax.jcr.Node> getStoredChildNodes(JcrNodeAdapter parent)
NodeUtil.MAGNOLIA_FILTER
predicate.public String getBasePropertyName()
I18NAwareHandler
I18NAuthoringSupport
should use.getBasePropertyName
in interface I18NAwareHandler
public Class<T> getType()
getType
in interface Transformer<T extends UploadReceiver>
value
must be assignable
to this type.public boolean isReadOnly()
isReadOnly
in interface Transformer<T extends UploadReceiver>
public void setReadOnly(boolean isReadOnly)
setReadOnly
in interface Transformer<T extends UploadReceiver>
public boolean hasI18NSupport()
Transformer
hasI18NSupport
in interface Transformer<T extends UploadReceiver>
public void setLocale(Locale locale)
setLocale
in interface I18NAwareHandler
public void setI18NPropertyName(String i18nPropertyName)
setI18NPropertyName
in interface I18NAwareHandler
public Locale getLocale()
getLocale
in interface I18NAwareHandler
Copyright © 2015 Magnolia International Ltd.. All rights reserved.