Klasse GridScroller
java.lang.Object
org.vaadin.addons.stefan.gridscroller.GridScroller
Utility class that provides methods to set and read the pixel based scroll position of a Vaadin grid.
- Autor:
- Stefan Uebe
-
Verschachtelte Klassen - Übersicht
Verschachtelte KlassenModifikator und TypKlasseBeschreibungstatic classContainer class providing information about scroll positions in a two dimensional component. -
Konstruktorübersicht
KonstruktorenKonstruktorBeschreibungGridScroller(com.vaadin.flow.component.grid.Grid<?> grid) Creates a new instance for the given grid. -
Methodenübersicht
Modifikator und TypMethodeBeschreibungcom.vaadin.flow.component.grid.Grid<?> getGrid()Returns the wrapped grid.static voidreadScrollPositions(com.vaadin.flow.component.grid.Grid<?> grid, com.vaadin.flow.function.SerializableConsumer<GridScroller.ScrollPosition> leftTopConsumer) Reads the current scroll position of the given grid and passes it to the given consumer.voidreadScrollPositions(com.vaadin.flow.function.SerializableConsumer<GridScroller.ScrollPosition> leftTopConsumer) Reads the current scroll position of given grid and passes it to the given consumer.static voidSets the both scroll positions in pixels for the given grid.static voidscroll(com.vaadin.flow.component.grid.Grid<?> grid, GridScroller.ScrollPosition scrollPosition) Sets the both scroll positions in pixels for the given grid.voidSets the both scroll positions in pixels for the grid.voidscroll(GridScroller.ScrollPosition scrollPosition) Sets the both scroll positions in pixels for the grid.static voidscrollLeft(com.vaadin.flow.component.grid.Grid<?> grid, Double value) Sets the left / horizontal / x scroll position in pixels for the given grid.voidscrollLeft(Double value) Sets the left / horizontal / x scroll position in pixels for grid.static voidSets the top / vertical / y scroll position in pixels for the given grid.voidSets the top / vertical / y scroll position in pixels for the grid.
-
Konstruktordetails
-
GridScroller
public GridScroller(com.vaadin.flow.component.grid.Grid<?> grid) Creates a new instance for the given grid.- Parameter:
grid- grid to manage- Löst aus:
NullPointerException- when given parameter is null
-
-
Methodendetails
-
scrollTop
Sets the top / vertical / y scroll position in pixels for the given grid. Passingnullresets the scroll position to the top.- Parameter:
grid- grid to modifyvalue- new scroll position
-
scrollLeft
Sets the left / horizontal / x scroll position in pixels for the given grid. Passingnullresets the scroll position to the left.- Parameter:
grid- grid to modifyvalue- new scroll position
-
scroll
Sets the both scroll positions in pixels for the given grid. Passingnullresets the respective scroll position.- Parameter:
grid- grid to modifyleft- new scroll position for left / horizontal / xtop- new scroll position for top / vertical / y
-
scroll
public static void scroll(com.vaadin.flow.component.grid.Grid<?> grid, GridScroller.ScrollPosition scrollPosition) Sets the both scroll positions in pixels for the given grid. Passingnullresets the scroll positions.- Parameter:
grid- grid to modifyscrollPosition- new scroll position
-
scroll
-
scroll
Sets the both scroll positions in pixels for the grid. Passingnullresets the scroll positions.- Parameter:
scrollPosition- new scroll position
-
readScrollPositions
public static void readScrollPositions(com.vaadin.flow.component.grid.Grid<?> grid, com.vaadin.flow.function.SerializableConsumer<GridScroller.ScrollPosition> leftTopConsumer) Reads the current scroll position of the given grid and passes it to the given consumer. Please notify, that this will do a round trip to the client, calling the consumer afterwards with the client result. If the client cannot be reached, then the consumer will not be called.- Parameter:
grid- grid to read fromleftTopConsumer- consumer for the scroll position- Löst aus:
IllegalStateException- return value from the client is not a json array
-
scrollTop
Sets the top / vertical / y scroll position in pixels for the grid. Passingnullresets the scroll position to the top.- Parameter:
value- new scroll position
-
scrollLeft
Sets the left / horizontal / x scroll position in pixels for grid. Passingnullresets the scroll position to the left.- Parameter:
value- new scroll position
-
readScrollPositions
public void readScrollPositions(com.vaadin.flow.function.SerializableConsumer<GridScroller.ScrollPosition> leftTopConsumer) Reads the current scroll position of given grid and passes it to the given consumer. Please notify, that this will do a round trip to the client, calling the consumer afterwards with the client result. If the client cannot be reached, then the consumer will not be called.- Parameter:
leftTopConsumer- consumer for the scroll position- Löst aus:
IllegalStateException- return value from the client is not a json array
-
getGrid
public com.vaadin.flow.component.grid.Grid<?> getGrid()Returns the wrapped grid.- Gibt zurück:
- grid
-