bugged
stringlengths
6
599k
fixed
stringlengths
10
599k
__index_level_0__
int64
0
1.13M
public synchronized StringBuffer append(char ch) { ensureCapacity_unsynchronized(count + 1); value[count++] = ch; return this; }
public StringBuffer append(Object obj) { ensureCapacity_unsynchronized(count + 1); value[count++] = ch; return this; }
0
public synchronized StringBuffer append(char ch) { ensureCapacity_unsynchronized(count + 1); value[count++] = ch; return this; }
public synchronized StringBuffer append(char ch) { ensureCapacity_unsynchronized(count + 1); value[count++] = ch; return this; }
1
public String substring(int beginIndex, int endIndex) { if (beginIndex < 0 || endIndex > count || beginIndex > endIndex) throw new StringIndexOutOfBoundsException(); if (beginIndex == 0 && endIndex == count) return this; int len = endIndex - beginIndex; // Package constructor avoids an array copy. return new String(value, beginIndex + offset, len, (len << 2) >= value.length); }
public String substring(int begin) { if (beginIndex < 0 || endIndex > count || beginIndex > endIndex) throw new StringIndexOutOfBoundsException(); if (beginIndex == 0 && endIndex == count) return this; int len = endIndex - beginIndex; // Package constructor avoids an array copy. return new String(value, beginIndex + offset, len, (len << 2) >= value.length); }
2
public String substring(int beginIndex, int endIndex) { if (beginIndex < 0 || endIndex > count || beginIndex > endIndex) throw new StringIndexOutOfBoundsException(); if (beginIndex == 0 && endIndex == count) return this; int len = endIndex - beginIndex; // Package constructor avoids an array copy. return new String(value, beginIndex + offset, len, (len << 2) >= value.length); }
public String substring(int beginIndex, int endIndex) { if (beginIndex < 0 || endIndex > count || beginIndex > endIndex) throw new StringIndexOutOfBoundsException(); if (beginIndex == 0 && endIndex == count) return this; int len = endIndex - beginIndex; // Package constructor avoids an array copy. return new String(value, beginIndex + offset, len, (len << 2) >= value.length); }
3
public Object next() { String fs = (String)fileSystemsRoots.next(); return new virtualFSEntry(fs); }
public FSEntry next() { String fs = (String)fileSystemsRoots.next(); return new virtualFSEntry(fs); }
4
public FSEntry getEntry(String name) throws IOException { return getEntry("/" + name); }
public FSEntry getEntry(String name) throws IOException { for(FSEntryIterator it = iterator() ; it.hasNext() ; ) { FSEntry entry = it.next(); if(entry.getName().equals(name)) return entry; } throw new IOException("Entry not found: "+name); }
5
public Iterator iterator() { return new RootsIterator(fsm.fileSystemRoots().iterator()); }
public FSEntryIterator iterator() { return new RootsIterator(fsm.fileSystemRoots().iterator()); }
6
public String[] list(File directory, FilenameFilter filter) throws IOException { final FSEntry entry = getEntry(directory); if (entry == null) { throw new FileNotFoundException(directory.getAbsolutePath()); } if (!entry.isDirectory()) { throw new IOException("Cannot list on non-directories " + directory); } final ArrayList list = new ArrayList(); for (Iterator i = entry.getDirectory().iterator(); i.hasNext();) { final FSEntry child = (FSEntry)i.next(); final String name = child.getName(); if ((filter == null) || (filter.accept(directory, name))) { list.add(name); } } return (String[])list.toArray(new String[list.size()]); }
public String[] list(File directory, FilenameFilter filter) throws IOException { final FSEntry entry = getEntry(directory); if (entry == null) { throw new FileNotFoundException(directory.getAbsolutePath()); } if (!entry.isDirectory()) { throw new IOException("Cannot list on non-directories " + directory); } final ArrayList list = new ArrayList(); for (FSEntryIterator i = entry.getDirectory().iterator(); i.hasNext();) { final FSEntry child = (FSEntry)i.next(); final String name = child.getName(); if ((filter == null) || (filter.accept(directory, name))) { list.add(name); } } return (String[])list.toArray(new String[list.size()]); }
7
public synchronized FileSystem getFileSystem(String rootName) { return (FileSystem)filesystems.get(rootName); }
public synchronized FileSystem getFileSystem(String rootName) { return (FileSystem)filesystems.get(rootName); }
8
public DriverException(String message, Throwable cause) { super(message, cause); }
public DriverException(String message, Throwable cause) { super(message, cause); }
10
public void mousePressed(MouseEvent e) { Point click = e.getPoint(); int row = Math.round(click.y / getRowHeight()); TreePath path = getClosestPathForLocation(tree, click.x, click.y); if (path != null) { boolean inBounds = false; boolean cntlClick = false; Rectangle bounds = getPathBounds(tree, path); bounds.x -= rightChildIndent - 4; bounds.width += rightChildIndent + 4; if (bounds.contains(click.x, click.y)) inBounds = true; else if (hasControlIcons() && (click.x < (bounds.x - rightChildIndent + 5) && click.x > (bounds.x - rightChildIndent - 5))) cntlClick = true; if ((inBounds || cntlClick) && tree.isVisible(path)) { selectPath(tree, path); if ((e.getClickCount() == 2 || cntlClick) && !isLeaf(row)) { if (tree.isExpanded(path)) tree.collapsePath(path); else tree.expandPath(path); } if (!cntlClick && tree.isEditable()) startEditing(path, e); } } }
public void mousePressed(MouseEvent e) { Point click = e.getPoint(); int row = Math.round(click.y / getRowHeight()); TreePath path = getClosestPathForLocation(tree, click.x, click.y); if (path != null) { boolean inBounds = false; boolean cntlClick = false; Rectangle bounds = getPathBounds(tree, path); bounds.x -= rightChildIndent - 4; bounds.width += rightChildIndent + 4; if (bounds.contains(click.x, click.y)) inBounds = true; else if (hasControlIcons() && (click.x < (bounds.x - rightChildIndent + 5) && click.x > (bounds.x - rightChildIndent - 5))) cntlClick = true; if ((inBounds || cntlClick) && tree.isVisible(path)) { selectPath(tree, path); if ((e.getClickCount() == 2 || cntlClick) && !isLeaf(row)) { if (tree.isExpanded(path)) tree.collapsePath(path); else tree.expandPath(path); } if (!cntlClick && tree.isEditable()) startEditing(path, e); } } }
11
public void mousePressed(MouseEvent e) { Point click = e.getPoint(); int row = Math.round(click.y / getRowHeight()); TreePath path = getClosestPathForLocation(tree, click.x, click.y); if (path != null) { boolean inBounds = false; boolean cntlClick = false; Rectangle bounds = getPathBounds(tree, path); bounds.x -= rightChildIndent - 4; bounds.width += rightChildIndent + 4; if (bounds.contains(click.x, click.y)) inBounds = true; else if (hasControlIcons() && (click.x < (bounds.x - rightChildIndent + 5) && click.x > (bounds.x - rightChildIndent - 5))) cntlClick = true; if ((inBounds || cntlClick) && tree.isVisible(path)) { selectPath(tree, path); if ((e.getClickCount() == 2 || cntlClick) && !isLeaf(row)) { if (tree.isExpanded(path)) tree.collapsePath(path); else tree.expandPath(path); } if (!cntlClick && tree.isEditable()) startEditing(path, e); } } }
public void mousePressed(MouseEvent e) { Point click = e.getPoint(); int row = Math.round(click.y / getRowHeight()); TreePath path = getClosestPathForLocation(tree, click.x, click.y); if (path != null) { boolean inBounds = false; boolean cntlClick = false; Rectangle bounds = getPathBounds(tree, path); bounds.x -= rightChildIndent - 4; bounds.width += rightChildIndent + 4; if (bounds.contains(click.x, click.y)) inBounds = true; else if (hasControlIcons() && (click.x < (bounds.x - rightChildIndent + 5) && click.x > (bounds.x - rightChildIndent - 5))) cntlClick = true; if ((inBounds || cntlClick) && tree.isVisible(path)) { selectPath(tree, path); if ((e.getClickCount() == 2 || cntlClick) && !isLeaf(row)) { if (tree.isExpanded(path)) tree.collapsePath(path); else tree.expandPath(path); } if (!cntlClick && tree.isEditable()) startEditing(path, e); } } }
12
public void mousePressed(MouseEvent e) { Point click = e.getPoint(); int row = Math.round(click.y / getRowHeight()); TreePath path = getClosestPathForLocation(tree, click.x, click.y); if (path != null) { boolean inBounds = false; boolean cntlClick = false; Rectangle bounds = getPathBounds(tree, path); bounds.x -= rightChildIndent - 4; bounds.width += rightChildIndent + 4; if (bounds.contains(click.x, click.y)) inBounds = true; else if (hasControlIcons() && (click.x < (bounds.x - rightChildIndent + 5) && click.x > (bounds.x - rightChildIndent - 5))) cntlClick = true; if ((inBounds || cntlClick) && tree.isVisible(path)) { selectPath(tree, path); if ((e.getClickCount() == 2 || cntlClick) && !isLeaf(row)) { if (tree.isExpanded(path)) tree.collapsePath(path); else tree.expandPath(path); } if (!cntlClick && tree.isEditable()) startEditing(path, e); } } }
public void mousePressed(MouseEvent e) { Point click = e.getPoint(); int row = Math.round(click.y / getRowHeight()); TreePath path = getClosestPathForLocation(tree, click.x, click.y); if (path != null) { boolean inBounds = false; boolean cntlClick = false; Rectangle bounds = getPathBounds(tree, path); bounds.x -= rightChildIndent - 4; bounds.width += rightChildIndent + 4; if (bounds.contains(click.x, click.y)) inBounds = true; else if (hasControlIcons() && (click.x < (bounds.x - rightChildIndent + 5) && click.x > (bounds.x - rightChildIndent - 5))) cntlClick = true; if ((inBounds || cntlClick) && tree.isVisible(path)) { selectPath(tree, path); if ((e.getClickCount() == 2 || cntlClick) && !isLeaf(row)) { if (tree.isExpanded(path)) tree.collapsePath(path); else tree.expandPath(path); } if (!cntlClick && tree.isEditable()) startEditing(path, e); } } }
13
public void mousePressed(MouseEvent e) { Point click = e.getPoint(); int row = Math.round(click.y / getRowHeight()); TreePath path = getClosestPathForLocation(tree, click.x, click.y); if (path != null) { boolean inBounds = false; boolean cntlClick = false; Rectangle bounds = getPathBounds(tree, path); bounds.x -= rightChildIndent - 4; bounds.width += rightChildIndent + 4; if (bounds.contains(click.x, click.y)) inBounds = true; else if (hasControlIcons() && (click.x < (bounds.x - rightChildIndent + 5) && click.x > (bounds.x - rightChildIndent - 5))) cntlClick = true; if ((inBounds || cntlClick) && tree.isVisible(path)) { selectPath(tree, path); if ((e.getClickCount() == 2 || cntlClick) && !isLeaf(row)) { if (tree.isExpanded(path)) tree.collapsePath(path); else tree.expandPath(path); } if (!cntlClick && tree.isEditable()) startEditing(path, e); } } }
public void mousePressed(MouseEvent e) { Point click = e.getPoint(); int row = Math.round(click.y / getRowHeight()); TreePath path = getClosestPathForLocation(tree, click.x, click.y); if (path != null) { boolean inBounds = false; boolean cntlClick = false; Rectangle bounds = getPathBounds(tree, path); bounds.x -= rightChildIndent - 4; bounds.width += rightChildIndent + 4; if (bounds.contains(click.x, click.y)) inBounds = true; else if (hasControlIcons() && (click.x < (bounds.x - rightChildIndent + 5) && click.x > (bounds.x - rightChildIndent - 5))) cntlClick = true; if ((inBounds || cntlClick) && tree.isVisible(path)) { selectPath(tree, path); if ((e.getClickCount() == 2 || cntlClick) && !isLeaf(row)) { if (tree.isExpanded(path)) tree.collapsePath(path); else tree.expandPath(path); } if (!cntlClick && tree.isEditable()) startEditing(path, e); } } }
14
public void mousePressed(MouseEvent e) { Point click = e.getPoint(); int row = Math.round(click.y / getRowHeight()); TreePath path = getClosestPathForLocation(tree, click.x, click.y); if (path != null) { boolean inBounds = false; boolean cntlClick = false; Rectangle bounds = getPathBounds(tree, path); bounds.x -= rightChildIndent - 4; bounds.width += rightChildIndent + 4; if (bounds.contains(click.x, click.y)) inBounds = true; else if (hasControlIcons() && (click.x < (bounds.x - rightChildIndent + 5) && click.x > (bounds.x - rightChildIndent - 5))) cntlClick = true; if ((inBounds || cntlClick) && tree.isVisible(path)) { selectPath(tree, path); if ((e.getClickCount() == 2 || cntlClick) && !isLeaf(row)) { if (tree.isExpanded(path)) tree.collapsePath(path); else tree.expandPath(path); } if (!cntlClick && tree.isEditable()) startEditing(path, e); } } }
public void mousePressed(MouseEvent e) { Point click = e.getPoint(); int row = Math.round(click.y / getRowHeight()); TreePath path = getClosestPathForLocation(tree, click.x, click.y); if (path != null) { boolean inBounds = false; boolean cntlClick = false; Rectangle bounds = getPathBounds(tree, path); bounds.x -= rightChildIndent - 4; bounds.width += rightChildIndent + 4; if (bounds.contains(click.x, click.y)) inBounds = true; else if (hasControlIcons() && (click.x < (bounds.x - rightChildIndent + 5) && click.x > (bounds.x - rightChildIndent - 5))) cntlClick = true; if ((inBounds || cntlClick) && tree.isVisible(path)) { selectPath(tree, path); if ((e.getClickCount() == 2 || cntlClick) && !isLeaf(row)) { if (tree.isExpanded(path)) tree.collapsePath(path); else tree.expandPath(path); } if (!cntlClick && tree.isEditable()) startEditing(path, e); } } }
15
public void actionPerformed(ActionEvent e) { TreePath lead = tree.getLeadSelectionPath(); if (e.getActionCommand().equals("selectPreviousChangeLead") || e.getActionCommand().equals("selectPreviousExtendSelection") || e.getActionCommand().equals("selectPrevious") || e.getActionCommand().equals("selectNext") || e.getActionCommand().equals("selectNextExtendSelection") || e.getActionCommand().equals("selectNextChangeLead")) (new TreeIncrementAction(0, "")).actionPerformed(e); else if (e.getActionCommand().equals("selectParent") || e.getActionCommand().equals("selectChild")) (new TreeTraverseAction(0, "")).actionPerformed(e); else if (e.getActionCommand().equals("selectAll")) { TreePath[] paths = new TreePath[tree.getRowCount()]; Object curr = getNextVisibleNode(tree.getModel().getRoot()); int i = 0; while (curr != null && i < paths.length) { paths[i] = new TreePath(getPathToRoot(curr, 0)); i++; } tree.addSelectionPaths(paths); } else if (e.getActionCommand().equals("startEditing")) tree.startEditingAtPath(lead); else if (e.getActionCommand().equals("toggle")) { if (tree.isEditing()) tree.stopEditing(); else { Object last = lead.getLastPathComponent(); TreePath path = new TreePath(getPathToRoot(last, 0)); if (!tree.getModel().isLeaf(last)) { if (tree.isExpanded(path)) tree.collapsePath(path); else tree.expandPath(path); } } } else if (e.getActionCommand().equals("clearSelection")) tree.clearSelection(); if (tree.isEditing() && !e.getActionCommand().equals("startEditing")) tree.cancelEditing(); tree.scrollPathToVisible(lead); }
public void actionPerformed(ActionEvent e) { TreePath lead = tree.getLeadSelectionPath(); if (e.getActionCommand().equals("selectPreviousChangeLead") || e.getActionCommand().equals("selectPreviousExtendSelection") || e.getActionCommand().equals("selectPrevious") || e.getActionCommand().equals("selectNext") || e.getActionCommand().equals("selectNextExtendSelection") || e.getActionCommand().equals("selectNextChangeLead")) (new TreeIncrementAction(0, "")).actionPerformed(e); else if (e.getActionCommand().equals("selectParent") || e.getActionCommand().equals("selectChild")) (new TreeTraverseAction(0, "")).actionPerformed(e); else if (e.getActionCommand().equals("selectAll")) { TreePath[] paths = new TreePath[tree.getRowCount()]; Object curr = getNextVisibleNode(treeModel.getRoot()); int i = 0; while (curr != null && i < paths.length) { paths[i] = new TreePath(getPathToRoot(curr, 0)); i++; } tree.addSelectionPaths(paths); } else if (e.getActionCommand().equals("startEditing")) tree.startEditingAtPath(lead); else if (e.getActionCommand().equals("toggle")) { if (tree.isEditing()) tree.stopEditing(); else { Object last = lead.getLastPathComponent(); TreePath path = new TreePath(getPathToRoot(last, 0)); if (!tree.getModel().isLeaf(last)) { if (tree.isExpanded(path)) tree.collapsePath(path); else tree.expandPath(path); } } } else if (e.getActionCommand().equals("clearSelection")) tree.clearSelection(); if (tree.isEditing() && !e.getActionCommand().equals("startEditing")) tree.cancelEditing(); tree.scrollPathToVisible(lead); }
16
public void actionPerformed(ActionEvent e) { TreePath lead = tree.getLeadSelectionPath(); if (e.getActionCommand().equals("selectPreviousChangeLead") || e.getActionCommand().equals("selectPreviousExtendSelection") || e.getActionCommand().equals("selectPrevious") || e.getActionCommand().equals("selectNext") || e.getActionCommand().equals("selectNextExtendSelection") || e.getActionCommand().equals("selectNextChangeLead")) (new TreeIncrementAction(0, "")).actionPerformed(e); else if (e.getActionCommand().equals("selectParent") || e.getActionCommand().equals("selectChild")) (new TreeTraverseAction(0, "")).actionPerformed(e); else if (e.getActionCommand().equals("selectAll")) { TreePath[] paths = new TreePath[tree.getRowCount()]; Object curr = getNextVisibleNode(tree.getModel().getRoot()); int i = 0; while (curr != null && i < paths.length) { paths[i] = new TreePath(getPathToRoot(curr, 0)); i++; } tree.addSelectionPaths(paths); } else if (e.getActionCommand().equals("startEditing")) tree.startEditingAtPath(lead); else if (e.getActionCommand().equals("toggle")) { if (tree.isEditing()) tree.stopEditing(); else { Object last = lead.getLastPathComponent(); TreePath path = new TreePath(getPathToRoot(last, 0)); if (!tree.getModel().isLeaf(last)) { if (tree.isExpanded(path)) tree.collapsePath(path); else tree.expandPath(path); } } } else if (e.getActionCommand().equals("clearSelection")) tree.clearSelection(); if (tree.isEditing() && !e.getActionCommand().equals("startEditing")) tree.cancelEditing(); tree.scrollPathToVisible(lead); }
public void actionPerformed(ActionEvent e) { TreePath lead = tree.getLeadSelectionPath(); if (e.getActionCommand().equals("selectPreviousChangeLead") || e.getActionCommand().equals("selectPreviousExtendSelection") || e.getActionCommand().equals("selectPrevious") || e.getActionCommand().equals("selectNext") || e.getActionCommand().equals("selectNextExtendSelection") || e.getActionCommand().equals("selectNextChangeLead")) (new TreeIncrementAction(0, "")).actionPerformed(e); else if (e.getActionCommand().equals("selectParent") || e.getActionCommand().equals("selectChild")) (new TreeTraverseAction(0, "")).actionPerformed(e); else if (e.getActionCommand().equals("selectAll")) { TreePath[] paths = new TreePath[tree.getRowCount()]; Object curr = getNextVisibleNode(tree.getModel().getRoot()); int i = 0; while (curr != null && i < paths.length) { paths[i] = new TreePath(getPathToRoot(curr, 0)); i++; } tree.addSelectionPaths(paths); } else if (e.getActionCommand().equals("startEditing")) tree.startEditingAtPath(lead); else if (e.getActionCommand().equals("toggle")) { if (tree.isEditing()) tree.stopEditing(); else { Object last = lead.getLastPathComponent(); TreePath path = new TreePath(getPathToRoot(last, 0)); if (!tree.getModel().isLeaf(last)) { if (tree.isExpanded(path)) tree.collapsePath(path); else tree.expandPath(path); } } } else if (e.getActionCommand().equals("clearSelection")) tree.clearSelection(); if (tree.isEditing() && !e.getActionCommand().equals("startEditing")) tree.cancelEditing(); tree.scrollPathToVisible(lead); }
17
public TreeCancelEditingAction() { }
public TreeCancelEditingAction() { }
18
public void actionPerformed(ActionEvent e) { TreeModel mod = tree.getModel(); Object last = tree.getLeadSelectionPath().getLastPathComponent(); if (e.getActionCommand().equals("selectParent")) { TreePath path = new TreePath(getPathToRoot(last, 0)); Object p = getParent(mod.getRoot(), last); if (!mod.isLeaf(last) && tree.isExpanded(path)) tree.collapsePath(path); else if (p != null) selectPath(tree, new TreePath(getPathToRoot(p, 0))); } else if (e.getActionCommand().equals("selectChild")) { TreePath path = new TreePath(getPathToRoot(last, 0)); if (!mod.isLeaf(last) && tree.isCollapsed(path)) tree.expandPath(path); else { Object next = getNextVisibleNode(last); if (next != null) selectPath(tree, new TreePath(getPathToRoot(next, 0))); } } }
public void actionPerformed(ActionEvent e) { TreeModel mod = tree.getModel(); Object last = tree.getLeadSelectionPath().getLastPathComponent(); if (e.getActionCommand().equals("selectParent")) { TreePath path = new TreePath(getPathToRoot(last, 0)); Object p = getParent(mod.getRoot(), last); if (!mod.isLeaf(last) && tree.isExpanded(path)) tree.collapsePath(path); else if (p != null) selectPath(tree, new TreePath(getPathToRoot(p, 0))); } else if (e.getActionCommand().equals("selectChild")) { TreePath path = new TreePath(getPathToRoot(last, 0)); if (!mod.isLeaf(last) && tree.isCollapsed(path)) tree.expandPath(path); else { Object next = getNextVisibleNode(last); if (next != null) selectPath(tree, new TreePath(getPathToRoot(next, 0))); } } }
19
public void actionPerformed(ActionEvent e) { TreeModel mod = tree.getModel(); Object last = tree.getLeadSelectionPath().getLastPathComponent(); if (e.getActionCommand().equals("selectParent")) { TreePath path = new TreePath(getPathToRoot(last, 0)); Object p = getParent(mod.getRoot(), last); if (!mod.isLeaf(last) && tree.isExpanded(path)) tree.collapsePath(path); else if (p != null) selectPath(tree, new TreePath(getPathToRoot(p, 0))); } else if (e.getActionCommand().equals("selectChild")) { TreePath path = new TreePath(getPathToRoot(last, 0)); if (!mod.isLeaf(last) && tree.isCollapsed(path)) tree.expandPath(path); else { Object next = getNextVisibleNode(last); if (next != null) selectPath(tree, new TreePath(getPathToRoot(next, 0))); } } }
public void actionPerformed(ActionEvent e) { TreeModel mod = tree.getModel(); Object last = tree.getLeadSelectionPath().getLastPathComponent(); if (e.getActionCommand().equals("selectParent")) { TreePath path = new TreePath(getPathToRoot(last, 0)); Object p = getParent(treeModel.getRoot(), last); if (!mod.isLeaf(last) && tree.isExpanded(path)) tree.collapsePath(path); else if (p != null) selectPath(tree, new TreePath(getPathToRoot(p, 0))); } else if (e.getActionCommand().equals("selectChild")) { TreePath path = new TreePath(getPathToRoot(last, 0)); if (!mod.isLeaf(last) && tree.isCollapsed(path)) tree.expandPath(path); else { Object next = getNextVisibleNode(last); if (next != null) selectPath(tree, new TreePath(getPathToRoot(next, 0))); } } }
20
public void actionPerformed(ActionEvent e) { TreeModel mod = tree.getModel(); Object last = tree.getLeadSelectionPath().getLastPathComponent(); if (e.getActionCommand().equals("selectParent")) { TreePath path = new TreePath(getPathToRoot(last, 0)); Object p = getParent(mod.getRoot(), last); if (!mod.isLeaf(last) && tree.isExpanded(path)) tree.collapsePath(path); else if (p != null) selectPath(tree, new TreePath(getPathToRoot(p, 0))); } else if (e.getActionCommand().equals("selectChild")) { TreePath path = new TreePath(getPathToRoot(last, 0)); if (!mod.isLeaf(last) && tree.isCollapsed(path)) tree.expandPath(path); else { Object next = getNextVisibleNode(last); if (next != null) selectPath(tree, new TreePath(getPathToRoot(next, 0))); } } }
public void actionPerformed(ActionEvent e) { TreeModel mod = tree.getModel(); Object last = tree.getLeadSelectionPath().getLastPathComponent(); if (e.getActionCommand().equals("selectParent")) { TreePath path = new TreePath(getPathToRoot(last, 0)); Object p = getParent(mod.getRoot(), last); if (!treeModel.isLeaf(last) && tree.isExpanded(path)) tree.collapsePath(path); else if (p != null) selectPath(tree, new TreePath(getPathToRoot(p, 0))); } else if (e.getActionCommand().equals("selectChild")) { TreePath path = new TreePath(getPathToRoot(last, 0)); if (!mod.isLeaf(last) && tree.isCollapsed(path)) tree.expandPath(path); else { Object next = getNextVisibleNode(last); if (next != null) selectPath(tree, new TreePath(getPathToRoot(next, 0))); } } }
21
public void actionPerformed(ActionEvent e) { TreeModel mod = tree.getModel(); Object last = tree.getLeadSelectionPath().getLastPathComponent(); if (e.getActionCommand().equals("selectParent")) { TreePath path = new TreePath(getPathToRoot(last, 0)); Object p = getParent(mod.getRoot(), last); if (!mod.isLeaf(last) && tree.isExpanded(path)) tree.collapsePath(path); else if (p != null) selectPath(tree, new TreePath(getPathToRoot(p, 0))); } else if (e.getActionCommand().equals("selectChild")) { TreePath path = new TreePath(getPathToRoot(last, 0)); if (!mod.isLeaf(last) && tree.isCollapsed(path)) tree.expandPath(path); else { Object next = getNextVisibleNode(last); if (next != null) selectPath(tree, new TreePath(getPathToRoot(next, 0))); } } }
public void actionPerformed(ActionEvent e) { TreeModel mod = tree.getModel(); Object last = tree.getLeadSelectionPath().getLastPathComponent(); if (e.getActionCommand().equals("selectParent")) { TreePath path = new TreePath(getPathToRoot(last, 0)); Object p = getParent(mod.getRoot(), last); if (!mod.isLeaf(last) && tree.isExpanded(path)) tree.collapsePath(path); else if (p != null) selectPath(tree, new TreePath(getPathToRoot(p, 0))); } else if (e.getActionCommand().equals("selectChild")) { TreePath path = new TreePath(getPathToRoot(last, 0)); if (!treeModel.isLeaf(last) && tree.isCollapsed(path)) tree.expandPath(path); else { Object next = getNextVisibleNode(last); if (next != null) selectPath(tree, new TreePath(getPathToRoot(next, 0))); } } }
22
protected void checkForClickInExpandControl(TreePath path, int mouseX, int mouseY) { // FIXME: not implemented }
protected void checkForClickInExpandControl(TreePath path, int mouseX, int mouseY) { // FIXME: not implemented }
23
protected AbstractLayoutCache.NodeDimensions createNodeDimensions() { // FIXME: not implemented return null; }
protected AbstractLayoutCache.NodeDimensions createNodeDimensions() { // FIXME: not implemented return null; }
24
protected void ensureRowsAreVisible(int beginRow, int endRow) { // FIXME: not implemented }
protected void ensureRowsAreVisible(int beginRow, int endRow) { // FIXME: not implemented }
25
private Object findNode(Object root, Object node) { TreeModel mod = tree.getModel(); int size = 0; if (!mod.isLeaf(root)) size = mod.getChildCount(root); for (int i = 0; i < size; i++) { if (mod.getIndexOfChild(root, node) != -1) return root; Object n = findNode(mod.getChild(root, i), node); if (n != null) return n; } return null; }
private Object findNode(Object root, Object node) { int size = 0; if (!mod.isLeaf(root)) size = mod.getChildCount(root); for (int i = 0; i < size; i++) { if (mod.getIndexOfChild(root, node) != -1) return root; Object n = findNode(mod.getChild(root, i), node); if (n != null) return n; } return null; }
26
private Object findNode(Object root, Object node) { TreeModel mod = tree.getModel(); int size = 0; if (!mod.isLeaf(root)) size = mod.getChildCount(root); for (int i = 0; i < size; i++) { if (mod.getIndexOfChild(root, node) != -1) return root; Object n = findNode(mod.getChild(root, i), node); if (n != null) return n; } return null; }
private Object findNode(Object root, Object node) { TreeModel mod = tree.getModel(); int size = 0; if (!mod.isLeaf(root)) size = mod.getChildCount(root); for (int i = 0; i < size; i++) { if (mod.getIndexOfChild(root, node) != -1) return root; Object n = findNode(mod.getChild(root, i), node); if (n != null) return n; } return null; }
27
private Object findNode(Object root, Object node) { TreeModel mod = tree.getModel(); int size = 0; if (!mod.isLeaf(root)) size = mod.getChildCount(root); for (int i = 0; i < size; i++) { if (mod.getIndexOfChild(root, node) != -1) return root; Object n = findNode(mod.getChild(root, i), node); if (n != null) return n; } return null; }
private Object findNode(Object root, Object node) { TreeModel mod = tree.getModel(); int size = 0; if (!mod.isLeaf(root)) size = mod.getChildCount(root); for (int i = 0; i < size; i++) { if (treeModel.getIndexOfChild(root, node) != -1) return root; Object n = findNode(mod.getChild(root, i), node); if (n != null) return n; } return null; }
28
private Object findNode(Object root, Object node) { TreeModel mod = tree.getModel(); int size = 0; if (!mod.isLeaf(root)) size = mod.getChildCount(root); for (int i = 0; i < size; i++) { if (mod.getIndexOfChild(root, node) != -1) return root; Object n = findNode(mod.getChild(root, i), node); if (n != null) return n; } return null; }
private Object findNode(Object root, Object node) { TreeModel mod = tree.getModel(); int size = 0; if (!mod.isLeaf(root)) size = mod.getChildCount(root); for (int i = 0; i < size; i++) { if (mod.getIndexOfChild(root, node) != -1) return root; Object n = findNode(treeModel.getChild(root, i), node); if (n != null) return n; } return null; }
29
Point getCellLocation(int x, int y, JTree tree, TreeModel mod, Object node, Object startNode) { int rowHeight = getRowHeight(); if (startNode == null || startNode.equals(node)) { if (!tree.isRootVisible() && tree.isExpanded(new TreePath(mod.getRoot()))) return new Point(x + ((getLevel(node)) * rightChildIndent), y); return new Point(x + ((getLevel(node) + 1) * rightChildIndent), y); } if (!mod.isLeaf(startNode) && tree.isExpanded(new TreePath(getPathToRoot(startNode, 0))) && !mod.isLeaf(startNode) && mod.getChildCount(startNode) > 0) { Object child = mod.getChild(startNode, 0); if (child != null) return getCellLocation(x, y + rowHeight, tree, mod, node, child); } return getCellLocation(x, y + rowHeight, tree, mod, node, getNextVisibleNode(startNode)); }
Point getCellLocation(int x, int y, JTree tree, TreeModel mod, Object node, Object startNode) { int rowHeight = getRowHeight(); if (startNode == null || startNode.equals(node)) { if (!tree.isRootVisible() && tree.isExpanded(new TreePath(mod.getRoot()))) return new Point(x + ((getLevel(node)) * rightChildIndent), y); return new Point(x + ((getLevel(node) + 1) * rightChildIndent), y); } if (!mod.isLeaf(startNode) && tree.isExpanded(new TreePath(getPathToRoot(startNode, 0))) && !mod.isLeaf(startNode) && mod.getChildCount(startNode) > 0) { Object child = mod.getChild(startNode, 0); if (child != null) return getCellLocation(x, y + rowHeight, tree, mod, node, child); } return getCellLocation(x, y + rowHeight, tree, mod, node, getNextVisibleNode(startNode)); }
30
protected int getHorizontalLegBuffer() { // FIXME: not implemented return 0; }
protected int getHorizontalLegBuffer() { // FIXME: not implemented return 0; }
31
int getLevel(Object node) { int count = -1; Object current = node; do { current = getParent(tree.getModel().getRoot(), current); count++; } while (current != null); return count; }
int getLevel(Object node) { int count = -1; Object current = node; do { current = getParent(treeModel.getRoot(), current); count++; } while (current != null); return count; }
32
public Dimension getMaximumSize(JComponent c) { // FIXME: not implemented return getPreferredSize(c); }
public Dimension getMaximumSize(JComponent c) { // FIXME: not implemented return getPreferredSize(c); }
33
public Dimension getMinimumSize(JComponent c) { // FIXME: not implemented return getPreferredSize(c); }
public Dimension getMinimumSize(JComponent c) { // FIXME: not implemented return getPreferredSize(c); }
34
Object getNextNode(Object curr) { TreeModel mod = tree.getModel(); if (!mod.isLeaf(curr) && mod.getChildCount(curr) > 0) return mod.getChild(curr, 0); Object node = curr; Object sibling = null; do { sibling = getNextSibling(node); node = getParent(mod.getRoot(), node); } while (sibling == null && node != null); return sibling; }
Object getNextNode(Object curr) { TreeModel mod = tree.getModel(); if (!mod.isLeaf(curr) && mod.getChildCount(curr) > 0) return mod.getChild(curr, 0); Object node = curr; Object sibling = null; do { sibling = getNextSibling(node); node = getParent(mod.getRoot(), node); } while (sibling == null && node != null); return sibling; }
35
Object getNextNode(Object curr) { TreeModel mod = tree.getModel(); if (!mod.isLeaf(curr) && mod.getChildCount(curr) > 0) return mod.getChild(curr, 0); Object node = curr; Object sibling = null; do { sibling = getNextSibling(node); node = getParent(mod.getRoot(), node); } while (sibling == null && node != null); return sibling; }
Object getNextNode(Object curr) { TreeModel mod = tree.getModel(); if (!mod.isLeaf(curr) && mod.getChildCount(curr) > 0) return mod.getChild(curr, 0); Object node = curr; Object sibling = null; do { sibling = getNextSibling(node); node = getParent(treeModel.getRoot(), node); } while (sibling == null && node != null); return sibling; }
36
Object getNextSibling(Object node) { TreeModel mod = tree.getModel(); Object parent = getParent(mod.getRoot(), node); if (parent == null) return null; int index = mod.getIndexOfChild(parent, node) + 1; int size = 0; if (!mod.isLeaf(parent)) size = mod.getChildCount(parent); if (index == 0 || index >= size) return null; return mod.getChild(parent, index); }
Object getNextSibling(Object node) { TreeModel mod = tree.getModel(); Object parent = getParent(mod.getRoot(), node); if (parent == null) return null; int index = mod.getIndexOfChild(parent, node) + 1; int size = 0; if (!mod.isLeaf(parent)) size = mod.getChildCount(parent); if (index == 0 || index >= size) return null; return mod.getChild(parent, index); }
37
Object getNextSibling(Object node) { TreeModel mod = tree.getModel(); Object parent = getParent(mod.getRoot(), node); if (parent == null) return null; int index = mod.getIndexOfChild(parent, node) + 1; int size = 0; if (!mod.isLeaf(parent)) size = mod.getChildCount(parent); if (index == 0 || index >= size) return null; return mod.getChild(parent, index); }
Object getNextSibling(Object node) { TreeModel mod = tree.getModel(); Object parent = getParent(mod.getRoot(), node); if (parent == null) return null; int index = treeModel.getIndexOfChild(parent, node) + 1; int size = 0; if (!mod.isLeaf(parent)) size = mod.getChildCount(parent); if (index == 0 || index >= size) return null; return mod.getChild(parent, index); }
38
Object getNextSibling(Object node) { TreeModel mod = tree.getModel(); Object parent = getParent(mod.getRoot(), node); if (parent == null) return null; int index = mod.getIndexOfChild(parent, node) + 1; int size = 0; if (!mod.isLeaf(parent)) size = mod.getChildCount(parent); if (index == 0 || index >= size) return null; return mod.getChild(parent, index); }
Object getNextSibling(Object node) { TreeModel mod = tree.getModel(); Object parent = getParent(mod.getRoot(), node); if (parent == null) return null; int index = mod.getIndexOfChild(parent, node) + 1; int size = 0; if (!mod.isLeaf(parent)) size = mod.getChildCount(parent); if (index == 0 || index >= size) return null; return mod.getChild(parent, index); }
39
Object getNextSibling(Object node) { TreeModel mod = tree.getModel(); Object parent = getParent(mod.getRoot(), node); if (parent == null) return null; int index = mod.getIndexOfChild(parent, node) + 1; int size = 0; if (!mod.isLeaf(parent)) size = mod.getChildCount(parent); if (index == 0 || index >= size) return null; return mod.getChild(parent, index); }
Object getNextSibling(Object node) { TreeModel mod = tree.getModel(); Object parent = getParent(mod.getRoot(), node); if (parent == null) return null; int index = mod.getIndexOfChild(parent, node) + 1; int size = 0; if (!mod.isLeaf(parent)) size = mod.getChildCount(parent); if (index == 0 || index >= size) return null; return treeModel.getChild(parent, index); }
40
public Rectangle getPathBounds(JTree tree, TreePath path) { if (path != null) { Object cell = path.getLastPathComponent(); TreeModel mod = tree.getModel(); if (mod != null) { Object root = mod.getRoot(); if (!tree.isRootVisible() && tree.isExpanded(new TreePath(root))) root = getNextNode(root); Point loc = getCellLocation(0, 0, tree, mod, cell, root); return getCellBounds(loc.x, loc.y, cell); } } return null; }
public Rectangle getPathBounds(JTree tree, TreePath path) { if (path != null) { Object cell = path.getLastPathComponent(); TreeModel mod = tree.getModel(); if (mod != null) { Object root = mod.getRoot(); if (!tree.isRootVisible() && tree.isExpanded(new TreePath(root))) root = getNextNode(root); Point loc = getCellLocation(0, 0, tree, mod, cell, root); return getCellBounds(loc.x, loc.y, cell); } } return null; }
41
public Rectangle getPathBounds(JTree tree, TreePath path) { if (path != null) { Object cell = path.getLastPathComponent(); TreeModel mod = tree.getModel(); if (mod != null) { Object root = mod.getRoot(); if (!tree.isRootVisible() && tree.isExpanded(new TreePath(root))) root = getNextNode(root); Point loc = getCellLocation(0, 0, tree, mod, cell, root); return getCellBounds(loc.x, loc.y, cell); } } return null; }
public Rectangle getPathBounds(JTree tree, TreePath path) { if (path != null) { Object cell = path.getLastPathComponent(); TreeModel mod = tree.getModel(); if (mod != null) { Object root = treeModel.getRoot(); if (!tree.isRootVisible() && tree.isExpanded(new TreePath(root))) root = getNextNode(root); Point loc = getCellLocation(0, 0, tree, mod, cell, root); return getCellBounds(loc.x, loc.y, cell); } } return null; }
42
public Rectangle getPathBounds(JTree tree, TreePath path) { if (path != null) { Object cell = path.getLastPathComponent(); TreeModel mod = tree.getModel(); if (mod != null) { Object root = mod.getRoot(); if (!tree.isRootVisible() && tree.isExpanded(new TreePath(root))) root = getNextNode(root); Point loc = getCellLocation(0, 0, tree, mod, cell, root); return getCellBounds(loc.x, loc.y, cell); } } return null; }
public Rectangle getPathBounds(JTree tree, TreePath path) { if (path != null) { Object cell = path.getLastPathComponent(); TreeModel mod = tree.getModel(); if (mod != null) { Object root = mod.getRoot(); if (!tree.isRootVisible() && tree.isExpanded(new TreePath(root))) root = getNextNode(root); Point loc = getCellLocation(0, 0, tree, mod, cell, root); return getCellBounds(loc.x, loc.y, cell); } } return null; }
43
public Rectangle getPathBounds(JTree tree, TreePath path) { if (path != null) { Object cell = path.getLastPathComponent(); TreeModel mod = tree.getModel(); if (mod != null) { Object root = mod.getRoot(); if (!tree.isRootVisible() && tree.isExpanded(new TreePath(root))) root = getNextNode(root); Point loc = getCellLocation(0, 0, tree, mod, cell, root); return getCellBounds(loc.x, loc.y, cell); } } return null; }
public Rectangle getPathBounds(JTree tree, TreePath path) { if (path != null) { Object cell = path.getLastPathComponent(); TreeModel mod = tree.getModel(); if (mod != null) { Object root = mod.getRoot(); if (!tree.isRootVisible() && tree.isExpanded(new TreePath(root))) root = getNextNode(root); Point loc = getCellLocation(0, 0, tree, mod, cell, root); return getCellBounds(loc.x, loc.y, cell); } } return null; }
44
public TreePath getPathForRow(JTree tree, int row) { TreeModel mod = tree.getModel(); if (mod != null) { Object node = mod.getRoot(); if (!tree.isRootVisible() && tree.isExpanded(new TreePath(getPathToRoot(node, 0)))) node = getNextNode(node); for (int i = 0; i < row; i++) node = getNextVisibleNode(node); if (node == null) return null; return new TreePath(getPathToRoot(node, 0)); } return null; }
public TreePath getPathForRow(JTree tree, int row) { TreeModel mod = tree.getModel(); if (mod != null) { Object node = mod.getRoot(); if (!tree.isRootVisible() && tree.isExpanded(new TreePath(getPathToRoot(node, 0)))) node = getNextNode(node); for (int i = 0; i < row; i++) node = getNextVisibleNode(node); if (node == null) return null; return new TreePath(getPathToRoot(node, 0)); } return null; }
45
public TreePath getPathForRow(JTree tree, int row) { TreeModel mod = tree.getModel(); if (mod != null) { Object node = mod.getRoot(); if (!tree.isRootVisible() && tree.isExpanded(new TreePath(getPathToRoot(node, 0)))) node = getNextNode(node); for (int i = 0; i < row; i++) node = getNextVisibleNode(node); if (node == null) return null; return new TreePath(getPathToRoot(node, 0)); } return null; }
public TreePath getPathForRow(JTree tree, int row) { TreeModel mod = tree.getModel(); if (mod != null) { Object node = mod.getRoot(); if (!tree.isRootVisible() && tree.isExpanded(new TreePath(getPathToRoot(node, 0)))) node = getNextNode(node); for (int i = 0; i < row; i++) node = getNextVisibleNode(node); if (node == null) return null; return new TreePath(getPathToRoot(node, 0)); } return null; }
46
Object[] getPathToRoot(Object node, int depth) { TreeModel mod = tree.getModel(); if (node == null) { if (depth == 0) return null; return new Object[depth]; } Object[] path = getPathToRoot(getParent(mod.getRoot(), node), depth + 1); path[path.length - depth - 1] = node; return path; }
Object[] getPathToRoot(Object node, int depth) { if (node == null) { if (depth == 0) return null; return new Object[depth]; } Object[] path = getPathToRoot(getParent(mod.getRoot(), node), depth + 1); path[path.length - depth - 1] = node; return path; }
47
Object[] getPathToRoot(Object node, int depth) { TreeModel mod = tree.getModel(); if (node == null) { if (depth == 0) return null; return new Object[depth]; } Object[] path = getPathToRoot(getParent(mod.getRoot(), node), depth + 1); path[path.length - depth - 1] = node; return path; }
Object[] getPathToRoot(Object node, int depth) { TreeModel mod = tree.getModel(); if (node == null) { if (depth == 0) return null; return new Object[depth]; } Object[] path = getPathToRoot(getParent(treeModel.getRoot(), node), depth + 1); path[path.length - depth - 1] = node; return path; }
48
Object getPreviousNode(Object node) { TreeModel mod = tree.getModel(); Object parent = getParent(mod.getRoot(), node); if (parent == null) return null; Object sibling = getPreviousSibling(node); if (sibling == null) return parent; int size = 0; if (!mod.isLeaf(sibling)) size = mod.getChildCount(sibling); while (size > 0) { sibling = mod.getChild(sibling, size - 1); if (!mod.isLeaf(sibling)) size = mod.getChildCount(sibling); else size = 0; } return sibling; }
Object getPreviousNode(Object node) { TreeModel mod = tree.getModel(); Object parent = getParent(mod.getRoot(), node); if (parent == null) return null; Object sibling = getPreviousSibling(node); if (sibling == null) return parent; int size = 0; if (!mod.isLeaf(sibling)) size = mod.getChildCount(sibling); while (size > 0) { sibling = mod.getChild(sibling, size - 1); if (!mod.isLeaf(sibling)) size = mod.getChildCount(sibling); else size = 0; } return sibling; }
49
Object getPreviousNode(Object node) { TreeModel mod = tree.getModel(); Object parent = getParent(mod.getRoot(), node); if (parent == null) return null; Object sibling = getPreviousSibling(node); if (sibling == null) return parent; int size = 0; if (!mod.isLeaf(sibling)) size = mod.getChildCount(sibling); while (size > 0) { sibling = mod.getChild(sibling, size - 1); if (!mod.isLeaf(sibling)) size = mod.getChildCount(sibling); else size = 0; } return sibling; }
Object getPreviousNode(Object node) { TreeModel mod = tree.getModel(); Object parent = getParent(mod.getRoot(), node); if (parent == null) return null; Object sibling = getPreviousSibling(node); if (sibling == null) return parent; int size = 0; if (!mod.isLeaf(sibling)) size = mod.getChildCount(sibling); while (size > 0) { sibling = mod.getChild(sibling, size - 1); if (!mod.isLeaf(sibling)) size = mod.getChildCount(sibling); else size = 0; } return sibling; }
50
Object getPreviousNode(Object node) { TreeModel mod = tree.getModel(); Object parent = getParent(mod.getRoot(), node); if (parent == null) return null; Object sibling = getPreviousSibling(node); if (sibling == null) return parent; int size = 0; if (!mod.isLeaf(sibling)) size = mod.getChildCount(sibling); while (size > 0) { sibling = mod.getChild(sibling, size - 1); if (!mod.isLeaf(sibling)) size = mod.getChildCount(sibling); else size = 0; } return sibling; }
Object getPreviousNode(Object node) { TreeModel mod = tree.getModel(); Object parent = getParent(mod.getRoot(), node); if (parent == null) return null; Object sibling = getPreviousSibling(node); if (sibling == null) return parent; int size = 0; if (!mod.isLeaf(sibling)) size = mod.getChildCount(sibling); while (size > 0) { sibling = mod.getChild(sibling, size - 1); if (!mod.isLeaf(sibling)) size = mod.getChildCount(sibling); else size = 0; } return sibling; }
51
Object getPreviousSibling(Object node) { TreeModel mod = tree.getModel(); Object parent = getParent(mod.getRoot(), node); if (parent == null) return null; int index = mod.getIndexOfChild(parent, node) - 1; int size = 0; if (!mod.isLeaf(parent)) size = mod.getChildCount(parent); if (index < 0 || index >= size) return null; return mod.getChild(parent, index); }
Object getPreviousSibling(Object node) { TreeModel mod = tree.getModel(); Object parent = getParent(mod.getRoot(), node); if (parent == null) return null; int index = mod.getIndexOfChild(parent, node) - 1; int size = 0; if (!mod.isLeaf(parent)) size = mod.getChildCount(parent); if (index < 0 || index >= size) return null; return mod.getChild(parent, index); }
52
Object getPreviousSibling(Object node) { TreeModel mod = tree.getModel(); Object parent = getParent(mod.getRoot(), node); if (parent == null) return null; int index = mod.getIndexOfChild(parent, node) - 1; int size = 0; if (!mod.isLeaf(parent)) size = mod.getChildCount(parent); if (index < 0 || index >= size) return null; return mod.getChild(parent, index); }
Object getPreviousSibling(Object node) { TreeModel mod = tree.getModel(); Object parent = getParent(mod.getRoot(), node); if (parent == null) return null; int index = treeModel.getIndexOfChild(parent, node) - 1; int size = 0; if (!mod.isLeaf(parent)) size = mod.getChildCount(parent); if (index < 0 || index >= size) return null; return mod.getChild(parent, index); }
53
Object getPreviousSibling(Object node) { TreeModel mod = tree.getModel(); Object parent = getParent(mod.getRoot(), node); if (parent == null) return null; int index = mod.getIndexOfChild(parent, node) - 1; int size = 0; if (!mod.isLeaf(parent)) size = mod.getChildCount(parent); if (index < 0 || index >= size) return null; return mod.getChild(parent, index); }
Object getPreviousSibling(Object node) { TreeModel mod = tree.getModel(); Object parent = getParent(mod.getRoot(), node); if (parent == null) return null; int index = mod.getIndexOfChild(parent, node) - 1; int size = 0; if (!mod.isLeaf(parent)) size = mod.getChildCount(parent); if (index < 0 || index >= size) return null; return mod.getChild(parent, index); }
54
Object getPreviousSibling(Object node) { TreeModel mod = tree.getModel(); Object parent = getParent(mod.getRoot(), node); if (parent == null) return null; int index = mod.getIndexOfChild(parent, node) - 1; int size = 0; if (!mod.isLeaf(parent)) size = mod.getChildCount(parent); if (index < 0 || index >= size) return null; return mod.getChild(parent, index); }
Object getPreviousSibling(Object node) { TreeModel mod = tree.getModel(); Object parent = getParent(mod.getRoot(), node); if (parent == null) return null; int index = mod.getIndexOfChild(parent, node) - 1; int size = 0; if (!mod.isLeaf(parent)) size = mod.getChildCount(parent); if (index < 0 || index >= size) return null; return treeModel.getChild(parent, index); }
55
public int getRowCount(JTree tree) { TreeModel mod = tree.getModel(); int count = 0; if (mod != null) { Object node = mod.getRoot(); if (!tree.isRootVisible() && tree.isExpanded(new TreePath((getPathToRoot(node, 0))))) node = getNextNode(node); while (node != null) { count++; node = getNextVisibleNode(node); } } return count; }
public int getRowCount(JTree tree) { TreeModel mod = tree.getModel(); int count = 0; if (mod != null) { Object node = mod.getRoot(); if (!tree.isRootVisible() && tree.isExpanded(new TreePath((getPathToRoot(node, 0))))) node = getNextNode(node); while (node != null) { count++; node = getNextVisibleNode(node); } } return count; }
56
public int getRowCount(JTree tree) { TreeModel mod = tree.getModel(); int count = 0; if (mod != null) { Object node = mod.getRoot(); if (!tree.isRootVisible() && tree.isExpanded(new TreePath((getPathToRoot(node, 0))))) node = getNextNode(node); while (node != null) { count++; node = getNextVisibleNode(node); } } return count; }
public int getRowCount(JTree tree) { TreeModel mod = tree.getModel(); int count = 0; if (treeModel != null) { Object node = mod.getRoot(); if (!tree.isRootVisible() && tree.isExpanded(new TreePath((getPathToRoot(node, 0))))) node = getNextNode(node); while (node != null) { count++; node = getNextVisibleNode(node); } } return count; }
57
public int getRowCount(JTree tree) { TreeModel mod = tree.getModel(); int count = 0; if (mod != null) { Object node = mod.getRoot(); if (!tree.isRootVisible() && tree.isExpanded(new TreePath((getPathToRoot(node, 0))))) node = getNextNode(node); while (node != null) { count++; node = getNextVisibleNode(node); } } return count; }
public int getRowCount(JTree tree) { TreeModel mod = tree.getModel(); int count = 0; if (mod != null) { Object node = mod.getRoot(); if (!tree.isRootVisible() && tree.isExpanded(new TreePath((getPathToRoot(node, 0))))) node = getNextNode(node); while (node != null) { count++; node = getNextVisibleNode(node); } } return count; }
58
public int getRowCount(JTree tree) { TreeModel mod = tree.getModel(); int count = 0; if (mod != null) { Object node = mod.getRoot(); if (!tree.isRootVisible() && tree.isExpanded(new TreePath((getPathToRoot(node, 0))))) node = getNextNode(node); while (node != null) { count++; node = getNextVisibleNode(node); } } return count; }
public int getRowCount(JTree tree) { TreeModel mod = tree.getModel(); int count = 0; if (mod != null) { Object node = mod.getRoot(); if (!tree.isRootVisible() && tree.isExpanded(new TreePath((getPathToRoot(node, 0))))) node = getNextNode(node); while (node != null) { count++; node = getNextVisibleNode(node); } } return count; }
59
public int getRowForPath(JTree tree, TreePath path) { int row = path.getPathCount(); if (tree.isVisible(path)) return row; path = path.getParentPath(); while (row > 0 && !tree.isVisible(path)) { path = path.getParentPath(); row--; } return row; }
public int getRowForPath(JTree tree, TreePath path) { int row = path.getPathCount(); if (tree.isVisible(path)) return row; path = path.getParentPath(); while (row > 0 && !tree.isVisible(path)) { path = path.getParentPath(); row--; } return row; }
60
public int getRowForPath(JTree tree, TreePath path) { int row = path.getPathCount(); if (tree.isVisible(path)) return row; path = path.getParentPath(); while (row > 0 && !tree.isVisible(path)) { path = path.getParentPath(); row--; } return row; }
public int getRowForPath(JTree tree, TreePath path) { int row = path.getPathCount(); if (tree.isVisible(path)) return row; path = path.getParentPath(); while (row > 0 && !tree.isVisible(path)) { path = path.getParentPath(); row--; } return row; }
61
protected int getVerticalLegBuffer() { // FIXME: not implemented return 0; }
protected int getVerticalLegBuffer() { // FIXME: not implemented return 0; }
62
protected void handleExpandControlClick(TreePath path, int mouseX, int mouseY) { // FIXME: not implemented }
protected void handleExpandControlClick(TreePath path, int mouseX, int mouseY) { // FIXME: not implemented }
63
boolean hasControlIcons() { if (UIManager.getLookAndFeelDefaults().getIcon("Tree.expandedIcon") == null || UIManager.getLookAndFeelDefaults().getIcon("Tree.collapsedIcon") == null) return false; return true; }
boolean hasControlIcons() { if (UIManager.getLookAndFeelDefaults().getIcon("Tree.expandedIcon") == null || UIManager.getLookAndFeelDefaults().getIcon("Tree.collapsedIcon") == null) return false; return true; }
64
boolean hasControlIcons() { if (UIManager.getLookAndFeelDefaults().getIcon("Tree.expandedIcon") == null || UIManager.getLookAndFeelDefaults().getIcon("Tree.collapsedIcon") == null) return false; return true; }
boolean hasControlIcons() { if (UIManager.getLookAndFeelDefaults().getIcon("Tree.expandedIcon") == null || UIManager.getLookAndFeelDefaults().getIcon("Tree.collapsedIcon") == null) return false; return true; return false; }
65
protected void installComponents() { // FIXME: not implemented }
protected void installComponents() { // FIXME: not implemented }
66
protected void installDefaults() { UIDefaults defaults = UIManager.getLookAndFeelDefaults(); tree.setFont(defaults.getFont("Tree.font")); tree.setForeground(defaults.getColor("Tree.foreground")); tree.setBackground(defaults.getColor("Tree.background")); tree.setOpaque(true); rightChildIndent = defaults.getInt("Tree.rightChildIndent"); leftChildIndent = defaults.getInt("Tree.leftChildIndent"); setRowHeight(defaults.getInt("Tree.rowHeight")); tree.requestFocusInWindow(false); }
protected void installDefaults() { UIDefaults defaults = UIManager.getLookAndFeelDefaults(); tree.setFont(defaults.getFont("Tree.font")); tree.setForeground(defaults.getColor("Tree.foreground")); tree.setBackground(defaults.getColor("Tree.background")); tree.setOpaque(true); rightChildIndent = defaults.getInt("Tree.rightChildIndent"); leftChildIndent = defaults.getInt("Tree.leftChildIndent"); setRowHeight(defaults.getInt("Tree.rowHeight")); tree.requestFocusInWindow(false); tree.setScrollsOnExpand(defaults.getBoolean("Tree.scrollsOnExpand")); setExpandedIcon(defaults.getIcon("Tree.expandedIcon")); setCollapsedIcon(defaults.getIcon("Tree.collapsedIcon")); }
67
public void installUI(JComponent c) { super.installUI(c); tree = (JTree) c; installDefaults(); currentCellRenderer = createDefaultCellRenderer(); rendererPane = createCellRendererPane(); createdRenderer = true; setCellEditor(createDefaultCellEditor()); createdCellEditor = true; isEditing = false; TreeModel mod = tree.getModel(); setModel(mod); tree.setRootVisible(true); if (mod != null) tree.expandPath(new TreePath(mod.getRoot())); treeSelectionModel = tree.getSelectionModel(); installKeyboardActions(); installListeners(); completeUIInstall(); }
public void installUI(JComponent c) { super.installUI(c); tree = (JTree) c; installDefaults(); currentCellRenderer = createDefaultCellRenderer(); rendererPane = createCellRendererPane(); createdRenderer = true; setCellEditor(createDefaultCellEditor()); createdCellEditor = true; isEditing = false; TreeModel mod = tree.getModel(); setModel(mod); tree.setRootVisible(true); if (mod != null) tree.expandPath(new TreePath(mod.getRoot())); treeSelectionModel = tree.getSelectionModel(); installKeyboardActions(); installListeners(); completeUIInstall(); }
68
public void installUI(JComponent c) { super.installUI(c); tree = (JTree) c; installDefaults(); currentCellRenderer = createDefaultCellRenderer(); rendererPane = createCellRendererPane(); createdRenderer = true; setCellEditor(createDefaultCellEditor()); createdCellEditor = true; isEditing = false; TreeModel mod = tree.getModel(); setModel(mod); tree.setRootVisible(true); if (mod != null) tree.expandPath(new TreePath(mod.getRoot())); treeSelectionModel = tree.getSelectionModel(); installKeyboardActions(); installListeners(); completeUIInstall(); }
public void installUI(JComponent c) { super.installUI(c); tree = (JTree) c; installDefaults(); currentCellRenderer = createDefaultCellRenderer(); rendererPane = createCellRendererPane(); createdRenderer = true; setCellEditor(createDefaultCellEditor()); createdCellEditor = true; isEditing = false; TreeModel mod = tree.getModel(); setModel(mod); tree.setRootVisible(true); if (mod != null) tree.expandPath(new TreePath(mod.getRoot())); treeSelectionModel = tree.getSelectionModel(); installKeyboardActions(); installListeners(); completeUIInstall(); }
69
protected boolean isLeaf(int row) { TreePath pathForRow = getPathForRow(tree, row); if (pathForRow == null) return true; Object node = pathForRow.getLastPathComponent(); return tree.getModel().isLeaf(node); }
protected boolean isLeaf(int row) { TreePath pathForRow = getPathForRow(tree, row); if (pathForRow == null) return true; Object node = pathForRow.getLastPathComponent(); return tree.getModel().isLeaf(node); }
70
protected boolean isLocationInExpandControl(TreePath path, int mouseX, int mouseY) { // FIXME: not implemented return false; }
protected boolean isLocationInExpandControl(TreePath path, int mouseX, int mouseY) { // FIXME: not implemented return false; }
71
protected boolean isMultiSelectEvent(MouseEvent event) { // FIXME: not implemented return false; }
protected boolean isMultiSelectEvent(MouseEvent event) { // FIXME: not implemented return false; }
72
protected boolean isToggleEvent(MouseEvent event) { // FIXME: not implemented return false; }
protected boolean isToggleEvent(MouseEvent event) { // FIXME: not implemented return false; }
73
protected boolean isToggleSelectionEvent(MouseEvent event) { // FIXME: not implemented return false; }
protected boolean isToggleSelectionEvent(MouseEvent event) { // FIXME: not implemented return false; }
74
public void paint(Graphics g, JComponent c) { JTree tree = (JTree) c; TreeModel mod = tree.getModel(); if (mod != null) { Object root = mod.getRoot(); if (!tree.isRootVisible()) tree.expandPath(new TreePath(root)); paintRecursive(g, 0, 0, 0, 0, tree, mod, root); if (hasControlIcons()) paintControlIcons(g, 0, 0, 0, 0, tree, mod, root); } }
public void paint(Graphics g, JComponent c) { JTree tree = (JTree) c; if (treeModel != null) { Object root = treeModel.getRoot(); if (mod != null) { Object root = mod.getRoot(); if (!tree.isRootVisible()) tree.expandPath(new TreePath(root)); paintRecursive(g, 0, 0, 0, 0, tree, mod, root); if (hasControlIcons()) paintControlIcons(g, 0, 0, 0, 0, tree, mod, root); } }
75
public void paint(Graphics g, JComponent c) { JTree tree = (JTree) c; TreeModel mod = tree.getModel(); if (mod != null) { Object root = mod.getRoot(); if (!tree.isRootVisible()) tree.expandPath(new TreePath(root)); paintRecursive(g, 0, 0, 0, 0, tree, mod, root); if (hasControlIcons()) paintControlIcons(g, 0, 0, 0, 0, tree, mod, root); } }
public void paint(Graphics g, JComponent c) { JTree tree = (JTree) c; TreeModel mod = tree.getModel(); if (mod != null) { Object root = mod.getRoot(); if (!tree.isRootVisible()) tree.expandPath(new TreePath(root)); paintRecursive(g, 0, 0, 0, 0, tree, mod, root); if (hasControlIcons()) paintControlIcons(g, 0, 0, 0, 0, tree, mod, root); } }
76
int paintControlIcons(Graphics g, int indentation, int descent, int childNumber, int depth, JTree tree, TreeModel mod, Object node) { int h = descent; int rowHeight = getRowHeight(); Icon ei = UIManager.getLookAndFeelDefaults().getIcon("Tree.expandedIcon"); Icon ci = UIManager.getLookAndFeelDefaults().getIcon("Tree.collapsedIcon"); Rectangle clip = g.getClipBounds(); if (indentation > clip.x + clip.width + rightChildIndent || descent > clip.y + clip.height + getRowHeight()) return descent; if (mod.isLeaf(node)) descent += rowHeight; else { if (depth > 0 || tree.isRootVisible()) descent += rowHeight; int max = 0; if (!mod.isLeaf(node)) max = mod.getChildCount(node); if (tree.isExpanded(new TreePath(getPathToRoot(node, 0)))) { if (!node.equals(mod.getRoot())) ei.paintIcon(tree, g, indentation - rightChildIndent - 3, h); for (int i = 0; i < max; i++) { int indent = indentation + rightChildIndent; if (depth == 0 && !tree.isRootVisible()) indent = -1; descent = paintControlIcons(g, indent, descent, i, depth + 1, tree, mod, mod.getChild(node, i)); } } else if (!node.equals(mod.getRoot())) ci.paintIcon(tree, g, indentation - rightChildIndent - 3, descent - getRowHeight()); } return descent; }
int paintControlIcons(Graphics g, int indentation, int descent, int childNumber, int depth, JTree tree, TreeModel mod, Object node) { int h = descent; int rowHeight = getRowHeight(); Icon ei = UIManager.getLookAndFeelDefaults().getIcon("Tree.expandedIcon"); Icon ci = UIManager.getLookAndFeelDefaults().getIcon("Tree.collapsedIcon"); Rectangle clip = g.getClipBounds(); if (indentation > clip.x + clip.width + rightChildIndent || descent > clip.y + clip.height + getRowHeight()) return descent; if (mod.isLeaf(node)) descent += rowHeight; else { if (depth > 0 || tree.isRootVisible()) descent += rowHeight; int max = 0; if (!mod.isLeaf(node)) max = mod.getChildCount(node); if (tree.isExpanded(new TreePath(getPathToRoot(node, 0)))) { if (!node.equals(mod.getRoot())) ei.paintIcon(tree, g, indentation - rightChildIndent - 3, h); for (int i = 0; i < max; i++) { int indent = indentation + rightChildIndent; if (depth == 0 && !tree.isRootVisible()) indent = -1; descent = paintControlIcons(g, indent, descent, i, depth + 1, tree, mod, mod.getChild(node, i)); } } else if (!node.equals(mod.getRoot())) ci.paintIcon(tree, g, indentation - rightChildIndent - 3, descent - getRowHeight()); } return descent; }
77
int paintControlIcons(Graphics g, int indentation, int descent, int childNumber, int depth, JTree tree, TreeModel mod, Object node) { int h = descent; int rowHeight = getRowHeight(); Icon ei = UIManager.getLookAndFeelDefaults().getIcon("Tree.expandedIcon"); Icon ci = UIManager.getLookAndFeelDefaults().getIcon("Tree.collapsedIcon"); Rectangle clip = g.getClipBounds(); if (indentation > clip.x + clip.width + rightChildIndent || descent > clip.y + clip.height + getRowHeight()) return descent; if (mod.isLeaf(node)) descent += rowHeight; else { if (depth > 0 || tree.isRootVisible()) descent += rowHeight; int max = 0; if (!mod.isLeaf(node)) max = mod.getChildCount(node); if (tree.isExpanded(new TreePath(getPathToRoot(node, 0)))) { if (!node.equals(mod.getRoot())) ei.paintIcon(tree, g, indentation - rightChildIndent - 3, h); for (int i = 0; i < max; i++) { int indent = indentation + rightChildIndent; if (depth == 0 && !tree.isRootVisible()) indent = -1; descent = paintControlIcons(g, indent, descent, i, depth + 1, tree, mod, mod.getChild(node, i)); } } else if (!node.equals(mod.getRoot())) ci.paintIcon(tree, g, indentation - rightChildIndent - 3, descent - getRowHeight()); } return descent; }
int paintControlIcons(Graphics g, int indentation, int descent, int childNumber, int depth, JTree tree, TreeModel mod, Object node) { int h = descent; int rowHeight = getRowHeight(); Icon ei = UIManager.getLookAndFeelDefaults().getIcon("Tree.expandedIcon"); Icon ci = UIManager.getLookAndFeelDefaults().getIcon("Tree.collapsedIcon"); Rectangle clip = g.getClipBounds(); if (indentation > clip.x + clip.width + rightChildIndent || descent > clip.y + clip.height + getRowHeight()) return descent; if (mod.isLeaf(node)) descent += rowHeight; else { if (depth > 0 || tree.isRootVisible()) descent += rowHeight; int max = 0; if (!mod.isLeaf(node)) max = mod.getChildCount(node); if (tree.isExpanded(new TreePath(getPathToRoot(node, 0)))) { if (!node.equals(mod.getRoot())) ei.paintIcon(tree, g, indentation - rightChildIndent - 3, h); for (int i = 0; i < max; i++) { int indent = indentation + rightChildIndent; if (depth == 0 && !tree.isRootVisible()) indent = -1; descent = paintControlIcons(g, indent, descent, i, depth + 1, tree, mod, mod.getChild(node, i)); } } else if (!node.equals(mod.getRoot())) ci.paintIcon(tree, g, indentation - rightChildIndent - 3, descent - getRowHeight()); } return descent; }
78
int paintControlIcons(Graphics g, int indentation, int descent, int childNumber, int depth, JTree tree, TreeModel mod, Object node) { int h = descent; int rowHeight = getRowHeight(); Icon ei = UIManager.getLookAndFeelDefaults().getIcon("Tree.expandedIcon"); Icon ci = UIManager.getLookAndFeelDefaults().getIcon("Tree.collapsedIcon"); Rectangle clip = g.getClipBounds(); if (indentation > clip.x + clip.width + rightChildIndent || descent > clip.y + clip.height + getRowHeight()) return descent; if (mod.isLeaf(node)) descent += rowHeight; else { if (depth > 0 || tree.isRootVisible()) descent += rowHeight; int max = 0; if (!mod.isLeaf(node)) max = mod.getChildCount(node); if (tree.isExpanded(new TreePath(getPathToRoot(node, 0)))) { if (!node.equals(mod.getRoot())) ei.paintIcon(tree, g, indentation - rightChildIndent - 3, h); for (int i = 0; i < max; i++) { int indent = indentation + rightChildIndent; if (depth == 0 && !tree.isRootVisible()) indent = -1; descent = paintControlIcons(g, indent, descent, i, depth + 1, tree, mod, mod.getChild(node, i)); } } else if (!node.equals(mod.getRoot())) ci.paintIcon(tree, g, indentation - rightChildIndent - 3, descent - getRowHeight()); } return descent; }
int paintControlIcons(Graphics g, int indentation, int descent, int childNumber, int depth, JTree tree, TreeModel mod, Object node) { int h = descent; int rowHeight = getRowHeight(); Icon ei = UIManager.getLookAndFeelDefaults().getIcon("Tree.expandedIcon"); Icon ci = UIManager.getLookAndFeelDefaults().getIcon("Tree.collapsedIcon"); Rectangle clip = g.getClipBounds(); if (indentation > clip.x + clip.width + rightChildIndent || descent > clip.y + clip.height + getRowHeight()) return descent; if (mod.isLeaf(node)) descent += rowHeight; else { if (depth > 0 || tree.isRootVisible()) descent += rowHeight; int max = 0; if (!mod.isLeaf(node)) max = mod.getChildCount(node); if (tree.isExpanded(new TreePath(getPathToRoot(node, 0)))) { if (!node.equals(mod.getRoot())) ei.paintIcon(tree, g, indentation - rightChildIndent - 3, h); for (int i = 0; i < max; i++) { int indent = indentation + rightChildIndent; if (depth == 0 && !tree.isRootVisible()) indent = -1; descent = paintControlIcons(g, indent, descent, i, depth + 1, tree, mod, mod.getChild(node, i)); } } else if (!node.equals(mod.getRoot())) ci.paintIcon(tree, g, indentation - rightChildIndent - 3, descent - getRowHeight()); } return descent; }
79
int paintRecursive(Graphics g, int indentation, int descent, int childNumber, int depth, JTree tree, TreeModel mod, Object curr) { Rectangle clip = g.getClipBounds(); if (indentation > clip.x + clip.width + rightChildIndent || descent > clip.y + clip.height + getRowHeight()) return descent; int halfHeight = getRowHeight() / 2; int halfWidth = rightChildIndent / 2; int y0 = descent + halfHeight; int heightOfLine = descent + halfHeight; boolean isRootVisible = tree.isRootVisible(); if (mod.isLeaf(curr)) { paintNode(g, indentation + 4, descent, tree, curr, true); descent += getRowHeight(); } else { if (depth > 0 || isRootVisible) { paintNode(g, indentation + 4, descent, tree, curr, false); descent += getRowHeight(); y0 += halfHeight; } int max = 0; if (!mod.isLeaf(curr)) max = mod.getChildCount(curr); if (tree.isExpanded(new TreePath(getPathToRoot(curr, 0)))) { for (int i = 0; i < max; i++) { int indent = indentation + rightChildIndent; if (!isRootVisible && depth == 0) indent = 0; else if ((!isRootVisible && !curr.equals(mod.getRoot())) || isRootVisible) { g.setColor(getHashColor()); heightOfLine = descent + halfHeight; g.drawLine(indentation + halfWidth, heightOfLine, indentation + rightChildIndent, heightOfLine); } descent = paintRecursive(g, indent, descent, i, depth + 1, tree, mod, mod.getChild(curr, i)); } } } if (tree.isExpanded(new TreePath(getPathToRoot(curr, 0)))) if (y0 != heightOfLine && !mod.isLeaf(curr) && mod.getChildCount(curr) > 0) { g.setColor(getHashColor()); g.drawLine(indentation + halfWidth, y0, indentation + halfWidth, heightOfLine); } return descent; }
int paintRecursive(Graphics g, int indentation, int descent, int childNumber, int depth, JTree tree, TreeModel mod, Object curr) { Rectangle clip = g.getClipBounds(); if (indentation > clip.x + clip.width + rightChildIndent || descent > clip.y + clip.height + getRowHeight()) return descent; int halfHeight = getRowHeight() / 2; int halfWidth = rightChildIndent / 2; int y0 = descent + halfHeight; int heightOfLine = descent + halfHeight; boolean isRootVisible = tree.isRootVisible(); if (mod.isLeaf(curr)) { paintNode(g, indentation + 4, descent, tree, curr, true); descent += getRowHeight(); } else { if (depth > 0 || isRootVisible) { paintNode(g, indentation + 4, descent, tree, curr, false); descent += getRowHeight(); y0 += halfHeight; } int max = 0; if (!mod.isLeaf(curr)) max = mod.getChildCount(curr); if (tree.isExpanded(new TreePath(getPathToRoot(curr, 0)))) { for (int i = 0; i < max; i++) { int indent = indentation + rightChildIndent; if (!isRootVisible && depth == 0) indent = 0; else if ((!isRootVisible && !curr.equals(mod.getRoot())) || isRootVisible) { g.setColor(getHashColor()); heightOfLine = descent + halfHeight; g.drawLine(indentation + halfWidth, heightOfLine, indentation + rightChildIndent, heightOfLine); } descent = paintRecursive(g, indent, descent, i, depth + 1, tree, mod, mod.getChild(curr, i)); } } } if (tree.isExpanded(new TreePath(getPathToRoot(curr, 0)))) if (y0 != heightOfLine && !mod.isLeaf(curr) && mod.getChildCount(curr) > 0) { g.setColor(getHashColor()); g.drawLine(indentation + halfWidth, y0, indentation + halfWidth, heightOfLine); } return descent; }
80
int paintRecursive(Graphics g, int indentation, int descent, int childNumber, int depth, JTree tree, TreeModel mod, Object curr) { Rectangle clip = g.getClipBounds(); if (indentation > clip.x + clip.width + rightChildIndent || descent > clip.y + clip.height + getRowHeight()) return descent; int halfHeight = getRowHeight() / 2; int halfWidth = rightChildIndent / 2; int y0 = descent + halfHeight; int heightOfLine = descent + halfHeight; boolean isRootVisible = tree.isRootVisible(); if (mod.isLeaf(curr)) { paintNode(g, indentation + 4, descent, tree, curr, true); descent += getRowHeight(); } else { if (depth > 0 || isRootVisible) { paintNode(g, indentation + 4, descent, tree, curr, false); descent += getRowHeight(); y0 += halfHeight; } int max = 0; if (!mod.isLeaf(curr)) max = mod.getChildCount(curr); if (tree.isExpanded(new TreePath(getPathToRoot(curr, 0)))) { for (int i = 0; i < max; i++) { int indent = indentation + rightChildIndent; if (!isRootVisible && depth == 0) indent = 0; else if ((!isRootVisible && !curr.equals(mod.getRoot())) || isRootVisible) { g.setColor(getHashColor()); heightOfLine = descent + halfHeight; g.drawLine(indentation + halfWidth, heightOfLine, indentation + rightChildIndent, heightOfLine); } descent = paintRecursive(g, indent, descent, i, depth + 1, tree, mod, mod.getChild(curr, i)); } } } if (tree.isExpanded(new TreePath(getPathToRoot(curr, 0)))) if (y0 != heightOfLine && !mod.isLeaf(curr) && mod.getChildCount(curr) > 0) { g.setColor(getHashColor()); g.drawLine(indentation + halfWidth, y0, indentation + halfWidth, heightOfLine); } return descent; }
int paintRecursive(Graphics g, int indentation, int descent, int childNumber, int depth, JTree tree, TreeModel mod, Object curr) { Rectangle clip = g.getClipBounds(); if (indentation > clip.x + clip.width + rightChildIndent || descent > clip.y + clip.height + getRowHeight()) return descent; int halfHeight = getRowHeight() / 2; int halfWidth = rightChildIndent / 2; int y0 = descent + halfHeight; int heightOfLine = descent + halfHeight; boolean isRootVisible = tree.isRootVisible(); if (mod.isLeaf(curr)) { paintNode(g, indentation + 4, descent, tree, curr, true); descent += getRowHeight(); } else { if (depth > 0 || isRootVisible) { paintNode(g, indentation + 4, descent, tree, curr, false); descent += getRowHeight(); y0 += halfHeight; } int max = 0; if (!mod.isLeaf(curr)) max = mod.getChildCount(curr); if (tree.isExpanded(new TreePath(getPathToRoot(curr, 0)))) { for (int i = 0; i < max; i++) { int indent = indentation + rightChildIndent; if (!isRootVisible && depth == 0) indent = 0; else if ((!isRootVisible && !curr.equals(mod.getRoot())) || isRootVisible) { g.setColor(getHashColor()); heightOfLine = descent + halfHeight; g.drawLine(indentation + halfWidth, heightOfLine, indentation + rightChildIndent, heightOfLine); } descent = paintRecursive(g, indent, descent, i, depth + 1, tree, mod, mod.getChild(curr, i)); } } } if (tree.isExpanded(new TreePath(getPathToRoot(curr, 0)))) if (y0 != heightOfLine && !mod.isLeaf(curr) && mod.getChildCount(curr) > 0) { g.setColor(getHashColor()); g.drawLine(indentation + halfWidth, y0, indentation + halfWidth, heightOfLine); } return descent; }
81
int paintRecursive(Graphics g, int indentation, int descent, int childNumber, int depth, JTree tree, TreeModel mod, Object curr) { Rectangle clip = g.getClipBounds(); if (indentation > clip.x + clip.width + rightChildIndent || descent > clip.y + clip.height + getRowHeight()) return descent; int halfHeight = getRowHeight() / 2; int halfWidth = rightChildIndent / 2; int y0 = descent + halfHeight; int heightOfLine = descent + halfHeight; boolean isRootVisible = tree.isRootVisible(); if (mod.isLeaf(curr)) { paintNode(g, indentation + 4, descent, tree, curr, true); descent += getRowHeight(); } else { if (depth > 0 || isRootVisible) { paintNode(g, indentation + 4, descent, tree, curr, false); descent += getRowHeight(); y0 += halfHeight; } int max = 0; if (!mod.isLeaf(curr)) max = mod.getChildCount(curr); if (tree.isExpanded(new TreePath(getPathToRoot(curr, 0)))) { for (int i = 0; i < max; i++) { int indent = indentation + rightChildIndent; if (!isRootVisible && depth == 0) indent = 0; else if ((!isRootVisible && !curr.equals(mod.getRoot())) || isRootVisible) { g.setColor(getHashColor()); heightOfLine = descent + halfHeight; g.drawLine(indentation + halfWidth, heightOfLine, indentation + rightChildIndent, heightOfLine); } descent = paintRecursive(g, indent, descent, i, depth + 1, tree, mod, mod.getChild(curr, i)); } } } if (tree.isExpanded(new TreePath(getPathToRoot(curr, 0)))) if (y0 != heightOfLine && !mod.isLeaf(curr) && mod.getChildCount(curr) > 0) { g.setColor(getHashColor()); g.drawLine(indentation + halfWidth, y0, indentation + halfWidth, heightOfLine); } return descent; }
int paintRecursive(Graphics g, int indentation, int descent, int childNumber, int depth, JTree tree, TreeModel mod, Object curr) { Rectangle clip = g.getClipBounds(); if (indentation > clip.x + clip.width + rightChildIndent || descent > clip.y + clip.height + getRowHeight()) return descent; int halfHeight = getRowHeight() / 2; int halfWidth = rightChildIndent / 2; int y0 = descent + halfHeight; int heightOfLine = descent + halfHeight; boolean isRootVisible = tree.isRootVisible(); if (mod.isLeaf(curr)) { paintNode(g, indentation + 4, descent, tree, curr, true); descent += getRowHeight(); else { if (depth > 0 || isRootVisible) { paintNode(g, indentation + 4, descent, tree, curr, false); descent += getRowHeight(); y0 += halfHeight; int max = 0; if (!mod.isLeaf(curr)) max = mod.getChildCount(curr); if (tree.isExpanded(new TreePath(getPathToRoot(curr, 0)))) { for (int i = 0; i < max; i++) { int indent = indentation + rightChildIndent; if (!isRootVisible && depth == 0) indent = 0; else if ((!isRootVisible && !curr.equals(mod.getRoot())) || isRootVisible) { g.setColor(getHashColor()); heightOfLine = descent + halfHeight; g.drawLine(indentation + halfWidth, heightOfLine, indentation + rightChildIndent, heightOfLine); descent = paintRecursive(g, indent, descent, i, depth + 1, tree, mod, mod.getChild(curr, i)); if (tree.isExpanded(new TreePath(getPathToRoot(curr, 0)))) if (y0 != heightOfLine && !mod.isLeaf(curr) && mod.getChildCount(curr) > 0) { g.setColor(getHashColor()); g.drawLine(indentation + halfWidth, y0, indentation + halfWidth, heightOfLine); return descent;
82
int paintRecursive(Graphics g, int indentation, int descent, int childNumber, int depth, JTree tree, TreeModel mod, Object curr) { Rectangle clip = g.getClipBounds(); if (indentation > clip.x + clip.width + rightChildIndent || descent > clip.y + clip.height + getRowHeight()) return descent; int halfHeight = getRowHeight() / 2; int halfWidth = rightChildIndent / 2; int y0 = descent + halfHeight; int heightOfLine = descent + halfHeight; boolean isRootVisible = tree.isRootVisible(); if (mod.isLeaf(curr)) { paintNode(g, indentation + 4, descent, tree, curr, true); descent += getRowHeight(); } else { if (depth > 0 || isRootVisible) { paintNode(g, indentation + 4, descent, tree, curr, false); descent += getRowHeight(); y0 += halfHeight; } int max = 0; if (!mod.isLeaf(curr)) max = mod.getChildCount(curr); if (tree.isExpanded(new TreePath(getPathToRoot(curr, 0)))) { for (int i = 0; i < max; i++) { int indent = indentation + rightChildIndent; if (!isRootVisible && depth == 0) indent = 0; else if ((!isRootVisible && !curr.equals(mod.getRoot())) || isRootVisible) { g.setColor(getHashColor()); heightOfLine = descent + halfHeight; g.drawLine(indentation + halfWidth, heightOfLine, indentation + rightChildIndent, heightOfLine); } descent = paintRecursive(g, indent, descent, i, depth + 1, tree, mod, mod.getChild(curr, i)); } } } if (tree.isExpanded(new TreePath(getPathToRoot(curr, 0)))) if (y0 != heightOfLine && !mod.isLeaf(curr) && mod.getChildCount(curr) > 0) { g.setColor(getHashColor()); g.drawLine(indentation + halfWidth, y0, indentation + halfWidth, heightOfLine); } return descent; }
int paintRecursive(Graphics g, int indentation, int descent, int childNumber, int depth, JTree tree, TreeModel mod, Object curr) { Rectangle clip = g.getClipBounds(); if (indentation > clip.x + clip.width + rightChildIndent || descent > clip.y + clip.height + getRowHeight()) return descent; int halfHeight = getRowHeight() / 2; int halfWidth = rightChildIndent / 2; int y0 = descent + halfHeight; int heightOfLine = descent + halfHeight; boolean isRootVisible = tree.isRootVisible(); if (mod.isLeaf(curr)) { paintNode(g, indentation + 4, descent, tree, curr, true); descent += getRowHeight(); } else { if (depth > 0 || isRootVisible) { paintNode(g, indentation + 4, descent, tree, curr, false); descent += getRowHeight(); y0 += halfHeight; } int max = 0; if (!mod.isLeaf(curr)) max = mod.getChildCount(curr); if (tree.isExpanded(new TreePath(getPathToRoot(curr, 0)))) { for (int i = 0; i < max; i++) { int indent = indentation + rightChildIndent; if (!isRootVisible && depth == 0) indent = 0; else if ((!isRootVisible && !curr.equals(mod.getRoot())) || isRootVisible) { g.setColor(getHashColor()); heightOfLine = descent + halfHeight; g.drawLine(indentation + halfWidth, heightOfLine, indentation + rightChildIndent, heightOfLine); } descent = paintRecursive(g, indent, descent, i, depth + 1, tree, mod, mod.getChild(curr, i)); } } } if (tree.isExpanded(new TreePath(getPathToRoot(curr, 0)))) if (y0 != heightOfLine && !mod.isLeaf(curr) && mod.getChildCount(curr) > 0) { g.setColor(getHashColor()); g.drawLine(indentation + halfWidth, y0, indentation + halfWidth, heightOfLine); } return descent; }
83
void selectPath(JTree tree, TreePath path) { if (path != null) { if (tree.getSelectionModel().getSelectionMode() == TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION) { tree.addSelectionPath(path); tree.setLeadSelectionPath(path); } else if (tree.getSelectionModel().getSelectionMode() == TreeSelectionModel.CONTIGUOUS_TREE_SELECTION) { // TODO } else { tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION); tree.getSelectionModel().clearSelection(); tree.addSelectionPath(path); tree.setLeadSelectionPath(path); } } }
void selectPath(JTree tree, TreePath path) { if (path != null) { if (tree.getSelectionModel().getSelectionMode() == TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION) { tree.addSelectionPath(path); tree.setLeadSelectionPath(path); } else if (tree.getSelectionModel().getSelectionMode() == TreeSelectionModel.CONTIGUOUS_TREE_SELECTION) { // TODO } else { tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION); tree.getSelectionModel().clearSelection(); tree.addSelectionPath(path); tree.setLeadSelectionPath(path); } } }
84
void selectPath(JTree tree, TreePath path) { if (path != null) { if (tree.getSelectionModel().getSelectionMode() == TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION) { tree.addSelectionPath(path); tree.setLeadSelectionPath(path); } else if (tree.getSelectionModel().getSelectionMode() == TreeSelectionModel.CONTIGUOUS_TREE_SELECTION) { // TODO } else { tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION); tree.getSelectionModel().clearSelection(); tree.addSelectionPath(path); tree.setLeadSelectionPath(path); } } }
void selectPath(JTree tree, TreePath path) { if (path != null) { if (tree.getSelectionModel().getSelectionMode() == TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION) { tree.addSelectionPath(path); tree.setLeadSelectionPath(path); } else if (tree.getSelectionModel().getSelectionMode() == TreeSelectionModel.CONTIGUOUS_TREE_SELECTION) { // TODO } else { tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION); tree.getSelectionModel().clearSelection(); tree.addSelectionPath(path); tree.setLeadSelectionPath(path); } } }
85
void selectPath(JTree tree, TreePath path) { if (path != null) { if (tree.getSelectionModel().getSelectionMode() == TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION) { tree.addSelectionPath(path); tree.setLeadSelectionPath(path); } else if (tree.getSelectionModel().getSelectionMode() == TreeSelectionModel.CONTIGUOUS_TREE_SELECTION) { // TODO } else { tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION); tree.getSelectionModel().clearSelection(); tree.addSelectionPath(path); tree.setLeadSelectionPath(path); } } }
void selectPath(JTree tree, TreePath path) { if (path != null) { if (tree.getSelectionModel().getSelectionMode() == TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION) { tree.addSelectionPath(path); tree.setLeadSelectionPath(path); tree.getSelectionModel().setSelectionMode (TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION); } else if (tree.getSelectionModel().getSelectionMode() == TreeSelectionModel.CONTIGUOUS_TREE_SELECTION) { // TODO tree.getSelectionModel().setSelectionMode (TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION); } else { tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION); tree.getSelectionModel().clearSelection(); tree.addSelectionPath(path); tree.setLeadSelectionPath(path); tree.getSelectionModel().setSelectionMode (TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION); } tree.getSelectionModel().setSelectionMode (TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION); } tree.getSelectionModel().setSelectionMode (TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION); }
86
protected void selectPathForEvent(TreePath path, MouseEvent event) { // FIXME: not implemented }
protected void selectPathForEvent(TreePath path, MouseEvent event) { // FIXME: not implemented }
87
protected void setCellRenderer(TreeCellRenderer tcr) { currentCellRenderer = tcr; tree.setCellRenderer(tcr); updateRenderer(); }
protected void setCellRenderer(TreeCellRenderer tcr) { currentCellRenderer = tcr; tree.setCellRenderer(tcr); updateRenderer(); }
88
protected void toggleExpandState(TreePath path) { // FIXME: not implemented }
protected void toggleExpandState(TreePath path) { // FIXME: not implemented }
89
protected void uninstallComponents() { // FIXME: not implemented }
protected void uninstallComponents() { // FIXME: not implemented }
90
protected void uninstallListeners() { tree.removePropertyChangeListener(propertyChangeListener); tree.removeFocusListener(focusListener); tree.removeTreeSelectionListener(treeSelectionListener); tree.removeMouseListener(mouseInputListener); tree.removeKeyListener(keyListener); tree.removePropertyChangeListener(selectionModelPropertyChangeListener); tree.removeComponentListener(componentListener); tree.removeTreeExpansionListener(treeExpansionListener); TreeCellEditor tce = tree.getCellEditor(); if (tce != null) tce.removeCellEditorListener(cellEditorListener); TreeModel tm = tree.getModel(); if (tm != null) tm.removeTreeModelListener(treeModelListener); }
protected void uninstallListeners() { tree.removePropertyChangeListener(propertyChangeListener); tree.removeFocusListener(focusListener); tree.removeTreeSelectionListener(treeSelectionListener); tree.removeMouseListener(mouseInputListener); tree.removeKeyListener(keyListener); tree.removePropertyChangeListener(selectionModelPropertyChangeListener); tree.removeComponentListener(componentListener); tree.removeTreeExpansionListener(treeExpansionListener); TreeCellEditor tce = tree.getCellEditor(); if (tce != null) tce.removeCellEditorListener(cellEditorListener); TreeModel tm = tree.getModel(); if (tm != null) tm.removeTreeModelListener(treeModelListener); }
91
public void uninstallUI(JComponent c) { uninstallDefaults(); uninstallKeyboardActions(); uninstallListeners(); tree = null; completeUIUninstall(); }
public void uninstallUI(JComponent c) { prepareForUIUninstall(); uninstallDefaults(); uninstallKeyboardActions(); uninstallListeners(); tree = null; completeUIUninstall(); }
92
public void uninstallUI(JComponent c) { uninstallDefaults(); uninstallKeyboardActions(); uninstallListeners(); tree = null; completeUIUninstall(); }
public void uninstallUI(JComponent c) { uninstallDefaults(); uninstallKeyboardActions(); uninstallListeners(); tree = null; completeUIUninstall(); }
93
protected void updateDepthOffset() { // FIXME: not implemented }
protected void updateDepthOffset() { // FIXME: not implemented }
94
protected void updateExpandedDescendants(TreePath path) { // FIXME: not implemented }
protected void updateExpandedDescendants(TreePath path) { // FIXME: not implemented }
95
protected void updateLayoutCacheExpandedNodes() { // FIXME: not implemented }
protected void updateLayoutCacheExpandedNodes() { // FIXME: not implemented }
96
protected void updateRenderer() { // FIXME: not implemented }
protected void updateRenderer() { // FIXME: not implemented }
97
protected void updateSize() { // FIXME: not implemented }
protected void updateSize() { // FIXME: not implemented }
98
public void remove(Component comp) { synchronized (getTreeLock ()) { for (int i = 0; i < ncomponents; ++i) { if (component[i] == comp) { remove(i); break; } } } }
public void remove(int index) { synchronized (getTreeLock ()) { for (int i = 0; i < ncomponents; ++i) { if (component[i] == comp) { remove(i); break; } } } }
99
public void remove(Component comp) { synchronized (getTreeLock ()) { for (int i = 0; i < ncomponents; ++i) { if (component[i] == comp) { remove(i); break; } } } }
public void remove(Component comp) { synchronized (getTreeLock ()) { Component r = component[index]; r.removeNotify(); System.arraycopy(component, index + 1, component, index, ncomponents - index - 1); component[--ncomponents] = null; invalidate(); if (layoutMgr != null) layoutMgr.removeLayoutComponent(r); r.parent = null; if (isShowing ()) { if (component[i] == comp) { remove(i); break; } } } }
100