/** * Render the header. * * @param context the context of the header * @param sb a {@link SafeHtmlBuilder} to render into */ public void render(Context context, SafeHtmlBuilder sb) { cell.render(context, getValue(), sb); }
/** * Render the object into the cell. * * @param context the cell context * @param object the object to render * @param sb the buffer to render into */ public void render(Context context, T object, SafeHtmlBuilder sb) { cell.render(context, getValue(object), sb); }
@Override protected void renderRowValues(SafeHtmlBuilder sb, List<T> values, int start, SelectionModel<? super T> selectionModel) { String keyboardSelectedItem = " " + style.cellListKeyboardSelectedItem(); String selectedItem = " " + style.cellListSelectedItem(); String evenItem = style.cellListEvenItem(); String oddItem = style.cellListOddItem(); int keyboardSelectedRow = getKeyboardSelectedRow() + getPageStart(); int length = values.size(); int end = start + length; for (int i = start; i < end; i++) { T value = values.get(i - start); boolean isSelected = selectionModel == null ? false : selectionModel.isSelected(value); StringBuilder classesBuilder = new StringBuilder(); classesBuilder.append(i % 2 == 0 ? evenItem : oddItem); if (isSelected) { classesBuilder.append(selectedItem); } if (i == keyboardSelectedRow) { classesBuilder.append(keyboardSelectedItem); } SafeHtmlBuilder cellBuilder = new SafeHtmlBuilder(); Context context = new Context(i, 0, getValueKey(value)); cell.render(context, value, cellBuilder); sb.append(TEMPLATE.div(i, classesBuilder.toString(), cellBuilder.toSafeHtml())); } }
/** * Render the composite cell as HTML into a {@link SafeHtmlBuilder}, suitable * for passing to {@link Element#setInnerHTML} on a container element. * * <p> * Note: If your cell contains natively focusable elements, such as buttons or * input elements, be sure to set the tabIndex to -1 so that they do not steal * focus away from the containing widget. * </p> * * @param context the {@link com.google.gwt.cell.client.Cell.Context Context} of the cell * @param value the cell value to be rendered * @param sb the {@link SafeHtmlBuilder} to be written to * @param hasCell a {@link HasCell} instance containing the cells to be * rendered within this cell */ protected <X> void render(Context context, C value, SafeHtmlBuilder sb, HasCell<C, X> hasCell) { Cell<X> cell = hasCell.getCell(); sb.appendHtmlConstant("<span>"); cell.render(context, hasCell.getValue(value), sb); sb.appendHtmlConstant("</span>"); }
public void render(Context context, C value, SafeHtmlBuilder sb) { SafeHtmlBuilder cellBuilder = new SafeHtmlBuilder(); cell.render(context, value, cellBuilder); sb.append(template.outerDiv(outerDivPadding, isIconUsed(value) ? getIconHtml(value) : placeHolderHtml, cellBuilder.toSafeHtml())); }
theColumn.render(context, rowValue, cellBuilder); } else { column.getCell().render(context, column.getValue(rowValue), cellBuilder);
@Override public void render(Cell.Context context, C value, SafeHtmlBuilder sb) { delegate.render(context, value, sb); }
cell.render(context, value, cellBuilder);
/** * Redraw the widget. */ public void redraw() { SafeHtmlBuilder sb = new SafeHtmlBuilder(); cell.render(createContext(), value, sb); getElement().setInnerSafeHtml(sb.toSafeHtml()); /* * The rendered Cell should fill the root element so height and width styles * applied to the widget also apply to the Cell. If there is exactly one * child element, the height and width are set to 100% to fill the parent. */ Element child = getElement().getFirstChildElement(); if (child != null && child.getNextSiblingElement() == null) { child.getStyle().setHeight(100, Unit.PCT); child.getStyle().setWidth(100, Unit.PCT); } }
/** * Render the object into the cell. * * @param context the cell context * @param object the object to render * @param sb the buffer to render into */ public void render(Context context, T object, SafeHtmlBuilder sb) { cell.render(context, getValue(object), sb); }
/** * Render the header. * * @param context the context of the header * @param sb a {@link SafeHtmlBuilder} to render into */ public void render(Context context, SafeHtmlBuilder sb) { cell.render(context, getValue(), sb); }
/** * Render the object into the cell. * * @param object the object to render * @param sb the buffer to render into */ public void render(Context context, T object, SafeHtmlBuilder sb) { cell.render(context, getValue(object), sb); }
/** * Render the header. * * @param context the context of the header * @param sb a {@link SafeHtmlBuilder} to render into */ public void render(Context context, SafeHtmlBuilder sb) { cell.render(context, getValue(), sb); }
/** * Render the object into the cell. * * @param context the cell context * @param object the object to render * @param sb the buffer to render into */ public void render(Context context, T object, SafeHtmlBuilder sb) { cell.render(context, getValue(object), sb); }
/** * Render the object into the cell. * * @param object the object to render * @param sb the buffer to render into */ public void render(Context context, T object, SafeHtmlBuilder sb) { cell.render(context, getValue(object), sb); }
public void render(Context context, C value, SafeHtmlBuilder sb) { SafeHtmlBuilder cellBuilder = new SafeHtmlBuilder(); cell.render(context, value, cellBuilder); sb.append(template.outerDiv(outerDivPadding, isIconUsed(value) ? getIconHtml(value) : placeHolderHtml, cellBuilder.toSafeHtml())); }
public void render(Context context, C value, SafeHtmlBuilder sb) { SafeHtmlBuilder cellBuilder = new SafeHtmlBuilder(); cell.render(context, value, cellBuilder); sb.append(template.outerDiv(outerDivPadding, isIconUsed(value) ? getIconHtml(value) : placeHolderHtml, cellBuilder.toSafeHtml())); }
/** * Get the width of a single item * @param value * @return */ public int getElementWidth( final V value ) { SafeHtmlBuilder sb = new SafeHtmlBuilder(); cell.render( null, value, sb ); div.setInnerHTML( sb.toSafeHtml().asString() ); int width = div.getClientWidth(); if ( minWidth == null ) { return div.getClientWidth(); } return minWidth > width ? minWidth : width; }
/** * Get the width of a single item * * @param value * @return */ public int getElementWidth(V value) { SafeHtmlBuilder sb = new SafeHtmlBuilder(); cell.render( null, value, sb ); div.setInnerHTML( sb.toSafeHtml().asString() ); int width = div.getClientWidth(); if ( minWidth == null ) { return div.getClientWidth(); } return minWidth > width ? minWidth : width; }
/** * Redraw the widget. */ public void redraw() { SafeHtmlBuilder sb = new SafeHtmlBuilder(); cell.render(createContext(), value, sb); getElement().setInnerSafeHtml(sb.toSafeHtml()); /* * The rendered Cell should fill the root element so height and width styles * applied to the widget also apply to the Cell. If there is exactly one * child element, the height and width are set to 100% to fill the parent. */ Element child = getElement().getFirstChildElement(); if (child != null && child.getNextSiblingElement() == null) { child.getStyle().setHeight(100, Unit.PCT); child.getStyle().setWidth(100, Unit.PCT); } }