Java Code Examples for javax.swing.JTree#collapseRow()

The following examples show how to use javax.swing.JTree#collapseRow() . 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 File: TDA.java    From tda with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * expand all nodes of the currently selected category, only works for tree categories.
 */
private void expandAllCatNodes(boolean expand) {
    DefaultMutableTreeNode node = (DefaultMutableTreeNode) tree.getLastSelectedPathComponent();
    JTree catTree = (JTree) ((TreeCategory) node.getUserObject()).getCatComponent(this);
        if(expand) {
      for (int i = 0; i < catTree.getRowCount(); i++) {
            catTree.expandRow(i);
      }
        } else {
      for (int i = 0; i < catTree.getRowCount(); i++) {
            catTree.collapseRow(i);
        }
    }
}
 
Example 2
Source File: EquipInfoTab.java    From pcgen with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
public void actionPerformed(ActionEvent e)
{
	JTree tree = equipmentSetTable.getTree();
	for (int i = tree.getRowCount() - 1; i >= 0; i--)
	{
		tree.collapseRow(i);
	}
}
 
Example 3
Source File: WorkingMemoryViewer.java    From cst with GNU Lesser General Public License v3.0 5 votes vote down vote up
private void collapseAllNodes(JTree tree) {
   int row = tree.getRowCount() - 1;
   while (row >= 0) {
      tree.collapseRow(row);
      row--;
   }
   tree.expandRow(0);
   row = tree.getRowCount() - 1;
   while (row >= 0) {
      tree.expandRow(row);
      row--;
   }
}
 
Example 4
Source File: WorkingMemoryPanel.java    From cst with GNU Lesser General Public License v3.0 5 votes vote down vote up
private void collapseAllNodes(JTree tree) {
   int row = tree.getRowCount() - 1;
   while (row >= 0) {
      tree.collapseRow(row);
      row--;
   }
   tree.expandRow(0);
   row = tree.getRowCount() - 1;
   while (row >= 0) {
      tree.expandRow(row);
      row--;
   }
}
 
Example 5
Source File: TreeViewerUtil.java    From cst with GNU Lesser General Public License v3.0 5 votes vote down vote up
public static void collapseAllNodes(JTree tree) {
   int row = tree.getRowCount() - 1;
   while (row >= 0) {
      tree.collapseRow(row);
      row--;
   }
   tree.expandRow(0);
   row = tree.getRowCount() - 1;
   while (row >= 0) {
      tree.expandRow(row);
      row--;
   }
}
 
Example 6
Source File: AbstractObjectEditor.java    From cst with GNU Lesser General Public License v3.0 5 votes vote down vote up
private void collapseAllNodes(JTree tree) {
   int row = tree.getRowCount() - 1;
   while (row >= 0) {
      tree.collapseRow(row);
      row--;
   }
   //tree.expandRow(0);
   row = tree.getRowCount() - 1;
   while (row >= 0) {
      tree.expandRow(row);
      row--;
   }
}
 
Example 7
Source File: EquipInfoTab.java    From pcgen with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
public void actionPerformed(ActionEvent e)
{
	JTree tree = equipmentSetTable.getTree();
	for (int i = tree.getRowCount() - 1; i >= 0; i--)
	{
		tree.collapseRow(i);
	}
}
 
Example 8
Source File: UIUtil.java    From rest-client with Apache License 2.0 3 votes vote down vote up
/**
* 
* @Title      : collapse 
* @Description: Collapse tree nodes
* @Param      : @param tree 
* @Return     : void
* @Throws     :
 */
public static void collapse(JTree tree)
{
    for (int r = 0; r < tree.getRowCount(); r++)
    {
        tree.collapseRow(r);
    }
}