File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JavaFX and the fly likes How to register for expand event of TreeItem with no children? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » JavaFX
Bookmark "How to register for expand event of TreeItem with no children?" Watch "How to register for expand event of TreeItem with no children?" New topic
Author

How to register for expand event of TreeItem with no children?

Volodymyr Levytskyi
Ranch Hand

Joined: Mar 29, 2012
Posts: 505
    
    1

Hello!

I am doing TreeView whose TreeItems should be lazily populated when user tries to expand TreeItem.

How to register for expand event of TreeItem with no children? I tried to add ChangeListener on expandProperty but it does not work.

Thank you!


True person is moral, false is right!
Ranganathan Kaliyur Mannar
Bartender

Joined: Oct 16, 2003
Posts: 1076
    
  10

Hi,
The API documentation for TreeItem straightaway gives an example - this example is using the usual file-folder one. You can read that and achieve lazy-loading the same way.


Ranga.
SCJP 1.4, OCMJEA/SCEA 5.0.
Volodymyr Levytskyi
Ranch Hand

Joined: Mar 29, 2012
Posts: 505
    
    1

Hello Ranganathan !

Yes. There is example but it requires me to call method getChildren. The problem is when to call it if I cannot register to change event on expandProperty.
But this is resolvable if I subclas TreeCell and override method setOnMouseClick.

The more weird problems for me were posted recently in this forum here and here.

But one more concern is how to style text of Tooltip. In swing I used html for that but what to use in JavaFX?

Thank you!
Ranganathan Kaliyur Mannar
Bartender

Joined: Oct 16, 2003
Posts: 1076
    
  10

Volodymyr Levytskyi wrote:There is example but it requires me to call method getChildren.


No, you don't have to call it. Did you actually try out the example?
John Damien Smith
Ranch Hand

Joined: Jan 26, 2012
Posts: 142
    
    9
> But one more concern is how to style text of Tooltip. In swing I used html for that but what to use in JavaFX?

Please ask additional questions in new threads.

To style the content of a Tooltip, use any of the following techniques.
a) Use Java 8 and set the graphic of the Tooltip to a TextFlow.
b) In any Java version, set the graphic to a WebView instance into which you load html.
c) In any Java version, set the graphic to an arbitrary Node in which you can place any Java content you want.
d) Use cssto style the Tooltip content.
Volodymyr Levytskyi
Ranch Hand

Joined: Mar 29, 2012
Posts: 505
    
    1

Thank you for replies!

I chose WebView and I have it displayed well with basic html.

One more question is how to tell javafx.scene.control.Tooltip to stay visible for longer time and
stay visible while mouse is inside tooltip.
How to control duration after which particular Tooltip is shown?

Thank you!

Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 4530
    
    5

Volodymyr Levytskyi wrote:One more question is ...


John Damien Smith wrote:Please ask additional questions in new threads.


Please do that.


luck, db
There are no new questions, but there may be new answers.
 
 
subject: How to register for expand event of TreeItem with no children?