summaryrefslogtreecommitdiffstats
path: root/src/com
diff options
context:
space:
mode:
authorJohannes Dahlström <johannes.dahlstrom@vaadin.com>2012-05-11 12:42:04 +0000
committerJohannes Dahlström <johannes.dahlstrom@vaadin.com>2012-05-11 12:42:04 +0000
commitbb486ff26ad6f43197aba42d5af53508bf2c5235 (patch)
treec28d5a7ad4b53014c7302d6b910733127c7479a6 /src/com
parent8383bddc03cc07bd0ae682af182784ca3415d505 (diff)
downloadvaadin-framework-bb486ff26ad6f43197aba42d5af53508bf2c5235.tar.gz
vaadin-framework-bb486ff26ad6f43197aba42d5af53508bf2c5235.zip
#8723 Add touch scrolling support to Accordion
svn changeset:23716/svn branch:6.8
Diffstat (limited to 'src/com')
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/VAccordion.java22
1 files changed, 16 insertions, 6 deletions
diff --git a/src/com/vaadin/terminal/gwt/client/ui/VAccordion.java b/src/com/vaadin/terminal/gwt/client/ui/VAccordion.java
index 4d0776a5f9..73d7eba2d6 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/VAccordion.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/VAccordion.java
@@ -24,6 +24,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.VCaption;
+import com.vaadin.terminal.gwt.client.ui.TouchScrollDelegate.TouchScrollHandler;
public class VAccordion extends VTabsheetBase implements
ContainerResizedListener {
@@ -48,12 +49,16 @@ public class VAccordion extends VTabsheetBase implements
private RenderInformation renderInformation = new RenderInformation();
+ private final TouchScrollHandler touchScrollHandler;
+
public VAccordion() {
super(CLASSNAME);
// IE6 needs this to calculate offsetHeight correctly
if (BrowserInfo.get().isIE6()) {
DOM.setStyleAttribute(getElement(), "zoom", "1");
}
+
+ touchScrollHandler = TouchScrollDelegate.enableTouchScrolling(this);
}
@Override
@@ -198,7 +203,6 @@ public class VAccordion extends VTabsheetBase implements
}
}
}
-
if (!alreadyOpen) {
item.open();
activeTabIndex = itemIndex;
@@ -442,11 +446,15 @@ public class VAccordion extends VTabsheetBase implements
DOM.appendChild(captionNode, caption.getElement());
DOM.appendChild(getElement(), captionNode);
DOM.appendChild(getElement(), content);
- setStyleName(CLASSNAME + "-item");
- DOM.setElementProperty(content, "className", CLASSNAME
- + "-item-content");
- DOM.setElementProperty(captionNode, "className", CLASSNAME
- + "-item-caption");
+
+ getElement().addClassName(CLASSNAME + "-item");
+ captionNode.addClassName(CLASSNAME + "-item-caption");
+ content.addClassName(CLASSNAME + "-item-content");
+
+ touchScrollHandler.addElement(getContainerElement());
+
+ sinkEvents(Event.TOUCHEVENTS | Event.MOUSEEVENTS);
+
close();
}
@@ -640,6 +648,8 @@ public class VAccordion extends VTabsheetBase implements
protected void removeTab(int index) {
StackItem item = getStackItem(index);
remove(item);
+
+ touchScrollHandler.addElement(item.getContainerElement());
}
@Override