summaryrefslogtreecommitdiffstats
path: root/uitest/src/com/vaadin/tests/widgetset/client
diff options
context:
space:
mode:
authorJohn Ahlroos <john@vaadin.com>2014-03-18 15:19:59 +0000
committerJohn Ahlroos <john@vaadin.com>2014-03-18 15:19:59 +0000
commitcca2172654699f9e2f79e8b36c70700c248da8f2 (patch)
tree2122cdf70d91f7533de4f3f0e31b10fec1792289 /uitest/src/com/vaadin/tests/widgetset/client
parent4420f52578e245045677f88852f1ba3f405e88a3 (diff)
downloadvaadin-framework-cca2172654699f9e2f79e8b36c70700c248da8f2.tar.gz
vaadin-framework-cca2172654699f9e2f79e8b36c70700c248da8f2.zip
Revert "Merge branch 'master' into grid"
This reverts commit 4420f52578e245045677f88852f1ba3f405e88a3. Change-Id: I06effe06f245baaeb499071917c359eb34cc55ea
Diffstat (limited to 'uitest/src/com/vaadin/tests/widgetset/client')
-rw-r--r--uitest/src/com/vaadin/tests/widgetset/client/grid/TestGridClientRpc.java48
-rw-r--r--uitest/src/com/vaadin/tests/widgetset/client/grid/TestGridConnector.java138
-rw-r--r--uitest/src/com/vaadin/tests/widgetset/client/grid/TestGridState.java29
-rw-r--r--uitest/src/com/vaadin/tests/widgetset/client/grid/VTestGrid.java220
4 files changed, 0 insertions, 435 deletions
diff --git a/uitest/src/com/vaadin/tests/widgetset/client/grid/TestGridClientRpc.java b/uitest/src/com/vaadin/tests/widgetset/client/grid/TestGridClientRpc.java
deleted file mode 100644
index ae2799d228..0000000000
--- a/uitest/src/com/vaadin/tests/widgetset/client/grid/TestGridClientRpc.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright 2000-2013 Vaadin Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-package com.vaadin.tests.widgetset.client.grid;
-
-import com.vaadin.shared.communication.ClientRpc;
-
-public interface TestGridClientRpc extends ClientRpc {
- void insertRows(int offset, int amount);
-
- void removeRows(int offset, int amount);
-
- void insertColumns(int offset, int amount);
-
- void removeColumns(int offset, int amount);
-
- void scrollToRow(int index, String destination, int padding);
-
- void scrollToColumn(int index, String destination, int padding);
-
- void setFrozenColumns(int frozenColumns);
-
- void insertHeaders(int index, int amount);
-
- void removeHeaders(int index, int amount);
-
- void insertFooters(int index, int amount);
-
- void removeFooters(int index, int amount);
-
- void setColumnWidth(int index, int px);
-
- void calculateColumnWidths();
-
- void randomRowHeight();
-}
diff --git a/uitest/src/com/vaadin/tests/widgetset/client/grid/TestGridConnector.java b/uitest/src/com/vaadin/tests/widgetset/client/grid/TestGridConnector.java
deleted file mode 100644
index e2d88c57f2..0000000000
--- a/uitest/src/com/vaadin/tests/widgetset/client/grid/TestGridConnector.java
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- * Copyright 2000-2013 Vaadin Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-package com.vaadin.tests.widgetset.client.grid;
-
-import com.google.gwt.user.client.Random;
-import com.vaadin.client.ui.AbstractComponentConnector;
-import com.vaadin.shared.ui.Connect;
-import com.vaadin.shared.ui.grid.ScrollDestination;
-import com.vaadin.tests.widgetset.server.grid.TestGrid;
-
-/**
- * @since 7.2
- * @author Vaadin Ltd
- */
-@Connect(TestGrid.class)
-public class TestGridConnector extends AbstractComponentConnector {
- @Override
- protected void init() {
- super.init();
- registerRpc(TestGridClientRpc.class, new TestGridClientRpc() {
- @Override
- public void insertRows(int offset, int amount) {
- getWidget().insertRows(offset, amount);
- }
-
- @Override
- public void removeRows(int offset, int amount) {
- getWidget().removeRows(offset, amount);
- }
-
- @Override
- public void removeColumns(int offset, int amount) {
- getWidget().removeColumns(offset, amount);
- }
-
- @Override
- public void insertColumns(int offset, int amount) {
- getWidget().insertColumns(offset, amount);
- }
-
- @Override
- public void scrollToRow(int index, String destination, int padding) {
- getWidget().scrollToRow(index, getDestination(destination),
- padding);
- }
-
- @Override
- public void scrollToColumn(int index, String destination,
- int padding) {
- getWidget().scrollToColumn(index, getDestination(destination),
- padding);
- }
-
- private ScrollDestination getDestination(String destination) {
- final ScrollDestination d;
- if (destination.equals("start")) {
- d = ScrollDestination.START;
- } else if (destination.equals("middle")) {
- d = ScrollDestination.MIDDLE;
- } else if (destination.equals("end")) {
- d = ScrollDestination.END;
- } else {
- d = ScrollDestination.ANY;
- }
- return d;
- }
-
- @Override
- public void setFrozenColumns(int frozenColumns) {
- getWidget().getColumnConfiguration().setFrozenColumnCount(
- frozenColumns);
- }
-
- @Override
- public void insertHeaders(int index, int amount) {
- getWidget().getHeader().insertRows(index, amount);
- }
-
- @Override
- public void removeHeaders(int index, int amount) {
- getWidget().getHeader().removeRows(index, amount);
- }
-
- @Override
- public void insertFooters(int index, int amount) {
- getWidget().getFooter().insertRows(index, amount);
- }
-
- @Override
- public void removeFooters(int index, int amount) {
- getWidget().getFooter().removeRows(index, amount);
- }
-
- @Override
- public void setColumnWidth(int index, int px) {
- getWidget().getColumnConfiguration().setColumnWidth(index, px);
- }
-
- @Override
- public void calculateColumnWidths() {
- getWidget().calculateColumnWidths();
- }
-
- @Override
- public void randomRowHeight() {
- getWidget().getHeader().setDefaultRowHeight(
- Random.nextInt(20) + 20);
- getWidget().getBody().setDefaultRowHeight(
- Random.nextInt(20) + 20);
- getWidget().getFooter().setDefaultRowHeight(
- Random.nextInt(20) + 20);
- }
- });
- }
-
- @Override
- public VTestGrid getWidget() {
- return (VTestGrid) super.getWidget();
- }
-
- @Override
- public TestGridState getState() {
- return (TestGridState) super.getState();
- }
-}
diff --git a/uitest/src/com/vaadin/tests/widgetset/client/grid/TestGridState.java b/uitest/src/com/vaadin/tests/widgetset/client/grid/TestGridState.java
deleted file mode 100644
index 73d6ba311c..0000000000
--- a/uitest/src/com/vaadin/tests/widgetset/client/grid/TestGridState.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright 2000-2013 Vaadin Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-package com.vaadin.tests.widgetset.client.grid;
-
-import com.vaadin.shared.AbstractComponentState;
-
-/**
- * @since 7.2
- * @author Vaadin Ltd
- */
-public class TestGridState extends AbstractComponentState {
- public static final String DEFAULT_HEIGHT = "400.0px";
-
- /* TODO: this should be "100%" before setting final. */
- public static final String DEFAULT_WIDTH = "800.0px";
-}
diff --git a/uitest/src/com/vaadin/tests/widgetset/client/grid/VTestGrid.java b/uitest/src/com/vaadin/tests/widgetset/client/grid/VTestGrid.java
deleted file mode 100644
index 28e650edc1..0000000000
--- a/uitest/src/com/vaadin/tests/widgetset/client/grid/VTestGrid.java
+++ /dev/null
@@ -1,220 +0,0 @@
-package com.vaadin.tests.widgetset.client.grid;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import com.google.gwt.user.client.ui.Composite;
-import com.vaadin.client.ui.grid.Cell;
-import com.vaadin.client.ui.grid.ColumnConfiguration;
-import com.vaadin.client.ui.grid.Escalator;
-import com.vaadin.client.ui.grid.EscalatorUpdater;
-import com.vaadin.client.ui.grid.Row;
-import com.vaadin.client.ui.grid.RowContainer;
-import com.vaadin.shared.ui.grid.ScrollDestination;
-
-public class VTestGrid extends Composite {
-
- private static class Data {
- private int columnCounter = 0;
- private int rowCounter = 0;
- private final List<Integer> columns = new ArrayList<Integer>();
- private final List<Integer> rows = new ArrayList<Integer>();
-
- @SuppressWarnings("boxing")
- public void insertRows(final int offset, final int amount) {
- final List<Integer> newRows = new ArrayList<Integer>();
- for (int i = 0; i < amount; i++) {
- newRows.add(rowCounter++);
- }
- rows.addAll(offset, newRows);
- }
-
- @SuppressWarnings("boxing")
- public void insertColumns(final int offset, final int amount) {
- final List<Integer> newColumns = new ArrayList<Integer>();
- for (int i = 0; i < amount; i++) {
- newColumns.add(columnCounter++);
- }
- columns.addAll(offset, newColumns);
- }
-
- public EscalatorUpdater createHeaderUpdater() {
- return new EscalatorUpdater() {
- @Override
- public void updateCells(final Row row,
- final Iterable<Cell> cellsToUpdate) {
- for (final Cell cell : cellsToUpdate) {
- if (cell.getColumn() % 3 == 0) {
- cell.setColSpan(2);
- }
-
- final Integer columnName = columns
- .get(cell.getColumn());
- cell.getElement().setInnerText("Header " + columnName);
- }
- }
- };
- }
-
- public EscalatorUpdater createFooterUpdater() {
- return new EscalatorUpdater() {
- @Override
- public void updateCells(final Row row,
- final Iterable<Cell> cellsToUpdate) {
- for (final Cell cell : cellsToUpdate) {
- if (cell.getColumn() % 3 == 1) {
- cell.setColSpan(2);
- }
-
- final Integer columnName = columns
- .get(cell.getColumn());
- cell.getElement().setInnerText("Footer " + columnName);
- }
- }
- };
- }
-
- public EscalatorUpdater createBodyUpdater() {
- return new EscalatorUpdater() {
- private int i = 0;
-
- public void renderCell(final Cell cell) {
- final Integer columnName = columns.get(cell.getColumn());
- final Integer rowName = rows.get(cell.getRow());
- final String cellInfo = columnName + "," + rowName + " ("
- + i + ")";
-
- if (cell.getColumn() > 0) {
- cell.getElement().setInnerText("Cell: " + cellInfo);
- } else {
- cell.getElement().setInnerText(
- "Row " + cell.getRow() + ": " + cellInfo);
- }
-
- if (cell.getColumn() % 3 == cell.getRow() % 3) {
- cell.setColSpan(3);
- }
-
- final double c = i * .1;
- final int r = (int) ((Math.cos(c) + 1) * 128);
- final int g = (int) ((Math.cos(c / Math.PI) + 1) * 128);
- final int b = (int) ((Math.cos(c / (Math.PI * 2)) + 1) * 128);
- cell.getElement()
- .getStyle()
- .setBackgroundColor(
- "rgb(" + r + "," + g + "," + b + ")");
- if ((r * .8 + g * 1.3 + b * .9) / 3 < 127) {
- cell.getElement().getStyle().setColor("white");
- } else {
- cell.getElement().getStyle().clearColor();
- }
-
- i++;
- }
-
- @Override
- public void updateCells(final Row row,
- final Iterable<Cell> cellsToUpdate) {
- for (final Cell cell : cellsToUpdate) {
- renderCell(cell);
- }
- }
- };
- }
-
- public void removeRows(final int offset, final int amount) {
- for (int i = 0; i < amount; i++) {
- rows.remove(offset);
- }
- }
-
- public void removeColumns(final int offset, final int amount) {
- for (int i = 0; i < amount; i++) {
- columns.remove(offset);
- }
- }
- }
-
- private final Escalator escalator = new Escalator();
- private final Data data = new Data();
-
- public VTestGrid() {
- initWidget(escalator);
- final RowContainer header = escalator.getHeader();
- header.setEscalatorUpdater(data.createHeaderUpdater());
- header.insertRows(0, 1);
-
- final RowContainer footer = escalator.getFooter();
- footer.setEscalatorUpdater(data.createFooterUpdater());
- footer.insertRows(0, 1);
-
- escalator.getBody().setEscalatorUpdater(data.createBodyUpdater());
-
- insertRows(0, 100);
- insertColumns(0, 10);
-
- setWidth(TestGridState.DEFAULT_WIDTH);
- setHeight(TestGridState.DEFAULT_HEIGHT);
-
- }
-
- public void insertRows(final int offset, final int number) {
- data.insertRows(offset, number);
- escalator.getBody().insertRows(offset, number);
- }
-
- public void insertColumns(final int offset, final int number) {
- data.insertColumns(offset, number);
- escalator.getColumnConfiguration().insertColumns(offset, number);
- }
-
- public ColumnConfiguration getColumnConfiguration() {
- return escalator.getColumnConfiguration();
- }
-
- public void scrollToRow(final int index,
- final ScrollDestination destination, final int padding) {
- escalator.scrollToRow(index, destination, padding);
- }
-
- public void scrollToColumn(final int index,
- final ScrollDestination destination, final int padding) {
- escalator.scrollToColumn(index, destination, padding);
- }
-
- public void removeRows(final int offset, final int amount) {
- data.removeRows(offset, amount);
- escalator.getBody().removeRows(offset, amount);
- }
-
- public void removeColumns(final int offset, final int amount) {
- data.removeColumns(offset, amount);
- escalator.getColumnConfiguration().removeColumns(offset, amount);
- }
-
- @Override
- public void setWidth(String width) {
- escalator.setWidth(width);
- }
-
- @Override
- public void setHeight(String height) {
- escalator.setHeight(height);
- }
-
- public RowContainer getHeader() {
- return escalator.getHeader();
- }
-
- public RowContainer getBody() {
- return escalator.getBody();
- }
-
- public RowContainer getFooter() {
- return escalator.getFooter();
- }
-
- public void calculateColumnWidths() {
- escalator.calculateColumnWidths();
- }
-}