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.

SubPartAware.java 2.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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.client.ui;
  17. import com.google.gwt.user.client.ui.Widget;
  18. /**
  19. * Interface implemented by {@link Widget}s which can provide identifiers for at
  20. * least one element inside the component.
  21. *
  22. */
  23. public interface SubPartAware {
  24. /**
  25. * Locates an element inside a component using the identifier provided in
  26. * {@code subPart}. The {@code subPart} identifier is component specific and
  27. * may be any string of characters, numbers, space characters and brackets.
  28. *
  29. * @param subPart
  30. * The identifier for the element inside the component
  31. * @return The element identified by subPart or null if the element could
  32. * not be found.
  33. */
  34. com.google.gwt.user.client.Element getSubPartElement(String subPart);
  35. /**
  36. * Provides an identifier that identifies the element within the component.
  37. * The {@code subElement} is a part of the component and must never be null.
  38. * <p>
  39. * <b>Note!</b>
  40. * {@code getSubPartElement(getSubPartName(element)) == element} is <i>not
  41. * always</i> true. A component can choose to provide a more generic
  42. * identifier for any given element if the results of all interactions with
  43. * {@code subElement} are the same as interactions with the element
  44. * identified by the return value. For example a button can return an
  45. * identifier for the root element even though a DIV inside the button was
  46. * passed as {@code subElement} because interactions with the DIV and the
  47. * root button element produce the same result.
  48. *
  49. * @param subElement
  50. * The element the identifier string should uniquely identify
  51. * @return An identifier that uniquely identifies {@code subElement} or null
  52. * if no identifier could be provided.
  53. */
  54. String getSubPartName(com.google.gwt.user.client.Element subElement);
  55. }