]> source.dussan.org Git - vaadin-framework.git/commitdiff
Merge remote branch 'origin/6.8'
authorLeif Åstrand <leif@vaadin.com>
Thu, 26 Jul 2012 11:53:59 +0000 (14:53 +0300)
committerLeif Åstrand <leif@vaadin.com>
Thu, 26 Jul 2012 11:53:59 +0000 (14:53 +0300)
Conflicts:
src/com/vaadin/terminal/gwt/server/CommunicationManager.java

1  2 
src/com/vaadin/data/util/sqlcontainer/query/generator/DefaultSQLGenerator.java
src/com/vaadin/terminal/gwt/client/ui/richtextarea/VRichTextArea.java
src/com/vaadin/terminal/gwt/server/CommunicationManager.java

index a6798f972bd17b82d6987b189d38dde7aeafe803,d1700fc0d2388395207d89a3d9442af8773bca52..64853305419258c8f710e5c5f816b2d651f88052
@@@ -312,4 -336,28 +340,28 @@@ public class DefaultSQLGenerator implem
          }
          return rowIdentifiers;
      }
- }
+     /**
+      * Returns the statement helper for the generator. Override this to handle
+      * platform specific data types.
+      * 
+      * @see http://dev.vaadin.com/ticket/9148
+      * @return a new instance of the statement helper
+      */
+     protected StatementHelper getStatementHelper() {
+         if (statementHelperClass == null) {
+             return new StatementHelper();
+         }
+         try {
+             return statementHelperClass.newInstance();
+         } catch (InstantiationException e) {
+             throw new RuntimeException(
+                     "Unable to instantiate custom StatementHelper", e);
+         } catch (IllegalAccessException e) {
+             throw new RuntimeException(
+                     "Unable to instantiate custom StatementHelper", e);
+         }
+     }
 -}
++}
index 5d5f7d7b8ceb484905ab7ec0622699508d02b517,08df9281946260c318c018e349bed20c2b509f66..f9b399caac0044bf40c27bf9cf748ebb2bffadc4
@@@ -30,7 -32,9 +30,8 @@@ import com.vaadin.terminal.gwt.client.C
  import com.vaadin.terminal.gwt.client.Util;
  import com.vaadin.terminal.gwt.client.ui.Field;
  import com.vaadin.terminal.gwt.client.ui.ShortcutActionHandler;
 -import com.vaadin.terminal.gwt.client.ui.ShortcutActionHandler.BeforeShortcutActionListener;
  import com.vaadin.terminal.gwt.client.ui.ShortcutActionHandler.ShortcutActionHandlerOwner;
+ import com.vaadin.terminal.gwt.client.ui.TouchScrollDelegate;
  
  /**
   * This class implements a basic client side rich text editor component.
index 2cf3b23446cff279a68c7e0beff418f6de42ba7d,9f6e0a8aaaff5e8e629a8b3f2812df057b681d54..f083252897e43af025cb017e0b2018f329d42203
@@@ -86,24 -229,22 +86,24 @@@ public class CommunicationManager exten
                  .indexOf(AbstractApplicationServlet.UPLOAD_URL_PREFIX)
                  + AbstractApplicationServlet.UPLOAD_URL_PREFIX.length();
          String uppUri = pathInfo.substring(startOfData);
 -        String[] parts = uppUri.split("/", 3); // 0 = pid, 1= name, 2 = sec key
 -        String variableName = parts[1];
 -        String paintableId = parts[0];
 -
 -        StreamVariable streamVariable = getStreamVariable(paintableId,
 +        String[] parts = uppUri.split("/", 4); // 0= rootid, 1 = cid, 2= name, 3
 +                                               // = sec key
 +        String rootId = parts[0];
 +        String connectorId = parts[1];
 +        String variableName = parts[2];
 +        Root root = application.getRootById(Integer.parseInt(rootId));
 +        Root.setCurrent(root);
 +
-         StreamVariable streamVariable = pidToNameToStreamVariable.get(
-                 connectorId).get(variableName);
++        StreamVariable streamVariable = getStreamVariable(connectorId,
+                 variableName);
          String secKey = streamVariableToSeckey.get(streamVariable);
 -        if (secKey.equals(parts[2])) {
 +        if (secKey.equals(parts[3])) {
  
 -            VariableOwner source = getVariableOwner(paintableId);
 +            ClientConnector source = getConnector(root, connectorId);
              String contentType = request.getContentType();
 -            if (request.getContentType().contains("boundary")) {
 +            if (contentType.contains("boundary")) {
                  // Multipart requests contain boundary string
 -                doHandleSimpleMultipartFileUpload(
 -                        new HttpServletRequestWrapper(request),
 -                        new HttpServletResponseWrapper(response),
 +                doHandleSimpleMultipartFileUpload(request, response,
                          streamVariable, variableName, source,
                          contentType.split("boundary=")[1]);
              } else {
  
      }
  
 -    /**
 -     * Handles UIDL request
 -     * 
 -     * TODO document
 -     * 
 -     * @param request
 -     * @param response
 -     * @param applicationServlet
 -     * @param window
 -     *            target window of the UIDL request, can be null if window not
 -     *            found
 -     * @throws IOException
 -     * @throws ServletException
 -     */
 -    public void handleUidlRequest(HttpServletRequest request,
 -            HttpServletResponse response,
 -            AbstractApplicationServlet applicationServlet, Window window)
 -            throws IOException, ServletException,
 -            InvalidUIDLSecurityKeyException {
 -        doHandleUidlRequest(new HttpServletRequestWrapper(request),
 -                new HttpServletResponseWrapper(response),
 -                new AbstractApplicationServletWrapper(applicationServlet),
 -                window);
 -    }
 -
 -    /**
 -     * Gets the existing application or creates a new one. Get a window within
 -     * an application based on the requested URI.
 -     * 
 -     * @param request
 -     *            the HTTP Request.
 -     * @param application
 -     *            the Application to query for window.
 -     * @param assumedWindow
 -     *            if the window has been already resolved once, this parameter
 -     *            must contain the window.
 -     * @return Window matching the given URI or null if not found.
 -     * @throws ServletException
 -     *             if an exception has occurred that interferes with the
 -     *             servlet's normal operation.
 -     */
 -    Window getApplicationWindow(HttpServletRequest request,
 -            AbstractApplicationServlet applicationServlet,
 -            Application application, Window assumedWindow)
 -            throws ServletException {
 -        return doGetApplicationWindow(new HttpServletRequestWrapper(request),
 -                new AbstractApplicationServletWrapper(applicationServlet),
 -                application, assumedWindow);
 -    }
 -
 -    /**
 -     * Calls the Window URI handler for a request and returns the
 -     * {@link DownloadStream} returned by the handler.
 -     * 
 -     * If the window is the main window of an application, the deprecated
 -     * {@link Application#handleURI(java.net.URL, String)} is called first to
 -     * handle {@link ApplicationResource}s and the window handler is only called
 -     * if it returns null.
 -     * 
 -     * @see AbstractCommunicationManager#handleURI(Window, Request, Response,
 -     *      Callback)
 -     * 
 -     * @param window
 -     * @param request
 -     * @param response
 -     * @param applicationServlet
 -     * @return
 -     */
 -    DownloadStream handleURI(Window window, HttpServletRequest request,
 -            HttpServletResponse response,
 -            AbstractApplicationServlet applicationServlet) {
 -        return handleURI(window, new HttpServletRequestWrapper(request),
 -                new HttpServletResponseWrapper(response),
 -                new AbstractApplicationServletWrapper(applicationServlet));
 -    }
 -
+     /**
+      * Gets a stream variable based on paintable id and variable name. Returns
+      * <code>null</code> if no matching variable has been registered.
+      * 
+      * @param paintableId
+      *            id of paintable to get variable for
+      * @param variableName
+      *            name of the stream variable
+      * @return the corresponding stream variable, or <code>null</code> if not
+      *         found
+      */
+     public StreamVariable getStreamVariable(String paintableId,
+             String variableName) {
+         Map<String, StreamVariable> nameToStreamVariable = pidToNameToStreamVariable
+                 .get(paintableId);
+         if (nameToStreamVariable == null) {
+             return null;
+         }
+         StreamVariable streamVariable = nameToStreamVariable.get(variableName);
+         return streamVariable;
+     }
      @Override
 -    protected void unregisterPaintable(Component p) {
 -        /* Cleanup possible receivers */
 +    protected void postPaint(Root root) {
 +        super.postPaint(root);
 +
          if (pidToNameToStreamVariable != null) {
 -            Map<String, StreamVariable> removed = pidToNameToStreamVariable
 -                    .remove(getPaintableId(p));
 -            if (removed != null) {
 -                for (String key : removed.keySet()) {
 -                    streamVariableToSeckey.remove(removed.get(key));
 +            Iterator<String> iterator = pidToNameToStreamVariable.keySet()
 +                    .iterator();
 +            while (iterator.hasNext()) {
 +                String connectorId = iterator.next();
 +                if (root.getConnectorTracker().getConnector(connectorId) == null) {
 +                    // Owner is no longer attached to the application
 +                    Map<String, StreamVariable> removed = pidToNameToStreamVariable
 +                            .get(connectorId);
 +                    for (String key : removed.keySet()) {
 +                        streamVariableToSeckey.remove(removed.get(key));
 +                    }
 +                    iterator.remove();
                  }
              }
          }
      private Map<StreamVariable, String> streamVariableToSeckey;
  
      @Override
-     String getStreamVariableTargetUrl(ClientConnector owner, String name,
 -    public String getStreamVariableTargetUrl(VariableOwner owner, String name,
--            StreamVariable value) {
++    public String getStreamVariableTargetUrl(ClientConnector owner,
++            String name, StreamVariable value) {
          /*
           * We will use the same APP/* URI space as ApplicationResources but
           * prefix url with UPLOAD
      }
  
      @Override
-     protected void cleanStreamVariable(ClientConnector owner, String name) {
 -    public void cleanStreamVariable(VariableOwner owner, String name) {
++    public void cleanStreamVariable(ClientConnector owner, String name) {
          Map<String, StreamVariable> nameToStreamVar = pidToNameToStreamVariable
 -                .get(getPaintableId((Paintable) owner));
 +                .get(owner.getConnectorId());
-         nameToStreamVar.remove("name");
+         nameToStreamVar.remove(name);
          if (nameToStreamVar.isEmpty()) {
 -            pidToNameToStreamVariable.remove(getPaintableId((Paintable) owner));
 +            pidToNameToStreamVariable.remove(owner.getConnectorId());
          }
      }