Changes to JFX Flow

31 views
Skip to first unread message

zonski

unread,
Dec 18, 2011, 4:18:26 PM12/18/11
to jfxflow-discuss, richar...@oracle.com
Hey Guys,

This is just a heads up that I am about to commit some changes to JFX
Flow that have some API changes. If you've got any code using Flow you
will likely need to make some small adjustments.

The main changes are:

1. HasNode has been renamed to Activity: I was trying to keep the
'activity' term out of the Flow framework in case people wanted to use
Presenter or Controller, or whatever in their own code. This approach
wasn't working (since I had AbstractActivity and ParentActivity
classes anyway). In general the API now reads cleaner with accepting
that Flow is based on 'Activities' not 'HasNodes'.

2. I have added a 'View' interface: previously the Activity had a
getNode() method which returned a Node. Since Node is not an
interface, when I tried to implement option 2 of my latest MVP blog, I
found that Flow did not support this well. As such the View Interface
is now added, which defines a single method 'toNode()' - in most cases
a view implementation will just implement this by returning
'this' (unless the JFX guys are interested in changing Node into an
interface but I think this was floated before and didn't go anywhere).
There is a SimpleView class that takes a Node as parameter and returns
that, which can be used for cases where the View is just a simple Node
and you don't want to create a new class for it.

3. HasEntryTransition now has a isSequentialTransition. If your
Activity returns false from this (AbstractActivity returns true by
default) then a parallel transition will be used. This works now,
currently however the whole ActivityFactory has not yet been added so
if you Navigate from an Activity to itself (i.e. from Person[1] to
Person[2]) with a parallel transition you will get an exception
(duplicate parent). This won't happen if each page of your GUI is a
unique Activity (e.g. JFX Ensemble and JFX Flow Showcase both are like
this). Factory support will likely be added in early Jan.

4. A TransitionFactory interface (with default implementation) has
been added. This can be set on a Browser to override the default
transition logic (i.e. you can set the default entry/exit, override;
when/if parallel or serial gets used; and choose to ignore custom
activity implementations; etc). As well as being used in Browser, this
can be used stand alone on your own custom views if you want.

5. A ParentActivity has been added. This is an Activity that contains
child activities and would be useful for things like a page containing
sub-tabs, etc. This supports TransitionFactory so you can set your own
tab-change animations if you want. ParentActivity provides an
aggregated state of its children (i.e. the list of active workers for
the ParentActivity includes the child ones, etc).

6. Browser has been gutted and rebuilt. The public API is unchanged
(for things that anyone would be using anyway) however the new Browser
class is much more extensible and customisable. I use ParentActivity
internally so most of the hard work has moved into that, meaning
Browser just contains the Glasspanes, header, footer, etc, which is
the stuff most people want to customise. If you want to build your own
Browser, just copy the current one and adjust to suit your needs. I
also ditched the skinning approach for this - it wasn't working for
Browser which really is 'skinned' by adding and removing children from
it and changing its actual structure (skinning is really only useful
for changing the display when the 'structure' is static).

7. ErrorHandler and supporting classes have been moved to its own
package (instead of worker). Just a bit of house keeping.

If anyone has trouble with the above changes or in making the shift,
let me know.

I will likely be deploying this to the Maven snapshot repository later
today, and will be using the latest changes in my own project to test
them out. There may be a couple of minor changes needed as a result
and I will put them in as I go. Hopefully the API won't change as a
result but I will let you know if it does.

Cheers,
Dan

Reply all
Reply to author
Forward
0 new messages