Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Volodymyr Lysenko
Ranch Hand
Posts: 511
1
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
 
Ranganathan Kaliyur Mannar
Bartender
Posts: 1101
10
Java Netbeans IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Volodymyr Lysenko
Ranch Hand
Posts: 511
1
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1101
10
Java Netbeans IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 287
13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
> 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 Lysenko
Ranch Hand
Posts: 511
1
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5126
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Volodymyr Levytskyi wrote:One more question is ...


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


Please do that.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic