From: Leif Åstrand Date: Thu, 26 Jul 2012 11:53:59 +0000 (+0300) Subject: Merge remote branch 'origin/6.8' X-Git-Tag: 7.0.0.beta1~236^2~27 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=6455d8a5f809c98d93f6bfe89fbe55a64c66a03f;p=vaadin-framework.git Merge remote branch 'origin/6.8' Conflicts: src/com/vaadin/terminal/gwt/server/CommunicationManager.java --- 6455d8a5f809c98d93f6bfe89fbe55a64c66a03f diff --cc src/com/vaadin/data/util/sqlcontainer/query/generator/DefaultSQLGenerator.java index a6798f972b,d1700fc0d2..6485330541 --- a/src/com/vaadin/data/util/sqlcontainer/query/generator/DefaultSQLGenerator.java +++ b/src/com/vaadin/data/util/sqlcontainer/query/generator/DefaultSQLGenerator.java @@@ -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); + } + } + -} ++} diff --cc src/com/vaadin/terminal/gwt/client/ui/richtextarea/VRichTextArea.java index 5d5f7d7b8c,08df928194..f9b399caac --- a/src/com/vaadin/terminal/gwt/client/ui/richtextarea/VRichTextArea.java +++ b/src/com/vaadin/terminal/gwt/client/ui/richtextarea/VRichTextArea.java @@@ -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. diff --cc src/com/vaadin/terminal/gwt/server/CommunicationManager.java index 2cf3b23446,9f6e0a8aaa..f083252897 --- a/src/com/vaadin/terminal/gwt/server/CommunicationManager.java +++ b/src/com/vaadin/terminal/gwt/server/CommunicationManager.java @@@ -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 { @@@ -119,23 -262,113 +119,45 @@@ } + /** + * Gets a stream variable based on paintable id and variable name. Returns + * null 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 null if not + * found + */ + public StreamVariable getStreamVariable(String paintableId, + String variableName) { + Map nameToStreamVariable = pidToNameToStreamVariable + .get(paintableId); + if (nameToStreamVariable == null) { + return null; + } + StreamVariable streamVariable = nameToStreamVariable.get(variableName); + return streamVariable; + } + - /** - * 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)); - } - @Override - protected void unregisterPaintable(Component p) { - /* Cleanup possible receivers */ + protected void postPaint(Root root) { + super.postPaint(root); + if (pidToNameToStreamVariable != null) { - Map removed = pidToNameToStreamVariable - .remove(getPaintableId(p)); - if (removed != null) { - for (String key : removed.keySet()) { - streamVariableToSeckey.remove(removed.get(key)); + Iterator 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 removed = pidToNameToStreamVariable + .get(connectorId); + for (String key : removed.keySet()) { + streamVariableToSeckey.remove(removed.get(key)); + } + iterator.remove(); } } } @@@ -147,8 -381,8 +169,8 @@@ private Map 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 @@@ -191,12 -424,12 +213,12 @@@ } @Override - protected void cleanStreamVariable(ClientConnector owner, String name) { - public void cleanStreamVariable(VariableOwner owner, String name) { ++ public void cleanStreamVariable(ClientConnector owner, String name) { Map 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()); } }