javax.swing.event.TreeModelListener Java Examples
The following examples show how to use
javax.swing.event.TreeModelListener.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RepositoryTreeModel.java From rapidminer-studio with GNU Affero General Public License v3.0 | 6 votes |
/** * Update tree if it was refreshed or an entry was changed. * * @param entry the changed entry * @param changed whether the entry was changed or just refreshed * @since 8.1.2 */ private void updateEntry(Entry entry, boolean changed) { RepositoryTreeUtil treeUtil = new RepositoryTreeUtil(); TreeModelEvent e = makeChangeEvent(entry); if (parentTree != null) { treeUtil.saveExpansionState(parentTree); if (!changed) { //Fix for UI glitches if children of a refreshed folder are selected during a refresh treeUtil.retainRootSelections(parentTree); } } for (TreeModelListener l : listeners.getListeners(TreeModelListener.class)) { if (changed) { l.treeNodesChanged(e); } l.treeStructureChanged(e); } if (parentTree != null) { treeUtil.restoreExpansionState(parentTree); } }
Example #2
Source File: AbstractReportDataTreeModel.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 6 votes |
public void fireQueryChanged( final Object query ) { if ( query == null ) { return; } final ArrayList<ReportQueryNode> nodes = new ArrayList<ReportQueryNode>(); findAllQueryNodes( query, nodes, getDataFactoryElement() ); final TreeModelListener[] treeModelListeners = getListeners(); for ( int n = 0; n < nodes.size(); n++ ) { final ReportQueryNode queryNode = nodes.get( n ); final TreePath path = getPathForNode( queryNode.getDataFactory() ); final TreePath queryPath = path.pathByAddingChild( queryNode ); final TreeModelEvent treeEvent = new TreeModelEvent( this, queryPath ); for ( int i = treeModelListeners.length - 1; i >= 0; i -= 1 ) { final TreeModelListener listener = treeModelListeners[ i ]; listener.treeStructureChanged( treeEvent ); } } }
Example #3
Source File: MasterReportDataTreeModel.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 6 votes |
public void fireParameterRemoved( final ParameterDefinitionEntry parameter ) { final TreePath pathForNode = new TreePath( new Object[] { getRoot(), getReportParametersNode() } ); final TreeModelListener[] treeModelListeners = getListeners(); final int index = findParameterInCache( parameter ); if ( index == -1 ) { return; } final TreeModelEvent treeEvent = new TreeModelEvent( this, pathForNode, new int[] { index }, new Object[] { parameter } ); for ( int i = treeModelListeners.length - 1; i >= 0; i -= 1 ) { final TreeModelListener listener = treeModelListeners[ i ]; listener.treeNodesRemoved( treeEvent ); } refreshParameterCache(); }
Example #4
Source File: ProcessTreeModel.java From rapidminer-studio with GNU Affero General Public License v3.0 | 6 votes |
private void fireTreeNodesChanged(Operator operator) { TreeModelEvent e = makeChangeEvent(operator); if (e.getChildIndices() != null && e.getChildIndices()[0] != -1) { // otherwise the // operator is in // the state of // being removed and // has // triggered an // update while // dying. for (TreeModelListener l : listenerList.getListeners(TreeModelListener.class)) { try { l.treeNodesChanged(e); } catch (Exception ex) { //ignore } } } }
Example #5
Source File: GTreeModel.java From ghidra with Apache License 2.0 | 6 votes |
public void fireNodeAdded(final GTreeNode parentNode, final GTreeNode newNode) { if (!eventsEnabled) { return; } SystemUtilities.assertThisIsTheSwingThread( "GTreeModel.fireNodeAdded() must be " + "called from the AWT thread"); GTreeNode parent = convertToViewNode(parentNode); if (parent == null) { // it will be null if filtered out return; } int index = parent.getIndexOfChild(newNode); if (index < 0) { // the index will be -1 if filtered out return; } TreeModelEvent event = new TreeModelEvent(this, parent.getTreePath(), new int[] { index }, new Object[] { newNode }); for (TreeModelListener listener : listeners) { listener.treeNodesInserted(event); } }
Example #6
Source File: ComponentsSelectionPanel.java From netbeans with Apache License 2.0 | 5 votes |
public void valueForPathChanged(final TreePath path, final Object value) { if (path.getLastPathComponent() instanceof Product) { final Product product = (Product) path.getLastPathComponent(); switch (product.getStatus()) { case NOT_INSTALLED: product.setStatus(Status.TO_BE_INSTALLED); updateRequirements(product); break; case TO_BE_INSTALLED: product.setStatus(Status.NOT_INSTALLED); break; case INSTALLED: product.setStatus(Status.TO_BE_UNINSTALLED); break; case TO_BE_UNINSTALLED: product.setStatus(Status.INSTALLED); break; } } final TreeModelListener[] clone; synchronized (listeners) { clone = listeners.toArray(new TreeModelListener[0]); } final TreeModelEvent event = new TreeModelEvent(this, path); for (TreeModelListener listener: clone) { listener.treeNodesChanged(event); } }
Example #7
Source File: BookBrowser.java From audiveris with GNU Affero General Public License v3.0 | 5 votes |
public void refreshPath (TreePath path) { TreeModelEvent modelEvent = new TreeModelEvent(this, path); for (TreeModelListener listener : listeners) { listener.treeStructureChanged(modelEvent); } }
Example #8
Source File: ProcessTreeModel.java From rapidminer-studio with GNU Affero General Public License v3.0 | 5 votes |
private void fireTreeStructureChanged(ExecutionUnit unit) { TreePath path = getPathTo(unit).getParentPath(); TreeModelEvent e = new TreeModelEvent(this, path); for (TreeModelListener l : listenerList.getListeners(TreeModelListener.class)) { try { l.treeStructureChanged(e); } catch (Exception ex) { //ignore } } }
Example #9
Source File: ScoreTree.java From libreveris with GNU Lesser General Public License v3.0 | 5 votes |
public void refreshPath (TreePath path) { TreeModelEvent modelEvent = new TreeModelEvent(this, path); for (TreeModelListener listener : listeners) { listener.treeStructureChanged(modelEvent); } }
Example #10
Source File: GTreeModel.java From ghidra with Apache License 2.0 | 5 votes |
public void fireNodeRemoved(GTreeNode parentNode, GTreeNode removedNode, int index) { SystemUtilities.assertThisIsTheSwingThread( "GTreeModel.fireNodeRemoved() must be " + "called from the AWT thread"); GTreeNode parent = convertToViewNode(parentNode); if (parent == null) { // will be null if filtered out return; } // if filtered, remove filtered node if (parent != parentNode) { index = removeFromFiltered(parent, removedNode); return; // the above call will generate the event for the filtered node } if (index < 0) { // will be -1 if filtered out return; } TreeModelEvent event = new TreeModelEvent(this, parent.getTreePath(), new int[] { index }, new Object[] { removedNode }); for (TreeModelListener listener : listeners) { listener.treeNodesRemoved(event); } }
Example #11
Source File: GenealogyModel.java From marathonv5 with Apache License 2.0 | 5 votes |
/** * The only event raised by this model is TreeStructureChanged with the root * as path, i.e. the whole tree has changed. */ protected void fireTreeStructureChanged(Person oldRoot) { int len = treeModelListeners.size(); TreeModelEvent e = new TreeModelEvent(this, new Object[] { oldRoot }); for (TreeModelListener tml : treeModelListeners) { tml.treeStructureChanged(e); } }
Example #12
Source File: WidgetTreeModel.java From DroidUIBuilder with Apache License 2.0 | 5 votes |
protected void fireStructureChangedEvent(TreeModelEvent event) { for (TreeModelListener listener : listeners) { listener.treeStructureChanged(event); } }
Example #13
Source File: GTreeModel.java From ghidra with Apache License 2.0 | 5 votes |
public void fireNodeStructureChanged(final GTreeNode changedNode) { if (!eventsEnabled || isFiringNodeStructureChanged) { return; } try { isFiringNodeStructureChanged = true; SystemUtilities.assertThisIsTheSwingThread( "GTreeModel.fireNodeStructuredChanged() must be " + "called from the AWT thread"); GTreeNode node = convertToViewNode(changedNode); if (node == null) { return; } if (node != changedNode) { node.setChildren(null); return; // the previous call will generate the proper event, so bail } TreeModelEvent event = new TreeModelEvent(this, node.getTreePath()); for (TreeModelListener listener : listeners) { listener.treeStructureChanged(event); } } finally { isFiringNodeStructureChanged = false; } }
Example #14
Source File: EditableResources.java From CodenameOne with GNU General Public License v2.0 | 5 votes |
public void valueForPathChanged(TreePath path, Object newValue) { Object oldValue = path.getLastPathComponent(); renameEntry((String)oldValue, (String)newValue); TreeModelEvent ev = new TreeModelEvent(this, path.getParentPath().pathByAddingChild(newValue)); for(TreeModelListener l : listeners) { l.treeNodesChanged(ev); } }
Example #15
Source File: RedisFragmentedKeyTreeModel.java From nosql4idea with Apache License 2.0 | 5 votes |
private void updateFilteredModel() { DefaultMutableTreeNode sourceRoot = (DefaultMutableTreeNode) super.getRoot(); DefaultMutableTreeNode targetRoot = (DefaultMutableTreeNode) sourceRoot.clone(); wrapNodes(sourceRoot, separator); fragmentedKeyModel = new DefaultTreeModel(targetRoot); Object[] listeners = listenerList.getListenerList(); for (int i = listeners.length - 2; i >= 0; i -= 2) { if (listeners[i] == TreeModelListener.class) { fragmentedKeyModel.addTreeModelListener((TreeModelListener) listeners[i + 1]); } } fireSeparatorChanged(); }
Example #16
Source File: GeopaparazziController.java From hortonmachine with GNU General Public License v3.0 | 4 votes |
protected void fireTreeStructureChanged( Object oldRoot ) { TreeModelEvent event = new TreeModelEvent(this, new Object[]{oldRoot}); EventListener[] listeners = listenerList.getListeners(TreeModelListener.class); for( int i = 0; i < listeners.length; i++ ) ((TreeModelListener) listeners[i]).treeStructureChanged(event); }
Example #17
Source File: SimpleTreeModel.java From pdfxtk with Apache License 2.0 | 4 votes |
public void addTreeModelListener(TreeModelListener l) { listeners.add(TreeModelListener.class, l); }
Example #18
Source File: TocTreeModel.java From jace with GNU General Public License v2.0 | 4 votes |
public void removeTreeModelListener(TreeModelListener l) { // Do nothing... }
Example #19
Source File: ProjectTreeModel.java From quickfix-messenger with BSD 3-Clause "New" or "Revised" License | 4 votes |
@Override public void removeTreeModelListener(TreeModelListener listener) { eventListenerList.remove(TreeModelListener.class, listener); }
Example #20
Source File: JTreeScopeStackModel.java From codebuff with BSD 2-Clause "Simplified" License | 4 votes |
@Override public void removeTreeModelListener(TreeModelListener treeModelListener) { }
Example #21
Source File: DumpTreeModel.java From jpexs-decompiler with GNU General Public License v3.0 | 4 votes |
@Override public void addTreeModelListener(TreeModelListener l) { listeners.add(l); }
Example #22
Source File: JTreeASTModel.java From codebuff with BSD 2-Clause "Simplified" License | 4 votes |
@Override public void addTreeModelListener(TreeModelListener treeModelListener) { }
Example #23
Source File: javax_swing_JTree.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
public void addTreeModelListener(TreeModelListener listener) { }
Example #24
Source File: AbstractTreeTableModel.java From gate-core with GNU Lesser General Public License v3.0 | 4 votes |
/** * Removes a {@link javax.swing.event.TreeModelListener} from the list of * listeners registered with this model. */ @Override public void removeTreeModelListener(TreeModelListener l) { listenerList.remove(TreeModelListener.class, l); }
Example #25
Source File: AbstractReportDataTreeModel.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 4 votes |
protected TreeModelListener[] getListeners() { return eventListenerList.getListeners( TreeModelListener.class ); }
Example #26
Source File: ProductLayerAssistantPage.java From snap-desktop with GNU General Public License v3.0 | 4 votes |
protected void fireTreeNodeChanged(TreePath treePath) { TreeModelEvent event = new TreeModelEvent(this, treePath); for (TreeModelListener treeModelListener : treeModelListeners.keySet()) { treeModelListener.treeNodesChanged(event); } }
Example #27
Source File: DataFactoryTreeModel.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 4 votes |
public void addTreeModelListener( final TreeModelListener l ) { listenerList.add( TreeModelListener.class, l ); }
Example #28
Source File: JTreeSTModel.java From codebuff with BSD 2-Clause "Simplified" License | 4 votes |
@Override public void removeTreeModelListener(TreeModelListener treeModelListener) { }
Example #29
Source File: JTreeSTModel.java From codebuff with BSD 2-Clause "Simplified" License | 4 votes |
@Override public void removeTreeModelListener(TreeModelListener treeModelListener) { }
Example #30
Source File: JTreeSTModel.java From codebuff with BSD 2-Clause "Simplified" License | 4 votes |
@Override public void removeTreeModelListener(TreeModelListener treeModelListener) { }