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

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

Introduction

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

Prototype

public FastTree() 

Source Link

Document

Constructs a tree.

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 w ww. j a v  a2  s. co  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 + "");
    }/* w  w  w.j  av a2s. 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

/**
 * Creates a lazy tree.
 */
protected Widget lazyTree() {
    FastTree t = new FastTree();
    lazyCreateChild(t, 0, 50);
    return t;
}

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

License:Apache License

protected Widget profileTree() {
    final FlexTable table = new FlexTable();
    final TextBox branches = new TextBox();
    int row = 0;//  w w w .jav a  2s .c  o  m
    table.setText(row, 0, "children per node");
    table.setText(row, 1, "total number of rows");
    table.setText(row, 2, "what type of node");
    ++row;
    table.setWidget(row, 0, branches);
    branches.setText("5");
    final TextBox nodes = new TextBox();

    table.setWidget(row, 1, nodes);
    nodes.setText("2000");
    table.setTitle("Number of nodes");

    final ListBox type = new ListBox();
    type.addItem("Text");
    type.addItem("HTML");
    type.addItem("CheckBox");
    type.setSelectedIndex(1);
    table.setWidget(row, 2, type);
    ++row;
    final int widgetRow = row + 1;
    table.setWidget(row, 0, new Button("Normal tree", new ClickListener() {
        public void onClick(Widget sender) {
            long time = System.currentTimeMillis();
            Tree t = new Tree();
            profileCreateTree(t, Integer.parseInt(branches.getText()), Integer.parseInt(nodes.getText()),
                    TreeType.getType(type.getSelectedIndex()));
            table.setWidget(widgetRow, 0, t);
            Window.alert("Elapsed time: " + (System.currentTimeMillis() - time));
        }
    }));

    table.setWidget(row, 1, new Button("Fast tree", new ClickListener() {
        public void onClick(Widget sender) {
            long time = System.currentTimeMillis();
            FastTree t = new FastTree();
            profileCreateTree(t, Integer.parseInt(branches.getText()), Integer.parseInt(nodes.getText()),
                    TreeType.getType(type.getSelectedIndex()));
            table.setWidget(widgetRow, 1, t);
            Window.alert("Elapsed time: " + (System.currentTimeMillis() - time));
        }
    }));
    ++row;
    table.setText(row, 0, "tree results");
    table.getCellFormatter().setVerticalAlignment(row, 0, HasAlignment.ALIGN_TOP);

    table.setText(row, 1, "fasttree results");
    table.getCellFormatter().setVerticalAlignment(row, 1, HasAlignment.ALIGN_TOP);
    return table;
}

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

License:Apache License

protected Widget verboseTree() {
    FastTree tree = new FastTree();
    verboseTreeItem(tree, 10);
    return tree;
}

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;//  w ww .j  a va2  s. com

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