Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add possibility to save/restore WebDocumentPane state #186

Closed
mgarin opened this issue Sep 30, 2014 · 1 comment
Closed

Add possibility to save/restore WebDocumentPane state #186

mgarin opened this issue Sep 30, 2014 · 1 comment
Assignees
Projects

Comments

@mgarin
Copy link
Owner

mgarin commented Sep 30, 2014

At the moment WebDocumentPane state cannot be easily restored without additional efforts and coding. There should be a way to save and restore documents positioning within the pane.

Original issue:
http://weblookandfeel.com/forum/viewtopic.php?f=4&t=203

@mgarin mgarin self-assigned this Sep 30, 2014
@mgarin mgarin modified the milestones: Enhancements, v1.29 Sep 30, 2014
mgarin added a commit that referenced this issue Oct 3, 2014
WebDocumentPane default settings processor added
WebDocumentPane tab menu improvements
WebTree default settings processor added
Proper Pair class XML aliases
@mgarin
Copy link
Owner Author

mgarin commented Oct 3, 2014

Starting with v1.29 it will be possible to save/restore WebDocumentPane state.

There are several options to do that, you can retrieve/set state manually:

final DocumentPaneState state = pane.getDocumentPaneState ();
pane.setDocumentPaneState ( state );

Or simply register your WebDocumentPane in SettingsManager, for example:

pane.registerSettings ( "DocumentPaneTest", "state" );

This will save your WebDocumentPane state in a separate settings group automatically on changes (unless that option - autosave on changes - is switched off). You can also force settings save action:

pane.saveSettings ();

Though that will work only if you have already registered your WebDocumentPane in SettingsManager.

One more important thing about this feature - in case you are restoring the state - you might want to have all documents be already opened at that moment or set DocumentDataProvider into your WebDocumentPane, otherwise state won't be able to restore document locations properly.

Here is an example how you can set DocumentDataProvider:

pane.setDocumentsProvider ( new DocumentDataProvider ()
{
    @Override
    public DocumentData provide ( final String documentId )
    {
        return new DocumentData ( documentId, ... );
    }
} );

Basically this provider can replace manual documents open process and will do that on its own. Though it is up to you to choose how you want to do that part.

All these changes are already available in sources and will be included in v1.29 release.

@mgarin mgarin added the solved label Oct 3, 2014
@mgarin mgarin closed this as completed Mar 15, 2015
@mgarin mgarin added this to Completed in v1.2.9 Nov 27, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
v1.2.9
Completed
Development

No branches or pull requests

1 participant