List of usage examples for com.google.gwt.cell.client HasCell getValue
C getValue(T object);
From source file:accelerator.client.ui.cell.StyleCompositeCell.java
License:Open Source License
/** * {@inheritDoc}//w ww . j av a 2s.co m */ @Override 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>"); }
From source file:com.akanoo.client.views.SharingPopupView.java
License:Apache License
private void setupCellList(CellList.Resources cellListResources) { selectionModel = new MultiSelectionModel<UserInfo>(UserInfo.keyprovider); // Construct a composite cell for contacts that includes a checkbox. List<HasCell<UserInfo, ?>> hasCells = new ArrayList<HasCell<UserInfo, ?>>(); hasCells.add(new HasCell<UserInfo, Boolean>() { private CheckboxCell cell = new CheckboxCell(true, false); public Cell<Boolean> getCell() { return cell; }//from w w w . ja v a 2s. c o m public FieldUpdater<UserInfo, Boolean> getFieldUpdater() { return null; } public Boolean getValue(UserInfo object) { return selectionModel.isSelected(object); } }); hasCells.add(new HasCell<UserInfo, UserInfo>() { private UserCell cell = new UserCell(); public Cell<UserInfo> getCell() { return cell; } public FieldUpdater<UserInfo, UserInfo> getFieldUpdater() { return null; } public UserInfo getValue(UserInfo object) { return object; } }); CompositeCell<UserInfo> friendCell = new CompositeCell<UserInfo>(hasCells) { @Override public void render(Context context, UserInfo value, SafeHtmlBuilder sb) { sb.appendHtmlConstant("<table><tbody><tr>"); super.render(context, value, sb); sb.appendHtmlConstant("</tr></tbody></table>"); } @Override protected Element getContainerElement(Element parent) { // Return the first TR element in the table. return parent.getFirstChildElement().getFirstChildElement().getFirstChildElement(); } @Override protected <X> void render(Context context, UserInfo value, SafeHtmlBuilder sb, HasCell<UserInfo, X> hasCell) { Cell<X> cell = hasCell.getCell(); sb.appendHtmlConstant("<td>"); cell.render(context, hasCell.getValue(value), sb); sb.appendHtmlConstant("</td>"); } }; shares = new CellList<UserInfo>(friendCell, cellListResources, UserInfo.keyprovider); shares.setSelectionModel(selectionModel, DefaultSelectionEventManager.<UserInfo>createCheckboxManager()); dataProvider = new ListDataProvider<UserInfo>(UserInfo.keyprovider); dataProvider.addDataDisplay(shares); selectionModel.addSelectionChangeHandler(this); }
From source file:com.google.gwt.sample.showcase.client.content.cell.ContactTreeViewModel.java
License:Apache License
public ContactTreeViewModel(final SelectionModel<ContactInfo> selectionModel) { this.selectionModel = selectionModel; if (images == null) { images = GWT.create(Images.class); }/*from w w w . j a va 2 s . c om*/ // Create a data provider that provides categories. categoryDataProvider = new ListDataProvider<Category>(); List<Category> categoryList = categoryDataProvider.getList(); for (Category category : ContactDatabase.get().queryCategories()) { categoryList.add(category); } // Construct a composite cell for contacts that includes a checkbox. List<HasCell<ContactInfo, ?>> hasCells = new ArrayList<HasCell<ContactInfo, ?>>(); hasCells.add(new HasCell<ContactInfo, Boolean>() { private CheckboxCell cell = new CheckboxCell(true, false); public Cell<Boolean> getCell() { return cell; } public FieldUpdater<ContactInfo, Boolean> getFieldUpdater() { return null; } public Boolean getValue(ContactInfo object) { return selectionModel.isSelected(object); } }); hasCells.add(new HasCell<ContactInfo, ContactInfo>() { private ContactCell cell = new ContactCell(images.contact()); public Cell<ContactInfo> getCell() { return cell; } public FieldUpdater<ContactInfo, ContactInfo> getFieldUpdater() { return null; } public ContactInfo getValue(ContactInfo object) { return object; } }); contactCell = new CompositeCell<ContactInfo>(hasCells) { @Override public void render(Context context, ContactInfo value, SafeHtmlBuilder sb) { sb.appendHtmlConstant("<table><tbody><tr>"); super.render(context, value, sb); sb.appendHtmlConstant("</tr></tbody></table>"); } @Override protected Element getContainerElement(Element parent) { // Return the first TR element in the table. return parent.getFirstChildElement().getFirstChildElement().getFirstChildElement(); } @Override protected <X> void render(Context context, ContactInfo value, SafeHtmlBuilder sb, HasCell<ContactInfo, X> hasCell) { Cell<X> cell = hasCell.getCell(); sb.appendHtmlConstant("<td>"); cell.render(context, hasCell.getValue(value), sb); sb.appendHtmlConstant("</td>"); } }; }
From source file:com.retech.reader.web.client.labs.Labs.java
License:Apache License
@Inject Labs(final CellList.Resources resource, final PlaceController placeController, final Provider<BasePlace> base) { this.setWaveContent(binder.createAndBindUi(this)); setColor.setChangeElm(simplePanel.getElement()); minimize.setIconElement(/*from w w w . j av a2s . com*/ AbstractImagePrototype.create(WaveTitleResources.image().waveTitleMinimize()).createElement()); // add Data List<LabsIconDecorator> list = listDataProvider.getList(); LabsIconDecorator touch = new LabsIconDecorator(bunder.laboratory(), "", WaveTest.class); list.add(touch); LabsIconDecorator flip = new LabsIconDecorator(bunder.laboratory(), "3D", BookFlip.class); list.add(flip); LabsIconDecorator contact = new LabsIconDecorator(bunder.laboratory(), "??", ContactPanel.class); list.add(contact); LabsIconDecorator treeTest = new LabsIconDecorator(bunder.laboratory(), "TreeTest", TreeTest.class); list.add(treeTest); LabsIconDecorator search = new LabsIconDecorator(bunder.laboratory(), "?", SearchPanel.class); list.add(search); LabsIconDecorator blipTest = new LabsIconDecorator(bunder.laboratory(), "BlipTest", BlipTest.class); list.add(blipTest); LabsIconDecorator blipTree = new LabsIconDecorator(bunder.laboratory(), "NestedBlipTest", NestedBlipTest.class); list.add(blipTree); LabsIconDecorator settingsView = new LabsIconDecorator(bunder.laboratory(), "", SettingsView.class); list.add(settingsView); LabsIconDecorator contactPanel = new LabsIconDecorator(bunder.laboratory(), "", ContactPanel.class); list.add(contactPanel); server.add( new Anchor("Android", "https://build.phonegap.com/apps/95095/download/android", "_blank")); server.add( new Anchor("iOS", "https://build.phonegap.com/apps/95095/download/ios", "_blank")); server.add(new Anchor("Google Play?", "https://play.google.com/store/apps/details?id=com.goodow.web.mobile", "_blank")); server.add(new Anchor("SCM - Subversion", SERVER_URL + "/svn/retech", "_blank")); server.add(new Anchor("Files", SERVER_URL + "/files", "_blank")); server.add(new Anchor("Document", SERVER_URL + "/svn/retech/document", "_blank")); server.add(new Anchor("CI - Hudson", SERVER_URL + ":8080", "_blank")); server.add(new Anchor("Repository - Nexus", SERVER_URL + ":8081/nexus", "_blank")); // add cell List<HasCell<LabsIconDecorator, ?>> hasCells = new ArrayList<HasCell<LabsIconDecorator, ?>>(); hasCells.add(new HasCell<LabsIconDecorator, LabsIconDecorator>() { LabsIconDecoratorCell cell = new LabsIconDecoratorCell( new LabsIconDecoratorCell.Delegate<LabsIconDecorator>() { @Override public void execute(final LabsIconDecorator object) { placeController.goTo(base.get().setPath(object.getClassName().getName())); } }); @Override public Cell<LabsIconDecorator> getCell() { return cell; } @Override public FieldUpdater<LabsIconDecorator, LabsIconDecorator> getFieldUpdater() { return null; } @Override public LabsIconDecorator getValue(final LabsIconDecorator object) { return object; } }); hasCells.add(new HasCell<LabsIconDecorator, LabsIconDecorator>() { private TrangleButtonCell<LabsIconDecorator> tbc = new TrangleButtonCell<LabsIconDecorator>(); @Override public Cell<LabsIconDecorator> getCell() { return tbc; } @Override public FieldUpdater<LabsIconDecorator, LabsIconDecorator> getFieldUpdater() { return null; } @Override public LabsIconDecorator getValue(final LabsIconDecorator object) { return object; } }); compositeCell = new CompositeCell<LabsIconDecorator>(hasCells) { @Override public void render(final com.google.gwt.cell.client.Cell.Context context, final LabsIconDecorator value, final SafeHtmlBuilder sb) { super.render(context, value, sb); } @Override protected Element getContainerElement(final Element parent) { return parent; } @Override protected <X> void render(final com.google.gwt.cell.client.Cell.Context context, final LabsIconDecorator value, final SafeHtmlBuilder sb, final HasCell<LabsIconDecorator, X> hasCell) { Cell<X> cell = hasCell.getCell(); cell.render(context, hasCell.getValue(value), sb); } }; // add cellList cellList = new CellList<LabsIconDecorator>(compositeCell, resource); // add cellPreviewHanler cellList.addCellPreviewHandler(new CellPreviewEvent.Handler<LabsIconDecorator>() { @Override public void onCellPreview(final CellPreviewEvent<LabsIconDecorator> event) { NativeEvent nativeEvent = event.getNativeEvent(); boolean isClick = nativeEvent.getType().equals(BrowserEvents.CLICK); if (isClick) { Element clickelm = cellList.getRowElement(event.getIndex()); Element eventTarget = Element.as(nativeEvent.getEventTarget()); if (clickelm.getFirstChildElement() == eventTarget) { if (Labs.this.lastElm == null) { Labs.this.lastElm = clickelm; } if (Labs.this.lastElm != clickelm) { Labs.this.lastElm.removeClassName(LabsResources.css().cellListSelectionItem()); clickelm.addClassName(LabsResources.css().cellListSelectionItem()); Labs.this.lastElm = clickelm; } else if (Labs.this.lastElm == clickelm) { clickelm.addClassName(LabsResources.css().cellListSelectionItem()); } } } } }); simplePanel.add(cellList); }
From source file:com.webgocommerce.client.view.tree.TreeMenuModel.java
private void initComponents() { List<HasCell<MenuBar, ?>> hasCells = new ArrayList<HasCell<MenuBar, ?>>(); hasCells.add(new HasCell<MenuBar, Boolean>() { private CheckboxCell cell = new CheckboxCell(true, true); @Override// w w w . j av a 2s . c o m public Cell<Boolean> getCell() { return cell; } @Override public FieldUpdater<MenuBar, Boolean> getFieldUpdater() { return new FieldUpdater<MenuBar, Boolean>() { public void update(int index, MenuBar object, Boolean value) { selectionModel.setSelected(object, value); object.setOperacion("A"); object.setEstado(value == true ? "A" : "D"); if (object.getPadre() != null && !object.getPadre().getVariable().equalsIgnoreCase("root")) { if (value) { //selectionModel.setSelected(object.getPadre(), value); //object.getPadre().setOperacion("A"); SelectedFather(object); } } isSelectedChild(object, value); } }; } @Override public Boolean getValue(MenuBar object) { if (object.getEstado().equalsIgnoreCase("A") && object.getOperacion().equalsIgnoreCase("N")) { selectionModel.setSelected(object, true); return true; } return selectionModel.isSelected(object); } public void SelectedFather(MenuBar menuBar) { if (!selectionModel.isSelected(menuBar.getPadre())) { selectionModel.setSelected(menuBar.getPadre(), true); menuBar.getPadre().setOperacion("A"); menuBar.getPadre().setEstado("A"); if (menuBar.getPadre() != null) { SelectedFather(menuBar.getPadre()); } } } public void isSelectedChild(MenuBar menuBar, Boolean val) { Iterator<MenuBar> iterador = menuBar.getHijos().iterator(); while (iterador.hasNext()) { MenuBar bean = iterador.next(); selectionModel.setSelected(bean, val); bean.setOperacion("A"); bean.setEstado(val == true ? "A" : "D"); isSelectedChild(bean, val); } } }); menuBarCell = new CompositeCell<MenuBar>(hasCells) { /*@Override public void onBrowserEvent(Cell.Context context, Element parent, MenuBar value, NativeEvent event, ValueUpdater<MenuBar> valueUpdater) { if ("keyup".equals(event.getType()) && event.getKeyCode() == KeyCodes.KEY_ENTER) { selectionModel.setSelected(value, !selectionModel.isSelected(value)); } }*/ @Override public void render(Cell.Context context, MenuBar value, SafeHtmlBuilder sb) { sb.appendHtmlConstant("<table><tbody><tr>"); super.render(context, value, sb); sb.appendHtmlConstant("</tr></tbody></table>"); } @Override protected Element getContainerElement(Element parent) { return parent.getFirstChildElement().getFirstChildElement().getFirstChildElement(); } @Override protected <X> void render(Cell.Context context, MenuBar value, SafeHtmlBuilder sb, HasCell<MenuBar, X> hasCell) { Cell<X> cell = hasCell.getCell(); sb.appendHtmlConstant("<td>"); cell.render(context, hasCell.getValue(value), sb); sb.appendHtmlConstant(" " + value.getOrden()); sb.appendHtmlConstant(" " + value.getDescripcion()); sb.appendHtmlConstant("</td>"); } }; /*hasCells.add(new HasCell<MenuBar, MenuBar>() { private MenuBarCell cell = new MenuBarCell(); public Cell<MenuBar> getCell() { return cell; } public FieldUpdater<MenuBar, MenuBar> getFieldUpdater() { return null; } public MenuBar getValue(MenuBar object) { return object; } });*/ }
From source file:gwt.material.design.client.ui.table.AbstractDataTable.java
License:Apache License
/** * Fire an event to the Cell within the specified {@link TableCellElement}. *///from w w w. j a v a2s .c o m private <C> void fireEventToCell(Event event, String eventType, Element parentElem, final T rowValue, Context context, HasCell<T, C> column) { // Check if the cell consumes the event. Cell<C> cell = column.getCell(); if (!cellConsumesEventType(cell, eventType)) { return; } C cellValue = column.getValue(rowValue); boolean cellWasEditing = cell.isEditing(context, parentElem, cellValue); if (column instanceof Column) { /* * If the HasCell is a Column, let it handle the event itself. This is * here for legacy support. */ Column<T, C> col = (Column<T, C>) column; col.onBrowserEvent(context, parentElem, rowValue, event); } else { // Create a FieldUpdater. final FieldUpdater<T, C> fieldUpdater = column.getFieldUpdater(); final int index = context.getIndex(); ValueUpdater<C> valueUpdater = (fieldUpdater == null) ? null : (value) -> { fieldUpdater.update(index, rowValue, value); }; // Fire the event to the cell. cell.onBrowserEvent(context, parentElem, cellValue, event, valueUpdater); } // Reset focus if needed. cellIsEditing = cell.isEditing(context, parentElem, cellValue); if (cellWasEditing && !cellIsEditing) { CellBasedWidgetImpl.get().resetFocus(() -> { setFocus(true); }); } }
From source file:org.dataconservancy.dcs.access.client.model.CollectionTreeViewModel.java
License:Apache License
public CollectionTreeViewModel(final SelectionModel<CollectionNode> selectionModel, final DatasetRelation relations, String root) { this.selectionModel = selectionModel; this.dusMap = relations.getDuAttrMap(); this.parentMap = relations.getParentMap(); this.root = root; // Construct a composite cell for contacts that includes a checkbox. //adding/*w w w. j av a 2 s . c o m*/ List<HasCell<CollectionNode, ?>> hasCells = new ArrayList<HasCell<CollectionNode, ?>>(); hasCells.add(new HasCell<CollectionNode, Boolean>() { private CheckboxCell cell = new CheckboxCell(true, false); public Cell<Boolean> getCell() { return cell; } public Boolean getValue(CollectionNode object) { return selectionModel.isSelected(object); } private void updateChildNodes(CollectionNode object, Boolean value) { List<String> subCollections = object.getSub().get(SubType.Collection); if (subCollections != null)//why is this running twice? { for (int i = 0; i < subCollections.size(); i++) { selectionModel.setSelected((CollectionNode) dusMap.get(subCollections.get(i)), value); MediciIngestPresenter.EVENT_BUS.fireEvent(new CollectionPassiveSelectEvent( (CollectionNode) dusMap.get(subCollections.get(i)), value)); updateChildNodes((CollectionNode) dusMap.get(subCollections.get(i)), value); } } } @Override public FieldUpdater<CollectionNode, Boolean> getFieldUpdater() { // TODO Auto-generated method stub //return null; return new FieldUpdater<CollectionNode, Boolean>() { public void update(int index, CollectionNode object, Boolean value) { //Update child Nodes /* List<String> subCollections = object.getSub().get(SubType.Collection); if(subCollections!=null)//why is this running twice? { for(int i=0;i<subCollections.size();i++) selectionModel.setSelected((CollectionNode)dusMap.get(subCollections.get(i)), value); }*/ //Update child collection nodes updateChildNodes(object, value); //update the Parent Node String parentCollection = parentMap.get(object.getId()); if (parentCollection != null) { List<String> siblingCollections = dusMap.get(parentCollection).getSub() .get(SubType.Collection); int allSelected = 1; if (value) { for (String sibling : siblingCollections) { if (!selectionModel.isSelected(dusMap.get(sibling))) { allSelected = 0; break; } } } if (allSelected == 1 && value) { //set parent true selectionModel.setSelected((CollectionNode) dusMap.get(parentCollection), true); } else { //set parent false selectionModel.setSelected((CollectionNode) dusMap.get(parentCollection), false); } } MediciIngestPresenter.EVENT_BUS.fireEvent(new CollectionSelectEvent(object, value)); } }; } }); hasCells.add(new HasCell<CollectionNode, CollectionNode>() { private CollectionCell cell = new CollectionCell(); public Cell<CollectionNode> getCell() { return cell; } public FieldUpdater<CollectionNode, CollectionNode> getFieldUpdater() { return null; } public CollectionNode getValue(CollectionNode object) { return object; } }); collectionCell = new CompositeCell<CollectionNode>(hasCells) { @Override public void render(Context context, CollectionNode value, SafeHtmlBuilder sb) { if (value == null) return; sb.appendHtmlConstant("<table><tbody><tr>"); super.render(context, value, sb); sb.appendHtmlConstant("</tr></tbody></table>"); } @Override protected Element getContainerElement(Element parent) { // Return the first TR element in the table. return parent.getFirstChildElement().getFirstChildElement().getFirstChildElement(); } @Override protected <X> void render(Context context, CollectionNode value, SafeHtmlBuilder sb, HasCell<CollectionNode, X> hasCell) { if (value != null) { Cell<X> cell = hasCell.getCell(); sb.appendHtmlConstant("<td>"); cell.render(context, hasCell.getValue(value), sb); sb.appendHtmlConstant("</td>"); } } }; }
From source file:org.eclipse.che.ide.ext.java.client.refactoring.preview.PreviewChangesModel.java
License:Open Source License
public PreviewChangesModel(RefactoringPreview changes, final SelectionModel<RefactoringPreview> selectionModel, final PreviewView.ActionDelegate delegate) { this.changes = changes; this.selectionModel = selectionModel; List<HasCell<RefactoringPreview, ?>> hasCells = new ArrayList<>(); hasCells.add(new HasCell<RefactoringPreview, Boolean>() { private CheckboxCell cell = new CheckboxCell(false, false); @Override/*from ww w . j a va 2s. c o m*/ public Cell<Boolean> getCell() { return cell; } @Override public FieldUpdater<RefactoringPreview, Boolean> getFieldUpdater() { return new FieldUpdater<RefactoringPreview, Boolean>() { @Override public void update(int index, RefactoringPreview object, Boolean value) { object.setEnabled(value); delegate.onEnabledStateChanged(object); } }; } @Override public Boolean getValue(RefactoringPreview object) { return object.isEnabled(); } }); hasCells.add(new HasCell<RefactoringPreview, RefactoringPreview>() { private RefactoringPreviewCell cell = new RefactoringPreviewCell(); @Override public Cell<RefactoringPreview> getCell() { return cell; } @Override public FieldUpdater<RefactoringPreview, RefactoringPreview> getFieldUpdater() { return null; } @Override public RefactoringPreview getValue(RefactoringPreview object) { return object; } }); refactoringPreviewCell = new CompositeCell<RefactoringPreview>(hasCells) { @Override public void render(Context context, RefactoringPreview value, SafeHtmlBuilder sb) { sb.appendHtmlConstant("<div style=\"display: inline-flex\">"); super.render(context, value, sb); sb.appendHtmlConstant("</div>"); } @Override protected Element getContainerElement(Element parent) { return parent.getFirstChildElement(); } @Override protected <X> void render(Context context, RefactoringPreview value, SafeHtmlBuilder sb, HasCell<RefactoringPreview, X> hasCell) { Cell<X> cell = hasCell.getCell(); sb.appendHtmlConstant("<div style=\"display: flex; align-items: center;\">"); cell.render(context, hasCell.getValue(value), sb); sb.appendHtmlConstant("</div>"); } }; }
From source file:org.komodo.web.client.panels.repo.VdbList.java
License:Apache License
private CompositeCell createCompositeCell(VdbCell vdbCell) { // ----------------------------------------------------------------- // VDB Cell - icon and name // ----------------------------------------------------------------- List<HasCell<KomodoObjectBean, ?>> hasCells = new ArrayList<HasCell<KomodoObjectBean, ?>>(); hasCells.add(new HasCell<KomodoObjectBean, KomodoObjectBean>() { private VdbCell cell = new VdbCell(); @Override//from w w w.ja v a 2s . co m public Cell<KomodoObjectBean> getCell() { return cell; } @Override public FieldUpdater<KomodoObjectBean, KomodoObjectBean> getFieldUpdater() { return null; } @Override public KomodoObjectBean getValue(KomodoObjectBean object) { return object; } }); // ----------------------------------------------------------------- // Cell with add, edit, remove icons // ----------------------------------------------------------------- hasCells.add(new HasCell<KomodoObjectBean, String>() { private ImagesCell cell = new ImagesCell(); @Override public Cell<String> getCell() { return cell; } @Override public FieldUpdater<KomodoObjectBean, String> getFieldUpdater() { return new FieldUpdater<KomodoObjectBean, String>() { @Override public void update(int index, KomodoObjectBean object, String value) { if (value.equals(ImagesCell.ADD_VDB)) { // Show confirmation dialog for VDB create showConfirmVdbCreateDialog(); } else if (value.equals(ImagesCell.DELETE_VDB)) { // Show confirmation dialog for VDB delete showConfirmVdbDeleteDialog(object); } else if (value.equals(ImagesCell.EDIT_VDB)) { // Do Nothing } } }; } @Override public String getValue(KomodoObjectBean object) { return StringConstants.EMPTY_STRING; } }); // ----------------------------------------------------------------- // Composite Cell // ----------------------------------------------------------------- CompositeCell compositeCell = new CompositeCell<KomodoObjectBean>(hasCells) { @Override public void render(Context context, KomodoObjectBean value, SafeHtmlBuilder sb) { sb.appendHtmlConstant("<table><tbody><tr>"); super.render(context, value, sb); sb.appendHtmlConstant("</tr></tbody></table>"); } @Override protected Element getContainerElement(Element parent) { // Return the first TR element in the table. return parent.getFirstChildElement().getFirstChildElement().getFirstChildElement(); } @Override protected <X> void render(Context context, KomodoObjectBean value, SafeHtmlBuilder sb, HasCell<KomodoObjectBean, X> hasCell) { Cell<X> cell = hasCell.getCell(); sb.appendHtmlConstant("<td>"); cell.render(context, hasCell.getValue(value), sb); sb.appendHtmlConstant("</td>"); } }; return compositeCell; }
From source file:org.mindinformatics.gwt.domeo.plugins.annotation.persistence.ui.existingsets.AnnotationSetTreeViewModel.java
License:Apache License
public AnnotationSetTreeViewModel(final SelectionModel<AnnotationSetInfo> selectionModel, final ExistingAnnotationViewerPanel2 parent) { this.parent = parent; this.selectionModel = selectionModel; if (images == null) { images = GWT.create(Images.class); }//from w w w . j a v a 2s .c om // Create a data provider that provides categories. categoryDataProvider = new ListDataProvider<Category>(); List<Category> categoryList = categoryDataProvider.getList(); for (Category category : parent.getCategories()) { categoryList.add(category); } // Construct a composite cell for contacts that includes a checkbox. List<HasCell<AnnotationSetInfo, ?>> hasCells = new ArrayList<HasCell<AnnotationSetInfo, ?>>(); hasCells.add(new HasCell<AnnotationSetInfo, Boolean>() { private CheckboxCell cell = new CheckboxCell(true, false); public Cell<Boolean> getCell() { return cell; } public FieldUpdater<AnnotationSetInfo, Boolean> getFieldUpdater() { return null; } public Boolean getValue(AnnotationSetInfo object) { return selectionModel.isSelected(object); } }); hasCells.add(new HasCell<AnnotationSetInfo, AnnotationSetInfo>() { private AnnotationSetCell cell = new AnnotationSetCell(selectionModel, parent); public Cell<AnnotationSetInfo> getCell() { return cell; } public FieldUpdater<AnnotationSetInfo, AnnotationSetInfo> getFieldUpdater() { return null; } public AnnotationSetInfo getValue(AnnotationSetInfo object) { return object; } }); contactCell = new CompositeCell<AnnotationSetInfo>(hasCells) { @Override public void render(Context context, AnnotationSetInfo value, SafeHtmlBuilder sb) { sb.appendHtmlConstant("<table><tbody><tr>"); super.render(context, value, sb); sb.appendHtmlConstant("</tr></tbody></table>"); } @Override protected Element getContainerElement(Element parent) { // Return the first TR element in the table. return parent.getFirstChildElement().getFirstChildElement().getFirstChildElement(); } @Override protected <X> void render(Context context, AnnotationSetInfo value, SafeHtmlBuilder sb, HasCell<AnnotationSetInfo, X> hasCell) { Cell<X> cell = hasCell.getCell(); sb.appendHtmlConstant("<td>"); cell.render(context, hasCell.getValue(value), sb); sb.appendHtmlConstant("</td>"); } }; }