diff options
28 files changed, 234 insertions, 134 deletions
diff --git a/WebContent/VAADIN/themes/base/accordion/accordion.scss b/WebContent/VAADIN/themes/base/accordion/accordion.scss index 694f5ca930..6f4825f16b 100644 --- a/WebContent/VAADIN/themes/base/accordion/accordion.scss +++ b/WebContent/VAADIN/themes/base/accordion/accordion.scss @@ -27,14 +27,4 @@ width: 100%; } -/* - * In IE8 and IE9 we need to do magic things to avoid scrollbars since it does not completely - * support the HTML5 doctype. Changing the contained element to a block element will not add - * magical bottom paddings to the contained element and cause scrollbars. Doing this for - * all browsers for consistency. - */ -.v-accordion .v-accordion-item-content > .v-widget { - display: block; -} - }
\ No newline at end of file diff --git a/WebContent/VAADIN/themes/base/splitpanel/splitpanel.scss b/WebContent/VAADIN/themes/base/splitpanel/splitpanel.scss index b29f596e36..f9731cf83c 100644 --- a/WebContent/VAADIN/themes/base/splitpanel/splitpanel.scss +++ b/WebContent/VAADIN/themes/base/splitpanel/splitpanel.scss @@ -31,16 +31,4 @@ .v-disabled .#{$name}-vsplitter div { cursor: default; } - -/* - * In IE8 and IE9 we need to do magic things to avoid scrollbars since it does not completely - * support the HTML5 doctype. Changing the contained element to a block element will not add - * magical bottom paddings to the contained element and cause scrollbars. Doing this for all - * browsers for consistency. - */ -.v-splitpanel-first-container > .v-widget, -.v-splitpanel-second-container > .v-widget{ - display:block; -} - }
\ No newline at end of file diff --git a/WebContent/VAADIN/themes/base/tabsheet/tabsheet.scss b/WebContent/VAADIN/themes/base/tabsheet/tabsheet.scss index 6fcb3d1705..a001605f27 100644 --- a/WebContent/VAADIN/themes/base/tabsheet/tabsheet.scss +++ b/WebContent/VAADIN/themes/base/tabsheet/tabsheet.scss @@ -125,16 +125,4 @@ height: 0; } -/* - * In IE8 and IE9 we need to do magic things to avoid scrollbars since it does not completely - * support the HTML5 doctype. Changing the contained element to a block element will not add - * magical bottom paddings to the contained element and cause scrollbars. Doing this for - * all browsers for consistency. - */ -.#{$name} .v-scrollable > .v-widget { - display: block; -} - - - }
\ No newline at end of file diff --git a/client-compiler/src/com/vaadin/server/widgetsetutils/metadata/ConnectorInitVisitor.java b/client-compiler/src/com/vaadin/server/widgetsetutils/metadata/ConnectorInitVisitor.java index 3e863516a5..7500d65443 100644 --- a/client-compiler/src/com/vaadin/server/widgetsetutils/metadata/ConnectorInitVisitor.java +++ b/client-compiler/src/com/vaadin/server/widgetsetutils/metadata/ConnectorInitVisitor.java @@ -4,22 +4,41 @@ package com.vaadin.server.widgetsetutils.metadata; +import java.util.Map; + import com.google.gwt.core.ext.TreeLogger; import com.google.gwt.core.ext.TreeLogger.Type; +import com.google.gwt.core.ext.UnableToCompleteException; import com.google.gwt.core.ext.typeinfo.JClassType; +import com.google.gwt.dev.util.collect.HashMap; import com.vaadin.shared.ui.Connect; public class ConnectorInitVisitor extends TypeVisitor { + private Map<String, JClassType> processedConnections = new HashMap<String, JClassType>(); + @Override public void visitConnector(TreeLogger logger, JClassType type, - ConnectorBundle bundle) { + ConnectorBundle bundle) throws UnableToCompleteException { Connect connectAnnotation = type.getAnnotation(Connect.class); if (connectAnnotation != null) { logger.log(Type.INFO, type.getName() + " will be in the " + bundle.getName().replaceAll("^_*", "") + " bundle"); - bundle.setIdentifier(type, connectAnnotation.value() - .getCanonicalName()); + String identifier = connectAnnotation.value().getCanonicalName(); + + JClassType previousMapping = processedConnections.put(identifier, + type); + if (previousMapping != null) { + logger.log( + Type.ERROR, + "Multiple @Connect mappings detected for " + identifier + + ": " + type.getQualifiedSourceName() + + " and " + + previousMapping.getQualifiedSourceName()); + throw new UnableToCompleteException(); + } + + bundle.setIdentifier(type, identifier); bundle.setNeedsGwtConstructor(type); } } diff --git a/client/src/com/vaadin/client/ApplicationConnection.java b/client/src/com/vaadin/client/ApplicationConnection.java index 943c826b4f..05ee63a7d5 100644 --- a/client/src/com/vaadin/client/ApplicationConnection.java +++ b/client/src/com/vaadin/client/ApplicationConnection.java @@ -1606,6 +1606,7 @@ public class ApplicationConnection { VConsole.log(" * Sending hierarchy change events"); for (ConnectorHierarchyChangeEvent event : pendingHierarchyChangeEvents) { try { + logHierarchyChange(event); event.getConnector().fireEvent(event); } catch (final Throwable e) { VConsole.error(e); @@ -1614,6 +1615,29 @@ public class ApplicationConnection { } + private void logHierarchyChange(ConnectorHierarchyChangeEvent event) { + if (true) { + // Always disabled for now. Can be enabled manually + return; + } + + VConsole.log("Hierarchy changed for " + + Util.getConnectorString(event.getConnector())); + String oldChildren = "* Old children: "; + for (ComponentConnector child : event.getOldChildren()) { + oldChildren += Util.getConnectorString(child) + " "; + } + VConsole.log(oldChildren); + + String newChildren = "* New children: "; + ComponentContainerConnector parent = (ComponentContainerConnector) event + .getConnector(); + for (ComponentConnector child : parent.getChildComponents()) { + newChildren += Util.getConnectorString(child) + " "; + } + VConsole.log(newChildren); + } + private Collection<StateChangeEvent> updateConnectorState( ValueMap json, Set<ServerConnector> newConnectors) { ArrayList<StateChangeEvent> events = new ArrayList<StateChangeEvent>(); diff --git a/client/src/com/vaadin/client/ui/AbstractComponentContainerConnector.java b/client/src/com/vaadin/client/ui/AbstractComponentContainerConnector.java index 8a2e63735a..20afb3de4b 100644 --- a/client/src/com/vaadin/client/ui/AbstractComponentContainerConnector.java +++ b/client/src/com/vaadin/client/ui/AbstractComponentContainerConnector.java @@ -23,8 +23,6 @@ import com.vaadin.client.ComponentConnector; import com.vaadin.client.ComponentContainerConnector; import com.vaadin.client.ConnectorHierarchyChangeEvent; import com.vaadin.client.ConnectorHierarchyChangeEvent.ConnectorHierarchyChangeHandler; -import com.vaadin.client.Util; -import com.vaadin.client.VConsole; public abstract class AbstractComponentContainerConnector extends AbstractComponentConnector implements ComponentContainerConnector, @@ -66,32 +64,6 @@ public abstract class AbstractComponentContainerConnector extends this.childComponents = childComponents; } - /* - * (non-Javadoc) - * - * @see com.vaadin.client.ComponentContainerConnector# - * connectorHierarchyChanged - * (com.vaadin.client.ConnectorHierarchyChangedEvent) - */ - @Override - public void onConnectorHierarchyChange(ConnectorHierarchyChangeEvent event) { - if (debugLogging) { - VConsole.log("Hierarchy changed for " - + Util.getConnectorString(this)); - String oldChildren = "* Old children: "; - for (ComponentConnector child : event.getOldChildren()) { - oldChildren += Util.getConnectorString(child) + " "; - } - VConsole.log(oldChildren); - - String newChildren = "* New children: "; - for (ComponentConnector child : getChildComponents()) { - newChildren += Util.getConnectorString(child) + " "; - } - VConsole.log(newChildren); - } - } - @Override public HandlerRegistration addConnectorHierarchyChangeHandler( ConnectorHierarchyChangeHandler handler) { diff --git a/client/src/com/vaadin/client/ui/absolutelayout/AbsoluteLayoutConnector.java b/client/src/com/vaadin/client/ui/absolutelayout/AbsoluteLayoutConnector.java index be29f5f512..599f52dc2a 100644 --- a/client/src/com/vaadin/client/ui/absolutelayout/AbsoluteLayoutConnector.java +++ b/client/src/com/vaadin/client/ui/absolutelayout/AbsoluteLayoutConnector.java @@ -147,7 +147,6 @@ public class AbsoluteLayoutConnector extends @Override public void onConnectorHierarchyChange(ConnectorHierarchyChangeEvent event) { - super.onConnectorHierarchyChange(event); for (ComponentConnector child : getChildComponents()) { getWrapper(child); diff --git a/client/src/com/vaadin/client/ui/accordion/AccordionConnector.java b/client/src/com/vaadin/client/ui/accordion/AccordionConnector.java index 3cee786b06..ec33ed72fd 100644 --- a/client/src/com/vaadin/client/ui/accordion/AccordionConnector.java +++ b/client/src/com/vaadin/client/ui/accordion/AccordionConnector.java @@ -19,6 +19,7 @@ import java.util.Iterator; import com.vaadin.client.ApplicationConnection; import com.vaadin.client.ComponentConnector; +import com.vaadin.client.ConnectorHierarchyChangeEvent; import com.vaadin.client.UIDL; import com.vaadin.client.ui.SimpleManagedLayout; import com.vaadin.client.ui.accordion.VAccordion.StackItem; @@ -87,4 +88,9 @@ public class AccordionConnector extends TabsheetBaseConnector implements } + @Override + public void onConnectorHierarchyChange( + ConnectorHierarchyChangeEvent connectorHierarchyChangeEvent) { + // TODO Move code from updateFromUIDL to this method + } } diff --git a/client/src/com/vaadin/client/ui/csslayout/CssLayoutConnector.java b/client/src/com/vaadin/client/ui/csslayout/CssLayoutConnector.java index 4fdd10de34..12ebb6a375 100644 --- a/client/src/com/vaadin/client/ui/csslayout/CssLayoutConnector.java +++ b/client/src/com/vaadin/client/ui/csslayout/CssLayoutConnector.java @@ -123,8 +123,6 @@ public class CssLayoutConnector extends AbstractLayoutConnector { */ @Override public void onConnectorHierarchyChange(ConnectorHierarchyChangeEvent event) { - super.onConnectorHierarchyChange(event); - clickEventHandler.handleEventHandlerRegistration(); int index = 0; diff --git a/client/src/com/vaadin/client/ui/customcomponent/CustomComponentConnector.java b/client/src/com/vaadin/client/ui/customcomponent/CustomComponentConnector.java index 5ad7bb715a..d14337afe4 100644 --- a/client/src/com/vaadin/client/ui/customcomponent/CustomComponentConnector.java +++ b/client/src/com/vaadin/client/ui/customcomponent/CustomComponentConnector.java @@ -38,8 +38,6 @@ public class CustomComponentConnector extends @Override public void onConnectorHierarchyChange(ConnectorHierarchyChangeEvent event) { - super.onConnectorHierarchyChange(event); - ComponentConnector newChild = null; if (getChildComponents().size() == 1) { newChild = getChildComponents().get(0); diff --git a/client/src/com/vaadin/client/ui/customlayout/CustomLayoutConnector.java b/client/src/com/vaadin/client/ui/customlayout/CustomLayoutConnector.java index 0049a4dd3d..21b32ae7b0 100644 --- a/client/src/com/vaadin/client/ui/customlayout/CustomLayoutConnector.java +++ b/client/src/com/vaadin/client/ui/customlayout/CustomLayoutConnector.java @@ -83,8 +83,6 @@ public class CustomLayoutConnector extends AbstractLayoutConnector implements @Override public void onConnectorHierarchyChange(ConnectorHierarchyChangeEvent event) { - super.onConnectorHierarchyChange(event); - // Must do this once here so the HTML has been set up before we start // adding child widgets. diff --git a/client/src/com/vaadin/client/ui/form/FormConnector.java b/client/src/com/vaadin/client/ui/form/FormConnector.java index 25b4a76a09..0c2e4a8ecd 100644 --- a/client/src/com/vaadin/client/ui/form/FormConnector.java +++ b/client/src/com/vaadin/client/ui/form/FormConnector.java @@ -20,6 +20,7 @@ import com.google.gwt.event.dom.client.KeyDownEvent; import com.google.gwt.user.client.ui.Widget; import com.vaadin.client.ApplicationConnection; import com.vaadin.client.ComponentConnector; +import com.vaadin.client.ConnectorHierarchyChangeEvent; import com.vaadin.client.LayoutManager; import com.vaadin.client.Paintable; import com.vaadin.client.UIDL; @@ -214,4 +215,9 @@ public class FormConnector extends AbstractComponentContainerConnector return (FormState) super.getState(); } + @Override + public void onConnectorHierarchyChange( + ConnectorHierarchyChangeEvent connectorHierarchyChangeEvent) { + // TODO Move code from updateFromUIDL to this method + } } diff --git a/client/src/com/vaadin/client/ui/formlayout/FormLayoutConnector.java b/client/src/com/vaadin/client/ui/formlayout/FormLayoutConnector.java index c78137345f..6379ae47be 100644 --- a/client/src/com/vaadin/client/ui/formlayout/FormLayoutConnector.java +++ b/client/src/com/vaadin/client/ui/formlayout/FormLayoutConnector.java @@ -53,8 +53,6 @@ public class FormLayoutConnector extends AbstractLayoutConnector { @Override public void onConnectorHierarchyChange(ConnectorHierarchyChangeEvent event) { - super.onConnectorHierarchyChange(event); - VFormLayout formLayout = getWidget(); VFormLayoutTable formLayoutTable = getWidget().table; diff --git a/client/src/com/vaadin/client/ui/gridlayout/GridLayoutConnector.java b/client/src/com/vaadin/client/ui/gridlayout/GridLayoutConnector.java index e6c293d217..d235413d8c 100644 --- a/client/src/com/vaadin/client/ui/gridlayout/GridLayoutConnector.java +++ b/client/src/com/vaadin/client/ui/gridlayout/GridLayoutConnector.java @@ -179,8 +179,6 @@ public class GridLayoutConnector extends AbstractComponentContainerConnector @Override public void onConnectorHierarchyChange(ConnectorHierarchyChangeEvent event) { - super.onConnectorHierarchyChange(event); - VGridLayout layout = getWidget(); // clean non rendered components diff --git a/client/src/com/vaadin/client/ui/orderedlayout/AbstractOrderedLayoutConnector.java b/client/src/com/vaadin/client/ui/orderedlayout/AbstractOrderedLayoutConnector.java index e0863512b4..7da2e17cbe 100644 --- a/client/src/com/vaadin/client/ui/orderedlayout/AbstractOrderedLayoutConnector.java +++ b/client/src/com/vaadin/client/ui/orderedlayout/AbstractOrderedLayoutConnector.java @@ -288,7 +288,6 @@ public abstract class AbstractOrderedLayoutConnector extends */ @Override public void onConnectorHierarchyChange(ConnectorHierarchyChangeEvent event) { - super.onConnectorHierarchyChange(event); List<ComponentConnector> previousChildren = event.getOldChildren(); int currentIndex = 0; diff --git a/client/src/com/vaadin/client/ui/panel/PanelConnector.java b/client/src/com/vaadin/client/ui/panel/PanelConnector.java index 16e6babfa6..695e06e0f2 100644 --- a/client/src/com/vaadin/client/ui/panel/PanelConnector.java +++ b/client/src/com/vaadin/client/ui/panel/PanelConnector.java @@ -243,7 +243,6 @@ public class PanelConnector extends AbstractComponentContainerConnector @Override public void onConnectorHierarchyChange(ConnectorHierarchyChangeEvent event) { - super.onConnectorHierarchyChange(event); // We always have 1 child, unless the child is hidden Widget newChildWidget = null; if (getChildComponents().size() == 1) { diff --git a/client/src/com/vaadin/client/ui/popupview/PopupViewConnector.java b/client/src/com/vaadin/client/ui/popupview/PopupViewConnector.java index 8def4d244d..eba09b6a19 100644 --- a/client/src/com/vaadin/client/ui/popupview/PopupViewConnector.java +++ b/client/src/com/vaadin/client/ui/popupview/PopupViewConnector.java @@ -17,6 +17,7 @@ package com.vaadin.client.ui.popupview; import com.vaadin.client.ApplicationConnection; import com.vaadin.client.ComponentConnector; +import com.vaadin.client.ConnectorHierarchyChangeEvent; import com.vaadin.client.Paintable; import com.vaadin.client.UIDL; import com.vaadin.client.VCaption; @@ -127,4 +128,10 @@ public class PopupViewConnector extends AbstractComponentContainerConnector } } + @Override + public void onConnectorHierarchyChange( + ConnectorHierarchyChangeEvent connectorHierarchyChangeEvent) { + // TODO Move code from updateFromUIDL to this method + } + } diff --git a/client/src/com/vaadin/client/ui/splitpanel/AbstractSplitPanelConnector.java b/client/src/com/vaadin/client/ui/splitpanel/AbstractSplitPanelConnector.java index eaf82ff557..501752ed18 100644 --- a/client/src/com/vaadin/client/ui/splitpanel/AbstractSplitPanelConnector.java +++ b/client/src/com/vaadin/client/ui/splitpanel/AbstractSplitPanelConnector.java @@ -212,8 +212,6 @@ public abstract class AbstractSplitPanelConnector extends @Override public void onConnectorHierarchyChange(ConnectorHierarchyChangeEvent event) { - super.onConnectorHierarchyChange(event); - Widget newFirstChildWidget = null; if (getFirstChild() != null) { newFirstChildWidget = getFirstChild().getWidget(); diff --git a/client/src/com/vaadin/client/ui/table/TableConnector.java b/client/src/com/vaadin/client/ui/table/TableConnector.java index e5e8cbb9ad..b79cc39297 100644 --- a/client/src/com/vaadin/client/ui/table/TableConnector.java +++ b/client/src/com/vaadin/client/ui/table/TableConnector.java @@ -26,6 +26,7 @@ import com.google.gwt.user.client.ui.Widget; import com.vaadin.client.ApplicationConnection; import com.vaadin.client.BrowserInfo; import com.vaadin.client.ComponentConnector; +import com.vaadin.client.ConnectorHierarchyChangeEvent; import com.vaadin.client.DirectionalManagedLayout; import com.vaadin.client.Paintable; import com.vaadin.client.ServerConnector; @@ -213,12 +214,10 @@ public class TableConnector extends AbstractComponentContainerConnector if (!getWidget().isSelectable()) { getWidget().scrollBody.addStyleName(getWidget() - .getStylePrimaryName() - + "-body-noselection"); + .getStylePrimaryName() + "-body-noselection"); } else { getWidget().scrollBody.removeStyleName(getWidget() - .getStylePrimaryName() - + "-body-noselection"); + .getStylePrimaryName() + "-body-noselection"); } getWidget().hideScrollPositionAnnotation(); @@ -388,4 +387,10 @@ public class TableConnector extends AbstractComponentContainerConnector return info; } + @Override + public void onConnectorHierarchyChange( + ConnectorHierarchyChangeEvent connectorHierarchyChangeEvent) { + // TODO Move code from updateFromUIDL to this method + } + } diff --git a/client/src/com/vaadin/client/ui/tabsheet/TabsheetConnector.java b/client/src/com/vaadin/client/ui/tabsheet/TabsheetConnector.java index aff5af2a95..fd09b03160 100644 --- a/client/src/com/vaadin/client/ui/tabsheet/TabsheetConnector.java +++ b/client/src/com/vaadin/client/ui/tabsheet/TabsheetConnector.java @@ -19,6 +19,7 @@ import com.google.gwt.dom.client.Element; import com.google.gwt.user.client.DOM; import com.vaadin.client.ApplicationConnection; import com.vaadin.client.ComponentConnector; +import com.vaadin.client.ConnectorHierarchyChangeEvent; import com.vaadin.client.TooltipInfo; import com.vaadin.client.UIDL; import com.vaadin.client.Util; @@ -144,4 +145,9 @@ public class TabsheetConnector extends TabsheetBaseConnector implements return info; } + @Override + public void onConnectorHierarchyChange( + ConnectorHierarchyChangeEvent connectorHierarchyChangeEvent) { + // TODO Move code from updateFromUIDL to this method + } } diff --git a/client/src/com/vaadin/client/ui/ui/UIConnector.java b/client/src/com/vaadin/client/ui/ui/UIConnector.java index a6c3b4cf2b..f2c54c0a21 100644 --- a/client/src/com/vaadin/client/ui/ui/UIConnector.java +++ b/client/src/com/vaadin/client/ui/ui/UIConnector.java @@ -394,8 +394,6 @@ public class UIConnector extends AbstractComponentContainerConnector implements @Override public void onConnectorHierarchyChange(ConnectorHierarchyChangeEvent event) { - super.onConnectorHierarchyChange(event); - ComponentConnector oldChild = null; ComponentConnector newChild = getContent(); diff --git a/client/src/com/vaadin/client/ui/window/WindowConnector.java b/client/src/com/vaadin/client/ui/window/WindowConnector.java index f26592350a..b975ab8e88 100644 --- a/client/src/com/vaadin/client/ui/window/WindowConnector.java +++ b/client/src/com/vaadin/client/ui/window/WindowConnector.java @@ -213,8 +213,6 @@ public class WindowConnector extends AbstractComponentContainerConnector @Override public void onConnectorHierarchyChange(ConnectorHierarchyChangeEvent event) { - super.onConnectorHierarchyChange(event); - // We always have 1 child, unless the child is hidden Widget newChildWidget = null; ComponentConnector newChild = null; diff --git a/server/src/com/vaadin/server/VaadinServlet.java b/server/src/com/vaadin/server/VaadinServlet.java index 13ea68f252..67f3691855 100644 --- a/server/src/com/vaadin/server/VaadinServlet.java +++ b/server/src/com/vaadin/server/VaadinServlet.java @@ -206,11 +206,7 @@ public class VaadinServlet extends HttpServlet implements Constants { @Override protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - /* - * Some servlet containers cause problems with requests to the context - * root without any ending slash - ensure we avoid such problems by - * redirecting to an ending slash in these cases. See #9921 - */ + // Handle context root request without trailing slash, see #9921 if (handleContextRootWithoutSlash(request, response)) { return; } @@ -219,8 +215,23 @@ public class VaadinServlet extends HttpServlet implements Constants { service(createVaadinRequest(request), createVaadinResponse(response)); } - private boolean handleContextRootWithoutSlash(HttpServletRequest request, - HttpServletResponse response) { + /** + * Invoked for every request to this servlet to potentially send a redirect + * to avoid problems with requests to the context root with no trailing + * slash. + * + * @param request + * the processed request + * @param response + * the processed response + * @return <code>true</code> if a redirect has been sent and the request + * should not be processed further; <code>false</code> if the + * request should be processed as usual + * @throws IOException + * If an input or output exception occurs + */ + protected boolean handleContextRootWithoutSlash(HttpServletRequest request, + HttpServletResponse response) throws IOException { if ("/".equals(request.getPathInfo()) && "".equals(request.getServletPath()) && !request.getRequestURI().endsWith("/")) { @@ -228,8 +239,12 @@ public class VaadinServlet extends HttpServlet implements Constants { * Path info is for the root but request URI doesn't end with a * slash -> redirect to the same URI but with an ending slash. */ - response.setStatus(HttpServletResponse.SC_FOUND); - response.setHeader("Location", request.getRequestURI() + "/"); + String location = request.getRequestURI() + "/"; + String queryString = request.getQueryString(); + if (queryString != null) { + location += '?' + queryString; + } + response.sendRedirect(location); return true; } else { return false; diff --git a/server/tests/src/com/vaadin/server/TestAbstractApplicationServletStaticFilesLocation.java b/server/tests/src/com/vaadin/server/TestAbstractApplicationServletStaticFilesLocation.java index 533bcc8422..cd64622392 100644 --- a/server/tests/src/com/vaadin/server/TestAbstractApplicationServletStaticFilesLocation.java +++ b/server/tests/src/com/vaadin/server/TestAbstractApplicationServletStaticFilesLocation.java @@ -41,32 +41,40 @@ public class TestAbstractApplicationServletStaticFilesLocation extends TestCase /* SERVLETS */ // http://dummy.host:8080/contextpath/servlet - // should return /contextpath + // should return . (relative url resolving to /contextpath) location = testLocation("http://dummy.host:8080", "/contextpath", "/servlet", ""); - assertEquals("/contextpath", location); + assertEquals(".", location); + + // http://dummy.host:8080/contextpath/servlet/ + // should return ./.. (relative url resolving to /contextpath) + location = testLocation("http://dummy.host:8080", "/contextpath", + "/servlet", "/"); + assertEquals("./..", location); // http://dummy.host:8080/servlet - // should return "" + // should return "." location = testLocation("http://dummy.host:8080", "", "/servlet", ""); - assertEquals("", location); + assertEquals(".", location); // http://dummy.host/contextpath/servlet/extra/stuff - // should return /contextpath + // should return ./../.. (relative url resolving to /contextpath) location = testLocation("http://dummy.host", "/contextpath", "/servlet", "/extra/stuff"); - assertEquals("/contextpath", location); + assertEquals("./../..", location); // http://dummy.host/context/path/servlet/extra/stuff - // should return /context/path + // should return ./../.. (relative url resolving to /context/path) location = testLocation("http://dummy.host", "/context/path", "/servlet", "/extra/stuff"); - assertEquals("/context/path", location); + assertEquals("./../..", location); /* Include requests */ - location = testIncludedLocation("http://my.portlet.server", "/user", - "/tmpservletlocation1", ""); - assertEquals("Wrong widgetset location", "/user", location); + // Include request support dropped with support for portlet1 + // Might reconsider when JSP integration support is implemented + // location = testIncludedLocation("http://my.portlet.server", "/user", + // "/tmpservletlocation1", ""); + // assertEquals("Wrong widgetset location", "/user", location); } diff --git a/theme-compiler/src/com/vaadin/sass/resolver/VaadinResolver.java b/theme-compiler/src/com/vaadin/sass/resolver/VaadinResolver.java index 93fdf6bfec..1caf5dcac8 100644 --- a/theme-compiler/src/com/vaadin/sass/resolver/VaadinResolver.java +++ b/theme-compiler/src/com/vaadin/sass/resolver/VaadinResolver.java @@ -1,46 +1,49 @@ package com.vaadin.sass.resolver; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + import org.w3c.css.sac.InputSource; public class VaadinResolver implements ScssStylesheetResolver { @Override public InputSource resolve(String identifier) { - String ext = ".scss"; if (identifier.endsWith(".css")) { - ext = ".css"; + // CSS support mainly for testing, don't load from classpath etc + ScssStylesheetResolver resolver = new FilesystemResolver(); + return resolver.resolve(identifier); } - // 'normalize' identifier to use in themeFile - String fileName = identifier; - if (identifier.endsWith(ext)) { - identifier = identifier.substring(0, - identifier.length() - ext.length()); - } - // also look here - String themeFile = "VAADIN/themes/" + identifier + "/" + fileName; + InputSource source = null; - // first plain file - ScssStylesheetResolver resolver = new FilesystemResolver(); - InputSource source = resolver.resolve(fileName); + Pattern pattern = Pattern + .compile("\\.\\.\\/([^\\/]+)\\/([^\\/]+\\.scss)"); + Matcher matcher = pattern.matcher(identifier); - if (source == null) { - // then file in theme - source = resolver.resolve(themeFile); - } + if (matcher.find()) { + // theme include + ScssStylesheetResolver resolver = new FilesystemResolver(); + source = resolver.resolve(identifier); - if (source == null) { - // then plain via classloader - resolver = new ClassloaderResolver(); + if (source == null) { + String themeName = matcher.group(1); + String fileName = matcher.group(2); + resolver = new ClassloaderResolver(); + String id = "VAADIN/themes/" + themeName + "/" + fileName; + source = resolver.resolve(id); + } + + } else { + ScssStylesheetResolver resolver = new FilesystemResolver(); source = resolver.resolve(identifier); - } - if (source == null) { - // then try theme via classloader - source = resolver.resolve(themeFile); + if (source == null) { + resolver = new ClassloaderResolver(); + source = resolver.resolve(identifier); + } } return source; } - } diff --git a/uitest/src/com/vaadin/tests/components/textfield/TextFieldPrimaryStyleName b/uitest/src/com/vaadin/tests/components/textfield/TextFieldPrimaryStyleName new file mode 100644 index 0000000000..9c99d86a91 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/textfield/TextFieldPrimaryStyleName @@ -0,0 +1,47 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> +<head profile="http://selenium-ide.openqa.org/profiles/test-case"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> +<link rel="selenium.base" href="http://localhost:8888/" /> +<title>New Test</title> +</head> +<body> +<table cellpadding="1" cellspacing="1" border="1"> +<thead> +<tr><td rowspan="1" colspan="3">New Test</td></tr> +</thead><tbody> +<tr> + <td>open</td> + <td>/run/com.vaadin.tests.components.textfield.TextFieldPrimaryStyleName?restartApplication</td> + <td></td> +</tr> +<tr> + <td>assertCSSClass</td> + <td>vaadin=runcomvaadintestscomponentstextfieldTextFieldPrimaryStyleName::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VTextField[0]</td> + <td>my-textfield</td> +</tr> +<tr> + <td>assertNotCSSClass</td> + <td>vaadin=runcomvaadintestscomponentstextfieldTextFieldPrimaryStyleName::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VTextField[0]</td> + <td>v-textfield</td> +</tr> +<tr> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentstextfieldTextFieldPrimaryStyleName::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>assertCSSClass</td> + <td>vaadin=runcomvaadintestscomponentstextfieldTextFieldPrimaryStyleName::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VTextField[0]</td> + <td>my-dynamic-textfield</td> +</tr> +<tr> + <td>assertNotCSSClass</td> + <td>vaadin=runcomvaadintestscomponentstextfieldTextFieldPrimaryStyleName::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VTextField[0]</td> + <td>my-textfield</td> +</tr> + +</tbody></table> +</body> +</html> diff --git a/uitest/src/com/vaadin/tests/components/textfield/TextFieldPrimaryStyleName.java b/uitest/src/com/vaadin/tests/components/textfield/TextFieldPrimaryStyleName.java new file mode 100644 index 0000000000..5746f74b5a --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/textfield/TextFieldPrimaryStyleName.java @@ -0,0 +1,36 @@ +package com.vaadin.tests.components.textfield; + +import com.vaadin.tests.components.TestBase; +import com.vaadin.ui.Button; +import com.vaadin.ui.Button.ClickEvent; +import com.vaadin.ui.TextField; + +public class TextFieldPrimaryStyleName extends TestBase { + + @Override + protected void setup() { + final TextField field = new TextField(); + field.setPrimaryStyleName("my-textfield"); + addComponent(field); + + addComponent(new Button("Change primary style name", + new Button.ClickListener() { + @Override + public void buttonClick(ClickEvent event) { + field.setPrimaryStyleName("my-dynamic-textfield"); + } + })); + + } + + @Override + protected String getDescription() { + return "Textfield should support setting the primary stylename both initially and dynamically"; + } + + @Override + protected Integer getTicketNumber() { + return 9896; + } + +} diff --git a/uitest/src/com/vaadin/tests/widgetset/client/minitutorials/v7a2/WidgetContainerConnector.java b/uitest/src/com/vaadin/tests/widgetset/client/minitutorials/v7a2/WidgetContainerConnector.java index 68af02d6ce..62686dfded 100644 --- a/uitest/src/com/vaadin/tests/widgetset/client/minitutorials/v7a2/WidgetContainerConnector.java +++ b/uitest/src/com/vaadin/tests/widgetset/client/minitutorials/v7a2/WidgetContainerConnector.java @@ -20,7 +20,6 @@ public class WidgetContainerConnector extends for (ComponentConnector connector : children) { widget.add(connector.getWidget()); } - super.onConnectorHierarchyChange(event); } @Override |