Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

EscalatorUpdater.java 5.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. /*
  2. * Copyright 2000-2016 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.v7.client.widget.escalator;
  17. import com.vaadin.v7.client.widgets.Escalator;
  18. /**
  19. * An interface that allows client code to define how a certain row in Escalator
  20. * will be displayed. The contents of an escalator's header, body and footer are
  21. * rendered by their respective updaters.
  22. * <p>
  23. * The updater is responsible for internally handling all remote communication,
  24. * should the displayed data need to be fetched remotely.
  25. * <p>
  26. * This has a similar function to {@link com.vaadin.v7.client.widgets.Grid Grid's}
  27. * {@link com.vaadin.v7.client.renderers.Renderer Renderers}
  28. * , although they operate on different abstraction levels.
  29. *
  30. * @since 7.4
  31. * @author Vaadin Ltd
  32. * @see RowContainer#setEscalatorUpdater(EscalatorUpdater)
  33. * @see Escalator#getHeader()
  34. * @see Escalator#getBody()
  35. * @see Escalator#getFooter()
  36. * @see Renderer
  37. */
  38. public interface EscalatorUpdater {
  39. /**
  40. * An {@link EscalatorUpdater} that doesn't render anything.
  41. */
  42. public static final EscalatorUpdater NULL = new EscalatorUpdater() {
  43. @Override
  44. public void update(final Row row,
  45. final Iterable<FlyweightCell> cellsToUpdate) {
  46. // NOOP
  47. }
  48. @Override
  49. public void preAttach(final Row row,
  50. final Iterable<FlyweightCell> cellsToAttach) {
  51. // NOOP
  52. }
  53. @Override
  54. public void postAttach(final Row row,
  55. final Iterable<FlyweightCell> attachedCells) {
  56. // NOOP
  57. }
  58. @Override
  59. public void preDetach(final Row row,
  60. final Iterable<FlyweightCell> cellsToDetach) {
  61. // NOOP
  62. }
  63. @Override
  64. public void postDetach(final Row row,
  65. final Iterable<FlyweightCell> detachedCells) {
  66. // NOOP
  67. }
  68. };
  69. /**
  70. * Renders a row contained in a row container.
  71. * <p>
  72. * <em>Note:</em> If rendering of cells is deferred (e.g. because
  73. * asynchronous data retrieval), this method is responsible for explicitly
  74. * displaying some placeholder data (empty content is valid). Because the
  75. * cells (and rows) in an escalator are recycled, failing to reset a cell's
  76. * presentation will lead to wrong data being displayed in the escalator.
  77. * <p>
  78. * For performance reasons, the escalator will never autonomously clear any
  79. * data in a cell.
  80. *
  81. * @param row
  82. * Information about the row that is being updated.
  83. * <em>Note:</em> You should not store nor reuse this reference.
  84. * @param cellsToUpdate
  85. * A collection of cells that need to be updated. <em>Note:</em>
  86. * You should neither store nor reuse the reference to the
  87. * iterable, nor to the individual cells.
  88. */
  89. public void update(Row row, Iterable<FlyweightCell> cellsToUpdate);
  90. /**
  91. * Called before attaching new cells to the escalator.
  92. *
  93. * @param row
  94. * Information about the row to which the cells will be added.
  95. * <em>Note:</em> You should not store nor reuse this reference.
  96. * @param cellsToAttach
  97. * A collection of cells that are about to be attached.
  98. * <em>Note:</em> You should neither store nor reuse the
  99. * reference to the iterable, nor to the individual cells.
  100. *
  101. */
  102. public void preAttach(Row row, Iterable<FlyweightCell> cellsToAttach);
  103. /**
  104. * Called after attaching new cells to the escalator.
  105. *
  106. * @param row
  107. * Information about the row to which the cells were added.
  108. * <em>Note:</em> You should not store nor reuse this reference.
  109. * @param attachedCells
  110. * A collection of cells that were attached. <em>Note:</em> You
  111. * should neither store nor reuse the reference to the iterable,
  112. * nor to the individual cells.
  113. *
  114. */
  115. public void postAttach(Row row, Iterable<FlyweightCell> attachedCells);
  116. /**
  117. * Called before detaching cells from the escalator.
  118. *
  119. * @param row
  120. * Information about the row from which the cells will be
  121. * removed. <em>Note:</em> You should not store nor reuse this
  122. * reference.
  123. * @param cellsToDetach
  124. * A collection of cells that are about to be detached.
  125. * <em>Note:</em> You should neither store nor reuse the
  126. * reference to the iterable, nor to the individual cells.
  127. *
  128. */
  129. public void preDetach(Row row, Iterable<FlyweightCell> cellsToDetach);
  130. /**
  131. * Called after detaching cells from the escalator.
  132. *
  133. * @param row
  134. * Information about the row from which the cells were removed.
  135. * <em>Note:</em> You should not store nor reuse this reference.
  136. * @param detachedCells
  137. * A collection of cells that were detached. <em>Note:</em> You
  138. * should neither store nor reuse the reference to the iterable,
  139. * nor to the individual cells.
  140. *
  141. */
  142. public void postDetach(Row row, Iterable<FlyweightCell> detachedCells);
  143. }