Any ideas for a "scene builder" control?

John Smith John_Smith at symantec.com
Fri Apr 5 13:56:45 PDT 2013


One solution is to create a separate layer pane placed over the top of the container containing the controls to be positioned and laid out.

stack.setChildren(
  controlPane,
  selectionPane
);

The Selection overlay would handle the rendering of the selection area bounds, resizing widgets etc.
Listeners on the various bounds types of nodes would co-ordinate changes between each of the panes.
For example, when the selection containing a node is dragged, the underlying node's layout is modified so that it moves as well.

A simplistic sample implementation is here:
https://gist.github.com/jewelsea/1441960  "Demo for understanding JavaFX Layout Bounds"

-----Original Message-----
From: openjfx-dev-bounces at openjdk.java.net [mailto:openjfx-dev-bounces at openjdk.java.net] On Behalf Of Werner Lehmann
Sent: Friday, April 05, 2013 6:40 AM
To: openjfx-dev at openjdk.java.net
Subject: Any ideas for a "scene builder" control?

Hi,

I am looking for options to create a custom container control or pane with absolute-position layouting which allows users at runtime to select, resize, drag, or drag-select children - similar to SceneBuilder.

Absolute layouting would probably be achieved by j.s.layout.Pane. The hard part is how to display interactive selections with...
- selection border on selected controls,
- resizing-handles in the border corners,
- a drag-selection rectangle,

while still keeping this a private implementation detail...
- cannot change parent hierarchy of contained child nodes,
- cannot add private nodes like a selection rectangle to the public children property.

So far I am stuck on the prototyping phase because nothing satisfied the
above:

1. Using CSS to draw selection borders: does not work because I could not display those 8 resizing-handles (on top yes, on bottom no), plus it may override existing control styles, plus it does not help with a drag-selection rectangle.

2. Extending Region and implement Skinnable, and the Skin has a stackpane for the private nodes: skins are intended for Control, not Region, need to use/copy some com.sun.* and impl and private code, and the layouting seems off (leaving out details here).


3. Extending Region with a nested substructure of StackPane and Panes, and returning only part of that substructure as public children. Does not work well either (not surprisingly because I have different public and private children lists then), and it violates the "cannot change parent hierarchy" requirement.

Am I missing something obvious? How is this done in SceneBuilder? Maybe it extends Control and lays out the children in a Skin?

Rgds
Werner


More information about the openjfx-dev mailing list