Skip to main content

Layout Manager in a scene graph

7 replies [Last post]
xylifyx
Offline
Joined: 2003-06-22

The Scene graph demos I have seen are very unresponsive to size changes of the surrounding component. In real life applications the user will experience this as strange. I have tried to come up with a suggestion to an extension to scenegraph that will change that.

http://profundo.dk/~ermh/SceneGraphLayout/dist/launch.html

the source code is here

http://profundo.dk/~ermh/SceneGraphLayout/src/xylifyx/scenario/layout/

The basic principle is to extend SGNode that supports relocation or resizing with a setBounds method, and use the getBounds method that already exists to get the extension of the node.

Using animation you can create fancy layoutmanager like SGGroup nodes that doesn't look like anything you can do in Swing. Check out the webstart demo and

http://profundo.dk/~ermh/SceneGraphLayout/src/xylifyx/scenario/layout/An...

what do you think?

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
rossjudson
Offline
Joined: 2006-01-13

Some basic layout capability between nodes is necessary in just about all cases...the min/preferred/max sizes that are used by AWT components are probably necessary in this case as well. I've created adapter classes that let the regular layouts work on non-component objects before, and something like that can probably work here as well.

As you've said, it's important to think about these layouts as animated entities, not static ones...

Amy Fowler

This a very cool example of the animated layout concept!

We completely agree that a layout mechanism needs to be supported in
scene graph at
some level.

For GUIs, it sometimes gets more complex than this, as layout managers
typically
consider size hints (min, preferred, max) from their children in terms
of allocating the often limited real estate.
Some components want to be flexible, some do not (in your example, the
ball objects do not).
Ideally we could support this in a way that doesn't unnecessarily
burden graphics nodes
that don't care about being flexible.

Additionally, in order to support the "pack" concept where the
toplevel window is sized
according to the content, there needs to be a bottom-up recursion for
requesting preferred
size of the hierarchy. I'm not sure if this concept is something
that has been traditionally
supported in more purely graphic scene-graph libraries (?) but it's
something that is desirable
for creating user interfaces.

Aim

On May 28, 2008, at 1:14 PM, scenario@javadesktop.org wrote:

> Some basic layout capability between nodes is necessary in just
> about all cases...the min/preferred/max sizes that are used by AWT
> components are probably necessary in this case as well. I've created
> adapter classes that let the regular layouts work on non-component
> objects before, and something like that can probably work here as
> well.
>
> As you've said, it's important to think about these layouts as
> animated entities, not static ones...
> [Message sent by forum member 'rossjudson' (rossjudson)]
>
> http://forums.java.net/jive/thread.jspa?messageID=277108
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@scenegraph.dev.java.net
> For additional commands, e-mail: dev-help@scenegraph.dev.java.net
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@scenegraph.dev.java.net
For additional commands, e-mail: dev-help@scenegraph.dev.java.net

willismorse
Offline
Joined: 2004-01-30

> Additionally, in order to support the "pack" concept
> where the
> toplevel window is sized
> according to the content, there needs to be a
> bottom-up recursion for
> requesting preferred
> size of the hierarchy. I'm not sure if this
> concept is something
> that has been traditionally
> supported in more purely graphic scene-graph
> libraries (?) but it's
> something that is desirable
> for creating user interfaces.

I'm very glad to hear you say this. You hit this "inside-out" layout problem a lot with text blocks, where you want reasonably tightly constrained width (with optional restraints on breaking text) but don't care about the height. Particle systems and more traditional graph engines like JUNG are more examples of the need for multipass layout.

billg
Offline
Joined: 2008-02-03

Very cool! Nice work xylifyx.

Joshua Marinacci

Wow. that runs quite nicely.

On Mar 22, 2008, at 9:55 AM, scenario@javadesktop.org wrote:

> The Scene graph demos I have seen are very unresponsive to size
> changes of the surrounding component. In real life applications the
> user will experience this as strange. I have tried to come up with a
> suggestion to an extension to scenegraph that will change that.
>
> http://profundo.dk/~ermh/SceneGraphLayout/dist/launch.html
>
> the source code is here
>
> http://profundo.dk/~ermh/SceneGraphLayout/src/xylifyx/scenario/layout/
>
> The basic principle is to extend SGNode that supports relocation or
> resizing with a setBounds method, and use the getBounds method that
> already exists to get the extension of the node.
>
> Using animation you can create fancy layoutmanager like SGGroup
> nodes that doesn't look like anything you can do in Swing. Check out
> the webstart demo and
>
> http://profundo.dk/~ermh/SceneGraphLayout/src/xylifyx/scenario/layout/An...
>
> what do you think?
> [Message sent by forum member 'xylifyx' (xylifyx)]
>
> http://forums.java.net/jive/thread.jspa?messageID=265302
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@scenegraph.dev.java.net
> For additional commands, e-mail: dev-help@scenegraph.dev.java.net
>

Joshua Marinacci, Sun Engineer
http://weblogs.java.net/blog/joshy/
http://joshy.org/
joshua@marinacci.org

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@scenegraph.dev.java.net
For additional commands, e-mail: dev-help@scenegraph.dev.java.net

Joshua Marinacci

I'm getting the following error on your JNLP. I think you need to go
into you project properties and switch to external HTTP and put in the
url for your web page.

com.sun.deploy.net.FailedDownloadException: Unable to load resource:
file:/Users/ermh/Developer/SceneGraphLayout/dist/launch.jnlp

On Mar 22, 2008, at 9:55 AM, scenario@javadesktop.org wrote:

> The Scene graph demos I have seen are very unresponsive to size
> changes of the surrounding component. In real life applications the
> user will experience this as strange. I have tried to come up with a
> suggestion to an extension to scenegraph that will change that.
>
> http://profundo.dk/~ermh/SceneGraphLayout/dist/launch.html
>
> the source code is here
>
> http://profundo.dk/~ermh/SceneGraphLayout/src/xylifyx/scenario/layout/
>
> The basic principle is to extend SGNode that supports relocation or
> resizing with a setBounds method, and use the getBounds method that
> already exists to get the extension of the node.
>
> Using animation you can create fancy layoutmanager like SGGroup
> nodes that doesn't look like anything you can do in Swing. Check out
> the webstart demo and
>
> http://profundo.dk/~ermh/SceneGraphLayout/src/xylifyx/scenario/layout/An...
>
> what do you think?
> [Message sent by forum member 'xylifyx' (xylifyx)]
>
> http://forums.java.net/jive/thread.jspa?messageID=265302
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@scenegraph.dev.java.net
> For additional commands, e-mail: dev-help@scenegraph.dev.java.net
>

Joshua Marinacci, Sun Engineer
http://weblogs.java.net/blog/joshy/
http://joshy.org/
joshua@marinacci.org

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@scenegraph.dev.java.net
For additional commands, e-mail: dev-help@scenegraph.dev.java.net

xylifyx
Offline
Joined: 2003-06-22

sorry, it should be fixed now