aboutsummaryrefslogtreecommitdiffstats
path: root/server/src/main/java/com/vaadin/ui/declarative/DesignAttributeHandler.java
diff options
context:
space:
mode:
authorArtur Signell <artur@vaadin.com>2016-08-18 09:27:03 +0300
committerArtur Signell <artur@vaadin.com>2016-08-18 09:27:03 +0300
commit6d54d78944f6c3278eed3bb5e7ee19687ee5714e (patch)
tree8142f622e644e98bb3f8d19a7021fd125f9fed40 /server/src/main/java/com/vaadin/ui/declarative/DesignAttributeHandler.java
parent7b899665d07be33f86015f71695868c70bc5a589 (diff)
downloadvaadin-framework-6d54d78944f6c3278eed3bb5e7ee19687ee5714e.tar.gz
vaadin-framework-6d54d78944f6c3278eed3bb5e7ee19687ee5714e.zip
Format using Eclipse Neon
Change-Id: I33f1cc33969ff74a95b1b8cc0f2add589be5aae0
Diffstat (limited to 'server/src/main/java/com/vaadin/ui/declarative/DesignAttributeHandler.java')
-rw-r--r--server/src/main/java/com/vaadin/ui/declarative/DesignAttributeHandler.java64
1 files changed, 32 insertions, 32 deletions
diff --git a/server/src/main/java/com/vaadin/ui/declarative/DesignAttributeHandler.java b/server/src/main/java/com/vaadin/ui/declarative/DesignAttributeHandler.java
index 35cbf755d4..34ed98f113 100644
--- a/server/src/main/java/com/vaadin/ui/declarative/DesignAttributeHandler.java
+++ b/server/src/main/java/com/vaadin/ui/declarative/DesignAttributeHandler.java
@@ -107,7 +107,8 @@ public class DesignAttributeHandler implements Serializable {
}
boolean success = false;
try {
- Method setter = findSetterForAttribute(target.getClass(), attribute);
+ Method setter = findSetterForAttribute(target.getClass(),
+ attribute);
if (setter == null) {
// if we don't have the setter, there is no point in continuing
success = false;
@@ -119,15 +120,12 @@ public class DesignAttributeHandler implements Serializable {
success = true;
}
} catch (Exception e) {
- getLogger().log(
- Level.WARNING,
- "Failed to set value \"" + value + "\" to attribute "
- + attribute, e);
+ getLogger().log(Level.WARNING, "Failed to set value \"" + value
+ + "\" to attribute " + attribute, e);
}
if (!success) {
- getLogger().info(
- "property " + attribute
- + " ignored by default attribute handler");
+ getLogger().info("property " + attribute
+ + " ignored by default attribute handler");
}
return success;
}
@@ -170,11 +168,12 @@ public class DesignAttributeHandler implements Serializable {
+ clazz.getName());
}
AttributeCacheEntry entry = new AttributeCacheEntry();
- for (PropertyDescriptor descriptor : beanInfo.getPropertyDescriptors()) {
+ for (PropertyDescriptor descriptor : beanInfo
+ .getPropertyDescriptors()) {
Method getter = descriptor.getReadMethod();
Method setter = descriptor.getWriteMethod();
- if (getter != null && setter != null
- && getFormatter().canConvert(descriptor.getPropertyType())) {
+ if (getter != null && setter != null && getFormatter()
+ .canConvert(descriptor.getPropertyType())) {
String attribute = toAttributeName(descriptor.getName());
entry.addAttribute(attribute, getter, setter);
}
@@ -210,10 +209,9 @@ public class DesignAttributeHandler implements Serializable {
writeAttribute(attribute, attr, value, defaultValue,
(Class) getter.getReturnType());
} catch (Exception e) {
- getLogger()
- .log(Level.SEVERE,
- "Failed to invoke getter for attribute "
- + attribute, e);
+ getLogger().log(Level.SEVERE,
+ "Failed to invoke getter for attribute " + attribute,
+ e);
}
}
}
@@ -234,15 +232,16 @@ public class DesignAttributeHandler implements Serializable {
* the type of the input value
*/
public static <T> void writeAttribute(String attribute,
- Attributes attributes, T value, T defaultValue, Class<T> inputType) {
+ Attributes attributes, T value, T defaultValue,
+ Class<T> inputType) {
if (!getFormatter().canConvert(inputType)) {
- throw new IllegalArgumentException("input type: "
- + inputType.getName() + " not supported");
+ throw new IllegalArgumentException(
+ "input type: " + inputType.getName() + " not supported");
}
if (!SharedUtil.equals(value, defaultValue)) {
String attributeValue = toAttributeValue(inputType, value);
- if ("".equals(attributeValue)
- && (inputType == boolean.class || inputType == Boolean.class)) {
+ if ("".equals(attributeValue) && (inputType == boolean.class
+ || inputType == Boolean.class)) {
attributes.put(attribute, true);
} else {
attributes.put(attribute, attributeValue);
@@ -288,8 +287,8 @@ public class DesignAttributeHandler implements Serializable {
public static <T> T readAttribute(String attribute, Attributes attributes,
Class<T> outputType) {
if (!getFormatter().canConvert(outputType)) {
- throw new IllegalArgumentException("output type: "
- + outputType.getName() + " not supported");
+ throw new IllegalArgumentException(
+ "output type: " + outputType.getName() + " not supported");
}
if (!attributes.hasKey(attribute)) {
return null;
@@ -298,8 +297,8 @@ public class DesignAttributeHandler implements Serializable {
String value = attributes.get(attribute);
return getFormatter().parse(value, outputType);
} catch (Exception e) {
- throw new DesignException("Failed to read attribute "
- + attribute, e);
+ throw new DesignException(
+ "Failed to read attribute " + attribute, e);
}
}
}
@@ -346,13 +345,12 @@ public class DesignAttributeHandler implements Serializable {
// if this is a beginning of the string, the whole matched group is
// written in lower case
if (matcher.group(1).isEmpty()) {
- matcher.appendReplacement(result, matched.toLowerCase()
- + matcher.group(3));
+ matcher.appendReplacement(result,
+ matched.toLowerCase() + matcher.group(3));
// otherwise the first character of the group stays uppercase,
// while the others are lower case
} else {
- matcher.appendReplacement(
- result,
+ matcher.appendReplacement(result,
matcher.group(1) + matched.substring(0, 1)
+ matched.substring(1).toLowerCase()
+ matcher.group(3));
@@ -381,8 +379,8 @@ public class DesignAttributeHandler implements Serializable {
// value is not null. How to represent null value in attributes?
return "";
}
- LegacyConverter<String, Object> converter = getFormatter().findConverterFor(
- sourceType);
+ LegacyConverter<String, Object> converter = getFormatter()
+ .findConverterFor(sourceType);
if (converter != null) {
return converter.convertToPresentation(value, String.class, null);
} else {
@@ -431,7 +429,8 @@ public class DesignAttributeHandler implements Serializable {
private static class AttributeCacheEntry implements Serializable {
private Map<String, Method[]> accessMethods = new ConcurrentHashMap<String, Method[]>();
- private void addAttribute(String attribute, Method getter, Method setter) {
+ private void addAttribute(String attribute, Method getter,
+ Method setter) {
Method[] methods = new Method[2];
methods[0] = getter;
methods[1] = setter;
@@ -492,7 +491,8 @@ public class DesignAttributeHandler implements Serializable {
* @param alignment
* the component alignment
*/
- public static void writeAlignment(Element childElement, Alignment alignment) {
+ public static void writeAlignment(Element childElement,
+ Alignment alignment) {
if (alignment.isMiddle()) {
childElement.attr(":middle", true);
} else if (alignment.isBottom()) {