/** * 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); }
Object key = getValueKey(); Context context = new Context(getIndex(), 0, key); boolean cellWasEditing = parentCell.isEditing(context, cellParent, value); parentCell.handlesSelection() || KeyboardSelectionPolicy.BOUND_TO_SELECTION == tree.getKeyboardSelectionPolicy(); HasData<T> display = (HasData<T>) parentNode.listView; return; Set<String> consumedEvents = parentCell.getConsumedEvents(); if (consumedEvents != null && consumedEvents.contains(eventType)) { parentCell .onBrowserEvent(context, cellParent, value, event, parentNodeInfo.getValueUpdater()); tree.cellIsEditing = parentCell.isEditing(context, cellParent, value); if (cellWasEditing && !tree.cellIsEditing) { CellBasedWidgetImpl.get().resetFocus(new Scheduler.ScheduledCommand() {
public void setValue(Context context, Element parent, C value) { cell.setValue(context, getCellParent(parent), value); }
/** * 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); } }
/** * Fire an event to the cell. * * @param context the {@link Context} of the cell * @param event the event that was fired * @param parent the parent of the cell * @param value the value of the cell */ protected void fireEventToCell(Context context, Event event, Element parent, T value) { Set<String> consumedEvents = cell.getConsumedEvents(); if (consumedEvents != null && consumedEvents.contains(event.getType())) { boolean cellWasEditing = cell.isEditing(context, parent, value); cell.onBrowserEvent(context, parent, value, event, valueUpdater); cellIsEditing = cell.isEditing(context, parent, value); if (cellWasEditing && !cellIsEditing) { CellBasedWidgetImpl.get().resetFocus(new Scheduler.ScheduledCommand() { @Override public void execute() { setFocus(true); } }); } } }
/** * 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; } } }
@Override public void onBrowserEvent(Event event) { CellBasedWidgetImpl.get().onBrowserEvent(this, event); super.onBrowserEvent(event); // Forward the event to the cell. String eventType = event.getType(); Set<String> consumedEvents = cell.getConsumedEvents(); if (consumedEvents != null && consumedEvents.contains(eventType)) { cell.onBrowserEvent(createContext(), getElement(), value, event, valueUpdater); } }
public boolean resetFocus(Context context, Element parent, C value) { return cell.resetFocus(context, getCellParent(parent), value); }
public void onBrowserEvent(Context context, Element parent, C value, NativeEvent event, ValueUpdater<C> valueUpdater) { cell.onBrowserEvent(context, getCellParent(parent), value, event, valueUpdater); }
public Set<String> getConsumedEvents() { return cell.getConsumedEvents(); }
public boolean isEditing(Context context, Element parent, C value) { return cell.isEditing(context, getCellParent(parent), value); }
boolean cellWasEditing = cell.isEditing(context, parentElem, cellValue); if (column instanceof Column) { cell.onBrowserEvent(context, parentElem, cellValue, event, valueUpdater); cellIsEditing = cell.isEditing(context, parentElem, cellValue); if (cellWasEditing && !cellIsEditing) { CellBasedWidgetImpl.get().resetFocus(new Scheduler.ScheduledCommand() {
@Override protected boolean dependsOnSelection() { return cell.dependsOnSelection(); }
public boolean handlesSelection() { return cell.handlesSelection(); }
/** * Fire an event to the cell. * * @param context the {@link Context} of the cell * @param event the event that was fired * @param parent the parent of the cell * @param value the value of the cell */ protected void fireEventToCell(Context context, Event event, Element parent, T value) { Set<String> consumedEvents = cell.getConsumedEvents(); if (consumedEvents != null && consumedEvents.contains(event.getType())) { boolean cellWasEditing = cell.isEditing(context, parent, value); cell.onBrowserEvent(context, parent, value, event, valueUpdater); cellIsEditing = cell.isEditing(context, parent, value); if (cellWasEditing && !cellIsEditing) { CellBasedWidgetImpl.get().resetFocus(new Scheduler.ScheduledCommand() { @Override public void execute() { setFocus(true); } }); } } }
/** * Construct a new {@link CompositeCell}. * * @param hasCells the cells that makeup the composite */ public CompositeCell(List<HasCell<C, ?>> hasCells) { // Create a new array so cells cannot be added or removed. this.hasCells = 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); } }
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); }
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); }
/** * 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; } } }