summaryrefslogtreecommitdiffstats
path: root/server/src/com
diff options
context:
space:
mode:
Diffstat (limited to 'server/src/com')
-rw-r--r--server/src/com/vaadin/ui/AbstractComponent.java2
-rw-r--r--server/src/com/vaadin/ui/declarative/DesignContext.java14
-rw-r--r--server/src/com/vaadin/ui/declarative/FieldBinder.java22
-rw-r--r--server/src/com/vaadin/ui/declarative/LayoutHandler.java7
4 files changed, 22 insertions, 23 deletions
diff --git a/server/src/com/vaadin/ui/AbstractComponent.java b/server/src/com/vaadin/ui/AbstractComponent.java
index 434fb114df..adbb6d7fe7 100644
--- a/server/src/com/vaadin/ui/AbstractComponent.java
+++ b/server/src/com/vaadin/ui/AbstractComponent.java
@@ -1206,7 +1206,7 @@ public abstract class AbstractComponent extends AbstractClientConnector
private static final String[] customAttributes = new String[] { "width",
"height", "debug-id", "error", "width-auto", "height-auto",
"width-full", "height-full", "size-auto", "size-full",
- "responsive", "immediate", "locale", "read-only" };
+ "responsive", "immediate", "locale", "read-only", "_id" };
/*
* (non-Javadoc)
diff --git a/server/src/com/vaadin/ui/declarative/DesignContext.java b/server/src/com/vaadin/ui/declarative/DesignContext.java
index 51bfd7c379..988dc7654e 100644
--- a/server/src/com/vaadin/ui/declarative/DesignContext.java
+++ b/server/src/com/vaadin/ui/declarative/DesignContext.java
@@ -23,7 +23,6 @@ import java.util.List;
import java.util.Locale;
import java.util.Map;
-import org.jsoup.nodes.Attribute;
import org.jsoup.nodes.Attributes;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
@@ -440,16 +439,9 @@ public class DesignContext implements Serializable {
}
// local id: this is not a property of a component, so need to fetch it
// from the attributes of componentDesign
- String localId = null;
- for (Attribute attribute : attributes.asList()) {
- if (attribute.getKey().equals(LOCAL_ID_ATTRIBUTE)) {
- if (localId != null) {
- throw new DesignException("Duplicate local ids specified: "
- + localId + ".");
- }
- localId = attribute.getValue();
- mapLocalId(localId, component); // two-way map
- }
+ if (attributes.hasKey(LOCAL_ID_ATTRIBUTE)) {
+ String localId = attributes.get(LOCAL_ID_ATTRIBUTE);
+ mapLocalId(localId, component); // two-way map
}
// caption: a property of a component, possibly not unique
String caption = component.getCaption();
diff --git a/server/src/com/vaadin/ui/declarative/FieldBinder.java b/server/src/com/vaadin/ui/declarative/FieldBinder.java
index a0418a5f04..ab71589db2 100644
--- a/server/src/com/vaadin/ui/declarative/FieldBinder.java
+++ b/server/src/com/vaadin/ui/declarative/FieldBinder.java
@@ -20,6 +20,7 @@ import java.io.Serializable;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -59,18 +60,17 @@ public class FieldBinder implements Serializable {
}
/**
- * Returns true if all the fields assignable to Component are bound
+ * Returns a collection of field names that are not bound
*
- * @return true if all the fields assignable to Component are bound
+ * @return a collection of fields assignable to Component that are not bound
*/
- public boolean isAllFieldsBound() throws FieldBindingException {
- boolean success = true;
+ public Collection<String> getUnboundFields() throws FieldBindingException {
+ List<String> unboundFields = new ArrayList<String>();
for (Field f : fieldMap.values()) {
try {
Object value = ReflectTools.getJavaFieldValue(bindTarget, f);
if (value == null) {
- success = false;
- getLogger().severe("Found unbound field :" + f.getName());
+ unboundFields.add(f.getName());
}
} catch (IllegalArgumentException e) {
throw new FieldBindingException("Could not get field value", e);
@@ -80,7 +80,11 @@ public class FieldBinder implements Serializable {
throw new FieldBindingException("Could not get field value", e);
}
}
- return success;
+ if (unboundFields.size() > 0) {
+ getLogger().severe(
+ "Found unbound fields in component root :" + unboundFields);
+ }
+ return unboundFields;
}
/**
@@ -137,7 +141,7 @@ public class FieldBinder implements Serializable {
if (!success) {
String idInfo = "localId: " + localId + " id: " + instance.getId()
+ " caption: " + instance.getCaption();
- getLogger().info(
+ getLogger().finest(
"Could not bind component to a field "
+ instance.getClass().getName() + " " + idInfo);
}
@@ -180,7 +184,7 @@ public class FieldBinder implements Serializable {
"The field with identifier \"" + identifier
+ "\" already mapped");
throw new FieldBindingException(
- "Duplicate identifier found for a field");
+ "Duplicate identifier found for a field: " + fieldName);
}
// set the field value
ReflectTools.setJavaFieldValue(bindTarget, field, instance);
diff --git a/server/src/com/vaadin/ui/declarative/LayoutHandler.java b/server/src/com/vaadin/ui/declarative/LayoutHandler.java
index 93d0b32326..862e93e8ff 100644
--- a/server/src/com/vaadin/ui/declarative/LayoutHandler.java
+++ b/server/src/com/vaadin/ui/declarative/LayoutHandler.java
@@ -20,6 +20,7 @@ import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.Serializable;
+import java.util.Collection;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
@@ -201,9 +202,11 @@ public class LayoutHandler implements Serializable {
// create subtree
designContext.synchronizeAndRegister(componentRoot, element);
// make sure that all the member fields are bound
- if (!binder.isAllFieldsBound()) {
+ Collection<String> unboundFields = binder.getUnboundFields();
+ if (!unboundFields.isEmpty()) {
throw new DesignException(
- "Found unbound fields from component root");
+ "Found unbound fields from component root "
+ + unboundFields);
}
// no need to listen anymore
designContext.removeComponentCreationListener(creationListener);