Skip to main content

JXTreeTable: Partial text rendered after an edit

3 replies [Last post]
siva
Offline
Joined: 2003-07-15
Points: 0

In the hierarchy cell, right after making a edit change, the text that is displayed is always a partial text followed by ...

For example, if I have "Hello" in the cell and I edit it as "Hello World" and press enter, it would first show as "He..." even though there is plenty of space available to render the entire text, and when I change the cursor to some other cell, then I see the entire text.

I tried commenting the "setText(shortText);" but that didnt' help.

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Anonymous

I didn't came across this problem with TreeTable.
Try to fire treeNodesChanged event from your model.

And check also valueForPathChanged method.
It should work, if your implementation is correct.

siva
Offline
Joined: 2003-07-15
Points: 0

The valueForPathChanged was never called. Infact, this is only called in the BasicTreeUI.java which has a cellEditorListener that takes care of posting this valueForPathChanged (and I think it also takes care of when to stop editing so that the data corruption issue I mentioned in another forum earlier will not happen, though I am not sure). However, JXTreeTable seems to be using it's own editor.

However, I used the fireTreeNodesChanged in the setValueAt function, and the partial value issue I mentioned is resolved.

Anonymous

The point is that you have to notify a tree about any changes in the model.

So when cell editor finished, it post the new value to the model, and model should take care about notifying a tree that value been changed.

Editor does not fire TreeModelEvent event.