BrightSide Workbench Full Report + Source Code
org.turro.collections.CollectionHtmlIterator< E, ID > Class Template Referenceabstract
Inheritance diagram for org.turro.collections.CollectionHtmlIterator< E, ID >:
Collaboration diagram for org.turro.collections.CollectionHtmlIterator< E, ID >:

Public Member Functions

 CollectionHtmlIterator (List collection, ElephantMarker marker)
 
 CollectionHtmlIterator (List collection, ElephantMarker marker, Writer writer)
 
void setSummaryTemplate (String summaryTemplate)
 
String getSummaryTemplate ()
 
void setFullTemplate (String fullTemplate)
 
String getFullTemplate ()
 
boolean isNavigatorTop ()
 
void setNavigatorTop (boolean navigatorTop)
 
boolean isNavigatorBottom ()
 
void setNavigatorBottom (boolean navigatorBottom)
 
boolean isSearchOption ()
 
void setSearchOption (boolean searchOption)
 
boolean isForceSummary ()
 
void setForceSummary (boolean forceSummary)
 
boolean wantItem ()
 
boolean isItem ()
 
Object addAttribute (String key, Object value)
 
Writer getWriter ()
 
void load ()
 
void forceItem (ID item)
 
String getTitle ()
 
Collection< String > getMetas ()
 
void render ()
 
boolean isFirst ()
 
boolean isLast ()
 
String renderSearchEngine ()
 
String renderTree ()
 
String renderTreeSelection ()
 
boolean isEmpty ()
 
- Public Member Functions inherited from org.turro.collections.CollectionIterator< E, ID >
 CollectionIterator (List< E > collection)
 
int getPage ()
 
void setPage (int page)
 
void initClauses ()
 
List< E > getItems ()
 
int getTotalCount ()
 
List< E > getTotalItems ()
 
int item ()
 
void current (int value)
 
int current ()
 
int pages ()
 
boolean beginning ()
 
boolean end ()
 
void next ()
 
void previous ()
 

Protected Member Functions

abstract E entity (ID value)
 
abstract void renderSummary (ElephantMarker marker, E e, int page)
 
abstract void renderItem (ElephantMarker marker, E e, int page)
 
abstract String title (E e)
 
abstract Collection< String > metas (E e)
 
ID getIdentifier ()
 
void onRenderItem (E e)
 
boolean isValid (E e)
 
ID parseId (String value)
 
String stringId (ID value)
 

Protected Attributes

HTMLHelper html
 
IConstructor constructor
 
ElephantMarker marker
 
- Protected Attributes inherited from org.turro.collections.CollectionIterator< E, ID >
List< E > items
 
int _total = -1
 

Additional Inherited Members

- Static Public Attributes inherited from org.turro.action.content.IContentIterator
static String PRELOAD_TMPL = "#preload"
 

Detailed Description

Author
Lluis TurrĂ³ Cutiller lluis.nosp@m.@tur.nosp@m.ro.or.nosp@m.g

Definition at line 43 of file CollectionHtmlIterator.java.

Constructor & Destructor Documentation

◆ CollectionHtmlIterator() [1/2]

Definition at line 61 of file CollectionHtmlIterator.java.

61  {
62  this(collection, marker, null);
63  }

◆ CollectionHtmlIterator() [2/2]

org.turro.collections.CollectionHtmlIterator< E, ID >.CollectionHtmlIterator ( List  collection,
ElephantMarker  marker,
Writer  writer 
)

Definition at line 65 of file CollectionHtmlIterator.java.

65  {
66  super(collection);
67  this.marker = marker;
69  this.writer = writer;
70  this.idClass = (Class<ID>) ((ParameterizedType) getClass()
71  .getGenericSuperclass()).getActualTypeArguments()[1];
72  markerAttributes = new HashMap<>();
73  }
Here is the call graph for this function:

Member Function Documentation

◆ addAttribute()

Object org.turro.collections.CollectionHtmlIterator< E, ID >.addAttribute ( String  key,
Object  value 
)

Implements org.turro.action.content.IContentIterator.

Definition at line 148 of file CollectionHtmlIterator.java.

148  {
149  return markerAttributes.put(key, value);
150  }

◆ entity()

abstract E org.turro.collections.CollectionHtmlIterator< E, ID >.entity ( ID  value)
abstractprotected

◆ forceItem()

void org.turro.collections.CollectionHtmlIterator< E, ID >.forceItem ( ID  item)

Definition at line 170 of file CollectionHtmlIterator.java.

170  {
171  this.item = item;
172  if(item != null) {
173  entity = entity(item);
174  }
175  }

◆ getFullTemplate()

String org.turro.collections.CollectionHtmlIterator< E, ID >.getFullTemplate ( )

Definition at line 87 of file CollectionHtmlIterator.java.

87  {
88  return Strings.isBlank(fullTemplate) ? "full" : fullTemplate;
89  }
Here is the caller graph for this function:

◆ getIdentifier()

ID org.turro.collections.CollectionHtmlIterator< E, ID >.getIdentifier ( )
protected

Definition at line 271 of file CollectionHtmlIterator.java.

271  {
272  if(constructor.isHeadless() || forceSummary) {
273  return null;
274  }
275  KeyValueMap kvm = MarkerHelper.getObfuscatedParameters();
276  if(kvm != null && !kvm.isEmpty() && kvm.containsKey("item")) {
277  return parseId(kvm.get("item"));
278  }
279  return parseId(constructor.getParameter("item"));
280  //return constructor.isHeadless() ? null : (ID) ObjectString.parseString(constructor.getParameter("item"), idClass, false);
281  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getMetas()

Collection<String> org.turro.collections.CollectionHtmlIterator< E, ID >.getMetas ( )

Definition at line 181 of file CollectionHtmlIterator.java.

181  {
182  return entity != null ? metas(entity) : null;
183  }
abstract Collection< String > metas(E e)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getSummaryTemplate()

String org.turro.collections.CollectionHtmlIterator< E, ID >.getSummaryTemplate ( )

Definition at line 79 of file CollectionHtmlIterator.java.

79  {
80  return Strings.isBlank(summaryTemplate) ? "summary" : summaryTemplate;
81  }
Here is the caller graph for this function:

◆ getTitle()

String org.turro.collections.CollectionHtmlIterator< E, ID >.getTitle ( )

Definition at line 177 of file CollectionHtmlIterator.java.

177  {
178  return entity != null ? title(entity) : null;
179  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getWriter()

Writer org.turro.collections.CollectionHtmlIterator< E, ID >.getWriter ( )

Implements org.turro.action.content.IContentIterator.

Definition at line 153 of file CollectionHtmlIterator.java.

153  {
154  try {
155  return writer != null ? writer : constructor.getOut();
156  } catch (IOException ex) {
157  Logger.getLogger(CollectionHtmlIterator.class.getName()).log(Level.SEVERE, ElephantContext.logMsg(null), ex);
158  }
159  return null;
160  }
CollectionHtmlIterator(List collection, ElephantMarker marker)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ isEmpty()

boolean org.turro.collections.CollectionHtmlIterator< E, ID >.isEmpty ( )

Implements org.turro.action.content.IContentIterator.

Definition at line 261 of file CollectionHtmlIterator.java.

261  {
262  return getTotalCount() < 1;
263  }
Here is the call graph for this function:

◆ isFirst()

boolean org.turro.collections.CollectionHtmlIterator< E, ID >.isFirst ( )

Definition at line 240 of file CollectionHtmlIterator.java.

240  {
241  return currentIndex == 0;
242  }
Here is the caller graph for this function:

◆ isForceSummary()

boolean org.turro.collections.CollectionHtmlIterator< E, ID >.isForceSummary ( )

Definition at line 131 of file CollectionHtmlIterator.java.

131  {
132  return forceSummary;
133  }

◆ isItem()

boolean org.turro.collections.CollectionHtmlIterator< E, ID >.isItem ( )

Definition at line 143 of file CollectionHtmlIterator.java.

143  {
144  return entity != null;
145  }
Here is the caller graph for this function:

◆ isLast()

boolean org.turro.collections.CollectionHtmlIterator< E, ID >.isLast ( )

Definition at line 244 of file CollectionHtmlIterator.java.

244  {
245  return currentIndex == currentSize - 1;
246  }
Here is the caller graph for this function:

◆ isNavigatorBottom()

boolean org.turro.collections.CollectionHtmlIterator< E, ID >.isNavigatorBottom ( )

Definition at line 99 of file CollectionHtmlIterator.java.

99  {
100  return navigatorBottom;
101  }

◆ isNavigatorTop()

boolean org.turro.collections.CollectionHtmlIterator< E, ID >.isNavigatorTop ( )

Definition at line 91 of file CollectionHtmlIterator.java.

91  {
92  return navigatorTop;
93  }

◆ isSearchOption()

boolean org.turro.collections.CollectionHtmlIterator< E, ID >.isSearchOption ( )

Definition at line 123 of file CollectionHtmlIterator.java.

123  {
124  return searchOption;
125  }

◆ isValid()

boolean org.turro.collections.CollectionHtmlIterator< E, ID >.isValid ( e)
protected

Definition at line 285 of file CollectionHtmlIterator.java.

285  {
286  return e != null;
287  }
Here is the caller graph for this function:

◆ load()

Implements org.turro.action.content.IContentIterator.

Definition at line 163 of file CollectionHtmlIterator.java.

163  {
164  item = getIdentifier();
165  if(item != null) {
166  entity = entity(item);
167  }
168  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ metas()

abstract Collection<String> org.turro.collections.CollectionHtmlIterator< E, ID >.metas ( e)
abstractprotected
Here is the caller graph for this function:

◆ onRenderItem()

void org.turro.collections.CollectionHtmlIterator< E, ID >.onRenderItem ( e)
protected

Definition at line 283 of file CollectionHtmlIterator.java.

283 {}

◆ parseId()

ID org.turro.collections.CollectionHtmlIterator< E, ID >.parseId ( String  value)
protected

Reimplemented in org.turro.alliance.client.ProjectGrantCollectionIterator.

Definition at line 289 of file CollectionHtmlIterator.java.

289  {
290  return (ID) ObjectString.parseString(value, idClass, false);
291  }
Here is the caller graph for this function:

◆ render()

Implements org.turro.action.content.IContentIterator.

Definition at line 186 of file CollectionHtmlIterator.java.

186  {
187  initClauses();
188  marker.putAll(markerAttributes);
189  marker.put("iterator", this);
190  marker.put("navigatorTop", navigatorTop);
191  marker.put("navigatorBottom", navigatorBottom);
192  marker.put("searchOption", searchOption);
193  page = constructor.isHeadless() ? 0 : (Integer) ObjectString.parseString(constructor.getParameter("page"), Integer.class, true);
194  if(entity != null) {
195  if(isValid(entity)) {
196  html = new HTMLHelper(constructor, writer);
197  CollectionNavigator navigator = new CollectionNavigator(this);
198  marker.put("navigator", navigator);
199  marker.put("empty", false);
200  marker.put("divider", false);
201  marker.put("header", true);
202  marker.put("footer", true);
203  marker.put("single", true);
204  renderItem(marker, entity, page);
205  html.endAllTags();
206  }
207  } else {
208  current(page);
209  if(items == null) {
210  return;
211  }
212  html = new HTMLHelper(constructor, writer);
213  CollectionNavigator navigator = new CollectionNavigator(this);
214  marker.put("navigator", navigator);
215  currentIndex = 0;
216  currentSize = items.size();
217  if(currentSize == 0) {
218  marker.put("empty", true);
219  marker.put("divider", false);
220  marker.put("header", true);
221  marker.put("footer", true);
222  marker.put("single", false);
223  renderSummary(marker, null, current());
224  } else {
225  marker.put("empty", false);
226  marker.put("single", false);
227  for(E e : items) {
228  if(isValid(e)) {
229  marker.put("divider", !isFirst());
230  marker.put("header", isFirst());
231  marker.put("footer", isLast());
233  }
234  currentIndex++;
235  }
236  }
237  }
238  }
abstract void renderItem(ElephantMarker marker, E e, int page)
abstract void renderSummary(ElephantMarker marker, E e, int page)
Object put(Object key, Object value)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ renderItem()

abstract void org.turro.collections.CollectionHtmlIterator< E, ID >.renderItem ( ElephantMarker  marker,
e,
int  page 
)
abstractprotected
Here is the caller graph for this function:

◆ renderSearchEngine()

String org.turro.collections.CollectionHtmlIterator< E, ID >.renderSearchEngine ( )

Reimplemented in org.turro.alliance.client.ProjectGrantCollectionIterator.

Definition at line 248 of file CollectionHtmlIterator.java.

248  {
249  return ""; //searchEngine != null ? searchEngine.render(constructor) : "";
250  }

◆ renderSummary()

abstract void org.turro.collections.CollectionHtmlIterator< E, ID >.renderSummary ( ElephantMarker  marker,
e,
int  page 
)
abstractprotected
Here is the caller graph for this function:

◆ renderTree()

String org.turro.collections.CollectionHtmlIterator< E, ID >.renderTree ( )

Definition at line 252 of file CollectionHtmlIterator.java.

252  {
253  return ""; //navigationTree != null ? navigationTree.parse() : "";
254  }

◆ renderTreeSelection()

String org.turro.collections.CollectionHtmlIterator< E, ID >.renderTreeSelection ( )

Definition at line 256 of file CollectionHtmlIterator.java.

256  {
257  return ""; //navigationTree != null ? navigationTree.parseSelected() : "";
258  }

◆ setForceSummary()

void org.turro.collections.CollectionHtmlIterator< E, ID >.setForceSummary ( boolean  forceSummary)

Definition at line 135 of file CollectionHtmlIterator.java.

135  {
136  this.forceSummary = forceSummary;
137  }

◆ setFullTemplate()

void org.turro.collections.CollectionHtmlIterator< E, ID >.setFullTemplate ( String  fullTemplate)

Definition at line 83 of file CollectionHtmlIterator.java.

83  {
84  this.fullTemplate = fullTemplate;
85  }
Here is the caller graph for this function:

◆ setNavigatorBottom()

void org.turro.collections.CollectionHtmlIterator< E, ID >.setNavigatorBottom ( boolean  navigatorBottom)

Definition at line 103 of file CollectionHtmlIterator.java.

103  {
104  this.navigatorBottom = navigatorBottom;
105  }
Here is the caller graph for this function:

◆ setNavigatorTop()

void org.turro.collections.CollectionHtmlIterator< E, ID >.setNavigatorTop ( boolean  navigatorTop)

Definition at line 95 of file CollectionHtmlIterator.java.

95  {
96  this.navigatorTop = navigatorTop;
97  }
Here is the caller graph for this function:

◆ setSearchOption()

void org.turro.collections.CollectionHtmlIterator< E, ID >.setSearchOption ( boolean  searchOption)

Definition at line 127 of file CollectionHtmlIterator.java.

127  {
128  this.searchOption = searchOption;
129  }

◆ setSummaryTemplate()

void org.turro.collections.CollectionHtmlIterator< E, ID >.setSummaryTemplate ( String  summaryTemplate)

Definition at line 75 of file CollectionHtmlIterator.java.

75  {
76  this.summaryTemplate = summaryTemplate;
77  }
Here is the caller graph for this function:

◆ stringId()

String org.turro.collections.CollectionHtmlIterator< E, ID >.stringId ( ID  value)
protected

Definition at line 293 of file CollectionHtmlIterator.java.

293  {
294  return String.valueOf(value);
295  }

◆ title()

abstract String org.turro.collections.CollectionHtmlIterator< E, ID >.title ( e)
abstractprotected
Here is the caller graph for this function:

◆ wantItem()

boolean org.turro.collections.CollectionHtmlIterator< E, ID >.wantItem ( )

Definition at line 139 of file CollectionHtmlIterator.java.

139  {
140  return getIdentifier() != null;
141  }
Here is the call graph for this function:

Member Data Documentation

◆ constructor

Definition at line 46 of file CollectionHtmlIterator.java.

◆ html

Definition at line 45 of file CollectionHtmlIterator.java.

◆ marker

Definition at line 47 of file CollectionHtmlIterator.java.


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