private static boolean testNodeInRow(Outline outline, Node node, int i) { int modelIndex = outline.convertRowIndexToModel(i); if (modelIndex != -1) { Object o = outline.getModel().getValueAt(modelIndex, 0); Node n = Visualizer.findNode(o); if (n == node) { return true; } } return false; }
public Node nodeForRow(int row) { int r = outline.convertRowIndexToModel(row); TreePath tp = outline.getLayoutCache().getPathForRow(r); return Visualizer.findNode(tp.getLastPathComponent()); } public String getShortDescription(int column) {
@Override public Node nodeForRow(int row) { int r = outline.convertRowIndexToModel(row); TreePath tp = outline.getLayoutCache().getPathForRow(r); return Visualizer.findNode(tp.getLastPathComponent()); }
@Override public void mouseClicked(MouseEvent e) { if (SwingUtilities.isLeftMouseButton(e) && MouseUtils.isDoubleClick(e)) { int row = view.getOutline().rowAtPoint(e.getPoint()); if (row == -1) return; T n = convertNode(getNodeAt(view.getOutline().convertRowIndexToModel(row))); if (n != null) { Action action = n.getNodeAction(); if (action != null && action.isEnabled()) { action.actionPerformed(new ActionEvent(this, ActionEvent.ACTION_PERFORMED, "")); // NOI18N e.consume(); } } } }
private static Node[] getChildrenInDisplayedOrder(Node parent, OutlineView outlineView) { Outline outline = outlineView.getOutline(); Node[] unsortedChildren = parent.getChildren().getNodes(true); int rows = outlineView.getOutline().getRowCount(); int start = findRowIndexInOutline(parent, outline, rows); if (start == -1 && parent != ExplorerManager.find(outlineView).getRootContext()) { return unsortedChildren; } List<Node> children = new LinkedList<Node>(); for (int j = start + 1; j < rows; j++) { int childModelIndex = outline.convertRowIndexToModel(j); if (childModelIndex == -1) { continue; } Object childObject = outline.getModel().getValueAt( childModelIndex, 0); Node childNode = Visualizer.findNode(childObject); if (childNode.getParentNode() == parent) { children.add(childNode); } else if (children.size() == unsortedChildren.length) { break; } } return children.toArray(new Node[children.size()]); }
@Override public T getNodeAtPosition (int position) { for (int i = 0; i < view.getOutline().getRowCount(); ++i) { Node n = getNodeAt(view.getOutline().convertRowIndexToModel(i)); T converted = convertNode(n); if (converted != null) { if (position-- == 0) { return converted; } } } return null; }
/** * @see java.awt.event.MouseAdapter#mouseClicked(java.awt.event.MouseEvent) */ @Override public void mouseClicked(MouseEvent e) { Point mousePoint = e.getPoint(); int colIndex = resultsOutline.columnAtPoint(mousePoint); int rowIndex = resultsOutline.rowAtPoint(mousePoint); int colModelIndex = resultsOutline.convertColumnIndexToModel(resultsOutline.columnAtPoint(mousePoint)); if (colModelIndex == OutlineColumn.IDENTIFICATION_COUNT.ordinal() + 1) { DirectoryComparableLong count = (DirectoryComparableLong) resultsOutline .getValueAt(rowIndex, colIndex); if (count != null && count.getSource() != null && count.getSource() > 1) { int rowModelIndex = resultsOutline.convertRowIndexToModel(rowIndex); DefaultMutableTreeNode treeNode = (DefaultMutableTreeNode) mdl.getValueAt(rowModelIndex, 0); ProfileResourceNode node = (ProfileResourceNode) treeNode.getUserObject(); multiIdentificationDialog.showDialog(node); } } } }
protected void configureTreeCellEditor( Component editor, int row, int column ) { if( !(editor instanceof JComponent) ) { return; } TreeCellEditorBorder b = new TreeCellEditorBorder(); TreePath path = getLayoutCache().getPathForRow(convertRowIndexToModel(row)); Object o = getValueAt(row, column); RenderDataProvider rdp = getRenderDataProvider(); b.icon = rdp.getIcon(o); b.nestingDepth = Math.max( 0, path.getPathCount() - (isRootVisible() ? 1 : 2) ); b.isLeaf = getOutlineModel().isLeaf(o); b.isExpanded = getLayoutCache().isExpanded(path); ((JComponent)editor).setBorder(b); }
/** * @see java.awt.event.MouseAdapter#mouseClicked(java.awt.event.MouseEvent) */ @Override public void mouseClicked(MouseEvent e) { Point mousePoint = e.getPoint(); int colIndex = resultsOutline.columnAtPoint(mousePoint); int rowIndex = resultsOutline.rowAtPoint(mousePoint); int colModelIndex = resultsOutline.convertColumnIndexToModel(resultsOutline.columnAtPoint(mousePoint)); if (colModelIndex == OutlineColumn.IDENTIFICATION_COUNT.ordinal() + 1) { DirectoryComparableLong count = (DirectoryComparableLong) resultsOutline .getValueAt(rowIndex, colIndex); if (count != null && count.getSource() != null && count.getSource() > 1) { int rowModelIndex = resultsOutline.convertRowIndexToModel(rowIndex); DefaultMutableTreeNode treeNode = (DefaultMutableTreeNode) mdl.getValueAt(rowModelIndex, 0); ProfileResourceNode node = (ProfileResourceNode) treeNode.getUserObject(); multiIdentificationDialog.showDialog(node); } } } }
TreePath path = getLayoutCache().getPathForRow(convertRowIndexToModel(row)); if (!getOutlineModel().isLeaf(path.getLastPathComponent())) { int handleWidth = DefaultOutlineCellRenderer.getExpansionHandleWidth();
view.getOutline().convertRowIndexToModel(row)); if (LOGABLE) { log("tp == " + tp); //NOI18N view.getOutline().convertRowIndexToModel(row)); if( null != path ) { TreePath parentPath = path.getParentPath(); view.getOutline().convertRowIndexToModel(row)); boolean expanded = view.getOutline().getLayoutCache().isExpanded(path); if (
if (tbl.isTreeColumnIndex(column)) { AbstractLayoutCache layout = tbl.getLayoutCache(); row = tbl.convertRowIndexToModel(row); boolean leaf = tbl.getOutlineModel().isLeaf(value); setLeaf(leaf);