Package com.google.gwt.gen2.complexpanel.client

Examples of com.google.gwt.gen2.complexpanel.client.FastTree


      Panel contents = createSchoolNavBar();
      FastTree.injectDefaultCss();
      CollapsiblePanel.injectDefaultCss();

      // The panel.
      final CollapsiblePanel panel = new CollapsiblePanel();
      panel.addCollapsedStateHandler(new CollapsedStateHandler() {
        public void onCollapsedState(CollapsedStateEvent e) {
          Window.alert("panel collapsed");
        }
      });

      panel.addExpandedStateHandler(new ExpandedStateHandler() {
        public void onExpandedState(ExpandedStateEvent e) {
          Window.alert("panel expanded");
        }
      });

      String value = Location.getParameter("collapsed");
      if (value != null) {
        value = value.trim();
        if (value.equals("true")) {
          panel.setCollapsedState(true);
        } else if (value.equals("false")) {
          // do nothing, default.
        } else {
          Window.alert("collapsed should not be given " + value
              + " use true or false instead");
        }
      }
      RootPanel.get("collapsible-panel").add(panel);
      panel.add(contents);
      panel.setHeight(Window.getClientHeight() - 1 + "px");
      panel.hookupControlToggle(controlButton);
    } catch (RuntimeException e) {
      if (GWT.isScript()) {
        Log.severe(e.getMessage());
      }
      throw e;
View Full Code Here


      FastTree.injectDefaultCss();
      CollapsiblePanel.injectDefaultCss();

      // The panel.
      final CollapsiblePanel panel = new CollapsiblePanel();
      panel.addCollapsedStateHandler(new CollapsedStateHandler() {
        public void onCollapsedState(CollapsedStateEvent e) {
          Window.alert("panel collapsed");
        }
      });
View Full Code Here

        public void onCollapsedState(CollapsedStateEvent e) {
          Window.alert("panel collapsed");
        }
      });

      panel.addExpandedStateHandler(new ExpandedStateHandler() {
        public void onExpandedState(ExpandedStateEvent e) {
          Window.alert("panel expanded");
        }
      });
View Full Code Here

    navBar.setSize("200px", "");

    navBar.add(controlButton);
    controlButton.setStylePrimaryName("CollapsibleTitle");

    final FastTree contents = new FastTree();
    navBar.add(contents);

    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;
  }
View Full Code Here

  public void onModuleLoad() {
    RootPanel.get().add(new FastTreeDemo().createDemo());
  }

  protected Widget basicTree() {
    FastTree t = new FastTree();
    FastTreeItem a = t.addItem("A root tree item");
    a.addItem("A child with different style");
    a.addItem("regular style");
    FastTreeItem aXb = a.addItem("Another child");
    aXb.addItem("a grand child");
    FastTreeItem widgetBranch = a.addItem(new CheckBox("A checkbox child"));
View Full Code Here

  /**
   * Creates a lazy tree.
   */
  protected Widget lazyTree() {
    final FastTree t = new FastTree();
    lazyCreateChild(t, 0, 50);
    t.addBeforeOpenHandler(new BeforeOpenHandler<FastTreeItem>() {
      public void onBeforeOpen(BeforeOpenEvent<FastTreeItem> event) {
        if (event.isFirstTime()) {
          for (int i = 0; i < 50; i++) {
            lazyCreateChild(event.getTarget(), i, 50 + (i * 10));
          }
View Full Code Here

    });
    return t;
  }

  protected Widget verboseTree() {
    FastTree tree = new FastTree();
    verboseTreeItem(tree, 10);
    tree.addOpenHandler(new OpenHandler<FastTreeItem>() {

      public void onOpen(OpenEvent<FastTreeItem> event) {
        Window.alert("Opened " + event.getTarget().getHTML());
      }
    });
    tree.addCloseHandler(new CloseHandler<FastTreeItem>() {

      public void onClose(CloseEvent<FastTreeItem> event) {
        Window.alert("Close " + event.getTarget().getHTML());
      }
    });
    tree.addSelectionHandler(new SelectionHandler<FastTreeItem>() {

      public void onSelection(SelectionEvent<FastTreeItem> event) {
        Window.alert("You selected " + event.getSelectedItem().getHTML());
      }
    });
    tree.addBeforeOpenHandler(new BeforeOpenHandler<FastTreeItem>() {

      public void onBeforeOpen(BeforeOpenEvent<FastTreeItem> event) {
        if (Window.confirm("Would you like to change the name of the item before opening it?")) {
          event.getTarget().setHTML("Name changed before open.");
        }
      }
    });
    tree.addBeforeCloseHandler(new BeforeCloseHandler<FastTreeItem>() {

      public void onBeforeClose(BeforeCloseEvent<FastTreeItem> event) {
        if (Window.confirm("Would you like to change the name of the item before closing it?")) {
          event.getTarget().setHTML("Name changed before close.");
        }
View Full Code Here

    });
    return tree;
  }

  private Widget crazyTree() {
    FastTree tree = new FastTree();
    FastTreeItem a = tree.addItem("I am root");
    a.addItem("I am root's child");
    FastTreeItem aXb = a.addItem("Root to become leaf.");
    aXb.addItem("a grand child");
    for (int i = 0; i < 10; i++) {
      aXb.addItem("grand child " + i);
    }
    tree.addOpenHandler(new OpenHandler<FastTreeItem>() {

      public void onOpen(OpenEvent<FastTreeItem> event) {
        if (!event.getTarget().isLeafNode()) {
          if (Window.confirm("Would you like me to become a leaf?")) {
            event.getTarget().becomeLeaf();
View Full Code Here

  private Widget dynamicTree() {
    FlowPanel container = new FlowPanel();

    // Add Tree
    final FastTree topTree = new FastTree();
    FastTreeItem firstBranch = topTree.addItem("Inbox (3)");
    firstBranch.addItem("Urgent");
    FastTreeItem familyBranch = firstBranch.addItem("Family");
    familyBranch.becomeInteriorNode();
    familyBranch.addItem("Mom");
    familyBranch.addItem("Brosef");
    FastTreeItem secondBranch = firstBranch.addItem("Calendar");
    secondBranch.addItem("Important Meetings");
    container.add(topTree);

    final Button btnAdd = new Button("Add to Family Branch",
        new ClickHandler() {

          public void onClick(ClickEvent event) {
            FastTreeItem selectedItem = topTree.getChild(0).getChild(1);
            Window.alert("Adding new " + selectedItem.getText()
                + " Child Nodes");
            selectedItem.addItem("Dad");
            selectedItem.addItem("Sissef");
          }
        });

    final Button btnKill = new Button("Disown Family Branch",
        new ClickHandler() {

          public void onClick(ClickEvent event) {
            FastTreeItem selectedItem = topTree.getChild(0).getChild(1);
            Window.alert("Disowning " + selectedItem.getText() + " Child Nodes");
            selectedItem.becomeLeaf();
            btnAdd.setVisible(true);
          }
        });

    topTree.addBeforeCloseHandler(new BeforeCloseHandler<FastTreeItem>() {
      public void onBeforeClose(BeforeCloseEvent<FastTreeItem> event) {
        btnKill.setVisible(event.getTarget().getText().equals("Family"));
      }
    });
    btnKill.setVisible(false);
View Full Code Here

    return container;
  }

  private Widget hebrewTree() {
    final FastTree hebrewTree = new FastTree();
    FastTreeItem firstBranch = hebrewTree.addItem("דואר נכנס (3)");
    firstBranch.addItem("דחוף");
    FastTreeItem familyBranch = firstBranch.addItem("משפחה");
    familyBranch.becomeInteriorNode();
    familyBranch.addItem("אמא");
    familyBranch.addItem("אח שלו");
View Full Code Here

TOP

Related Classes of com.google.gwt.gen2.complexpanel.client.FastTree

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.