aboutsummaryrefslogtreecommitdiffstats
path: root/client
diff options
context:
space:
mode:
authorHenrik Paul <henrik@vaadin.com>2015-02-03 16:37:19 +0200
committerVaadin Code Review <review@vaadin.com>2015-02-04 13:07:23 +0000
commit103b177475e0029abed00eec68e752492feafa61 (patch)
treed7a57ca6fd37330651a3fae8e80b01a9e115e018 /client
parentbe25df9b752a7350c91393397389761ce652f52d (diff)
downloadvaadin-framework-103b177475e0029abed00eec68e752492feafa61.tar.gz
vaadin-framework-103b177475e0029abed00eec68e752492feafa61.zip
Editor save/cancel buttons stay visually in place (#16562)
Change-Id: Ia63ffc36bee83e1bd20dc6e1a83616f94574a89b
Diffstat (limited to 'client')
-rw-r--r--client/src/com/vaadin/client/widgets/Grid.java23
1 files changed, 17 insertions, 6 deletions
diff --git a/client/src/com/vaadin/client/widgets/Grid.java b/client/src/com/vaadin/client/widgets/Grid.java
index c8354dc5ce..ea69968a75 100644
--- a/client/src/com/vaadin/client/widgets/Grid.java
+++ b/client/src/com/vaadin/client/widgets/Grid.java
@@ -945,6 +945,10 @@ public class Grid<T> extends ResizeComposite implements
private static final double BUTTON_HEIGHT = 25;
private static final double BUTTON_WIDTH = 50;
private static final double BUTTON_MARGIN = 5;
+ private static final double SAVE_BUTTON_LEFT_MARGIN_PX = 0;
+ private static final double CANCEL_BUTTON_LEFT_MARGIN_PX = SAVE_BUTTON_LEFT_MARGIN_PX
+ + BUTTON_WIDTH + BUTTON_MARGIN;
+
public static final int KEYCODE_SHOW = KeyCodes.KEY_ENTER;
public static final int KEYCODE_HIDE = KeyCodes.KEY_ESCAPE;
@@ -1264,8 +1268,6 @@ public class Grid<T> extends ResizeComposite implements
setBounds(editorOverlay, tr.getOffsetLeft(), overlayTop, width,
height);
- updateHorizontalScrollPosition();
-
scrollHandler = grid.addScrollHandler(new ScrollHandler() {
@Override
public void onScroll(ScrollEvent event) {
@@ -1321,10 +1323,12 @@ public class Grid<T> extends ResizeComposite implements
* Chrome and Firefox. So we measure it.
*/
double buttonTop = getButtonTop(tr, saveButton.getOffsetHeight());
- setBounds(saveButton.getElement(), 0, buttonTop, BUTTON_WIDTH,
- BUTTON_HEIGHT);
- setBounds(cancelButton.getElement(), BUTTON_WIDTH + BUTTON_MARGIN,
+ setBounds(saveButton.getElement(), SAVE_BUTTON_LEFT_MARGIN_PX,
+ buttonTop, BUTTON_WIDTH, BUTTON_HEIGHT);
+ setBounds(cancelButton.getElement(), CANCEL_BUTTON_LEFT_MARGIN_PX,
buttonTop, BUTTON_WIDTH, BUTTON_HEIGHT);
+
+ updateHorizontalScrollPosition();
}
private double getButtonTop(TableRowElement tr, int buttonHeight) {
@@ -1406,7 +1410,14 @@ public class Grid<T> extends ResizeComposite implements
}
private void updateHorizontalScrollPosition() {
- editorOverlay.getStyle().setLeft(-grid.getScrollLeft(), Unit.PX);
+ double scrollLeft = grid.getScrollLeft();
+
+ editorOverlay.getStyle().setLeft(-scrollLeft, Unit.PX);
+
+ double saveLeftPx = scrollLeft + SAVE_BUTTON_LEFT_MARGIN_PX;
+ double cancelLeftPx = scrollLeft + CANCEL_BUTTON_LEFT_MARGIN_PX;
+ saveButton.getElement().getStyle().setLeft(saveLeftPx, Unit.PX);
+ cancelButton.getElement().getStyle().setLeft(cancelLeftPx, Unit.PX);
}
protected void setGridEnabled(boolean enabled) {