From 8b064167bbf42f1e0788e854bd7450a87fc480a2 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Johannes=20Dahlstr=C3=B6m?= Date: Tue, 15 May 2012 07:48:46 +0000 Subject: [PATCH] #8716 #8725 Fix regressions introduced by CSS class handling changes svn changeset:23736/svn branch:6.8 --- .../vaadin/terminal/gwt/client/ui/VPanel.java | 15 +++++++++++---- .../terminal/gwt/client/ui/VSplitPanel.java | 16 +++++++++++----- 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/src/com/vaadin/terminal/gwt/client/ui/VPanel.java b/src/com/vaadin/terminal/gwt/client/ui/VPanel.java index 1b5c48283b..56bc779fbc 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/VPanel.java +++ b/src/com/vaadin/terminal/gwt/client/ui/VPanel.java @@ -27,6 +27,7 @@ import com.vaadin.terminal.gwt.client.RenderSpace; import com.vaadin.terminal.gwt.client.UIDL; import com.vaadin.terminal.gwt.client.Util; import com.vaadin.terminal.gwt.client.ui.ShortcutActionHandler.ShortcutActionHandlerOwner; +import com.vaadin.terminal.gwt.client.ui.TouchScrollDelegate.TouchScrollHandler; public class VPanel extends SimplePanel implements Container, ShortcutActionHandlerOwner, Focusable { @@ -80,6 +81,8 @@ public class VPanel extends SimplePanel implements Container, private String previousStyleName; + private final TouchScrollHandler touchScrollHandler; + private ClickEventHandler clickEventHandler = new ClickEventHandler(this, CLICK_EVENT_IDENTIFIER) { @@ -119,7 +122,8 @@ public class VPanel extends SimplePanel implements Container, contentNode.getStyle().setProperty("position", "relative"); getElement().getStyle().setProperty("overflow", "hidden"); - TouchScrollDelegate.enableTouchScrolling(this, contentNode); + touchScrollHandler = TouchScrollDelegate.enableTouchScrolling(this, + contentNode); } /** @@ -173,9 +177,9 @@ public class VPanel extends SimplePanel implements Container, final String contentBaseClass = CLASSNAME + "-content"; final String decoBaseClass = CLASSNAME + "-deco"; - captionNode.addClassName(captionBaseClass); - contentNode.addClassName(contentBaseClass); - bottomDecoration.addClassName(decoBaseClass); + captionNode.setClassName(captionBaseClass); + contentNode.setClassName(contentBaseClass); + bottomDecoration.setClassName(decoBaseClass); // Add proper stylenames for all elements. This way we can prevent // unwanted CSS selector inheritance. @@ -188,6 +192,9 @@ public class VPanel extends SimplePanel implements Container, bottomDecoration.addClassName(decoBaseClass + "-" + style); } } + + // Ensure panel is still scrollable + touchScrollHandler.addElement(contentNode); } // Ensure correct implementation if (client.updateComponent(this, uidl, false)) { diff --git a/src/com/vaadin/terminal/gwt/client/ui/VSplitPanel.java b/src/com/vaadin/terminal/gwt/client/ui/VSplitPanel.java index 173bd02151..5a996954a0 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/VSplitPanel.java +++ b/src/com/vaadin/terminal/gwt/client/ui/VSplitPanel.java @@ -36,6 +36,7 @@ import com.vaadin.terminal.gwt.client.RenderSpace; import com.vaadin.terminal.gwt.client.UIDL; import com.vaadin.terminal.gwt.client.Util; import com.vaadin.terminal.gwt.client.VConsole; +import com.vaadin.terminal.gwt.client.ui.TouchScrollDelegate.TouchScrollHandler; public class VSplitPanel extends ComplexPanel implements Container, ContainerResizedListener { @@ -146,6 +147,8 @@ public class VSplitPanel extends ComplexPanel implements Container, /* The current position of the split handle in either percentages or pixels */ private String position; + private final TouchScrollHandler touchScrollHandler; + protected Element scrolledContainer; protected int origScrollTop; @@ -173,8 +176,8 @@ public class VSplitPanel extends ComplexPanel implements Container, setOrientation(orientation); sinkEvents(Event.MOUSEEVENTS); - TouchScrollDelegate.enableTouchScrolling(this, firstContainer, - secondContainer); + touchScrollHandler = TouchScrollDelegate.enableTouchScrolling(this, + firstContainer, secondContainer); addDomHandler(new TouchCancelHandler() { public void onTouchCancel(TouchCancelEvent event) { @@ -265,6 +268,9 @@ public class VSplitPanel extends ComplexPanel implements Container, setStylenames(); + // Ensure panels are still scrollable + touchScrollHandler.setElements(firstContainer, secondContainer); + position = uidl.getStringAttribute("position"); setSplitPosition(position); @@ -803,9 +809,9 @@ public class VSplitPanel extends ComplexPanel implements Container, final String secondContainerClass = CLASSNAME + "-second-container"; final String lockedSuffix = locked ? "-locked" : ""; - splitter.addClassName(splitterClass); - firstContainer.addClassName(firstContainerClass); - secondContainer.addClassName(secondContainerClass); + splitter.setClassName(splitterClass + lockedSuffix); + firstContainer.setClassName(firstContainerClass); + secondContainer.setClassName(secondContainerClass); for (String styleName : componentStyleNames) { splitter.addClassName(splitterClass + "-" + styleName -- 2.39.5