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

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

Introduction

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

Prototype

public void setWidget(Widget widget) 

Source Link

Usage

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();//from  ww  w. j a  v  a2 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

                    }// ww w.j  ava2  s.  com

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

                    }

                });
    }
}