]> source.dussan.org Git - vaadin-framework.git/commitdiff
ScrollbarBundle, Escalator and Grid fire Scroll events (#13334)
authorHenrik Paul <henrik@vaadin.com>
Wed, 27 Aug 2014 12:18:30 +0000 (15:18 +0300)
committerHenrik Paul <henrik@vaadin.com>
Thu, 28 Aug 2014 11:31:41 +0000 (11:31 +0000)
Change-Id: I362f1f8d2107d762b43ab52c1f22dfd218f67ba4

33 files changed:
client/src/com/vaadin/client/ui/grid/Escalator.java
client/src/com/vaadin/client/ui/grid/Grid.java
client/src/com/vaadin/client/ui/grid/ScrollbarBundle.java
client/src/com/vaadin/client/ui/grid/events/AbstractGridKeyEventHandler.java [new file with mode: 0644]
client/src/com/vaadin/client/ui/grid/events/BodyKeyDownHandler.java [new file with mode: 0644]
client/src/com/vaadin/client/ui/grid/events/BodyKeyPressHandler.java [new file with mode: 0644]
client/src/com/vaadin/client/ui/grid/events/BodyKeyUpHandler.java [new file with mode: 0644]
client/src/com/vaadin/client/ui/grid/events/FooterKeyDownHandler.java [new file with mode: 0644]
client/src/com/vaadin/client/ui/grid/events/FooterKeyPressHandler.java [new file with mode: 0644]
client/src/com/vaadin/client/ui/grid/events/FooterKeyUpHandler.java [new file with mode: 0644]
client/src/com/vaadin/client/ui/grid/events/GridKeyDownEvent.java [new file with mode: 0644]
client/src/com/vaadin/client/ui/grid/events/GridKeyPressEvent.java [new file with mode: 0644]
client/src/com/vaadin/client/ui/grid/events/GridKeyUpEvent.java [new file with mode: 0644]
client/src/com/vaadin/client/ui/grid/events/HeaderKeyDownHandler.java [new file with mode: 0644]
client/src/com/vaadin/client/ui/grid/events/HeaderKeyPressHandler.java [new file with mode: 0644]
client/src/com/vaadin/client/ui/grid/events/HeaderKeyUpHandler.java [new file with mode: 0644]
client/src/com/vaadin/client/ui/grid/events/ScrollEvent.java [new file with mode: 0644]
client/src/com/vaadin/client/ui/grid/events/ScrollHandler.java [new file with mode: 0644]
client/src/com/vaadin/client/ui/grid/keyevents/AbstractGridKeyEventHandler.java [deleted file]
client/src/com/vaadin/client/ui/grid/keyevents/BodyKeyDownHandler.java [deleted file]
client/src/com/vaadin/client/ui/grid/keyevents/BodyKeyPressHandler.java [deleted file]
client/src/com/vaadin/client/ui/grid/keyevents/BodyKeyUpHandler.java [deleted file]
client/src/com/vaadin/client/ui/grid/keyevents/FooterKeyDownHandler.java [deleted file]
client/src/com/vaadin/client/ui/grid/keyevents/FooterKeyPressHandler.java [deleted file]
client/src/com/vaadin/client/ui/grid/keyevents/FooterKeyUpHandler.java [deleted file]
client/src/com/vaadin/client/ui/grid/keyevents/GridKeyDownEvent.java [deleted file]
client/src/com/vaadin/client/ui/grid/keyevents/GridKeyPressEvent.java [deleted file]
client/src/com/vaadin/client/ui/grid/keyevents/GridKeyUpEvent.java [deleted file]
client/src/com/vaadin/client/ui/grid/keyevents/HeaderKeyDownHandler.java [deleted file]
client/src/com/vaadin/client/ui/grid/keyevents/HeaderKeyPressHandler.java [deleted file]
client/src/com/vaadin/client/ui/grid/keyevents/HeaderKeyUpHandler.java [deleted file]
client/src/com/vaadin/client/ui/grid/selection/MultiSelectionRenderer.java
uitest/src/com/vaadin/tests/widgetset/client/grid/GridBasicClientFeaturesWidget.java

index dd220b296485f42489075f38e779c92dcd19067c..ceff55e303403a8e04cd06a79638191ff7a9db1c 100644 (file)
@@ -57,6 +57,8 @@ import com.vaadin.client.ui.grid.PositionFunction.TranslatePosition;
 import com.vaadin.client.ui.grid.PositionFunction.WebkitTranslate3DPosition;
 import com.vaadin.client.ui.grid.ScrollbarBundle.HorizontalScrollbarBundle;
 import com.vaadin.client.ui.grid.ScrollbarBundle.VerticalScrollbarBundle;
+import com.vaadin.client.ui.grid.events.ScrollEvent;
+import com.vaadin.client.ui.grid.events.ScrollHandler;
 import com.vaadin.shared.ui.grid.GridState;
 import com.vaadin.shared.ui.grid.HeightMode;
 import com.vaadin.shared.ui.grid.Range;
@@ -3950,11 +3952,20 @@ public class Escalator extends Widget {
         final Element root = DOM.createDiv();
         setElement(root);
 
+        ScrollHandler scrollHandler = new ScrollHandler() {
+            @Override
+            public void onScroll(ScrollEvent event) {
+                fireEvent(new ScrollEvent());
+            }
+        };
+
         root.appendChild(verticalScrollbar.getElement());
+        verticalScrollbar.addScrollHandler(scrollHandler);
         verticalScrollbar.getElement().setTabIndex(-1);
         verticalScrollbar.setScrollbarThickness(Util.getNativeScrollbarSize());
 
         root.appendChild(horizontalScrollbar.getElement());
+        horizontalScrollbar.addScrollHandler(scrollHandler);
         horizontalScrollbar.getElement().setTabIndex(-1);
         horizontalScrollbar
                 .setScrollbarThickness(Util.getNativeScrollbarSize());
@@ -4668,4 +4679,15 @@ public class Escalator extends Widget {
                     + direction);
         }
     }
+
+    /**
+     * Adds a scroll handler to this escalator
+     * 
+     * @param handler
+     *            the scroll handler to add
+     * @return a handler registration for the registered scroll handler
+     */
+    public HandlerRegistration addScrollHandler(ScrollHandler handler) {
+        return addHandler(handler, ScrollEvent.TYPE);
+    }
 }
index 4d8aa25c3bc3106bbeeca4e4eb8e29009249a789..9c12b37bb5db5d19c6cbe6a9e74a5e47bc5eae77 100644 (file)
@@ -52,22 +52,24 @@ import com.vaadin.client.ui.SubPartAware;
 import com.vaadin.client.ui.grid.GridFooter.FooterRow;
 import com.vaadin.client.ui.grid.GridHeader.HeaderRow;
 import com.vaadin.client.ui.grid.GridStaticSection.StaticCell;
-import com.vaadin.client.ui.grid.keyevents.AbstractGridKeyEventHandler;
-import com.vaadin.client.ui.grid.keyevents.AbstractGridKeyEventHandler.GridKeyDownHandler;
-import com.vaadin.client.ui.grid.keyevents.AbstractGridKeyEventHandler.GridKeyPressHandler;
-import com.vaadin.client.ui.grid.keyevents.AbstractGridKeyEventHandler.GridKeyUpHandler;
-import com.vaadin.client.ui.grid.keyevents.BodyKeyDownHandler;
-import com.vaadin.client.ui.grid.keyevents.BodyKeyPressHandler;
-import com.vaadin.client.ui.grid.keyevents.BodyKeyUpHandler;
-import com.vaadin.client.ui.grid.keyevents.FooterKeyDownHandler;
-import com.vaadin.client.ui.grid.keyevents.FooterKeyPressHandler;
-import com.vaadin.client.ui.grid.keyevents.FooterKeyUpHandler;
-import com.vaadin.client.ui.grid.keyevents.GridKeyDownEvent;
-import com.vaadin.client.ui.grid.keyevents.GridKeyPressEvent;
-import com.vaadin.client.ui.grid.keyevents.GridKeyUpEvent;
-import com.vaadin.client.ui.grid.keyevents.HeaderKeyDownHandler;
-import com.vaadin.client.ui.grid.keyevents.HeaderKeyPressHandler;
-import com.vaadin.client.ui.grid.keyevents.HeaderKeyUpHandler;
+import com.vaadin.client.ui.grid.events.AbstractGridKeyEventHandler;
+import com.vaadin.client.ui.grid.events.AbstractGridKeyEventHandler.GridKeyDownHandler;
+import com.vaadin.client.ui.grid.events.AbstractGridKeyEventHandler.GridKeyPressHandler;
+import com.vaadin.client.ui.grid.events.AbstractGridKeyEventHandler.GridKeyUpHandler;
+import com.vaadin.client.ui.grid.events.BodyKeyDownHandler;
+import com.vaadin.client.ui.grid.events.BodyKeyPressHandler;
+import com.vaadin.client.ui.grid.events.BodyKeyUpHandler;
+import com.vaadin.client.ui.grid.events.FooterKeyDownHandler;
+import com.vaadin.client.ui.grid.events.FooterKeyPressHandler;
+import com.vaadin.client.ui.grid.events.FooterKeyUpHandler;
+import com.vaadin.client.ui.grid.events.GridKeyDownEvent;
+import com.vaadin.client.ui.grid.events.GridKeyPressEvent;
+import com.vaadin.client.ui.grid.events.GridKeyUpEvent;
+import com.vaadin.client.ui.grid.events.HeaderKeyDownHandler;
+import com.vaadin.client.ui.grid.events.HeaderKeyPressHandler;
+import com.vaadin.client.ui.grid.events.HeaderKeyUpHandler;
+import com.vaadin.client.ui.grid.events.ScrollEvent;
+import com.vaadin.client.ui.grid.events.ScrollHandler;
 import com.vaadin.client.ui.grid.renderers.ComplexRenderer;
 import com.vaadin.client.ui.grid.renderers.WidgetRenderer;
 import com.vaadin.client.ui.grid.selection.HasSelectionChangeHandlers;
@@ -1225,6 +1227,13 @@ public class Grid<T> extends Composite implements
 
         setSelectionMode(SelectionMode.SINGLE);
 
+        escalator.addScrollHandler(new ScrollHandler() {
+            @Override
+            public void onScroll(ScrollEvent event) {
+                fireEvent(new ScrollEvent());
+            }
+        });
+
         escalator
                 .addRowVisibilityChangeHandler(new RowVisibilityChangeHandler() {
                     @Override
@@ -1814,6 +1823,15 @@ public class Grid<T> extends Composite implements
         return escalator.getScrollTop();
     }
 
+    /**
+     * Gets the horizontal scroll offset
+     * 
+     * @return the number of pixels this grid is scrolled to the right
+     */
+    public double getScrollLeft() {
+        return escalator.getScrollLeft();
+    }
+
     private static final Logger getLogger() {
         return Logger.getLogger(Grid.class.getName());
     }
@@ -2560,4 +2578,15 @@ public class Grid<T> extends Composite implements
 
         return firstRowIndex;
     }
+
+    /**
+     * Adds a scroll handler to this grid
+     * 
+     * @param handler
+     *            the scroll handler to add
+     * @return a handler registration for the registered scroll handler
+     */
+    public HandlerRegistration addScrollHandler(ScrollHandler handler) {
+        return addHandler(handler, ScrollEvent.TYPE);
+    }
 }
index a45affb0be64b437f142a86b93fc87832c508fe7..ceaa4b9fec4b5a96707f8329e80a59f887ba1f6f 100644 (file)
@@ -16,6 +16,8 @@
 
 package com.vaadin.client.ui.grid;
 
+import com.google.gwt.core.client.Scheduler;
+import com.google.gwt.core.client.Scheduler.ScheduledCommand;
 import com.google.gwt.dom.client.Element;
 import com.google.gwt.dom.client.Style.Overflow;
 import com.google.gwt.dom.client.Style.Unit;
@@ -27,6 +29,8 @@ import com.google.gwt.user.client.DOM;
 import com.google.gwt.user.client.Event;
 import com.google.gwt.user.client.EventListener;
 import com.google.gwt.user.client.Timer;
+import com.vaadin.client.ui.grid.events.ScrollEvent;
+import com.vaadin.client.ui.grid.events.ScrollHandler;
 
 /**
  * An element-like bundle representing a configurable and visual scrollbar in
@@ -39,6 +43,41 @@ import com.google.gwt.user.client.Timer;
  */
 abstract class ScrollbarBundle {
 
+    private class ScrollEventFirer {
+        private final ScheduledCommand fireEventCommand = new ScheduledCommand() {
+            @Override
+            public void execute() {
+                if (!pixelValuesEqual(startScrollPos, getScrollPos())) {
+                    getHandlerManager().fireEvent(new ScrollEvent());
+                }
+                reset();
+            }
+        };
+
+        private boolean isBeingFired;
+        private double startScrollPos;
+
+        public ScrollEventFirer() {
+            reset();
+        }
+
+        public void scheduleEvent() {
+            if (!isBeingFired) {
+                /*
+                 * We'll gather all the scroll events, and only fire once, once
+                 * everything has calmed down.
+                 */
+                Scheduler.get().scheduleDeferred(fireEventCommand);
+                isBeingFired = true;
+            }
+        }
+
+        private void reset() {
+            isBeingFired = false;
+            startScrollPos = getScrollPos();
+        }
+    }
+
     /**
      * The orientation of the scrollbar.
      */
@@ -288,6 +327,8 @@ abstract class ScrollbarBundle {
 
     private TemporaryResizer invisibleScrollbarTemporaryResizer = new TemporaryResizer();
 
+    private final ScrollEventFirer scrollEventFirer = new ScrollEventFirer();
+
     private ScrollbarBundle() {
         root.appendChild(scrollSizeElement);
     }
@@ -409,6 +450,8 @@ abstract class ScrollbarBundle {
              * only facilitating future virtual scrollbars.
              */
             internalSetScrollPos(toInt32(scrollPos));
+
+            scrollEventFirer.scheduleEvent();
         }
     }
 
@@ -603,6 +646,7 @@ abstract class ScrollbarBundle {
         int newScrollPos = internalGetScrollPos();
         if (!isLocked()) {
             scrollPos = newScrollPos;
+            scrollEventFirer.scheduleEvent();
         } else if (scrollPos != newScrollPos) {
             // we need to actually undo the setting of the scroll.
             internalSetScrollPos(toInt32(scrollPos));
@@ -694,4 +738,15 @@ abstract class ScrollbarBundle {
      * @return the scroll direction of this scrollbar bundle
      */
     public abstract Direction getDirection();
+
+    /**
+     * Adds a scroll handler to the scrollbar bundle.
+     * 
+     * @param handler
+     *            the handler to add
+     * @return the registration object for the handler registration
+     */
+    public HandlerRegistration addScrollHandler(final ScrollHandler handler) {
+        return getHandlerManager().addHandler(ScrollEvent.TYPE, handler);
+    }
 }
diff --git a/client/src/com/vaadin/client/ui/grid/events/AbstractGridKeyEventHandler.java b/client/src/com/vaadin/client/ui/grid/events/AbstractGridKeyEventHandler.java
new file mode 100644 (file)
index 0000000..8dcd243
--- /dev/null
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2000-2014 Vaadin Ltd.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.client.ui.grid.events;
+
+import com.google.gwt.event.shared.EventHandler;
+import com.vaadin.client.ui.grid.Grid.AbstractGridKeyEvent;
+
+/**
+ * Base interface of all handlers for {@link AbstractGridKeyEvent}s.
+ * 
+ * @since
+ * @author Vaadin Ltd
+ */
+public abstract interface AbstractGridKeyEventHandler extends EventHandler {
+
+    public abstract interface GridKeyDownHandler extends
+            AbstractGridKeyEventHandler {
+        public void onKeyDown(GridKeyDownEvent event);
+    }
+
+    public abstract interface GridKeyUpHandler extends
+            AbstractGridKeyEventHandler {
+        public void onKeyUp(GridKeyUpEvent event);
+    }
+
+    public abstract interface GridKeyPressHandler extends
+            AbstractGridKeyEventHandler {
+        public void onKeyPress(GridKeyPressEvent event);
+    }
+
+}
diff --git a/client/src/com/vaadin/client/ui/grid/events/BodyKeyDownHandler.java b/client/src/com/vaadin/client/ui/grid/events/BodyKeyDownHandler.java
new file mode 100644 (file)
index 0000000..2ec8117
--- /dev/null
@@ -0,0 +1,28 @@
+/*
+ * Copyright 2000-2014 Vaadin Ltd.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.client.ui.grid.events;
+
+import com.vaadin.client.ui.grid.events.AbstractGridKeyEventHandler.GridKeyDownHandler;
+
+/**
+ * Handler for {@link GridKeyDownEvent}s that happen when active cell is in the
+ * body of the Grid.
+ * 
+ * @since
+ * @author Vaadin Ltd
+ */
+public interface BodyKeyDownHandler extends GridKeyDownHandler {
+}
diff --git a/client/src/com/vaadin/client/ui/grid/events/BodyKeyPressHandler.java b/client/src/com/vaadin/client/ui/grid/events/BodyKeyPressHandler.java
new file mode 100644 (file)
index 0000000..f328a11
--- /dev/null
@@ -0,0 +1,28 @@
+/*
+ * Copyright 2000-2014 Vaadin Ltd.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.client.ui.grid.events;
+
+import com.vaadin.client.ui.grid.events.AbstractGridKeyEventHandler.GridKeyPressHandler;
+
+/**
+ * Handler for {@link GridKeyPressEvent}s that happen when active cell is in the
+ * body of the Grid.
+ * 
+ * @since
+ * @author Vaadin Ltd
+ */
+public interface BodyKeyPressHandler extends GridKeyPressHandler {
+}
\ No newline at end of file
diff --git a/client/src/com/vaadin/client/ui/grid/events/BodyKeyUpHandler.java b/client/src/com/vaadin/client/ui/grid/events/BodyKeyUpHandler.java
new file mode 100644 (file)
index 0000000..f5cab67
--- /dev/null
@@ -0,0 +1,28 @@
+/*
+ * Copyright 2000-2014 Vaadin Ltd.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.client.ui.grid.events;
+
+import com.vaadin.client.ui.grid.events.AbstractGridKeyEventHandler.GridKeyUpHandler;
+
+/**
+ * Handler for {@link GridKeyUpEvent}s that happen when active cell is in the
+ * body of the Grid.
+ * 
+ * @since
+ * @author Vaadin Ltd
+ */
+public interface BodyKeyUpHandler extends GridKeyUpHandler {
+}
\ No newline at end of file
diff --git a/client/src/com/vaadin/client/ui/grid/events/FooterKeyDownHandler.java b/client/src/com/vaadin/client/ui/grid/events/FooterKeyDownHandler.java
new file mode 100644 (file)
index 0000000..e84da35
--- /dev/null
@@ -0,0 +1,28 @@
+/*
+ * Copyright 2000-2014 Vaadin Ltd.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.client.ui.grid.events;
+
+import com.vaadin.client.ui.grid.events.AbstractGridKeyEventHandler.GridKeyDownHandler;
+
+/**
+ * Handler for {@link GridKeyDownEvent}s that happen when active cell is in the
+ * footer of the Grid.
+ * 
+ * @since
+ * @author Vaadin Ltd
+ */
+public interface FooterKeyDownHandler extends GridKeyDownHandler {
+}
diff --git a/client/src/com/vaadin/client/ui/grid/events/FooterKeyPressHandler.java b/client/src/com/vaadin/client/ui/grid/events/FooterKeyPressHandler.java
new file mode 100644 (file)
index 0000000..617e25f
--- /dev/null
@@ -0,0 +1,28 @@
+/*
+ * Copyright 2000-2014 Vaadin Ltd.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.client.ui.grid.events;
+
+import com.vaadin.client.ui.grid.events.AbstractGridKeyEventHandler.GridKeyPressHandler;
+
+/**
+ * Handler for {@link GridKeyPressEvent}s that happen when active cell is in the
+ * footer of the Grid.
+ * 
+ * @since
+ * @author Vaadin Ltd
+ */
+public interface FooterKeyPressHandler extends GridKeyPressHandler {
+}
\ No newline at end of file
diff --git a/client/src/com/vaadin/client/ui/grid/events/FooterKeyUpHandler.java b/client/src/com/vaadin/client/ui/grid/events/FooterKeyUpHandler.java
new file mode 100644 (file)
index 0000000..4dd3dc7
--- /dev/null
@@ -0,0 +1,28 @@
+/*
+ * Copyright 2000-2014 Vaadin Ltd.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.client.ui.grid.events;
+
+import com.vaadin.client.ui.grid.events.AbstractGridKeyEventHandler.GridKeyUpHandler;
+
+/**
+ * Handler for {@link GridKeyUpEvent}s that happen when active cell is in the
+ * footer of the Grid.
+ * 
+ * @since
+ * @author Vaadin Ltd
+ */
+public interface FooterKeyUpHandler extends GridKeyUpHandler {
+}
\ No newline at end of file
diff --git a/client/src/com/vaadin/client/ui/grid/events/GridKeyDownEvent.java b/client/src/com/vaadin/client/ui/grid/events/GridKeyDownEvent.java
new file mode 100644 (file)
index 0000000..2fab683
--- /dev/null
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2000-2014 Vaadin Ltd.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.client.ui.grid.events;
+
+import com.google.gwt.dom.client.BrowserEvents;
+import com.vaadin.client.ui.grid.Grid;
+import com.vaadin.client.ui.grid.Grid.AbstractGridKeyEvent;
+import com.vaadin.client.ui.grid.events.AbstractGridKeyEventHandler.GridKeyDownHandler;
+
+/**
+ * Represents native key down event in Grid.
+ * 
+ * @since
+ * @author Vaadin Ltd
+ */
+public class GridKeyDownEvent extends AbstractGridKeyEvent<GridKeyDownHandler> {
+
+    public GridKeyDownEvent(Grid<?> grid) {
+        super(grid);
+    }
+
+    @Override
+    protected void dispatch(GridKeyDownHandler handler) {
+        super.dispatch(handler);
+        if ((activeSection == GridSection.BODY && handler instanceof BodyKeyDownHandler)
+                || (activeSection == GridSection.HEADER && handler instanceof HeaderKeyDownHandler)
+                || (activeSection == GridSection.FOOTER && handler instanceof FooterKeyDownHandler)) {
+            handler.onKeyDown(this);
+        }
+    }
+
+    @Override
+    protected String getBrowserEventType() {
+        return BrowserEvents.KEYDOWN;
+    }
+
+}
diff --git a/client/src/com/vaadin/client/ui/grid/events/GridKeyPressEvent.java b/client/src/com/vaadin/client/ui/grid/events/GridKeyPressEvent.java
new file mode 100644 (file)
index 0000000..112200b
--- /dev/null
@@ -0,0 +1,51 @@
+/*
+ * Copyright 2000-2014 Vaadin Ltd.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.client.ui.grid.events;
+
+import com.google.gwt.dom.client.BrowserEvents;
+import com.vaadin.client.ui.grid.Grid;
+import com.vaadin.client.ui.grid.Grid.AbstractGridKeyEvent;
+import com.vaadin.client.ui.grid.events.AbstractGridKeyEventHandler.GridKeyPressHandler;
+
+/**
+ * Represents native key press event in Grid.
+ * 
+ * @since
+ * @author Vaadin Ltd
+ */
+public class GridKeyPressEvent extends
+        AbstractGridKeyEvent<GridKeyPressHandler> {
+
+    public GridKeyPressEvent(Grid<?> grid) {
+        super(grid);
+    }
+
+    @Override
+    protected void dispatch(GridKeyPressHandler handler) {
+        super.dispatch(handler);
+        if ((activeSection == GridSection.BODY && handler instanceof BodyKeyPressHandler)
+                || (activeSection == GridSection.HEADER && handler instanceof HeaderKeyPressHandler)
+                || (activeSection == GridSection.FOOTER && handler instanceof FooterKeyPressHandler)) {
+            handler.onKeyPress(this);
+        }
+    }
+
+    @Override
+    protected String getBrowserEventType() {
+        return BrowserEvents.KEYPRESS;
+    }
+
+}
\ No newline at end of file
diff --git a/client/src/com/vaadin/client/ui/grid/events/GridKeyUpEvent.java b/client/src/com/vaadin/client/ui/grid/events/GridKeyUpEvent.java
new file mode 100644 (file)
index 0000000..9aa8ce7
--- /dev/null
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2000-2014 Vaadin Ltd.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.client.ui.grid.events;
+
+import com.google.gwt.dom.client.BrowserEvents;
+import com.vaadin.client.ui.grid.Grid;
+import com.vaadin.client.ui.grid.Grid.AbstractGridKeyEvent;
+import com.vaadin.client.ui.grid.events.AbstractGridKeyEventHandler.GridKeyUpHandler;
+
+/**
+ * Represents native key up event in Grid.
+ * 
+ * @since
+ * @author Vaadin Ltd
+ */
+public class GridKeyUpEvent extends AbstractGridKeyEvent<GridKeyUpHandler> {
+
+    public GridKeyUpEvent(Grid<?> grid) {
+        super(grid);
+    }
+
+    @Override
+    protected void dispatch(GridKeyUpHandler handler) {
+        super.dispatch(handler);
+        if ((activeSection == GridSection.BODY && handler instanceof BodyKeyUpHandler)
+                || (activeSection == GridSection.HEADER && handler instanceof HeaderKeyUpHandler)
+                || (activeSection == GridSection.FOOTER && handler instanceof FooterKeyUpHandler)) {
+            handler.onKeyUp(this);
+        }
+    }
+
+    @Override
+    protected String getBrowserEventType() {
+        return BrowserEvents.KEYUP;
+    }
+
+}
diff --git a/client/src/com/vaadin/client/ui/grid/events/HeaderKeyDownHandler.java b/client/src/com/vaadin/client/ui/grid/events/HeaderKeyDownHandler.java
new file mode 100644 (file)
index 0000000..a19bfad
--- /dev/null
@@ -0,0 +1,28 @@
+/*
+ * Copyright 2000-2014 Vaadin Ltd.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.client.ui.grid.events;
+
+import com.vaadin.client.ui.grid.events.AbstractGridKeyEventHandler.GridKeyDownHandler;
+
+/**
+ * Handler for {@link GridKeyDownEvent}s that happen when active cell is in the
+ * header of the Grid.
+ * 
+ * @since
+ * @author Vaadin Ltd
+ */
+public interface HeaderKeyDownHandler extends GridKeyDownHandler {
+}
diff --git a/client/src/com/vaadin/client/ui/grid/events/HeaderKeyPressHandler.java b/client/src/com/vaadin/client/ui/grid/events/HeaderKeyPressHandler.java
new file mode 100644 (file)
index 0000000..1188dc9
--- /dev/null
@@ -0,0 +1,28 @@
+/*
+ * Copyright 2000-2014 Vaadin Ltd.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.client.ui.grid.events;
+
+import com.vaadin.client.ui.grid.events.AbstractGridKeyEventHandler.GridKeyPressHandler;
+
+/**
+ * Handler for {@link GridKeyPressEvent}s that happen when active cell is in the
+ * header of the Grid.
+ * 
+ * @since
+ * @author Vaadin Ltd
+ */
+public interface HeaderKeyPressHandler extends GridKeyPressHandler {
+}
\ No newline at end of file
diff --git a/client/src/com/vaadin/client/ui/grid/events/HeaderKeyUpHandler.java b/client/src/com/vaadin/client/ui/grid/events/HeaderKeyUpHandler.java
new file mode 100644 (file)
index 0000000..3a8bc3e
--- /dev/null
@@ -0,0 +1,28 @@
+/*
+ * Copyright 2000-2014 Vaadin Ltd.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.client.ui.grid.events;
+
+import com.vaadin.client.ui.grid.events.AbstractGridKeyEventHandler.GridKeyUpHandler;
+
+/**
+ * Handler for {@link GridKeyUpEvent}s that happen when active cell is in the
+ * header of the Grid.
+ * 
+ * @since
+ * @author Vaadin Ltd
+ */
+public interface HeaderKeyUpHandler extends GridKeyUpHandler {
+}
\ No newline at end of file
diff --git a/client/src/com/vaadin/client/ui/grid/events/ScrollEvent.java b/client/src/com/vaadin/client/ui/grid/events/ScrollEvent.java
new file mode 100644 (file)
index 0000000..751823f
--- /dev/null
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2000-2014 Vaadin Ltd.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.client.ui.grid.events;
+
+import com.google.gwt.event.shared.GwtEvent;
+
+/**
+ * An event that signifies that a scrollbar bundle has been scrolled
+ * 
+ * @author Vaadin Ltd
+ */
+public class ScrollEvent extends GwtEvent<ScrollHandler> {
+
+    /** The type of this event */
+    public static final Type<ScrollHandler> TYPE = new Type<ScrollHandler>();
+
+    @Override
+    public Type<ScrollHandler> getAssociatedType() {
+        return TYPE;
+    }
+
+    @Override
+    protected void dispatch(final ScrollHandler handler) {
+        handler.onScroll(this);
+    }
+}
diff --git a/client/src/com/vaadin/client/ui/grid/events/ScrollHandler.java b/client/src/com/vaadin/client/ui/grid/events/ScrollHandler.java
new file mode 100644 (file)
index 0000000..473b180
--- /dev/null
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2000-2014 Vaadin Ltd.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.client.ui.grid.events;
+
+import com.google.gwt.event.shared.EventHandler;
+
+/**
+ * A handler that gets called whenever a scrollbar bundle is scrolled
+ * 
+ * @author Vaadin Ltd
+ */
+public interface ScrollHandler extends EventHandler {
+    /**
+     * A callback method that is called once a scrollbar bundle has been
+     * scrolled.
+     * 
+     * @param event
+     *            the scroll event
+     */
+    public void onScroll(ScrollEvent event);
+}
diff --git a/client/src/com/vaadin/client/ui/grid/keyevents/AbstractGridKeyEventHandler.java b/client/src/com/vaadin/client/ui/grid/keyevents/AbstractGridKeyEventHandler.java
deleted file mode 100644 (file)
index 57708e8..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright 2000-2014 Vaadin Ltd.
- * 
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- * 
- * http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-package com.vaadin.client.ui.grid.keyevents;
-
-import com.google.gwt.event.shared.EventHandler;
-import com.vaadin.client.ui.grid.Grid.AbstractGridKeyEvent;
-
-/**
- * Base interface of all handlers for {@link AbstractGridKeyEvent}s.
- * 
- * @since
- * @author Vaadin Ltd
- */
-public abstract interface AbstractGridKeyEventHandler extends EventHandler {
-
-    public abstract interface GridKeyDownHandler extends
-            AbstractGridKeyEventHandler {
-        public void onKeyDown(GridKeyDownEvent event);
-    }
-
-    public abstract interface GridKeyUpHandler extends
-            AbstractGridKeyEventHandler {
-        public void onKeyUp(GridKeyUpEvent event);
-    }
-
-    public abstract interface GridKeyPressHandler extends
-            AbstractGridKeyEventHandler {
-        public void onKeyPress(GridKeyPressEvent event);
-    }
-
-}
diff --git a/client/src/com/vaadin/client/ui/grid/keyevents/BodyKeyDownHandler.java b/client/src/com/vaadin/client/ui/grid/keyevents/BodyKeyDownHandler.java
deleted file mode 100644 (file)
index 9e61624..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright 2000-2014 Vaadin Ltd.
- * 
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- * 
- * http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-package com.vaadin.client.ui.grid.keyevents;
-
-import com.vaadin.client.ui.grid.keyevents.AbstractGridKeyEventHandler.GridKeyDownHandler;
-
-/**
- * Handler for {@link GridKeyDownEvent}s that happen when active cell is in the
- * body of the Grid.
- * 
- * @since
- * @author Vaadin Ltd
- */
-public interface BodyKeyDownHandler extends GridKeyDownHandler {
-}
diff --git a/client/src/com/vaadin/client/ui/grid/keyevents/BodyKeyPressHandler.java b/client/src/com/vaadin/client/ui/grid/keyevents/BodyKeyPressHandler.java
deleted file mode 100644 (file)
index f44c1d1..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright 2000-2014 Vaadin Ltd.
- * 
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- * 
- * http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-package com.vaadin.client.ui.grid.keyevents;
-
-import com.vaadin.client.ui.grid.keyevents.AbstractGridKeyEventHandler.GridKeyPressHandler;
-
-/**
- * Handler for {@link GridKeyPressEvent}s that happen when active cell is in the
- * body of the Grid.
- * 
- * @since
- * @author Vaadin Ltd
- */
-public interface BodyKeyPressHandler extends GridKeyPressHandler {
-}
\ No newline at end of file
diff --git a/client/src/com/vaadin/client/ui/grid/keyevents/BodyKeyUpHandler.java b/client/src/com/vaadin/client/ui/grid/keyevents/BodyKeyUpHandler.java
deleted file mode 100644 (file)
index a6b3929..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright 2000-2014 Vaadin Ltd.
- * 
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- * 
- * http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-package com.vaadin.client.ui.grid.keyevents;
-
-import com.vaadin.client.ui.grid.keyevents.AbstractGridKeyEventHandler.GridKeyUpHandler;
-
-/**
- * Handler for {@link GridKeyUpEvent}s that happen when active cell is in the
- * body of the Grid.
- * 
- * @since
- * @author Vaadin Ltd
- */
-public interface BodyKeyUpHandler extends GridKeyUpHandler {
-}
\ No newline at end of file
diff --git a/client/src/com/vaadin/client/ui/grid/keyevents/FooterKeyDownHandler.java b/client/src/com/vaadin/client/ui/grid/keyevents/FooterKeyDownHandler.java
deleted file mode 100644 (file)
index 5e9fffd..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright 2000-2014 Vaadin Ltd.
- * 
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- * 
- * http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-package com.vaadin.client.ui.grid.keyevents;
-
-import com.vaadin.client.ui.grid.keyevents.AbstractGridKeyEventHandler.GridKeyDownHandler;
-
-/**
- * Handler for {@link GridKeyDownEvent}s that happen when active cell is in the
- * footer of the Grid.
- * 
- * @since
- * @author Vaadin Ltd
- */
-public interface FooterKeyDownHandler extends GridKeyDownHandler {
-}
diff --git a/client/src/com/vaadin/client/ui/grid/keyevents/FooterKeyPressHandler.java b/client/src/com/vaadin/client/ui/grid/keyevents/FooterKeyPressHandler.java
deleted file mode 100644 (file)
index d5713d9..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright 2000-2014 Vaadin Ltd.
- * 
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- * 
- * http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-package com.vaadin.client.ui.grid.keyevents;
-
-import com.vaadin.client.ui.grid.keyevents.AbstractGridKeyEventHandler.GridKeyPressHandler;
-
-/**
- * Handler for {@link GridKeyPressEvent}s that happen when active cell is in the
- * footer of the Grid.
- * 
- * @since
- * @author Vaadin Ltd
- */
-public interface FooterKeyPressHandler extends GridKeyPressHandler {
-}
\ No newline at end of file
diff --git a/client/src/com/vaadin/client/ui/grid/keyevents/FooterKeyUpHandler.java b/client/src/com/vaadin/client/ui/grid/keyevents/FooterKeyUpHandler.java
deleted file mode 100644 (file)
index 87978e1..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright 2000-2014 Vaadin Ltd.
- * 
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- * 
- * http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-package com.vaadin.client.ui.grid.keyevents;
-
-import com.vaadin.client.ui.grid.keyevents.AbstractGridKeyEventHandler.GridKeyUpHandler;
-
-/**
- * Handler for {@link GridKeyUpEvent}s that happen when active cell is in the
- * footer of the Grid.
- * 
- * @since
- * @author Vaadin Ltd
- */
-public interface FooterKeyUpHandler extends GridKeyUpHandler {
-}
\ No newline at end of file
diff --git a/client/src/com/vaadin/client/ui/grid/keyevents/GridKeyDownEvent.java b/client/src/com/vaadin/client/ui/grid/keyevents/GridKeyDownEvent.java
deleted file mode 100644 (file)
index 65c8327..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright 2000-2014 Vaadin Ltd.
- * 
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- * 
- * http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-package com.vaadin.client.ui.grid.keyevents;
-
-import com.google.gwt.dom.client.BrowserEvents;
-import com.vaadin.client.ui.grid.Grid;
-import com.vaadin.client.ui.grid.Grid.AbstractGridKeyEvent;
-import com.vaadin.client.ui.grid.keyevents.AbstractGridKeyEventHandler.GridKeyDownHandler;
-
-/**
- * Represents native key down event in Grid.
- * 
- * @since
- * @author Vaadin Ltd
- */
-public class GridKeyDownEvent extends AbstractGridKeyEvent<GridKeyDownHandler> {
-
-    public GridKeyDownEvent(Grid<?> grid) {
-        super(grid);
-    }
-
-    @Override
-    protected void dispatch(GridKeyDownHandler handler) {
-        super.dispatch(handler);
-        if ((activeSection == GridSection.BODY && handler instanceof BodyKeyDownHandler)
-                || (activeSection == GridSection.HEADER && handler instanceof HeaderKeyDownHandler)
-                || (activeSection == GridSection.FOOTER && handler instanceof FooterKeyDownHandler)) {
-            handler.onKeyDown(this);
-        }
-    }
-
-    @Override
-    protected String getBrowserEventType() {
-        return BrowserEvents.KEYDOWN;
-    }
-
-}
diff --git a/client/src/com/vaadin/client/ui/grid/keyevents/GridKeyPressEvent.java b/client/src/com/vaadin/client/ui/grid/keyevents/GridKeyPressEvent.java
deleted file mode 100644 (file)
index 3884679..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright 2000-2014 Vaadin Ltd.
- * 
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- * 
- * http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-package com.vaadin.client.ui.grid.keyevents;
-
-import com.google.gwt.dom.client.BrowserEvents;
-import com.vaadin.client.ui.grid.Grid;
-import com.vaadin.client.ui.grid.Grid.AbstractGridKeyEvent;
-import com.vaadin.client.ui.grid.keyevents.AbstractGridKeyEventHandler.GridKeyPressHandler;
-
-/**
- * Represents native key press event in Grid.
- * 
- * @since
- * @author Vaadin Ltd
- */
-public class GridKeyPressEvent extends
-        AbstractGridKeyEvent<GridKeyPressHandler> {
-
-    public GridKeyPressEvent(Grid<?> grid) {
-        super(grid);
-    }
-
-    @Override
-    protected void dispatch(GridKeyPressHandler handler) {
-        super.dispatch(handler);
-        if ((activeSection == GridSection.BODY && handler instanceof BodyKeyPressHandler)
-                || (activeSection == GridSection.HEADER && handler instanceof HeaderKeyPressHandler)
-                || (activeSection == GridSection.FOOTER && handler instanceof FooterKeyPressHandler)) {
-            handler.onKeyPress(this);
-        }
-    }
-
-    @Override
-    protected String getBrowserEventType() {
-        return BrowserEvents.KEYPRESS;
-    }
-
-}
\ No newline at end of file
diff --git a/client/src/com/vaadin/client/ui/grid/keyevents/GridKeyUpEvent.java b/client/src/com/vaadin/client/ui/grid/keyevents/GridKeyUpEvent.java
deleted file mode 100644 (file)
index dd1fb33..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright 2000-2014 Vaadin Ltd.
- * 
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- * 
- * http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-package com.vaadin.client.ui.grid.keyevents;
-
-import com.google.gwt.dom.client.BrowserEvents;
-import com.vaadin.client.ui.grid.Grid;
-import com.vaadin.client.ui.grid.Grid.AbstractGridKeyEvent;
-import com.vaadin.client.ui.grid.keyevents.AbstractGridKeyEventHandler.GridKeyUpHandler;
-
-/**
- * Represents native key up event in Grid.
- * 
- * @since
- * @author Vaadin Ltd
- */
-public class GridKeyUpEvent extends AbstractGridKeyEvent<GridKeyUpHandler> {
-
-    public GridKeyUpEvent(Grid<?> grid) {
-        super(grid);
-    }
-
-    @Override
-    protected void dispatch(GridKeyUpHandler handler) {
-        super.dispatch(handler);
-        if ((activeSection == GridSection.BODY && handler instanceof BodyKeyUpHandler)
-                || (activeSection == GridSection.HEADER && handler instanceof HeaderKeyUpHandler)
-                || (activeSection == GridSection.FOOTER && handler instanceof FooterKeyUpHandler)) {
-            handler.onKeyUp(this);
-        }
-    }
-
-    @Override
-    protected String getBrowserEventType() {
-        return BrowserEvents.KEYUP;
-    }
-
-}
diff --git a/client/src/com/vaadin/client/ui/grid/keyevents/HeaderKeyDownHandler.java b/client/src/com/vaadin/client/ui/grid/keyevents/HeaderKeyDownHandler.java
deleted file mode 100644 (file)
index d8a1132..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright 2000-2014 Vaadin Ltd.
- * 
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- * 
- * http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-package com.vaadin.client.ui.grid.keyevents;
-
-import com.vaadin.client.ui.grid.keyevents.AbstractGridKeyEventHandler.GridKeyDownHandler;
-
-/**
- * Handler for {@link GridKeyDownEvent}s that happen when active cell is in the
- * header of the Grid.
- * 
- * @since
- * @author Vaadin Ltd
- */
-public interface HeaderKeyDownHandler extends GridKeyDownHandler {
-}
diff --git a/client/src/com/vaadin/client/ui/grid/keyevents/HeaderKeyPressHandler.java b/client/src/com/vaadin/client/ui/grid/keyevents/HeaderKeyPressHandler.java
deleted file mode 100644 (file)
index a2245b1..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright 2000-2014 Vaadin Ltd.
- * 
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- * 
- * http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-package com.vaadin.client.ui.grid.keyevents;
-
-import com.vaadin.client.ui.grid.keyevents.AbstractGridKeyEventHandler.GridKeyPressHandler;
-
-/**
- * Handler for {@link GridKeyPressEvent}s that happen when active cell is in the
- * header of the Grid.
- * 
- * @since
- * @author Vaadin Ltd
- */
-public interface HeaderKeyPressHandler extends GridKeyPressHandler {
-}
\ No newline at end of file
diff --git a/client/src/com/vaadin/client/ui/grid/keyevents/HeaderKeyUpHandler.java b/client/src/com/vaadin/client/ui/grid/keyevents/HeaderKeyUpHandler.java
deleted file mode 100644 (file)
index 405195e..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright 2000-2014 Vaadin Ltd.
- * 
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- * 
- * http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-package com.vaadin.client.ui.grid.keyevents;
-
-import com.vaadin.client.ui.grid.keyevents.AbstractGridKeyEventHandler.GridKeyUpHandler;
-
-/**
- * Handler for {@link GridKeyUpEvent}s that happen when active cell is in the
- * header of the Grid.
- * 
- * @since
- * @author Vaadin Ltd
- */
-public interface HeaderKeyUpHandler extends GridKeyUpHandler {
-}
\ No newline at end of file
index bfcc639a64c16e593a89fc3fda880443033eea22..222c8ab8060100db83d75b677fd1f16c593da92e 100644 (file)
@@ -41,10 +41,10 @@ import com.vaadin.client.ui.grid.DataAvailableEvent;
 import com.vaadin.client.ui.grid.DataAvailableHandler;
 import com.vaadin.client.ui.grid.FlyweightCell;
 import com.vaadin.client.ui.grid.Grid;
-import com.vaadin.client.ui.grid.keyevents.BodyKeyDownHandler;
-import com.vaadin.client.ui.grid.keyevents.BodyKeyUpHandler;
-import com.vaadin.client.ui.grid.keyevents.GridKeyDownEvent;
-import com.vaadin.client.ui.grid.keyevents.GridKeyUpEvent;
+import com.vaadin.client.ui.grid.events.BodyKeyDownHandler;
+import com.vaadin.client.ui.grid.events.BodyKeyUpHandler;
+import com.vaadin.client.ui.grid.events.GridKeyDownEvent;
+import com.vaadin.client.ui.grid.events.GridKeyUpEvent;
 import com.vaadin.client.ui.grid.renderers.ComplexRenderer;
 import com.vaadin.client.ui.grid.selection.SelectionModel.Multi.Batched;
 import com.vaadin.shared.ui.grid.ScrollDestination;
index 1bdbd76a20f102f76d919a2cc3c107dd8b1385c4..14388aec6ec1ff762c8ba3d5be64fac20f3a3139 100644 (file)
@@ -23,8 +23,10 @@ import java.util.Random;
 import com.google.gwt.core.client.Scheduler.ScheduledCommand;
 import com.google.gwt.event.dom.client.ClickEvent;
 import com.google.gwt.event.dom.client.ClickHandler;
+import com.google.gwt.event.shared.HandlerRegistration;
 import com.google.gwt.user.client.ui.Button;
 import com.google.gwt.user.client.ui.HTML;
+import com.google.gwt.user.client.ui.Label;
 import com.vaadin.client.ui.VLabel;
 import com.vaadin.client.ui.grid.Cell;
 import com.vaadin.client.ui.grid.FlyweightCell;
@@ -39,18 +41,20 @@ import com.vaadin.client.ui.grid.GridHeader.HeaderRow;
 import com.vaadin.client.ui.grid.Renderer;
 import com.vaadin.client.ui.grid.datasources.ListDataSource;
 import com.vaadin.client.ui.grid.datasources.ListSorter;
-import com.vaadin.client.ui.grid.keyevents.BodyKeyDownHandler;
-import com.vaadin.client.ui.grid.keyevents.BodyKeyPressHandler;
-import com.vaadin.client.ui.grid.keyevents.BodyKeyUpHandler;
-import com.vaadin.client.ui.grid.keyevents.FooterKeyDownHandler;
-import com.vaadin.client.ui.grid.keyevents.FooterKeyPressHandler;
-import com.vaadin.client.ui.grid.keyevents.FooterKeyUpHandler;
-import com.vaadin.client.ui.grid.keyevents.GridKeyDownEvent;
-import com.vaadin.client.ui.grid.keyevents.GridKeyPressEvent;
-import com.vaadin.client.ui.grid.keyevents.GridKeyUpEvent;
-import com.vaadin.client.ui.grid.keyevents.HeaderKeyDownHandler;
-import com.vaadin.client.ui.grid.keyevents.HeaderKeyPressHandler;
-import com.vaadin.client.ui.grid.keyevents.HeaderKeyUpHandler;
+import com.vaadin.client.ui.grid.events.BodyKeyDownHandler;
+import com.vaadin.client.ui.grid.events.BodyKeyPressHandler;
+import com.vaadin.client.ui.grid.events.BodyKeyUpHandler;
+import com.vaadin.client.ui.grid.events.FooterKeyDownHandler;
+import com.vaadin.client.ui.grid.events.FooterKeyPressHandler;
+import com.vaadin.client.ui.grid.events.FooterKeyUpHandler;
+import com.vaadin.client.ui.grid.events.GridKeyDownEvent;
+import com.vaadin.client.ui.grid.events.GridKeyPressEvent;
+import com.vaadin.client.ui.grid.events.GridKeyUpEvent;
+import com.vaadin.client.ui.grid.events.HeaderKeyDownHandler;
+import com.vaadin.client.ui.grid.events.HeaderKeyPressHandler;
+import com.vaadin.client.ui.grid.events.HeaderKeyUpHandler;
+import com.vaadin.client.ui.grid.events.ScrollEvent;
+import com.vaadin.client.ui.grid.events.ScrollHandler;
 import com.vaadin.client.ui.grid.renderers.DateRenderer;
 import com.vaadin.client.ui.grid.renderers.HtmlRenderer;
 import com.vaadin.client.ui.grid.renderers.NumberRenderer;
@@ -249,6 +253,7 @@ public class GridBasicClientFeaturesWidget extends
         createColumnsMenu();
         createHeaderMenu();
         createFooterMenu();
+        createInternalsMenu();
 
         grid.getElement().getStyle().setZIndex(0);
         addNorth(grid, 400);
@@ -256,6 +261,32 @@ public class GridBasicClientFeaturesWidget extends
         createKeyHandlers();
     }
 
+    private void createInternalsMenu() {
+        String[] listenersPath = { "Component", "Internals", "Listeners" };
+        final Label label = new Label();
+        addSouth(label, 20);
+
+        addMenuCommand("Add scroll listener", new ScheduledCommand() {
+            private HandlerRegistration scrollHandler = null;
+
+            @Override
+            public void execute() {
+                if (scrollHandler != null) {
+                    return;
+                }
+                scrollHandler = grid.addScrollHandler(new ScrollHandler() {
+                    @Override
+                    public void onScroll(ScrollEvent event) {
+                        @SuppressWarnings("hiding")
+                        final Grid<?> grid = (Grid<?>) event.getSource();
+                        label.setText("scrollTop: " + grid.getScrollTop()
+                                + ", scrollLeft: " + grid.getScrollLeft());
+                    }
+                });
+            }
+        }, listenersPath);
+    }
+
     private void createStateMenu() {
         String[] selectionModePath = { "Component", "State", "Selection mode" };
         String[] primaryStyleNamePath = { "Component", "State",