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.

GridState.java 4.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  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.shared.ui.grid;
  17. import java.util.ArrayList;
  18. import java.util.List;
  19. import com.vaadin.shared.annotations.DelegateToWidget;
  20. import com.vaadin.shared.data.sort.SortDirection;
  21. import com.vaadin.shared.ui.AbstractSingleSelectState;
  22. /**
  23. * The shared state for the {@link com.vaadin.ui.Grid} component.
  24. *
  25. * @since 8.0
  26. * @author Vaadin Ltd
  27. */
  28. public class GridState extends AbstractSingleSelectState {
  29. /**
  30. * The default value for height-by-rows for both GWT widgets
  31. * {@link com.vaadin.client.widgets.Grid} and
  32. * {@link com.vaadin.client.widgets.Escalator Escalator}.
  33. */
  34. public static final double DEFAULT_HEIGHT_BY_ROWS = 10.0d;
  35. /**
  36. * The key in which a row's data can be found.
  37. *
  38. * @see com.vaadin.shared.data.DataProviderRpc#setRowData(int, String)
  39. */
  40. public static final String JSONKEY_DATA = "d";
  41. /**
  42. * The key in which a row's own key can be found.
  43. *
  44. * @see com.vaadin.shared.data.DataProviderRpc#setRowData(int, String)
  45. */
  46. public static final String JSONKEY_ROWKEY = "k";
  47. /**
  48. * The key in which a row's generated style can be found.
  49. *
  50. * @see com.vaadin.shared.data.DataProviderRpc#setRowData(int, String)
  51. */
  52. public static final String JSONKEY_ROWSTYLE = "rs";
  53. /**
  54. * The key in which a generated styles for a row's cells can be found.
  55. *
  56. * @see com.vaadin.shared.data.DataProviderRpc#setRowData(int, String)
  57. */
  58. public static final String JSONKEY_CELLSTYLES = "cs";
  59. /**
  60. * The key in which a row's description can be found.
  61. *
  62. * @see com.vaadin.shared.data.DataProviderRpc#setRowData(int, String)
  63. */
  64. public static final String JSONKEY_ROWDESCRIPTION = "rd";
  65. /**
  66. * The key in which a cell's description can be found.
  67. *
  68. * @see com.vaadin.shared.data.DataProviderRpc#setRowData(int, String)
  69. */
  70. public static final String JSONKEY_CELLDESCRIPTION = "cd";
  71. /**
  72. * The key that tells whether details are visible for the row.
  73. *
  74. * @see com.vaadin.ui.Grid#setDetailsGenerator(com.vaadin.ui.Grid.DetailsGenerator)
  75. * @see com.vaadin.ui.Grid#setDetailsVisible(Object, boolean)
  76. * @see com.vaadin.shared.data.DataProviderRpc#setRowData(int,
  77. * elemental.json.JsonArray)
  78. */
  79. public static final String JSONKEY_DETAILS_VISIBLE = "dv";
  80. /**
  81. * The key that tells whether row is selected or not.
  82. */
  83. public static final String JSONKEY_SELECTED = "s";
  84. {
  85. primaryStyleName = "v-grid";
  86. }
  87. /**
  88. * Column resize mode in grid.
  89. */
  90. public ColumnResizeMode columnResizeMode = ColumnResizeMode.ANIMATED;
  91. /** The state of the header section. */
  92. public SectionState header = new SectionState();
  93. /** The state of the footer section. */
  94. public SectionState footer = new SectionState();
  95. /**
  96. * Column order in grid.
  97. */
  98. public List<String> columnOrder = new ArrayList<>();
  99. /** The number of frozen columns. */
  100. @DelegateToWidget
  101. public int frozenColumnCount = 0;
  102. /** The height of the Grid in terms of body rows. */
  103. @DelegateToWidget
  104. public double heightByRows = DEFAULT_HEIGHT_BY_ROWS;
  105. /** The mode by which Grid defines its height. */
  106. @DelegateToWidget
  107. public HeightMode heightMode = HeightMode.CSS;
  108. /** Keys of the currently sorted columns. */
  109. public String[] sortColumns = new String[0];
  110. /** Directions for each sorted column. */
  111. public SortDirection[] sortDirs = new SortDirection[0];
  112. /**
  113. * Whether rows and/or cells have generated descriptions (tooltips).
  114. */
  115. public boolean hasDescriptions;
  116. /** Whether the columns can be reordered. */
  117. @DelegateToWidget
  118. public boolean columnReorderingAllowed;
  119. }