本文整理了Java中javax.swing.JTree.getRowForPath()
方法的一些代码示例,展示了JTree.getRowForPath()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JTree.getRowForPath()
方法的具体详情如下:
包路径:javax.swing.JTree
类名称:JTree
方法名:getRowForPath
暂无
代码示例来源:origin: stackoverflow.com
(DefaultMutableTreeNode)e.nextElement();
if(node.isLeaf()) continue;
int row = tree.getRowForPath(new TreePath(node.getPath()));
tree.expandRow(row);
(JTree.DropLocation)support.getDropLocation();
JTree tree = (JTree)support.getComponent();
int dropRow = tree.getRowForPath(dl.getPath());
int[] selRows = tree.getSelectionRows();
for(int i = 0; i < selRows.length; i++) {
代码示例来源:origin: stackoverflow.com
for (String prefix : paths) {
treePath = tree.getNextMatch( prefix, row, Position.Bias.Forward );
row = tree.getRowForPath(treePath);
代码示例来源:origin: org.apache.jmeter/ApacheJMeter_core
@Override
public int compare(TreePath o1, TreePath o2) {
int row1 = tree.getRowForPath(o1);
int row2 = tree.getRowForPath(o2);
return row1<row2 ? -1 : (row1==row2 ? 0 : 1);
}
};
代码示例来源:origin: abbot/abbot
@Override
public Integer call() {
return tree.getRowForPath(getPath(tree));
}
});
代码示例来源:origin: UISpec4J/UISpec4J
private Rectangle getRectangle(TreePath treePath) {
return jTree.getRowBounds(jTree.getRowForPath(treePath));
}
代码示例来源:origin: net.sf.jt400/jt400
/**
Finds the row for the object.
@param object The object.
@return The row, or -1 if the object is not in the
tree or is not visible.
**/
private int findRow (VNode object)
{
if (object == null)
throw new NullPointerException ("object");
TreePath path = getPath (object);
if (path != null)
return tree_.getRowForPath (path);
else
return -1;
}
代码示例来源:origin: net.sf.taverna.t2.ui-components/workflow-explorer
/**
* Collapses all direct ascendants of a node in the tree.
*/
@SuppressWarnings("unchecked")
private void collapseAscendants(JTree tree, DefaultMutableTreeNode node) {
Enumeration<DefaultMutableTreeNode> children = node.children();
while (children.hasMoreElements()) {
DefaultMutableTreeNode child = children.nextElement();
int row = tree.getRowForPath(new TreePath(child.getPath()));
tree.collapseRow(row);
}
}
代码示例来源:origin: org.cytoscape/swing-application-impl
public Map<Long, Integer> getNetworkListOrder() {
Map<Long, Integer> order = new HashMap<Long, Integer>();
// Save the network orders
final JTree tree = treeTable.getTree();
for (final Entry<CyNetwork, NetworkTreeNode> entry : network2nodeMap.entrySet()) {
final CyNetwork net = entry.getKey();
final NetworkTreeNode node = entry.getValue();
if (node != null) {
final TreePath tp = new TreePath(node.getPath());
final int row = tree.getRowForPath(tp);
order.put(net.getSUID(), row);
}
}
return order;
}
代码示例来源:origin: de.sciss/jtreetable
private void repaint(TreePath path, int col) {
Rectangle r = table.getCellRect(tree.getRowForPath(path), col, true);
treeTable.repaint(r);
}
代码示例来源:origin: org.activecomponents.jadex/jadex-commons-gui
/**
* Invoked after the tree has drastically changed structure from a
* given node down.
*/
public void treeStructureChanged(final TreeModelEvent event)
{
handleTreeStructureChanged(event, event.getTreePath(), Math.max(tree.getRowForPath(event.getTreePath()), 0));
}
代码示例来源:origin: senbox-org/snap-desktop
private static void expandAll(JTree tree) {
DefaultMutableTreeNode actNode = (DefaultMutableTreeNode) tree.getModel().getRoot();
while (actNode != null) {
if (!actNode.isLeaf()) {
final TreePath actPath = new TreePath(actNode.getPath());
tree.expandRow(tree.getRowForPath(actPath));
}
actNode = actNode.getNextNode();
}
}
代码示例来源:origin: bcdev/beam
private void expandAllTreeNodes() {
FilterTreeModel model = (FilterTreeModel) filterTree.getModel();
int childCount = model.getChildCount(model.getRoot());
for (int i = 0; i < childCount; i++) {
Object child = model.getChild(model.getRoot(), i);
TreePath treePath = new TreePath(new Object[]{model.getRoot(), child});
filterTree.expandRow(filterTree.getRowForPath(treePath));
}
}
代码示例来源:origin: senbox-org/snap-desktop
private void expandAllTreeNodes() {
FilterTreeModel model = (FilterTreeModel) filterTree.getModel();
int childCount = model.getChildCount(model.getRoot());
for (int i = 0; i < childCount; i++) {
Object child = model.getChild(model.getRoot(), i);
TreePath treePath = new TreePath(new Object[]{model.getRoot(), child});
filterTree.expandRow(filterTree.getRowForPath(treePath));
}
}
代码示例来源:origin: edu.stanford.protege/jtreetable
protected void notifyTreeCollapsed(TreeExpansionEvent event) {
int startrow = tree.getRowForPath(event.getPath())+1;
int endRow = startrow + getDiff();
TableModelEvent tableDataEvent = new TableModelEvent(AbstractTreeTableModel.this,
startrow, endRow,
TableModelEvent.ALL_COLUMNS,
TableModelEvent.DELETE);
for (TableModelListener l : listeners){
l.tableChanged(tableDataEvent);
}
}
代码示例来源:origin: edu.stanford.protege/jtreetable
protected void notifyTreeExpanded(TreeExpansionEvent event) {
int startrow = tree.getRowForPath(event.getPath())+1;
int endRow = startrow + getDiff();//getLastExpandedRow(event.getPath());
TableModelEvent tableDataEvent = new TableModelEvent(AbstractTreeTableModel.this,
startrow, endRow,
TableModelEvent.ALL_COLUMNS,
TableModelEvent.INSERT);
for (TableModelListener l : listeners){
l.tableChanged(tableDataEvent);
}
}
代码示例来源:origin: robotframework/SwingLibrary
private Component getNodeComponent(Object node, TreePath treePath) {
int row = tree.getRowForPath(treePath);
boolean isLeaf = tree.getModel().isLeaf(node);
boolean hasFocus = tree.getLeadSelectionRow() == row;
boolean isSelected = tree.isRowSelected(row);
boolean isExpanded = tree.isExpanded(row);
TreeCellRenderer cellRenderer = tree.getCellRenderer();
return cellRenderer.getTreeCellRendererComponent(tree, node, isSelected, isExpanded, isLeaf, row, hasFocus);
}
代码示例来源:origin: org.bidib.jbidib.swinglabs.swingx/swingx-core
private boolean checkDropOnState() {
if ((getComponent() == null)) {
return false;
}
JTree.DropLocation dropLocation = getComponent().getDropLocation();
if (dropLocation != null
&& dropLocation.getChildIndex() == -1
&& getComponent().getRowForPath(dropLocation.getPath()) == row) {
return true;
}
return false;
}
代码示例来源:origin: com.haulmont.thirdparty/swingx-core
private boolean checkDropOnState() {
if ((getComponent() == null)) {
return false;
}
JTree.DropLocation dropLocation = getComponent().getDropLocation();
if (dropLocation != null
&& dropLocation.getChildIndex() == -1
&& getComponent().getRowForPath(dropLocation.getPath()) == row) {
return true;
}
return false;
}
代码示例来源:origin: org.swinglabs.swingx/swingx-core
private boolean checkDropOnState() {
if ((getComponent() == null)) {
return false;
}
JTree.DropLocation dropLocation = getComponent().getDropLocation();
if (dropLocation != null
&& dropLocation.getChildIndex() == -1
&& getComponent().getRowForPath(dropLocation.getPath()) == row) {
return true;
}
return false;
}
代码示例来源:origin: org.swinglabs.swingx/swingx-all
private boolean checkDropOnState() {
if ((getComponent() == null)) {
return false;
}
JTree.DropLocation dropLocation = getComponent().getDropLocation();
if (dropLocation != null
&& dropLocation.getChildIndex() == -1
&& getComponent().getRowForPath(dropLocation.getPath()) == row) {
return true;
}
return false;
}
内容来源于网络,如有侵权,请联系作者删除!