本文整理汇总了Java中com.google.gwt.cell.client.Cell.render方法的典型用法代码示例。如果您正苦于以下问题:Java Cell.render方法的具体用法?Java Cell.render怎么用?Java Cell.render使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.gwt.cell.client.Cell
的用法示例。
在下文中一共展示了Cell.render方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: redrawAllRowsInColumn
import com.google.gwt.cell.client.Cell; //导入方法依赖的package包/类
public <C> void redrawAllRowsInColumn(int aIndex, ListDataProvider<T> aDataProvider) {
if (aIndex >= 0 && aIndex < getColumnCount()) {
int start = getVisibleRange().getStart();
Column<T, C> column = (Column<T, C>) getColumn(aIndex);
Cell<C> cell = column.getCell();
List<T> data = aDataProvider.getList();
ProvidesKey<T> keys = getKeyProvider();
NodeList<TableRowElement> rows = getTableBodyElement().getRows();
for (int i = 0; i < rows.getLength(); i++) {
TableRowElement row = rows.getItem(i);
NodeList<TableCellElement> cells = row.getCells();
if (aIndex >= 0 && aIndex < cells.getLength()) {
TableCellElement toRerender = cells.getItem(aIndex);
if (toRerender != null) {
SafeHtmlBuilder sb = new SafeHtmlBuilder();
int dataIdx = start + i;
if (dataIdx >= 0 && dataIdx < data.size()) {
T object = data.get(dataIdx);
Cell.Context cx = new Cell.Context(start + i, aIndex, keys.getKey(object));
cell.render(cx, column.getValue(object), sb);
// Take into account, that cell builder supports
// some
// maps
// to cells' divs
// and generates them. So we have to work with first
// <div>
// in <td>.
toRerender.getFirstChildElement().setInnerSafeHtml(sb.toSafeHtml());
}
}
}
}
}
}
示例2: render
import com.google.gwt.cell.client.Cell; //导入方法依赖的package包/类
@Override
protected <X> void render(Context context, GlobalPermissionEnum value,
SafeHtmlBuilder sb, HasCell<GlobalPermissionEnum, X> hasCell) {
Cell<X> cell = hasCell.getCell();
sb.appendHtmlConstant("<td>");
cell.render(context, hasCell.getValue(value), sb);
sb.appendHtmlConstant("</td>");
}
示例3: render
import com.google.gwt.cell.client.Cell; //导入方法依赖的package包/类
@Override
public void render(Context context, PropertyEditorValue value, SafeHtmlBuilder sb) {
Cell cell = config.getBestSuitedCell(value);
if (cell != null) {
cell.render(context, value.getValue(), sb);
}
}
示例4: renderRowValues
import com.google.gwt.cell.client.Cell; //导入方法依赖的package包/类
@Override
protected void renderRowValues(SafeHtmlBuilder sb, List<T> values, int start,
SelectionModel<? super T> selectionModel) {
Cell<T> cell = getCell();
String keyboardSelectedItem = " " + style.cellBrowserKeyboardSelectedItem();
String selectedItem = " " + style.cellBrowserSelectedItem();
String openItem = " " + style.cellBrowserOpenItem();
String evenItem = style.cellBrowserEvenItem();
String oddItem = style.cellBrowserOddItem();
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);
boolean isOpen = isOpen(i);
StringBuilder classesBuilder = new StringBuilder();
classesBuilder.append(i % 2 == 0 ? evenItem : oddItem);
if (isOpen) {
classesBuilder.append(openItem);
}
if (isSelected) {
classesBuilder.append(selectedItem);
}
SafeHtmlBuilder cellBuilder = new SafeHtmlBuilder();
Context context = new Context(i, 0, getValueKey(value));
cell.render(context, value, cellBuilder);
// Figure out which image to use.
SafeHtml image;
if (isOpen) {
image = openImageHtml;
} else if (isLeaf(value)) {
image = LEAF_IMAGE;
} else {
image = closedImageHtml;
}
SafeStyles padding =
SafeStylesUtils.fromTrustedString("padding-right: " + imageWidth + "px;");
if (i == keyboardSelectedRow) {
// This is the focused item.
if (isFocused) {
classesBuilder.append(keyboardSelectedItem);
}
char accessKey = getAccessKey();
if (accessKey != 0) {
sb.append(template.divFocusableWithKey(i, classesBuilder.toString(), padding,
getTabIndex(), getAccessKey(), image, cellBuilder.toSafeHtml()));
} else {
sb.append(template.divFocusable(i, classesBuilder.toString(), padding, getTabIndex(),
image, cellBuilder.toSafeHtml()));
}
} else {
sb.append(template.div(i, classesBuilder.toString(), padding, image, cellBuilder
.toSafeHtml()));
}
}
// Update the child state.
updateChildState(this, true);
}