aboutsummaryrefslogtreecommitdiffstats
path: root/server/src/main/java/com/vaadin/ui/declarative/Design.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/Design.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/Design.java')
-rw-r--r--server/src/main/java/com/vaadin/ui/declarative/Design.java60
1 files changed, 32 insertions, 28 deletions
diff --git a/server/src/main/java/com/vaadin/ui/declarative/Design.java b/server/src/main/java/com/vaadin/ui/declarative/Design.java
index a12cd65557..5c81a1efa2 100644
--- a/server/src/main/java/com/vaadin/ui/declarative/Design.java
+++ b/server/src/main/java/com/vaadin/ui/declarative/Design.java
@@ -133,7 +133,8 @@ public class Design implements Serializable {
* the design context for which the tag name is needed
* @return the tag name corresponding to the component
*/
- public String componentToTag(Component component, DesignContext context);
+ public String componentToTag(Component component,
+ DesignContext context);
}
/**
@@ -156,8 +157,7 @@ public class Design implements Serializable {
int lastDot = fullyQualifiedClassName.lastIndexOf('.');
if (lastDot != -1) {
String qualifiedInnerClassName = fullyQualifiedClassName
- .substring(0, lastDot)
- + "$"
+ .substring(0, lastDot) + "$"
+ fullyQualifiedClassName.substring(lastDot + 1);
return createComponent(qualifiedInnerClassName, context);
} else {
@@ -165,14 +165,17 @@ public class Design implements Serializable {
}
}
- assert Component.class.isAssignableFrom(componentClass) : "resolveComponentClass returned "
- + componentClass + " which is not a Vaadin Component class";
+ assert Component.class.isAssignableFrom(
+ componentClass) : "resolveComponentClass returned "
+ + componentClass
+ + " which is not a Vaadin Component class";
try {
return componentClass.newInstance();
} catch (Exception e) {
- throw new DesignException("Could not create component "
- + fullyQualifiedClassName, e);
+ throw new DesignException(
+ "Could not create component " + fullyQualifiedClassName,
+ e);
}
}
@@ -192,8 +195,8 @@ public class Design implements Serializable {
Class<?> componentClass = Class.forName(qualifiedClassName);
return componentClass.asSubclass(Component.class);
} catch (ClassNotFoundException e) {
- throw new DesignException(
- "Unable to load component for design", e);
+ throw new DesignException("Unable to load component for design",
+ e);
}
}
@@ -235,8 +238,8 @@ public class Design implements Serializable {
}
String qualifiedClassName = packageName + "." + className;
- Component component = componentFactory.createComponent(
- qualifiedClassName, context);
+ Component component = componentFactory
+ .createComponent(qualifiedClassName, context);
if (component == null) {
throw new DesignException("Got unexpected null component from "
@@ -248,18 +251,19 @@ public class Design implements Serializable {
}
@Override
- public String componentToTag(Component component, DesignContext context) {
+ public String componentToTag(Component component,
+ DesignContext context) {
Class<?> componentClass = component.getClass();
String packageName = getPackageName(componentClass);
String prefix = context.getPackagePrefix(packageName);
if (prefix == null) {
- prefix = packageName.replace('.', '_').toLowerCase(
- Locale.ENGLISH);
+ prefix = packageName.replace('.', '_')
+ .toLowerCase(Locale.ENGLISH);
context.addPackagePrefix(prefix, packageName);
}
prefix = prefix + "-";
- String className = classNameToElementName(componentClass
- .getSimpleName());
+ String className = classNameToElementName(
+ componentClass.getSimpleName());
String tagName = prefix + className;
return tagName;
@@ -488,8 +492,8 @@ public class Design implements Serializable {
designContext.removeComponentCreationListener(creationListener);
} else {
// createChild creates the entire component hierarchy
- componentRoot = element == null ? null : designContext
- .readDesign(element);
+ componentRoot = element == null ? null
+ : designContext.readDesign(element);
}
designContext.setRootComponent(componentRoot);
return designContext;
@@ -559,10 +563,9 @@ public class Design implements Serializable {
Class<? extends Component> annotatedClass = findClassWithAnnotation(
rootComponent.getClass(), DesignRoot.class);
if (annotatedClass == null) {
- throw new IllegalArgumentException(
- "The class "
- + rootComponent.getClass().getName()
- + " or any of its superclasses do not have an @DesignRoot annotation");
+ throw new IllegalArgumentException("The class "
+ + rootComponent.getClass().getName()
+ + " or any of its superclasses do not have an @DesignRoot annotation");
}
DesignRoot designAnnotation = annotatedClass
@@ -649,12 +652,12 @@ public class Design implements Serializable {
*/
public static DesignContext read(String filename, Component rootComponent)
throws DesignException {
- InputStream stream = rootComponent.getClass().getResourceAsStream(
- filename);
+ InputStream stream = rootComponent.getClass()
+ .getResourceAsStream(filename);
if (stream == null) {
- throw new DesignException("File " + filename
- + " was not found in the package "
- + rootComponent.getClass().getPackage().getName());
+ throw new DesignException(
+ "File " + filename + " was not found in the package "
+ + rootComponent.getClass().getPackage().getName());
}
try {
return read(stream, rootComponent);
@@ -687,7 +690,8 @@ public class Design implements Serializable {
* @throws DesignException
* If the design could not be loaded
*/
- public static DesignContext read(InputStream stream, Component rootComponent) {
+ public static DesignContext read(InputStream stream,
+ Component rootComponent) {
if (stream == null) {
throw new DesignException("Stream cannot be null");
}