Example usage for com.google.gwt.user.cellview.client TreeNode isChildOpen

List of usage examples for com.google.gwt.user.cellview.client TreeNode isChildOpen

Introduction

In this page you can find the example usage for com.google.gwt.user.cellview.client TreeNode isChildOpen.

Prototype

boolean isChildOpen(int index);

Source Link

Document

Check whether or not a child node is open.

Usage

From source file:com.google.code.tree.client.UpdatableTreeModel.java

License:Apache License

private NodeChildToClose searchTreeNode(TreeNode parent, UpdatableTreeNode nodeToCheck) {
    int childCount = parent.getChildCount();
    for (int idx = 0; idx < childCount; idx++) {
        boolean leaveOpen = parent.isChildOpen(idx);
        TreeNode node = parent.setChildOpen(idx, true, false);
        if (!leaveOpen)
            parent.setChildOpen(idx, false, false);
        if (node != null) {
            UpdatableTreeNode utn = (UpdatableTreeNode) node.getValue();
            NodeChildToClose nctc = null;
            if (nodeToCheck.getParent() == utn) {
                nctc = new NodeChildToClose();
                nctc.node = parent;//from   ww w.j  av  a 2s  .c o m
                nctc.childIndex = idx;
                return nctc;
            } else {
                if (node.getChildCount() > 0) {
                    nctc = searchTreeNode(node, nodeToCheck);
                    if (nctc != null)
                        return nctc;
                }
            }
        }
    }
    return null;
}

From source file:org.gss_project.gss.web.client.CellTreeViewUtils.java

License:Open Source License

private void refreshNodeContainingResource(TreeNode node, RestResource resource) {
    int count = node.getChildCount();
    for (int i = 0; i < count; i++) {
        if (node.getChildValue(i).equals(resource)) {
            if (node.getChildValue(i) instanceof RestResourceWrapper
                    && ((RestResourceWrapper) node.getChildValue(i)).getResource().getFolders().size() == 0)
                return;
            node.setChildOpen(i, false, true);
            node.setChildOpen(i, true, true);
            return;
        } else if (node.isChildOpen(i)) {
            TreeNode n = node.setChildOpen(i, true);
            if (n != null)
                refreshNodeContainingResource(n, resource);
        }//from w w  w.  j a  va 2s.  c o m
    }

}

From source file:org.gss_project.gss.web.client.CellTreeViewUtils.java

License:Open Source License

void refreshNodeContainingResource(TreeNode node, String uri) {
    int count = node.getChildCount();
    for (int i = 0; i < count; i++) {
        if (node.isChildOpen(i)) {
            if (node.getChildValue(i) instanceof RestResource
                    && ((RestResource) node.getChildValue(i)).getUri().equals(uri)) {
                if (node.getChildValue(i) instanceof RestResourceWrapper
                        && ((RestResourceWrapper) node.getChildValue(i)).getResource().getFolders().size() == 0)
                    return;
                node.setChildOpen(i, false, true);
                node.setChildOpen(i, true, true);
                return;
            } else {
                TreeNode n = node.setChildOpen(i, true);
                if (n != null)
                    refreshNodeContainingResource(n, uri);
            }//from  www .  j a  v  a 2s.  co m
        }
    }
}

From source file:org.gss_project.gss.web.client.CellTreeViewUtils.java

License:Open Source License

private void openNodeContainingResource(TreeNode node, RestResource resource) {
    int count = node.getChildCount();
    for (int i = 0; i < count; i++) {

        if (node.getChildValue(i).equals(resource)) {
            if (node.getChildValue(i) instanceof RestResourceWrapper
                    && ((RestResourceWrapper) node.getChildValue(i)).getResource().getFolders().size() == 0)
                return;
            node.setChildOpen(i, true, true);
            return;
        } else {//  w  w w .j  a va 2s . co m
            if (node.isChildOpen(i)) {
                TreeNode n = node.setChildOpen(i, true);
                if (n != null)
                    openNodeContainingResource(n, resource);
            }
        }

    }
}

From source file:org.gss_project.gss.web.client.CellTreeViewUtils.java

License:Open Source License

private void openNodeContainingResource(TreeNode node, RestResource resource, RefreshHandler handler) {
    int count = node.getChildCount();
    for (int i = 0; i < count; i++) {
        if (node.getChildValue(i).equals(resource)) {
            if (node.getChildValue(i) instanceof RestResourceWrapper
                    && ((RestResourceWrapper) node.getChildValue(i)).getResource().getFolders().size() == 0)
                return;
            //node.setChildOpen(i, false, true);
            node.setChildOpen(i, true, true);
            handler.onRefresh();//from  w w  w .  j a  v a  2  s .  c o  m
            return;
        } else {
            if (node.isChildOpen(i)) {
                TreeNode n = node.setChildOpen(i, true);
                if (n != null)
                    openNodeContainingResource(n, resource, handler);
            }
        }

    }
}

From source file:org.gss_project.gss.web.client.CellTreeViewUtils.java

License:Open Source License

public boolean doesNodeContainsResource(TreeNode node, RestResource resource) {
    int count = node.getChildCount();
    for (int i = 0; i < count; i++) {
        if (node.isChildOpen(i)) {
            if (node.getChildValue(i) instanceof RestResource
                    && ((RestResource) node.getChildValue(i)).equals(resource)) {
                return true;
            } else if (node.isChildOpen(i)) {
                TreeNode n = node.setChildOpen(i, true);
                if (n != null)
                    return doesNodeContainsResource(n, resource);
            }// w ww .j a v a  2 s .  c o  m
        }
    }
    return false;
}

From source file:org.gss_project.gss.web.client.CellTreeViewUtils.java

License:Open Source License

public boolean doesNodeContainsResource(TreeNode node, String resource) {
    int count = node.getChildCount();
    for (int i = 0; i < count; i++) {

        if (node.getChildValue(i) instanceof RestResource
                && ((RestResource) node.getChildValue(i)).getUri().equals(resource)) {
            return true;
        } else if (node.isChildOpen(i)) {
            TreeNode n = node.setChildOpen(i, true);
            if (n != null)
                return doesNodeContainsResource(n, resource);
        }//from   w w w  .  j a  v  a  2s.c o m

    }
    return false;
}

From source file:org.gss_project.gss.web.client.CellTreeViewUtils.java

License:Open Source License

public TreeNode getNodeContainingResource(TreeNode node, RestResource resource) {
    int count = node.getChildCount();
    for (int i = 0; i < count; i++) {

        if (node.getChildValue(i) instanceof RestResource
                && ((RestResource) node.getChildValue(i)).getUri().equals(resource.getUri())) {
            return node;
        } else if (node.isChildOpen(i)) {
            TreeNode n = node.setChildOpen(i, true);
            if (n != null)
                return getNodeContainingResource(n, resource);
        }/*from   ww w  .  j  ava  2 s.  co  m*/

    }
    return null;
}

From source file:org.gss_project.gss.web.client.CellTreeViewUtils.java

License:Open Source License

public TreeNode getNodeContainingResource(TreeNode node, String resource) {
    if (node == null)
        return null;
    int count = node.getChildCount();
    for (int i = 0; i < count; i++) {

        if (node.getChildValue(i) instanceof RestResource
                && ((RestResource) node.getChildValue(i)).getUri().equals(resource)) {
            return node;
        } else if (node.isChildOpen(i)) {
            TreeNode n = node.setChildOpen(i, true);
            if (n != null) {
                TreeNode result = getNodeContainingResource2(n, resource);
                if (result != null)
                    return result;
            }//from w  ww.j a  va 2s.c om
        }

    }
    return null;
}

From source file:org.gss_project.gss.web.client.CellTreeViewUtils.java

License:Open Source License

public TreeNode getNodeContainingResource2(TreeNode node, String resource) {
    if (node == null)
        return null;
    int count = node.getChildCount();
    for (int i = 0; i < count; i++) {
        if (node.getChildValue(i) instanceof RestResource
                && ((RestResource) node.getChildValue(i)).getUri().equals(resource)) {
            return node.setChildOpen(i, node.isChildOpen(i));
        } else if (node.isChildOpen(i)) {
            TreeNode n = node.setChildOpen(i, true);
            if (n != null) {
                TreeNode result = getNodeContainingResource2(n, resource);
                if (result != null)
                    return result;
            }/*from w w  w  .  jav  a 2s.  co m*/
        }

    }
    return null;
}