aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/com/vaadin/annotations/AutoGenerated.java30
-rw-r--r--src/com/vaadin/data/util/Filter.java174
-rw-r--r--src/com/vaadin/data/validator/DoubleValidator.java74
-rw-r--r--src/com/vaadin/data/validator/EmailValidator.java64
-rw-r--r--src/com/vaadin/data/validator/IntegerValidator.java76
-rw-r--r--src/com/vaadin/data/validator/RegexpValidator.java174
-rw-r--r--src/com/vaadin/event/ComponentEventListener.java14
-rw-r--r--src/com/vaadin/terminal/gwt/client/CSSRule.java111
-rw-r--r--src/com/vaadin/terminal/gwt/client/ClientExceptionHandler.java50
-rw-r--r--src/com/vaadin/terminal/gwt/client/RenderInformation.java248
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/Field.java26
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/SubPartAware.java20
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/VCalendarPanel.java6
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/VCheckBox.java3
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/VEmbedded.java2
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/VHorizontalLayout.java22
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/VOptionGroup.java3
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/VOrderedLayout.java1784
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/VPopupCalendar.java14
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/VSlider.java4
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/VVerticalLayout.java22
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/dd/HorizontalDropLocation.java1
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/dd/VAcceptCallback.java1
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/dd/VTargetInSubtree.java3
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/layout/Margins.java166
-rw-r--r--src/com/vaadin/terminal/gwt/server/AbstractApplicationPortlet.java7
-rw-r--r--src/com/vaadin/terminal/gwt/server/AbstractWebApplicationContext.java320
-rw-r--r--src/com/vaadin/terminal/gwt/server/ApplicationPortlet.java434
-rw-r--r--src/com/vaadin/terminal/gwt/server/ChangeVariablesErrorEvent.java68
-rw-r--r--src/com/vaadin/terminal/gwt/server/DragAndDropService.java7
-rw-r--r--src/com/vaadin/terminal/gwt/server/PortletApplicationContext.java342
-rw-r--r--src/com/vaadin/terminal/gwt/server/RestrictedRenderResponse.java248
-rw-r--r--src/com/vaadin/terminal/gwt/server/SystemMessageException.java106
-rw-r--r--src/com/vaadin/tools/WidgetsetCompiler.java140
-rw-r--r--src/com/vaadin/ui/AbstractComponent.java10
-rw-r--r--src/com/vaadin/ui/Tree.java6
36 files changed, 2390 insertions, 2390 deletions
diff --git a/src/com/vaadin/annotations/AutoGenerated.java b/src/com/vaadin/annotations/AutoGenerated.java
index 87b876e268..90c3adc2cf 100644
--- a/src/com/vaadin/annotations/AutoGenerated.java
+++ b/src/com/vaadin/annotations/AutoGenerated.java
@@ -1,18 +1,18 @@
/*
@ITMillApache2LicenseForJavaFiles@
*/
-package com.vaadin.annotations;
-
-/**
- * Marker annotation for automatically generated code elements.
- *
- * These elements may be modified or removed by code generation.
- *
- * @author IT Mill Ltd.
- * @version
- * @VERSION@
- * @since 6.0
- */
-public @interface AutoGenerated {
-
-}
+package com.vaadin.annotations;
+
+/**
+ * Marker annotation for automatically generated code elements.
+ *
+ * These elements may be modified or removed by code generation.
+ *
+ * @author IT Mill Ltd.
+ * @version
+ * @VERSION@
+ * @since 6.0
+ */
+public @interface AutoGenerated {
+
+}
diff --git a/src/com/vaadin/data/util/Filter.java b/src/com/vaadin/data/util/Filter.java
index fb187b2b3b..0fad1a6e1b 100644
--- a/src/com/vaadin/data/util/Filter.java
+++ b/src/com/vaadin/data/util/Filter.java
@@ -1,93 +1,93 @@
/*
@ITMillApache2LicenseForJavaFiles@
*/
-package com.vaadin.data.util;
-
-import java.io.Serializable;
-
-import com.vaadin.data.Item;
-import com.vaadin.data.Property;
-
-/**
- * A default filter that can be used to implement
- * {@link com.vaadin.data.Container.Filterable}.
- *
- * @since 5.4
- */
-@SuppressWarnings("serial")
-public class Filter implements Serializable {
- final Object propertyId;
- final String filterString;
- final boolean ignoreCase;
- final boolean onlyMatchPrefix;
-
- Filter(Object propertyId, String filterString, boolean ignoreCase,
- boolean onlyMatchPrefix) {
- this.propertyId = propertyId;
- ;
- this.filterString = ignoreCase ? filterString.toLowerCase()
- : filterString;
- this.ignoreCase = ignoreCase;
- this.onlyMatchPrefix = onlyMatchPrefix;
- }
-
- /**
- * Check if an item passes the filter.
- *
- * @param item
- * @return true if the item is accepted by this filter
- */
- public boolean passesFilter(Item item) {
- final Property p = item.getItemProperty(propertyId);
- if (p == null || p.toString() == null) {
- return false;
- }
- final String value = ignoreCase ? p.toString().toLowerCase() : p
- .toString();
- if (onlyMatchPrefix) {
- if (!value.startsWith(filterString)) {
- return false;
- }
- } else {
- if (!value.contains(filterString)) {
- return false;
- }
- }
- return true;
- }
-
- @Override
- public boolean equals(Object obj) {
-
+package com.vaadin.data.util;
+
+import java.io.Serializable;
+
+import com.vaadin.data.Item;
+import com.vaadin.data.Property;
+
+/**
+ * A default filter that can be used to implement
+ * {@link com.vaadin.data.Container.Filterable}.
+ *
+ * @since 5.4
+ */
+@SuppressWarnings("serial")
+public class Filter implements Serializable {
+ final Object propertyId;
+ final String filterString;
+ final boolean ignoreCase;
+ final boolean onlyMatchPrefix;
+
+ Filter(Object propertyId, String filterString, boolean ignoreCase,
+ boolean onlyMatchPrefix) {
+ this.propertyId = propertyId;
+ ;
+ this.filterString = ignoreCase ? filterString.toLowerCase()
+ : filterString;
+ this.ignoreCase = ignoreCase;
+ this.onlyMatchPrefix = onlyMatchPrefix;
+ }
+
+ /**
+ * Check if an item passes the filter.
+ *
+ * @param item
+ * @return true if the item is accepted by this filter
+ */
+ public boolean passesFilter(Item item) {
+ final Property p = item.getItemProperty(propertyId);
+ if (p == null || p.toString() == null) {
+ return false;
+ }
+ final String value = ignoreCase ? p.toString().toLowerCase() : p
+ .toString();
+ if (onlyMatchPrefix) {
+ if (!value.startsWith(filterString)) {
+ return false;
+ }
+ } else {
+ if (!value.contains(filterString)) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+
// Only ones of the objects of the same class can be equal
- if (!(obj instanceof Filter)) {
- return false;
- }
- final Filter o = (Filter) obj;
-
+ if (!(obj instanceof Filter)) {
+ return false;
+ }
+ final Filter o = (Filter) obj;
+
// Checks the properties one by one
- if (propertyId != o.propertyId && o.propertyId != null
- && !o.propertyId.equals(propertyId)) {
- return false;
- }
- if (filterString != o.filterString && o.filterString != null
- && !o.filterString.equals(filterString)) {
- return false;
- }
- if (ignoreCase != o.ignoreCase) {
- return false;
- }
- if (onlyMatchPrefix != o.onlyMatchPrefix) {
- return false;
- }
-
- return true;
- }
-
- @Override
- public int hashCode() {
- return (propertyId != null ? propertyId.hashCode() : 0)
- ^ (filterString != null ? filterString.hashCode() : 0);
- }
-
+ if (propertyId != o.propertyId && o.propertyId != null
+ && !o.propertyId.equals(propertyId)) {
+ return false;
+ }
+ if (filterString != o.filterString && o.filterString != null
+ && !o.filterString.equals(filterString)) {
+ return false;
+ }
+ if (ignoreCase != o.ignoreCase) {
+ return false;
+ }
+ if (onlyMatchPrefix != o.onlyMatchPrefix) {
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ return (propertyId != null ? propertyId.hashCode() : 0)
+ ^ (filterString != null ? filterString.hashCode() : 0);
+ }
+
} \ No newline at end of file
diff --git a/src/com/vaadin/data/validator/DoubleValidator.java b/src/com/vaadin/data/validator/DoubleValidator.java
index cbdcb562d5..db639f3856 100644
--- a/src/com/vaadin/data/validator/DoubleValidator.java
+++ b/src/com/vaadin/data/validator/DoubleValidator.java
@@ -1,40 +1,40 @@
/*
@ITMillApache2LicenseForJavaFiles@
*/
-package com.vaadin.data.validator;
-
-/**
- * String validator for a double precision floating point number. See
- * {@link com.vaadin.data.validator.AbstractStringValidator} for more
- * information.
- *
- * @author IT Mill Ltd.
- * @version
- * @VERSION@
- * @since 5.4
- */
-@SuppressWarnings("serial")
-public class DoubleValidator extends AbstractStringValidator {
-
- /**
- * Creates a validator for checking that a string can be parsed as an
- * double.
- *
- * @param errorMessage
- * the message to display in case the value does not validate.
- */
- public DoubleValidator(String errorMessage) {
- super(errorMessage);
- }
-
- @Override
- protected boolean isValidString(String value) {
- try {
- Double.parseDouble(value);
- return true;
- } catch (Exception e) {
- return false;
- }
- }
-
-}
+package com.vaadin.data.validator;
+
+/**
+ * String validator for a double precision floating point number. See
+ * {@link com.vaadin.data.validator.AbstractStringValidator} for more
+ * information.
+ *
+ * @author IT Mill Ltd.
+ * @version
+ * @VERSION@
+ * @since 5.4
+ */
+@SuppressWarnings("serial")
+public class DoubleValidator extends AbstractStringValidator {
+
+ /**
+ * Creates a validator for checking that a string can be parsed as an
+ * double.
+ *
+ * @param errorMessage
+ * the message to display in case the value does not validate.
+ */
+ public DoubleValidator(String errorMessage) {
+ super(errorMessage);
+ }
+
+ @Override
+ protected boolean isValidString(String value) {
+ try {
+ Double.parseDouble(value);
+ return true;
+ } catch (Exception e) {
+ return false;
+ }
+ }
+
+}
diff --git a/src/com/vaadin/data/validator/EmailValidator.java b/src/com/vaadin/data/validator/EmailValidator.java
index e86028e2d4..4fc09dadc5 100644
--- a/src/com/vaadin/data/validator/EmailValidator.java
+++ b/src/com/vaadin/data/validator/EmailValidator.java
@@ -1,35 +1,35 @@
/*
@ITMillApache2LicenseForJavaFiles@
*/
-package com.vaadin.data.validator;
-
-/**
- * String validator for e-mail addresses. The e-mail address syntax is not
- * complete according to RFC 822 but handles the vast majority of valid e-mail
- * addresses correctly.
- *
- * See {@link com.vaadin.data.validator.AbstractStringValidator} for more
- * information.
- *
- * @author IT Mill Ltd.
- * @version
- * @VERSION@
- * @since 5.4
- */
-@SuppressWarnings("serial")
-public class EmailValidator extends RegexpValidator {
-
- /**
- * Creates a validator for checking that a string is a syntactically valid
- * e-mail address.
- *
- * @param errorMessage
- * the message to display in case the value does not validate.
- */
- public EmailValidator(String errorMessage) {
- super(
- "^([a-zA-Z0-9_\\.\\-+])+@(([a-zA-Z0-9-])+\\.)+([a-zA-Z0-9]{2,4})+$",
- true, errorMessage);
- }
-
-}
+package com.vaadin.data.validator;
+
+/**
+ * String validator for e-mail addresses. The e-mail address syntax is not
+ * complete according to RFC 822 but handles the vast majority of valid e-mail
+ * addresses correctly.
+ *
+ * See {@link com.vaadin.data.validator.AbstractStringValidator} for more
+ * information.
+ *
+ * @author IT Mill Ltd.
+ * @version
+ * @VERSION@
+ * @since 5.4
+ */
+@SuppressWarnings("serial")
+public class EmailValidator extends RegexpValidator {
+
+ /**
+ * Creates a validator for checking that a string is a syntactically valid
+ * e-mail address.
+ *
+ * @param errorMessage
+ * the message to display in case the value does not validate.
+ */
+ public EmailValidator(String errorMessage) {
+ super(
+ "^([a-zA-Z0-9_\\.\\-+])+@(([a-zA-Z0-9-])+\\.)+([a-zA-Z0-9]{2,4})+$",
+ true, errorMessage);
+ }
+
+}
diff --git a/src/com/vaadin/data/validator/IntegerValidator.java b/src/com/vaadin/data/validator/IntegerValidator.java
index 30a41d7662..1475caf312 100644
--- a/src/com/vaadin/data/validator/IntegerValidator.java
+++ b/src/com/vaadin/data/validator/IntegerValidator.java
@@ -1,41 +1,41 @@
/*
@ITMillApache2LicenseForJavaFiles@
*/
-package com.vaadin.data.validator;
-
-/**
- * String validator for integers. See
- * {@link com.vaadin.data.validator.AbstractStringValidator} for more
- * information.
- *
- * @author IT Mill Ltd.
- * @version
- * @VERSION@
- * @since 5.4
- */
-@SuppressWarnings("serial")
-public class IntegerValidator extends AbstractStringValidator {
-
- /**
- * Creates a validator for checking that a string can be parsed as an
- * integer.
- *
- * @param errorMessage
- * the message to display in case the value does not validate.
- */
- public IntegerValidator(String errorMessage) {
- super(errorMessage);
-
- }
-
- @Override
- protected boolean isValidString(String value) {
- try {
- Integer.parseInt(value);
- return true;
- } catch (Exception e) {
- return false;
- }
- }
-
-}
+package com.vaadin.data.validator;
+
+/**
+ * String validator for integers. See
+ * {@link com.vaadin.data.validator.AbstractStringValidator} for more
+ * information.
+ *
+ * @author IT Mill Ltd.
+ * @version
+ * @VERSION@
+ * @since 5.4
+ */
+@SuppressWarnings("serial")
+public class IntegerValidator extends AbstractStringValidator {
+
+ /**
+ * Creates a validator for checking that a string can be parsed as an
+ * integer.
+ *
+ * @param errorMessage
+ * the message to display in case the value does not validate.
+ */
+ public IntegerValidator(String errorMessage) {
+ super(errorMessage);
+
+ }
+
+ @Override
+ protected boolean isValidString(String value) {
+ try {
+ Integer.parseInt(value);
+ return true;
+ } catch (Exception e) {
+ return false;
+ }
+ }
+
+}
diff --git a/src/com/vaadin/data/validator/RegexpValidator.java b/src/com/vaadin/data/validator/RegexpValidator.java
index eb85319f9d..3c455e587b 100644
--- a/src/com/vaadin/data/validator/RegexpValidator.java
+++ b/src/com/vaadin/data/validator/RegexpValidator.java
@@ -1,90 +1,90 @@
/*
@ITMillApache2LicenseForJavaFiles@
*/
-package com.vaadin.data.validator;
-
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-/**
- * String validator comparing the string against a Java regular expression. Both
- * complete matches and substring matches are supported.
- *
- * <p>
- * For the Java regular expression syntax, see
- * {@link java.util.regex.Pattern#sum}
- * </p>
- * <p>
- * See {@link com.vaadin.data.validator.AbstractStringValidator} for more
- * information.
- * </p>
- *
- * @author IT Mill Ltd.
- * @version
- * @VERSION@
- * @since 5.4
- */
-@SuppressWarnings("serial")
-public class RegexpValidator extends AbstractStringValidator {
-
- private Pattern pattern;
- private boolean complete;
- private transient Matcher matcher = null;
-
- /**
- * Creates a validator for checking that the regular expression matches the
- * complete string to validate.
- *
- * @param regexp
- * a Java regular expression
- * @param errorMessage
- * the message to display in case the value does not validate.
- */
- public RegexpValidator(String regexp, String errorMessage) {
- this(regexp, true, errorMessage);
- }
-
- /**
- * Creates a validator for checking that the regular expression matches the
- * string to validate.
- *
- * @param regexp
- * a Java regular expression
- * @param complete
- * true to use check for a complete match, false to look for a
- * matching substring
- * @param errorMessage
- * the message to display in case the value does not validate.
- */
- public RegexpValidator(String regexp, boolean complete, String errorMessage) {
- super(errorMessage);
- pattern = Pattern.compile(regexp);
- this.complete = complete;
- }
-
- @Override
- protected boolean isValidString(String value) {
- if (complete) {
- return getMatcher(value).matches();
- } else {
- return getMatcher(value).find();
- }
- }
-
- /**
- * Get a new or reused matcher for the pattern
- *
- * @param value
- * the string to find matches in
- * @return Matcher for the string
- */
- private Matcher getMatcher(String value) {
- if (matcher == null) {
- matcher = pattern.matcher(value);
- } else {
- matcher.reset(value);
- }
- return matcher;
- }
-
-}
+package com.vaadin.data.validator;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/**
+ * String validator comparing the string against a Java regular expression. Both
+ * complete matches and substring matches are supported.
+ *
+ * <p>
+ * For the Java regular expression syntax, see
+ * {@link java.util.regex.Pattern#sum}
+ * </p>
+ * <p>
+ * See {@link com.vaadin.data.validator.AbstractStringValidator} for more
+ * information.
+ * </p>
+ *
+ * @author IT Mill Ltd.
+ * @version
+ * @VERSION@
+ * @since 5.4
+ */
+@SuppressWarnings("serial")
+public class RegexpValidator extends AbstractStringValidator {
+
+ private Pattern pattern;
+ private boolean complete;
+ private transient Matcher matcher = null;
+
+ /**
+ * Creates a validator for checking that the regular expression matches the
+ * complete string to validate.
+ *
+ * @param regexp
+ * a Java regular expression
+ * @param errorMessage
+ * the message to display in case the value does not validate.
+ */
+ public RegexpValidator(String regexp, String errorMessage) {
+ this(regexp, true, errorMessage);
+ }
+
+ /**
+ * Creates a validator for checking that the regular expression matches the
+ * string to validate.
+ *
+ * @param regexp
+ * a Java regular expression
+ * @param complete
+ * true to use check for a complete match, false to look for a
+ * matching substring
+ * @param errorMessage
+ * the message to display in case the value does not validate.
+ */
+ public RegexpValidator(String regexp, boolean complete, String errorMessage) {
+ super(errorMessage);
+ pattern = Pattern.compile(regexp);
+ this.complete = complete;
+ }
+
+ @Override
+ protected boolean isValidString(String value) {
+ if (complete) {
+ return getMatcher(value).matches();
+ } else {
+ return getMatcher(value).find();
+ }
+ }
+
+ /**
+ * Get a new or reused matcher for the pattern
+ *
+ * @param value
+ * the string to find matches in
+ * @return Matcher for the string
+ */
+ private Matcher getMatcher(String value) {
+ if (matcher == null) {
+ matcher = pattern.matcher(value);
+ } else {
+ matcher.reset(value);
+ }
+ return matcher;
+ }
+
+}
diff --git a/src/com/vaadin/event/ComponentEventListener.java b/src/com/vaadin/event/ComponentEventListener.java
index 6957a762f0..215db4f991 100644
--- a/src/com/vaadin/event/ComponentEventListener.java
+++ b/src/com/vaadin/event/ComponentEventListener.java
@@ -1,11 +1,11 @@
/*
@ITMillApache2LicenseForJavaFiles@
*/
-package com.vaadin.event;
-
-import java.io.Serializable;
-import java.util.EventListener;
-
-public interface ComponentEventListener extends EventListener, Serializable {
-
+package com.vaadin.event;
+
+import java.io.Serializable;
+import java.util.EventListener;
+
+public interface ComponentEventListener extends EventListener, Serializable {
+
} \ No newline at end of file
diff --git a/src/com/vaadin/terminal/gwt/client/CSSRule.java b/src/com/vaadin/terminal/gwt/client/CSSRule.java
index 0931c23d86..5c7758e0dd 100644
--- a/src/com/vaadin/terminal/gwt/client/CSSRule.java
+++ b/src/com/vaadin/terminal/gwt/client/CSSRule.java
@@ -27,16 +27,17 @@ public class CSSRule {
// TODO how to find the right LINK-element? We should probably give the
// stylesheet a name.
- private native void fetchRule(final String selector, final boolean deep) /*-{
- var sheets = $doc.styleSheets;
- for(var i = 0; i < sheets.length; i++) {
- var sheet = sheets[i];
- if(sheet.href && sheet.href.indexOf("VAADIN/themes")>-1) {
- this.@com.vaadin.terminal.gwt.client.CSSRule::rules = @com.vaadin.terminal.gwt.client.CSSRule::searchForRule(Lcom/google/gwt/core/client/JavaScriptObject;Ljava/lang/String;Z)(sheet, selector, deep);
- return;
- }
- }
- this.@com.vaadin.terminal.gwt.client.CSSRule::rules = [];
+ private native void fetchRule(final String selector, final boolean deep)
+ /*-{
+ var sheets = $doc.styleSheets;
+ for(var i = 0; i < sheets.length; i++) {
+ var sheet = sheets[i];
+ if(sheet.href && sheet.href.indexOf("VAADIN/themes")>-1) {
+ this.@com.vaadin.terminal.gwt.client.CSSRule::rules = @com.vaadin.terminal.gwt.client.CSSRule::searchForRule(Lcom/google/gwt/core/client/JavaScriptObject;Ljava/lang/String;Z)(sheet, selector, deep);
+ return;
+ }
+ }
+ this.@com.vaadin.terminal.gwt.client.CSSRule::rules = [];
}-*/;
/*
@@ -45,48 +46,49 @@ public class CSSRule {
*/
private static native JavaScriptObject searchForRule(
final JavaScriptObject sheet, final String selector,
- final boolean deep) /*-{
- if(!$doc.styleSheets)
- return null;
+ final boolean deep)
+ /*-{
+ if(!$doc.styleSheets)
+ return null;
- selector = selector.toLowerCase();
+ selector = selector.toLowerCase();
- var allMatches = [];
+ var allMatches = [];
- // IE handles imported sheet differently
- if(deep && sheet.imports && sheet.imports.length > 0) {
- for(var i=0; i < sheet.imports.length; i++) {
- var imports = @com.vaadin.terminal.gwt.client.CSSRule::searchForRule(Lcom/google/gwt/core/client/JavaScriptObject;Ljava/lang/String;Z)(sheet.imports[i], selector, deep);
- allMatches.concat(imports);
- }
- }
+ // IE handles imported sheet differently
+ if(deep && sheet.imports && sheet.imports.length > 0) {
+ for(var i=0; i < sheet.imports.length; i++) {
+ var imports = @com.vaadin.terminal.gwt.client.CSSRule::searchForRule(Lcom/google/gwt/core/client/JavaScriptObject;Ljava/lang/String;Z)(sheet.imports[i], selector, deep);
+ allMatches.concat(imports);
+ }
+ }
- var theRules = new Array();
- if (sheet.cssRules)
- theRules = sheet.cssRules
- else if (sheet.rules)
- theRules = sheet.rules
+ var theRules = new Array();
+ if (sheet.cssRules)
+ theRules = sheet.cssRules
+ else if (sheet.rules)
+ theRules = sheet.rules
- var j = theRules.length;
- for(var i=0; i<j; i++) {
- var r = theRules[i];
- if(r.type == 1 || sheet.imports) {
- var selectors = r.selectorText.toLowerCase().split(",");
- var n = selectors.length;
- for(var m=0; m<n; m++) {
- if(selectors[m].replace(/^\s+|\s+$/g, "") == selector) {
- allMatches.unshift(r);
- break; // No need to loop other selectors for this rule
- }
- }
- } else if(deep && r.type == 3) {
- // Search @import stylesheet
- var imports = @com.vaadin.terminal.gwt.client.CSSRule::searchForRule(Lcom/google/gwt/core/client/JavaScriptObject;Ljava/lang/String;Z)(r.styleSheet, selector, deep);
- allMatches = allMatches.concat(imports);
- }
- }
+ var j = theRules.length;
+ for(var i=0; i<j; i++) {
+ var r = theRules[i];
+ if(r.type == 1 || sheet.imports) {
+ var selectors = r.selectorText.toLowerCase().split(",");
+ var n = selectors.length;
+ for(var m=0; m<n; m++) {
+ if(selectors[m].replace(/^\s+|\s+$/g, "") == selector) {
+ allMatches.unshift(r);
+ break; // No need to loop other selectors for this rule
+ }
+ }
+ } else if(deep && r.type == 3) {
+ // Search @import stylesheet
+ var imports = @com.vaadin.terminal.gwt.client.CSSRule::searchForRule(Lcom/google/gwt/core/client/JavaScriptObject;Ljava/lang/String;Z)(r.styleSheet, selector, deep);
+ allMatches = allMatches.concat(imports);
+ }
+ }
- return allMatches;
+ return allMatches;
}-*/;
/**
@@ -96,14 +98,15 @@ public class CSSRule {
* camelCase CSS property name
* @return the value of the property as a String
*/
- public native String getPropertyValue(final String propertyName) /*-{
- var j = this.@com.vaadin.terminal.gwt.client.CSSRule::rules.length;
- for(var i=0; i<j; i++) {
- var value = this.@com.vaadin.terminal.gwt.client.CSSRule::rules[i].style[propertyName];
- if(value)
- return value;
- }
- return null;
+ public native String getPropertyValue(final String propertyName)
+ /*-{
+ var j = this.@com.vaadin.terminal.gwt.client.CSSRule::rules.length;
+ for(var i=0; i<j; i++) {
+ var value = this.@com.vaadin.terminal.gwt.client.CSSRule::rules[i].style[propertyName];
+ if(value)
+ return value;
+ }
+ return null;
}-*/;
public String getSelector() {
diff --git a/src/com/vaadin/terminal/gwt/client/ClientExceptionHandler.java b/src/com/vaadin/terminal/gwt/client/ClientExceptionHandler.java
index 015815ffe2..955deb4d8f 100644
--- a/src/com/vaadin/terminal/gwt/client/ClientExceptionHandler.java
+++ b/src/com/vaadin/terminal/gwt/client/ClientExceptionHandler.java
@@ -1,30 +1,30 @@
/*
@ITMillApache2LicenseForJavaFiles@
*/
-package com.vaadin.terminal.gwt.client;
-
-public class ClientExceptionHandler {
-
- public static void displayError(Throwable e) {
- displayError(e.getClass().getName() + ": " + e.getMessage());
- e.printStackTrace();
- }
-
- public static void displayError(String msg) {
-
- Console console = ApplicationConnection.getConsole();
-
- if (console != null) {
- console.error(msg);
+package com.vaadin.terminal.gwt.client;
+
+public class ClientExceptionHandler {
+
+ public static void displayError(Throwable e) {
+ displayError(e.getClass().getName() + ": " + e.getMessage());
+ e.printStackTrace();
+ }
+
+ public static void displayError(String msg) {
+
+ Console console = ApplicationConnection.getConsole();
+
+ if (console != null) {
+ console.error(msg);
// } else {
// System.err.println(msg);
- }
- }
-
- public static void displayError(String msg, Throwable e) {
- displayError(msg);
- displayError(e);
-
- }
-
-}
+ }
+ }
+
+ public static void displayError(String msg, Throwable e) {
+ displayError(msg);
+ displayError(e);
+
+ }
+
+}
diff --git a/src/com/vaadin/terminal/gwt/client/RenderInformation.java b/src/com/vaadin/terminal/gwt/client/RenderInformation.java
index 6fb92c63e4..f9195c8bf8 100644
--- a/src/com/vaadin/terminal/gwt/client/RenderInformation.java
+++ b/src/com/vaadin/terminal/gwt/client/RenderInformation.java
@@ -1,136 +1,136 @@
/*
@ITMillApache2LicenseForJavaFiles@
*/
-package com.vaadin.terminal.gwt.client;
-
+package com.vaadin.terminal.gwt.client;
+
import com.google.gwt.user.client.Element;
-
-/**
- * Contains size information about a rendered container and its content area.
- *
- * @author Artur Signell
- *
- */
-public class RenderInformation {
-
- private RenderSpace contentArea = new RenderSpace();
- private Size renderedSize = new Size(-1, -1);
-
- public void setContentAreaWidth(int w) {
- contentArea.setWidth(w);
- }
-
- public void setContentAreaHeight(int h) {
- contentArea.setHeight(h);
- }
-
- public RenderSpace getContentAreaSize() {
- return contentArea;
-
- }
-
- public Size getRenderedSize() {
- return renderedSize;
- }
-
- /**
- * Update the size of the widget.
- *
- * @param widget
- *
- * @return true if the size has changed since last update
- */
- public boolean updateSize(Element element) {
- Size newSize = new Size(element.getOffsetWidth(), element
- .getOffsetHeight());
- if (newSize.equals(renderedSize)) {
- return false;
- } else {
- renderedSize = newSize;
- return true;
- }
- }
-
- @Override
- public String toString() {
- return "RenderInformation [contentArea=" + contentArea
- + ",renderedSize=" + renderedSize + "]";
-
- }
-
- public static class FloatSize {
-
- private float width, height;
-
- public FloatSize(float width, float height) {
- this.width = width;
- this.height = height;
- }
-
- public float getWidth() {
- return width;
- }
-
- public void setWidth(float width) {
- this.width = width;
- }
-
- public float getHeight() {
- return height;
- }
-
- public void setHeight(float height) {
- this.height = height;
- }
-
- }
-
- public static class Size {
-
- private int width, height;
-
- @Override
+
+/**
+ * Contains size information about a rendered container and its content area.
+ *
+ * @author Artur Signell
+ *
+ */
+public class RenderInformation {
+
+ private RenderSpace contentArea = new RenderSpace();
+ private Size renderedSize = new Size(-1, -1);
+
+ public void setContentAreaWidth(int w) {
+ contentArea.setWidth(w);
+ }
+
+ public void setContentAreaHeight(int h) {
+ contentArea.setHeight(h);
+ }
+
+ public RenderSpace getContentAreaSize() {
+ return contentArea;
+
+ }
+
+ public Size getRenderedSize() {
+ return renderedSize;
+ }
+
+ /**
+ * Update the size of the widget.
+ *
+ * @param widget
+ *
+ * @return true if the size has changed since last update
+ */
+ public boolean updateSize(Element element) {
+ Size newSize = new Size(element.getOffsetWidth(), element
+ .getOffsetHeight());
+ if (newSize.equals(renderedSize)) {
+ return false;
+ } else {
+ renderedSize = newSize;
+ return true;
+ }
+ }
+
+ @Override
+ public String toString() {
+ return "RenderInformation [contentArea=" + contentArea
+ + ",renderedSize=" + renderedSize + "]";
+
+ }
+
+ public static class FloatSize {
+
+ private float width, height;
+
+ public FloatSize(float width, float height) {
+ this.width = width;
+ this.height = height;
+ }
+
+ public float getWidth() {
+ return width;
+ }
+
+ public void setWidth(float width) {
+ this.width = width;
+ }
+
+ public float getHeight() {
+ return height;
+ }
+
+ public void setHeight(float height) {
+ this.height = height;
+ }
+
+ }
+
+ public static class Size {
+
+ private int width, height;
+
+ @Override
public boolean equals(Object obj) {
if (!(obj instanceof Size)) {
return false;
- }
- Size other = (Size) obj;
- return other.width == width && other.height == height;
+ }
+ Size other = (Size) obj;
+ return other.width == width && other.height == height;
}
@Override
public int hashCode() {
return (width << 8) | height;
- }
-
- public Size() {
- }
-
- public Size(int width, int height) {
- this.height = height;
- this.width = width;
- }
-
- public int getWidth() {
- return width;
- }
-
- public void setWidth(int width) {
- this.width = width;
- }
-
- public int getHeight() {
- return height;
- }
-
- public void setHeight(int height) {
- this.height = height;
- }
-
- @Override
- public String toString() {
- return "Size [width=" + width + ",height=" + height + "]";
- }
- }
-
-}
+ }
+
+ public Size() {
+ }
+
+ public Size(int width, int height) {
+ this.height = height;
+ this.width = width;
+ }
+
+ public int getWidth() {
+ return width;
+ }
+
+ public void setWidth(int width) {
+ this.width = width;
+ }
+
+ public int getHeight() {
+ return height;
+ }
+
+ public void setHeight(int height) {
+ this.height = height;
+ }
+
+ @Override
+ public String toString() {
+ return "Size [width=" + width + ",height=" + height + "]";
+ }
+ }
+
+}
diff --git a/src/com/vaadin/terminal/gwt/client/ui/Field.java b/src/com/vaadin/terminal/gwt/client/ui/Field.java
index 1a8d0141e1..8d13e70d61 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/Field.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/Field.java
@@ -1,16 +1,16 @@
/*
@ITMillApache2LicenseForJavaFiles@
*/
-/**
- *
- */
-package com.vaadin.terminal.gwt.client.ui;
-
-/**
- * This interface indicates that the component is a Field (serverside), and
- * wants (for instance) to automatically get the v-modified classname.
- *
- */
-public interface Field {
-
-}
+/**
+ *
+ */
+package com.vaadin.terminal.gwt.client.ui;
+
+/**
+ * This interface indicates that the component is a Field (serverside), and
+ * wants (for instance) to automatically get the v-modified classname.
+ *
+ */
+public interface Field {
+
+}
diff --git a/src/com/vaadin/terminal/gwt/client/ui/SubPartAware.java b/src/com/vaadin/terminal/gwt/client/ui/SubPartAware.java
index 74f954d6e5..2a1bef71ff 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/SubPartAware.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/SubPartAware.java
@@ -1,14 +1,14 @@
/*
@ITMillApache2LicenseForJavaFiles@
*/
-package com.vaadin.terminal.gwt.client.ui;
-
-import com.google.gwt.user.client.Element;
-
-public interface SubPartAware {
-
- Element getSubPartElement(String subPart);
-
- String getSubPartName(Element subElement);
-
+package com.vaadin.terminal.gwt.client.ui;
+
+import com.google.gwt.user.client.Element;
+
+public interface SubPartAware {
+
+ Element getSubPartElement(String subPart);
+
+ String getSubPartName(Element subElement);
+
} \ No newline at end of file
diff --git a/src/com/vaadin/terminal/gwt/client/ui/VCalendarPanel.java b/src/com/vaadin/terminal/gwt/client/ui/VCalendarPanel.java
index bf753ce530..af5411467a 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/VCalendarPanel.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/VCalendarPanel.java
@@ -788,7 +788,6 @@ public class VCalendarPanel extends FocusableFlexTable implements
processClickEvent(sender, true);
}
-
public void setLimits(Date min, Date max) {
if (min != null) {
final Date d = new Date(min.getTime());
@@ -832,8 +831,7 @@ public class VCalendarPanel extends FocusableFlexTable implements
public void onKeyDown(KeyDownEvent event) {
int keycode = event.getNativeKeyCode();
- if (handleNavigation(keycode, event
- .isControlKeyDown()
+ if (handleNavigation(keycode, event.isControlKeyDown()
|| event.isMetaKeyDown(), event.isShiftKeyDown())) {
event.preventDefault();
}
@@ -1337,7 +1335,7 @@ public class VCalendarPanel extends FocusableFlexTable implements
updateCalendar();
return true;
}
-
+
return false;
}
diff --git a/src/com/vaadin/terminal/gwt/client/ui/VCheckBox.java b/src/com/vaadin/terminal/gwt/client/ui/VCheckBox.java
index 88b3f876dd..be61aea7be 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/VCheckBox.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/VCheckBox.java
@@ -80,7 +80,8 @@ public class VCheckBox extends com.google.gwt.user.client.ui.CheckBox implements
focusHandlerRegistration = EventHelper.updateFocusHandler(this, client,
focusHandlerRegistration);
- blurHandlerRegistration = EventHelper.updateBlurHandler(this, client, blurHandlerRegistration);
+ blurHandlerRegistration = EventHelper.updateBlurHandler(this, client,
+ blurHandlerRegistration);
if (uidl.hasAttribute("error")) {
if (errorIndicatorElement == null) {
diff --git a/src/com/vaadin/terminal/gwt/client/ui/VEmbedded.java b/src/com/vaadin/terminal/gwt/client/ui/VEmbedded.java
index ffd09dab2c..49b3123bbf 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/VEmbedded.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/VEmbedded.java
@@ -153,7 +153,7 @@ public class VEmbedded extends HTML implements Paintable {
// Add the parameters to the Embed
for (String name : parameters.keySet()) {
html += escapeAttribute(name) + "=\""
- + escapeAttribute(parameters.get(name)) + "\" ";
+ + escapeAttribute(parameters.get(name)) + "\" ";
}
html += "></embed></object>";
diff --git a/src/com/vaadin/terminal/gwt/client/ui/VHorizontalLayout.java b/src/com/vaadin/terminal/gwt/client/ui/VHorizontalLayout.java
index c9eed4e1be..9adc60014f 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/VHorizontalLayout.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/VHorizontalLayout.java
@@ -1,14 +1,14 @@
/*
@ITMillApache2LicenseForJavaFiles@
*/
-package com.vaadin.terminal.gwt.client.ui;
-
-public class VHorizontalLayout extends VOrderedLayout {
-
- public static final String CLASSNAME = "v-horizontallayout";
-
- public VHorizontalLayout() {
- super(CLASSNAME, ORIENTATION_HORIZONTAL);
- }
-
-}
+package com.vaadin.terminal.gwt.client.ui;
+
+public class VHorizontalLayout extends VOrderedLayout {
+
+ public static final String CLASSNAME = "v-horizontallayout";
+
+ public VHorizontalLayout() {
+ super(CLASSNAME, ORIENTATION_HORIZONTAL);
+ }
+
+}
diff --git a/src/com/vaadin/terminal/gwt/client/ui/VOptionGroup.java b/src/com/vaadin/terminal/gwt/client/ui/VOptionGroup.java
index f49cd5098b..b1d4730372 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/VOptionGroup.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/VOptionGroup.java
@@ -182,8 +182,7 @@ public class VOptionGroup extends VOptionGroupBase implements FocusHandler,
// check whether blurOccured still is true and then send the
// event out to the server
if (blurOccured) {
- client.updateVariable(id, EventId.BLUR, "",
- true);
+ client.updateVariable(id, EventId.BLUR, "", true);
blurOccured = false;
}
}
diff --git a/src/com/vaadin/terminal/gwt/client/ui/VOrderedLayout.java b/src/com/vaadin/terminal/gwt/client/ui/VOrderedLayout.java
index 4d1a19b937..9df038f93c 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/VOrderedLayout.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/VOrderedLayout.java
@@ -1,783 +1,783 @@
/*
@ITMillApache2LicenseForJavaFiles@
*/
-package com.vaadin.terminal.gwt.client.ui;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.Set;
-
-import com.google.gwt.core.client.JsArrayString;
-import com.google.gwt.event.dom.client.DomEvent.Type;
-import com.google.gwt.event.shared.EventHandler;
-import com.google.gwt.event.shared.HandlerRegistration;
-import com.google.gwt.user.client.Element;
-import com.google.gwt.user.client.ui.Widget;
-import com.vaadin.terminal.gwt.client.ApplicationConnection;
-import com.vaadin.terminal.gwt.client.BrowserInfo;
-import com.vaadin.terminal.gwt.client.Paintable;
-import com.vaadin.terminal.gwt.client.RenderSpace;
-import com.vaadin.terminal.gwt.client.UIDL;
-import com.vaadin.terminal.gwt.client.Util;
-import com.vaadin.terminal.gwt.client.ValueMap;
-import com.vaadin.terminal.gwt.client.RenderInformation.FloatSize;
-import com.vaadin.terminal.gwt.client.RenderInformation.Size;
-import com.vaadin.terminal.gwt.client.ui.layout.CellBasedLayout;
-import com.vaadin.terminal.gwt.client.ui.layout.ChildComponentContainer;
-
-public class VOrderedLayout extends CellBasedLayout {
-
- public static final String CLASSNAME = "v-orderedlayout";
-
- public static final String CLICK_EVENT_IDENTIFIER = "click";
-
- private int orientation;
-
+package com.vaadin.terminal.gwt.client.ui;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.Set;
+
+import com.google.gwt.core.client.JsArrayString;
+import com.google.gwt.event.dom.client.DomEvent.Type;
+import com.google.gwt.event.shared.EventHandler;
+import com.google.gwt.event.shared.HandlerRegistration;
+import com.google.gwt.user.client.Element;
+import com.google.gwt.user.client.ui.Widget;
+import com.vaadin.terminal.gwt.client.ApplicationConnection;
+import com.vaadin.terminal.gwt.client.BrowserInfo;
+import com.vaadin.terminal.gwt.client.Paintable;
+import com.vaadin.terminal.gwt.client.RenderSpace;
+import com.vaadin.terminal.gwt.client.UIDL;
+import com.vaadin.terminal.gwt.client.Util;
+import com.vaadin.terminal.gwt.client.ValueMap;
+import com.vaadin.terminal.gwt.client.RenderInformation.FloatSize;
+import com.vaadin.terminal.gwt.client.RenderInformation.Size;
+import com.vaadin.terminal.gwt.client.ui.layout.CellBasedLayout;
+import com.vaadin.terminal.gwt.client.ui.layout.ChildComponentContainer;
+
+public class VOrderedLayout extends CellBasedLayout {
+
+ public static final String CLASSNAME = "v-orderedlayout";
+
+ public static final String CLICK_EVENT_IDENTIFIER = "click";
+
+ private int orientation;
+
// Can be removed once OrderedLayout is removed
- private boolean allowOrientationUpdate = false;
-
- /**
- * Size of the layout excluding any margins.
- */
- private Size activeLayoutSize = new Size(0, 0);
-
- private boolean isRendering = false;
-
- private String width = "";
-
- private boolean sizeHasChangedDuringRendering = false;
-
- private ValueMap expandRatios;
-
- private double expandRatioSum;
-
- private double defaultExpandRatio;
-
- private ValueMap alignments;
-
- private LayoutClickEventHandler clickEventHandler = new LayoutClickEventHandler(
- this, CLICK_EVENT_IDENTIFIER) {
-
- @Override
- protected Paintable getChildComponent(Element element) {
- return getComponent(element);
- }
-
- @Override
- protected <H extends EventHandler> HandlerRegistration registerHandler(
- H handler, Type<H> type) {
- return addDomHandler(handler, type);
- }
- };
-
- public VOrderedLayout() {
- this(CLASSNAME, ORIENTATION_VERTICAL);
- allowOrientationUpdate = true;
- }
-
- protected VOrderedLayout(String className, int orientation) {
- setStyleName(className);
- this.orientation = orientation;
-
- STYLENAME_SPACING = className + "-spacing";
- STYLENAME_MARGIN_TOP = className + "-margin-top";
- STYLENAME_MARGIN_RIGHT = className + "-margin-right";
- STYLENAME_MARGIN_BOTTOM = className + "-margin-bottom";
- STYLENAME_MARGIN_LEFT = className + "-margin-left";
- }
-
- @Override
- public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {
- isRendering = true;
- super.updateFromUIDL(uidl, client);
-
+ private boolean allowOrientationUpdate = false;
+
+ /**
+ * Size of the layout excluding any margins.
+ */
+ private Size activeLayoutSize = new Size(0, 0);
+
+ private boolean isRendering = false;
+
+ private String width = "";
+
+ private boolean sizeHasChangedDuringRendering = false;
+
+ private ValueMap expandRatios;
+
+ private double expandRatioSum;
+
+ private double defaultExpandRatio;
+
+ private ValueMap alignments;
+
+ private LayoutClickEventHandler clickEventHandler = new LayoutClickEventHandler(
+ this, CLICK_EVENT_IDENTIFIER) {
+
+ @Override
+ protected Paintable getChildComponent(Element element) {
+ return getComponent(element);
+ }
+
+ @Override
+ protected <H extends EventHandler> HandlerRegistration registerHandler(
+ H handler, Type<H> type) {
+ return addDomHandler(handler, type);
+ }
+ };
+
+ public VOrderedLayout() {
+ this(CLASSNAME, ORIENTATION_VERTICAL);
+ allowOrientationUpdate = true;
+ }
+
+ protected VOrderedLayout(String className, int orientation) {
+ setStyleName(className);
+ this.orientation = orientation;
+
+ STYLENAME_SPACING = className + "-spacing";
+ STYLENAME_MARGIN_TOP = className + "-margin-top";
+ STYLENAME_MARGIN_RIGHT = className + "-margin-right";
+ STYLENAME_MARGIN_BOTTOM = className + "-margin-bottom";
+ STYLENAME_MARGIN_LEFT = className + "-margin-left";
+ }
+
+ @Override
+ public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {
+ isRendering = true;
+ super.updateFromUIDL(uidl, client);
+
// Only non-cached, visible UIDL:s can introduce changes
- if (uidl.getBooleanAttribute("cached")
- || uidl.getBooleanAttribute("invisible")) {
- isRendering = false;
- return;
- }
-
- clickEventHandler.handleEventHandlerRegistration(client);
-
- if (allowOrientationUpdate) {
- handleOrientationUpdate(uidl);
- }
-
+ if (uidl.getBooleanAttribute("cached")
+ || uidl.getBooleanAttribute("invisible")) {
+ isRendering = false;
+ return;
+ }
+
+ clickEventHandler.handleEventHandlerRegistration(client);
+
+ if (allowOrientationUpdate) {
+ handleOrientationUpdate(uidl);
+ }
+
// IStopWatch w = new IStopWatch("OrderedLayout.updateFromUIDL");
-
- ArrayList<Widget> uidlWidgets = new ArrayList<Widget>(uidl
- .getChildCount());
- ArrayList<ChildComponentContainer> relativeSizeComponents = new ArrayList<ChildComponentContainer>();
- ArrayList<UIDL> relativeSizeComponentUIDL = new ArrayList<UIDL>();
-
- int pos = 0;
- for (final Iterator<Object> it = uidl.getChildIterator(); it.hasNext();) {
- final UIDL childUIDL = (UIDL) it.next();
- final Paintable child = client.getPaintable(childUIDL);
- Widget widget = (Widget) child;
-
+
+ ArrayList<Widget> uidlWidgets = new ArrayList<Widget>(uidl
+ .getChildCount());
+ ArrayList<ChildComponentContainer> relativeSizeComponents = new ArrayList<ChildComponentContainer>();
+ ArrayList<UIDL> relativeSizeComponentUIDL = new ArrayList<UIDL>();
+
+ int pos = 0;
+ for (final Iterator<Object> it = uidl.getChildIterator(); it.hasNext();) {
+ final UIDL childUIDL = (UIDL) it.next();
+ final Paintable child = client.getPaintable(childUIDL);
+ Widget widget = (Widget) child;
+
// Create container for component
- ChildComponentContainer childComponentContainer = getComponentContainer(widget);
-
- if (childComponentContainer == null) {
+ ChildComponentContainer childComponentContainer = getComponentContainer(widget);
+
+ if (childComponentContainer == null) {
// This is a new component
- childComponentContainer = createChildContainer(widget);
- }
-
- addOrMoveChild(childComponentContainer, pos++);
-
- /*
- * Components which are to be expanded in the same orientation as
- * the layout are rendered later when it is clear how much space
- * they can use
- */
- if (!Util.isCached(childUIDL)) {
- FloatSize relativeSize = Util.parseRelativeSize(childUIDL);
- childComponentContainer.setRelativeSize(relativeSize);
- }
-
- if (childComponentContainer.isComponentRelativeSized(orientation)) {
- relativeSizeComponents.add(childComponentContainer);
- relativeSizeComponentUIDL.add(childUIDL);
- } else {
- if (isDynamicWidth()) {
- childComponentContainer.renderChild(childUIDL, client, -1);
- } else {
- childComponentContainer.renderChild(childUIDL, client,
- activeLayoutSize.getWidth());
- }
- if (sizeHasChangedDuringRendering && Util.isCached(childUIDL)) {
+ childComponentContainer = createChildContainer(widget);
+ }
+
+ addOrMoveChild(childComponentContainer, pos++);
+
+ /*
+ * Components which are to be expanded in the same orientation as
+ * the layout are rendered later when it is clear how much space
+ * they can use
+ */
+ if (!Util.isCached(childUIDL)) {
+ FloatSize relativeSize = Util.parseRelativeSize(childUIDL);
+ childComponentContainer.setRelativeSize(relativeSize);
+ }
+
+ if (childComponentContainer.isComponentRelativeSized(orientation)) {
+ relativeSizeComponents.add(childComponentContainer);
+ relativeSizeComponentUIDL.add(childUIDL);
+ } else {
+ if (isDynamicWidth()) {
+ childComponentContainer.renderChild(childUIDL, client, -1);
+ } else {
+ childComponentContainer.renderChild(childUIDL, client,
+ activeLayoutSize.getWidth());
+ }
+ if (sizeHasChangedDuringRendering && Util.isCached(childUIDL)) {
// notify cached relative sized component about size
// chance
- client.handleComponentRelativeSize(childComponentContainer
- .getWidget());
- }
- }
-
- uidlWidgets.add(widget);
-
- }
-
+ client.handleComponentRelativeSize(childComponentContainer
+ .getWidget());
+ }
+ }
+
+ uidlWidgets.add(widget);
+
+ }
+
// w.mark("Rendering of "
// + (uidlWidgets.size() - relativeSizeComponents.size())
// + " absolute size components done");
-
- /*
- * Remove any children after pos. These are the ones that previously
- * were in the layout but have now been removed
- */
- removeChildrenAfter(pos);
-
+
+ /*
+ * Remove any children after pos. These are the ones that previously
+ * were in the layout but have now been removed
+ */
+ removeChildrenAfter(pos);
+
// w.mark("Old children removed");
-
- /* Fetch alignments and expand ratio from UIDL */
- updateAlignmentsAndExpandRatios(uidl, uidlWidgets);
+
+ /* Fetch alignments and expand ratio from UIDL */
+ updateAlignmentsAndExpandRatios(uidl, uidlWidgets);
// w.mark("Alignments and expand ratios updated");
-
- /* Fetch widget sizes from rendered components */
- updateWidgetSizes();
+
+ /* Fetch widget sizes from rendered components */
+ updateWidgetSizes();
// w.mark("Widget sizes updated");
-
- recalculateLayout();
+
+ recalculateLayout();
// w.mark("Layout size calculated (" + activeLayoutSize +
// ") offsetSize: "
// + getOffsetWidth() + "," + getOffsetHeight());
-
- /* Render relative size components */
- for (int i = 0; i < relativeSizeComponents.size(); i++) {
- ChildComponentContainer childComponentContainer = relativeSizeComponents
- .get(i);
- UIDL childUIDL = relativeSizeComponentUIDL.get(i);
-
- if (isDynamicWidth()) {
- childComponentContainer.renderChild(childUIDL, client, -1);
- } else {
- childComponentContainer.renderChild(childUIDL, client,
- activeLayoutSize.getWidth());
- }
-
- if (Util.isCached(childUIDL)) {
- /*
- * We must update the size of the relative sized component if
- * the expand ratio or something else in the layout changes
- * which affects the size of a relative sized component
- */
- client.handleComponentRelativeSize(childComponentContainer
- .getWidget());
- }
-
+
+ /* Render relative size components */
+ for (int i = 0; i < relativeSizeComponents.size(); i++) {
+ ChildComponentContainer childComponentContainer = relativeSizeComponents
+ .get(i);
+ UIDL childUIDL = relativeSizeComponentUIDL.get(i);
+
+ if (isDynamicWidth()) {
+ childComponentContainer.renderChild(childUIDL, client, -1);
+ } else {
+ childComponentContainer.renderChild(childUIDL, client,
+ activeLayoutSize.getWidth());
+ }
+
+ if (Util.isCached(childUIDL)) {
+ /*
+ * We must update the size of the relative sized component if
+ * the expand ratio or something else in the layout changes
+ * which affects the size of a relative sized component
+ */
+ client.handleComponentRelativeSize(childComponentContainer
+ .getWidget());
+ }
+
// childComponentContainer.updateWidgetSize();
- }
-
+ }
+
// w.mark("Rendering of " + (relativeSizeComponents.size())
// + " relative size components done");
-
- /* Fetch widget sizes for relative size components */
- for (ChildComponentContainer childComponentContainer : widgetToComponentContainer
- .values()) {
-
- /* Update widget size from DOM */
- childComponentContainer.updateWidgetSize();
- }
-
+
+ /* Fetch widget sizes for relative size components */
+ for (ChildComponentContainer childComponentContainer : widgetToComponentContainer
+ .values()) {
+
+ /* Update widget size from DOM */
+ childComponentContainer.updateWidgetSize();
+ }
+
// w.mark("Widget sizes updated");
-
- /*
- * Components with relative size in main direction may affect the layout
- * size in the other direction
- */
- if ((isHorizontal() && isDynamicHeight())
- || (isVertical() && isDynamicWidth())) {
- layoutSizeMightHaveChanged();
- }
+
+ /*
+ * Components with relative size in main direction may affect the layout
+ * size in the other direction
+ */
+ if ((isHorizontal() && isDynamicHeight())
+ || (isVertical() && isDynamicWidth())) {
+ layoutSizeMightHaveChanged();
+ }
// w.mark("Layout dimensions updated");
-
- /* Update component spacing */
- updateContainerMargins();
-
- /*
- * Update component sizes for components with relative size in non-main
- * direction
- */
- if (updateRelativeSizesInNonMainDirection()) {
+
+ /* Update component spacing */
+ updateContainerMargins();
+
+ /*
+ * Update component sizes for components with relative size in non-main
+ * direction
+ */
+ if (updateRelativeSizesInNonMainDirection()) {
// Sizes updated - might affect the other dimension so we need to
// recheck the widget sizes and recalculate layout dimensions
- updateWidgetSizes();
- layoutSizeMightHaveChanged();
- }
- calculateAlignments();
+ updateWidgetSizes();
+ layoutSizeMightHaveChanged();
+ }
+ calculateAlignments();
// w.mark("recalculateComponentSizesAndAlignments done");
-
- setRootSize();
-
- if (BrowserInfo.get().isIE()) {
- /*
- * This should fix the issue with padding not always taken into
- * account for the containers leading to no spacing between
- * elements.
- */
- root.getStyle().setProperty("zoom", "1");
- }
-
+
+ setRootSize();
+
+ if (BrowserInfo.get().isIE()) {
+ /*
+ * This should fix the issue with padding not always taken into
+ * account for the containers leading to no spacing between
+ * elements.
+ */
+ root.getStyle().setProperty("zoom", "1");
+ }
+
// w.mark("runDescendentsLayout done");
- isRendering = false;
- sizeHasChangedDuringRendering = false;
- }
-
- private void layoutSizeMightHaveChanged() {
- Size oldSize = new Size(activeLayoutSize.getWidth(), activeLayoutSize
- .getHeight());
- calculateLayoutDimensions();
-
- /*
- * If layout dimension changes we must also update container sizes
- */
- if (!oldSize.equals(activeLayoutSize)) {
- calculateContainerSize();
- }
- }
-
- private void updateWidgetSizes() {
- for (ChildComponentContainer childComponentContainer : widgetToComponentContainer
- .values()) {
-
- /*
- * Update widget size from DOM
- */
- childComponentContainer.updateWidgetSize();
- }
- }
-
- private void recalculateLayout() {
-
- /* Calculate space for relative size components */
- int spaceForExpansion = calculateLayoutDimensions();
-
- if (!widgetToComponentContainer.isEmpty()) {
- /* Divide expansion space between component containers */
- expandComponentContainers(spaceForExpansion);
-
- /* Update container sizes */
- calculateContainerSize();
- }
-
- }
-
- private void expandComponentContainers(int spaceForExpansion) {
- int remaining = spaceForExpansion;
- for (ChildComponentContainer childComponentContainer : widgetToComponentContainer
- .values()) {
- remaining -= childComponentContainer.expand(orientation,
- spaceForExpansion);
- }
-
- if (remaining > 0) {
-
+ isRendering = false;
+ sizeHasChangedDuringRendering = false;
+ }
+
+ private void layoutSizeMightHaveChanged() {
+ Size oldSize = new Size(activeLayoutSize.getWidth(), activeLayoutSize
+ .getHeight());
+ calculateLayoutDimensions();
+
+ /*
+ * If layout dimension changes we must also update container sizes
+ */
+ if (!oldSize.equals(activeLayoutSize)) {
+ calculateContainerSize();
+ }
+ }
+
+ private void updateWidgetSizes() {
+ for (ChildComponentContainer childComponentContainer : widgetToComponentContainer
+ .values()) {
+
+ /*
+ * Update widget size from DOM
+ */
+ childComponentContainer.updateWidgetSize();
+ }
+ }
+
+ private void recalculateLayout() {
+
+ /* Calculate space for relative size components */
+ int spaceForExpansion = calculateLayoutDimensions();
+
+ if (!widgetToComponentContainer.isEmpty()) {
+ /* Divide expansion space between component containers */
+ expandComponentContainers(spaceForExpansion);
+
+ /* Update container sizes */
+ calculateContainerSize();
+ }
+
+ }
+
+ private void expandComponentContainers(int spaceForExpansion) {
+ int remaining = spaceForExpansion;
+ for (ChildComponentContainer childComponentContainer : widgetToComponentContainer
+ .values()) {
+ remaining -= childComponentContainer.expand(orientation,
+ spaceForExpansion);
+ }
+
+ if (remaining > 0) {
+
// Some left-over pixels due to rounding errors
-
+
// Add one pixel to each container until there are no pixels left
// FIXME extra pixels should be divided among expanded widgets if
// such a widgets exists
-
- Iterator<Widget> widgetIterator = iterator();
- while (widgetIterator.hasNext() && remaining-- > 0) {
- ChildComponentContainer childComponentContainer = (ChildComponentContainer) widgetIterator
- .next();
- childComponentContainer.expandExtra(orientation, 1);
- }
- }
-
- }
-
- private void handleOrientationUpdate(UIDL uidl) {
- int newOrientation = ORIENTATION_VERTICAL;
- if ("horizontal".equals(uidl.getStringAttribute("orientation"))) {
- newOrientation = ORIENTATION_HORIZONTAL;
- }
-
- if (orientation != newOrientation) {
- orientation = newOrientation;
-
- for (ChildComponentContainer childComponentContainer : widgetToComponentContainer
- .values()) {
- childComponentContainer.setOrientation(orientation);
- }
- }
-
- }
-
- /**
- * Updated components with relative height in horizontal layouts and
- * components with relative width in vertical layouts. This is only needed
- * if the height (horizontal layout) or width (vertical layout) has not been
- * specified.
- */
- private boolean updateRelativeSizesInNonMainDirection() {
- int updateDirection = 1 - orientation;
- if ((updateDirection == ORIENTATION_HORIZONTAL && !isDynamicWidth())
- || (updateDirection == ORIENTATION_VERTICAL && !isDynamicHeight())) {
- return false;
- }
-
- boolean updated = false;
- for (ChildComponentContainer componentContainer : widgetToComponentContainer
- .values()) {
- if (componentContainer.isComponentRelativeSized(updateDirection)) {
- client.handleComponentRelativeSize(componentContainer
- .getWidget());
- }
-
- updated = true;
- }
-
- return updated;
- }
-
- private int calculateLayoutDimensions() {
- int summedWidgetWidth = 0;
- int summedWidgetHeight = 0;
-
- int maxWidgetWidth = 0;
- int maxWidgetHeight = 0;
-
+
+ Iterator<Widget> widgetIterator = iterator();
+ while (widgetIterator.hasNext() && remaining-- > 0) {
+ ChildComponentContainer childComponentContainer = (ChildComponentContainer) widgetIterator
+ .next();
+ childComponentContainer.expandExtra(orientation, 1);
+ }
+ }
+
+ }
+
+ private void handleOrientationUpdate(UIDL uidl) {
+ int newOrientation = ORIENTATION_VERTICAL;
+ if ("horizontal".equals(uidl.getStringAttribute("orientation"))) {
+ newOrientation = ORIENTATION_HORIZONTAL;
+ }
+
+ if (orientation != newOrientation) {
+ orientation = newOrientation;
+
+ for (ChildComponentContainer childComponentContainer : widgetToComponentContainer
+ .values()) {
+ childComponentContainer.setOrientation(orientation);
+ }
+ }
+
+ }
+
+ /**
+ * Updated components with relative height in horizontal layouts and
+ * components with relative width in vertical layouts. This is only needed
+ * if the height (horizontal layout) or width (vertical layout) has not been
+ * specified.
+ */
+ private boolean updateRelativeSizesInNonMainDirection() {
+ int updateDirection = 1 - orientation;
+ if ((updateDirection == ORIENTATION_HORIZONTAL && !isDynamicWidth())
+ || (updateDirection == ORIENTATION_VERTICAL && !isDynamicHeight())) {
+ return false;
+ }
+
+ boolean updated = false;
+ for (ChildComponentContainer componentContainer : widgetToComponentContainer
+ .values()) {
+ if (componentContainer.isComponentRelativeSized(updateDirection)) {
+ client.handleComponentRelativeSize(componentContainer
+ .getWidget());
+ }
+
+ updated = true;
+ }
+
+ return updated;
+ }
+
+ private int calculateLayoutDimensions() {
+ int summedWidgetWidth = 0;
+ int summedWidgetHeight = 0;
+
+ int maxWidgetWidth = 0;
+ int maxWidgetHeight = 0;
+
// Calculate layout dimensions from component dimensions
- for (ChildComponentContainer childComponentContainer : widgetToComponentContainer
- .values()) {
-
- int widgetHeight = 0;
- int widgetWidth = 0;
- if (childComponentContainer.isComponentRelativeSized(orientation)) {
- if (orientation == ORIENTATION_HORIZONTAL) {
- widgetHeight = getWidgetHeight(childComponentContainer);
- } else {
- widgetWidth = getWidgetWidth(childComponentContainer);
- }
- } else {
- widgetWidth = getWidgetWidth(childComponentContainer);
- widgetHeight = getWidgetHeight(childComponentContainer);
- }
-
- summedWidgetWidth += widgetWidth;
- summedWidgetHeight += widgetHeight;
-
- maxWidgetHeight = Math.max(maxWidgetHeight, widgetHeight);
- maxWidgetWidth = Math.max(maxWidgetWidth, widgetWidth);
- }
-
- if (isHorizontal()) {
- summedWidgetWidth += activeSpacing.hSpacing
- * (widgetToComponentContainer.size() - 1);
- } else {
- summedWidgetHeight += activeSpacing.vSpacing
- * (widgetToComponentContainer.size() - 1);
- }
-
- Size layoutSize = updateLayoutDimensions(summedWidgetWidth,
- summedWidgetHeight, maxWidgetWidth, maxWidgetHeight);
-
- int remainingSpace;
- if (isHorizontal()) {
- remainingSpace = layoutSize.getWidth() - summedWidgetWidth;
- } else {
- remainingSpace = layoutSize.getHeight() - summedWidgetHeight;
- }
- if (remainingSpace < 0) {
- remainingSpace = 0;
- }
-
+ for (ChildComponentContainer childComponentContainer : widgetToComponentContainer
+ .values()) {
+
+ int widgetHeight = 0;
+ int widgetWidth = 0;
+ if (childComponentContainer.isComponentRelativeSized(orientation)) {
+ if (orientation == ORIENTATION_HORIZONTAL) {
+ widgetHeight = getWidgetHeight(childComponentContainer);
+ } else {
+ widgetWidth = getWidgetWidth(childComponentContainer);
+ }
+ } else {
+ widgetWidth = getWidgetWidth(childComponentContainer);
+ widgetHeight = getWidgetHeight(childComponentContainer);
+ }
+
+ summedWidgetWidth += widgetWidth;
+ summedWidgetHeight += widgetHeight;
+
+ maxWidgetHeight = Math.max(maxWidgetHeight, widgetHeight);
+ maxWidgetWidth = Math.max(maxWidgetWidth, widgetWidth);
+ }
+
+ if (isHorizontal()) {
+ summedWidgetWidth += activeSpacing.hSpacing
+ * (widgetToComponentContainer.size() - 1);
+ } else {
+ summedWidgetHeight += activeSpacing.vSpacing
+ * (widgetToComponentContainer.size() - 1);
+ }
+
+ Size layoutSize = updateLayoutDimensions(summedWidgetWidth,
+ summedWidgetHeight, maxWidgetWidth, maxWidgetHeight);
+
+ int remainingSpace;
+ if (isHorizontal()) {
+ remainingSpace = layoutSize.getWidth() - summedWidgetWidth;
+ } else {
+ remainingSpace = layoutSize.getHeight() - summedWidgetHeight;
+ }
+ if (remainingSpace < 0) {
+ remainingSpace = 0;
+ }
+
// ApplicationConnection.getConsole().log(
// "Layout size: " + activeLayoutSize);
- return remainingSpace;
- }
-
- private int getWidgetHeight(ChildComponentContainer childComponentContainer) {
- Size s = childComponentContainer.getWidgetSize();
- return s.getHeight()
- + childComponentContainer.getCaptionHeightAboveComponent();
- }
-
- private int getWidgetWidth(ChildComponentContainer childComponentContainer) {
- Size s = childComponentContainer.getWidgetSize();
- int widgetWidth = s.getWidth()
- + childComponentContainer.getCaptionWidthAfterComponent();
-
- /*
- * If the component does not have a specified size in the main direction
- * the caption may determine the space used by the component
- */
- if (!childComponentContainer.widgetHasSizeSpecified(orientation)) {
- int captionWidth = childComponentContainer
- .getCaptionRequiredWidth();
-
- if (captionWidth > widgetWidth) {
- widgetWidth = captionWidth;
- }
- }
-
- return widgetWidth;
- }
-
- private void calculateAlignments() {
- int w = 0;
- int h = 0;
-
- if (isHorizontal()) {
+ return remainingSpace;
+ }
+
+ private int getWidgetHeight(ChildComponentContainer childComponentContainer) {
+ Size s = childComponentContainer.getWidgetSize();
+ return s.getHeight()
+ + childComponentContainer.getCaptionHeightAboveComponent();
+ }
+
+ private int getWidgetWidth(ChildComponentContainer childComponentContainer) {
+ Size s = childComponentContainer.getWidgetSize();
+ int widgetWidth = s.getWidth()
+ + childComponentContainer.getCaptionWidthAfterComponent();
+
+ /*
+ * If the component does not have a specified size in the main direction
+ * the caption may determine the space used by the component
+ */
+ if (!childComponentContainer.widgetHasSizeSpecified(orientation)) {
+ int captionWidth = childComponentContainer
+ .getCaptionRequiredWidth();
+
+ if (captionWidth > widgetWidth) {
+ widgetWidth = captionWidth;
+ }
+ }
+
+ return widgetWidth;
+ }
+
+ private void calculateAlignments() {
+ int w = 0;
+ int h = 0;
+
+ if (isHorizontal()) {
// HORIZONTAL
- h = activeLayoutSize.getHeight();
- if (!isDynamicWidth()) {
- w = -1;
- }
-
- } else {
+ h = activeLayoutSize.getHeight();
+ if (!isDynamicWidth()) {
+ w = -1;
+ }
+
+ } else {
// VERTICAL
- w = activeLayoutSize.getWidth();
- if (!isDynamicHeight()) {
- h = -1;
- }
- }
-
- for (ChildComponentContainer childComponentContainer : widgetToComponentContainer
- .values()) {
- childComponentContainer.updateAlignments(w, h);
- }
-
- }
-
- private void calculateContainerSize() {
-
- /*
- * Container size here means the size the container gets from the
- * component. The expansion size is not include in this but taken
- * separately into account.
- */
- int height = 0, width = 0;
- Iterator<Widget> widgetIterator = iterator();
- if (isHorizontal()) {
- height = activeLayoutSize.getHeight();
- int availableWidth = activeLayoutSize.getWidth();
- boolean first = true;
- while (widgetIterator.hasNext()) {
- ChildComponentContainer childComponentContainer = (ChildComponentContainer) widgetIterator
- .next();
- if (!childComponentContainer
- .isComponentRelativeSized(ORIENTATION_HORIZONTAL)) {
- /*
- * Only components with non-relative size in the main
- * direction has a container size
- */
- width = childComponentContainer.getWidgetSize().getWidth()
- + childComponentContainer
- .getCaptionWidthAfterComponent();
-
- /*
- * If the component does not have a specified size in the
- * main direction the caption may determine the space used
- * by the component
- */
- if (!childComponentContainer
- .widgetHasSizeSpecified(orientation)) {
- int captionWidth = childComponentContainer
- .getCaptionRequiredWidth();
+ w = activeLayoutSize.getWidth();
+ if (!isDynamicHeight()) {
+ h = -1;
+ }
+ }
+
+ for (ChildComponentContainer childComponentContainer : widgetToComponentContainer
+ .values()) {
+ childComponentContainer.updateAlignments(w, h);
+ }
+
+ }
+
+ private void calculateContainerSize() {
+
+ /*
+ * Container size here means the size the container gets from the
+ * component. The expansion size is not include in this but taken
+ * separately into account.
+ */
+ int height = 0, width = 0;
+ Iterator<Widget> widgetIterator = iterator();
+ if (isHorizontal()) {
+ height = activeLayoutSize.getHeight();
+ int availableWidth = activeLayoutSize.getWidth();
+ boolean first = true;
+ while (widgetIterator.hasNext()) {
+ ChildComponentContainer childComponentContainer = (ChildComponentContainer) widgetIterator
+ .next();
+ if (!childComponentContainer
+ .isComponentRelativeSized(ORIENTATION_HORIZONTAL)) {
+ /*
+ * Only components with non-relative size in the main
+ * direction has a container size
+ */
+ width = childComponentContainer.getWidgetSize().getWidth()
+ + childComponentContainer
+ .getCaptionWidthAfterComponent();
+
+ /*
+ * If the component does not have a specified size in the
+ * main direction the caption may determine the space used
+ * by the component
+ */
+ if (!childComponentContainer
+ .widgetHasSizeSpecified(orientation)) {
+ int captionWidth = childComponentContainer
+ .getCaptionRequiredWidth();
// ApplicationConnection.getConsole().log(
// "Component width: " + width
// + ", caption width: " + captionWidth);
- if (captionWidth > width) {
- width = captionWidth;
- }
- }
- } else {
- width = 0;
- }
-
- if (!isDynamicWidth()) {
- if (availableWidth == 0) {
- /*
- * Let the overflowing components overflow. IE has
- * problems with zero sizes.
- */
+ if (captionWidth > width) {
+ width = captionWidth;
+ }
+ }
+ } else {
+ width = 0;
+ }
+
+ if (!isDynamicWidth()) {
+ if (availableWidth == 0) {
+ /*
+ * Let the overflowing components overflow. IE has
+ * problems with zero sizes.
+ */
// width = 0;
// height = 0;
- } else if (width > availableWidth) {
- width = availableWidth;
-
- if (!first) {
- width -= activeSpacing.hSpacing;
- }
- availableWidth = 0;
- } else {
- availableWidth -= width;
- if (!first) {
- availableWidth -= activeSpacing.hSpacing;
- }
- }
-
- first = false;
- }
-
- childComponentContainer.setContainerSize(width, height);
- }
- } else {
- width = activeLayoutSize.getWidth();
- while (widgetIterator.hasNext()) {
- ChildComponentContainer childComponentContainer = (ChildComponentContainer) widgetIterator
- .next();
-
- if (!childComponentContainer
- .isComponentRelativeSized(ORIENTATION_VERTICAL)) {
- /*
- * Only components with non-relative size in the main
- * direction has a container size
- */
- height = childComponentContainer.getWidgetSize()
- .getHeight()
- + childComponentContainer
- .getCaptionHeightAboveComponent();
- } else {
- height = 0;
- }
-
- childComponentContainer.setContainerSize(width, height);
- }
-
- }
-
- }
-
- private Size updateLayoutDimensions(int totalComponentWidth,
- int totalComponentHeight, int maxComponentWidth,
- int maxComponentHeight) {
-
- /* Only need to calculate dynamic dimensions */
- if (!isDynamicHeight() && !isDynamicWidth()) {
- return activeLayoutSize;
- }
-
- int activeLayoutWidth = 0;
- int activeLayoutHeight = 0;
-
+ } else if (width > availableWidth) {
+ width = availableWidth;
+
+ if (!first) {
+ width -= activeSpacing.hSpacing;
+ }
+ availableWidth = 0;
+ } else {
+ availableWidth -= width;
+ if (!first) {
+ availableWidth -= activeSpacing.hSpacing;
+ }
+ }
+
+ first = false;
+ }
+
+ childComponentContainer.setContainerSize(width, height);
+ }
+ } else {
+ width = activeLayoutSize.getWidth();
+ while (widgetIterator.hasNext()) {
+ ChildComponentContainer childComponentContainer = (ChildComponentContainer) widgetIterator
+ .next();
+
+ if (!childComponentContainer
+ .isComponentRelativeSized(ORIENTATION_VERTICAL)) {
+ /*
+ * Only components with non-relative size in the main
+ * direction has a container size
+ */
+ height = childComponentContainer.getWidgetSize()
+ .getHeight()
+ + childComponentContainer
+ .getCaptionHeightAboveComponent();
+ } else {
+ height = 0;
+ }
+
+ childComponentContainer.setContainerSize(width, height);
+ }
+
+ }
+
+ }
+
+ private Size updateLayoutDimensions(int totalComponentWidth,
+ int totalComponentHeight, int maxComponentWidth,
+ int maxComponentHeight) {
+
+ /* Only need to calculate dynamic dimensions */
+ if (!isDynamicHeight() && !isDynamicWidth()) {
+ return activeLayoutSize;
+ }
+
+ int activeLayoutWidth = 0;
+ int activeLayoutHeight = 0;
+
// Update layout dimensions
- if (isHorizontal()) {
+ if (isHorizontal()) {
// Horizontal
- if (isDynamicWidth()) {
- activeLayoutWidth = totalComponentWidth;
- }
-
- if (isDynamicHeight()) {
- activeLayoutHeight = maxComponentHeight;
- }
-
- } else {
+ if (isDynamicWidth()) {
+ activeLayoutWidth = totalComponentWidth;
+ }
+
+ if (isDynamicHeight()) {
+ activeLayoutHeight = maxComponentHeight;
+ }
+
+ } else {
// Vertical
- if (isDynamicWidth()) {
- activeLayoutWidth = maxComponentWidth;
- }
-
- if (isDynamicHeight()) {
- activeLayoutHeight = totalComponentHeight;
- }
- }
-
- if (isDynamicWidth()) {
- setActiveLayoutWidth(activeLayoutWidth);
- setOuterLayoutWidth(activeLayoutSize.getWidth());
- }
-
- if (isDynamicHeight()) {
- setActiveLayoutHeight(activeLayoutHeight);
- setOuterLayoutHeight(activeLayoutSize.getHeight());
- }
-
- return activeLayoutSize;
- }
-
- private void setActiveLayoutWidth(int activeLayoutWidth) {
- if (activeLayoutWidth < 0) {
- activeLayoutWidth = 0;
- }
- activeLayoutSize.setWidth(activeLayoutWidth);
- }
-
- private void setActiveLayoutHeight(int activeLayoutHeight) {
- if (activeLayoutHeight < 0) {
- activeLayoutHeight = 0;
- }
- activeLayoutSize.setHeight(activeLayoutHeight);
-
- }
-
- private void setOuterLayoutWidth(int activeLayoutWidth) {
- super.setWidth((activeLayoutWidth + activeMargins.getHorizontal())
- + "px");
-
- }
-
- private void setOuterLayoutHeight(int activeLayoutHeight) {
- super.setHeight((activeLayoutHeight + activeMargins.getVertical())
- + "px");
-
- }
-
- /**
- * Updates the spacing between components. Needs to be done only when
- * components are added/removed.
- */
- private void updateContainerMargins() {
- ChildComponentContainer firstChildComponent = getFirstChildComponentContainer();
- if (firstChildComponent != null) {
- firstChildComponent.setMarginLeft(0);
- firstChildComponent.setMarginTop(0);
-
- for (ChildComponentContainer childComponent : widgetToComponentContainer
- .values()) {
- if (childComponent == firstChildComponent) {
- continue;
- }
-
- if (isHorizontal()) {
- childComponent.setMarginLeft(activeSpacing.hSpacing);
- } else {
- childComponent.setMarginTop(activeSpacing.vSpacing);
- }
- }
- }
- }
-
- private boolean isHorizontal() {
- return orientation == ORIENTATION_HORIZONTAL;
- }
-
- private boolean isVertical() {
- return orientation == ORIENTATION_VERTICAL;
- }
-
- private ChildComponentContainer createChildContainer(Widget child) {
-
+ if (isDynamicWidth()) {
+ activeLayoutWidth = maxComponentWidth;
+ }
+
+ if (isDynamicHeight()) {
+ activeLayoutHeight = totalComponentHeight;
+ }
+ }
+
+ if (isDynamicWidth()) {
+ setActiveLayoutWidth(activeLayoutWidth);
+ setOuterLayoutWidth(activeLayoutSize.getWidth());
+ }
+
+ if (isDynamicHeight()) {
+ setActiveLayoutHeight(activeLayoutHeight);
+ setOuterLayoutHeight(activeLayoutSize.getHeight());
+ }
+
+ return activeLayoutSize;
+ }
+
+ private void setActiveLayoutWidth(int activeLayoutWidth) {
+ if (activeLayoutWidth < 0) {
+ activeLayoutWidth = 0;
+ }
+ activeLayoutSize.setWidth(activeLayoutWidth);
+ }
+
+ private void setActiveLayoutHeight(int activeLayoutHeight) {
+ if (activeLayoutHeight < 0) {
+ activeLayoutHeight = 0;
+ }
+ activeLayoutSize.setHeight(activeLayoutHeight);
+
+ }
+
+ private void setOuterLayoutWidth(int activeLayoutWidth) {
+ super.setWidth((activeLayoutWidth + activeMargins.getHorizontal())
+ + "px");
+
+ }
+
+ private void setOuterLayoutHeight(int activeLayoutHeight) {
+ super.setHeight((activeLayoutHeight + activeMargins.getVertical())
+ + "px");
+
+ }
+
+ /**
+ * Updates the spacing between components. Needs to be done only when
+ * components are added/removed.
+ */
+ private void updateContainerMargins() {
+ ChildComponentContainer firstChildComponent = getFirstChildComponentContainer();
+ if (firstChildComponent != null) {
+ firstChildComponent.setMarginLeft(0);
+ firstChildComponent.setMarginTop(0);
+
+ for (ChildComponentContainer childComponent : widgetToComponentContainer
+ .values()) {
+ if (childComponent == firstChildComponent) {
+ continue;
+ }
+
+ if (isHorizontal()) {
+ childComponent.setMarginLeft(activeSpacing.hSpacing);
+ } else {
+ childComponent.setMarginTop(activeSpacing.vSpacing);
+ }
+ }
+ }
+ }
+
+ private boolean isHorizontal() {
+ return orientation == ORIENTATION_HORIZONTAL;
+ }
+
+ private boolean isVertical() {
+ return orientation == ORIENTATION_VERTICAL;
+ }
+
+ private ChildComponentContainer createChildContainer(Widget child) {
+
// Create a container DIV for the child
- ChildComponentContainer childComponent = new ChildComponentContainer(
- child, orientation);
-
- return childComponent;
-
- }
-
- public RenderSpace getAllocatedSpace(Widget child) {
- int width = 0;
- int height = 0;
- ChildComponentContainer childComponentContainer = getComponentContainer(child);
+ ChildComponentContainer childComponent = new ChildComponentContainer(
+ child, orientation);
+
+ return childComponent;
+
+ }
+
+ public RenderSpace getAllocatedSpace(Widget child) {
+ int width = 0;
+ int height = 0;
+ ChildComponentContainer childComponentContainer = getComponentContainer(child);
// WIDTH CALCULATION
- if (isVertical()) {
- width = activeLayoutSize.getWidth();
- width -= childComponentContainer.getCaptionWidthAfterComponent();
- } else if (!isDynamicWidth()) {
+ if (isVertical()) {
+ width = activeLayoutSize.getWidth();
+ width -= childComponentContainer.getCaptionWidthAfterComponent();
+ } else if (!isDynamicWidth()) {
// HORIZONTAL
- width = childComponentContainer.getContSize().getWidth();
- width -= childComponentContainer.getCaptionWidthAfterComponent();
- }
-
+ width = childComponentContainer.getContSize().getWidth();
+ width -= childComponentContainer.getCaptionWidthAfterComponent();
+ }
+
// HEIGHT CALCULATION
- if (isHorizontal()) {
- height = activeLayoutSize.getHeight();
- height -= childComponentContainer.getCaptionHeightAboveComponent();
- } else if (!isDynamicHeight()) {
+ if (isHorizontal()) {
+ height = activeLayoutSize.getHeight();
+ height -= childComponentContainer.getCaptionHeightAboveComponent();
+ } else if (!isDynamicHeight()) {
// VERTICAL
- height = childComponentContainer.getContSize().getHeight();
- height -= childComponentContainer.getCaptionHeightAboveComponent();
- }
-
+ height = childComponentContainer.getContSize().getHeight();
+ height -= childComponentContainer.getCaptionHeightAboveComponent();
+ }
+
// ApplicationConnection.getConsole().log(
// "allocatedSpace for " + Util.getSimpleName(child) + ": "
// + width + "," + height);
- RenderSpace space = new RenderSpace(width, height);
- return space;
- }
-
- private void recalculateLayoutAndComponentSizes() {
- recalculateLayout();
-
- if (!(isDynamicHeight() && isDynamicWidth())) {
- /* First update relative sized components */
- for (ChildComponentContainer componentContainer : widgetToComponentContainer
- .values()) {
- client.handleComponentRelativeSize(componentContainer
- .getWidget());
-
+ RenderSpace space = new RenderSpace(width, height);
+ return space;
+ }
+
+ private void recalculateLayoutAndComponentSizes() {
+ recalculateLayout();
+
+ if (!(isDynamicHeight() && isDynamicWidth())) {
+ /* First update relative sized components */
+ for (ChildComponentContainer componentContainer : widgetToComponentContainer
+ .values()) {
+ client.handleComponentRelativeSize(componentContainer
+ .getWidget());
+
// Update widget size from DOM
- componentContainer.updateWidgetSize();
- }
- }
-
- if (isDynamicHeight()) {
- /*
- * Height is not necessarily correct anymore as the height of
- * components might have changed if the width has changed.
- */
-
- /*
- * Get the new widget sizes from DOM and calculate new container
- * sizes
- */
- updateWidgetSizes();
-
- /* Update layout dimensions based on widget sizes */
- recalculateLayout();
- }
-
- updateRelativeSizesInNonMainDirection();
- calculateAlignments();
-
- setRootSize();
- }
-
- private void setRootSize() {
- root.getStyle().setPropertyPx("width", activeLayoutSize.getWidth());
- root.getStyle().setPropertyPx("height", activeLayoutSize.getHeight());
- }
-
- public boolean requestLayout(Set<Paintable> children) {
- for (Paintable p : children) {
- /* Update widget size from DOM */
- ChildComponentContainer componentContainer = getComponentContainer((Widget) p);
+ componentContainer.updateWidgetSize();
+ }
+ }
+
+ if (isDynamicHeight()) {
+ /*
+ * Height is not necessarily correct anymore as the height of
+ * components might have changed if the width has changed.
+ */
+
+ /*
+ * Get the new widget sizes from DOM and calculate new container
+ * sizes
+ */
+ updateWidgetSizes();
+
+ /* Update layout dimensions based on widget sizes */
+ recalculateLayout();
+ }
+
+ updateRelativeSizesInNonMainDirection();
+ calculateAlignments();
+
+ setRootSize();
+ }
+
+ private void setRootSize() {
+ root.getStyle().setPropertyPx("width", activeLayoutSize.getWidth());
+ root.getStyle().setPropertyPx("height", activeLayoutSize.getHeight());
+ }
+
+ public boolean requestLayout(Set<Paintable> children) {
+ for (Paintable p : children) {
+ /* Update widget size from DOM */
+ ChildComponentContainer componentContainer = getComponentContainer((Widget) p);
// This should no longer be needed (after #2563)
// if (isDynamicWidth()) {
// componentContainer.setUnlimitedContainerWidth();
@@ -785,173 +785,173 @@ public class VOrderedLayout extends CellBasedLayout {
// componentContainer.setLimitedContainerWidth(activeLayoutSize
// .getWidth());
// }
-
- componentContainer.updateWidgetSize();
-
- /*
- * If this is the result of an caption icon onload event the caption
- * size may have changed
- */
- componentContainer.updateCaptionSize();
- }
-
- Size sizeBefore = new Size(activeLayoutSize.getWidth(),
- activeLayoutSize.getHeight());
-
- recalculateLayoutAndComponentSizes();
- boolean sameSize = (sizeBefore.equals(activeLayoutSize));
- if (!sameSize) {
- /* Must inform child components about possible size updates */
- client.runDescendentsLayout(this);
- }
-
- /* Automatically propagated upwards if the size has changed */
-
- return sameSize;
- }
-
- @Override
- public void setHeight(String height) {
- Size sizeBefore = new Size(activeLayoutSize.getWidth(),
- activeLayoutSize.getHeight());
-
- super.setHeight(height);
-
- if (height != null && !height.equals("")) {
- setActiveLayoutHeight(getOffsetHeight()
- - activeMargins.getVertical());
- }
-
- if (isRendering) {
- sizeHasChangedDuringRendering = true;
- } else {
- recalculateLayoutAndComponentSizes();
- boolean sameSize = (sizeBefore.equals(activeLayoutSize));
- if (!sameSize) {
- /* Must inform child components about possible size updates */
- client.runDescendentsLayout(this);
- }
- }
- }
-
- @Override
- public void setWidth(String width) {
- if (this.width.equals(width) || !isVisible()) {
- return;
- }
- Size sizeBefore = new Size(activeLayoutSize.getWidth(),
- activeLayoutSize.getHeight());
-
- super.setWidth(width);
- this.width = width;
- if (width != null && !width.equals("")) {
- setActiveLayoutWidth(getOffsetWidth()
- - activeMargins.getHorizontal());
- }
-
- if (isRendering) {
- sizeHasChangedDuringRendering = true;
- } else {
- recalculateLayoutAndComponentSizes();
- boolean sameSize = (sizeBefore.equals(activeLayoutSize));
- if (!sameSize) {
- /* Must inform child components about possible size updates */
- client.runDescendentsLayout(this);
- }
- /*
- * If the height changes as a consequence of this we must inform the
- * parent also
- */
- if (isDynamicHeight()
- && sizeBefore.getHeight() != activeLayoutSize.getHeight()) {
- Util.notifyParentOfSizeChange(this, false);
- }
-
- }
- }
-
- protected void updateAlignmentsAndExpandRatios(UIDL uidl,
- ArrayList<Widget> renderedWidgets) {
-
- /*
- */
- alignments = uidl.getMapAttribute("alignments");
-
+
+ componentContainer.updateWidgetSize();
+
+ /*
+ * If this is the result of an caption icon onload event the caption
+ * size may have changed
+ */
+ componentContainer.updateCaptionSize();
+ }
+
+ Size sizeBefore = new Size(activeLayoutSize.getWidth(),
+ activeLayoutSize.getHeight());
+
+ recalculateLayoutAndComponentSizes();
+ boolean sameSize = (sizeBefore.equals(activeLayoutSize));
+ if (!sameSize) {
+ /* Must inform child components about possible size updates */
+ client.runDescendentsLayout(this);
+ }
+
+ /* Automatically propagated upwards if the size has changed */
+
+ return sameSize;
+ }
+
+ @Override
+ public void setHeight(String height) {
+ Size sizeBefore = new Size(activeLayoutSize.getWidth(),
+ activeLayoutSize.getHeight());
+
+ super.setHeight(height);
+
+ if (height != null && !height.equals("")) {
+ setActiveLayoutHeight(getOffsetHeight()
+ - activeMargins.getVertical());
+ }
+
+ if (isRendering) {
+ sizeHasChangedDuringRendering = true;
+ } else {
+ recalculateLayoutAndComponentSizes();
+ boolean sameSize = (sizeBefore.equals(activeLayoutSize));
+ if (!sameSize) {
+ /* Must inform child components about possible size updates */
+ client.runDescendentsLayout(this);
+ }
+ }
+ }
+
+ @Override
+ public void setWidth(String width) {
+ if (this.width.equals(width) || !isVisible()) {
+ return;
+ }
+ Size sizeBefore = new Size(activeLayoutSize.getWidth(),
+ activeLayoutSize.getHeight());
+
+ super.setWidth(width);
+ this.width = width;
+ if (width != null && !width.equals("")) {
+ setActiveLayoutWidth(getOffsetWidth()
+ - activeMargins.getHorizontal());
+ }
+
+ if (isRendering) {
+ sizeHasChangedDuringRendering = true;
+ } else {
+ recalculateLayoutAndComponentSizes();
+ boolean sameSize = (sizeBefore.equals(activeLayoutSize));
+ if (!sameSize) {
+ /* Must inform child components about possible size updates */
+ client.runDescendentsLayout(this);
+ }
+ /*
+ * If the height changes as a consequence of this we must inform the
+ * parent also
+ */
+ if (isDynamicHeight()
+ && sizeBefore.getHeight() != activeLayoutSize.getHeight()) {
+ Util.notifyParentOfSizeChange(this, false);
+ }
+
+ }
+ }
+
+ protected void updateAlignmentsAndExpandRatios(UIDL uidl,
+ ArrayList<Widget> renderedWidgets) {
+
/*
- * UIDL contains a map of paintable ids to expand ratios
- */
-
- expandRatios = uidl.getMapAttribute("expandRatios");
- expandRatioSum = -1.0;
-
- for (int i = 0; i < renderedWidgets.size(); i++) {
- Widget widget = renderedWidgets.get(i);
- String pid = client.getPid(widget.getElement());
-
- ChildComponentContainer container = getComponentContainer(widget);
-
+ */
+ alignments = uidl.getMapAttribute("alignments");
+
+ /*
+ * UIDL contains a map of paintable ids to expand ratios
+ */
+
+ expandRatios = uidl.getMapAttribute("expandRatios");
+ expandRatioSum = -1.0;
+
+ for (int i = 0; i < renderedWidgets.size(); i++) {
+ Widget widget = renderedWidgets.get(i);
+ String pid = client.getPid(widget.getElement());
+
+ ChildComponentContainer container = getComponentContainer(widget);
+
// Calculate alignment info
- container.setAlignment(getAlignment(pid));
-
+ container.setAlignment(getAlignment(pid));
+
// Update expand ratio
- container.setNormalizedExpandRatio(getExpandRatio(pid));
- }
- }
-
- private AlignmentInfo getAlignment(String pid) {
- if (alignments.containsKey(pid)) {
- return new AlignmentInfo(alignments.getInt(pid));
- } else {
- return AlignmentInfo.TOP_LEFT;
- }
- }
-
- private double getExpandRatio(String pid) {
- if (expandRatioSum < 0) {
- expandRatioSum = 0;
- JsArrayString keyArray = expandRatios.getKeyArray();
- int length = keyArray.length();
- for (int i = 0; i < length; i++) {
- expandRatioSum += expandRatios.getRawNumber(keyArray.get(i));
- }
- if (expandRatioSum == 0) {
+ container.setNormalizedExpandRatio(getExpandRatio(pid));
+ }
+ }
+
+ private AlignmentInfo getAlignment(String pid) {
+ if (alignments.containsKey(pid)) {
+ return new AlignmentInfo(alignments.getInt(pid));
+ } else {
+ return AlignmentInfo.TOP_LEFT;
+ }
+ }
+
+ private double getExpandRatio(String pid) {
+ if (expandRatioSum < 0) {
+ expandRatioSum = 0;
+ JsArrayString keyArray = expandRatios.getKeyArray();
+ int length = keyArray.length();
+ for (int i = 0; i < length; i++) {
+ expandRatioSum += expandRatios.getRawNumber(keyArray.get(i));
+ }
+ if (expandRatioSum == 0) {
// by default split equally among components
- defaultExpandRatio = 1.0 / widgetToComponentContainer.size();
- } else {
- defaultExpandRatio = 0;
- }
- }
- if (expandRatios.containsKey(pid)) {
- return expandRatios.getRawNumber(pid) / expandRatioSum;
- } else {
- return defaultExpandRatio;
- }
- }
-
- public void updateCaption(Paintable component, UIDL uidl) {
- ChildComponentContainer componentContainer = getComponentContainer((Widget) component);
- componentContainer.updateCaption(uidl, client);
- if (!isRendering) {
- /*
- * This was a component-only update and the possible size change
- * must be propagated to the layout
- */
- client.captionSizeUpdated(component);
- }
- }
-
- /**
- * Returns the child component which contains "element". The child component
- * is also returned if "element" is part of its caption.
- *
- * @param element
- * An element that is a sub element of the root element in this
- * layout
- * @return The Paintable which the element is a part of. Null if the element
- * belongs to the layout and not to a child.
- */
- private Paintable getComponent(Element element) {
- return Util.getChildPaintableForElement(client, this, element);
- }
-
-}
+ defaultExpandRatio = 1.0 / widgetToComponentContainer.size();
+ } else {
+ defaultExpandRatio = 0;
+ }
+ }
+ if (expandRatios.containsKey(pid)) {
+ return expandRatios.getRawNumber(pid) / expandRatioSum;
+ } else {
+ return defaultExpandRatio;
+ }
+ }
+
+ public void updateCaption(Paintable component, UIDL uidl) {
+ ChildComponentContainer componentContainer = getComponentContainer((Widget) component);
+ componentContainer.updateCaption(uidl, client);
+ if (!isRendering) {
+ /*
+ * This was a component-only update and the possible size change
+ * must be propagated to the layout
+ */
+ client.captionSizeUpdated(component);
+ }
+ }
+
+ /**
+ * Returns the child component which contains "element". The child component
+ * is also returned if "element" is part of its caption.
+ *
+ * @param element
+ * An element that is a sub element of the root element in this
+ * layout
+ * @return The Paintable which the element is a part of. Null if the element
+ * belongs to the layout and not to a child.
+ */
+ private Paintable getComponent(Element element) {
+ return Util.getChildPaintableForElement(client, this, element);
+ }
+
+}
diff --git a/src/com/vaadin/terminal/gwt/client/ui/VPopupCalendar.java b/src/com/vaadin/terminal/gwt/client/ui/VPopupCalendar.java
index 7c87927fd3..5437d512c3 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/VPopupCalendar.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/VPopupCalendar.java
@@ -56,7 +56,7 @@ public class VPopupCalendar extends VTextualDate implements Paintable, Field,
popup = new VOverlay(true, true, true);
popup.setStyleName(VDateField.CLASSNAME + "-popup");
popup.setWidget(calendar);
- popup.addCloseHandler(this);
+ popup.addCloseHandler(this);
DOM.setElementProperty(calendar.getElement(), "id",
"PID_VAADIN_POPUPCAL");
@@ -183,17 +183,17 @@ public class VPopupCalendar extends VTextualDate implements Paintable, Field,
popup.setPopupPosition(l, t
+ calendarToggle.getOffsetHeight() + 2);
- /* We have to wait a while before focusing
- * since the popup needs to be opened before
- * we can focus
+ /*
+ * We have to wait a while before focusing since the popup
+ * needs to be opened before we can focus
*/
- Timer focusTimer = new Timer() {
+ Timer focusTimer = new Timer() {
@Override
public void run() {
- setFocus(true);
+ setFocus(true);
}
};
-
+
focusTimer.schedule(100);
}
});
diff --git a/src/com/vaadin/terminal/gwt/client/ui/VSlider.java b/src/com/vaadin/terminal/gwt/client/ui/VSlider.java
index d30c2b2f20..dbc8f7144b 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/VSlider.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/VSlider.java
@@ -106,11 +106,11 @@ public class VSlider extends SimpleFocusablePanel implements Paintable, Field,
| Event.ONMOUSEOUT);
DOM.sinkEvents(bigger, Event.ONMOUSEDOWN | Event.ONMOUSEUP
| Event.ONMOUSEOUT);
-
+
feedbackPopup.addStyleName(CLASSNAME + "-feedback");
feedbackPopup.setWidget(feedback);
}
-
+
public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {
this.client = client;
diff --git a/src/com/vaadin/terminal/gwt/client/ui/VVerticalLayout.java b/src/com/vaadin/terminal/gwt/client/ui/VVerticalLayout.java
index f888f89d16..40151726a3 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/VVerticalLayout.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/VVerticalLayout.java
@@ -1,14 +1,14 @@
/*
@ITMillApache2LicenseForJavaFiles@
*/
-package com.vaadin.terminal.gwt.client.ui;
-
-public class VVerticalLayout extends VOrderedLayout {
-
- public static final String CLASSNAME = "v-verticallayout";
-
- public VVerticalLayout() {
- super(CLASSNAME, ORIENTATION_VERTICAL);
- }
-
-}
+package com.vaadin.terminal.gwt.client.ui;
+
+public class VVerticalLayout extends VOrderedLayout {
+
+ public static final String CLASSNAME = "v-verticallayout";
+
+ public VVerticalLayout() {
+ super(CLASSNAME, ORIENTATION_VERTICAL);
+ }
+
+}
diff --git a/src/com/vaadin/terminal/gwt/client/ui/dd/HorizontalDropLocation.java b/src/com/vaadin/terminal/gwt/client/ui/dd/HorizontalDropLocation.java
index 70f5793257..6d91eef1ef 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/dd/HorizontalDropLocation.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/dd/HorizontalDropLocation.java
@@ -3,7 +3,6 @@
*/
package com.vaadin.terminal.gwt.client.ui.dd;
-
public enum HorizontalDropLocation {
LEFT, RIGHT, CENTER
}
diff --git a/src/com/vaadin/terminal/gwt/client/ui/dd/VAcceptCallback.java b/src/com/vaadin/terminal/gwt/client/ui/dd/VAcceptCallback.java
index 4c80775fd2..1f0823c5c4 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/dd/VAcceptCallback.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/dd/VAcceptCallback.java
@@ -3,7 +3,6 @@
*/
package com.vaadin.terminal.gwt.client.ui.dd;
-
public interface VAcceptCallback {
/**
diff --git a/src/com/vaadin/terminal/gwt/client/ui/dd/VTargetInSubtree.java b/src/com/vaadin/terminal/gwt/client/ui/dd/VTargetInSubtree.java
index 5456b449e1..6ce885919c 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/dd/VTargetInSubtree.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/dd/VTargetInSubtree.java
@@ -31,7 +31,8 @@ final public class VTargetInSubtree extends VAcceptCriterion {
if (searchedKey.equals(((TreeNode) parent2).key)) {
return true;
}
- parent2 = parent2.getParent().getParent(); // panel -> next level node
+ parent2 = parent2.getParent().getParent(); // panel -> next
+ // level node
}
}
diff --git a/src/com/vaadin/terminal/gwt/client/ui/layout/Margins.java b/src/com/vaadin/terminal/gwt/client/ui/layout/Margins.java
index 429255ac7f..d4b216dbee 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/layout/Margins.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/layout/Margins.java
@@ -1,86 +1,86 @@
/*
@ITMillApache2LicenseForJavaFiles@
*/
-package com.vaadin.terminal.gwt.client.ui.layout;
-
-public class Margins {
-
- private int marginTop;
- private int marginBottom;
- private int marginLeft;
- private int marginRight;
-
- private int horizontal = 0;
- private int vertical = 0;
-
- public Margins(int marginTop, int marginBottom, int marginLeft,
- int marginRight) {
- super();
- this.marginTop = marginTop;
- this.marginBottom = marginBottom;
- this.marginLeft = marginLeft;
- this.marginRight = marginRight;
-
- updateHorizontal();
- updateVertical();
- }
-
- public int getMarginTop() {
- return marginTop;
- }
-
- public int getMarginBottom() {
- return marginBottom;
- }
-
- public int getMarginLeft() {
- return marginLeft;
- }
-
- public int getMarginRight() {
- return marginRight;
- }
-
- public int getHorizontal() {
- return horizontal;
- }
-
- public int getVertical() {
- return vertical;
- }
-
- public void setMarginTop(int marginTop) {
- this.marginTop = marginTop;
- updateVertical();
- }
-
- public void setMarginBottom(int marginBottom) {
- this.marginBottom = marginBottom;
- updateVertical();
- }
-
- public void setMarginLeft(int marginLeft) {
- this.marginLeft = marginLeft;
- updateHorizontal();
- }
-
- public void setMarginRight(int marginRight) {
- this.marginRight = marginRight;
- updateHorizontal();
- }
-
- private void updateVertical() {
- vertical = marginTop + marginBottom;
- }
-
- private void updateHorizontal() {
- horizontal = marginLeft + marginRight;
- }
-
- @Override
- public String toString() {
- return "Margins [marginLeft=" + marginLeft + ",marginTop=" + marginTop
- + ",marginRight=" + marginRight + ",marginBottom="
- + marginBottom + "]";
- }
-}
+package com.vaadin.terminal.gwt.client.ui.layout;
+
+public class Margins {
+
+ private int marginTop;
+ private int marginBottom;
+ private int marginLeft;
+ private int marginRight;
+
+ private int horizontal = 0;
+ private int vertical = 0;
+
+ public Margins(int marginTop, int marginBottom, int marginLeft,
+ int marginRight) {
+ super();
+ this.marginTop = marginTop;
+ this.marginBottom = marginBottom;
+ this.marginLeft = marginLeft;
+ this.marginRight = marginRight;
+
+ updateHorizontal();
+ updateVertical();
+ }
+
+ public int getMarginTop() {
+ return marginTop;
+ }
+
+ public int getMarginBottom() {
+ return marginBottom;
+ }
+
+ public int getMarginLeft() {
+ return marginLeft;
+ }
+
+ public int getMarginRight() {
+ return marginRight;
+ }
+
+ public int getHorizontal() {
+ return horizontal;
+ }
+
+ public int getVertical() {
+ return vertical;
+ }
+
+ public void setMarginTop(int marginTop) {
+ this.marginTop = marginTop;
+ updateVertical();
+ }
+
+ public void setMarginBottom(int marginBottom) {
+ this.marginBottom = marginBottom;
+ updateVertical();
+ }
+
+ public void setMarginLeft(int marginLeft) {
+ this.marginLeft = marginLeft;
+ updateHorizontal();
+ }
+
+ public void setMarginRight(int marginRight) {
+ this.marginRight = marginRight;
+ updateHorizontal();
+ }
+
+ private void updateVertical() {
+ vertical = marginTop + marginBottom;
+ }
+
+ private void updateHorizontal() {
+ horizontal = marginLeft + marginRight;
+ }
+
+ @Override
+ public String toString() {
+ return "Margins [marginLeft=" + marginLeft + ",marginTop=" + marginTop
+ + ",marginRight=" + marginRight + ",marginBottom="
+ + marginBottom + "]";
+ }
+}
diff --git a/src/com/vaadin/terminal/gwt/server/AbstractApplicationPortlet.java b/src/com/vaadin/terminal/gwt/server/AbstractApplicationPortlet.java
index 74a4b9ba5e..c8d58abdb8 100644
--- a/src/com/vaadin/terminal/gwt/server/AbstractApplicationPortlet.java
+++ b/src/com/vaadin/terminal/gwt/server/AbstractApplicationPortlet.java
@@ -1202,8 +1202,8 @@ public abstract class AbstractApplicationPortlet extends GenericPortlet
protected void writeAjaxPageHtmlMainDiv(RenderRequest request,
RenderResponse response, final BufferedWriter writer, String id,
String classNames, String divStyle) throws IOException {
- writer.write("<div id=\"" + id + "\" class=\""
- + classNames + "\" " + divStyle + "></div>\n");
+ writer.write("<div id=\"" + id + "\" class=\"" + classNames + "\" "
+ + divStyle + "></div>\n");
writer.write("<noscript>" + getNoScriptMessage() + "</noscript>");
}
@@ -1474,7 +1474,8 @@ public abstract class AbstractApplicationPortlet extends GenericPortlet
return value;
}
- private static String getLiferayHTTPRequestParameter(PortletRequest request, String name) {
+ private static String getLiferayHTTPRequestParameter(
+ PortletRequest request, String name) {
try {
// httpRequest = PortalUtil.getHttpServletRequest(request);
HttpServletRequest httpRequest = (HttpServletRequest) PortalClassInvoker
diff --git a/src/com/vaadin/terminal/gwt/server/AbstractWebApplicationContext.java b/src/com/vaadin/terminal/gwt/server/AbstractWebApplicationContext.java
index 92488ef9ca..e9de68630b 100644
--- a/src/com/vaadin/terminal/gwt/server/AbstractWebApplicationContext.java
+++ b/src/com/vaadin/terminal/gwt/server/AbstractWebApplicationContext.java
@@ -1,8 +1,8 @@
/*
@ITMillApache2LicenseForJavaFiles@
*/
-package com.vaadin.terminal.gwt.server;
-
+package com.vaadin.terminal.gwt.server;
+
import java.io.PrintWriter;
import java.io.Serializable;
import java.io.StringWriter;
@@ -19,178 +19,178 @@ import javax.servlet.http.HttpSessionBindingListener;
import com.vaadin.Application;
import com.vaadin.service.ApplicationContext;
import com.vaadin.terminal.ApplicationResource;
-
-/**
- * Base class for web application contexts (including portlet contexts) that
- * handles the common tasks.
- */
-public abstract class AbstractWebApplicationContext implements
- ApplicationContext, HttpSessionBindingListener, Serializable {
-
- protected Collection<TransactionListener> listeners = Collections
- .synchronizedList(new LinkedList<TransactionListener>());
-
- protected final HashSet<Application> applications = new HashSet<Application>();
-
- protected WebBrowser browser = new WebBrowser();
-
- protected HashMap<Application, AbstractCommunicationManager> applicationToAjaxAppMgrMap = new HashMap<Application, AbstractCommunicationManager>();
-
+
+/**
+ * Base class for web application contexts (including portlet contexts) that
+ * handles the common tasks.
+ */
+public abstract class AbstractWebApplicationContext implements
+ ApplicationContext, HttpSessionBindingListener, Serializable {
+
+ protected Collection<TransactionListener> listeners = Collections
+ .synchronizedList(new LinkedList<TransactionListener>());
+
+ protected final HashSet<Application> applications = new HashSet<Application>();
+
+ protected WebBrowser browser = new WebBrowser();
+
+ protected HashMap<Application, AbstractCommunicationManager> applicationToAjaxAppMgrMap = new HashMap<Application, AbstractCommunicationManager>();
+
public void addTransactionListener(TransactionListener listener) {
if (listener != null) {
listeners.add(listener);
- }
- }
-
- public void removeTransactionListener(TransactionListener listener) {
- listeners.remove(listener);
- }
-
- /**
- * Sends a notification that a transaction is starting.
- *
- * @param application
- * The application associated with the transaction.
- * @param request
- * the HTTP or portlet request that triggered the transaction.
- */
- protected void startTransaction(Application application, Object request) {
- synchronized (listeners) {
- for (TransactionListener listener : listeners) {
- listener.transactionStart(application, request);
- }
- }
- }
-
- /**
- * Sends a notification that a transaction has ended.
- *
- * @param application
- * The application associated with the transaction.
- * @param request
- * the HTTP or portlet request that triggered the transaction.
- */
- protected void endTransaction(Application application, Object request) {
- LinkedList<Exception> exceptions = null;
-
- synchronized (listeners) {
- for (TransactionListener listener : listeners) {
- try {
- listener.transactionEnd(application, request);
- } catch (final RuntimeException t) {
- if (exceptions == null) {
- exceptions = new LinkedList<Exception>();
- }
- exceptions.add(t);
- }
- }
- }
-
+ }
+ }
+
+ public void removeTransactionListener(TransactionListener listener) {
+ listeners.remove(listener);
+ }
+
+ /**
+ * Sends a notification that a transaction is starting.
+ *
+ * @param application
+ * The application associated with the transaction.
+ * @param request
+ * the HTTP or portlet request that triggered the transaction.
+ */
+ protected void startTransaction(Application application, Object request) {
+ synchronized (listeners) {
+ for (TransactionListener listener : listeners) {
+ listener.transactionStart(application, request);
+ }
+ }
+ }
+
+ /**
+ * Sends a notification that a transaction has ended.
+ *
+ * @param application
+ * The application associated with the transaction.
+ * @param request
+ * the HTTP or portlet request that triggered the transaction.
+ */
+ protected void endTransaction(Application application, Object request) {
+ LinkedList<Exception> exceptions = null;
+
+ synchronized (listeners) {
+ for (TransactionListener listener : listeners) {
+ try {
+ listener.transactionEnd(application, request);
+ } catch (final RuntimeException t) {
+ if (exceptions == null) {
+ exceptions = new LinkedList<Exception>();
+ }
+ exceptions.add(t);
+ }
+ }
+ }
+
// If any runtime exceptions occurred, throw a combined exception
- if (exceptions != null) {
- final StringBuffer msg = new StringBuffer();
- for (Exception e : exceptions) {
- if (msg.length() == 0) {
- msg.append("\n\n--------------------------\n\n");
- }
- msg.append(e.getMessage() + "\n");
- final StringWriter trace = new StringWriter();
- e.printStackTrace(new PrintWriter(trace, true));
- msg.append(trace.toString());
- }
- throw new RuntimeException(msg.toString());
- }
- }
-
- /**
- * @see javax.servlet.http.HttpSessionBindingListener#valueBound(HttpSessionBindingEvent)
- */
- public void valueBound(HttpSessionBindingEvent arg0) {
+ if (exceptions != null) {
+ final StringBuffer msg = new StringBuffer();
+ for (Exception e : exceptions) {
+ if (msg.length() == 0) {
+ msg.append("\n\n--------------------------\n\n");
+ }
+ msg.append(e.getMessage() + "\n");
+ final StringWriter trace = new StringWriter();
+ e.printStackTrace(new PrintWriter(trace, true));
+ msg.append(trace.toString());
+ }
+ throw new RuntimeException(msg.toString());
+ }
+ }
+
+ /**
+ * @see javax.servlet.http.HttpSessionBindingListener#valueBound(HttpSessionBindingEvent)
+ */
+ public void valueBound(HttpSessionBindingEvent arg0) {
// We are not interested in bindings
- }
-
- /**
- * @see javax.servlet.http.HttpSessionBindingListener#valueUnbound(HttpSessionBindingEvent)
- */
- public void valueUnbound(HttpSessionBindingEvent event) {
+ }
+
+ /**
+ * @see javax.servlet.http.HttpSessionBindingListener#valueUnbound(HttpSessionBindingEvent)
+ */
+ public void valueUnbound(HttpSessionBindingEvent event) {
// If we are going to be unbound from the session, the session must be
// closing
- try {
- while (!applications.isEmpty()) {
- final Application app = applications.iterator().next();
- app.close();
- removeApplication(app);
- }
- } catch (Exception e) {
+ try {
+ while (!applications.isEmpty()) {
+ final Application app = applications.iterator().next();
+ app.close();
+ removeApplication(app);
+ }
+ } catch (Exception e) {
// This should never happen but is possible with rare
// configurations (e.g. robustness tests). If you have one
// thread doing HTTP socket write and another thread trying to
// remove same application here. Possible if you got e.g. session
// lifetime 1 min but socket write may take longer than 1 min.
// FIXME: Handle exception
- System.err.println("Could not remove application, leaking memory.");
- e.printStackTrace();
- }
- }
-
- /**
- * Get the web browser associated with this application context.
- *
- * Because application context is related to the http session and server
- * maintains one session per browser-instance, each context has exactly one
- * web browser associated with it.
- *
- * @return
- */
- public WebBrowser getBrowser() {
- return browser;
- }
-
- public Collection<Application> getApplications() {
- return Collections.unmodifiableCollection(applications);
- }
-
- protected void removeApplication(Application application) {
- applications.remove(application);
- applicationToAjaxAppMgrMap.remove(application);
- }
-
- public String generateApplicationResourceURL(ApplicationResource resource,
- String mapKey) {
-
- final String filename = resource.getFilename();
- if (filename == null) {
- return "APP/" + mapKey + "/";
- } else {
- return "APP/" + mapKey + "/" + filename;
- }
-
- }
-
- public boolean isApplicationResourceURL(URL context, String relativeUri) {
+ System.err.println("Could not remove application, leaking memory.");
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * Get the web browser associated with this application context.
+ *
+ * Because application context is related to the http session and server
+ * maintains one session per browser-instance, each context has exactly one
+ * web browser associated with it.
+ *
+ * @return
+ */
+ public WebBrowser getBrowser() {
+ return browser;
+ }
+
+ public Collection<Application> getApplications() {
+ return Collections.unmodifiableCollection(applications);
+ }
+
+ protected void removeApplication(Application application) {
+ applications.remove(application);
+ applicationToAjaxAppMgrMap.remove(application);
+ }
+
+ public String generateApplicationResourceURL(ApplicationResource resource,
+ String mapKey) {
+
+ final String filename = resource.getFilename();
+ if (filename == null) {
+ return "APP/" + mapKey + "/";
+ } else {
+ return "APP/" + mapKey + "/" + filename;
+ }
+
+ }
+
+ public boolean isApplicationResourceURL(URL context, String relativeUri) {
// If the relative uri is null, we are ready
- if (relativeUri == null) {
- return false;
- }
-
+ if (relativeUri == null) {
+ return false;
+ }
+
// Resolves the prefix
- String prefix = relativeUri;
- final int index = relativeUri.indexOf('/');
- if (index >= 0) {
- prefix = relativeUri.substring(0, index);
- }
-
+ String prefix = relativeUri;
+ final int index = relativeUri.indexOf('/');
+ if (index >= 0) {
+ prefix = relativeUri.substring(0, index);
+ }
+
// Handles the resource requests
- return (prefix.equals("APP"));
- }
-
- public String getURLKey(URL context, String relativeUri) {
- final int index = relativeUri.indexOf('/');
- final int next = relativeUri.indexOf('/', index + 1);
- if (next < 0) {
- return null;
- }
- return relativeUri.substring(index + 1, next);
- }
-
+ return (prefix.equals("APP"));
+ }
+
+ public String getURLKey(URL context, String relativeUri) {
+ final int index = relativeUri.indexOf('/');
+ final int next = relativeUri.indexOf('/', index + 1);
+ if (next < 0) {
+ return null;
+ }
+ return relativeUri.substring(index + 1, next);
+ }
+
} \ No newline at end of file
diff --git a/src/com/vaadin/terminal/gwt/server/ApplicationPortlet.java b/src/com/vaadin/terminal/gwt/server/ApplicationPortlet.java
index ca5455f096..3a527fc187 100644
--- a/src/com/vaadin/terminal/gwt/server/ApplicationPortlet.java
+++ b/src/com/vaadin/terminal/gwt/server/ApplicationPortlet.java
@@ -1,247 +1,247 @@
/*
@ITMillApache2LicenseForJavaFiles@
*/
-package com.vaadin.terminal.gwt.server;
-
-import java.io.IOException;
-import java.io.OutputStream;
-import java.io.PrintWriter;
-import java.io.Serializable;
-
-import javax.portlet.ActionRequest;
-import javax.portlet.ActionResponse;
-import javax.portlet.PortalContext;
-import javax.portlet.Portlet;
-import javax.portlet.PortletConfig;
-import javax.portlet.PortletException;
-import javax.portlet.PortletRequestDispatcher;
-import javax.portlet.PortletSession;
-import javax.portlet.RenderRequest;
-import javax.portlet.RenderResponse;
-
-import com.liferay.portal.kernel.util.PropsUtil;
-import com.vaadin.Application;
-
-/**
- * Portlet main class for Portlet 1.0 (JSR-168) portlets which consist of a
- * portlet and a servlet. For Portlet 2.0 (JSR-286, no servlet required), use
- * {@link ApplicationPortlet2} instead.
- */
-@SuppressWarnings("serial")
-public class ApplicationPortlet implements Portlet, Serializable {
+package com.vaadin.terminal.gwt.server;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.PrintWriter;
+import java.io.Serializable;
+
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.PortalContext;
+import javax.portlet.Portlet;
+import javax.portlet.PortletConfig;
+import javax.portlet.PortletException;
+import javax.portlet.PortletRequestDispatcher;
+import javax.portlet.PortletSession;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+
+import com.liferay.portal.kernel.util.PropsUtil;
+import com.vaadin.Application;
+
+/**
+ * Portlet main class for Portlet 1.0 (JSR-168) portlets which consist of a
+ * portlet and a servlet. For Portlet 2.0 (JSR-286, no servlet required), use
+ * {@link ApplicationPortlet2} instead.
+ */
+@SuppressWarnings("serial")
+public class ApplicationPortlet implements Portlet, Serializable {
// portlet configuration parameters
- private static final String PORTLET_PARAMETER_APPLICATION = "application";
- private static final String PORTLET_PARAMETER_STYLE = "style";
- private static final String PORTLET_PARAMETER_WIDGETSET = "widgetset";
-
+ private static final String PORTLET_PARAMETER_APPLICATION = "application";
+ private static final String PORTLET_PARAMETER_STYLE = "style";
+ private static final String PORTLET_PARAMETER_WIDGETSET = "widgetset";
+
// The application to show
- protected String app = null;
+ protected String app = null;
// some applications might require forced height (and, more seldom, width)
protected String style = null; // e.g "height:500px;"
// force the portlet to use this widgetset - portlet level setting
- protected String portletWidgetset = null;
-
- public void destroy() {
-
- }
-
- public void init(PortletConfig config) throws PortletException {
- app = config.getInitParameter(PORTLET_PARAMETER_APPLICATION);
- if (app == null) {
- throw new PortletException(
- "No porlet application url defined in portlet.xml. Define the '"
- + PORTLET_PARAMETER_APPLICATION
- + "' init parameter to be the servlet deployment path.");
- }
- style = config.getInitParameter(PORTLET_PARAMETER_STYLE);
+ protected String portletWidgetset = null;
+
+ public void destroy() {
+
+ }
+
+ public void init(PortletConfig config) throws PortletException {
+ app = config.getInitParameter(PORTLET_PARAMETER_APPLICATION);
+ if (app == null) {
+ throw new PortletException(
+ "No porlet application url defined in portlet.xml. Define the '"
+ + PORTLET_PARAMETER_APPLICATION
+ + "' init parameter to be the servlet deployment path.");
+ }
+ style = config.getInitParameter(PORTLET_PARAMETER_STYLE);
// enable forcing the selection of the widgetset in portlet
// configuration for a single portlet (backwards compatibility)
- portletWidgetset = config.getInitParameter(PORTLET_PARAMETER_WIDGETSET);
- }
-
- public void processAction(ActionRequest request, ActionResponse response)
- throws PortletException, IOException {
- PortletApplicationContext.dispatchRequest(this, request, response);
- }
-
- public void render(RenderRequest request, RenderResponse response)
- throws PortletException, IOException {
-
+ portletWidgetset = config.getInitParameter(PORTLET_PARAMETER_WIDGETSET);
+ }
+
+ public void processAction(ActionRequest request, ActionResponse response)
+ throws PortletException, IOException {
+ PortletApplicationContext.dispatchRequest(this, request, response);
+ }
+
+ public void render(RenderRequest request, RenderResponse response)
+ throws PortletException, IOException {
+
// display the Vaadin application
- writeAjaxWindow(request, response);
- }
-
- protected void writeAjaxWindow(RenderRequest request,
- RenderResponse response) throws IOException {
-
- response.setContentType("text/html");
- if (app != null) {
- PortletSession sess = request.getPortletSession();
- PortletApplicationContext ctx = PortletApplicationContext
- .getApplicationContext(sess);
-
- PortletRequestDispatcher dispatcher = sess.getPortletContext()
- .getRequestDispatcher("/" + app);
-
- try {
+ writeAjaxWindow(request, response);
+ }
+
+ protected void writeAjaxWindow(RenderRequest request,
+ RenderResponse response) throws IOException {
+
+ response.setContentType("text/html");
+ if (app != null) {
+ PortletSession sess = request.getPortletSession();
+ PortletApplicationContext ctx = PortletApplicationContext
+ .getApplicationContext(sess);
+
+ PortletRequestDispatcher dispatcher = sess.getPortletContext()
+ .getRequestDispatcher("/" + app);
+
+ try {
// portal-wide settings
- PortalContext portalCtx = request.getPortalContext();
-
- boolean isLifeRay = portalCtx.getPortalInfo().toLowerCase()
- .contains("liferay");
-
- request.setAttribute(ApplicationServlet.REQUEST_FRAGMENT,
- "true");
-
+ PortalContext portalCtx = request.getPortalContext();
+
+ boolean isLifeRay = portalCtx.getPortalInfo().toLowerCase()
+ .contains("liferay");
+
+ request.setAttribute(ApplicationServlet.REQUEST_FRAGMENT,
+ "true");
+
// fixed base theme to use - all portal pages with Vaadin
// applications will load this exactly once
- String portalTheme = getPortalProperty(
- Constants.PORTAL_PARAMETER_VAADIN_THEME, portalCtx);
-
- String portalWidgetset = getPortalProperty(
- Constants.PORTAL_PARAMETER_VAADIN_WIDGETSET, portalCtx);
-
+ String portalTheme = getPortalProperty(
+ Constants.PORTAL_PARAMETER_VAADIN_THEME, portalCtx);
+
+ String portalWidgetset = getPortalProperty(
+ Constants.PORTAL_PARAMETER_VAADIN_WIDGETSET, portalCtx);
+
// location of the widgetset(s) and default theme (to which
// /VAADIN/widgetsets/...
// is appended)
- String portalResourcePath = getPortalProperty(
- Constants.PORTAL_PARAMETER_VAADIN_RESOURCE_PATH,
- portalCtx);
-
- if (portalResourcePath != null) {
+ String portalResourcePath = getPortalProperty(
+ Constants.PORTAL_PARAMETER_VAADIN_RESOURCE_PATH,
+ portalCtx);
+
+ if (portalResourcePath != null) {
// if portalResourcePath is defined, set it as a request
// parameter which will override the default location in
// servlet
- request.setAttribute(
- ApplicationServlet.REQUEST_VAADIN_STATIC_FILE_PATH,
- portalResourcePath);
- }
-
+ request.setAttribute(
+ ApplicationServlet.REQUEST_VAADIN_STATIC_FILE_PATH,
+ portalResourcePath);
+ }
+
// - if the user has specified a widgetset for this portlet, use
// it from the portlet (not fully supported)
// - otherwise, if specified, use the portal-wide widgetset
// and widgetset path settings (recommended)
// - finally, default to use the default widgetset if nothing
// else is found
- if (portletWidgetset != null) {
- request.setAttribute(ApplicationServlet.REQUEST_WIDGETSET,
- portletWidgetset);
- }
- if (portalWidgetset != null) {
- request.setAttribute(
- ApplicationServlet.REQUEST_SHARED_WIDGETSET,
- portalWidgetset);
- }
-
- if (style != null) {
- request.setAttribute(ApplicationServlet.REQUEST_APPSTYLE,
- style);
- }
-
+ if (portletWidgetset != null) {
+ request.setAttribute(ApplicationServlet.REQUEST_WIDGETSET,
+ portletWidgetset);
+ }
+ if (portalWidgetset != null) {
+ request.setAttribute(
+ ApplicationServlet.REQUEST_SHARED_WIDGETSET,
+ portalWidgetset);
+ }
+
+ if (style != null) {
+ request.setAttribute(ApplicationServlet.REQUEST_APPSTYLE,
+ style);
+ }
+
// portalTheme is only used if the shared portal resource
// directory is defined
- if (portalTheme != null && portalResourcePath != null) {
- request.setAttribute(
- ApplicationServlet.REQUEST_DEFAULT_THEME,
- portalTheme);
-
- String defaultThemeUri = null;
- defaultThemeUri = portalResourcePath + "/"
- + AbstractApplicationServlet.THEME_DIRECTORY_PATH
- + portalTheme;
- /*
- * Make sure portal default Vaadin theme is included in DOM.
- * Vaadin portlet themes do not "inherit" base theme, so we
- * need to force loading of the common base theme.
- */
- OutputStream out = response.getPortletOutputStream();
-
+ if (portalTheme != null && portalResourcePath != null) {
+ request.setAttribute(
+ ApplicationServlet.REQUEST_DEFAULT_THEME,
+ portalTheme);
+
+ String defaultThemeUri = null;
+ defaultThemeUri = portalResourcePath + "/"
+ + AbstractApplicationServlet.THEME_DIRECTORY_PATH
+ + portalTheme;
+ /*
+ * Make sure portal default Vaadin theme is included in DOM.
+ * Vaadin portlet themes do not "inherit" base theme, so we
+ * need to force loading of the common base theme.
+ */
+ OutputStream out = response.getPortletOutputStream();
+
// Using portal-wide theme
- String loadDefaultTheme = ("<script type=\"text/javascript\">\n"
- + "if(!vaadin) { var vaadin = {} } \n"
- + "if(!vaadin.themesLoaded) { vaadin.themesLoaded = {} } \n"
- + "if(!vaadin.themesLoaded['"
- + portalTheme
- + "']) {\n"
- + "var stylesheet = document.createElement('link');\n"
- + "stylesheet.setAttribute('rel', 'stylesheet');\n"
- + "stylesheet.setAttribute('type', 'text/css');\n"
- + "stylesheet.setAttribute('href', '"
- + defaultThemeUri
- + "/styles.css');\n"
- + "document.getElementsByTagName('head')[0].appendChild(stylesheet);\n"
- + "vaadin.themesLoaded['"
- + portalTheme
- + "'] = true;\n}\n" + "</script>\n");
- out.write(loadDefaultTheme.getBytes());
- }
-
- dispatcher.include(request, response);
-
- if (isLifeRay) {
- /*
- * Temporary support to heartbeat Liferay session when using
- * Vaadin based portlet. We hit an extra xhr to liferay
- * servlet to extend the session lifetime after each Vaadin
- * request. This hack can be removed when supporting portlet
- * 2.0 and resourceRequests.
- *
- * TODO make this configurable, this is not necessary with
- * some custom session configurations.
- */
- OutputStream out = response.getPortletOutputStream();
-
- String lifeRaySessionHearbeatHack = ("<script type=\"text/javascript\">"
- + "if(!vaadin.postRequestHooks) {"
- + " vaadin.postRequestHooks = {};"
- + "}"
- + "vaadin.postRequestHooks.liferaySessionHeartBeat = function() {"
- + " if (Liferay && Liferay.Session && Liferay.Session.setCookie) {"
- + " Liferay.Session.setCookie();"
- + " }"
- + "};" + "</script>");
- out.write(lifeRaySessionHearbeatHack.getBytes());
- }
-
- } catch (PortletException e) {
- PrintWriter out = response.getWriter();
- out.print("<h1>Servlet include failed!</h1>");
- out.print("<div>" + e + "</div>");
- ctx.setPortletApplication(this, null);
- return;
- }
-
- Application app = (Application) request
- .getAttribute(Application.class.getName());
- ctx.setPortletApplication(this, app);
- ctx.firePortletRenderRequest(this, request, response);
-
- }
- }
-
- private String getPortalProperty(String name, PortalContext context) {
- boolean isLifeRay = context.getPortalInfo().toLowerCase().contains(
- "liferay");
-
+ String loadDefaultTheme = ("<script type=\"text/javascript\">\n"
+ + "if(!vaadin) { var vaadin = {} } \n"
+ + "if(!vaadin.themesLoaded) { vaadin.themesLoaded = {} } \n"
+ + "if(!vaadin.themesLoaded['"
+ + portalTheme
+ + "']) {\n"
+ + "var stylesheet = document.createElement('link');\n"
+ + "stylesheet.setAttribute('rel', 'stylesheet');\n"
+ + "stylesheet.setAttribute('type', 'text/css');\n"
+ + "stylesheet.setAttribute('href', '"
+ + defaultThemeUri
+ + "/styles.css');\n"
+ + "document.getElementsByTagName('head')[0].appendChild(stylesheet);\n"
+ + "vaadin.themesLoaded['"
+ + portalTheme
+ + "'] = true;\n}\n" + "</script>\n");
+ out.write(loadDefaultTheme.getBytes());
+ }
+
+ dispatcher.include(request, response);
+
+ if (isLifeRay) {
+ /*
+ * Temporary support to heartbeat Liferay session when using
+ * Vaadin based portlet. We hit an extra xhr to liferay
+ * servlet to extend the session lifetime after each Vaadin
+ * request. This hack can be removed when supporting portlet
+ * 2.0 and resourceRequests.
+ *
+ * TODO make this configurable, this is not necessary with
+ * some custom session configurations.
+ */
+ OutputStream out = response.getPortletOutputStream();
+
+ String lifeRaySessionHearbeatHack = ("<script type=\"text/javascript\">"
+ + "if(!vaadin.postRequestHooks) {"
+ + " vaadin.postRequestHooks = {};"
+ + "}"
+ + "vaadin.postRequestHooks.liferaySessionHeartBeat = function() {"
+ + " if (Liferay && Liferay.Session && Liferay.Session.setCookie) {"
+ + " Liferay.Session.setCookie();"
+ + " }"
+ + "};" + "</script>");
+ out.write(lifeRaySessionHearbeatHack.getBytes());
+ }
+
+ } catch (PortletException e) {
+ PrintWriter out = response.getWriter();
+ out.print("<h1>Servlet include failed!</h1>");
+ out.print("<div>" + e + "</div>");
+ ctx.setPortletApplication(this, null);
+ return;
+ }
+
+ Application app = (Application) request
+ .getAttribute(Application.class.getName());
+ ctx.setPortletApplication(this, app);
+ ctx.firePortletRenderRequest(this, request, response);
+
+ }
+ }
+
+ private String getPortalProperty(String name, PortalContext context) {
+ boolean isLifeRay = context.getPortalInfo().toLowerCase().contains(
+ "liferay");
+
// TODO test on non-LifeRay platforms
-
- String value;
- if (isLifeRay) {
- value = getLifeRayPortalProperty(name);
- } else {
- value = context.getProperty(name);
- }
-
- return value;
- }
-
- private String getLifeRayPortalProperty(String name) {
- String value;
- try {
- value = PropsUtil.get(name);
- } catch (Exception e) {
- value = null;
- }
- return value;
- }
-}
+
+ String value;
+ if (isLifeRay) {
+ value = getLifeRayPortalProperty(name);
+ } else {
+ value = context.getProperty(name);
+ }
+
+ return value;
+ }
+
+ private String getLifeRayPortalProperty(String name) {
+ String value;
+ try {
+ value = PropsUtil.get(name);
+ } catch (Exception e) {
+ value = null;
+ }
+ return value;
+ }
+}
diff --git a/src/com/vaadin/terminal/gwt/server/ChangeVariablesErrorEvent.java b/src/com/vaadin/terminal/gwt/server/ChangeVariablesErrorEvent.java
index 6cf09a4c4d..e523ad3ca5 100644
--- a/src/com/vaadin/terminal/gwt/server/ChangeVariablesErrorEvent.java
+++ b/src/com/vaadin/terminal/gwt/server/ChangeVariablesErrorEvent.java
@@ -1,38 +1,38 @@
/*
@ITMillApache2LicenseForJavaFiles@
*/
-package com.vaadin.terminal.gwt.server;
-
-import java.util.Map;
-
-import com.vaadin.ui.Component;
-import com.vaadin.ui.AbstractComponent.ComponentErrorEvent;
-
-@SuppressWarnings("serial")
-public class ChangeVariablesErrorEvent implements ComponentErrorEvent {
-
- private Throwable throwable;
- private Component component;
-
- private Map variableChanges;
-
- public ChangeVariablesErrorEvent(Component component, Throwable throwable,
- Map variableChanges) {
- this.component = component;
- this.throwable = throwable;
- this.variableChanges = variableChanges;
- }
-
- public Throwable getThrowable() {
- return throwable;
- }
-
- public Component getComponent() {
- return component;
- }
-
- public Map getVariableChanges() {
- return variableChanges;
- }
-
+package com.vaadin.terminal.gwt.server;
+
+import java.util.Map;
+
+import com.vaadin.ui.Component;
+import com.vaadin.ui.AbstractComponent.ComponentErrorEvent;
+
+@SuppressWarnings("serial")
+public class ChangeVariablesErrorEvent implements ComponentErrorEvent {
+
+ private Throwable throwable;
+ private Component component;
+
+ private Map variableChanges;
+
+ public ChangeVariablesErrorEvent(Component component, Throwable throwable,
+ Map variableChanges) {
+ this.component = component;
+ this.throwable = throwable;
+ this.variableChanges = variableChanges;
+ }
+
+ public Throwable getThrowable() {
+ return throwable;
+ }
+
+ public Component getComponent() {
+ return component;
+ }
+
+ public Map getVariableChanges() {
+ return variableChanges;
+ }
+
} \ No newline at end of file
diff --git a/src/com/vaadin/terminal/gwt/server/DragAndDropService.java b/src/com/vaadin/terminal/gwt/server/DragAndDropService.java
index 4bc8d386b4..a741d6dfed 100644
--- a/src/com/vaadin/terminal/gwt/server/DragAndDropService.java
+++ b/src/com/vaadin/terminal/gwt/server/DragAndDropService.java
@@ -86,8 +86,7 @@ public class DragAndDropService implements VariableOwner {
* source for Transferable, drop target for DragDropDetails).
*/
Transferable transferable = constructTransferable(dropTarget, variables);
- TargetDetails dropData = constructDragDropDetails(dropTarget,
- variables);
+ TargetDetails dropData = constructDragDropDetails(dropTarget, variables);
DragAndDropEvent dropEvent = new DragAndDropEvent(transferable,
dropData);
if (dropHandler.getAcceptCriterion().accept(dropEvent)) {
@@ -113,8 +112,8 @@ public class DragAndDropService implements VariableOwner {
* source for Transferable, current target for DragDropDetails).
*/
Transferable transferable = constructTransferable(dropTarget, variables);
- TargetDetails dragDropDetails = constructDragDropDetails(
- dropTarget, variables);
+ TargetDetails dragDropDetails = constructDragDropDetails(dropTarget,
+ variables);
dragEvent = new DragAndDropEvent(transferable, dragDropDetails);
diff --git a/src/com/vaadin/terminal/gwt/server/PortletApplicationContext.java b/src/com/vaadin/terminal/gwt/server/PortletApplicationContext.java
index 1eb80b1d5c..91fabc948e 100644
--- a/src/com/vaadin/terminal/gwt/server/PortletApplicationContext.java
+++ b/src/com/vaadin/terminal/gwt/server/PortletApplicationContext.java
@@ -1,176 +1,176 @@
/*
@ITMillApache2LicenseForJavaFiles@
*/
-/**
- *
- */
-package com.vaadin.terminal.gwt.server;
-
-import java.io.Serializable;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.LinkedHashSet;
-import java.util.Map;
-import java.util.Set;
-
-import javax.portlet.ActionRequest;
-import javax.portlet.ActionResponse;
-import javax.portlet.Portlet;
-import javax.portlet.PortletSession;
-import javax.portlet.RenderRequest;
-import javax.portlet.RenderResponse;
-import javax.servlet.http.HttpSession;
-
-import com.vaadin.Application;
-
-/**
- * @author marc
- */
-@SuppressWarnings( { "serial", "unchecked" })
-public class PortletApplicationContext extends WebApplicationContext implements
- Serializable {
-
- protected PortletSession portletSession;
-
- protected Map<Application, Set<PortletListener>> portletListeners = new HashMap<Application, Set<PortletListener>>();
-
- protected Map<Portlet, Application> portletToApplication = new HashMap<Portlet, Application>();
-
- PortletApplicationContext() {
-
- }
-
- static public PortletApplicationContext getApplicationContext(
- PortletSession session) {
- WebApplicationContext cx = (WebApplicationContext) session
- .getAttribute(WebApplicationContext.class.getName(),
- PortletSession.APPLICATION_SCOPE);
- if (cx == null) {
- cx = new PortletApplicationContext();
- }
- if (!(cx instanceof PortletApplicationContext)) {
+/**
+ *
+ */
+package com.vaadin.terminal.gwt.server;
+
+import java.io.Serializable;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedHashSet;
+import java.util.Map;
+import java.util.Set;
+
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.Portlet;
+import javax.portlet.PortletSession;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.servlet.http.HttpSession;
+
+import com.vaadin.Application;
+
+/**
+ * @author marc
+ */
+@SuppressWarnings( { "serial", "unchecked" })
+public class PortletApplicationContext extends WebApplicationContext implements
+ Serializable {
+
+ protected PortletSession portletSession;
+
+ protected Map<Application, Set<PortletListener>> portletListeners = new HashMap<Application, Set<PortletListener>>();
+
+ protected Map<Portlet, Application> portletToApplication = new HashMap<Portlet, Application>();
+
+ PortletApplicationContext() {
+
+ }
+
+ static public PortletApplicationContext getApplicationContext(
+ PortletSession session) {
+ WebApplicationContext cx = (WebApplicationContext) session
+ .getAttribute(WebApplicationContext.class.getName(),
+ PortletSession.APPLICATION_SCOPE);
+ if (cx == null) {
+ cx = new PortletApplicationContext();
+ }
+ if (!(cx instanceof PortletApplicationContext)) {
// TODO Should we even try this? And should we leave original as-is?
- PortletApplicationContext pcx = new PortletApplicationContext();
- pcx.applications.addAll(cx.applications);
- cx.applications.clear();
- pcx.browser = cx.browser;
- cx.browser = null;
- pcx.listeners = cx.listeners;
- cx.listeners = null;
- pcx.session = cx.session;
- cx = pcx;
- }
- if (((PortletApplicationContext) cx).portletSession == null) {
- ((PortletApplicationContext) cx).portletSession = session;
- }
- session.setAttribute(WebApplicationContext.class.getName(), cx,
- PortletSession.APPLICATION_SCOPE);
- return (PortletApplicationContext) cx;
- }
-
- static public WebApplicationContext getApplicationContext(
- HttpSession session) {
- WebApplicationContext cx = (WebApplicationContext) session
- .getAttribute(WebApplicationContext.class.getName());
- if (cx == null) {
- cx = new PortletApplicationContext();
- }
- if (cx.session == null) {
- cx.session = session;
- }
- session.setAttribute(WebApplicationContext.class.getName(), cx);
- return cx;
- }
-
- @Override
- protected void removeApplication(Application application) {
- portletListeners.remove(application);
- for (Iterator<Application> it = portletToApplication.values()
- .iterator(); it.hasNext();) {
- Application value = it.next();
- if (value == application) {
+ PortletApplicationContext pcx = new PortletApplicationContext();
+ pcx.applications.addAll(cx.applications);
+ cx.applications.clear();
+ pcx.browser = cx.browser;
+ cx.browser = null;
+ pcx.listeners = cx.listeners;
+ cx.listeners = null;
+ pcx.session = cx.session;
+ cx = pcx;
+ }
+ if (((PortletApplicationContext) cx).portletSession == null) {
+ ((PortletApplicationContext) cx).portletSession = session;
+ }
+ session.setAttribute(WebApplicationContext.class.getName(), cx,
+ PortletSession.APPLICATION_SCOPE);
+ return (PortletApplicationContext) cx;
+ }
+
+ static public WebApplicationContext getApplicationContext(
+ HttpSession session) {
+ WebApplicationContext cx = (WebApplicationContext) session
+ .getAttribute(WebApplicationContext.class.getName());
+ if (cx == null) {
+ cx = new PortletApplicationContext();
+ }
+ if (cx.session == null) {
+ cx.session = session;
+ }
+ session.setAttribute(WebApplicationContext.class.getName(), cx);
+ return cx;
+ }
+
+ @Override
+ protected void removeApplication(Application application) {
+ portletListeners.remove(application);
+ for (Iterator<Application> it = portletToApplication.values()
+ .iterator(); it.hasNext();) {
+ Application value = it.next();
+ if (value == application) {
// values().iterator() is backed by the map
- it.remove();
- }
- }
- super.removeApplication(application);
- }
-
- public void setPortletApplication(Portlet portlet, Application app) {
- portletToApplication.put(portlet, app);
- }
-
- public Application getPortletApplication(Portlet portlet) {
- return portletToApplication.get(portlet);
- }
-
- public PortletSession getPortletSession() {
- return portletSession;
- }
-
- public void addPortletListener(Application app, PortletListener listener) {
- Set<PortletListener> l = portletListeners.get(app);
- if (l == null) {
- l = new LinkedHashSet<PortletListener>();
- portletListeners.put(app, l);
- }
- l.add(listener);
- }
-
- public void removePortletListener(Application app, PortletListener listener) {
- Set<PortletListener> l = portletListeners.get(app);
- if (l != null) {
- l.remove(listener);
- }
- }
-
- public static void dispatchRequest(Portlet portlet, RenderRequest request,
- RenderResponse response) {
- PortletApplicationContext ctx = getApplicationContext(request
- .getPortletSession());
- if (ctx != null) {
- ctx.firePortletRenderRequest(portlet, request, response);
- }
- }
-
- public static void dispatchRequest(Portlet portlet, ActionRequest request,
- ActionResponse response) {
- PortletApplicationContext ctx = getApplicationContext(request
- .getPortletSession());
- if (ctx != null) {
- ctx.firePortletActionRequest(portlet, request, response);
- }
- }
-
- public void firePortletRenderRequest(Portlet portlet,
- RenderRequest request, RenderResponse response) {
- Application app = getPortletApplication(portlet);
- Set<PortletListener> listeners = portletListeners.get(app);
- if (listeners != null) {
- for (PortletListener l : listeners) {
- l.handleRenderRequest(request, new RestrictedRenderResponse(
- response));
- }
- }
- }
-
- public void firePortletActionRequest(Portlet portlet,
- ActionRequest request, ActionResponse response) {
- Application app = getPortletApplication(portlet);
- Set<PortletListener> listeners = portletListeners.get(app);
- if (listeners != null) {
- for (PortletListener l : listeners) {
- l.handleActionRequest(request, response);
- }
- }
- }
-
- public interface PortletListener extends Serializable {
- public void handleRenderRequest(RenderRequest request,
- RenderResponse response);
-
- public void handleActionRequest(ActionRequest request,
- ActionResponse response);
- }
-
-}
+ it.remove();
+ }
+ }
+ super.removeApplication(application);
+ }
+
+ public void setPortletApplication(Portlet portlet, Application app) {
+ portletToApplication.put(portlet, app);
+ }
+
+ public Application getPortletApplication(Portlet portlet) {
+ return portletToApplication.get(portlet);
+ }
+
+ public PortletSession getPortletSession() {
+ return portletSession;
+ }
+
+ public void addPortletListener(Application app, PortletListener listener) {
+ Set<PortletListener> l = portletListeners.get(app);
+ if (l == null) {
+ l = new LinkedHashSet<PortletListener>();
+ portletListeners.put(app, l);
+ }
+ l.add(listener);
+ }
+
+ public void removePortletListener(Application app, PortletListener listener) {
+ Set<PortletListener> l = portletListeners.get(app);
+ if (l != null) {
+ l.remove(listener);
+ }
+ }
+
+ public static void dispatchRequest(Portlet portlet, RenderRequest request,
+ RenderResponse response) {
+ PortletApplicationContext ctx = getApplicationContext(request
+ .getPortletSession());
+ if (ctx != null) {
+ ctx.firePortletRenderRequest(portlet, request, response);
+ }
+ }
+
+ public static void dispatchRequest(Portlet portlet, ActionRequest request,
+ ActionResponse response) {
+ PortletApplicationContext ctx = getApplicationContext(request
+ .getPortletSession());
+ if (ctx != null) {
+ ctx.firePortletActionRequest(portlet, request, response);
+ }
+ }
+
+ public void firePortletRenderRequest(Portlet portlet,
+ RenderRequest request, RenderResponse response) {
+ Application app = getPortletApplication(portlet);
+ Set<PortletListener> listeners = portletListeners.get(app);
+ if (listeners != null) {
+ for (PortletListener l : listeners) {
+ l.handleRenderRequest(request, new RestrictedRenderResponse(
+ response));
+ }
+ }
+ }
+
+ public void firePortletActionRequest(Portlet portlet,
+ ActionRequest request, ActionResponse response) {
+ Application app = getPortletApplication(portlet);
+ Set<PortletListener> listeners = portletListeners.get(app);
+ if (listeners != null) {
+ for (PortletListener l : listeners) {
+ l.handleActionRequest(request, response);
+ }
+ }
+ }
+
+ public interface PortletListener extends Serializable {
+ public void handleRenderRequest(RenderRequest request,
+ RenderResponse response);
+
+ public void handleActionRequest(ActionRequest request,
+ ActionResponse response);
+ }
+
+}
diff --git a/src/com/vaadin/terminal/gwt/server/RestrictedRenderResponse.java b/src/com/vaadin/terminal/gwt/server/RestrictedRenderResponse.java
index 6e9c8988ce..c57a02e111 100644
--- a/src/com/vaadin/terminal/gwt/server/RestrictedRenderResponse.java
+++ b/src/com/vaadin/terminal/gwt/server/RestrictedRenderResponse.java
@@ -1,147 +1,147 @@
/*
@ITMillApache2LicenseForJavaFiles@
*/
-package com.vaadin.terminal.gwt.server;
-
-import java.io.IOException;
-import java.io.OutputStream;
-import java.io.PrintWriter;
-import java.io.Serializable;
-import java.util.Collection;
-import java.util.Locale;
-
-import javax.portlet.CacheControl;
-import javax.portlet.PortletMode;
-import javax.portlet.PortletURL;
-import javax.portlet.RenderResponse;
-import javax.portlet.ResourceURL;
-import javax.servlet.http.Cookie;
-
-import org.w3c.dom.DOMException;
-import org.w3c.dom.Element;
-
-/**
- * Read-only wrapper for a {@link RenderResponse}.
- *
- * Only for use by {@link PortletApplicationContext} and
- * {@link PortletApplicationContext2}.
- */
-class RestrictedRenderResponse implements RenderResponse, Serializable {
-
- private RenderResponse response;
-
- RestrictedRenderResponse(RenderResponse response) {
- this.response = response;
- }
-
- public void addProperty(String key, String value) {
- response.addProperty(key, value);
- }
-
- public PortletURL createActionURL() {
- return response.createActionURL();
- }
-
- public PortletURL createRenderURL() {
- return response.createRenderURL();
- }
-
- public String encodeURL(String path) {
- return response.encodeURL(path);
- }
-
- public void flushBuffer() throws IOException {
+package com.vaadin.terminal.gwt.server;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.PrintWriter;
+import java.io.Serializable;
+import java.util.Collection;
+import java.util.Locale;
+
+import javax.portlet.CacheControl;
+import javax.portlet.PortletMode;
+import javax.portlet.PortletURL;
+import javax.portlet.RenderResponse;
+import javax.portlet.ResourceURL;
+import javax.servlet.http.Cookie;
+
+import org.w3c.dom.DOMException;
+import org.w3c.dom.Element;
+
+/**
+ * Read-only wrapper for a {@link RenderResponse}.
+ *
+ * Only for use by {@link PortletApplicationContext} and
+ * {@link PortletApplicationContext2}.
+ */
+class RestrictedRenderResponse implements RenderResponse, Serializable {
+
+ private RenderResponse response;
+
+ RestrictedRenderResponse(RenderResponse response) {
+ this.response = response;
+ }
+
+ public void addProperty(String key, String value) {
+ response.addProperty(key, value);
+ }
+
+ public PortletURL createActionURL() {
+ return response.createActionURL();
+ }
+
+ public PortletURL createRenderURL() {
+ return response.createRenderURL();
+ }
+
+ public String encodeURL(String path) {
+ return response.encodeURL(path);
+ }
+
+ public void flushBuffer() throws IOException {
// NOP
// TODO throw?
- }
-
- public int getBufferSize() {
- return response.getBufferSize();
- }
-
- public String getCharacterEncoding() {
- return response.getCharacterEncoding();
- }
-
- public String getContentType() {
- return response.getContentType();
- }
-
- public Locale getLocale() {
- return response.getLocale();
- }
-
- public String getNamespace() {
- return response.getNamespace();
- }
-
- public OutputStream getPortletOutputStream() throws IOException {
+ }
+
+ public int getBufferSize() {
+ return response.getBufferSize();
+ }
+
+ public String getCharacterEncoding() {
+ return response.getCharacterEncoding();
+ }
+
+ public String getContentType() {
+ return response.getContentType();
+ }
+
+ public Locale getLocale() {
+ return response.getLocale();
+ }
+
+ public String getNamespace() {
+ return response.getNamespace();
+ }
+
+ public OutputStream getPortletOutputStream() throws IOException {
// write forbidden
- return null;
- }
-
- public PrintWriter getWriter() throws IOException {
+ return null;
+ }
+
+ public PrintWriter getWriter() throws IOException {
// write forbidden
- return null;
- }
-
- public boolean isCommitted() {
- return response.isCommitted();
- }
-
- public void reset() {
+ return null;
+ }
+
+ public boolean isCommitted() {
+ return response.isCommitted();
+ }
+
+ public void reset() {
// NOP
// TODO throw?
- }
-
- public void resetBuffer() {
+ }
+
+ public void resetBuffer() {
// NOP
// TODO throw?
- }
-
- public void setBufferSize(int size) {
+ }
+
+ public void setBufferSize(int size) {
// NOP
// TODO throw?
- }
-
- public void setContentType(String type) {
+ }
+
+ public void setContentType(String type) {
// NOP
// TODO throw?
- }
-
- public void setProperty(String key, String value) {
- response.setProperty(key, value);
- }
-
- public void setTitle(String title) {
- response.setTitle(title);
- }
-
- public void setNextPossiblePortletModes(Collection<PortletMode> portletModes) {
+ }
+
+ public void setProperty(String key, String value) {
+ response.setProperty(key, value);
+ }
+
+ public void setTitle(String title) {
+ response.setTitle(title);
+ }
+
+ public void setNextPossiblePortletModes(Collection<PortletMode> portletModes) {
// NOP
// TODO throw?
- }
-
- public ResourceURL createResourceURL() {
- return response.createResourceURL();
- }
-
- public CacheControl getCacheControl() {
- return response.getCacheControl();
- }
-
- public void addProperty(Cookie cookie) {
+ }
+
+ public ResourceURL createResourceURL() {
+ return response.createResourceURL();
+ }
+
+ public CacheControl getCacheControl() {
+ return response.getCacheControl();
+ }
+
+ public void addProperty(Cookie cookie) {
// NOP
// TODO throw?
- }
-
- public void addProperty(String key, Element element) {
+ }
+
+ public void addProperty(String key, Element element) {
// NOP
// TODO throw?
- }
-
- public Element createElement(String tagName) throws DOMException {
+ }
+
+ public Element createElement(String tagName) throws DOMException {
// NOP
- return null;
- }
+ return null;
+ }
} \ No newline at end of file
diff --git a/src/com/vaadin/terminal/gwt/server/SystemMessageException.java b/src/com/vaadin/terminal/gwt/server/SystemMessageException.java
index 67a033ea3b..3fdba28c06 100644
--- a/src/com/vaadin/terminal/gwt/server/SystemMessageException.java
+++ b/src/com/vaadin/terminal/gwt/server/SystemMessageException.java
@@ -1,57 +1,57 @@
/*
@ITMillApache2LicenseForJavaFiles@
*/
-package com.vaadin.terminal.gwt.server;
-
-@SuppressWarnings("serial")
-public class SystemMessageException extends RuntimeException {
-
- /**
- * Cause of the method exception
- */
- private Throwable cause;
-
- /**
- * Constructs a new <code>SystemMessageException</code> with the specified
- * detail message.
- *
- * @param msg
- * the detail message.
- */
- public SystemMessageException(String msg) {
- super(msg);
- }
-
- /**
- * Constructs a new <code>SystemMessageException</code> with the specified
- * detail message and cause.
- *
- * @param msg
- * the detail message.
- * @param cause
- * the cause of the exception.
- */
- public SystemMessageException(String msg, Throwable cause) {
- super(msg, cause);
- }
-
- /**
- * Constructs a new <code>SystemMessageException</code> from another
- * exception.
- *
- * @param cause
- * the cause of the exception.
- */
- public SystemMessageException(Throwable cause) {
- this.cause = cause;
- }
-
- /**
- * @see java.lang.Throwable#getCause()
- */
- @Override
- public Throwable getCause() {
- return cause;
- }
-
+package com.vaadin.terminal.gwt.server;
+
+@SuppressWarnings("serial")
+public class SystemMessageException extends RuntimeException {
+
+ /**
+ * Cause of the method exception
+ */
+ private Throwable cause;
+
+ /**
+ * Constructs a new <code>SystemMessageException</code> with the specified
+ * detail message.
+ *
+ * @param msg
+ * the detail message.
+ */
+ public SystemMessageException(String msg) {
+ super(msg);
+ }
+
+ /**
+ * Constructs a new <code>SystemMessageException</code> with the specified
+ * detail message and cause.
+ *
+ * @param msg
+ * the detail message.
+ * @param cause
+ * the cause of the exception.
+ */
+ public SystemMessageException(String msg, Throwable cause) {
+ super(msg, cause);
+ }
+
+ /**
+ * Constructs a new <code>SystemMessageException</code> from another
+ * exception.
+ *
+ * @param cause
+ * the cause of the exception.
+ */
+ public SystemMessageException(Throwable cause) {
+ this.cause = cause;
+ }
+
+ /**
+ * @see java.lang.Throwable#getCause()
+ */
+ @Override
+ public Throwable getCause() {
+ return cause;
+ }
+
} \ No newline at end of file
diff --git a/src/com/vaadin/tools/WidgetsetCompiler.java b/src/com/vaadin/tools/WidgetsetCompiler.java
index 6373caac7d..ad1c5cfcd2 100644
--- a/src/com/vaadin/tools/WidgetsetCompiler.java
+++ b/src/com/vaadin/tools/WidgetsetCompiler.java
@@ -1,82 +1,82 @@
/*
@ITMillApache2LicenseForJavaFiles@
*/
-package com.vaadin.tools;
-
-import java.lang.reflect.Method;
-
-import com.vaadin.terminal.gwt.widgetsetutils.WidgetSetBuilder;
-
-/**
- * A wrapper for the GWT 1.6 compiler that runs the compiler in a new thread.
- *
- * This allows circumventing a J2SE 5.0 bug (6316197) that prevents setting the
- * stack size for the main thread. Thus, larger widgetsets can be compiled.
- *
- * This class takes the same command line arguments as the
- * com.google.gwt.dev.GWTCompiler class. The old and deprecated compiler is used
- * for compatibility with GWT 1.5.
- *
- * A typical invocation would use e.g. the following arguments
- *
- * "-out WebContent/VAADIN/widgetsets com.vaadin.terminal.gwt.DefaultWidgetSet"
- *
- * In addition, larger memory usage settings for the VM should be used, e.g.
- *
- * "-Xms256M -Xmx512M -Xss8M"
- *
- * The source directory containing widgetset and related classes must be
- * included in the classpath, as well as the gwt-dev-[platform].jar and other
- * relevant JARs.
- */
-public class WidgetsetCompiler {
-
- /**
- * @param args
- * same arguments as for com.google.gwt.dev.Compiler
- */
- public static void main(final String[] args) {
- try {
+package com.vaadin.tools;
+
+import java.lang.reflect.Method;
+
+import com.vaadin.terminal.gwt.widgetsetutils.WidgetSetBuilder;
+
+/**
+ * A wrapper for the GWT 1.6 compiler that runs the compiler in a new thread.
+ *
+ * This allows circumventing a J2SE 5.0 bug (6316197) that prevents setting the
+ * stack size for the main thread. Thus, larger widgetsets can be compiled.
+ *
+ * This class takes the same command line arguments as the
+ * com.google.gwt.dev.GWTCompiler class. The old and deprecated compiler is used
+ * for compatibility with GWT 1.5.
+ *
+ * A typical invocation would use e.g. the following arguments
+ *
+ * "-out WebContent/VAADIN/widgetsets com.vaadin.terminal.gwt.DefaultWidgetSet"
+ *
+ * In addition, larger memory usage settings for the VM should be used, e.g.
+ *
+ * "-Xms256M -Xmx512M -Xss8M"
+ *
+ * The source directory containing widgetset and related classes must be
+ * included in the classpath, as well as the gwt-dev-[platform].jar and other
+ * relevant JARs.
+ */
+public class WidgetsetCompiler {
+
+ /**
+ * @param args
+ * same arguments as for com.google.gwt.dev.Compiler
+ */
+ public static void main(final String[] args) {
+ try {
// run the compiler in a different thread to enable using the
// user-set stack size
-
+
// on Windows, the default stack size is too small for the main
// thread and cannot be changed in JRE 1.5 (see
// http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6316197)
-
- Runnable runCompiler = new Runnable() {
- public void run() {
- try {
+
+ Runnable runCompiler = new Runnable() {
+ public void run() {
+ try {
// GWTCompiler.main(args);
// avoid warnings
-
- String wsname = args[args.length - 1];
-
+
+ String wsname = args[args.length - 1];
+
// TODO expecting this is launched via eclipse WTP
// project
- System.out
- .println("Updating GWT module description file...");
- WidgetSetBuilder.updateWidgetSet(wsname);
- System.out.println("Done.");
-
- System.out.println("Starting GWT compiler");
- System.setProperty("gwt.nowarn.legacy.tools", "true");
- Class<?> compilerClass = Class
- .forName("com.google.gwt.dev.GWTCompiler");
- Method method = compilerClass.getDeclaredMethod("main",
- String[].class);
- method.invoke(null, new Object[] { args });
- } catch (Throwable thr) {
- thr.printStackTrace();
- }
- }
- };
- Thread runThread = new Thread(runCompiler);
- runThread.start();
- runThread.join();
- System.out.println("Widgetset compilation finished");
- } catch (Throwable thr) {
- thr.printStackTrace();
- }
- }
-}
+ System.out
+ .println("Updating GWT module description file...");
+ WidgetSetBuilder.updateWidgetSet(wsname);
+ System.out.println("Done.");
+
+ System.out.println("Starting GWT compiler");
+ System.setProperty("gwt.nowarn.legacy.tools", "true");
+ Class<?> compilerClass = Class
+ .forName("com.google.gwt.dev.GWTCompiler");
+ Method method = compilerClass.getDeclaredMethod("main",
+ String[].class);
+ method.invoke(null, new Object[] { args });
+ } catch (Throwable thr) {
+ thr.printStackTrace();
+ }
+ }
+ };
+ Thread runThread = new Thread(runCompiler);
+ runThread.start();
+ runThread.join();
+ System.out.println("Widgetset compilation finished");
+ } catch (Throwable thr) {
+ thr.printStackTrace();
+ }
+ }
+}
diff --git a/src/com/vaadin/ui/AbstractComponent.java b/src/com/vaadin/ui/AbstractComponent.java
index 90eef00604..f4d7aa3238 100644
--- a/src/com/vaadin/ui/AbstractComponent.java
+++ b/src/com/vaadin/ui/AbstractComponent.java
@@ -317,16 +317,16 @@ public abstract class AbstractComponent implements Component, MethodEventSource
*
* <pre>
* // Component for which the locale is meaningful
- * InlineDateField date = new InlineDateField("Datum");
- *
+ * InlineDateField date = new InlineDateField(&quot;Datum&quot;);
+ *
* // German language specified with ISO 639-1 language
* // code and ISO 3166-1 alpha-2 country code.
- * date.setLocale(new Locale("de", "DE"));
- *
+ * date.setLocale(new Locale(&quot;de&quot;, &quot;DE&quot;));
+ *
* date.setResolution(DateField.RESOLUTION_DAY);
* layout.addComponent(date);
* </pre>
-
+ *
*
* @param locale
* the locale to become this component's locale.
diff --git a/src/com/vaadin/ui/Tree.java b/src/com/vaadin/ui/Tree.java
index 11b049d803..4e7fda5d88 100644
--- a/src/com/vaadin/ui/Tree.java
+++ b/src/com/vaadin/ui/Tree.java
@@ -119,9 +119,9 @@ public class Tree extends AbstractSelect implements Container.Hierarchical,
}
private TreeDragMode dragMode = TreeDragMode.NONE;
-
+
private MultiSelectMode multiSelectMode = MultiSelectMode.DEFAULT;
-
+
/* Tree constructors */
/**
@@ -340,7 +340,7 @@ public class Tree extends AbstractSelect implements Container.Hierarchical,
requestRepaint();
}
}
-
+
/**
* Sets the behavior of the multiselect mode
*