Opposite Filter (Scripting help needed)

Opposite Filter (Scripting help needed)

Postby edo_f » Thu Apr 03, 2014 1:37 pm

Hi
in the "Freeplane NEW FEATURES LIST +++ PLEASE" topic I mentioned that a Opposite Filtering option would be something useful.
I tried the "NOT" operator but couldn't get the results that I want, when doing that I discovered there was a "Script filter" functionality. Wow! Terrific! (I use Freeplane everyday and didn't know it exists. How many other hidden diamonds are there?)
I'm not really good with java or groovy. I am trying to use this feature to have the filters I need but need some Help from the community to get this working.

The problem to be solved:
I have maps with nodes with two userdefined styles: "Pending Tasks" and "Finalized Tasks"
nodes with "Pending Tasks" style have the "unchecked" icon and a yellow background
nodes with "Finalized Tasks" style have the "checked" icon and a grey background

I want to filter the map just to show the pendigs tasks with their children but not to show the finalized tasks and their children. The problem is that pending tasks can have finalizad tasks as children.

For example:
Image


The branches I want to hide with the filter (in red)
Image

So after the filter I can see this:
Image

As first step I want to hide all nodes that have the "Finalized Task" Style or are descendant of one that it has it.
I was trying to make a script to recognize this condition.

I am able to recognize the ascendants form a node and to see if they have this style as a List.

Image

Scripts:
Asc_Val =c.find{ node.isDescendantOf( it )}.value
Asc_TF? =c.find{ node.isDescendantOf( it )}.collect {it.hasStyle("Tarea finalizada")}



but to have a valid boolean result For the Script Filter i need to apply an "OR" operator to the Asc_FT? list and a "NOT" afterwards and I don't know how to do it.
something like this:

[False,False,True,False,False] ---"or"---> True -----"not"---> False <--- So the filter knows this node is not to be shown.


Please help!

Thanks in advance

Edo F
edo_f
 
Posts: 13
Joined: Fri May 11, 2012 7:21 pm

Re: Opposite Filter (Scripting help needed)

Postby edo_f » Fri Apr 04, 2014 2:01 pm

Got it!
(ok, just the first step)

script for the filter:
! c.find{ node.isDescendantOf( it )}.collect {it.hasStyle("Tarea finalizada")}.contains(true)
edo_f
 
Posts: 13
Joined: Fri May 11, 2012 7:21 pm

Re: Opposite Filter (Scripting help needed)

Postby edo_f » Fri Apr 04, 2014 2:29 pm

2nd step:
create another script filter:
c.find{ node.isDescendantOf( it )}.collect {it.hasStyle("Pending Task")}.contains(true)

3rd step:
combine both filters with the "And" operation in Filters editing Dialog

Listo!

now I have a filter optiopn which shows me all the pending tasks without the finalized ones!

Hope this can help others.

bye

Edo_F
edo_f
 
Posts: 13
Joined: Fri May 11, 2012 7:21 pm


Return to Open Discussion

Who is online

Users browsing this forum: No registered users and 1 guest

cron