]> source.dussan.org Git - vaadin-framework.git/commitdiff
Merge branch 'master' into grid-unbuffered-editor 7.6.0.alpha3
authorJohannes Dahlström <johannesd@vaadin.com>
Wed, 15 Jul 2015 09:59:35 +0000 (12:59 +0300)
committerJohannes Dahlström <johannesd@vaadin.com>
Wed, 15 Jul 2015 09:59:35 +0000 (12:59 +0300)
Conflicts:
uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridEditorTest.java

Change-Id: I5ed68bc73d38be4e1f6816108a5246d0c98a258f

1  2 
client/src/com/vaadin/client/widgets/Grid.java
uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridEditorTest.java

index cf05e7e53a00496cafbe2954b33aaf3a7233f0ec,377943ed61791afa6399b3ff22f7bbfe56d41b46..18407dccc9e7734fe731b1dd2d6cf2b741cd12a7
@@@ -1759,38 -1723,10 +1784,39 @@@ public class Grid<T> extends ResizeComp
  
          private void updateHorizontalScrollPosition() {
              double scrollLeft = grid.getScrollLeft();
-             cellWrapper.getStyle().setLeft(-scrollLeft, Unit.PX);
+             cellWrapper.getStyle().setLeft(
+                     frozenCellWrapper.getOffsetWidth() - scrollLeft, Unit.PX);
          }
  
 +        /**
 +         * Moves the editor overlay on scroll so that it stays on top of the
 +         * edited row. This will also snap the editor to top or bottom of the
 +         * row container if the edited row is scrolled out of the visible area.
 +         */
 +        private void updateVerticalScrollPosition() {
 +            double newScrollTop = grid.getScrollTop();
 +
 +            int gridTop = grid.getElement().getAbsoluteTop();
 +            int editorHeight = editorOverlay.getOffsetHeight();
 +
 +            Escalator escalator = grid.getEscalator();
 +            TableSectionElement header = escalator.getHeader().getElement();
 +            int footerTop = escalator.getFooter().getElement().getAbsoluteTop();
 +            int headerBottom = header.getAbsoluteBottom();
 +
 +            double newTop = originalTop - (newScrollTop - originalScrollTop);
 +
 +            if (newTop + gridTop < headerBottom) {
 +                // Snap editor to top of the row container
 +                newTop = header.getOffsetHeight();
 +            } else if (newTop + gridTop > footerTop - editorHeight) {
 +                // Snap editor to the bottom of the row container
 +                newTop = footerTop - editorHeight - gridTop;
 +            }
 +
 +            editorOverlay.getStyle().setTop(newTop, Unit.PX);
 +        }
 +
          protected void setGridEnabled(boolean enabled) {
              // TODO: This should be informed to handler as well so possible
              // fields can be disabled.
index e7eb78c35ed000f3d56cb37f3cede1ff04fc4265,b77cc419466de58eff3c1097ad338879fccedb7a..f7592ce922e1002622a2a85be3170866327e9290
@@@ -190,20 -259,15 +190,20 @@@ public abstract class GridEditorTest ex
      }
  
      @Test
 -    public void testNoScrollAfterMouseOpen() {
 -        int originalScrollPos = getGridVerticalScrollPos();
 +    public void testUneditableColumn() {
 +        selectMenuPath(EDIT_ITEM_5);
 +        assertEditorOpen();
  
 -        GridCellElement cell_5_0 = getGridElement().getCell(5, 0);
 -        new Actions(getDriver()).doubleClick(cell_5_0).perform();
 +        GridEditorElement editor = getGridElement().getEditor();
 +        assertFalse("Uneditable column should not have an editor widget",
 +                editor.isEditable(3));
 +        assertEquals(
 +                "Not editable cell did not contain correct classname",
 +                "not-editable",
-                 editor.findElement(By.className("v-grid-editor-cells"))
++                editor.findElements(By.className("v-grid-editor-cells")).get(1)
 +                        .findElements(By.xpath("./div")).get(3)
 +                        .getAttribute("class"));
  
 -        scrollGridVerticallyTo(100);
 -        assertEquals("Grid shouldn't scroll vertically while editing",
 -                originalScrollPos, getGridVerticalScrollPos());
      }
  
      @Test