java类javax.swing.tree.TreeNode的实例源码

StateTree.java 文件源码 项目:JavaGraph 阅读 23 收藏 0 点赞 0 评论 0
private void maybeShowPopup(MouseEvent evt) {
    if (evt.isPopupTrigger()) {
        TreePath selectedPath = getPathForLocation(evt.getX(), evt.getY());
        TreeNode selectedNode =
            selectedPath == null ? null : (TreeNode) selectedPath.getLastPathComponent();
        StateTree.this.requestFocus();
        createPopupMenu(selectedNode).show(evt.getComponent(), evt.getX(), evt.getY());
    }
}
ComponentSelector.java 文件源码 项目:Logisim 阅读 18 收藏 0 点赞 0 评论 0
@Override
public int getIndex(TreeNode n) {
    for (int i = 0; i < opts.length; i++) {
        if (opts[i] == n)
            return i;
    }
    return -1;
}
VisualizerNodeTest.java 文件源码 项目:incubator-netbeans 阅读 20 收藏 0 点赞 0 评论 0
public void testIndexOfProvidesResultsEvenIfTheVisualizerIsComputedViaDifferentMeans() throws Exception {
    AbstractNode a = new AbstractNode(new Children.Array());
    AbstractNode m = new AbstractNode(Children.LEAF);
    a.getChildren().add(new Node[] { Node.EMPTY.cloneNode(), m, Node.EMPTY.cloneNode() });

    TreeNode ta = Visualizer.findVisualizer(a);
    TreeNode tm = Visualizer.findVisualizer(m);

    assertEquals("Index is 1", 1, ta.getIndex(tm));
}
FAdmin.java 文件源码 项目:sbc-qsystem 阅读 41 收藏 0 点赞 0 评论 0
/**
 * Из привязок к услугам всех юзеров убрать привязку к данной услуге и всех ее вложенных.
 *
 * @param service удаляемая услуга
 */
private void deleteServicesFromUsers(QService service) {

    QServiceTree.sailToStorm(service, (TreeNode service1) -> {
        deleteServiceFromUsers((QService) service1);
    });
}
SimulationTreeModel.java 文件源码 项目:Logisim 阅读 17 收藏 0 点赞 0 评论 0
@Override
public int getChildCount(Object parent) {
    if (parent instanceof TreeNode) {
        return ((TreeNode) parent).getChildCount();
    } else {
        return 0;
    }
}
JCheckBoxTree.java 文件源码 项目:Cognizant-Intelligent-Test-Scripter 阅读 19 收藏 0 点赞 0 评论 0
protected void updatePredecessorsWithCheckMode(TreePath tp, boolean check) {
    TreePath parentPath = tp.getParentPath();
    // If it is the root, stop the recursive calls and return
    if (parentPath == null) {
        return;
    }
    CheckedNode parentCheckedNode = nodesCheckingState.get(parentPath);
    TreeNode parentNode = (TreeNode) parentPath.getLastPathComponent();
    parentCheckedNode.allChildrenSelected = true;
    parentCheckedNode.isSelected = false;
    for (int i = 0; i < getChildCount(parentNode); i++) {
        TreePath childPath = parentPath.pathByAddingChild(getChildAt(parentNode, i));
        CheckedNode childCheckedNode = nodesCheckingState.get(childPath);
        // It is enough that even one subtree is not fully selected
        // to determine that the parent is not fully selected
        if (!childCheckedNode.allChildrenSelected) {
            parentCheckedNode.allChildrenSelected = false;
        }
        // If at least one child is selected, selecting also the parent
        if (childCheckedNode.isSelected) {
            parentCheckedNode.isSelected = true;
        }
    }
    if (parentCheckedNode.isSelected) {
        checkedPaths.add(parentPath);
    } else {
        checkedPaths.remove(parentPath);
    }
    // Go to upper predecessor
    updatePredecessorsWithCheckMode(parentPath, check);
}
ZooInspectorTreeViewer.java 文件源码 项目:fuck_zookeeper 阅读 21 收藏 0 点赞 0 评论 0
public TreeNode getChildAt(int childIndex) {
    String child = zooInspectorManager.getNodeChild(this.nodePath,
            childIndex);
    if (child != null) {
        return new ZooInspectorTreeNode((this.nodePath.equals("/") ? ""
                : this.nodePath)
                + "/" + child, this);
    }
    return null;
}
ExcludeDependencyPanel.java 文件源码 项目:incubator-netbeans 阅读 25 收藏 0 点赞 0 评论 0
private TreeNode createTransitiveDependenciesList() {
    DefaultMutableTreeNode root = new DefaultMutableTreeNode(null, true);
    Set<Artifact> artifacts = project.getArtifacts();
    Icon icn = ImageUtilities.image2Icon(ImageUtilities.loadImage(IconResources.TRANSITIVE_DEPENDENCY_ICON, true)); //NOI18N
    for (Artifact a : artifacts) {
        if (a.getDependencyTrail().size() > 2) {
            String label = a.getGroupId() + ":" + a.getArtifactId();
            root.add(new CheckNode(a, label, icn));
        }
    }
    return root;
}
XpathGenerator.java 文件源码 项目:Cognizant-Intelligent-Test-Scripter 阅读 18 收藏 0 点赞 0 评论 0
private static String getPosition(AndroidTreeNode node) {
    int count = 0;
    TreeNode parent = node.getParent();
    String nodeName = node.getClassName();
    for (int i = 0; i < parent.getChildCount(); i++) {
        AndroidTreeNode currNode = (AndroidTreeNode) parent.getChildAt(i);
        if (currNode.getClassName().equals(nodeName)) {
            count++;
            if (currNode.equals(node)) {
                return nodeName + "[" + count + "]";
            }
        }
    }
    return nodeName;
}
ComponentSelector.java 文件源码 项目:Logisim 阅读 17 收藏 0 点赞 0 评论 0
public CircuitNode(CircuitNode parent, CircuitState circuitState, Component subcircComp) {
    this.parent = parent;
    this.circuitState = circuitState;
    this.subcircComp = subcircComp;
    this.children = new ArrayList<TreeNode>();
    circuitState.getCircuit().addCircuitListener(this);
    computeChildren();
}


问题


面经


文章

微信
公众号

扫码关注公众号