Hi Dan!
Yes, that's the reason why I wanted to be able to display icons.
Good to know, that my patch might be ok. :-)
Christian
________________________________________
From: Dan Haywood [[email protected]]
Sent: Thursday, February 14, 2013 2:41 PM
To: [email protected]
Subject: Re: iconName()
Actually, that might well be all there is to it. Since it's only cosmetic,
it's not the riskiest of patches.
While on the topic... (and perhaps you've thought of this yourself), a nice
thing to do with instance-specific icons is to create a family of icons
that have overlays based on some important state (or status) of the object.
That way the user can see at a glance which orders have been shipped, for
example.
Dan
On 14 February 2013 13:35, Christian Steinebach <
[email protected]> wrote:
> Hi Dan,
>
> I changed ImageCacheClassPath and so far it seems to work.
> But maybe I introduced a hell of a mess another place, will see. ;-)
>
> Christian
>
>
>
> public class ImageCacheClassPath implements ImageResourceCache {
>
> private static final List<String> IMAGE_SUFFICES =
> Arrays.asList("png", "gif", "jpeg", "jpg");
> private static final String FALLBACK_IMAGE = "Default.png";
>
> private final Map<ObjectSpecification, ResourceReference>
> resourceReferenceBySpec = Maps.newHashMap();
>
>
> @Override
> public ResourceReference resourceReferenceFor(ObjectAdapter adapter) {
> // my patch
> if (adapter.getIconName() != null)
> return resourceReferenceFor(adapter.getIconName());
> // end my patch
> return resourceReferenceFor(adapter.getSpecification());
> }
>
>
>
>
>
>
>
>
>
>
>
>
>
> ________________________________________
> From: Dan Haywood [[email protected]]
> Sent: Thursday, February 14, 2013 2:12 PM
> To: [email protected]
> Subject: Re: iconName()
>
> Hi Christian,
>
> This isn't quite the way that Isis works.
>
> Instead, we have what are called FacetFactorys, and a collection of these
> are registered to constitute the programming model - see
> ProgrammingModelFacetsJava5.
>
> The icon is determined by the IconFacet, that is attached to the
> ObjectSpecification (cf java.lang.Class) in the metamodel.
>
> So what the viewers do is they (should) search for IconFacet and if present
> call it. Since this is a common operation, there is actually a helper
> method getIconName() on ObjectAdapter (cf java.lang.Object). And indeed,
> the html, dnd and scimpi viewers are calling ObjectAdapter.getIconName(),
> while the wicket viewer does not.
>
> Was just looking at my list of things I need to address... I'm afraid this
> one is quite far down the list. You're very welcome, of course, to cobble
> together a patch if you wish :-) I have found that this stuff is somewhat
> fiddly, so don't feel compelled to.
>
> Cheers
> Dan
> ~~~~~~
>
> On 14 February 2013 12:32, Christian Steinebach <
> [email protected]> wrote:
>
> > Hi again,
> >
> > Just did a search for iconName in isis/component/viewer (pulled the
> latest
> > from github)
> > There are no files containing the string iconName in the wicket module
> > but several files in the html, dnd and scimpi module do
> > Probably iconName() is not implemented in the wicket viewer.
> >
> > Christian
> >
> >
> > ________________________________________
> > From: Christian Steinebach [[email protected]]
> > Sent: Thursday, February 14, 2013 12:58 PM
> > To: [email protected]
> > Subject: RE: iconName()
> >
> > Hi Dan
> >
> > https://issues.apache.org/jira/browse/ISIS-334
> >
> > Christian
> >
> > ________________________________________
> > From: Dan Haywood [[email protected]]
> > Sent: Thursday, February 14, 2013 12:17 PM
> > To: [email protected]
> > Subject: Re: iconName()
> >
> > Hi Christian,
> > Could you raise a ticket on that? there's a reasonable chance that this
> > doesn't work correctly yet...it's not a feature that Jeroen and I have
> used
> > in our app.
> >
> > Still, I think that the Wicket viewer should support it, as described.
> >
> > Thx
> > Dan
> >
> >
> > On 14 February 2013 11:11, Christian Steinebach <
> > [email protected]> wrote:
> >
> > > Hi
> > >
> > > I understood that the method iconName() should return a String
> > > which is the name of an image file in dom/src/main/resources/images.
> > > I inserted the method into ToDoItem.java but still the default
> > > ToDoItem.gif icon is
> > > shown in the wicket viewer.
> > >
> > > I inserted
> > > public String iconName(){
> > > return "SomeIcon";
> > > }
> > >
> > > into ToDoItem.java
> > >
> > > but iconName() is never called
> > >
> > > Christian
> > >
> >
>