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.5KB

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