org.openide.nodes.Node n = Visualizer.findNode (tree.getPathForRow(lastRow).getLastPathComponent()); if (n == null || !n.canRename ()) { TreePath path = tree.getPathForRow(TreeTable.this.rowAtPoint(me.getPoint())); Rectangle r = tree.getPathBounds(path); if ( me.getX() < r.x - positionX || me.getX() > r.x - positionX + r.width ) { me.translatePoint( r.x - me.getX(), 0 ); me.getY(), me.getClickCount(), me.isPopupTrigger()); TreeTable.this.tree.dispatchEvent(newME);
new TreeTableAction(tree.getActionMap().get("selectChild"), // NOI18N getActionMap().get("selectNextColumn"))); // NOI18N getActionMap().put("selectPreviousColumn", // NOI18N new TreeTableAction(tree.getActionMap().get("selectParent"), // NOI18N getActionMap().get("selectPreviousColumn"))); // NOI18N
public String getToolTipText(MouseEvent event) { if(event != null) { Point p = event.getPoint(); p.translate(positionX, visibleRow * getRowHeight()); int selRow = getRowForLocation(p.x, p.y); if(selRow != -1) { TreePath path = getPathForRow(selRow); VisualizerNode v = (VisualizerNode)path.getLastPathComponent(); String tooltip = v.getShortDescription(); String displayName = v.getDisplayName (); if ((tooltip != null) && !tooltip.equals (displayName)) return tooltip; } } return null; }
tree.scrollRectToVisible(tree.getRowBounds(row)); ignoreScrolling = false; } else {
tree.scrollRectToVisible(tree.getRowBounds(row)); ignoreScrolling = false; } else {
tree.scrollRectToVisible(tree.getRowBounds(row)); ignoreScrolling = false; } else {
new TreeTableAction(tree.getActionMap().get("selectChild"), // NOI18N getActionMap().get("selectNextColumn"))); // NOI18N getActionMap().put("selectPreviousColumn", // NOI18N new TreeTableAction(tree.getActionMap().get("selectParent"), // NOI18N getActionMap().get("selectPreviousColumn"))); // NOI18N
TreePath path = tree.getPathForRow(TreeTable.this.rowAtPoint(e.getPoint())); Rectangle r = tree.getPathBounds(path); if (e.getX() >= r.x - positionX && e.getX() <= r.x - positionX + r.width) { changeSelection = false;
TreePath path = tree.getPathForRow(TreeTable.this.rowAtPoint(e.getPoint())); Rectangle r = tree.getPathBounds(path); if (e.getX() >= r.x - positionX && e.getX() <= r.x - positionX + r.width) { changeSelection = false;
TreePath path = tree.getPathForRow(TreeTable.this.rowAtPoint(e.getPoint())); Rectangle r = tree.getPathBounds(path);
TreePath lastP = tree.getPathForRow(lastRow); if (lastP != null) { Node n = Visualizer.findNode (lastP.getLastPathComponent());
org.openide.nodes.Node n = Visualizer.findNode (tree.getPathForRow(lastRow).getLastPathComponent()); if (n == null || !n.canRename ()) { TreePath path = tree.getPathForRow(TreeTable.this.rowAtPoint(me.getPoint())); Rectangle r = tree.getPathBounds(path); if ( me.getX() < r.x - positionX || me.getX() > r.x - positionX + r.width ) { me.translatePoint( r.x - me.getX(), 0 ); me.getY(), me.getClickCount(), me.isPopupTrigger()); TreeTable.this.tree.dispatchEvent(newME);
"selectNextColumn", // NOI18N new TreeTableAction( tree.getActionMap().get("selectChild"), // NOI18N getActionMap().get("selectNextColumn") getActionMap().put( "selectPreviousColumn", // NOI18N new TreeTableAction(
TreePath lastP = tree.getPathForRow(lastRow); if (lastP != null) { Node n = Visualizer.findNode (lastP.getLastPathComponent());
public TreeTable(NodeTreeModel treeModel, NodeTableModel tableModel) { super(); setSurrendersFocusOnKeystroke(true); this.tree = new TreeTableCellRenderer(treeModel); this.tableModel = new TreeTableModelAdapter(tree, tableModel); tree.setCellRenderer(new NodeRenderer()); // Install a tableModel representing the visible rows in the tree. setModel(this.tableModel); // Force the JTable and JTree to share their row selection models. selectionWrapper = new ListToTreeSelectionModelWrapper(); tree.setSelectionModel(selectionWrapper); setSelectionModel(selectionWrapper.getListSelectionModel()); getTableHeader().setReorderingAllowed(false); // Install the tree editor renderer and editor. setDefaultRenderer(TreeTableModelAdapter.class, tree); // Install property renderer and editor. tableCell = new TableSheetCell(this.tableModel); tableCell.setFlat(true); setDefaultRenderer(Property.class, tableCell); setDefaultEditor(Property.class, tableCell); getTableHeader().setDefaultRenderer(tableCell); getAccessibleContext().setAccessibleName(NbBundle.getMessage(TreeTable.class, "ACSN_TreeTable")); // NOI18N getAccessibleContext().setAccessibleDescription( // NOI18N NbBundle.getMessage(TreeTable.class, "ACSD_TreeTable")); // NOI18N setFocusCycleRoot(true); setFocusTraversalPolicy(new STPolicy()); putClientProperty("terminateEditOnFocusLost", Boolean.TRUE); putClientProperty("JTable.autoStartsEdit", Boolean.FALSE); initKeysAndActions(); }
this.tree = new TreeTableCellRenderer(treeModel); this.tableModel = new TreeTableModelAdapter(tree, tableModel); tree.setCellRenderer(new NodeRenderer()); tree.setSelectionModel(selectionWrapper); setSelectionModel(selectionWrapper.getListSelectionModel()); getTableHeader().setReorderingAllowed(false);
public boolean isCellEditable(EventObject e) { if (lastRow != -1) { TreePath tp = tree.getPathForRow(lastRow); org.openide.nodes.Node n = tp != null ? Visualizer.findNode(tp.getLastPathComponent()) : null; TreePath path = tree.getPathForRow(TreeTable.this.rowAtPoint(me.getPoint())); Rectangle r = tree.getPathBounds(path); me.isPopupTrigger() ); TreeTable.this.tree.dispatchEvent(newME);
this.tree = new TreeTableCellRenderer(treeModel); this.tableModel = new TreeTableModelAdapter(tree, tableModel); tree.setCellRenderer(new NodeRenderer()); tree.setSelectionModel(selectionWrapper); setSelectionModel(selectionWrapper.getListSelectionModel()); getTableHeader().setReorderingAllowed(false);
private boolean isLocationInExpandControl( TreePath path, Point location ) { if( tree.getModel().isLeaf( path.getLastPathComponent() ) ) return false; Rectangle r = tree.getPathBounds(path); int boxWidth = 8; Insets i = tree.getInsets(); int indent = 0; if( tree.getUI() instanceof BasicTreeUI ) { BasicTreeUI ui = (BasicTreeUI)tree.getUI(); if( null != ui.getExpandedIcon() ) boxWidth = ui.getExpandedIcon().getIconWidth(); indent = ui.getLeftChildIndent(); } int boxX; if( tree.getComponentOrientation().isLeftToRight() ) { boxX = r.x - positionX - indent - boxWidth; } else { boxX = r.x - positionX + indent + r.width; } return location.getX() >= boxX && location.getX() <= (boxX + boxWidth); } }
@Override public String getToolTipText(MouseEvent event) { if (event != null) { Point p = event.getPoint(); p.translate(positionX, visibleRow * getRowHeight()); int selRow = getRowForLocation(p.x, p.y); if (selRow != -1) { TreePath path = getPathForRow(selRow); VisualizerNode v = (VisualizerNode) path.getLastPathComponent(); String tooltip = v.getShortDescription(); String displayName = v.getDisplayName(); if ((tooltip != null) && !tooltip.equals(displayName)) { return tooltip; } } } return null; }