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;
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());
+ 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);
+ }
}
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;
setSelectionMode(SelectionMode.SINGLE);
+ escalator.addScrollHandler(new ScrollHandler() {
+ @Override
+ public void onScroll(ScrollEvent event) {
+ fireEvent(new ScrollEvent());
+ }
+ });
+
escalator
.addRowVisibilityChangeHandler(new RowVisibilityChangeHandler() {
@Override
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());
}
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);
+ }
}
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;
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
*/
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.
*/
private TemporaryResizer invisibleScrollbarTemporaryResizer = new TemporaryResizer();
+ private final ScrollEventFirer scrollEventFirer = new ScrollEventFirer();
+
private ScrollbarBundle() {
root.appendChild(scrollSizeElement);
}
* only facilitating future virtual scrollbars.
*/
internalSetScrollPos(toInt32(scrollPos));
+
+ scrollEventFirer.scheduleEvent();
}
}
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));
* @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);
+ }
}
--- /dev/null
+/*
+ * 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);
+ }
+
+}
--- /dev/null
+/*
+ * 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 {
+}
--- /dev/null
+/*
+ * 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
--- /dev/null
+/*
+ * 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
--- /dev/null
+/*
+ * 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 {
+}
--- /dev/null
+/*
+ * 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
--- /dev/null
+/*
+ * 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
--- /dev/null
+/*
+ * 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;
+ }
+
+}
--- /dev/null
+/*
+ * 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
--- /dev/null
+/*
+ * 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;
+ }
+
+}
--- /dev/null
+/*
+ * 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 {
+}
--- /dev/null
+/*
+ * 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
--- /dev/null
+/*
+ * 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
--- /dev/null
+/*
+ * 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);
+ }
+}
--- /dev/null
+/*
+ * 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);
+}
+++ /dev/null
-/*
- * 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);
- }
-
-}
+++ /dev/null
-/*
- * 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 {
-}
+++ /dev/null
-/*
- * 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
+++ /dev/null
-/*
- * 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
+++ /dev/null
-/*
- * 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 {
-}
+++ /dev/null
-/*
- * 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
+++ /dev/null
-/*
- * 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
+++ /dev/null
-/*
- * 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;
- }
-
-}
+++ /dev/null
-/*
- * 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
+++ /dev/null
-/*
- * 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;
- }
-
-}
+++ /dev/null
-/*
- * 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 {
-}
+++ /dev/null
-/*
- * 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
+++ /dev/null
-/*
- * 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
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;
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;
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;
createColumnsMenu();
createHeaderMenu();
createFooterMenu();
+ createInternalsMenu();
grid.getElement().getStyle().setZIndex(0);
addNorth(grid, 400);
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",