United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-5032759 Please add ability to know when JTree.getRowCount() has changed
JDK-5032759 : Please add ability to know when JTree.getRowCount() has changed

Details
Type:
Enhancement
Submit Date:
2004-04-16
Status:
Closed
Updated Date:
2004-04-19
Project Name:
JDK
Resolved Date:
2004-04-19
Component:
client-libs
OS:
windows_2000
Sub-Component:
javax.swing
CPU:
x86
Priority:
P4
Resolution:
Duplicate
Affected Versions:
1.4.2
Fixed Versions:

Related Reports
Duplicate:

Sub Tasks

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



Hardware and Software, Engineered to Work Together