Bug 50221 - Renaming elements in the tree does not resize label
Renaming elements in the tree does not resize label
Status: RESOLVED FIXED
Product: JMeter
Classification: Unclassified
Component: Main
2.4
PC Windows XP
: P2 minor with 1 vote (vote)
: ---
Assigned To: JMeter issues mailing list
:
Depends on:
Blocks:
  Show dependency tree
 
Reported: 2010-11-05 08:59 UTC by jens_0
Modified: 2011-07-20 22:13 UTC (History)
1 user (show)



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description jens_0 2010-11-05 08:59:21 UTC
Often, when test elements are renamed, their label in the test tree does not resize: When the name is longer than before, it is displayed with "...", if the name is shorter than before, it the blue selection box is too large.

This can be fixed by expanding or collapsing the element, in case it has children.
Comment 1 Sebb 2010-11-05 10:59:53 UTC
Or by disabling and re-enabling the element...
Comment 2 jens_0 2011-02-02 11:00:34 UTC
The method JMeterTreeNode.nameChanged() is never called but fixes this.

It needs to be called on the right moment, probably on the node that just is left when changing the focus. The only events that I found are raised too late: They are applied on the node that is switched to, but if you switch back to the node with short label "..." then it helps:
JMeterTreeListener.mouseclicked:
    getCurrentNode().nameChanged();

So this only solves it halfway. It can't be that difficult?
Comment 3 Sebb 2011-02-02 11:30:45 UTC
Thanks for that insight - I have found the place in GuiPackage where the GUI fields are saved when changing node. Adding a call to nameChanged() seems to fix the issue:

URL: http://svn.apache.org/viewvc?rev=1066517&view=rev
Log:
Bug 50221 - Renaming elements in the tree does not resize label

Modified:
   jakarta/jmeter/trunk/src/core/org/apache/jmeter/gui/GuiPackage.java
   jakarta/jmeter/trunk/xdocs/changes.xml
Comment 4 jens_0 2011-07-20 09:09:08 UTC
I get null pointer exceptions sometimes when opening large test plans at the start of JMeter.

This solved the problem:

JMeterTreeNode.java:
    /** {@inheritDoc} */
    public void nameChanged() {
+   	if (treeModel != null) {
    		treeModel.nodeChanged(this);
+    	}
    }