BrightSide Workbench Full Report + Source Code
org.turro.jpa.grid.RendererOnDemand< T, ID > Class Template Referenceabstract
Inheritance diagram for org.turro.jpa.grid.RendererOnDemand< T, ID >:
Collaboration diagram for org.turro.jpa.grid.RendererOnDemand< T, ID >:

Public Member Functions

 RendererOnDemand (Supplier< Dao > onDao)
 
void render (Row row, Object data, int index) throws Exception
 

Protected Member Functions

Object getId (ID id)
 
void renderGroup (Group group, T value)
 
abstract void renderRow (Row row, T value)
 
Dao getDao ()
 

Detailed Description

Author
Lluis TurrĂ³ Cutiller lluis.nosp@m.@tur.nosp@m.ro.or.nosp@m.g
Parameters
<T>
<ID>

Definition at line 33 of file grid/RendererOnDemand.java.

Constructor & Destructor Documentation

◆ RendererOnDemand()

org.turro.jpa.grid.RendererOnDemand< T, ID >.RendererOnDemand ( Supplier< Dao onDao)

Definition at line 39 of file grid/RendererOnDemand.java.

39  {
40  entityClass = (Class<T>) ((ParameterizedType) getClass().getGenericSuperclass()).getActualTypeArguments()[0];
41  idClass = (Class<ID>) ((ParameterizedType) getClass().getGenericSuperclass()).getActualTypeArguments()[1];
42  this.onDao = onDao;
43  }

Member Function Documentation

◆ getDao()

Dao org.turro.jpa.grid.RendererOnDemand< T, ID >.getDao ( )
protected

Definition at line 76 of file grid/RendererOnDemand.java.

76  {
77  if(dao == null) {
78  dao = onDao.get();
79  }
80  return dao;
81  }
Here is the caller graph for this function:

◆ getId()

Object org.turro.jpa.grid.RendererOnDemand< T, ID >.getId ( ID  id)
protected

Definition at line 62 of file grid/RendererOnDemand.java.

62  {
63  return id;
64  }
Here is the caller graph for this function:

◆ render()

void org.turro.jpa.grid.RendererOnDemand< T, ID >.render ( Row  row,
Object  data,
int  index 
) throws Exception

Definition at line 46 of file grid/RendererOnDemand.java.

46  {
47  T obj = null;
48  if(data.getClass().isAssignableFrom(idClass)) {
49  obj = getDao().find(entityClass, getId((ID) data));
50  } else if(data.getClass().isAssignableFrom(entityClass)) {
51  obj = (T) data;
52  }
53  if(obj != null) {
54  if(row instanceof Group) {
55  renderGroup((Group) row, obj);
56  } else {
57  renderRow(row, obj);
58  }
59  }
60  }
abstract void renderRow(Row row, T value)
Here is the call graph for this function:

◆ renderGroup()

void org.turro.jpa.grid.RendererOnDemand< T, ID >.renderGroup ( Group  group,
value 
)
protected

Definition at line 66 of file grid/RendererOnDemand.java.

66  {
67  // nothing to do
68  }
Here is the caller graph for this function:

◆ renderRow()

abstract void org.turro.jpa.grid.RendererOnDemand< T, ID >.renderRow ( Row  row,
value 
)
abstractprotected
Here is the caller graph for this function:

The documentation for this class was generated from the following file: