You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

DataProviderRpc.java 3.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  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.shared.data;
  17. import com.vaadin.shared.annotations.NoLayout;
  18. import com.vaadin.shared.communication.ClientRpc;
  19. import elemental.json.JsonArray;
  20. /**
  21. * RPC interface used for pushing container data to the client.
  22. *
  23. * @since 7.4
  24. * @author Vaadin Ltd
  25. */
  26. public interface DataProviderRpc extends ClientRpc {
  27. /**
  28. * Sends updated row data to a client.
  29. * <p>
  30. * rowDataJson represents a JSON array of JSON objects in the following
  31. * format:
  32. *
  33. * <pre>
  34. * [{
  35. * "d": [COL_1_JSON, COL_2_json, ...],
  36. * "k": "1"
  37. * },
  38. * ...
  39. * ]
  40. * </pre>
  41. *
  42. * where COL_INDEX is the index of the column (as a string), and COL_n_JSON
  43. * is valid JSON of the column's data.
  44. *
  45. * @param firstRowIndex
  46. * the index of the first updated row
  47. * @param rowDataJson
  48. * the updated row data
  49. * @see com.vaadin.shared.ui.grid.GridState#JSONKEY_DATA
  50. * @see com.vaadin.ui.components.grid.Renderer#encode(Object)
  51. */
  52. @NoLayout
  53. public void setRowData(int firstRowIndex, JsonArray rowDataJson);
  54. /**
  55. * Informs the client to remove row data.
  56. *
  57. * @param firstRowIndex
  58. * the index of the first removed row
  59. * @param count
  60. * the number of rows removed from <code>firstRowIndex</code> and
  61. * onwards
  62. */
  63. @NoLayout
  64. public void removeRowData(int firstRowIndex, int count);
  65. /**
  66. * Informs the client to insert new row data.
  67. *
  68. * @param firstRowIndex
  69. * the index of the first new row
  70. * @param count
  71. * the number of rows inserted at <code>firstRowIndex</code>
  72. */
  73. @NoLayout
  74. public void insertRowData(int firstRowIndex, int count);
  75. /**
  76. * Resets all data and defines a new size for the data.
  77. * <p>
  78. * This should be used in the cases where the data has changed in some
  79. * unverifiable way. I.e. "something happened". This will lead to a
  80. * re-rendering of the current Grid viewport
  81. *
  82. * @param size
  83. * the size of the new data set
  84. */
  85. public void resetDataAndSize(int size);
  86. /**
  87. * Informs the client that rows have been updated. The client-side
  88. * DataSource will map the given data to correct index if it should be in
  89. * the cache.
  90. *
  91. * @since 7.6
  92. * @param rowArray
  93. * array of updated rows
  94. */
  95. @NoLayout
  96. public void updateRowData(JsonArray rowArray);
  97. }