Modifying freeplane popup menu dynamically

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Modifying freeplane popup menu dynamically

nsai
Good day,

I want to simulate a task execution environment using freeplane. Each node will be a task that can be decomposed into several sub tasks (child nodes). For a given task, several decomposition can exist. I have already written java classes that capture this behaviour.

What I want is that on right clicking on a node, the popup menu should contain a list of possible decompositions of the task contained in the node, and once a user choses one, the map is expanded by creating child nodes representing the decomposed tasks. The same process can then be applied to child nodes, and so on.

I have this question:
Is it possible to access and modify the freeplane popup menu dynamically, adding a menu entry with a dynamic submenu populated with the possible decompositions of the task contained in the current node? If yes can I have some tips please?

I read through freeplane documentation and saw that the menu and popup menu are managed using the mindmapmodmenu.xml and mindmapmodmenu.mm files. How can a groovy script be useful to me in manipulating these files?

Any idea will be of great help.
Thanks.
Reply | Threaded
Open this post in threaded view
|

Re: Modifying freeplane popup menu dynamically

Volker Börchers
Administrator
Hi,

you can change the context menu, see
http://freeplane.sourceforge.net/wiki/index.php/Menus_and_commands but I
don't know how difficult it is to change it dynamically. If you want to
do that make sure that you have a good development environment -
http://freeplane.sourceforge.net/wiki/index.php/Scripting_environment_setup 
- and start with MenuBuilder and MenuUtils. You have to register a
MouseListener. While this is possible with scripting you have to invoke
a script for that.

The easiest way to make scripts more accessible are keybindings. All
scripts are added to the menu and you can define keybindings for these
menu items. It's also very easy to implement dialogs in Groovy scripts
using the SwingBuilder (search for SwingBuilder on the Scripts
collection:
http://freeplane.sourceforge.net/wiki/index.php/Scripting:_Example_scripts).
As an alternative to changing the menu dynamically you could make the
dialog dynamic: It could offer only those actions which are appropriate
in the current context.

Regards,
Volker

Am 22.01.2015 um 13:03 schrieb nsai [via Freeplane Developer]:

> Good day,
>
> I want to simulate a task environment using freeplane. Each node will be
> a task that can be decomposed into several tasks (child nodes). There
> exist several ways of decomposing a task to several tasks. I have
> already written java classes that capture this behaviour.
>
> What I want is that on write clicking on a node, the popup menu should
> contain a list of possible decompositions of the task contained in the
> node, and once a user choses one, the map is expanded with child nodes
> representing the decomposed tasks. The same process can then be applied
> to child nodes, and so on.
>
> I am pretty new to freeplane and freeplane scripting. I have this question:
>
> Is it possible to access and modify the freeplane popup menu
> dynamically, adding a menu entry with a dynamic submenu populated with
> the subtasks of the task contained in the current node? If yes can I
> have some tips please?
>
> I read through freeplane documentation and saw that the menu is managed
> using the mindmapmodmenu.xml and mindmapmodmenu.mm files. How can a
> groovy script be useful to me in manipulating these files?
>
> Any idea will be of great help.
> Thanks.
>
>
> ------------------------------------------------------------------------
> If you reply to this email, your message will be added to the discussion
> below:
> http://freeplane-developer.996965.n3.nabble.com/Modifying-freeplane-popup-menu-dynamically-tp601.html
>
> To start a new topic under Freeplane Developer, email
> [hidden email]
> To unsubscribe from Freeplane Developer, click here
> <
> NAML
> <
http://freeplane-developer.996965.n3.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>
Reply | Threaded
Open this post in threaded view
|

Re: Modifying freeplane popup menu dynamically

nsai
Thank you Volker for the indications.
I'll set up my scripting environment and try it out.







On Sat, Jan 24, 2015 at 2:10 AM, Volker Börchers [via Freeplane Developer] <
ml-node+s996965n602h91@n3.nabble.com> wrote:

> Hi,
>
> you can change the context menu, see
> http://freeplane.sourceforge.net/wiki/index.php/Menus_and_commands but I
> don't know how difficult it is to change it dynamically. If you want to
> do that make sure that you have a good development environment -
> http://freeplane.sourceforge.net/wiki/index.php/Scripting_environment_setup
>
> - and start with MenuBuilder and MenuUtils. You have to register a
> MouseListener. While this is possible with scripting you have to invoke
> a script for that.
>
> The easiest way to make scripts more accessible are keybindings. All
> scripts are added to the menu and you can define keybindings for these
> menu items. It's also very easy to implement dialogs in Groovy scripts
> using the SwingBuilder (search for SwingBuilder on the Scripts
> collection:
> http://freeplane.sourceforge.net/wiki/index.php/Scripting:_Example_scripts).
>
> As an alternative to changing the menu dynamically you could make the
> dialog dynamic: It could offer only those actions which are appropriate
> in the current context.
>
> Regards,
> Volker
>
> Am 22.01.2015 um 13:03 schrieb nsai [via Freeplane Developer]:
>
> > Good day,
> >
> > I want to simulate a task environment using freeplane. Each node will be
> > a task that can be decomposed into several tasks (child nodes). There
> > exist several ways of decomposing a task to several tasks. I have
> > already written java classes that capture this behaviour.
> >
> > What I want is that on write clicking on a node, the popup menu should
> > contain a list of possible decompositions of the task contained in the
> > node, and once a user choses one, the map is expanded with child nodes
> > representing the decomposed tasks. The same process can then be applied
> > to child nodes, and so on.
> >
> > I am pretty new to freeplane and freeplane scripting. I have this
> question:
> >
> > Is it possible to access and modify the freeplane popup menu
> > dynamically, adding a menu entry with a dynamic submenu populated with
> > the subtasks of the task contained in the current node? If yes can I
> > have some tips please?
> >
> > I read through freeplane documentation and saw that the menu is managed
> > using the mindmapmodmenu.xml and mindmapmodmenu.mm files. How can a
> > groovy script be useful to me in manipulating these files?
> >
> > Any idea will be of great help.
> > Thanks.
> >
> >
> > ------------------------------------------------------------------------
> > If you reply to this email, your message will be added to the discussion
> > below:
> >
> http://freeplane-developer.996965.n3.nabble.com/Modifying-freeplane-popup-menu-dynamically-tp601.html
> >
> > To start a new topic under Freeplane Developer, email
> > [hidden email] <http:///user/SendEmail.jtp?type=node&node=602&i=0>
> > To unsubscribe from Freeplane Developer, click here
> > <
> > NAML
> > <
> http://freeplane-developer.996965.n3.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>
> >
>
>
> ------------------------------
>  If you reply to this email, your message will be added to the discussion
> below:
>
> http://freeplane-developer.996965.n3.nabble.com/Modifying-freeplane-popup-menu-dynamically-tp601p602.html
>  To unsubscribe from Modifying freeplane popup menu dynamically, click
> here
> <http://freeplane-developer.996965.n3.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=601&code=bnNhaXJvYmJ5QGdtYWlsLmNvbXw2MDF8MTEyNjQyNzMyNA==>
> .
> NAML
> <http://freeplane-developer.996965.n3.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>