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.

AbstractRowHandleSelectionModel.java 2.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /*
  2. * Copyright 2000-2021 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.grid.selection;
  17. import com.vaadin.client.data.DataSource.RowHandle;
  18. /**
  19. * An abstract class that adds a consistent API for common methods that's needed
  20. * by Vaadin's server-based selection models to work.
  21. * <p>
  22. * <em>Note:</em> This should be an interface instead of an abstract class, if
  23. * only we could define protected methods in an interface.
  24. *
  25. * @author Vaadin Ltd
  26. * @param <T>
  27. * The grid's row type
  28. * @since 7.4
  29. */
  30. public abstract class AbstractRowHandleSelectionModel<T>
  31. implements SelectionModel<T> {
  32. /**
  33. * Select a row, based on its
  34. * {@link com.vaadin.client.data.DataSource.RowHandle RowHandle}.
  35. * <p>
  36. * <em>Note:</em> this method may not fire selection change events.
  37. *
  38. * @param handle
  39. * the handle to select by
  40. * @return <code>true</code> if the selection state was changed by this call
  41. * @throws UnsupportedOperationException
  42. * if the selection model does not support either handles or
  43. * selection
  44. */
  45. protected abstract boolean selectByHandle(RowHandle<T> handle);
  46. /**
  47. * Deselect a row, based on its
  48. * {@link com.vaadin.client.data.DataSource.RowHandle RowHandle}.
  49. * <p>
  50. * <em>Note:</em> this method may not fire selection change events.
  51. *
  52. * @param handle
  53. * the handle to deselect by
  54. * @return <code>true</code> if the selection state was changed by this call
  55. * @throws UnsupportedOperationException
  56. * if the selection model does not support either handles or
  57. * deselection
  58. */
  59. protected abstract boolean deselectByHandle(RowHandle<T> handle)
  60. throws UnsupportedOperationException;
  61. }