List of usage examples for com.google.gwt.user.client.ui TreeItem addItem
public TreeItem addItem(Widget widget)
From source file:asquare.gwt.tests.selecttreeitem.client.Demo.java
License:Apache License
public void onModuleLoad() { Debug.enableSilently();//from www.j a v a 2 s.co m TreeItem treeRoot = new TreeItem("Tree"); final TreeItem treeItem = new TreeItem("foo"); treeRoot.addItem(treeItem); treeRoot.addItem("bar"); treeRoot.addItem("baz"); final Tree tree = new Tree(); tree.addItem(treeRoot); // DeferredCommand.addCommand(new Command() // { // public void execute() // { tree.setSelectedItem(treeItem); tree.ensureSelectedItemVisible(); // } // }); // RootPanel.get().add(tree); // this is not reached in Opera RootPanel.get().add(new Label("Entry point was sucessfully executed")); }
From source file:asquare.gwt.tk.demo.client.DebugPanel.java
License:Apache License
private Widget createWidgetPanel() { BasicPanel widgets = new BasicPanel(); DOM.setAttribute(widgets.getElement(), "id", "debug-widgets"); TextArea textArea = new TextArea(); textArea.setText("Enable event tracing then type in here"); widgets.add(textArea);//from w w w . jav a2 s . co m ListBox listBox = new ListBox(); listBox.addItem("List Box"); listBox.addItem("foo"); listBox.addItem("bar"); listBox.addItem("baz"); widgets.add(listBox); TreeItem treeRoot = new TreeItem("Tree"); TreeItem treeItem = new TreeItem("foo"); treeRoot.addItem(treeItem); treeRoot.addItem("bar"); treeRoot.addItem("baz"); Tree tree = new Tree(); tree.addItem(treeRoot); tree.setSelectedItem(treeItem); tree.ensureSelectedItemVisible(); widgets.add(tree); Image image = new Image("icecube.jpg"); ScrollPanel scrollPanel = new ScrollPanel(image); scrollPanel.setSize("200px", "200px"); widgets.add(scrollPanel); return widgets; }
From source file:asquare.gwt.tkdemo.client.demos.DebugPanel.java
License:Apache License
private Widget createWidgetPanel() { BasicPanel widgets = new BasicPanel(); TextArea textArea = new TextArea(); textArea.setText("Enable event tracing then type in here"); widgets.add(textArea);// w ww . j a va 2 s .co m ListBox listBox = new ListBox(); listBox.addItem("List Box"); listBox.addItem("foo"); listBox.addItem("bar"); listBox.addItem("baz"); widgets.add(listBox); TreeItem treeRoot = new TreeItem("Tree"); final TreeItem treeItem = new TreeItem("foo"); treeRoot.addItem(treeItem); treeRoot.addItem("bar"); treeRoot.addItem("baz"); final Tree tree = new Tree(); tree.addItem(treeRoot); /* * This crashes the hosted shell * http://code.google.com/p/google-web-toolkit/issues/detail?id=1785 */ // /* // * Defer selection so that Tree does not break Opera // * http://code.google.com/p/google-web-toolkit/issues/detail?id=1784 // */ // DeferredCommand.addCommand(new Command() // { // public void execute() // { // tree.setSelectedItem(treeItem); // tree.ensureSelectedItemVisible(); // } // }); widgets.add(tree); Image image = new Image("icecube.jpg"); ScrollPanel scrollPanel = new ScrollPanel(image); scrollPanel.setSize("200px", "200px"); widgets.add(scrollPanel); return widgets; }
From source file:asquare.gwt.tkdemo.client.demos.FocusCycleDemo.java
License:Apache License
private Widget createFocusCycle1() { FocusCyclePanel cycle1 = new FocusCyclePanel("div", "block"); cycle1.add(new Label("Cycle 1")); cycle1.add(new FocusStyleDecorator(new Button("Button"))); Button buttonDisabled = new Button("disabled"); buttonDisabled.setEnabled(false);// w w w.jav a 2 s .c om cycle1.add(new FocusStyleDecorator(buttonDisabled)); Button buttonNegativeTabIndex = new Button("tabIndex = -1"); buttonNegativeTabIndex.setTabIndex(-1); cycle1.add(new FocusStyleDecorator(buttonNegativeTabIndex)); cycle1.add(new FocusStyleDecorator(new CheckBox("CheckBox"))); cycle1.add(new FocusStyleDecorator(new FocusPanel(new Label("FocusPanel")))); ListBox listBox = new ListBox(); listBox.addItem("ListBox"); listBox.addItem("Item 1"); listBox.addItem("Item 2"); listBox.addItem("Item 3"); cycle1.add(new FocusStyleDecorator(listBox)); TextBox textBox = new TextBox(); textBox.setText("TextBox"); cycle1.add(new FocusStyleDecorator(textBox)); PasswordTextBox pwBox = new PasswordTextBox(); pwBox.setText("PasswordTextBox"); cycle1.add(new FocusStyleDecorator(pwBox)); TextArea textArea = new TextArea(); textArea.setText("TextArea"); cycle1.add(new FocusStyleDecorator(textArea)); Tree tree = new Tree(); TreeItem treeRoot = new TreeItem("Tree"); for (int branchNum = 1; branchNum < 4; branchNum++) { TreeItem branch = new TreeItem("Branch " + branchNum); for (int item = 1; item < 4; item++) { branch.addItem("Item " + item); } treeRoot.addItem(branch); } tree.addItem(treeRoot); cycle1.add(new FocusStyleDecorator(tree)); new WidgetFocusStyleController(cycle1.getFocusModel()); return cycle1; }
From source file:at.ait.dme.yuma.client.image.annotation.ImageAnnotationTree.java
License:EUPL
/** * add the given annotation and all replies to the annotation tree * /* w w w. ja v a 2s . c o m*/ * @param annotation * @param parentAnnotation * @param parent */ private void addAnnotation(final ImageAnnotation annotation, ImageAnnotation parentAnnotation, TreeItem parent) { // create the tree node final ImageAnnotationTreeNode node = new ImageAnnotationTreeNode(annotationComposite, annotation, parentAnnotation); node.setAnnotationTreeItem((parent == null) ? this.addItem(node) : parent.addItem(node)); node.addMouseOutHandler(new MouseOutHandler() { public void onMouseOut(MouseOutEvent event) { node.setStyleName("imageAnnotation"); handlerManager.fireEvent(new ImageAnnotationSelectionEvent(annotation, false)); } }); node.addMouseOverHandler(new MouseOverHandler() { public void onMouseOver(MouseOverEvent event) { node.setStyleName("imageAnnotation-selected"); handlerManager.fireEvent(new ImageAnnotationSelectionEvent(annotation, true)); } }); annotationNodes.put(annotation, node); // show the fragment if (annotation.hasFragment()) { DeferredCommand.addCommand(new Command() { public void execute() { imageComposite.showFragment(node.getAnnotation()); } }); } setSelectedItem(node.getAnnotationTreeItem()); ensureSelectedItemVisible(); // process replies if (annotation.hasReplies()) { // sort replies ascending by creation date List<ImageAnnotation> replies = annotation.getReplies(); Collections.sort(replies, new Comparator<ImageAnnotation>() { public int compare(ImageAnnotation o1, ImageAnnotation o2) { return o1.getCreated().compareTo(o2.getCreated()); } }); // add replies to the tree for (ImageAnnotation reply : replies) { addAnnotation(reply, annotation, node.getAnnotationTreeItem()); } } }
From source file:client.argon.tree.ArgonTreeMenu.java
License:Open Source License
/** * default constructor.//from w ww.jav a 2 s .c o m */ public ArgonTreeMenu() { super(); final TreeItem argon = new TreeItem("ARGON"); final TreeItem argonReservations = new TreeItem("Reservations"); final TreeItem argonTopology = new TreeItem("Topology"); final TreeItem argonEndpoints = new TreeItem("Endpoints"); final TreeItem argonInternalLinks = new TreeItem("Internal Links"); final TreeItem argonRouter = new TreeItem("Router"); argonReservations.setUserObject(new ArgonReservationCrudPage()); argonEndpoints.setUserObject(new ArgonEndpointCrudPage()); argonInternalLinks.setUserObject(new ArgonInternalLinkCrudPage()); argonRouter.setUserObject(new ArgonRouterCrudPage()); argonTopology.addItem(argonEndpoints); argonTopology.addItem(argonInternalLinks); argonTopology.addItem(argonRouter); argon.addItem(argonReservations); argon.addItem(argonTopology); this.getTree().addItem(argon); }
From source file:com.arondor.common.reflection.gwt.client.view.AbstractTreeNodeView.java
License:Apache License
private void addItemToParent(UIObject parentNode) { if (parentNode instanceof Tree) { ((Tree) parentNode).addItem(this); } else if (parentNode instanceof TreeItem) { TreeItem parentNodeItem = (TreeItem) parentNode; int childCount = parentNodeItem.getChildCount(); int nodeDepth = 0; for (TreeItem ancestor = parentNodeItem; ancestor != null; ancestor = ancestor.getParentItem()) { nodeDepth++;/* w w w .jav a2 s. co m*/ } parentNodeItem.addItem(this); String colors[] = { "#F5F5F2", "#DBDAD8", "#F9F8F6", "#E7E7E3" }; int colorIndex = ((nodeDepth % 2) + (childCount % 2)) % 2; getElement().getStyle().setBackgroundColor(colors[colorIndex]); } }
From source file:com.audata.client.classification.ClassBrowser.java
License:Open Source License
public void addClass(String name, String uuid, TreeItem parent, boolean hasChildren) { //this.sp.setWidget(this.classes); CaptionButton i = new CaptionButton(); i.setCaptionText(name);/*from ww w. ja v a 2 s. com*/ if (hasChildren) { //i = new CaptionButton("images/16x16/treeclass.gif", name, CaptionButton.CAPTION_EAST); i.setImageUrl("images/16x16/treeclass.gif"); } else { i.setImageUrl("images/16x16/treeclassb.gif"); } i.setCaptionStyleName("tree-text"); TreeItem c = new TreeItem(i); c.setUserObject(new TreeNodeType("class", uuid, name, hasChildren)); if (parent == null) { this.classes.addItem(c); } else { parent.addItem(c); parent.setState(true); } }
From source file:com.audata.client.Keyword.KeywordBrowser.java
License:Open Source License
public void addClass(String name, String uuid, TreeItem parent, boolean hasChildren, String path) { this.sp.setWidget(this.keywords); CaptionButton i = new CaptionButton(); i.setCaptionText(name);//from www . j ava 2 s . c o m if (hasChildren) { i.setImageUrl("images/16x16/treeclass.gif"); } else { i.setImageUrl("images/16x16/treeclassb.gif"); } i.setCaptionStyleName("tree-text"); TreeItem c = new TreeItem(i); HashMap uObj = new HashMap(); uObj.put("uuid", uuid); uObj.put("name", name); uObj.put("path", path); uObj.put("hasChildren", new Boolean(hasChildren)); //c.setUserObject(new TreeNodeType("class", uuid, name, hasChildren)); c.setUserObject(uObj); if (parent == null) { this.keywords.addItem(c); } else { parent.addItem(c); parent.setState(true); } }
From source file:com.chinarewards.gwt.license.client.core.ui.impl.SimpleMenuProcessor.java
/** * /*from w w w . j av a 2 s . c o m*/ * * @param parent * @param node */ private void addSubTreeNode(TreeItem parent, final MenuNode node) { TreeItem item = new TreeItem(); Grid grid = new Grid(1, 2); // if (node.getValue().getIcon() != null) { // // grid.setWidget(0, 0, node.getValue().getIcon()); // } else { // // default menu icon // // grid.setWidget(0, 0, new Image(resources.getDefaultMenuIcon())); // } // setup handler to fire menu click event Label text = new Label(node.getValue().getTitle()); text.addClickHandler(new ClickHandler() { public void onClick(ClickEvent paramClickEvent) { eventBus.fireEvent(new MenuClickEvent(node.getValue())); } }); grid.setWidget(0, 1, text); // make it visible item.setWidget(grid); item.setVisible(true); item.setState(true); parent.addItem(item); // continue processing child menus if any. for (MenuNode i : node.getChildren()) { addSubTreeNode(item, i); } }