123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258 |
- package com.vaadin.tests.widgetset.client.grid;
-
- import java.util.List;
- import java.util.Map;
- import java.util.function.Consumer;
-
- import com.google.gwt.dom.client.Element;
- import com.google.gwt.dom.client.TableRowElement;
- import com.google.gwt.dom.client.TableSectionElement;
- import com.vaadin.client.widget.escalator.Cell;
- import com.vaadin.client.widget.escalator.ColumnConfiguration;
- import com.vaadin.client.widget.escalator.EscalatorUpdater;
- import com.vaadin.client.widget.escalator.RowContainer;
- import com.vaadin.client.widget.escalator.RowContainer.BodyRowContainer;
- import com.vaadin.client.widget.escalator.SpacerUpdater;
- import com.vaadin.client.widgets.Escalator;
- import com.vaadin.tests.widgetset.client.grid.EscalatorBasicClientFeaturesWidget.LogWidget;
-
- public class EscalatorProxy extends Escalator {
- private class ColumnConfigurationProxy implements ColumnConfiguration {
- private ColumnConfiguration columnConfiguration;
-
- public ColumnConfigurationProxy(
- ColumnConfiguration columnConfiguration) {
- this.columnConfiguration = columnConfiguration;
- }
-
- @Override
- public void removeColumns(int index, int numberOfColumns)
- throws IndexOutOfBoundsException, IllegalArgumentException {
- columnConfiguration.removeColumns(index, numberOfColumns);
- logWidget.log("removeColumns " + index + ", " + numberOfColumns);
- logWidget.updateDebugLabel();
- }
-
- @Override
- public void insertColumns(int index, int numberOfColumns)
- throws IndexOutOfBoundsException, IllegalArgumentException {
- columnConfiguration.insertColumns(index, numberOfColumns);
- logWidget.log("insertColumns " + index + ", " + numberOfColumns);
- logWidget.updateDebugLabel();
- }
-
- @Override
- public int getColumnCount() {
- return columnConfiguration.getColumnCount();
- }
-
- @Override
- public void setFrozenColumnCount(int count)
- throws IllegalArgumentException {
- columnConfiguration.setFrozenColumnCount(count);
- }
-
- @Override
- public int getFrozenColumnCount() {
- return columnConfiguration.getFrozenColumnCount();
- }
-
- @Override
- public void setColumnWidth(int index, double px)
- throws IllegalArgumentException {
- columnConfiguration.setColumnWidth(index, px);
- }
-
- @Override
- public double getColumnWidth(int index)
- throws IllegalArgumentException {
- return columnConfiguration.getColumnWidth(index);
- }
-
- @Override
- public double getColumnWidthActual(int index)
- throws IllegalArgumentException {
- return columnConfiguration.getColumnWidthActual(index);
- }
-
- @Override
- public void refreshColumns(int index, int numberOfColumns)
- throws IndexOutOfBoundsException, IllegalArgumentException {
- columnConfiguration.refreshColumns(index, numberOfColumns);
- }
-
- @Override
- public void setColumnWidths(Map<Integer, Double> indexWidthMap)
- throws IllegalArgumentException {
- columnConfiguration.setColumnWidths(indexWidthMap);
- }
- }
-
- private class BodyRowContainerProxy extends RowContainerProxy
- implements BodyRowContainer {
- private BodyRowContainer rowContainer;
-
- public BodyRowContainerProxy(BodyRowContainer rowContainer) {
- super(rowContainer);
- this.rowContainer = rowContainer;
- }
-
- @Override
- public void setSpacer(int rowIndex, double height)
- throws IllegalArgumentException {
- rowContainer.setSpacer(rowIndex, height);
- }
-
- @Override
- public void setSpacerUpdater(SpacerUpdater spacerUpdater)
- throws IllegalArgumentException {
- rowContainer.setSpacerUpdater(spacerUpdater);
- }
-
- @Override
- public SpacerUpdater getSpacerUpdater() {
- return rowContainer.getSpacerUpdater();
- }
-
- @Override
- public void setNewRowCallback(
- Consumer<List<TableRowElement>> consumer) {
- throw new UnsupportedOperationException(
- "setNewRowCallback is not supported");
- }
- }
-
- private class RowContainerProxy implements RowContainer {
- private final RowContainer rowContainer;
-
- public RowContainerProxy(RowContainer rowContainer) {
- this.rowContainer = rowContainer;
- }
-
- @Override
- public EscalatorUpdater getEscalatorUpdater() {
- return rowContainer.getEscalatorUpdater();
- }
-
- @Override
- public void setEscalatorUpdater(EscalatorUpdater escalatorUpdater)
- throws IllegalArgumentException {
- rowContainer.setEscalatorUpdater(escalatorUpdater);
- }
-
- @Override
- public void removeRows(int index, int numberOfRows)
- throws IndexOutOfBoundsException, IllegalArgumentException {
- rowContainer.removeRows(index, numberOfRows);
- logWidget.log(rowContainer.getClass().getSimpleName()
- + " removeRows " + index + ", " + numberOfRows);
- logWidget.updateDebugLabel();
- }
-
- @Override
- public void insertRows(int index, int numberOfRows)
- throws IndexOutOfBoundsException, IllegalArgumentException {
- rowContainer.insertRows(index, numberOfRows);
- logWidget.log(rowContainer.getClass().getSimpleName()
- + " insertRows " + index + ", " + numberOfRows);
- logWidget.updateDebugLabel();
- }
-
- @Override
- public void refreshRows(int index, int numberOfRows)
- throws IndexOutOfBoundsException, IllegalArgumentException {
- rowContainer.refreshRows(index, numberOfRows);
- logWidget.log(rowContainer.getClass().getSimpleName()
- + " refreshRows " + index + ", " + numberOfRows);
- }
-
- @Override
- public int getRowCount() {
- return rowContainer.getRowCount();
- }
-
- @Override
- public boolean isAutodetectingRowHeightLater() {
- return rowContainer.isAutodetectingRowHeightLater();
- }
-
- @Override
- public void setDefaultRowHeight(double px)
- throws IllegalArgumentException {
- rowContainer.setDefaultRowHeight(px);
- }
-
- @Override
- public double getDefaultRowHeight() {
- return rowContainer.getDefaultRowHeight();
- }
-
- @Override
- public Cell getCell(Element element) {
- return rowContainer.getCell(element);
- }
-
- @Override
- public TableRowElement getRowElement(int index)
- throws IndexOutOfBoundsException, IllegalStateException {
- return rowContainer.getRowElement(index);
- }
-
- @Override
- public TableSectionElement getElement() {
- return rowContainer.getElement();
- }
-
- }
-
- private RowContainer headerProxy = null;
- private BodyRowContainer bodyProxy = null;
- private RowContainer footerProxy = null;
- private ColumnConfiguration columnProxy = null;
- private LogWidget logWidget;
-
- @Override
- public RowContainer getHeader() {
- if (headerProxy == null) {
- headerProxy = new RowContainerProxy(super.getHeader());
- }
- return headerProxy;
- }
-
- @Override
- public RowContainer getFooter() {
- if (footerProxy == null) {
- footerProxy = new RowContainerProxy(super.getFooter());
- }
- return footerProxy;
- }
-
- @Override
- public BodyRowContainer getBody() {
- if (bodyProxy == null) {
- bodyProxy = new BodyRowContainerProxy(super.getBody());
- }
- return bodyProxy;
- }
-
- @Override
- public ColumnConfiguration getColumnConfiguration() {
- if (columnProxy == null) {
- columnProxy = new ColumnConfigurationProxy(
- super.getColumnConfiguration());
- }
- return columnProxy;
- }
-
- public void setLogWidget(LogWidget logWidget) {
- this.logWidget = logWidget;
- logWidget.updateDebugLabel();
- }
-
- @Override
- public void setScrollTop(double scrollTop) {
- logWidget.log("setScrollTop " + scrollTop);
- logWidget.updateDebugLabel();
- super.setScrollTop(scrollTop);
- }
- }
|