Example usage for com.google.gwt.widgetideas.client FastTree addItem

List of usage examples for com.google.gwt.widgetideas.client FastTree addItem

Introduction

In this page you can find the example usage for com.google.gwt.widgetideas.client FastTree addItem.

Prototype

public FastTreeItem addItem(Widget widget) 

Source Link

Document

Adds a new tree item containing the specified widget.

Usage

From source file:com.google.gwt.demos.fasttree.client.FastTreeDemo.java

License:Apache License

public void store() {
    FastTree t = new FastTree();
    FastTreeItem camping = t.addItem("Camping Gear");
    camping.addItem("Camping tents");
    FastTreeItem cooking = camping.addItem("Cooking gear");
    camping.setState(true);/* w  ww .  j  a  v a  2  s.c  o  m*/

    t.setSelectedItem(cooking);

    FastTreeItem ap = t.addItem("Apparel");
    ap.addItem("Jackets");
    ap.addItem("Shirts");
    t.addItem("Footwear").becomeInteriorNode();
    t.addItem("Coolers");
    RootPanel.get().add(t);
}

From source file:com.google.gwt.demos.fasttree.client.FastTreeDemo.java

License:Apache License

protected Widget basicTree() {
    FastTree t = new FastTree();
    FastTreeItem a = t.addItem("A root tree item");
    a.addItem("A child");
    FastTreeItem aXb = a.addItem("Another child");
    aXb.addItem("a grand child");
    FastTreeItem widgetBranch = a.addItem(new CheckBox("A checkbox child"));
    FastTreeItem textBoxParent = widgetBranch.addItem("A TextBox parent");
    textBoxParent.addItem(new TextBox());
    textBoxParent.addItem("and another one...");
    textBoxParent.addItem(new TextArea());

    ListBox lb = new ListBox();
    for (int i = 0; i < 100; i++) {
        lb.addItem(i + "");
    }//from w  w w  . j  av  a  2 s. c  om
    widgetBranch.addItem("A ListBox parent").addItem(lb);
    return t;
}

From source file:com.google.gwt.demos.fasttree.client.FastTreeDemo.java

License:Apache License

private void profileCreateTree(FastTree t, int numBranches, int numNodes, TreeType type) {
    FastTreeItem root = t.addItem("root");
    ArrayList front = new ArrayList();
    front.add(profileAdd(root, type));/*from www .ja  v a 2  s .com*/
    int count = 0;
    while (true) {
        ArrayList newFront = new ArrayList();
        for (int i = 0; i < front.size(); i++) {
            for (int j = 0; j < numBranches; j++) {
                newFront.add(profileAdd((FastTreeItem) front.get(i), type));
                if (++count == numNodes) {
                    RootPanel.get().add(t);
                    return;
                }
            }
        }
        front = newFront;
    }
}

From source file:com.google.gwt.widgetideas.demo.collapsiblepanel.client.CollapsiblePanelDemo.java

License:Apache License

private Panel createSchoolNavBar() {
    ToggleButton toggler = new ToggleButton("Directory (click to pin)", "Directory (click to collapse)");
    toggler.setStyleName("CollapsibleToggle");
    controlButton = toggler;//  www.  ja va2s .  c  om

    MyStackPanel wrapper = new MyStackPanel();
    FlowPanel navBar = new FlowPanel();
    navBar.setSize("200px", "100%");

    HorizontalPanel panel = new HorizontalPanel();
    panel.setWidth("100%");

    panel.setCellHorizontalAlignment(controlButton, HasHorizontalAlignment.ALIGN_LEFT);

    panel.add(controlButton);
    panel.setCellWidth(controlButton, "1px");
    panel.setCellHorizontalAlignment(controlButton, HorizontalPanel.ALIGN_CENTER);

    navBar.add(panel);

    panel.setStyleName("nav-Tree-title");
    wrapper = new MyStackPanel();
    wrapper.setHeight("250px");

    final FastTree contents = new FastTree();
    wrapper.add(contents, "<b>People</b>", true);

    wrapper.add(new Label("None"), "<b>Academics</b>", true);
    navBar.add(wrapper);

    FastTreeItem students = contents.addItem("Students");
    students.addItem("Jill");
    students.addItem("Jack");
    students.addItem("Molly");
    students.addItem("Ms. Muffat");

    FastTreeItem teachers = contents.addItem("Teachers");
    teachers.addItem("Mrs Black");
    teachers.addItem("Mr White");

    FastTreeItem admin = contents.addItem("Administrators");
    admin.addItem("The Soup Nazi");
    admin.addItem("The Grand High Supreme Master Pubba");
    return navBar;
}