From: Henri Sara Date: Sun, 19 Feb 2012 10:04:42 +0000 (+0200) Subject: Merge branch 'master' into rpc X-Git-Tag: 7.0.0.alpha2~440^2~19 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=1faaa184dc8fbcd551049c78e420a7cfff0ede0e;p=vaadin-framework.git Merge branch 'master' into rpc Conflicts: src/com/vaadin/terminal/gwt/server/AbstractCommunicationManager.java --- 1faaa184dc8fbcd551049c78e420a7cfff0ede0e diff --cc src/com/vaadin/terminal/gwt/server/AbstractCommunicationManager.java index 85643e2b8a,705bf13346..f394966ea3 --- a/src/com/vaadin/terminal/gwt/server/AbstractCommunicationManager.java +++ b/src/com/vaadin/terminal/gwt/server/AbstractCommunicationManager.java @@@ -1309,85 -1256,23 +1309,87 @@@ public abstract class AbstractCommunica continue; } - // Ignore variable change - String msg = "Warning: Ignoring variable change for "; - if (owner != null) { - msg += "disabled component " + owner.getClass(); - String caption = ((Component) owner).getCaption(); - if (caption != null) { - msg += ", caption=" + caption; + final VariableOwner owner = getVariableOwner(invocation + .getPaintableId()); + + if (owner != null && owner.isEnabled()) { + VariableChange change = new VariableChange(invocation); + + // TODO could optimize with a single value map if only one + // change for a paintable + + Map m = new HashMap(); + m.put(change.getName(), change.getValue()); + while (nextInvocation != null + && invocation.getPaintableId().equals( + nextInvocation.getPaintableId()) + && ApplicationConnection.UPDATE_VARIABLE_METHOD + .equals(nextInvocation.getMethodName())) { + i++; + invocation = nextInvocation; + change = new VariableChange(invocation); + m.put(change.getName(), change.getValue()); + if (i + 1 < invocations.size()) { + nextInvocation = invocations.get(i + 1); + } else { + nextInvocation = null; + } + } + + try { + changeVariables(source, owner, m); + } catch (Exception e) { ++ Component errorComponent = null; + if (owner instanceof Component) { - handleChangeVariablesError(app, (Component) owner, - e, m); - } else { - // TODO DragDropService error handling - throw new RuntimeException(e); ++ errorComponent = (Component) owner; ++ } else if (owner instanceof DragAndDropService) { ++ if (m.get("dhowner") instanceof Component) { ++ errorComponent = (Component) m.get("dhowner"); ++ } + } ++ handleChangeVariablesError(app, errorComponent, e, m); } } else { - msg += "non-existent component, VAR_PID=" - + variable[VAR_PID]; - success = false; + // TODO convert window close to a separate RPC call and + // handle above - not a variable change + + VariableChange change = new VariableChange(invocation); + + // Handle special case where window-close is called + // after the window has been removed from the + // application or the application has closed + if ("close".equals(change.getName()) + && Boolean.TRUE.equals(change.getValue())) { + // Silently ignore this + continue; + } + + // Ignore variable change + String msg = "Warning: Ignoring RPC call for "; + if (owner != null) { + msg += "disabled component " + owner.getClass(); + String caption = ((Component) owner).getCaption(); + if (caption != null) { + msg += ", caption=" + caption; + } + } else { + msg += "non-existent component, VAR_PID=" + + invocation.getPaintableId(); + // TODO should this cause the message to be ignored? + success = false; + } + logger.warning(msg); + continue; } - logger.warning(msg); - continue; } + + } catch (JSONException e) { + logger.warning("Unable to parse RPC call from the client: " + + e.getMessage()); + // TODO or return success = false? + throw new RuntimeException(e); } + return success; }