具有恒定节点宽度的 Draw2D GridLayoutAlgorithm?
我们正在将 Draw2D/GEF 集成到应用程序中,但遇到了所提供的标准布局的问题。
我们有一个元素集合(比如 100 个)需要以类似网格的方式显示。我们使用 GraphViewer
实现了视图,并应用了 GridLayoutAlgorithm
。
这几乎正如我们所希望的那样,但我们无法满足的一个规定是每个节点必须具有恒定的、定义的大小。比如说,50x50 像素。我们当前使用的 GridLayoutAlgorithm 会调整节点的大小,以便它们都适合窗口。如果我们的窗口很小,那么 100 个元素就会变得很小。相反,我们希望它们填充宽度,然后换行为多行,并带有垂直滚动条。
在我的一生中,我找不到一种简单、直接的方法来实现这一目标。
We're integrating Draw2D/GEF into an application, and are encountering an issue with the standard layouts provided.
We have a collection (say 100) of elements that need to be displayed in a grid-like fashion. We implemented our view using a GraphViewer
, and applied a GridLayoutAlgorithm
.
This works almost as we'd like it to, but the one stipulation we haven't been able to meet is that each node must be of a constant, defined size. Say, 50x50 pixels. The current GridLayoutAlgorithm we're using resizes the nodes so that they all fit in the window. If our window is small, the 100 elements become minuscule. We would instead like them to fill the width, then wrap to multiple rows, with a vertical scrollbar.
For the life of me, I can't find a simple, straightforward way to accomplish this.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
有点糟糕的答案,但我最终编写了自己的 GridLayoutAlgorithm 子类,并手工完成了一堆数学运算。令人沮丧的是,这并不是开箱即用的,但它工作得很好。
Kind of a bummer answer, but I just ended up writing my own subclass of a
GridLayoutAlgorithm
and did a bunch of the math by hand. Frustrating that this wasn't included out-of-the-box, but it works fine.