T5APR
Collection
Data and models related to T5APR.
•
15 items
•
Updated
rem
stringlengths 0
477k
| add
stringlengths 0
313k
| context
stringlengths 6
599k
|
---|---|---|
public synchronized StringBuffer append(char ch) | public StringBuffer append(Object obj) | public synchronized StringBuffer append(char ch) { ensureCapacity_unsynchronized(count + 1); value[count++] = ch; return this; } |
ensureCapacity_unsynchronized(count + 1); value[count++] = ch; return this; | return append(obj == null ? "null" : obj.toString()); | public synchronized StringBuffer append(char ch) { ensureCapacity_unsynchronized(count + 1); value[count++] = ch; return this; } |
public String substring(int beginIndex, int endIndex) | public String substring(int begin) | 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); } |
if (beginIndex < 0 || endIndex > count || beginIndex > endIndex) throw new StringIndexOutOfBoundsException(); if (beginIndex == 0 && endIndex == count) return this; int len = endIndex - beginIndex; return new String(value, beginIndex + offset, len, (len << 2) >= value.length); | return substring(begin, count); | 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 Object next() { | public FSEntry next() { | public Object next() { String fs = (String)fileSystemsRoots.next(); return new virtualFSEntry(fs); } |
return getEntry("/" + name); | for(FSEntryIterator it = iterator() ; it.hasNext() ; ) { FSEntry entry = it.next(); if(entry.getName().equals(name)) return entry; } throw new IOException("Entry not found: "+name); | public FSEntry getEntry(String name) throws IOException { return getEntry("/" + name); } |
public Iterator iterator() { | public FSEntryIterator iterator() { | public Iterator iterator() { return new RootsIterator(fsm.fileSystemRoots().iterator()); } |
for (Iterator i = entry.getDirectory().iterator(); i.hasNext();) { | for (FSEntryIterator i = entry.getDirectory().iterator(); i.hasNext();) { | 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 synchronized FileSystem getFileSystem(String rootName) { return (FileSystem)filesystems.get(rootName); | public synchronized FileSystem getFileSystem(Device device) { return (FileSystem)filesystems.get(getMountPoint(device)); | public synchronized FileSystem getFileSystem(String rootName) { return (FileSystem)filesystems.get(rootName); } |
attribHash.put("lessThanValue", new XMLAttribute(null, Constants.STRING_OR_NUMBER_TYPE)); attribHash.put("lessThanOrEqualValue", new XMLAttribute(null, Constants.STRING_OR_NUMBER_TYPE)); attribHash.put("greaterThanValue", new XMLAttribute(null, Constants.STRING_OR_NUMBER_TYPE)); attribHash.put("greaterThanOrEqualValue", new XMLAttribute(null, Constants.STRING_OR_NUMBER_TYPE)); attribHash.put("infiniteValue", new XMLAttribute(null, Constants.STRING_OR_NUMBER_TYPE)); attribHash.put("infiniteNegativeValue", new XMLAttribute(null, Constants.STRING_OR_NUMBER_TYPE)); attribHash.put("noDataValue", new XMLAttribute(null, Constants.STRING_OR_NUMBER_TYPE)); | private void init() { classXDFNodeName = "dataFormat"; // order matters! these are in *reverse* order of their // occurence in the XDF DTD //the order of the attributes that all sub-classses should have attribOrder.add(0,"noDataValue"); attribOrder.add(0,"infiniteNegativeValue"); attribOrder.add(0,"infiniteValue"); attribOrder.add(0,"greaterThanOrEqualValue"); attribOrder.add(0,"greaterThanValue"); attribOrder.add(0,"lessThanOrEqualValue"); attribOrder.add(0,"lessThanValue"); } |
|
public DriverException(String message, Throwable cause) { super(message, cause); | public DriverException() { super(); | public DriverException(String message, Throwable cause) { super(message, cause); } |
Point click = e.getPoint(); int row = Math.round(click.y / getRowHeight()); | Point click = e.getPoint(); | 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); } } } |
if (path != null) { boolean inBounds = false; boolean cntlClick = false; Rectangle bounds = getPathBounds(tree, path); | if (path != null) { bounds = getPathBounds(tree, path); int row = getRowForPath(tree, path); boolean cntlClick = isLocationInExpandControl(path, click.x, click.y); | 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); } } } |
bounds.x -= rightChildIndent - 4; bounds.width += rightChildIndent + 4; | if (isLeaf(row)) { bounds.x -= rightChildIndent - 4; bounds.width += rightChildIndent + 4; } else if (tree.isExpanded(path) && expandedIcon != null) bounds.width += expandedIcon.getIconWidth() + 4; else if (collapsedIcon != null) bounds.width += collapsedIcon.getIconWidth() + 4; | 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); } } } |
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; | boolean inBounds = bounds.contains(click.x, click.y); | 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); } } } |
if ((e.getClickCount() == 2 || cntlClick) && !isLeaf(row)) { if (tree.isExpanded(path)) tree.collapsePath(path); else tree.expandPath(path); } if (!cntlClick && tree.isEditable()) | if (inBounds && e.getClickCount() == 2 && !isLeaf(row)) toggleExpandState(path); if (cntlClick) { handleExpandControlClick(path, click.x, click.y); if (cellEditor != null) cellEditor.cancelCellEditing(); } else if (tree.isEditable()) | 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); } } } |
Object curr = getNextVisibleNode(tree.getModel().getRoot()); | Object curr = getNextVisibleNode(treeModel.getRoot()); | 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); } |
if (!tree.getModel().isLeaf(last)) { if (tree.isExpanded(path)) tree.collapsePath(path); else tree.expandPath(path); } | if (!treeModel.isLeaf(last)) toggleExpandState(path); | 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 TreeCancelEditingAction() { } | public TreeCancelEditingAction(String name) { } | public TreeCancelEditingAction() { } |
{ TreeModel mod = tree.getModel(); | { | 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))); } } } |
Object p = getParent(mod.getRoot(), last); | Object p = getParent(treeModel.getRoot(), last); | 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))); } } } |
if (!mod.isLeaf(last) && tree.isExpanded(path)) | if (!treeModel.isLeaf(last) && tree.isExpanded(path)) | 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))); } } } |
if (!mod.isLeaf(last) && tree.isCollapsed(path)) | if (!treeModel.isLeaf(last) && tree.isCollapsed(path)) | 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))); } } } |
int mouseY) { } | int mouseY) { if (isLocationInExpandControl(path, mouseX, mouseY)) toggleExpandState(path); } | protected void checkForClickInExpandControl(TreePath path, int mouseX, int mouseY) { // FIXME: not implemented } |
{ return null; } | { return new NodeDimensionsHandler(); } | protected AbstractLayoutCache.NodeDimensions createNodeDimensions() { // FIXME: not implemented return null; } |
{ } | { if (beginRow < endRow) { int temp = endRow; endRow = beginRow; beginRow = temp; } for (int i = beginRow; i < endRow; i++) { TreePath path = getPathForRow(tree, i); if (!tree.isVisible(path)) tree.makeVisible(path); } } | protected void ensureRowsAreVisible(int beginRow, int endRow) { // FIXME: not implemented } |
TreeModel mod = tree.getModel(); | 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; } |
|
if (!mod.isLeaf(root)) size = mod.getChildCount(root); | if (!treeModel.isLeaf(root)) size = treeModel.getChildCount(root); | 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; } |
if (mod.getIndexOfChild(root, node) != -1) | if (treeModel.getIndexOfChild(root, node) != -1) | 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; } |
Object n = findNode(mod.getChild(root, i), node); | Object n = findNode(treeModel.getChild(root, i), node); | 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; } |
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)); } |
|
{ return 0; } | { return rightChildIndent / 2; } | protected int getHorizontalLegBuffer() { // FIXME: not implemented return 0; } |
current = getParent(tree.getModel().getRoot(), current); | current = getParent(treeModel.getRoot(), current); | int getLevel(Object node) { int count = -1; Object current = node; do { current = getParent(tree.getModel().getRoot(), current); count++; } while (current != null); return count; } |
{ return getPreferredSize(c); } | { if (c instanceof JTree) return ((JTree) c).getPreferredSize(); return new Dimension(); } | public Dimension getMaximumSize(JComponent c) { // FIXME: not implemented return getPreferredSize(c); } |
{ return getPreferredSize(c); } | { Dimension min = getPreferredMinSize(); if (min == null) return new Dimension(); return min; } | public Dimension getMinimumSize(JComponent c) { // FIXME: not implemented return getPreferredSize(c); } |
TreeModel mod = tree.getModel(); if (!mod.isLeaf(curr) && mod.getChildCount(curr) > 0) return mod.getChild(curr, 0); | if (!treeModel.isLeaf(curr) && treeModel.getChildCount(curr) > 0) return treeModel.getChild(curr, 0); | 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; } |
node = getParent(mod.getRoot(), node); | node = getParent(treeModel.getRoot(), node); | 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; } |
TreeModel mod = tree.getModel(); Object parent = getParent(mod.getRoot(), node); | Object parent = getParent(treeModel.getRoot(), node); | 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); } |
int index = mod.getIndexOfChild(parent, node) + 1; | int index = treeModel.getIndexOfChild(parent, node) + 1; | 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); } |
if (!mod.isLeaf(parent)) size = mod.getChildCount(parent); | if (!treeModel.isLeaf(parent)) size = treeModel.getChildCount(parent); | 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); } |
return mod.getChild(parent, index); | return treeModel.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); } |
TreeModel mod = tree.getModel(); if (mod != null) | if (treeModel != 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; } |
Object root = mod.getRoot(); | Object root = treeModel.getRoot(); | 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; } |
Point loc = getCellLocation(0, 0, tree, mod, cell, root); return getCellBounds(loc.x, loc.y, cell); | Point loc = getCellLocation(0, 0, tree, treeModel, cell, root); return getCellBounds(loc.x, loc.y, cell); } | 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; } |
} return null; } | 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; } |
{ TreeModel mod = tree.getModel(); if (mod != null) | { if (treeModel != 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; } |
Object node = mod.getRoot(); if (!tree.isRootVisible() && tree.isExpanded(new TreePath(getPathToRoot(node, 0)))) node = getNextNode(node); | Object node = treeModel.getRoot(); if (!tree.isRootVisible() && tree.isExpanded(new TreePath(getPathToRoot(node, 0)))) node = getNextNode(node); | 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; } |
TreeModel mod = tree.getModel(); | 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[] path = getPathToRoot(getParent(mod.getRoot(), node), depth + 1); | Object[] path = getPathToRoot(getParent(treeModel.getRoot(), node), depth + 1); | 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; } |
TreeModel mod = tree.getModel(); Object parent = getParent(mod.getRoot(), node); | Object parent = getParent(treeModel.getRoot(), node); | 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; } |
if (!mod.isLeaf(sibling)) size = mod.getChildCount(sibling); | if (!treeModel.isLeaf(sibling)) size = treeModel.getChildCount(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; } |
{ sibling = mod.getChild(sibling, size - 1); if (!mod.isLeaf(sibling)) size = mod.getChildCount(sibling); | { sibling = treeModel.getChild(sibling, size - 1); if (!treeModel.isLeaf(sibling)) size = treeModel.getChildCount(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; } |
TreeModel mod = tree.getModel(); Object parent = getParent(mod.getRoot(), node); | Object parent = getParent(treeModel.getRoot(), node); | 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); } |
int index = mod.getIndexOfChild(parent, node) - 1; | int index = treeModel.getIndexOfChild(parent, node) - 1; | 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); } |
if (!mod.isLeaf(parent)) size = mod.getChildCount(parent); | if (!treeModel.isLeaf(parent)) size = treeModel.getChildCount(parent); | 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); } |
return mod.getChild(parent, index); | return treeModel.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); } |
{ TreeModel mod = tree.getModel(); | { | 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; } |
if (mod != null) | if (treeModel != null) | 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; } |
Object node = mod.getRoot(); if (!tree.isRootVisible() && tree.isExpanded(new TreePath((getPathToRoot(node, 0))))) node = getNextNode(node); while (node != null) { count++; node = getNextVisibleNode(node); | Object node = treeModel.getRoot(); if (!tree.isRootVisible() && tree.isExpanded(new TreePath((getPathToRoot(node, 0))))) node = getNextNode(node); while (node != null) { count++; node = getNextVisibleNode(node); } | 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; } |
} return count; } | 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; } |
{ int row = path.getPathCount(); if (tree.isVisible(path)) return row; path = path.getParentPath(); while (row > 0 && !tree.isVisible(path)) | { int row = 0; Object dest = path.getLastPathComponent(); Object curr = treeModel.getRoot(); while (curr != null && !curr.equals(dest)) | 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; } |
path = path.getParentPath(); row--; | ++row; curr = getNextVisibleNode(curr); | 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; } |
{ return 0; } | { return getRowHeight() / 2; } | protected int getVerticalLegBuffer() { // FIXME: not implemented return 0; } |
{ } | { toggleExpandState(path); } | protected void handleExpandControlClick(TreePath path, int mouseX, int mouseY) { // FIXME: not implemented } |
{ if (UIManager.getLookAndFeelDefaults().getIcon("Tree.expandedIcon") == null || UIManager.getLookAndFeelDefaults().getIcon("Tree.collapsedIcon") == null) return false; | { if (UIManager.getLookAndFeelDefaults().getIcon("Tree.expandedIcon") != null || UIManager.getLookAndFeelDefaults().getIcon("Tree.collapsedIcon") != null) | boolean hasControlIcons() { if (UIManager.getLookAndFeelDefaults().getIcon("Tree.expandedIcon") == null || UIManager.getLookAndFeelDefaults().getIcon("Tree.collapsedIcon") == null) return false; return true; } |
} | return false; } | boolean hasControlIcons() { if (UIManager.getLookAndFeelDefaults().getIcon("Tree.expandedIcon") == null || UIManager.getLookAndFeelDefaults().getIcon("Tree.collapsedIcon") == null) return false; return true; } |
{ } | { currentCellRenderer = createDefaultCellRenderer(); rendererPane = createCellRendererPane(); createdRenderer = true; setCellRenderer(currentCellRenderer); } | protected void installComponents() { // FIXME: not implemented } |
} | tree.setScrollsOnExpand(defaults.getBoolean("Tree.scrollsOnExpand")); setExpandedIcon(defaults.getIcon("Tree.expandedIcon")); setCollapsedIcon(defaults.getIcon("Tree.collapsedIcon")); } | 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); } |
{ super.installUI(c); tree = (JTree) c; | { prepareForUIInstall(); super.installUI(c); tree = (JTree) c; | 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(); } |
currentCellRenderer = createDefaultCellRenderer(); rendererPane = createCellRendererPane(); createdRenderer = true; | installComponents(); | 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(); } |
Object node = pathForRow.getLastPathComponent(); return tree.getModel().isLeaf(node); } | Object node = pathForRow.getLastPathComponent(); return treeModel.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); } |
int mouseY) { return false; } | int mouseY) { boolean cntlClick = false; int row = getRowForPath(tree, path); if (!isLeaf(row)) { if (bounds == null) bounds = getPathBounds(tree, path); if (tree.isExpanded(path) && expandedIcon != null) bounds.x -= expandedIcon.getIconWidth() - 4; else if (collapsedIcon != null) bounds.x -= collapsedIcon.getIconWidth() - 4; Icon controlIcon = getCurrentControlIcon(path); if (controlIcon != null && (mouseX < bounds.x) && (mouseX > (bounds.x - controlIcon.getIconWidth()))) cntlClick = true; } return cntlClick; } | protected boolean isLocationInExpandControl(TreePath path, int mouseX, int mouseY) { // FIXME: not implemented return false; } |
{ return false; } | { return (tree.getSelectionModel().getSelectionMode() == TreeSelectionModel.CONTIGUOUS_TREE_SELECTION); } | protected boolean isMultiSelectEvent(MouseEvent event) { // FIXME: not implemented return false; } |
{ return false; } | { return true; } | protected boolean isToggleEvent(MouseEvent event) { // FIXME: not implemented return false; } |
{ return false; } | { return (tree.getSelectionModel().getSelectionMode() == TreeSelectionModel.SINGLE_TREE_SELECTION); } | protected boolean isToggleSelectionEvent(MouseEvent event) { // FIXME: not implemented return false; } |
TreeModel mod = tree.getModel(); | if (treeModel != null) { Object root = treeModel.getRoot(); | 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); } } |
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); } | paintRecursive(g, 0, 0, 0, 0, tree, treeModel, root); if (hasControlIcons()) paintControlIcons(g, 0, 0, 0, 0, tree, treeModel, 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); } } |
{ 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 | { int h = descent; int rowHeight = getRowHeight(); TreePath path = new TreePath(getPathToRoot(node, 0)); Icon icon = getCurrentControlIcon(path); 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 | 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; } |
if (tree.isExpanded(new TreePath(getPathToRoot(node, 0)))) { if (!node.equals(mod.getRoot())) ei.paintIcon(tree, g, indentation - rightChildIndent - 3, h); | if (!node.equals(mod.getRoot())) icon.paintIcon(tree, g, indentation - rightChildIndent - 3, h); if (tree.isExpanded(path)) { | 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; } |
} } else if (!node.equals(mod.getRoot())) ci.paintIcon(tree, g, indentation - rightChildIndent - 3, descent - getRowHeight()); | } } | 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; } |
Rectangle clip = g.getClipBounds(); if (indentation > clip.x + clip.width + rightChildIndent || descent > clip.y + clip.height + getRowHeight()) | Rectangle clip = tree.getVisibleRect(); if (indentation > clip.x + clip.width + rightChildIndent || descent > clip.y + clip.height + getRowHeight()) | 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; } |
{ g.setColor(getHashColor()); heightOfLine = descent + halfHeight; g.drawLine(indentation + halfWidth, heightOfLine, indentation + rightChildIndent, heightOfLine); } | { g.setColor(getHashColor()); heightOfLine = descent + halfHeight; paintHorizontalLine(g, (JComponent) tree, heightOfLine, indentation + halfWidth, indentation + rightChildIndent); } | 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; } |
|
{ g.setColor(getHashColor()); g.drawLine(indentation + halfWidth, y0, indentation + halfWidth, heightOfLine); } return descent; } | { g.setColor(getHashColor()); paintVerticalLine(g, (JComponent) tree, indentation + halfWidth, y0, 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; } |
if (tree.getSelectionModel().getSelectionMode() == TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION) { | if (tree.getSelectionModel().getSelectionMode() == TreeSelectionModel.SINGLE_TREE_SELECTION) { tree.getSelectionModel().clearSelection(); | 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); } } } |
} else { tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION); tree.getSelectionModel().clearSelection(); | } else { | 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); } } } |
} | tree.getSelectionModel().setSelectionMode (TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION); } | 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); } } } |
{ } | { if (isToggleSelectionEvent(event)) { if (tree.isPathSelected(path)) tree.removeSelectionPath(path); else { tree.addSelectionPath(path); tree.setAnchorSelectionPath(path); } } else if (isMultiSelectEvent(event)) { TreePath anchor = tree.getAnchorSelectionPath(); if (anchor != null) { int aRow = getRowForPath(tree, anchor); tree.addSelectionInterval(aRow, getRowForPath(tree, path)); } else tree.addSelectionPath(path); } else tree.addSelectionPath(path); } | protected void selectPathForEvent(TreePath path, MouseEvent event) { // FIXME: not implemented } |
{ currentCellRenderer = tcr; tree.setCellRenderer(tcr); updateRenderer(); } | { currentCellRenderer = tcr; updateRenderer(); } | protected void setCellRenderer(TreeCellRenderer tcr) { currentCellRenderer = tcr; tree.setCellRenderer(tcr); updateRenderer(); } |
{ } | { if (tree.isExpanded(path)) tree.collapsePath(path); else tree.expandPath(path); } | protected void toggleExpandState(TreePath path) { // FIXME: not implemented } |
{ } | { currentCellRenderer = null; rendererPane = null; createdRenderer = false; setCellRenderer(currentCellRenderer); } | protected void uninstallComponents() { // FIXME: not implemented } |
TreeModel tm = tree.getModel(); if (tm != null) tm.removeTreeModelListener(treeModelListener); } | if (treeModel != null) treeModel.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); } |
{ | { prepareForUIUninstall(); | public void uninstallUI(JComponent c) { uninstallDefaults(); uninstallKeyboardActions(); uninstallListeners(); tree = null; completeUIUninstall(); } |
uninstallKeyboardActions(); uninstallListeners(); tree = null; completeUIUninstall(); } | uninstallKeyboardActions(); uninstallListeners(); tree = null; uninstallComponents(); completeUIUninstall(); } | public void uninstallUI(JComponent c) { uninstallDefaults(); uninstallKeyboardActions(); uninstallListeners(); tree = null; completeUIUninstall(); } |
{ } | { depthOffset += getVerticalLegBuffer(); } | protected void updateDepthOffset() { // FIXME: not implemented } |
{ } | { Enumeration expanded = tree.getExpandedDescendants(path); while (expanded.hasMoreElements()) treeState.setExpandedState(((TreePath) expanded.nextElement()), true); } | protected void updateExpandedDescendants(TreePath path) { // FIXME: not implemented } |
{ } | { if (treeModel != null) updateExpandedDescendants(new TreePath(getPathToRoot(treeModel. getRoot(), 0))); } | protected void updateLayoutCacheExpandedNodes() { // FIXME: not implemented } |
{ } | { if (tree != null) tree.setCellRenderer(currentCellRenderer); } | protected void updateRenderer() { // FIXME: not implemented } |
{ } | { preferredSize = null; updateCachedPreferredSize(); tree.treeDidChange(); } | protected void updateSize() { // FIXME: not implemented } |
public void remove(Component comp) | public void remove(int index) | public void remove(Component comp) { synchronized (getTreeLock ()) { for (int i = 0; i < ncomponents; ++i) { if (component[i] == comp) { remove(i); break; } } } } |
No dataset card yet
New: Create and edit this dataset card directly on the website!
Contribute a Dataset Card