Use a <wicket:remove> around an image tag that does link to the resource in either the original directory using a relative path (../../../../../../etc) or the package. I use that all the time :-)

Martijn

On 10/11/05, Johan Compagner <[EMAIL PROTECTED]> wrote:
please upgrade to the latest RC version of 1.1
You can only preview the page when you have the image in the org/foo/presentation/images dir yes?
Because if you don't have it there it is not previeable ..

can you use the constructor Image(String , ResourceReference)?
And then first make a PackageResourceReference to youre image that is in the above dir?

Because it seems that something goes wrong in this code:


LocalizedImageResource:
private void loadStaticImage(final String path)
    {
        MarkupContainer parent = component.findParentWithAssociatedMarkup();
        if (parent instanceof Border)
        {
            parent = parent.getParent();
        }
        final Class scope = parent.getClass();
        this.resourceReference = new ResourceReference(scope, path)
        {
            private static final long serialVersionUID = 1L;
           
            /**
             * @see wicket.ResourceReference#newResource()
             */
            protected Resource newResource()
            {
                PackageResource pr = PackageResource.get(getScope(), getName(), LocalizedImageResource.this.locale, style);
                locale = pr.getLocale();
                return pr;
            }
        };
        resourceReference.setLocale(locale);
        resourceReference.setStyle(style);
        bind();
    }

I think the scope or something is not calculated right (can you debug through that method)?

or course if you want to have the image in "webapps/portal/images" then please remove the Image:
add(new Image("deleteImage", "images/delete.gif"))

completely from youre code and set that images/delete.gif directly as the src attribute of youre img.



On 10/10/05, Francis Amanfo <[EMAIL PROTECTED] > wrote:
Right, I'm having the image in the webapps/portal/images directory where portal is my application's context. And also having it in
org/foo/presentation/images but both don't work. The strange part is that previewing the panel in my development environment displays the image fine but only after wicket renders does it disappear. I also tried to move the panel markup to my application root but still no image was displayed. I could however preview with the image before wicket renders.
I'm using wicket 1.1b.

Francis




On 10/10/05, Johan Compagner <[EMAIL PROTECTED] > wrote:
first which version of wicket are you using?
And where is the image "images/delete.gif" exactly?
is in in the webapp root?
so yes then you don't need a wicket tag for that and it should work out of the box
Looking at youre tag:

/portal/app/resources/org.foo.presentation.PSBreadCrumbsPanel/images/delete_en_US.gif

i expect to have the image in the package:

org.foo.presentation.images (

org/foo/presentation/images)


so what is the case?



On 10/10/05, Phil Kulak <


[EMAIL PROTECTED]
> wrote:
> Images in Wicket are bit tricky. If you didn't want to use
> ResourceReferences, you could do something like this:
>
> AttributeModifier src = "" AttributeModifier("src", true, new Model() {
>    @Override
>    public Object getObject(Component component) {
>       // Do some logic and return a string...
>    }
> }
>
> add(new WebMarkupContainer("image").add(src));
>
> Otherwise, I usually just put the dynamic images in the package, then
> create static resource references to them:
>
> public static final ResourceReference ERROR_IMG =
>                 new PackageResourceReference(MyClass.class, "error.gif");
>
> and use those in the image:
>
> add(new Image("image") {
>         @Override
>         public ResourceReference getImageResourceReference() {
>                 if (anyMessage(FeedbackMessage.ERROR)) {
>                         return ERROR_IMG;
>                 }
>                 return INFORMATION_IMG;
>         }
> });
>
> On 10/10/05, Francis Amanfo < [EMAIL PROTECTED] > wrote:
> > I'm adding the image dynamically based on a condition. I can't see why this
> > shouldn't work. The images directory are located in the application root.
> > Tried also to put it in the presentation package but didn't work. Whats the
> > solution then?
> >
> >
> >
> > On 10/10/05, Phil Kulak <[EMAIL PROTECTED] > wrote:
> > >
> > > Do you have a resource reference named "images/delete.gif"? Because if
> > > you're just trying to make a static link to a static image, there's no
> > > need to get Wicket involved:
> > >
> > > <img src="" type="image" width="12" height="12"
> > > alt="[Delete]" border="0" valign="middle" />
> > >
> > > On 10/10/05, Francis Amanfo < [EMAIL PROTECTED] > wrote:
> > > > Hi,
> > > >
> > > >  I have a Panel whose markup contains:
> > > >
> > > >  <img src="" type="image" wicket:id="deleteImage"
> > > > width="12" height="12" alt="[Delete]" border="0" valign="middle" />
> > > >
> > > >  The markup is located in package org.foo.presentation
> > > >  In my panel class located in the same package as the markup I do:
> > > >
> > > >  add(new Image("deleteImage", "images/delete.gif"))
> > > >
> > > >  The problem is the image doesn't get dsiplayed. Viewing the source html
> > in
> > > > my browser I see:
> > > >
> > > >  <img width="12" height=
> > > > "12" type="image" wicket:id="deleteImage"
> > > > valign="middle" border="0"
> > > >
> > src=""
> > > > alt="[Delete]"
> > > > />
> > > >
> > > >  I don't get it. Any help?
> > > >
> > > >  Francis
> > > >
> > >
> > >
> > > -------------------------------------------------------
> > > This SF.Net email is sponsored by:
> > > Power Architecture Resource Center: Free content, downloads, discussions,
> > > and more. http://solutions.newsforge.com/ibmarch.tmpl
> > > _______________________________________________
> > > Wicket-user mailing list
> > > Wicket-user@lists.sourceforge.net
> > > https://lists.sourceforge.net/lists/listinfo/wicket-user
> > >
> >
> >
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by:
> Power Architecture Resource Center: Free content, downloads, discussions,
> and more. http://solutions.newsforge.com/ibmarch.tmpl
> _______________________________________________
> Wicket-user mailing list
> Wicket-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wicket-user
>


-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user




Reply via email to