public void renderCellContent(Object value, HtmlWriter out, HtmlPage contextPage) { Long millis = (Long) value; if (millis <= 0) { out.write("-"); return; } Date date = new Date(millis); synchronized (dateFormat) { out.write(dateFormat.format(date)); } }
public void renderCellContent(Object value, HtmlWriter out, HtmlPage contextPage) { Integer millis = (Integer) value; int minutes = millis.intValue() / 1000 / 60; int hours = minutes / 60; minutes = minutes - hours * 60; if (hours > 0) { out.write(hours + " h "); } if (minutes > 0) { out.write(minutes + " min"); } }
private void formatValue( String propertyName, Object value, HtmlWriter out, HtmlPage contextPage) { // TODO implement custom formatting for columns if (value == null) { out.write("n/a"); return; } try { CellRenderer renderer = this.propertyCellRendererMap.get(propertyName); if (renderer == null) { renderer = DEFAULT_RENDERER; } renderer.renderCellContent(value, out, contextPage); } catch (Exception e) { out.write("n/a"); out.writeStacktrace(e, true); } }
public void renderCellContent(Object value, HtmlWriter out, HtmlPage contextPage) { out.write(value.toString()); }
public void renderCellContent(Object value, HtmlWriter out, HtmlPage contextPage) { String ssk = (String) value; String croppedSSK = ssk.substring(0, 15) + "..." + ssk.substring(ssk.length() - 15); out.writeLink("/" + ssk, croppedSSK, "View the content of this slot as xml"); }
public void renderCellContent(Object value, HtmlWriter out, HtmlPage contextPage) { String ssk = (String) value; String croppedSSK = ssk.substring(0, 15) + "..." + ssk.substring(ssk.length() - 15); out.writeTooltipItem(ssk, croppedSSK, "ssk"); }
public void renderHtml(HtmlWriter out, HtmlPage contextPage) { if (this.dataProvider != null) { synchronized (this.beanList) { this.beanList.clear(); Object[] newValues = this.dataProvider.getRows(); for (Object o : newValues) { this.beanList.add(o); } } } out.append("<table><thead>"); for (Iterator propertyNameIterator = this.propertyNameList.iterator(); propertyNameIterator.hasNext(); ) { String propertyName = (String) propertyNameIterator.next(); out.append("<th>" + this.getColumnHeader(propertyName) + "</th>"); } out.append("</tr></thead><tbody>"); for (Iterator objectIterator = this.beanList.iterator(); objectIterator.hasNext(); ) { out.append("<tr>"); Object nextBean = (Object) objectIterator.next(); try { Map getMethodMap = this.findAvailableGetters(nextBean); for (Iterator propertyNameIterator = this.propertyNameList.iterator(); propertyNameIterator.hasNext(); ) { String propertyName = (String) propertyNameIterator.next(); out.append("<td>"); try { Method getter = (Method) getMethodMap.get(propertyName); if (getter == null) { String msg = "Bean of " + nextBean + " does not have a property named " + propertyName; throw new RuntimeException(msg); } Object value = getter.invoke(nextBean, (Object[]) new String[0]); this.formatValue(propertyName, value, out, contextPage); } catch (Exception e) { out.append("<span class=\"error\">n/a</span>"); out.writeStacktrace(e, true); } out.append("</td>"); } } catch (Exception e) { out.append("<td colspan=\"" + propertyNameList.size() + "\">"); out.append("<span class=\"error\">n/a</span>"); out.writeStacktrace(e, true); out.append("</td>"); } out.append("</tr>"); } out.append("</tbody></table>"); }