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.

Collapsible.java 3.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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.v7.data;
  17. import com.vaadin.v7.data.Container.Hierarchical;
  18. import com.vaadin.v7.data.Container.Ordered;
  19. /**
  20. * Container needed by large lazy loading hierarchies displayed e.g. in
  21. * TreeTable.
  22. * <p>
  23. * Container of this type gets notified when a subtree is opened/closed in a
  24. * component displaying its content. This allows container to lazy load subtrees
  25. * and release memory when a sub-tree is no longer displayed.
  26. * <p>
  27. * Methods from {@link Container.Ordered} (and from {@linkContainer.Indexed} if
  28. * implemented) are expected to work as in "preorder" of the currently visible
  29. * hierarchy. This means for example that the return value of size method
  30. * changes when subtree is collapsed/expanded. In other words items in collapsed
  31. * sub trees should be "ignored" by container when the container is accessed
  32. * with methods introduced in {@link Container.Ordered} or
  33. * {@linkContainer.Indexed}. From the accessors point of view, items in
  34. * collapsed subtrees don't exist.
  35. * <p>
  36. *
  37. * @deprecated Use {@code TreeGrid.addExpandListener()} and
  38. * {@code TreeGrid.addCollapseListener()}.
  39. */
  40. @Deprecated
  41. public interface Collapsible extends Hierarchical, Ordered {
  42. /**
  43. * <p>
  44. * Collapsing the {@link Item} indicated by <code>itemId</code> hides all
  45. * children, and their respective children, from the {@link Container}.
  46. * </p>
  47. *
  48. * <p>
  49. * If called on a leaf {@link Item}, this method does nothing.
  50. * </p>
  51. *
  52. * @param itemId
  53. * the identifier of the collapsed {@link Item}
  54. * @param collapsed
  55. * <code>true</code> if you want to collapse the children below
  56. * this {@link Item}. <code>false</code> if you want to
  57. * uncollapse the children.
  58. */
  59. public void setCollapsed(Object itemId, boolean collapsed);
  60. /**
  61. * <p>
  62. * Checks whether the {@link Item}, identified by <code>itemId</code> is
  63. * collapsed or not.
  64. * </p>
  65. *
  66. * <p>
  67. * If an {@link Item} is "collapsed" its children are not included in
  68. * methods used to list Items in this container.
  69. * </p>
  70. *
  71. * @param itemId
  72. * The {@link Item}'s identifier that is to be checked.
  73. * @return <code>true</code> if the {@link Item} identified by
  74. * <code>itemId</code> is currently collapsed, otherwise
  75. * <code>false</code>.
  76. */
  77. public boolean isCollapsed(Object itemId);
  78. }