private CheckBoxNode getCheckBoxNode(TreePath path) { Object value = path.getLastPathComponent(); Object userObject = null; if (value != null && value instanceof DefaultMutableTreeNode) { userObject = ((DefaultMutableTreeNode) value).getUserObject(); } if (value != null && value instanceof TreeList.Node) { userObject = ((TreeList.Node) value).getElement(); } if (userObject != null && userObject instanceof CheckBoxNode) { return (CheckBoxNode) userObject; } return null; }
userObject = ((TreeList.Node) value).getElement();
setVisible(descendent, true); int insertIndex = data.indexOfNode(descendent.element, VISIBLE_NODES); updates.elementInserted(insertIndex, descendent.getElement()); updates.elementDeleted(deleteIndex, descendent.getElement()); setVisible(descendent, false);
setVisible(descendent, true); int insertIndex = data.indexOfNode(descendent.element, VISIBLE_NODES); updates.elementInserted(insertIndex, descendent.getElement()); updates.elementDeleted(deleteIndex, descendent.getElement()); setVisible(descendent, false);
setVisible(descendent, true); int insertIndex = data.indexOfNode(descendent.element, VISIBLE_NODES); updates.elementInserted(insertIndex, descendent.getElement()); updates.elementDeleted(deleteIndex, descendent.getElement()); setVisible(descendent, false);
/** master Constructor */ private TreeList(InitializationData<E> initializationData) { super(initializationData.getSource()); this.format = initializationData.format; this.nodeComparator = initializationData.nodeComparator; this.expansionModel = initializationData.expansionModel; this.initializationData = initializationData; // insert the new elements like they were adds NodeAttacher nodeAttacher = new NodeAttacher(false); for(int i = 0; i < super.source.size(); i++) { Node<E> node = super.source.get(i); node.expanded = expansionModel.isExpanded(node.getElement(), node.path); addNode(node, HIDDEN_REAL, i); nodeAttacher.nodesToAttach.queueNewNodeForInserting(node); } // attach siblings and parent nodes nodeAttacher.attachAll(); assert(isValid()); source.addListEventListener(this); }
/** master Constructor */ private TreeList(InitializationData<E> initializationData) { super(initializationData.getSource()); this.format = initializationData.format; this.nodeComparator = initializationData.nodeComparator; this.expansionModel = initializationData.expansionModel; this.initializationData = initializationData; // insert the new elements like they were adds NodeAttacher nodeAttacher = new NodeAttacher(false); for(int i = 0; i < super.source.size(); i++) { Node<E> node = super.source.get(i); node.expanded = expansionModel.isExpanded(node.getElement(), node.path); addNode(node, HIDDEN_REAL, i); nodeAttacher.nodesToAttach.queueNewNodeForInserting(node); } // attach siblings and parent nodes nodeAttacher.attachAll(); assert(isValid()); source.addListEventListener(this); }
/** master Constructor */ private TreeList(InitializationData<E> initializationData) { super(initializationData.getSource()); this.format = initializationData.format; this.nodeComparator = initializationData.nodeComparator; this.expansionModel = initializationData.expansionModel; this.initializationData = initializationData; // insert the new elements like they were adds NodeAttacher nodeAttacher = new NodeAttacher(false); for(int i = 0; i < super.source.size(); i++) { Node<E> node = super.source.get(i); node.expanded = expansionModel.isExpanded(node.getElement(), node.path); addNode(node, HIDDEN_REAL, i); nodeAttacher.nodesToAttach.queueNewNodeForInserting(node); } // attach siblings and parent nodes nodeAttacher.attachAll(); assert(isValid()); source.addListEventListener(this); }
/** * Delete the actual node, without unlinking children or unlinking siblings, * which must be handled externally. */ private void deleteNode(Node<E> node) { // remove links to this node from siblings node.detachSiblings(); boolean visible = node.isVisible(); if(visible) { int viewIndex = data.indexOfNode(node.element, VISIBLE_NODES); updates.elementDeleted(viewIndex, node.getElement()); } data.remove(node.element); node.element = null; // null out the element }
/** * Delete the actual node, without unlinking children or unlinking siblings, * which must be handled externally. */ private void deleteNode(Node<E> node) { // remove links to this node from siblings node.detachSiblings(); boolean visible = node.isVisible(); if(visible) { int viewIndex = data.indexOfNode(node.element, VISIBLE_NODES); updates.elementDeleted(viewIndex, node.getElement()); } data.remove(node.element); node.element = null; // null out the element }
/** * Delete the actual node, without unlinking children or unlinking siblings, * which must be handled externally. */ private void deleteNode(Node<E> node) { // remove links to this node from siblings node.detachSiblings(); boolean visible = node.isVisible(); if(visible) { int viewIndex = data.indexOfNode(node.element, VISIBLE_NODES); updates.elementDeleted(viewIndex, node.getElement()); } data.remove(node.element); node.element = null; // null out the element }
/** * Control whether the child elements of the specified node are visible. * * @param expanded <code>true</code> to expand the node, <code>false</code> * to collapse it. */ public void setExpanded(int visibleIndex, boolean expanded) { Node<E> toExpand = data.get(visibleIndex, VISIBLE_NODES).get(); expansionModel.setExpanded(toExpand.getElement(), toExpand.path, expanded); setExpanded(toExpand, expanded); assert(isValid()); }
/** {@inheritDoc} */ @Override public E get(int visibleIndex) { return getTreeNode(visibleIndex).getElement(); }
/** * Control whether the child elements of the specified node are visible. * * @param expanded <code>true</code> to expand the node, <code>false</code> * to collapse it. */ public void setExpanded(int visibleIndex, boolean expanded) { Node<E> toExpand = data.get(visibleIndex, VISIBLE_NODES).get(); expansionModel.setExpanded(toExpand.getElement(), toExpand.path, expanded); setExpanded(toExpand, expanded); assert(isValid()); }
/** * Control whether the child elements of the specified node are visible. * * @param expanded <code>true</code> to expand the node, <code>false</code> * to collapse it. */ public void setExpanded(int visibleIndex, boolean expanded) { Node<E> toExpand = data.get(visibleIndex, VISIBLE_NODES).get(); expansionModel.setExpanded(toExpand.getElement(), toExpand.path, expanded); setExpanded(toExpand, expanded); assert(isValid()); }
/** {@inheritDoc} */ @Override public E get(int visibleIndex) { return getTreeNode(visibleIndex).getElement(); }
/** {@inheritDoc} */ @Override public E get(int visibleIndex) { return getTreeNode(visibleIndex).getElement(); }