public abstract class GridStringColumn<M> extends Column<VwGovernorRule, String> { private String text_; private String tooltip_; private boolean defaultShown_ = true; private boolean hidden_ = false; public GridStringColumn(String fieldName, String text, String tooltip, boolean defaultShown, boolean sortable, boolean hidden) { super(new TextCell()); setDataStoreName(fieldName); this.text_ = text; this.tooltip_ = tooltip; this.defaultShown_ = defaultShown; setSortable(sortable); this.hidden_ = hidden; } }
@Override public boolean isEditing(Context context, Element parent, String value) { ViewData viewData = getViewData(context.getKey()); return viewData == null ? false : viewData.isEditing(); }
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())); }
private <C> boolean resetFocusOnCellImpl(Context context, T value, HasCell<T, C> column, Element cellParent) { C cellValue = column.getValue(value); Cell<C> cell = column.getCell(); return cell.resetFocus(context, cellParent, cellValue); }
public void onBrowserEvent(Context context, Element parent, C value, NativeEvent event, ValueUpdater<C> valueUpdater) { cell.onBrowserEvent(context, getCellParent(parent), value, event, valueUpdater); }
public void setValue(Context context, Element parent, C value) { cell.setValue(context, getCellParent(parent), value); }
/** * Create the context for a column based on the current table building state. * * @param column the column id * @return the context that contains the column index, row/subrow indexes, and the row value key */ public final Context createContext(int column) { return new Context(rowIndex, column, rowValueKey, subrowIndex); }
@Override public void update(C value) { fieldUpdater.update(index, rowValue, value); } };
@Override public void render(Context context, C value, SafeHtmlBuilder sb) { for (HasCell<C, ?> hasCell : hasCells) { render(context, value, sb, hasCell); } }
@Override protected void onEnterKeyDown(Context context, Element parent, C value, NativeEvent event, ValueUpdater<C> valueUpdater) { delegate.execute(value); } }
/** * The wrapper around the image vertically aligned to the bottom. */ @Template("<div style=\"{0}position:absolute;bottom:0px;line-height:0px;\">{1}</div>") SafeHtml imageWrapperBottom(SafeStyles styles, SafeHtml image);
/** * Construct a new {@link AbstractInputCell} with the specified consumed * events. * * @param consumedEvents the events that this cell consumes */ public AbstractInputCell(String... consumedEvents) { super(getConsumedEventsImpl(consumedEvents)); }
private <X> boolean resetFocusImpl(Context context, Element cellParent, C value, HasCell<C, X> hasCell) { X cellValue = hasCell.getValue(value); return hasCell.getCell().resetFocus(context, cellParent, cellValue); }
@Override public void update(C value) { fieldUpdater.update(index, object, value); } };
/** * The wrapper around the image vertically aligned to the middle. */ @Template("<div style=\"{0}position:absolute;top:50%;line-height:0px;\">{1}</div>") SafeHtml imageWrapperMiddle(SafeStyles styles, SafeHtml image);
/** * Construct a new TextHeader. * * @param text the header text as a String */ public TextHeader(String text) { super(new TextCell()); this.text = text; }