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

Save functions missing? #2

Open
ghost opened this issue Apr 8, 2015 · 3 comments
Open

Save functions missing? #2

ghost opened this issue Apr 8, 2015 · 3 comments

Comments

@ghost
Copy link

ghost commented Apr 8, 2015

Hi There

I would like to use this whiteboard and whilst I have it working it seems to be missing the save, undo features shown

https://github.com/wicketstuff/core/wiki/Whiteboard

Can you tell me how I can add these in?

THanks

Jason

@bay73
Copy link
Owner

bay73 commented Apr 8, 2015

Hi Jason,

You can easily add buttons to toolbar using 
whiteboard.addTool( id , groupId , actions , order , label) method:

whiteboard.addTool('save', 'tools', {action: actionFunction}, 10, 'Save')

You can place new buttons to the 'tools' group (where zoom-in, zoom-out and so on already placed) or create new group using whiteboard.addGroup ( id , order , label ) method.

For save operation action function can look like :

actionFunction = function(board){
  var boardData =  board.collections.main. jsonCode();
  // here you can save the data where you want
  // to restore you should call board .collections.main.parseJson(baordData);
}

For undo it's a bit more painful. You should add listener for collections.main.onChange event, save board data somewhere and restore it when user click undo.

Regards,
Andrey

Среда, 8 апреля 2015, 3:36 -07:00 от jasonhayhurst notifications@github.com:

Hi There
I would like to use this whiteboard and whilst I have it working it seems to be missing the save, undo features shown
https://github.com/wicketstuff/core/wiki/Whiteboard
Can you tell me how I can add these in?
THanks
Jason

Reply to this email directly or view it on GitHub .

@ghost
Copy link
Author

ghost commented Apr 8, 2015

Hi Andrey

Thanks for the reply. I have located an uncomressed later version of the whiteboard
https://github.com/wicketstuff/core/tree/master/jdk-1.7-parent/whiteboard-parent/whiteboard/src/main/resources/org/wicketstuff/whiteboard/resource

This has the icon images etc for save undo and yet it doesn’t have the code for the save file. Do you know why that was not included?

Also have you any example code for saving within the function?

Thanks Again,

Jason

From: Andrey Bogdanov <notifications@github.commailto:notifications@github.com>
Reply-To: bay73/whiteboard <reply@reply.github.commailto:reply@reply.github.com>
Date: Wednesday, 8 April 2015 12:20
To: bay73/whiteboard <whiteboard@noreply.github.commailto:whiteboard@noreply.github.com>
Cc: Jason Hayhurst <j.hayhurst@hull.ac.ukmailto:j.hayhurst@hull.ac.uk>
Subject: Re: [whiteboard] Save functions missing? (#2)

Hi Jason,

You can easily add buttons to toolbar using
whiteboard.addTool( id , groupId , actions , order , label) method:

whiteboard.addTool('save', 'tools', {action: actionFunction}, 10, 'Save')

You can place new buttons to the 'tools' group (where zoom-in, zoom-out and so on already placed) or create new group using whiteboard.addGroup ( id , order , label ) method.

For save operation action function can look like :

actionFunction = function(board){
var boardData = board.collections.main. jsonCode();
// here you can save the data where you want
// to restore you should call board .collections.main.parseJson(baordData);
}

For undo it's a bit more painful. You should add listener for collections.main.onChange event, save board data somewhere and restore it when user click undo.

Regards,
Andrey

Ñðåäà, 8 àïðåëÿ 2015, 3:36 -07:00 îò jasonhayhurst <notifications@github.commailto:notifications@github.com>:

Hi There
I would like to use this whiteboard and whilst I have it working it seems to be missing the save, undo features shown
https://github.com/wicketstuff/core/wiki/Whiteboard
Can you tell me how I can add these in?
THanks
Jason

Reply to this email directly or view it on GitHub .


Reply to this email directly or view it on GitHubhttps://github.com//issues/2#issuecomment-90883084.


To view the terms under which this email is
distributed, please go to
http://www2.hull.ac.uk/legal/disclaimer.aspx


@bay73
Copy link
Owner

bay73 commented Apr 8, 2015

This has the icon images etc for save undo and yet it doesn’t have the code for the save file. Do you know why that was not included?

Wicket integration for whiteboard was made by Andun Gunawardana and these functionality (saving, undo) was added be him. Unfortunately I don't know the details of this. I made only javascript library which doesn't work directly with any external components.

Also have you any example code for saving within the function?
I don't have such code. It depends on where you want to save the data. Whiteboard works inside browser and standard sandbox policy doesn't allow to write to local file directly. So you should either send data to server (using Ajax, Websocket and so on) or use FileSystem API. As example whiteboard has special shortcut (Ctrl+J) which activate window where you can see the text data. It is possible to copy and past it there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant