List of usage examples for com.google.gwt.user.client.ui TreeItem addItem
public TreeItem addItem(Widget widget)
From source file:com.fullmetalgalaxy.client.game.tabmenu.WgtGameLogs.java
License:Open Source License
private void buildTree4Parallel() { Iterator<AnEvent> iterator = GameEngine.model().getGame().getLogs().iterator(); if (GameEngine.model().getGame().getAdditionalEventCount() == 0) { TreeItem turnTreeItem = new TreeItem(SafeHtmlUtils.fromString("inscriptions")); m_tree.addItem(turnTreeItem);//from www.j a va 2 s . co m // game starting while (iterator.hasNext()) { AnEvent event = iterator.next(); turnTreeItem.addItem(new TreeItemEvent(event)); if (event instanceof EbAdminTimePlay) { break; } } } // game time step TreeItemEvent dateTreeItem = null; while (iterator.hasNext()) { AnEvent event = iterator.next(); if (dateTreeItem == null || event.getLastUpdate().getDate() != dateTreeItem.getEvent().getLastUpdate().getDate()) { dateTreeItem = new TreeItemEvent(event); dateTreeItem.setHTML("<img src='/images/css/calendar.png'/> " + EventPresenter.getDate(event)); m_tree.addItem(dateTreeItem); } dateTreeItem.addItem(new TreeItemEvent(event)); } }
From source file:com.gmail.cjbooms.thesis.pythonappengine.client.filebrowser.FileSystemTreeWidget.java
License:Open Source License
/** * Create Empty Tree/*from ww w . j av a 2 s .c om*/ * @return */ private Tree createFileSystemTree() { tree = new Tree(); tree.setAnimationEnabled(true); TreeItem tItem = new TreeItem(new TreeItemWidget(FileType.DIR, "Available Projects")); tItem.addItem("Loading..."); tree.addOpenHandler(getOpenHandler()); tree.addSelectionHandler(getSelectionHandler()); tree.addItem(tItem); //tree.setSelectedItem(tItem, true); return tree; }
From source file:com.gmail.cjbooms.thesis.pythonappengine.client.filebrowser.FileSystemTreeWidget.java
License:Open Source License
/** * Handle Tree Expansion. Add new branch nodes if directory, otherwise add as leaf nodes * @param father// ww w.ja va2 s .c o m * @param files */ private void expandTreeItem(TreeItem father, FileWrapper[] files) { father.removeItems(); for (FileWrapper file : files) { TreeItemWidget fileTreeNode = new TreeItemWidget(file.getKind(), file.getName()); // Add new branch node if (file.getKind() == FileType.DIR) { TreeItem newItem = new TreeItem(fileTreeNode); father.addItem(newItem); newItem.addItem("Loading..."); } // Add Leaf else { father.addItem(fileTreeNode); } } }
From source file:com.google.appinventor.client.editor.simple.components.MockContainer.java
License:Open Source License
@Override protected TreeItem buildTree() { TreeItem itemNode = super.buildTree(); // Recursively build the tree for child components for (MockComponent child : children) { itemNode.addItem(child.buildTree()); }// www .ja v a2s . c o m itemNode.setState(expanded); return itemNode; }
From source file:com.google.gwt.demos.fasttree.client.FastTreeDemo.java
License:Apache License
private TreeItem profileAdd(TreeItem parent, TreeType type) { if (type == TreeType.TEXT) { TreeItem item = new TreeItem(); item.setText("text"); parent.addItem(item); return item; } else if (type == TreeType.HTML) { TreeItem item = new TreeItem("<h1>html</h1>"); parent.addItem(item);//from w w w . j a v a 2 s .c om return item; } else if (type == TreeType.CHECKBOX) { return parent.addItem(new CheckBox("myBox")); } else { throw new RuntimeException("What?"); } }
From source file:com.google.gwt.demos.fasttree.client.TreeBenchmarkHelper.java
License:Apache License
private TreeItem add(TreeItem parent, TreeType type) { if (type == TreeType.TEXT) { return parent.addItem("text"); } else if (type == TreeType.HTML) { TreeItem item = new TreeItem(); item.setHTML("<h1>html</h1>"); parent.addItem(item);/*from w w w . ja v a 2 s . c o m*/ return item; } else if (type == TreeType.CHECKBOX) { return parent.addItem(new CheckBox("myBox")); } else { throw new RuntimeException("What?"); } }
From source file:com.google.gwt.examples.TreeExample.java
License:Apache License
public void onModuleLoad() { // Create a tree with a few items in it. TreeItem root = new TreeItem("root"); root.addItem("item0"); root.addItem("item1"); root.addItem("item2"); // Add a CheckBox to the tree TreeItem item = new TreeItem(new CheckBox("item3")); root.addItem(item);//from ww w . jav a 2 s .c o m Tree t = new Tree(); t.addItem(root); // Add it to the root panel. RootPanel.get().add(t); }
From source file:com.google.gwt.gen2.demo.scrolltable.client.PagingScrollTableDemo.java
License:Apache License
@Override protected void initOptions(Tree menu) { super.initOptions(menu); // Paging/*from www . jav a 2 s . com*/ { TreeItem root = menu.addItem("Paging"); mapOption(root.addItem("Page Size"), new PageSizeOption()); mapOption(root.addItem("Cache Size"), new CacheSizeOption()); mapOption(root.addItem("Hide Columns"), new HideColumnOption()); mapOption(root.addItem("Cross Page Selection"), new CrossPageSelectionOption()); mapOption(root.addItem("Mode Selection"), new ModeSelectionOption()); } }
From source file:com.google.gwt.gen2.demo.scrolltable.client.ScrollTableDemo.java
License:Apache License
/** * Initialize the main menu./*w ww .j av a 2s . c o m*/ * * @param menu the main menu */ protected void initOptions(Tree menu) { // Setup { TreeItem root = menu.addItem("ScrollTable setup"); mapOption(root.addItem("Resize Checking"), new ResizeCheckingOption()); mapOption(root.addItem("Scroll Policy"), new ScrollPolicyOption()); mapOption(root.addItem("Table Size"), new TableSizeOption()); } // Column Widths { TreeItem root = menu.addItem("Column Width"); mapOption(root.addItem("Table Resize Policy"), new TableResizePolicyOption()); mapOption(root.addItem("Column Resize Policy"), new ColumnResizePolicyOption()); mapOption(root.addItem("Resize Column"), new ResizeColumnOption()); mapOption(root.addItem("Cell Padding and Spacing"), new CellPaddingAndSpacingOption()); } // Highlighting { TreeItem root = menu.addItem("Highlighting & Selection"); mapOption(root.addItem("Row Selection Policy"), new RowSelectionPolicyOption()); } // Sorting { TreeItem root = menu.addItem("Column Sorting"); mapOption(root.addItem("Shift Rows"), new ShiftRowsOption()); mapOption(root.addItem("Swap Rows"), new SwapRowsOption()); mapOption(root.addItem("Sort Column"), new SortColumnOption()); } // Data Manipulation { TreeItem root = menu.addItem("Data Manipulation"); mapOption(root.addItem("Set Text"), new SetDataTextOption()); mapOption(root.addItem("Insert Row"), new InsertDataRowOption()); } // Header Manipulation { TreeItem root = menu.addItem("Header Manipulation"); mapOption(root.addItem("Set Text"), new SetHeaderTextOption()); mapOption(root.addItem("Insert Row"), new InsertHeaderRowOption()); mapOption(root.addItem("Set Row/ColSpan"), new ColSpanOption()); } // Log { mapOption(menu.addItem("Log"), new LogOption()); } }
From source file:com.google.gwt.maps.sample.hellomaps.client.InfoWindowDemo.java
License:Apache License
/** * Display one of the info Window test cases. *//*from w w w. j a va 2 s . c om*/ private void displayInfoWindow() { // pop down the existing info window. if (info != null) { info.close(); } info = map.getInfoWindow(); String selection = actionListBox.getItemText(actionListBox.getSelectedIndex()); if (selection == null) { return; } InfoWindowContent content; if (selection.equals(TEST_MAX_CONTENT)) { // Demonstrate the use of the maxTitle and maxContent properties HTML htmlWidget = new HTML( "<h1>ATTENTION PLEASE</h1>" + "<p> I have a few things to say to you (click maximize.)</p>"); content = new InfoWindowContent(htmlWidget); content.setMaxContent("<p>Now is the time for all good men to come to the" + " aid of their country because we hold these truths to be self" + " evident, that I have a dream, that one day our children and our" + " children's children will tear down this wall!</p>" + "<p>Now is the time for all good men to come to the" + " aid of their country because we hold these truths to be self" + " evident, that I have a dream, that one day our children and our" + " children's children will tear down this wall!</p>"); content.setMaxTitle("ATTENTION PLEASE"); } else if (selection.equals(TEST_IMAGE)) { // An image that isn't loaded yet doesn't work well sometimes // Specify the width and height to work around this. HTML htmlWidget = new HTML("<img src=\"boot.jpg\" width=\"235\" height=\"287\">"); content = new InfoWindowContent(htmlWidget); } else if (selection.equals(TEST_NO_CLICK)) { // Demonstrates setting the info window to stay "sticky" and not // automatically close when the user clicks on the maps window. HTML htmlWidget = new HTML("<h1>STICKY INFO WINDOW</h1>" + "<p> Click if you must, you won't get rid of me that easily.</p>"); content = new InfoWindowContent(htmlWidget); content.setNoCloseOnClick(true); } else if (selection.equals(TEST_TABS)) { // Display tabs in the InfoWindow content = displayInfoWindowTabs(); } else if (selection.equals(TEST_MAX_TITLE_CONTENT_WIDGET)) { // Display the maximized content using widgets instead of strings. content = displayInfoWindowMaxWidget(); } else if (selection.equals(TEST_MAP_BLOWUP)) { // Display a Map Blowup Window content = new InfoWindowContent.MapBlowupContent(); } else { // The default case Tree tree = new Tree(); TreeItem foo = new TreeItem("Foo"); tree.addItem(foo); TreeItem bar = new TreeItem("bar"); foo.addItem(bar); bar.addItem("baz"); bar.addItem("gwt"); // max-height must be set in advance so info window is sized appropriately tree.setSize("217px", "104px"); content = new InfoWindowContent(tree); } info.open(map.getCenter(), content); }