Java Code Examples for org.jdesktop.swingx.treetable.TreeTableNode

The following examples show how to use org.jdesktop.swingx.treetable.TreeTableNode. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: ganttproject   Source File: GanttTree2.java    License: GNU General Public License v3.0 5 votes vote down vote up
/** Refresh the expansion (recursive function) */
public void expandRefresh(TreeTableNode moved) {
  if (moved instanceof TaskNode) {
    Task movedTask = (Task) moved.getUserObject();
    if (movedTask.getExpand()) {
      getTreeTable().getTree().expandPath(TreeUtil.createPath(moved));
    }
    for (int i = 0; i < moved.getChildCount(); i++) {
      expandRefresh(moved.getChildAt(i));
    }
  }
}
 
Example 2
@Override
public String getToolTipText(MouseEvent event) {
  int column = columnAtPoint(event.getPoint());
  if (column >= 0 && isHierarchical(column)) {
    TreePath pathAtPoint = getTreeTable().getPathForLocation(event.getX(), event.getY());
    TreeTableNode nodeAtPoint = pathAtPoint == null ? null : (TreeTableNode) pathAtPoint.getLastPathComponent();
    if (nodeAtPoint instanceof AssignmentNode) {
      Task task = ((AssignmentNode)nodeAtPoint).getTask();
      return "<html><body>" + buildPath(task) + "</body></html>";
    }
  }
  return super.getToolTipText(event);
}
 
Example 3
Source Project: ganttproject   Source File: TreeUtil.java    License: GNU General Public License v3.0 5 votes vote down vote up
public static int getLevel(TreeTableNode treeNode) {
  int level = 0;
  while (treeNode != null) {
    treeNode = treeNode.getParent();
    level++;
  }
  return level - 1;
}
 
Example 4
private void expandAll(TreePath root) {
  getTree().expandPath(root);
  TreeTableNode node = (TreeTableNode) root.getLastPathComponent();
  for (int i = 0; i < node.getChildCount(); i++) {
    expandAll(root.pathByAddingChild(node.getChildAt(i)));
  }
}
 
Example 5
private void collapseAll(TreePath root) {
  TreeTableNode node = (TreeTableNode) root.getLastPathComponent();
  for (int i = 0; i < node.getChildCount(); i++) {
    collapseAll(root.pathByAddingChild(node.getChildAt(i)));
  }
  getTree().collapsePath(root);
}
 
Example 6
Source Project: gameserver   Source File: GuildBagTreeTableModel.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void setValueAt(Object value, Object node, int column) {
	if ( node != null && node instanceof DBObjectTreeTableNode ) {
		DBObjectTreeTableNode userNode = (DBObjectTreeTableNode)node;
		TreeTableNode parent = userNode.getParent();
		while ( parent.getParent() != root ) {
			parent = parent.getParent();
		}
		userNode = (UserTreeTableNode)parent;
		String userId = (String)userNode.getKey();
		userNodeSet.put(userId, userNode);
	}
	super.setValueAt(value, node, column);
}
 
Example 7
Source Project: gameserver   Source File: GuildTreeTableModel.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void setValueAt(Object value, Object node, int column) {
	if ( node != null && node instanceof DBObjectTreeTableNode ) {
		DBObjectTreeTableNode userNode = (DBObjectTreeTableNode)node;
		TreeTableNode parent = userNode.getParent();
		while ( parent.getParent() != root ) {
			parent = parent.getParent();
		}
		userNode = (UserTreeTableNode)parent;
		String userId = (String)userNode.getKey();
		userNodeSet.put(userId, userNode);
	}
	super.setValueAt(value, node, column);
}
 
Example 8
Source Project: gameserver   Source File: AccountTreeTableModel.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void setValueAt(Object value, Object node, int column) {
	if ( node != null && node instanceof DBObjectTreeTableNode ) {
		DBObjectTreeTableNode userNode = (DBObjectTreeTableNode)node;
		TreeTableNode parent = userNode.getParent();
		while ( parent.getParent() != root ) {
			parent = parent.getParent();
		}
		userNode = (UserTreeTableNode)parent;
		String userId = (String)userNode.getKey();
		userNodeSet.put(userId, userNode);
	}
	super.setValueAt(value, node, column);
}
 
Example 9
Source Project: gameserver   Source File: UserTreeTableModel.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void setValueAt(Object value, Object node, int column) {
	if ( node != null && node instanceof DBObjectTreeTableNode ) {
		DBObjectTreeTableNode userNode = (DBObjectTreeTableNode)node;
		TreeTableNode parent = userNode.getParent();
		while ( parent.getParent() != root ) {
			parent = parent.getParent();
		}
		userNode = (UserTreeTableNode)parent;
		UserId userId = (UserId)userNode.getKey();
		userNodeSet.put(userId, userNode);
	}
	super.setValueAt(value, node, column);
}
 
Example 10
Source Project: gameserver   Source File: GuildMemberTreeTableModel.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void setValueAt(Object value, Object node, int column) {
	if ( node != null && node instanceof DBObjectTreeTableNode ) {
		DBObjectTreeTableNode userNode = (DBObjectTreeTableNode)node;
		TreeTableNode parent = userNode.getParent();
		while ( parent.getParent() != root ) {
			parent = parent.getParent();
		}
		userNode = (UserTreeTableNode)parent;
		String userId = (String)userNode.getKey();
		userNodeSet.put(userId, userNode);
	}
	super.setValueAt(value, node, column);
}
 
Example 11
Source Project: aion-germany   Source File: FileSystemPanel.java    License: GNU General Public License v3.0 4 votes vote down vote up
public SimpleTreeModel(TreeTableNode root)
{
    super(root);
}
 
Example 12
public PacketViewTableModel(TreeTableNode root)
{
    super(root);
}
 
Example 13
Source Project: ramus   Source File: BranchView.java    License: GNU General Public License v3.0 4 votes vote down vote up
@Override
public Enumeration<? extends TreeTableNode> children() {
    return Collections.enumeration(children);
}
 
Example 14
Source Project: ramus   Source File: BranchView.java    License: GNU General Public License v3.0 4 votes vote down vote up
@Override
public TreeTableNode getChildAt(int childIndex) {
    return children.get(childIndex);
}
 
Example 15
Source Project: ramus   Source File: BranchView.java    License: GNU General Public License v3.0 4 votes vote down vote up
public BranchModel(TreeTableNode root) {
    super(root);
}
 
Example 16
Source Project: ramus   Source File: BranchView.java    License: GNU General Public License v3.0 4 votes vote down vote up
@Override
public void setRoot(TreeTableNode root) {
    Node n = (Node) root;
    n.sort();
    super.setRoot(root);
}
 
Example 17
Source Project: ganttproject   Source File: TreeUtil.java    License: GNU General Public License v3.0 4 votes vote down vote up
static TreeTableNode getPrevSibling(TreeTableNode node) {
  TreeTableNode parent = node.getParent();
  int idxPrev = getPrevSibling(parent, node);
  return idxPrev == -1 ? null : parent.getChildAt(idxPrev);
}
 
Example 18
Source Project: ganttproject   Source File: TreeUtil.java    License: GNU General Public License v3.0 4 votes vote down vote up
static TreeTableNode getNextSibling(TreeTableNode node) {
  TreeTableNode parent = node.getParent();
  int idxNext = getNextSibling(parent, node);
  return idxNext == -1 ? null : parent.getChildAt(idxNext);
}
 
Example 19
Source Project: GsonFormat   Source File: FiledTreeTableModel.java    License: Apache License 2.0 4 votes vote down vote up
public FiledTreeTableModel(TreeTableNode node) {
    super(node);
}