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.

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