public class DesignAttributeHandler extends Object implements Serializable
Constructor and Description |
---|
DesignAttributeHandler() |
Modifier and Type | Method and Description |
---|---|
static boolean |
assignValue(Object target,
String attribute,
String value)
Assigns the specified design attribute to the given component.
|
static void |
clearElement(org.jsoup.nodes.Element design)
Clears the children and attributes of the given element
|
static DesignFormatter |
getFormatter()
Returns the currently used formatter.
|
static Collection<String> |
getSupportedAttributes(Class<?> clazz)
Searches for supported setter and getter types from the specified class
and returns the list of corresponding design attributes
|
static Alignment |
readAlignment(org.jsoup.nodes.Attributes attr)
Read the alignment from the given child component attributes.
|
static <T> T |
readAttribute(String attribute,
org.jsoup.nodes.Attributes attributes,
Class<T> outputType)
Reads the given attribute from a set of attributes.
|
static <T> T |
readAttribute(String attribute,
org.jsoup.nodes.Attributes attributes,
T defaultValue,
Class<T> outputType)
Reads the given attribute from a set of attributes.
|
static void |
writeAlignment(org.jsoup.nodes.Element childElement,
Alignment alignment)
Writes the alignment to the given child element attributes.
|
static void |
writeAttribute(Object component,
String attribute,
org.jsoup.nodes.Attributes attr,
Object defaultInstance)
Writes the specified attribute to the design if it differs from the
default value got from the
defaultInstance |
static <T> void |
writeAttribute(String attribute,
org.jsoup.nodes.Attributes attributes,
T value,
T defaultValue,
Class<T> inputType)
Writes the given attribute value to a set of attributes if it differs
from the default attribute value.
|
public static DesignFormatter getFormatter()
public static void clearElement(org.jsoup.nodes.Element design)
design
- the element to be clearedpublic static boolean assignValue(Object target, String attribute, String value)
target
- the target to which the attribute should be setattribute
- the name of the attribute to be setvalue
- the string value of the attributepublic static Collection<String> getSupportedAttributes(Class<?> clazz)
clazz
- the class scanned for setterspublic static void writeAttribute(Object component, String attribute, org.jsoup.nodes.Attributes attr, Object defaultInstance)
defaultInstance
component
- the component used to get the attribute valueattribute
- the key for the attributeattr
- the attribute list where the attribute will be writtendefaultInstance
- the default instance for comparing default valuespublic static <T> void writeAttribute(String attribute, org.jsoup.nodes.Attributes attributes, T value, T defaultValue, Class<T> inputType)
attribute
- the attribute keyattributes
- the set of attributes where the new attribute is writtenvalue
- the attribute valuedefaultValue
- the default attribute valueinputType
- the type of the input valuepublic static <T> T readAttribute(String attribute, org.jsoup.nodes.Attributes attributes, T defaultValue, Class<T> outputType)
attribute
- the attribute keyattributes
- the set of attributes to read fromdefaultValue
- the default value to return if attribute does not existoutputType
- the output type for the attributepublic static <T> T readAttribute(String attribute, org.jsoup.nodes.Attributes attributes, Class<T> outputType)
attribute
- the attribute keyattributes
- the set of attributes to read fromoutputType
- the output type for the attributepublic static Alignment readAlignment(org.jsoup.nodes.Attributes attr)
attr
- the child component attributespublic static void writeAlignment(org.jsoup.nodes.Element childElement, Alignment alignment)
childElement
- the child elementalignment
- the component alignmentCopyright © 2016 Vaadin Ltd. All rights reserved.