Java Code Examples for javax.swing.tree.DefaultTreeModel#nodesWereInserted()
The following examples show how to use
javax.swing.tree.DefaultTreeModel#nodesWereInserted() .
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: ComponentSelector.java From Logisim with GNU General Public License v3.0 | 5 votes |
@Override public void circuitChanged(CircuitEvent event) { int action = event.getAction(); DefaultTreeModel model = (DefaultTreeModel) getModel(); if (action == CircuitEvent.ACTION_SET_NAME) { model.nodeChanged(this); } else { if (computeChildren()) { model.nodeStructureChanged(this); } else if (action == CircuitEvent.ACTION_INVALIDATE) { Object o = event.getData(); for (int i = children.size() - 1; i >= 0; i--) { Object o2 = children.get(i); if (o2 instanceof ComponentNode) { ComponentNode n = (ComponentNode) o2; if (n.comp == o) { int[] changed = { i }; children.remove(i); model.nodesWereRemoved(this, changed, new Object[] { n }); children.add(i, new ComponentNode(this, n.comp)); model.nodesWereInserted(this, changed); } } } } } }
Example 2
Source File: ClasspathEntry.java From ApkToolPlus with Apache License 2.0 | 5 votes |
private void insertNode(ClassTreeNode newNode, ClassTreeNode parentNode, int insertionIndex, DefaultTreeModel model, boolean reset) { parentNode.insert(newNode, insertionIndex); if (!reset) { model.nodesWereInserted(parentNode, new int[] {insertionIndex}); } }
Example 3
Source File: ElistTablePanel.java From ramus with GNU General Public License v3.0 | 4 votes |
public ElistTablePanel(GUIFramework framework, Qualifier qualifier) { leafIcon = new ImageIcon(getClass().getResource( "/com/ramussoft/gui/table/sheet.png")); folderIcon = new ImageIcon(getClass().getResource( "/com/ramussoft/gui/table/folder.png")); folderSheetIcon = new ImageIcon(getClass().getResource( "/com/ramussoft/gui/table/folder-sheet.png")); setRootVisible(false); List<Attribute> list = qualifier.getAttributes(); if (list.size() > 0) attribute = list.get(0); for (Attribute attr : list) { if (attr.getId() == qualifier.getAttributeForName()) { attribute = attr; break; } } Attribute[] attributes; if (attribute != null) attributes = new Attribute[]{attribute}; else attributes = new Attribute[]{}; rowSet = new RowSet(framework.getEngine(), qualifier, attributes) { @Override protected void removedFromChildren(Row parentRow, Row row, int i) { try { model.nodesWereRemoved(parentRow, new int[]{i}, new Object[]{row}); } catch (Exception e) { e.printStackTrace(); } } @Override protected void added(Row parent, final Row row, int index) { super.added(parent, row, index); if (parent == null) parent = getRoot(); try { model.nodesWereInserted(parent, new int[]{index}); expandPath(new TreePath(model.getPathToRoot(parent))); } catch (Exception e) { e.printStackTrace(); } } @Override protected void attributeChanged(Row row, Attribute attr, Object newValue, Object oldValue, boolean journaled) { if (attribute.getId() == attr.getId()) { try { model.nodeChanged(row); } catch (Exception e) { e.printStackTrace(); } } } }; model = new DefaultTreeModel(rowSet.getRoot()); setModel(model); for (int i = 0; i < getRowCount(); i++) expandRow(i); setRowHeight(ElistTableTabView.CELL_BORDER); this.addMouseMotionListener(new MouseMotionAdapter() { @Override public void mouseMoved(MouseEvent e) { setToolTipText(getToolTipText(e)); } }); setCellRenderer(renderer); }