public void addTreeExpansionListener( TreeExpansionListener l ) { TreePathSupport tps = getOutline().getOutlineModel().getTreePathSupport(); if( tps != null ) tps.addTreeExpansionListener(l); }
/** Creates a new instance of DefaultOutlineModel. <strong><b>Note</b> * Do not fire table structure changes from the wrapped TableModel (value * changes are okay). Changes that affect the number of rows must come * from the TreeModel. */ protected DefaultOutlineModel(TreeModel treeModel, TableModel tableModel, boolean largeModel, String nodesColumnLabel) { this.treeModel = treeModel; this.tableModel = tableModel; if (nodesColumnLabel != null) { this.nodesColumnLabel = nodesColumnLabel; } layout = largeModel ? (AbstractLayoutCache) new FixedHeightLayoutCache() : (AbstractLayoutCache) new VariableHeightLayoutCache(); broadcaster = new EventBroadcaster (this); layout.setRootVisible(true); layout.setModel(this); treePathSupport = new TreePathSupport(this, layout); treePathSupport.addTreeExpansionListener(broadcaster); treePathSupport.addTreeWillExpandListener(broadcaster); treeModel.addTreeModelListener(broadcaster); tableModel.addTableModelListener(broadcaster); if (tableModel instanceof ProxyTableModel) { ((ProxyTableModel) tableModel).setOutlineModel(this); } }