aboutsummaryrefslogtreecommitdiffstats
path: root/src/com/vaadin/terminal/gwt/client/ui/FocusableScrollPanel.java
diff options
context:
space:
mode:
authorMatti Tahvonen <matti.tahvonen@itmill.com>2010-05-20 10:22:37 +0000
committerMatti Tahvonen <matti.tahvonen@itmill.com>2010-05-20 10:22:37 +0000
commit03bf281cc40e05d901c015adba1a308f27bea40a (patch)
tree990f74593aeefe7f12f04e7c5cd6aa92ea4552c6 /src/com/vaadin/terminal/gwt/client/ui/FocusableScrollPanel.java
parentaf1e495311287e196e6ffad73fe712ecab93cc33 (diff)
downloadvaadin-framework-03bf281cc40e05d901c015adba1a308f27bea40a.tar.gz
vaadin-framework-03bf281cc40e05d901c015adba1a308f27bea40a.zip
reverting dom structures be similar to previous version
svn changeset:13268/svn branch:6.4
Diffstat (limited to 'src/com/vaadin/terminal/gwt/client/ui/FocusableScrollPanel.java')
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/FocusableScrollPanel.java69
1 files changed, 69 insertions, 0 deletions
diff --git a/src/com/vaadin/terminal/gwt/client/ui/FocusableScrollPanel.java b/src/com/vaadin/terminal/gwt/client/ui/FocusableScrollPanel.java
new file mode 100644
index 0000000000..cebdf1063f
--- /dev/null
+++ b/src/com/vaadin/terminal/gwt/client/ui/FocusableScrollPanel.java
@@ -0,0 +1,69 @@
+package com.vaadin.terminal.gwt.client.ui;
+
+import com.google.gwt.dom.client.Style;
+import com.google.gwt.dom.client.Style.Overflow;
+import com.google.gwt.dom.client.Style.Position;
+import com.google.gwt.event.dom.client.HasScrollHandlers;
+import com.google.gwt.event.dom.client.ScrollEvent;
+import com.google.gwt.event.dom.client.ScrollHandler;
+import com.google.gwt.event.shared.HandlerRegistration;
+import com.google.gwt.user.client.ui.ScrollPanel;
+
+/**
+ * A scrollhandlers similar to {@link ScrollPanel}.
+ *
+ */
+public class FocusableScrollPanel extends SimpleFocusablePanel implements
+ HasScrollHandlers {
+
+ public FocusableScrollPanel() {
+ // Prevent IE standard mode bug when a AbsolutePanel is contained.
+ Style style = getElement().getStyle();
+ style.setOverflow(Overflow.AUTO);
+ style.setProperty("zoom", "1");
+ style.setPosition(Position.RELATIVE);
+ }
+
+ public HandlerRegistration addScrollHandler(ScrollHandler handler) {
+ return addDomHandler(handler, ScrollEvent.getType());
+ }
+
+ /**
+ * Gets the horizontal scroll position.
+ *
+ * @return the horizontal scroll position, in pixels
+ */
+ public int getHorizontalScrollPosition() {
+ return getElement().getScrollLeft();
+ }
+
+ /**
+ * Gets the vertical scroll position.
+ *
+ * @return the vertical scroll position, in pixels
+ */
+ public int getScrollPosition() {
+ return getElement().getScrollTop();
+ }
+
+ /**
+ * Sets the horizontal scroll position.
+ *
+ * @param position
+ * the new horizontal scroll position, in pixels
+ */
+ public void setHorizontalScrollPosition(int position) {
+ getElement().setScrollLeft(position);
+ }
+
+ /**
+ * Sets the vertical scroll position.
+ *
+ * @param position
+ * the new vertical scroll position, in pixels
+ */
+ public void setScrollPosition(int position) {
+ getElement().setScrollTop(position);
+ }
+
+}