JDK-5032759 : Please add ability to know when JTree.getRowCount() has changed
  • Type: Enhancement
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 1.4.2
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_2000
  • CPU: x86
  • Submitted: 2004-04-16
  • Updated: 2004-04-19
  • Resolved: 2004-04-19
Related Reports
Duplicate :  
Description

Name: rmT116609			Date: 04/15/2004


A DESCRIPTION OF THE REQUEST :
Please add ability to know when JTree.getRowCount() has changed.

When we add listeners to the model to find out when nodes have been inserted or removed then call JTree.getRowCount() from the event notification, the row count sometimes hasn't been updated yet.

The problem is that the TreeState has also added listeners to the model, and the ordering that our listeners and the TreeState listeners get notified in changes sometimes.

JUSTIFICATION :
We want to make the preferred size of our JTrees based on rowCount and not visible row count.

CUSTOMER SUBMITTED WORKAROUND :
workaround 1: call SwingUtilities.invokeLater from the event notification in order to make sure the state listeners have been called 1st.

workaround 2: override JTree.treeDidChange() to notify our listeners that the row count may have changed.
(Incident Review ID: 230402) 
======================================================================

Comments
EVALUATION This is another case where the developer should be able to specify that they want their listener notified after Swing has updated its own listeners. This is therefore a duplicate of 4178930. ###@###.### 2004-04-19
2004-04-19