#1810 FluxText - TextEditor onSave() hooks

SlimerDude Mon 5 Mar 2012

It's niffty that flux comes with a Fantom text editor that can be used to edit a serialised options class.

From there are there any hooks or callbacks that I can use to be notified when my .fog has been saved so I can re-load and apply the new properties?

(By the way, what does .fog stand for?)

brian Mon 5 Mar 2012

Your View is given a onSave callback, but there is currently no "file watching" today. Although that feature is now in JDK 1.7 so we can support it.

By the way, what does .fog stand for?)

Its sort of a derivative from a term we used in our old system, but it stands for "fantom object graph" (although technically it is more of a tree, but fot didn't have the same catchiness)

SlimerDude Mon 5 Mar 2012

Your View is given a onSave callback

The TextEditor View has one yes... but alas that is out of my code base and I can't hook in to it.

there is currently no "file watching" today

I was thinking more of a global save event / hook given out by the Frame. The general idea being that sometimes your View cares more than just the resource it is modelling.

brian Mon 5 Mar 2012

I was planning on something like that, but I really want it to hook in native file system events so that an external app can change a dir, and Flux will notice it.

But a simple thing Flux already does (and you can do), is that when you regain focus check if your file's timestamp has been modified.

SlimerDude Mon 5 Mar 2012

Ah yes, I looked at flux::Flux#loadOptions and noticed the option / timestamp caching(*) Didn't think to check that on fwt::Widget#onFocus though, thanks for the idea.

(*) I have some ideas for improvements... maybe tomorrow :)

SlimerDude Wed 7 Mar 2012

Adding a listener to onFocus for a View doesn't seem to fire, but overriding #onActive works well.

Login or Signup to reply.