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.

HierarchicalContainerOrderedWrapper.java 2.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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.data.util;
  17. import java.util.Collection;
  18. import com.vaadin.data.Container.Hierarchical;
  19. /**
  20. * A wrapper class for adding external ordering to containers not implementing
  21. * the {@link com.vaadin.data.Container.Ordered} interface while retaining
  22. * {@link Hierarchical} features.
  23. *
  24. * @see ContainerOrderedWrapper
  25. */
  26. @SuppressWarnings({ "serial" })
  27. public class HierarchicalContainerOrderedWrapper extends
  28. ContainerOrderedWrapper implements Hierarchical {
  29. private Hierarchical hierarchical;
  30. public HierarchicalContainerOrderedWrapper(Hierarchical toBeWrapped) {
  31. super(toBeWrapped);
  32. hierarchical = toBeWrapped;
  33. }
  34. @Override
  35. public boolean areChildrenAllowed(Object itemId) {
  36. return hierarchical.areChildrenAllowed(itemId);
  37. }
  38. @Override
  39. public Collection<?> getChildren(Object itemId) {
  40. return hierarchical.getChildren(itemId);
  41. }
  42. @Override
  43. public Object getParent(Object itemId) {
  44. return hierarchical.getParent(itemId);
  45. }
  46. @Override
  47. public boolean hasChildren(Object itemId) {
  48. return hierarchical.hasChildren(itemId);
  49. }
  50. @Override
  51. public boolean isRoot(Object itemId) {
  52. return hierarchical.isRoot(itemId);
  53. }
  54. @Override
  55. public Collection<?> rootItemIds() {
  56. return hierarchical.rootItemIds();
  57. }
  58. @Override
  59. public boolean setChildrenAllowed(Object itemId, boolean areChildrenAllowed)
  60. throws UnsupportedOperationException {
  61. return hierarchical.setChildrenAllowed(itemId, areChildrenAllowed);
  62. }
  63. @Override
  64. public boolean setParent(Object itemId, Object newParentId)
  65. throws UnsupportedOperationException {
  66. return hierarchical.setParent(itemId, newParentId);
  67. }
  68. }