RobertBColton / DockFX

A fully featured docking library for the JavaFX platform.
Mozilla Public License 2.0
279 stars 106 forks source link

Ability to load/save layouts #11

Open SamCooper opened 8 years ago

SamCooper commented 8 years ago

It would be nice to be able to persist the layout of the docked panes (and even the undocked ones) so that that it can be recreated when restarting an application.

jasons2000 commented 8 years ago

I'm having to implement something like this for my application. We should consider creating a Dock Model separating it from the View and Control. This Dock Model would be a Tree like data structure capturing persist-able type state, including window size information and dock states. It would then be fairly trivial to persist this model, in addition this model structure could be mapped quite easily onto an FXML structure.

jpiersol commented 8 years ago

@jasons2000 Have you done any work on this? I'd be interested in using and/or helping develop.

jasons2000 commented 8 years ago

Hi @jpiersol, I've implemented persistence for aspects of my GUI and this works well, but haven't yet started work on persisting the actual DockFX related attributes data. I'm probably a couple of weeks away from looking at this on my current project plan.

My original strategy was to do some thing quick and dirty as I think a proper solution would require creating a tree-like model representing the DockPane relationships separate from all the presentation and control code which might be a lot of change to the existing DockFX implementation.

In any case, once I start looking at persistence again I will be happy to share and work with you on it.

mrjvijay commented 7 years ago

Hi @jasons2000, I tried to implement persistence for my GUI using (x,y) coordinates but my nodes don't exactly display as how I wanted to see. It feels like they loose the positions when I dock them. Can you give me any inputs or ideas please? Thanks

jasons2000 commented 7 years ago

Have you looked at the latest ClearControl fork. That now contains a persistence mechanism for Windows.

mrjvijay commented 7 years ago

No not yet. I will check it out. Thanks so much.

ValeriusGC commented 6 years ago

Hi, excuse me, is this save/load mechanism implemented or nope? I had not found no trace of it in the source (searching by keywords save/load)...

jasons2000 commented 6 years ago

i believe it's on one of the other forks, the Sam Cooper branch i think

davidmoshal commented 5 years ago

any updates on the ability to save/load dock state?

sirolf2009 commented 5 years ago

I implemented this once for a project I was working one. You can find my save/load here: https://github.com/sirolf2009/caesar/blob/master/src/main/java/com/sirolf2009/caesar/MainController.java#L65 It uses kryo to serialize DockFX dashboards by saving the splitpane dividers and then turning them back into dashboards here: https://github.com/sirolf2009/caesar/blob/master/src/main/java/com/sirolf2009/caesar/component/DashboardTab.java