动画的TreeView和嵌套的手风琴 [英] Animated TreeView and nested Accordions

查看:128
本文介绍了动画的TreeView和嵌套的手风琴的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想为我的应用程序实现一个导航,该导航看起来像TreeView,但动画化为TitledPane。也就是说,在扩展/折叠其内容时的过渡。

I want to achive a Navigation for my application that looks like a TreeView but is animated like a TitledPane. That is, a Transition when expanding/collapsing an item for its content.

到目前为止,我所做的是嵌套多个这样的手风琴:

What I did so far is to nest multiple Accordions like this:

- TopAccordion
---- TitledPane
------- Accordion
----------TitledPane
----------TitledPane
----------TitledPane
---- TitledPane
------- Accordion
----------TitledPane
----------TitledPane
----------TitledPane

等。不幸的是,这导致了同样的丑陋过渡(请注意打开嵌套的TitledPane时会有很大的间隙):

etc. Unfortunately, this results in same ugly transitions (notice the large gap when opening a nested TitledPane):

是否可以对TreeViews进行动画处理?通过查看TreeCell / TreeItem API,我找不到解决方法。

Is there a way to animate TreeViews and how? I couldn't find a way to do it by looking at the TreeCell/TreeItem API.

致谢,
Sebastian

Regards, Sebastian

推荐答案

我认为,有一种方法可以实现开放的视觉效果,例如在TreeView的Accordion / TitledPane中。

I think, there exists a way to implement visual effect of opening like in Accordion/TitledPane for TreeView.

您需要了解以下内容:

有一个场景图(节点树,其中在现场显示)。展开treeItem时,将在场景图中添加一些TreeCell,并重新分配树的内容。您需要的是添加动画,这将模糊更改单元格的高度,以便场景图引擎将重新绘制单元格,同时它们的高度会不断增加。

There is a scenegraph (tree of nodes, which are shown on the scene). When you expand a treeItem, some TreeCells are added in the scenegraph, and content of the tree is reallocated. What you need - is to add animation, which will change the height of cells smoohtly, so that scenegraph engine will redraw the cells, while they have an encreasing height.

但是您必须自己做。而且我认为,TreeView或TreeCell对此没有直接支持。

But you will have to do it be yourself. And I think, there is no direct support from TreeView or TreeCell for that.

您将发现此决定有效,并且发现可以在多种情况下实施该决定,您可以在jfx-jira中提出RFE以提供动画支持。

You will find this decision working, and find, that it can be implemented for a wide range of situations, you can file an RFE in jfx-jira for animation support.

这篇关于动画的TreeView和嵌套的手风琴的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆