@@ -103,6 +103,7 @@ | |||
<li>Row height in <tt>Grid</tt> is replaced with separate header, body and footer row heights</li> | |||
<li><tt>GridState</tt> variable <tt>rowHeight</tt> has been replaced by three variables.</li> | |||
<li><tt>Button</tt> has a new constructor that may cause constructor calls with null as first parameter to be ambiguous.</li> | |||
<li><tt>DataCommunicator</tt> method <tt>getDataProviderSize</tt> is now <tt>public</tt>, not <tt>protected</tt>.</li> | |||
<h2>For incompatible or behaviour-altering changes in 8.1, please see <a href="https://vaadin.com/download/release/8.1/8.1.0/release-notes.html#incompatible">8.1 release notes</a></h2> | |||
@@ -735,7 +735,7 @@ public class DataCommunicator<T> extends AbstractExtension { | |||
* @return the size of data provider with current filter | |||
*/ | |||
@SuppressWarnings({ "unchecked", "rawtypes" }) | |||
protected int getDataProviderSize() { | |||
public int getDataProviderSize() { | |||
return getDataProvider().size(new Query(getFilter())); | |||
} | |||
@@ -282,7 +282,7 @@ public class HierarchicalDataCommunicator<T> extends DataCommunicator<T> { | |||
} | |||
@Override | |||
protected int getDataProviderSize() { | |||
public int getDataProviderSize() { | |||
return mapper.getTreeSize(); | |||
} | |||
@@ -3989,7 +3989,7 @@ public class Grid<T> extends AbstractListing<T> implements HasComponents, | |||
* @param row | |||
* zero based index of the item to scroll to in the current view. | |||
* @throws IllegalArgumentException | |||
* if the provided id is not recognized by the data source. | |||
* if the provided row is outside the item range | |||
*/ | |||
public void scrollTo(int row) throws IllegalArgumentException { | |||
scrollTo(row, ScrollDestination.ANY); | |||
@@ -4013,7 +4013,7 @@ public class Grid<T> extends AbstractListing<T> implements HasComponents, | |||
Objects.requireNonNull(destination, | |||
"ScrollDestination can not be null"); | |||
if (row > getDataProvider().size(new Query())) { | |||
if (row > getDataCommunicator().getDataProviderSize()) { | |||
throw new IllegalArgumentException("Row outside dataProvider size"); | |||
} | |||
@@ -55,6 +55,7 @@ import com.vaadin.shared.MouseEventDetails; | |||
import com.vaadin.shared.Registration; | |||
import com.vaadin.shared.ui.ContentMode; | |||
import com.vaadin.shared.ui.grid.HeightMode; | |||
import com.vaadin.shared.ui.grid.ScrollDestination; | |||
import com.vaadin.shared.ui.tree.TreeMultiSelectionModelState; | |||
import com.vaadin.shared.ui.tree.TreeRendererState; | |||
import com.vaadin.ui.Grid.SelectionMode; | |||
@@ -1142,4 +1143,52 @@ public class Tree<T> extends Composite | |||
return (Tree<T>) super.getComponent(); | |||
} | |||
} | |||
/** | |||
* Scrolls to a certain item, using {@link ScrollDestination#ANY}. | |||
* <p> | |||
* If the item has an open details row, its size will also be taken into | |||
* account. | |||
* | |||
* @param row | |||
* zero based index of the item to scroll to in the current view. | |||
* @throws IllegalArgumentException | |||
* if the provided row is outside the item range | |||
*/ | |||
public void scrollTo(int row) throws IllegalArgumentException { | |||
treeGrid.scrollTo(row, ScrollDestination.ANY); | |||
} | |||
/** | |||
* Scrolls to a certain item, using user-specified scroll destination. | |||
* <p> | |||
* If the item has an open details row, its size will also be taken into | |||
* account. | |||
* | |||
* @param row | |||
* zero based index of the item to scroll to in the current view. | |||
* @param destination | |||
* value specifying desired position of scrolled-to row, not | |||
* {@code null} | |||
* @throws IllegalArgumentException | |||
* if the provided row is outside the item range | |||
*/ | |||
public void scrollTo(int row, ScrollDestination destination) { | |||
treeGrid.scrollTo(row, destination); | |||
} | |||
/** | |||
* Scrolls to the beginning of the first data row. | |||
*/ | |||
public void scrollToStart() { | |||
treeGrid.scrollToStart(); | |||
} | |||
/** | |||
* Scrolls to the end of the last data row. | |||
*/ | |||
public void scrollToEnd() { | |||
treeGrid.scrollToEnd(); | |||
} | |||
} |