<li>Row height in <tt>Grid</tt> is replaced with separate header, body and footer row heights</li> | <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>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>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> | <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> | ||||
* @return the size of data provider with current filter | * @return the size of data provider with current filter | ||||
*/ | */ | ||||
@SuppressWarnings({ "unchecked", "rawtypes" }) | @SuppressWarnings({ "unchecked", "rawtypes" }) | ||||
protected int getDataProviderSize() { | |||||
public int getDataProviderSize() { | |||||
return getDataProvider().size(new Query(getFilter())); | return getDataProvider().size(new Query(getFilter())); | ||||
} | } | ||||
} | } | ||||
@Override | @Override | ||||
protected int getDataProviderSize() { | |||||
public int getDataProviderSize() { | |||||
return mapper.getTreeSize(); | return mapper.getTreeSize(); | ||||
} | } | ||||
* @param row | * @param row | ||||
* zero based index of the item to scroll to in the current view. | * zero based index of the item to scroll to in the current view. | ||||
* @throws IllegalArgumentException | * @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 { | public void scrollTo(int row) throws IllegalArgumentException { | ||||
scrollTo(row, ScrollDestination.ANY); | scrollTo(row, ScrollDestination.ANY); | ||||
Objects.requireNonNull(destination, | Objects.requireNonNull(destination, | ||||
"ScrollDestination can not be null"); | "ScrollDestination can not be null"); | ||||
if (row > getDataProvider().size(new Query())) { | |||||
if (row > getDataCommunicator().getDataProviderSize()) { | |||||
throw new IllegalArgumentException("Row outside dataProvider size"); | throw new IllegalArgumentException("Row outside dataProvider size"); | ||||
} | } | ||||
import com.vaadin.shared.Registration; | import com.vaadin.shared.Registration; | ||||
import com.vaadin.shared.ui.ContentMode; | import com.vaadin.shared.ui.ContentMode; | ||||
import com.vaadin.shared.ui.grid.HeightMode; | 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.TreeMultiSelectionModelState; | ||||
import com.vaadin.shared.ui.tree.TreeRendererState; | import com.vaadin.shared.ui.tree.TreeRendererState; | ||||
import com.vaadin.ui.Grid.SelectionMode; | import com.vaadin.ui.Grid.SelectionMode; | ||||
return (Tree<T>) super.getComponent(); | 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(); | |||||
} | |||||
} | } |