diff options
author | Artur Signell <artur.signell@itmill.com> | 2010-01-25 15:45:08 +0000 |
---|---|---|
committer | Artur Signell <artur.signell@itmill.com> | 2010-01-25 15:45:08 +0000 |
commit | d5afb8f7999bbe5166d3d3dd978fbba41fd5f012 (patch) | |
tree | 12eacdb37e3d2c65d6e5a746a76788239820bbaa /src/com/vaadin | |
parent | d1a635a81be3a6de05b923e6c36e76beb28664e4 (diff) | |
download | vaadin-framework-d5afb8f7999bbe5166d3d3dd978fbba41fd5f012.tar.gz vaadin-framework-d5afb8f7999bbe5166d3d3dd978fbba41fd5f012.zip |
Merged [10797]-[10991] from 6.2
svn changeset:10996/svn branch:6.3
Diffstat (limited to 'src/com/vaadin')
6 files changed, 73 insertions, 42 deletions
diff --git a/src/com/vaadin/service/FileTypeResolver.java b/src/com/vaadin/service/FileTypeResolver.java index 599cce924f..566f299376 100644 --- a/src/com/vaadin/service/FileTypeResolver.java +++ b/src/com/vaadin/service/FileTypeResolver.java @@ -245,7 +245,13 @@ public class FileTypeResolver implements Serializable { dotIndex++; if (fileName.length() > dotIndex) { - final String ext = fileName.substring(dotIndex); + String ext = fileName.substring(dotIndex); + + // Ignore any query parameters + int queryStringStart = ext.indexOf('?'); + if (queryStringStart > 0) { + ext = ext.substring(0, queryStringStart); + } // Return type from extension map, if found final String type = (String) extToMIMEMap.get(ext); diff --git a/src/com/vaadin/terminal/gwt/client/ApplicationConnection.java b/src/com/vaadin/terminal/gwt/client/ApplicationConnection.java index 70cb99bc23..1c3128dbdf 100755 --- a/src/com/vaadin/terminal/gwt/client/ApplicationConnection.java +++ b/src/com/vaadin/terminal/gwt/client/ApplicationConnection.java @@ -1324,11 +1324,12 @@ public class ApplicationConnection { /** * Sends a new value for the given paintables given variable to the server. - * <p> + * * The update is actually queued to be sent at a suitable time. If immediate * is true, the update is sent as soon as possible. If immediate is false, * the update will be sent along with the next immediate update. - * </p> + * + * A null array is sent as an empty array. * * @param paintableId * the id of the paintable that owns the variable @@ -1342,11 +1343,14 @@ public class ApplicationConnection { public void updateVariable(String paintableId, String variableName, String[] values, boolean immediate) { final StringBuffer buf = new StringBuffer(); - for (int i = 0; i < values.length; i++) { - if (i > 0) { + if (values != null) { + for (int i = 0; i < values.length; i++) { + buf.append(values[i]); + // there will be an extra separator at the end to differentiate + // between an empty array and one containing an empty string + // only buf.append(VAR_ARRAYITEM_SEPARATOR); } - buf.append(values[i]); } addVariableToQueue(paintableId, variableName, buf.toString(), immediate, 'c'); @@ -1354,11 +1358,13 @@ public class ApplicationConnection { /** * Sends a new value for the given paintables given variable to the server. - * <p> + * * The update is actually queued to be sent at a suitable time. If immediate * is true, the update is sent as soon as possible. If immediate is false, - * the update will be sent along with the next immediate update. - * </p> + * the update will be sent along with the next immediate update. </p> + * + * A null array is sent as an empty array. + * * * @param paintableId * the id of the paintable that owns the variable @@ -1372,18 +1378,20 @@ public class ApplicationConnection { public void updateVariable(String paintableId, String variableName, Object[] values, boolean immediate) { final StringBuffer buf = new StringBuffer(); - for (int i = 0; i < values.length; i++) { - if (i > 0) { - buf.append(VAR_ARRAYITEM_SEPARATOR); - } - Object value = values[i]; - char transportType = getTransportType(value); - // first char tells the type in array - buf.append(transportType); - if (transportType == 'p') { - buf.append(getPid((Paintable) value)); - } else { - buf.append(value); + if (values != null) { + for (int i = 0; i < values.length; i++) { + if (i > 0) { + buf.append(VAR_ARRAYITEM_SEPARATOR); + } + Object value = values[i]; + char transportType = getTransportType(value); + // first char tells the type in array + buf.append(transportType); + if (transportType == 'p') { + buf.append(getPid((Paintable) value)); + } else { + buf.append(value); + } } } addVariableToQueue(paintableId, variableName, buf.toString(), diff --git a/src/com/vaadin/terminal/gwt/client/ui/VSplitPanel.java b/src/com/vaadin/terminal/gwt/client/ui/VSplitPanel.java index 27fdf9506f..d7a11427fb 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/VSplitPanel.java +++ b/src/com/vaadin/terminal/gwt/client/ui/VSplitPanel.java @@ -16,7 +16,6 @@ import com.google.gwt.user.client.DeferredCommand; import com.google.gwt.user.client.Element; import com.google.gwt.user.client.Event; import com.google.gwt.user.client.ui.ComplexPanel; -import com.google.gwt.user.client.ui.RootPanel; import com.google.gwt.user.client.ui.Widget; import com.vaadin.terminal.gwt.client.ApplicationConnection; import com.vaadin.terminal.gwt.client.BrowserInfo; @@ -503,7 +502,7 @@ public class VSplitPanel extends ComplexPanel implements Container, DOM.setStyleAttribute(draggingCurtain, "zIndex", "" + VOverlay.Z_INDEX); - DOM.appendChild(RootPanel.getBodyElement(), draggingCurtain); + DOM.appendChild(wrapper, draggingCurtain); } } @@ -521,7 +520,7 @@ public class VSplitPanel extends ComplexPanel implements Container, */ private void hideDraggingCurtain() { if (draggingCurtain != null) { - DOM.removeChild(RootPanel.getBodyElement(), draggingCurtain); + DOM.removeChild(wrapper, draggingCurtain); draggingCurtain = null; } } diff --git a/src/com/vaadin/terminal/gwt/client/ui/VWindow.java b/src/com/vaadin/terminal/gwt/client/ui/VWindow.java index e1ab149dc5..0cae63b8ca 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/VWindow.java +++ b/src/com/vaadin/terminal/gwt/client/ui/VWindow.java @@ -1065,6 +1065,10 @@ public class VWindow extends VOverlay implements Container, ScrollListener { } else if (vaadinModality) { // return false when modal and outside window final Element target = event.getTarget().cast(); + if (DOM.getCaptureElement() != null) { + // Allow events when capture is set + return true; + } if (!DOM.isOrHasChild(getElement(), target)) { // not within the modal window, but let's see if it's in the diff --git a/src/com/vaadin/terminal/gwt/server/AbstractCommunicationManager.java b/src/com/vaadin/terminal/gwt/server/AbstractCommunicationManager.java index 72c383b0c1..2bc10b4cc0 100644 --- a/src/com/vaadin/terminal/gwt/server/AbstractCommunicationManager.java +++ b/src/com/vaadin/terminal/gwt/server/AbstractCommunicationManager.java @@ -59,6 +59,7 @@ import java.util.List; import java.util.Locale; import java.util.Map; import java.util.Set; +import java.util.StringTokenizer; import javax.portlet.PortletRequest; import javax.portlet.PortletResponse; @@ -1211,7 +1212,7 @@ public abstract class AbstractCommunicationManager implements val = convertMap(strValue); break; case VTYPE_STRINGARRAY: - val = strValue.split(VAR_ARRAYITEM_SEPARATOR); + val = convertStringArray(strValue); break; case VTYPE_STRING: val = strValue; @@ -1244,19 +1245,44 @@ public abstract class AbstractCommunicationManager implements HashMap<String, Object> map = new HashMap<String, Object>(); for (int i = 0; i < parts.length; i += 2) { String key = parts[i]; - char variabletype = key.charAt(0); - Object value = convertVariableValue(variabletype, parts[i + 1]); - map.put(key.substring(1), value); + if (key.length() > 0) { + char variabletype = key.charAt(0); + Object value = convertVariableValue(variabletype, parts[i + 1]); + map.put(key.substring(1), value); + } } return map; } + private String[] convertStringArray(String strValue) { + // need to return delimiters and filter them out; otherwise empty + // strings are lost + // an extra empty delimiter at the end is automatically eliminated + StringTokenizer tokenizer = new StringTokenizer(strValue, + VAR_ARRAYITEM_SEPARATOR, true); + List<String> tokens = new ArrayList<String>(); + String prevToken = VAR_ARRAYITEM_SEPARATOR; + while (tokenizer.hasMoreTokens()) { + String token = tokenizer.nextToken(); + if (!VAR_ARRAYITEM_SEPARATOR.equals(token)) { + tokens.add(token); + } else if (VAR_ARRAYITEM_SEPARATOR.equals(prevToken)) { + tokens.add(""); + } + prevToken = token; + } + return tokens.toArray(new String[tokens.size()]); + } + private Object convertArray(String strValue) { String[] val = strValue.split(VAR_ARRAYITEM_SEPARATOR); + if (val.length == 0 || (val.length == 1 && val[0].length() == 0)) { + return new Object[0]; + } Object[] values = new Object[val.length]; for (int i = 0; i < values.length; i++) { String string = val[i]; - // first char of string is typ + // first char of string is type char variableType = string.charAt(0); values[i] = convertVariableValue(variableType, string.substring(1)); } diff --git a/src/com/vaadin/ui/LoginForm.java b/src/com/vaadin/ui/LoginForm.java index 9d1de60505..dd6b527b4c 100644 --- a/src/com/vaadin/ui/LoginForm.java +++ b/src/com/vaadin/ui/LoginForm.java @@ -43,9 +43,6 @@ public class LoginForm extends CustomComponent { private ApplicationResource loginPage = new ApplicationResource() { - /** - * - */ private static final long serialVersionUID = 1L; public Application getApplication() { @@ -76,9 +73,6 @@ public class LoginForm extends CustomComponent { private ParameterHandler paramHandler = new ParameterHandler() { - /** - * - */ private static final long serialVersionUID = 1L; public void handleParameters(Map<String, String[]> parameters) { @@ -100,9 +94,6 @@ public class LoginForm extends CustomComponent { }; private URIHandler uriHandler = new URIHandler() { - /** - * - */ private static final long serialVersionUID = 1L; private final String responce = "<html><body>Login form handeled." + "<script type='text/javascript'>top.vaadin.forceSync();" @@ -175,7 +166,7 @@ public class LoginForm extends CustomComponent { + "<div class='v-app v-app-loginpage' style=\"background:transparent;\">" + "<iframe name='logintarget' style='width:0;height:0;" + "border:0;margin:0;padding:0;'></iframe>" - + "<form id='loginf' target='logintarget' onkeypress=\"submitOnEnter(event)\">" + + "<form id='loginf' target='logintarget' onkeypress=\"submitOnEnter(event)\" method=\"post\">" + "<div>Username</div><div >" + "<input class='v-textfield' style='display:block;' type='text' name='username'></div>" + "<div>Password</div>" @@ -211,9 +202,6 @@ public class LoginForm extends CustomComponent { */ public class LoginEvent extends Event { - /** - * - */ private static final long serialVersionUID = 1L; private Map<String, String> params; |