Example usage for com.google.gwt.gen2.complexpanel.client FastTreeItem becomeInteriorNode

List of usage examples for com.google.gwt.gen2.complexpanel.client FastTreeItem becomeInteriorNode

Introduction

In this page you can find the example usage for com.google.gwt.gen2.complexpanel.client FastTreeItem becomeInteriorNode.

Prototype

public void becomeInteriorNode() 

Source Link

Document

Become an interior node.

Usage

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

License:Apache License

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

    // Add Tree//from   w w  w .j av a2  s.c  o  m
    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);
    btnAdd.setVisible(false);

    container.add(btnKill);
    container.add(btnAdd);

    return container;
}

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

License:Apache License

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("? ");
    FastTreeItem secondBranch = firstBranch.addItem("");
    secondBranch.addItem(" ");

    return hebrewTree;
}

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

License:Apache License

private void lazyCreateChild(final HasFastTreeItems parent, final int index, final int children) {

    final FastTreeItem item = new FastTreeItem("child" + index + " (" + children + " children)");

    item.becomeInteriorNode();
    parent.addItem(item);//from w w w  . j a  v  a 2s  .c  om
}

From source file:org.pentaho.pat.client.ui.widgets.DimensionTreeWidget.java

License:Open Source License

private FastTreeItem createChildLabel(String name, String caption, ObjectType objecttype, boolean isuniquename,
        SimplePanelDragControllerImpl controller, boolean draggable) {

    FastTreeItem fti = new FastTreeItem();

    MeasureLabel label = new MeasureLabel(name, caption, objecttype, fti, isuniquename);

    label.setDragController(controller);

    if (draggable) {
        label.makeDraggable();/*w  w  w .  j  a va  2  s .  c  om*/
    }
    if (objecttype.equals(ObjectType.MEASURE) || objecttype.equals(ObjectType.MEMBER)) {
        fti.becomeLeaf();
    } else {
        fti.becomeInteriorNode();
    }
    fti.setWidget(label);
    return fti;

}

From source file:org.pentaho.pat.client.ui.widgets.DimensionTreeWidget.java

License:Open Source License

private void lazyCreateChild(final FastTreeItem parent, final int index, final int children) {

    for (IAxis.Standard axis : IAxis.Standard.values()) {
        ServiceFactory.getDiscoveryInstance().getDimensions(Pat.getSessionID(), Pat.getCurrQuery(), axis,
                new AsyncCallback<String[]>() {

                    public void onFailure(Throwable arg0) {
                        // TODO Auto-generated method stub

                    }//from   ww w.j av  a2  s .  co m

                    public void onSuccess(String[] arg0) {

                        for (int i = 0; i < arg0.length; i++) {
                            dimensionLocations.put(arg0[i], IAxis.UNUSED);
                            ArrayList<String> path = new ArrayList<String>();
                            path.add(arg0[i]);
                            MeasureLabel label;
                            final FastTreeItem item = new FastTreeItem();
                            if (arg0[i].equals("Measures")) {
                                label = new MeasureLabel(arg0[i], arg0[i], ObjectType.MEASURE, item,
                                        parentPanel.isUniqueNameLabel());
                            } else {
                                label = new MeasureLabel(arg0[i], arg0[i], ObjectType.DIMENSION, item,
                                        parentPanel.isUniqueNameLabel());
                            }
                            label.setDragController(dragController);
                            label.makeDraggable();
                            item.setWidget(label);
                            item.becomeInteriorNode();
                            parent.addItem(item);
                        }

                    }

                });
    }
}