/** 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) {
@Override public String getShortDescription(int column) { return outline.getOutlineModel().getColumnName(column); }
/** 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; } }
public Icon getIcon(Object o) { if( getOutline().getOutlineModel().isLeaf(o) ) return NO_ICON; return null; }
public void addTreeExpansionListener( TreeExpansionListener l ) { TreePathSupport tps = getOutline().getOutlineModel().getTreePathSupport(); if( tps != null ) tps.addTreeExpansionListener(l); }
public void removeTreeExpansionListener( TreeExpansionListener l ) { TreePathSupport tps = getOutline().getOutlineModel().getTreePathSupport(); if( tps != null ) tps.removeTreeExpansionListener(l); }
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; }
/** Set whether or not the root is visible */ public void setRootVisible (boolean val) { if (getOutlineModel() == null) { cachedRootVisible = val ? Boolean.TRUE : Boolean.FALSE; } if (val != isRootVisible()) { //TODO - need to force a property change on the model, //the layout cache doesn't have direct listener support getLayoutCache().setRootVisible(val); firePropertyChange("rootVisible", !val, val); //NOI18N } }
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); }
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); } }
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);
TreePath parent2 = tp2.getParentPath(); if (parent1 != null && parent2 != null && parent1.equals(parent2) && getOutlineModel().isLeaf(tp1.getLastPathComponent()) && getOutlineModel().isLeaf(tp2.getLastPathComponent())) { return ascending ? super.compare(rm1, rm2) : - super.compare(rm1, rm2);
AbstractLayoutCache layout = tbl.getLayoutCache(); row = tbl.convertRowIndexToModel(row); boolean leaf = tbl.getOutlineModel().isLeaf(value); setLeaf(leaf); setShowHandle(true);