/** * Check if a column consumes events. */ private static boolean isColumnInteractive(HasCell<?, ?> column) { Set<String> consumedEvents = column.getCell().getConsumedEvents(); return consumedEvents != null && consumedEvents.size() > 0; }
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); }
private <X> boolean isEditingImpl(Context context, Element cellParent, C object, HasCell<C, X> hasCell) { return hasCell.getCell().isEditing(context, cellParent, hasCell.getValue(object)); }
private <X> void setValueImpl(Context context, Element cellParent, C object, HasCell<C, X> hasCell) { hasCell.getCell().setValue(context, cellParent, hasCell.getValue(object)); } }
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); }
/** * Construct a new {@link CompositeCell}. * * @param hasCells the cells that makeup the composite */ public CompositeCell(List<HasCell<C, ?>> hasCells) { // Create a new, readonly copy so cells cannot be added or removed. this.hasCells = Collections.unmodifiableList(new ArrayList<HasCell<C, ?>>(hasCells)); // Get the consumed events and depends on selection. Set<String> theConsumedEvents = null; for (HasCell<C, ?> hasCell : hasCells) { Cell<?> cell = hasCell.getCell(); Set<String> events = cell.getConsumedEvents(); if (events != null) { if (theConsumedEvents == null) { theConsumedEvents = new HashSet<String>(); } theConsumedEvents.addAll(events); } if (cell.dependsOnSelection()) { dependsOnSelection = true; } if (cell.handlesSelection()) { handlesSelection = true; } } if (theConsumedEvents != null) { this.consumedEvents = Collections.unmodifiableSet(theConsumedEvents); } }
/** * Coalesce the various cell properties (dependsOnSelection, handlesSelection, * isInteractive) into a table policy. */ private void coalesceCellProperties() { dependsOnSelection = false; handlesSelection = false; isInteractive = false; for (HasCell<T, ?> column : tableBuilder.getColumns()) { Cell<?> cell = column.getCell(); if (cell.dependsOnSelection()) { dependsOnSelection = true; } if (cell.handlesSelection()) { handlesSelection = true; } if (isColumnInteractive(column)) { isInteractive = true; } } }
private <X> void onBrowserEventImpl(final Context context, Element parent, final C object, NativeEvent event, final ValueUpdater<C> valueUpdater, final HasCell<C, X> hasCell) { Cell<X> cell = hasCell.getCell(); String eventType = event.getType(); Set<String> cellConsumedEvents = cell.getConsumedEvents(); if (cellConsumedEvents == null || !cellConsumedEvents.contains(eventType)) { // If this sub-cell doesn't consume this event. return; } ValueUpdater<X> tempUpdater = null; final FieldUpdater<C, X> fieldUpdater = hasCell.getFieldUpdater(); if (fieldUpdater != null) { tempUpdater = new ValueUpdater<X>() { @Override public void update(X value) { fieldUpdater.update(context.getIndex(), object, value); if (valueUpdater != null) { valueUpdater.update(object); } } }; } cell.onBrowserEvent(context, parent, hasCell.getValue(object), event, tempUpdater); }
/** * 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>"); }
theColumn.render(context, rowValue, cellBuilder); } else { column.getCell().render(context, column.getValue(rowValue), cellBuilder);
final T rowValue, Context context, HasCell<T, C> column) { Cell<C> cell = column.getCell(); if (!cellConsumesEventType(cell, eventType)) { return;
/** * Check if a column consumes events. */ private static boolean isColumnInteractive(HasCell<?, ?> column) { Set<String> consumedEvents = column.getCell().getConsumedEvents(); return consumedEvents != null && consumedEvents.size() > 0; }
/** * Check if a column consumes events. */ private static boolean isColumnInteractive(HasCell<?, ?> column) { Set<String> consumedEvents = column.getCell().getConsumedEvents(); return consumedEvents != null && consumedEvents.size() > 0; }
private <X> void setValueImpl(Context context, Element cellParent, C object, HasCell<C, X> hasCell) { hasCell.getCell().setValue(context, cellParent, hasCell.getValue(object)); } }
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); }
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); }
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); }
private <X> void setValueImpl(Context context, Element cellParent, C object, HasCell<C, X> hasCell) { hasCell.getCell().setValue(context, cellParent, hasCell.getValue(object)); } }
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); }
protected <X> void render(Context context, C value, SafeHtmlBuilder sb, HasCell<C, X> hasCell, String id) { com.google.gwt.cell.client.Cell<X> _cell = hasCell.getCell(); if (_cell instanceof Cell) { Cell<X> cell = (Cell<X>) _cell; // cast from GWT Cell to our Cell impl sb.appendHtmlConstant("<span id=\"" + id + "\">"); //$NON-NLS-1$ //$NON-NLS-2$ cell.render(context, hasCell.getValue(value), sb, id); sb.appendHtmlConstant("</span>"); //$NON-NLS-1$ } else { throw new IllegalStateException("CompositeCell cannot render Cells that do not implement " //$NON-NLS-1$ + Cell.class.getName()); } }