本文整理汇总了Java中org.jdesktop.swingx.treetable.TreeTableNode.getUserObject方法的典型用法代码示例。如果您正苦于以下问题:Java TreeTableNode.getUserObject方法的具体用法?Java TreeTableNode.getUserObject怎么用?Java TreeTableNode.getUserObject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jdesktop.swingx.treetable.TreeTableNode
的用法示例。
在下文中一共展示了TreeTableNode.getUserObject方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: pluginsTreeTableMouseClicked
import org.jdesktop.swingx.treetable.TreeTableNode; //导入方法依赖的package包/类
private void pluginsTreeTableMouseClicked(MouseEvent e) {
if (e.getClickCount() == 2) {
synchronized(this) {
int selectedRow = this.pluginsTreeTable.getSelectedRow();
if (selectedRow != -1) {
TreePath path = this.pluginsTreeTable.getPathForRow(selectedRow);
Object node = path.getLastPathComponent();
if (node instanceof DependencyTreeTableNode) {
Dependency dependency = ((DependencyTreeTableNode) node).getUserObject();
Enumeration<? extends TreeTableNode> children = this.treeTableModel.getRoot().children();
TreeTableNode child;
Object value;
while (children.hasMoreElements()) {
child = children.nextElement();
value = child.getUserObject();
if (value instanceof Plugin) {
if (((Plugin) value).getUID().equalsIgnoreCase(dependency.getResolveToPluginUID())) {
TreePath treePath = new TreePath(new Object[]{this.treeTableModel.getRoot(), child});
int index = this.pluginsTreeTable.getRowForPath(treePath);
this.pluginsTreeTable.setRowSelectionInterval(index, index);
break;
}
}
}
}
}
}
}
}
示例2: pluginsTreeTableMouseClicked
import org.jdesktop.swingx.treetable.TreeTableNode; //导入方法依赖的package包/类
private void pluginsTreeTableMouseClicked(MouseEvent e) {
if (e.getClickCount() == 2) {
synchronized(this) {
int selectedRow = this.pluginsTreeTable.getSelectedRow();
if (selectedRow != -1) {
TreePath path = this.pluginsTreeTable.getPathForRow(selectedRow);
Object node = path.getLastPathComponent();
if (node instanceof DependencyTreeTableNode) {
DependencyInfo dependency = ((DependencyTreeTableNode) node).getUserObject();
Enumeration<? extends TreeTableNode> children = this.treeTableModel.getRoot().children();
TreeTableNode child;
Object value;
while (children.hasMoreElements()) {
child = children.nextElement();
value = child.getUserObject();
if (value instanceof PluginInfo) {
if (((PluginInfo) value).getUID().equalsIgnoreCase(dependency.getUid())) {
TreePath treePath = new TreePath(new Object[]{this.treeTableModel.getRoot(), child});
int index = this.pluginsTreeTable.getRowForPath(treePath);
this.pluginsTreeTable.setRowSelectionInterval(index, index);
break;
}
}
}
}
}
}
}
}
示例3: getUnwrappedValue
import org.jdesktop.swingx.treetable.TreeTableNode; //导入方法依赖的package包/类
/**
* Returns the value as it should be passed to the delegate. If the unwrapUserObject
* property is true, tries return a userObject as appropriate for the value type.
* Returns the given value itself, ff the property is false or the type does
* not support the notion of userObject<p>
*
* Here: unwraps userObject of DefaultMutableTreeNode and TreeTableNode.<p>
*
* @param value the value to possibly unwrap
* @return the userObject if the value has an appropriate type and the
* unwrapUserObject property is true, otherwise returns the value unchanged.
*
* @see #setUnwrapUserObject(boolean)
* @see #getString(Object)
* @see #getRendererComponent(CellContext)
*/
protected Object getUnwrappedValue(Object value) {
if (!getUnwrapUserObject()) return value;
if (value instanceof DefaultMutableTreeNode) {
value = ((DefaultMutableTreeNode) value).getUserObject();
} else if (value instanceof TreeTableNode) {
TreeTableNode node = (TreeTableNode) value;
value = node.getUserObject();
}
return value;
}