I thought I'd have a play with writing a Flux application. I don't want to extend the IDE but build new app from scratch with only my views and sidebars. Only I can't work out how!
flux::Main is essentially just:
static Void main(Str[] args) {
f := Frame()
f.loadState
// open the frame and let's get this party started!
f.open
}
which seems reasonable given that Frame is the main top level window in flux applications. But how do I create an instance of Frame in my own app? Its make signature is:
internal new make() : super() { ... }
meaning I can't access it!?
I must be missing something rather obvious so any pointers would be appreciated.
Cheers.
brianSun 19 Feb 2012
Hi SlimerDude,
The original design of Flux was more of a framework versus a library - Hollywood principle you know: "don't call us, we'll call you". The intention is that you don't create your own frames, but rather you plug into the existing framework thru a couple mechanisms:
model your navigation through URIs which includes the file system or custom URI schemes you might create yourself (for example see FluxScheme)
for a given resolved URI resource plugin one or more views that can view and edit that resource. If its a File resource, then you do this via the MIME type. Or if you create your own custom resources, then its by the Fantom type
Hmm, it seems rather awkward having to deploy your code into an existing installation of Flux just to try it out. (I'm comparing it to the Run as Fantom class option in F4)
I rebuilt Flux, changing the scope of about 3 methods in flux::Frame from internal to public and now my Main looks like:
an instant flux library! It even picks up the index property in build.fan for defining SideBars and Views - it makes life a whole lot easier.
I would consider opening up Frame a little so the above is accessible by default.
brianSun 19 Feb 2012
Those sort of manual initialization steps tend to be fragile. And that code is pretty much what flux::Main already does. I pushed a change to make Main public so you can duplicate that with this script:
using flux
class Foo {
static Void main(Str[] args) { Main.main(args) }
}
I guess if you get into it further we can evaluate figuring out best way to make more public.
SlimerDudeSun 19 Feb 2012
Cool, cheers.
I guess all I'm actually looking for is a way to programmatically fire up the Flux app - which by making Main public - you've done!
SlimerDude Sat 18 Feb 2012
I thought I'd have a play with writing a Flux application. I don't want to extend the IDE but build new app from scratch with only my views and sidebars. Only I can't work out how!
flux::Main
is essentially just:which seems reasonable given that
Frame is the main top level window in flux applications.
But how do I create an instance ofFrame
in my own app? Its make signature is:meaning I can't access it!?
I must be missing something rather obvious so any pointers would be appreciated.
Cheers.
brian Sun 19 Feb 2012
Hi SlimerDude,
The original design of Flux was more of a framework versus a library - Hollywood principle you know: "don't call us, we'll call you". The intention is that you don't create your own frames, but rather you plug into the existing framework thru a couple mechanisms:
The Flux docs have a high level overview.
SlimerDude Sun 19 Feb 2012
Hmm, it seems rather awkward having to deploy your code into an existing installation of Flux just to try it out. (I'm comparing it to the
Run as Fantom class
option in F4)I rebuilt Flux, changing the scope of about 3 methods in
flux::Frame
frominternal
topublic
and now my Main looks like:an instant flux library! It even picks up the index property in
build.fan
for defining SideBars and Views - it makes life a whole lot easier.I would consider opening up Frame a little so the above is accessible by default.
brian Sun 19 Feb 2012
Those sort of manual initialization steps tend to be fragile. And that code is pretty much what
flux::Main
already does. I pushed a change to makeMain
public so you can duplicate that with this script:I guess if you get into it further we can evaluate figuring out best way to make more public.
SlimerDude Sun 19 Feb 2012
Cool, cheers.
I guess all I'm actually looking for is a way to programmatically fire up the Flux app - which by making Main public - you've done!