public Cell createCell(Row row, Object value) { Cell cell = new Cell(value == null ? null : value.toString()); row.addChild(cell); return cell; } }
/** * Adds a cell to the grid row. * * @param row List row. * @param label Label text for cell. * @return Newly created cell. */ public Cell addCell(Row row, String label) { Cell cell = new Cell(label); row.addChild(cell); return cell; }
private void createCell(Row row, Object data) { Cell cell = new Cell(); cell.setLabel(data == null ? null : data.toString()); row.addChild(cell); } }
/** * Add a cell to the row. * * @param row Grid row to receive new cell; * @param label Text label for the cell. * @param max Maximum # of allowable cells. * @return True if a cell was added. */ private boolean addCell(Row row, String label, int max) { if (max == 0 || row.getChildCount() < max) { row.addChild(new Cell(label)); return true; } return false; } }
/** * Returns a component of a type suitable for displaying the specified text. For text that is a * URL, returns a hyperlink. For text that begins with <html>, returns an HTML component. * All other text returns a label. * * @param text Text to be displayed. * @return BaseComponent of the appropriate type. */ public static BaseComponent getTextComponent(String text) { String frag = text == null ? "" : StringUtils.substring(text, 0, 20).toLowerCase(); if (frag.contains("<html>")) { return new Html(text); } if (frag.matches("^https?:\\/\\/.+$")) { Hyperlink link = new Hyperlink(); link.setHref(text); link.setTarget("_blank"); return link; } return new Cell(text); }
/** * Convenience method for displaying a simple text message. * * @param message Message to display * @param title Caption for message. * @param clazz CSS classes to apply. * @param duration Message duration in milliseconds. * @param category Tag to classify message. * @param actionListener Optional listener for action invocation. * @return The newly created message pane. */ public MessagePane showMessage(String message, String title, String clazz, int duration, String category, IEventListener actionListener) { MessagePane pane = new MessagePane(title, category, duration, actionListener != null); pane.addClass(clazz); pane.addChild(new Cell(message)); if (actionListener != null) { pane.addEventListener("action", actionListener); } addChild(pane); return pane; }
/** * Renders the list box contents. * * @param qr The search hit to render. */ @Override public Listitem render(HelpSearchHit qr) { Listitem item = new Listitem(); double score = qr.getConfidence(); item.setData(qr.getTopic()); Cell lc = new Cell(); lc.addChild(toImage(score)); String tt = StrUtil.formatMessage("@cwf.help.tab.search.score", score); lc.setHint(tt); item.addChild(lc); lc = new Cell(qr.getTopic().getLabel()); item.addChild(lc); lc = new Cell(qr.getTopic().getSource()); item.addChild(lc); return item; }