您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

EscalatorProxy.java 7.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  1. /*
  2. * Copyright 2000-2014 Vaadin Ltd.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License"); you may not
  5. * use this file except in compliance with the License. You may obtain a copy of
  6. * the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  12. * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  13. * License for the specific language governing permissions and limitations under
  14. * the License.
  15. */
  16. package com.vaadin.tests.widgetset.client.grid;
  17. import com.google.gwt.dom.client.Element;
  18. import com.google.gwt.dom.client.TableRowElement;
  19. import com.vaadin.client.ui.grid.Cell;
  20. import com.vaadin.client.ui.grid.ColumnConfiguration;
  21. import com.vaadin.client.ui.grid.Escalator;
  22. import com.vaadin.client.ui.grid.EscalatorUpdater;
  23. import com.vaadin.client.ui.grid.RowContainer;
  24. import com.vaadin.tests.widgetset.client.grid.EscalatorBasicClientFeaturesWidget.LogWidget;
  25. public class EscalatorProxy extends Escalator {
  26. private class ColumnConfigurationProxy implements ColumnConfiguration {
  27. private ColumnConfiguration columnConfiguration;
  28. public ColumnConfigurationProxy(ColumnConfiguration columnConfiguration) {
  29. this.columnConfiguration = columnConfiguration;
  30. }
  31. @Override
  32. public void removeColumns(int index, int numberOfColumns)
  33. throws IndexOutOfBoundsException, IllegalArgumentException {
  34. columnConfiguration.removeColumns(index, numberOfColumns);
  35. logWidget.log("removeColumns " + index + ", " + numberOfColumns);
  36. logWidget.updateDebugLabel();
  37. }
  38. @Override
  39. public void insertColumns(int index, int numberOfColumns)
  40. throws IndexOutOfBoundsException, IllegalArgumentException {
  41. columnConfiguration.insertColumns(index, numberOfColumns);
  42. logWidget.log("insertColumns " + index + ", " + numberOfColumns);
  43. logWidget.updateDebugLabel();
  44. }
  45. @Override
  46. public int getColumnCount() {
  47. return columnConfiguration.getColumnCount();
  48. }
  49. @Override
  50. public void setFrozenColumnCount(int count)
  51. throws IllegalArgumentException {
  52. columnConfiguration.setFrozenColumnCount(count);
  53. }
  54. @Override
  55. public int getFrozenColumnCount() {
  56. return columnConfiguration.getFrozenColumnCount();
  57. }
  58. @Override
  59. public void setColumnWidth(int index, int px)
  60. throws IllegalArgumentException {
  61. columnConfiguration.setColumnWidth(index, px);
  62. }
  63. @Override
  64. public int getColumnWidth(int index) throws IllegalArgumentException {
  65. return columnConfiguration.getColumnWidth(index);
  66. }
  67. @Override
  68. public int getColumnWidthActual(int index)
  69. throws IllegalArgumentException {
  70. return columnConfiguration.getColumnWidthActual(index);
  71. }
  72. @Override
  73. public void refreshColumns(int index, int numberOfColumns)
  74. throws IndexOutOfBoundsException, IllegalArgumentException {
  75. columnConfiguration.refreshColumns(index, numberOfColumns);
  76. }
  77. }
  78. private class RowContainerProxy implements RowContainer {
  79. private final RowContainer rowContainer;
  80. public RowContainerProxy(RowContainer rowContainer) {
  81. this.rowContainer = rowContainer;
  82. }
  83. @Override
  84. public EscalatorUpdater getEscalatorUpdater() {
  85. return rowContainer.getEscalatorUpdater();
  86. }
  87. @Override
  88. public void setEscalatorUpdater(EscalatorUpdater escalatorUpdater)
  89. throws IllegalArgumentException {
  90. rowContainer.setEscalatorUpdater(escalatorUpdater);
  91. }
  92. @Override
  93. public void removeRows(int index, int numberOfRows)
  94. throws IndexOutOfBoundsException, IllegalArgumentException {
  95. rowContainer.removeRows(index, numberOfRows);
  96. logWidget.log(rowContainer.getClass().getSimpleName()
  97. + " removeRows " + index + ", " + numberOfRows);
  98. logWidget.updateDebugLabel();
  99. }
  100. @Override
  101. public void insertRows(int index, int numberOfRows)
  102. throws IndexOutOfBoundsException, IllegalArgumentException {
  103. rowContainer.insertRows(index, numberOfRows);
  104. logWidget.log(rowContainer.getClass().getSimpleName()
  105. + " insertRows " + index + ", " + numberOfRows);
  106. logWidget.updateDebugLabel();
  107. }
  108. @Override
  109. public void refreshRows(int index, int numberOfRows)
  110. throws IndexOutOfBoundsException, IllegalArgumentException {
  111. rowContainer.refreshRows(index, numberOfRows);
  112. logWidget.log(rowContainer.getClass().getSimpleName()
  113. + " refreshRows " + index + ", " + numberOfRows);
  114. }
  115. @Override
  116. public int getRowCount() {
  117. return rowContainer.getRowCount();
  118. }
  119. @Override
  120. public void setDefaultRowHeight(int px) throws IllegalArgumentException {
  121. rowContainer.setDefaultRowHeight(px);
  122. }
  123. @Override
  124. public int getDefaultRowHeight() {
  125. return rowContainer.getDefaultRowHeight();
  126. }
  127. @Override
  128. public Cell getCell(Element element) {
  129. return rowContainer.getCell(element);
  130. }
  131. @Override
  132. public TableRowElement getRowElement(int index)
  133. throws IndexOutOfBoundsException, IllegalStateException {
  134. return rowContainer.getRowElement(index);
  135. }
  136. @Override
  137. public Element getElement() {
  138. return rowContainer.getElement();
  139. }
  140. }
  141. private RowContainer headerProxy = null;
  142. private RowContainer bodyProxy = null;
  143. private RowContainer footerProxy = null;
  144. private ColumnConfiguration columnProxy = null;
  145. private LogWidget logWidget;
  146. @Override
  147. public RowContainer getHeader() {
  148. if (headerProxy == null) {
  149. headerProxy = new RowContainerProxy(super.getHeader());
  150. }
  151. return headerProxy;
  152. }
  153. @Override
  154. public RowContainer getFooter() {
  155. if (footerProxy == null) {
  156. footerProxy = new RowContainerProxy(super.getFooter());
  157. }
  158. return footerProxy;
  159. }
  160. @Override
  161. public RowContainer getBody() {
  162. if (bodyProxy == null) {
  163. bodyProxy = new RowContainerProxy(super.getBody());
  164. }
  165. return bodyProxy;
  166. }
  167. @Override
  168. public ColumnConfiguration getColumnConfiguration() {
  169. if (columnProxy == null) {
  170. columnProxy = new ColumnConfigurationProxy(
  171. super.getColumnConfiguration());
  172. }
  173. return columnProxy;
  174. }
  175. public void setLogWidget(LogWidget logWidget) {
  176. this.logWidget = logWidget;
  177. logWidget.updateDebugLabel();
  178. }
  179. @Override
  180. public void setScrollTop(double scrollTop) {
  181. logWidget.log("setScrollTop " + scrollTop);
  182. logWidget.updateDebugLabel();
  183. super.setScrollTop(scrollTop);
  184. }
  185. }