@Override public Widget asWidget() { if (panel == null) { panel = new ContentPanel(); panel.setHeadingText("Cell Action Tree"); panel.setPixelSize(315, 400); panel.addStyleName("margin-10"); VerticalLayoutContainer con = new VerticalLayoutContainer(); panel.add(con); TreeStore<BaseDto> store = new TreeStore<BaseDto>(new KeyProvider()); FolderDto root = TestData.getMusicRootFolder(); for (BaseDto base : root.getChildren()) { store.add(base); if (base instanceof FolderDto) { processFolder(store, (FolderDto) base); } } SimpleSafeHtmlCell<String> cell = new SimpleSafeHtmlCell<String>(SimpleSafeHtmlRenderer.getInstance(), "click") { @Override public void onBrowserEvent( Context context, Element parent, String value, NativeEvent event, ValueUpdater<String> valueUpdater) { super.onBrowserEvent(context, parent, value, event, valueUpdater); if ("click".equals(event.getType())) { Info.display("Click", "You clicked \"" + value + "\"!"); } } }; final Tree<BaseDto, String> tree = new Tree<BaseDto, String>( store, new ValueProvider<BaseDto, String>() { @Override public String getValue(BaseDto object) { return object.getName(); } @Override public void setValue(BaseDto object, String value) {} @Override public String getPath() { return "name"; } }); tree.setCell(cell); tree.setWidth(300); tree.getStyle().setLeafIcon(ExampleImages.INSTANCE.music()); ToolBar buttonBar = new ToolBar(); buttonBar.add( new TextButton( "Expand All", new SelectHandler() { @Override public void onSelect(SelectEvent event) { tree.expandAll(); } })); buttonBar.add( new TextButton( "Collapse All", new SelectHandler() { @Override public void onSelect(SelectEvent event) { tree.collapseAll(); } })); con.add(buttonBar, new VerticalLayoutData(1, -1)); con.add(tree, new VerticalLayoutData(1, 1)); } return panel; }
public ContainerActionsCell( final ContainersProvider containersProvider, final DoContainerActionCallback callback) { super(SimpleSafeHtmlRenderer.getInstance(), "click", "keydown"); this.containersProvider = containersProvider; this.callback = callback; }
/** Construct a new EditTextCell that will use a {@link SimpleSafeHtmlRenderer}. */ public EditTextAreaCell() { this(SimpleSafeHtmlRenderer.getInstance()); }