/zul/src/org/zkoss/zul/ItemRenderer.java

http://github.com/zkoss/zk · Java · 40 lines · 5 code · 3 blank · 32 comment · 0 complexity · 2a7d3e45a3f6a1a6ab2c17a6ddb183fd MD5 · raw file

  1. /* ItemRenderer.java
  2. Purpose:
  3. Description:
  4. History:
  5. Fri Sep 30 10:53:25 TST 2011, Created by jumperchen
  6. Copyright (C) 2011 Potix Corporation. All Rights Reserved.
  7. {{IS_RIGHT
  8. This program is distributed under LGPL Version 3.0 in the hope that
  9. it will be useful, but WITHOUT ANY WARRANTY.
  10. }}IS_RIGHT
  11. */
  12. package org.zkoss.zul;
  13. import org.zkoss.zk.ui.Component;
  14. /**
  15. * Used to generated the HTML fragment for the data associated
  16. * with a component, such as {@link Selectbox}.
  17. *
  18. * @author jumperchen
  19. * @since 6.0.0
  20. */
  21. public interface ItemRenderer<T> {
  22. /** Renders the data to the corresponding HTML fragment, and returns
  23. * the HTML fragment.
  24. *
  25. * @param owner the component that this renderer belongs to (never null).
  26. * @param data that is returned from {@link ListModel#getElementAt}
  27. * @param index the data index that is currently being rendered
  28. * @return the HTML fragment representing the data. It depends
  29. * on the component this renderer belongs to.
  30. */
  31. public String render(Component owner, T data, int index) throws Exception;
  32. }