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.

Renderer.java 1.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /*
  2. * Copyright 2000-2018 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.renderers;
  17. import com.vaadin.client.widget.escalator.Cell;
  18. import com.vaadin.client.widget.grid.RendererCellReference;
  19. import com.vaadin.client.widgets.Grid;
  20. /**
  21. * Renderer for rending a value <T> into cell.
  22. * <p>
  23. * You can add a renderer to any column by overring the
  24. * {@link GridColumn#getRenderer()} method and returning your own renderer. You
  25. * can retrieve the cell element using {@link Cell#getElement()}.
  26. *
  27. * @param <T>
  28. * The column type
  29. *
  30. * @since 7.4
  31. * @author Vaadin Ltd
  32. */
  33. public interface Renderer<T> {
  34. /**
  35. * Called whenever the {@link Grid} updates a cell.
  36. * <p>
  37. * For optimal performance, work done in this method should be kept to a
  38. * minimum since it will be called continuously while the user is scrolling.
  39. * It is recommended to set up the cell's DOM structure in
  40. * {@link ComplexRenderer#init(RendererCellReference)} and only make
  41. * incremental updates based on cell data in this method.
  42. *
  43. * @param cell
  44. * The cell. Note that the cell is a flyweight and should not be
  45. * stored outside of the method as it will change.
  46. *
  47. * @param data
  48. * The column data object
  49. */
  50. void render(RendererCellReference cell, T data);
  51. }