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.

ComboBoxState.java 3.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. /*
  2. * Copyright 2000-2018 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.combobox;
  17. import com.vaadin.shared.annotations.DelegateToWidget;
  18. import com.vaadin.shared.annotations.NoLayout;
  19. import com.vaadin.shared.ui.AbstractSingleSelectState;
  20. /**
  21. * Shared state for the ComboBox component.
  22. *
  23. * @since 7.0
  24. */
  25. public class ComboBoxState extends AbstractSingleSelectState {
  26. {
  27. // TODO ideally this would be v-combobox, but that would affect a lot of
  28. // themes
  29. primaryStyleName = "v-filterselect";
  30. }
  31. /**
  32. * If text input is not allowed, the ComboBox behaves like a pretty
  33. * NativeSelect - the user can not enter any text and clicking the text
  34. * field opens the drop down with options.
  35. *
  36. * @since 8.0
  37. */
  38. @DelegateToWidget
  39. public boolean textInputAllowed = true;
  40. /**
  41. * The prompt to display in an empty field. Null when disabled.
  42. */
  43. @DelegateToWidget
  44. @NoLayout
  45. public String placeholder = null;
  46. /**
  47. * Number of items to show per page or 0 to disable paging.
  48. */
  49. @DelegateToWidget
  50. public int pageLength = 10;
  51. /**
  52. * Suggestion pop-up's width as a CSS string. By using relative units (e.g.
  53. * "50%") it's possible to set the popup's width relative to the ComboBox
  54. * itself.
  55. */
  56. @DelegateToWidget
  57. public String suggestionPopupWidth = "100%";
  58. /**
  59. * True to allow the user to send new items to the server, false to only
  60. * select among existing items.
  61. */
  62. @DelegateToWidget
  63. public boolean allowNewItems = false;
  64. /**
  65. * True to allow selecting nothing (a special empty selection item is shown
  66. * at the beginning of the list), false not to allow empty selection by the
  67. * user.
  68. */
  69. public boolean emptySelectionAllowed = true;
  70. /**
  71. * True to automatically scroll the ComboBox to show the selected item,
  72. * false not to search for it in the results.
  73. */
  74. public boolean scrollToSelectedItem = false;
  75. /**
  76. * The caption of the currently selected item or {@code null} if no item is
  77. * selected.
  78. */
  79. public String selectedItemCaption;
  80. /**
  81. * Caption for item which represents empty selection.
  82. */
  83. public String emptySelectionCaption = "";
  84. /**
  85. * Selected item icon uri.
  86. *
  87. * @since 8.0
  88. */
  89. public String selectedItemIcon;
  90. /**
  91. * Filter string that is currently in use in the suggestion listing.
  92. *
  93. * @since 8.3.2
  94. */
  95. public String currentFilterText;
  96. /**
  97. * Ensure the data source is updated when backing dataprovider has been
  98. * refreshed.
  99. *
  100. * @since
  101. */
  102. public boolean forceDataSourceUpdate;
  103. }