icon-not-found bug

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

icon-not-found bug

Felix Natter
Administrator
hi,

I fixed this issue [1] in icon-not-found branch:
  https://github.com/freeplane/freeplane/commit/068c5a08ad877742b7ddd8e17d1fcabac6b2d66a

The problem is that if you load a Freeplane map with user icon X and the
current installation does not have icon X, then it is replaced by a
"IconNotFound" (which is irreversible). So now I remember the original
icon name in "IconNotFound" so that it will be persisted.

But there are some questions:

- org.freeplane.features.icon.IconNotFound.createIconOrReturnNotFoundIcon(String):
  the current callers pass a file name and not an image name: Shall I
  pass addOn.getName() additionally so that I can do:
  new IconNotFound(addOnName)
  instead of:
  new IconNotFound("?")
  I guess it does not matter since no changed icons are persisted?

- Are there some corner cases with images in subdirectories (I tested
  with <fpuserdir>/icons/whatever.png) that I must test?

- org.freeplane.features.icon.factory.IconStoreFactory.setIconGroups(IconStore):
  Can somebody please tell me what icon groups are?
  Is that a representation of a compound icon consisting of several icons?

[1] http://sourceforge.net/p/freeplane/discussion/758437/thread/abeb56ea/

Cheers and Best Regards,
--
Felix Natter
Reply | Threaded
Open this post in threaded view
|

Re: icon-not-found bug

Dimitry Polivaev
Administrator
> - org.freeplane.features.icon.IconNotFound.createIconOrReturnNotFoundIcon(String):
>    the current callers pass a file name and not an image name: Shall I
>    pass addOn.getName() additionally so that I can do:
>    new IconNotFound(addOnName)
>    instead of:
>    new IconNotFound("?")
>    I guess it does not matter since no changed icons are persisted?

The question goes to @Volker :)

> - Are there some corner cases with images in subdirectories (I tested
>    with <fpuserdir>/icons/whatever.png) that I must test?

May be with <fpuserdir>/icons/dir/whatever.png ?


> - org.freeplane.features.icon.factory.IconStoreFactory.setIconGroups(IconStore):
>    Can somebody please tell me what icon groups are?
>    Is that a representation of a compound icon consisting of several icons?

Icon groups are used to group icons in the menu and optionally in the icon toolbar.

Cheers,
Dimitry


Reply | Threaded
Open this post in threaded view
|

Re: icon-not-found bug

Volker Börchers
Administrator
In reply to this post by Felix Natter
Hi Felix,

Am 15.10.2015 um 19:17 schrieb Felix Natter [via Freeplane Developer]:
> org.freeplane.features.icon.IconNotFound.createIconOrReturnNotFoundIcon(String):
>
>    the current callers pass a file name and not an image name: Shall I
>    pass addOn.getName() additionally so that I can do:
>    new IconNotFound(addOnName)
>    instead of:
>    new IconNotFound("?")
>    I guess it does not matter since no changed icons are persisted?

Add-on icons should be installed with the add-ons. If this fails (since
the add-on is incomplete) the only thing that matters is that the
IconNotFound icon is shown. The requested file path doesn't matter since
in opposite to normal icons they are not saved to a map (beside of rare
occasions you don't need to care about), so "?" is perfectly fine.

@Dimitry: IconNotFound.createIconOrReturnNotFoundIcon() is used as a
factory for MindIcons and although it is only used for add-ons it's
nonetheless not special to add-ons (if "?" is used as an argument to the
constructor). That's why I dislike renaming the method to
createAddonIconOrReturnNotFoundIcon(). (But I wouldn't fight for it :-))

> - Are there some corner cases with images in subdirectories (I tested
>    with <fpuserdir>/icons/whatever.png) that I must test?

I'm not sure since I struggled with MindIcon's simple mind a bit which
resulted in the change of MindIcon.createMindIcon() that allowed me to
create MindIcons for "../filenew.png" for the hyperlink-to-menu-item
feature (afaik). Also note that IconNotFound and MindIcon have different
image paths. But although storing the icon name wouldn't fit all
thinkable cases it would perhaps fit all cases you have to care about.

I think the only relevant use-case with add-ons for your fix would be a
map containing user icons from the [User
Icons](http://freeplane.sourceforge.net/wiki/index.php/Add-ons#User_Icons)
add-on. References to these icons should survive if you open such a map
in Freeplane without the User Icons add-on being installed. Could you
check that?

Regards,
Volker
Reply | Threaded
Open this post in threaded view
|

Re: icon-not-found bug

Felix Natter
Administrator
"Volker Börchers [via Freeplane Developer]"
<[hidden email]> writes:

> Hi Felix,
>
> Am 15.10.2015 um 19:17 schrieb Felix Natter [via Freeplane Developer]:
>> org.freeplane.features.icon.IconNotFound.createIconOrReturnNotFoundIcon
> (String):
>>
>> the current callers pass a file name and not an image name: Shall I
>> pass addOn.getName() additionally so that I can do:
>> new IconNotFound(addOnName)
>> instead of:
>> new IconNotFound("?")
>> I guess it does not matter since no changed icons are persisted?
>
> Add-on icons should be installed with the add-ons. If this fails (since
> the add-on is incomplete) the only thing that matters is that the
> IconNotFound icon is shown. The requested file path doesn't matter since
> in opposite to normal icons they are not saved to a map (beside of rare
> occasions you don't need to care about), so "?" is perfectly fine.
>
> @Dimitry: IconNotFound.createIconOrReturnNotFoundIcon() is used as a
> factory for MindIcons and although it is only used for add-ons it's
> nonetheless not special to add-ons (if "?" is used as an argument to the
> constructor). That's why I dislike renaming the method to
> createAddonIconOrReturnNotFoundIcon(). (But I wouldn't fight for it :-))
>
>> - Are there some corner cases with images in subdirectories (I tested
>> with <fpuserdir>/icons/whatever.png) that I must test?
>
> I'm not sure since I struggled with MindIcon's simple mind a bit which
> resulted in the change of MindIcon.createMindIcon() that allowed me to
> create MindIcons for "../filenew.png" for the hyperlink-to-menu-item
> feature (afaik). Also note that IconNotFound and MindIcon have different
> image paths. But although storing the icon name wouldn't fit all
> thinkable cases it would perhaps fit all cases you have to care about.
>
> I think the only relevant use-case with add-ons for your fix would be a
> map containing user icons from the [User
> Icons](http://freeplane.sourceforge.net/wiki/index.php/Add-ons#User_Icons)
> add-on. References to these icons should survive if you open such a map
> in Freeplane without the User Icons add-on being installed. Could you
> check that?

hi Volker,

unfortuntately, installing add-ons is broken on 1.4.x [1] (aka 1.6) (and
-U is broken on <1.6) so I will test this later (it should work) and
integrate the branch now.

[1]
STDERR: java.lang.NoClassDefFoundError: com/jgoodies/forms/layout/FormLayout
(OptionPanel)

I fixed this in freeplane_plugin_script/build.gradle, but then I get:

INFORMATION: installing add-on from file:/home/felix/src/userIcons-v1.1.addon.mm

STDOUT: message: startup failed:
Script1.groovy: 9: unable to resolve class groovy.swing.SwingBuilder
 @ line 9, column 1.
   import groovy.swing.SwingBuilder
   ^

1 error

Best Regards,
--
Felix Natter