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

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

Introduction

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

Prototype

public FastTreeItem addItem(Widget widget) 

Source Link

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);//from  ww  w . j a  v a 2s .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. ja  va2s.co  m
    widgetBranch.addItem("A ListBox parent").addItem(lb);
    return t;
}

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

License:Apache License

protected Widget stubbornTree() {
    StubbornTree t = new StubbornTree();
    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 + "");
    }/*  www. j a v  a  2 s.  c  o  m*/
    widgetBranch.addItem("A ListBox parent").addItem(lb);
    return t;
}

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

License:Apache License

private FastTreeItem profileAdd(FastTreeItem parent, TreeType type) {
    if (type == TreeType.TEXT) {
        FastTreeItem text = new FastTreeItem();
        text.setText("item");
        parent.addItem(text);
        return text;
    } else if (type == TreeType.HTML) {
        FastTreeItem item = new FastTreeItem("<h1>html</h1>");
        parent.addItem(item);//from   w ww. j  a  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.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  va  2 s.  c o m*/

    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;
}