本文整理了Java中javax.swing.JTree.getPathForRow()
方法的一些代码示例,展示了JTree.getPathForRow()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JTree.getPathForRow()
方法的具体详情如下:
包路径:javax.swing.JTree
类名称:JTree
方法名:getPathForRow
暂无
代码示例来源:origin: checkstyle/checkstyle
/**
* Finds node for a given row.
* @param row Row for which to find a related node.
* @return Node for a given row.
*/
private Object nodeForRow(int row) {
final TreePath treePath = tree.getPathForRow(row);
return treePath.getLastPathComponent();
}
代码示例来源:origin: deathmarine/Luyten
public void restoreExpanstionState(Set<String> expansionState) {
if (tree != null && expansionState != null) {
// tree.getRowCount() changes at tree.expandRow()
for (int i = 0; i < tree.getRowCount(); i++) {
TreePath path = tree.getPathForRow(i);
if (expansionState.contains(getRowPathStr(path))) {
tree.expandRow(i);
}
}
}
}
代码示例来源:origin: checkstyle/checkstyle
/**
* If the row at given index is selected, selected paths are updated.
* @param counter number of row.
*/
private void updateSelectedPathIfRowIsSelected(int counter) {
if (listSelectionModel.isSelectedIndex(counter)) {
final TreePath selPath = treeTable.getTree().getPathForRow(counter);
if (selPath != null) {
addSelectionPath(selPath);
}
}
}
代码示例来源:origin: deathmarine/Luyten
public Set<String> getExpansionState() {
Set<String> openedSet = new HashSet<>();
if (tree != null) {
int rowCount = tree.getRowCount();
for (int i = 0; i < rowCount; i++) {
TreePath path = tree.getPathForRow(i);
if (tree.isExpanded(path)) {
String rowPathStr = getRowPathStr(path);
// for switching Package Explorer on/off
openedSet.addAll(getAllParentPathsStr(rowPathStr));
}
}
}
return openedSet;
}
代码示例来源:origin: zzz40500/GsonFormat
TreePath path = tree.getPathForRow(arg0.getRow());
if (path != null) {
if (selectionModel.isPathSelected(path, true)) {
代码示例来源:origin: stackoverflow.com
DefaultMutableTreeNode target =
(DefaultMutableTreeNode)dest.getLastPathComponent();
TreePath path = tree.getPathForRow(selRows[0]);
DefaultMutableTreeNode firstNode =
(DefaultMutableTreeNode)path.getLastPathComponent();
TreePath path = tree.getPathForRow(selRows[0]);
DefaultMutableTreeNode first =
(DefaultMutableTreeNode)path.getLastPathComponent();
path = tree.getPathForRow(selRows[i]);
DefaultMutableTreeNode next =
(DefaultMutableTreeNode)path.getLastPathComponent();
代码示例来源:origin: pentaho/mondrian
private boolean isInvalid(JTree tree, Object value, int row) {
// getPathForRow(row) returns null for new objects added to tree in the
// first run of rendering. Check for null before calling methods on
// Treepath returned.
return invalid(tree, tree.getPathForRow(row), value) != null;
}
代码示例来源:origin: abbot/abbot
@Override
public TreePath call() {
return tree.getPathForRow(row);
}
});
代码示例来源:origin: stackoverflow.com
TreePath path = tree.getPathForRow(row);
代码示例来源:origin: Audiveris/audiveris
/**
* DOCUMENT ME!
*
* @param row DOCUMENT ME!
* @return DOCUMENT ME!
*/
public Object nodeForRow (int row)
{
TreePath treePath = tree.getPathForRow(row);
return treePath.getLastPathComponent();
}
代码示例来源:origin: uk.org.mygrid.taverna/taverna-core
protected Object nodeForRow(int row) {
TreePath treePath = tree.getPathForRow(row);
if (treePath == null) {
return null;
}
return treePath.getLastPathComponent();
}
代码示例来源:origin: org.bidib.jbidib.swinglabs.swingx/swingx-core
protected Object nodeForRow(int row) {
// Issue #270-swingx: guard against invisible row
TreePath path = tree.getPathForRow(row);
return path != null ? path.getLastPathComponent() : null;
}
代码示例来源:origin: com.haulmont.thirdparty/swingx-core
protected Object nodeForRow(int row) {
// Issue #270-swingx: guard against invisible row
TreePath path = tree.getPathForRow(row);
return path != null ? path.getLastPathComponent() : null;
}
代码示例来源:origin: com.puppycrawl.tools/checkstyle
/**
* Finds node for a given row.
* @param row Row for which to find a related node.
* @return Node for a given row.
*/
private Object nodeForRow(int row) {
final TreePath treePath = tree.getPathForRow(row);
return treePath.getLastPathComponent();
}
代码示例来源:origin: pentaho/mondrian
25));
} else if (value instanceof MondrianGuiDef.RelationOrJoin) {
TreePath tpath = tree.getPathForRow(row);
String prefix = "";
if (tpath != null) {
代码示例来源:origin: com.jidesoft/jide-oss
@Override
protected Object getElementAt(int index) {
if (index == -1) {
return null;
}
if (!isRecursive()) {
return ((JTree) _component).getPathForRow(index);
}
else {
return getTreePathes().get(index);
}
}
代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/openide
public Object getValueAt(int row, int column) {
return column == 0 ? tree.getPathForRow(row).getLastPathComponent()
: nodeTableModel.getPropertyFor(
nodeForRow(row),
propertyForColumn(column));
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-lib-profiler-ui
public void mousePressed(MouseEvent e) {
if (e.getModifiers() == InputEvent.BUTTON3_MASK) {
treePath = treeTable.getTree().getPathForRow(treeTable.rowAtPoint(e.getPoint()));
if (treePath != null) {
treeTable.getTree().setSelectionPath(treePath);
}
}
}
代码示例来源:origin: org.netbeans.api/org-openide-explorer
@Override
public Object getValueAt(int row, int column) {
if (column == 0) {
TreePath path = tree.getPathForRow(row);
if (path == null) {
throw new IndexOutOfBoundsException("row " + row + " vs. count " + tree.getRowCount() + " with UI " + tree.getUI());
}
return path.getLastPathComponent();
} else {
return nodeTableModel.getPropertyFor(nodeForRow(row), propertyForColumn(column));
}
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-lib-profiler-ui
public void valueChanged(ListSelectionEvent e) {
int selectedRow = treeTable.getSelectedRow();
if (selectedRow == -1) {
return;
}
popupPath = treeTable.getTree().getPathForRow(selectedRow);
PrestimeCPUCCTNode node = (PrestimeCPUCCTNode) popupPath.getLastPathComponent();
if (selectionHandler != null) {
selectionHandler.methodSelected(node.getThreadId(), node.getMethodId(), currentView);
}
}
});
内容来源于网络,如有侵权,请联系作者删除!