/** Get the TreePathSupport object which manages path expansion for this * Outline. */ TreePathSupport getTreePathSupport () { OutlineModel mdl = getOutlineModel(); if (mdl != null) { return mdl.getTreePathSupport(); } else { return null; } }
public String getShortDescription(int column) { return outline.getOutlineModel().getColumnName(column); } public void propertyChange(PropertyChangeEvent evt) {
/** Get the layout cache which manages layout data for the Outline. * <strong>Under no circumstances directly call the methods on the * layout cache which change the expanded state - such changes will not * be propagated into the table model, and will leave the model and * its layout in inconsistent states. Any calls that affect expanded * state must go through <code>getTreePathSupport()</code>.</strong> */ public final AbstractLayoutCache getLayoutCache () { OutlineModel mdl = getOutlineModel(); if (mdl != null) { return mdl.getLayout(); } else { return null; } }
void setTreeHScrollingEnabled(boolean isHScrollingEnabled, JScrollBar hScrollBar) { this.isHScrollingEnabled = isHScrollingEnabled; this.hScrollBar = hScrollBar; if (isHScrollingEnabled) { if (tmScrollingListener == null) { tmScrollingListener = new TMScrollingListener(); rowWidths = new int[getOutlineModel().getRowCount()]; getOutlineModel().addTableModelListener(tmScrollingListener); getOutlineModel().addTreeModelListener(tmScrollingListener); } } else { if (tmScrollingListener != null) { getOutlineModel().removeTableModelListener(tmScrollingListener); getOutlineModel().removeTreeModelListener(tmScrollingListener); tmScrollingListener = null; rowWidths = null; } } }
MouseEvent me = (MouseEvent) e; TreePath path = getLayoutCache().getPathForRow(convertRowIndexToModel(row)); if (!getOutlineModel().isLeaf(path.getLastPathComponent())) { int handleWidth = DefaultOutlineCellRenderer.getExpansionHandleWidth(); Insets ins = getInsets(); int cCount = getOutlineModel().getChildCount(ourObject); if (cCount > 0) { Object lastChild = getOutlineModel().getChild(ourObject, cCount - 1); TreePath lastChildPath = path.pathByAddingChild(lastChild); int lastRow = getLayoutCache().getRowForPath(lastChildPath);
public Icon getIcon(Object o) { if( getOutline().getOutlineModel().isLeaf(o) ) return NO_ICON; return null; }
AbstractLayoutCache layout = ((OutlineModel) mdl).getLayout(); if (cachedRootVisible != null) { if (((OutlineModel) mdl).isLargeModel()) { addComponentListener (getComponentListener()); layout.setNodeDimensions(new ND());
/** Get the object that will be passed to the RowModel to fetch values * for the given row. * @param row The row we need the tree node for */ private Object getNodeForRow(int row) { return getOutlineModel().getValueAt(row, 0); }
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); } } } }
public void addTreeExpansionListener( TreeExpansionListener l ) { TreePathSupport tps = getOutline().getOutlineModel().getTreePathSupport(); if( tps != null ) tps.addTreeExpansionListener(l); }
public void actionPerformed(ActionEvent e) { if( getSelectedRowCount() == 1 && isTreeColumnIndex (getSelectedColumn()) ) { int selRow = getSelectedRow(); TreePath selPath = getLayoutCache().getPathForRow(selRow); if( null != selPath && !getOutlineModel().isLeaf(selPath.getLastPathComponent()) ) { boolean expanded = getLayoutCache().isExpanded(selPath); if( expanded && !expand ) { collapsePath(selPath); return; } else if( !expanded && expand ) { expandPath(selPath); return; } } } if( null != origAction ) origAction.actionPerformed(e); } }
/** * @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); } } } }
@Override public String getShortDescription(int column) { return outline.getOutlineModel().getColumnName(column); }
private Node getNodeAt( int rowIndex ) { Node result = null; TreePath path = view.getOutline().getOutlineModel().getLayout().getPathForRow(rowIndex); if (path != null) { result = Visualizer.findNode(path.getLastPathComponent()); } return result; }
public void removeTreeExpansionListener( TreeExpansionListener l ) { TreePathSupport tps = getOutline().getOutlineModel().getTreePathSupport(); if( tps != null ) tps.removeTreeExpansionListener(l); }
/** * Set the description (table header tooltip) for the property column * representing properties that have the passed programmatic (not display) * name, or for the tree column. * * @param columnName The programmatic name (Property.getName()) of the * column, or name of the tree column * @param description Tooltip text for the column header for that column */ public final void setPropertyColumnDescription(String columnName, String description) { Parameters.notNull ("columnName", columnName); //NOI18N Property[] props = rowModel.getProperties(); for (Property p : props) { if (columnName.equals(p.getName())) { p.setShortDescription(description); } } if (columnName.equals(model.getColumnName(0))) { outline.setNodesColumnDescription(description); } }
private void expandNode(DefaultMutableTreeNode treeNode, boolean recursive, int level) { if (treeNode.getAllowsChildren()) { if (treeNode.getChildCount() == 0) { TreePath path = new TreePath(treeNode.getPath()); mdl.getTreePathSupport().expandPath(path); } if (recursive && level <= MAX_LEVELS_TO_EXPAND) { for (int childIndex = 0; childIndex < treeNode.getChildCount(); childIndex++) { DefaultMutableTreeNode child = (DefaultMutableTreeNode) treeNode.getChildAt(childIndex); expandNode(child, recursive, level + 1); } } } }
AbstractLayoutCache layout = tbl.getLayoutCache(); row = tbl.convertRowIndexToModel(row); boolean leaf = tbl.getOutlineModel().isLeaf(value); setLeaf(leaf); setShowHandle(true);