]> source.dussan.org Git - vaadin-framework.git/commitdiff
Merge branch 'master' into rpc
authorHenri Sara <hesara@vaadin.com>
Sun, 19 Feb 2012 10:04:42 +0000 (12:04 +0200)
committerHenri Sara <hesara@vaadin.com>
Sun, 19 Feb 2012 10:04:42 +0000 (12:04 +0200)
Conflicts:
src/com/vaadin/terminal/gwt/server/AbstractCommunicationManager.java

1  2 
src/com/vaadin/terminal/gwt/DefaultWidgetSet.gwt.xml
src/com/vaadin/terminal/gwt/client/Util.java
src/com/vaadin/terminal/gwt/client/VPaintableMap.java
src/com/vaadin/terminal/gwt/server/AbstractCommunicationManager.java

index 85643e2b8ab6153c23eeff3ccece507c963ee19e,705bf13346ed0809edd588f098b6ce15c24a1dfe..f394966ea3f8c692b56fd32ce699cfc94bff6092
@@@ -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<String, Object> m = new HashMap<String, Object>();
 +                    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;
      }