Link to static image from packaged css
Hello, there seems to be some difficulty linking between static and packages resources, or at least a lot of confusion in forums ;-) If I refer to a static css from a wicket:link or wicket:head, the link will be "relativized" automatically, right ? However, I do have a CSS that is specific to a special page, and thus I have page .html, .css and .js for this special page side-by-side packed and included via CssResourceReference and JavaScriptResourceReference. Now, inside my .css, I have a background: url('img/formbg.png') no-repeat; but the resource is not found. using "/" prefix will tie me to a context prefix using several "../" will work but certainly isn't very professional or stable. What's the best idea here ? Cheers, Tom. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Static image
> Here is the source of > org.apache.wicket.markup.html.image.Image#getStatelessHint() > { > return (getImageResource() == null || getImageResource() == > localizedImageResource.getResource()) && > localizedImageResource.isStateless(); > } > > I.e. if the image uses a IResource then it is stateful because the url to > the IResource is dependent on the component (e.g. > ?2-IResourceListener-container~image). > If you use ResourceReference then the url to reach it doesn't depend on > the > page/component (e.g. wicket/resource/). > > As Andrea mentioned you can use ContextImage which also doesn't use > IResource and the generated url doesn't depend on the page/component. > I think this is the most helpful reply. A static image will be linked successfully this way. Thanks for the nice sharing. It helps a lot. - Best Regards, Arron | Image Processing SDK | Next Tomorrow is Another Day. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Static-image-tp4655192p4659931.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Static image
The context image looks nice, but I cannot use it in a ClientSideImageMap - is that on purpose? For now UrlResourceReference serves my purpose. Thank you for helping On 8 January 2013 09:09, Martin Grigorov wrote: > Hi, > > Here is the source of > org.apache.wicket.markup.html.image.Image#getStatelessHint() > { > return (getImageResource() == null || getImageResource() == > localizedImageResource.getResource()) && > localizedImageResource.isStateless(); > } > > I.e. if the image uses a IResource then it is stateful because the url to > the IResource is dependent on the component (e.g. > ?2-IResourceListener-container~image). > If you use ResourceReference then the url to reach it doesn't depend on the > page/component (e.g. wicket/resource/). > > As Andrea mentioned you can use ContextImage which also doesn't use > IResource and the generated url doesn't depend on the page/component. > > > On Tue, Jan 8, 2013 at 12:30 AM, René Vangsgaard > wrote: > > > Hi - I would like to link to a static image, and the link should be > > stateless. > > > > I have tried this (using Scala): > > > > val img = new Image("img", new ContextRelativeResource("images/img" + > imgId > > + ".png")) > > > > But the link becomes stateful. > > > > I just found > > > > val img = new Image("img", new UrlResourceReference(new > Url(listOfStrings, > > Charset.defaultCharset( > > > > Is the last example the preferred way of achieving this? > > > > Thanks in advance, > > René > > > > > > -- > Martin Grigorov > jWeekend > Training, Consulting, Development > http://jWeekend.com <http://jweekend.com/> >
Re: Static image
Hi, Here is the source of org.apache.wicket.markup.html.image.Image#getStatelessHint() { return (getImageResource() == null || getImageResource() == localizedImageResource.getResource()) && localizedImageResource.isStateless(); } I.e. if the image uses a IResource then it is stateful because the url to the IResource is dependent on the component (e.g. ?2-IResourceListener-container~image). If you use ResourceReference then the url to reach it doesn't depend on the page/component (e.g. wicket/resource/). As Andrea mentioned you can use ContextImage which also doesn't use IResource and the generated url doesn't depend on the page/component. On Tue, Jan 8, 2013 at 12:30 AM, René Vangsgaard wrote: > Hi - I would like to link to a static image, and the link should be > stateless. > > I have tried this (using Scala): > > val img = new Image("img", new ContextRelativeResource("images/img" + imgId > + ".png")) > > But the link becomes stateful. > > I just found > > val img = new Image("img", new UrlResourceReference(new Url(listOfStrings, > Charset.defaultCharset( > > Is the last example the preferred way of achieving this? > > Thanks in advance, > René > -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com <http://jweekend.com/>
Re: Static image
Have you tried with ContextImage? Hi - I would like to link to a static image, and the link should be stateless. I have tried this (using Scala): val img = new Image("img", new ContextRelativeResource("images/img" + imgId + ".png")) But the link becomes stateful. I just found val img = new Image("img", new UrlResourceReference(new Url(listOfStrings, Charset.defaultCharset( Is the last example the preferred way of achieving this? Thanks in advance, René -- Andrea Del Bene Abaco Informatica S.r.l. Via Montegrappa, 3 61121 Pesaro (IT) Tel. +39 0721 35425 Fax. +39 0721 32967 P.IVA 00933130411 Associato AssoProvider CISCO Systems Partner PREMIER Certified ABANET is associated to RIPE (AS 12468) Http://www.abanet.it Questa é una email privata ad uso confidenziale; é proibito ogni uso non autorizzato. This message is confidential; any unauthorised use is forbidden. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Static image
Hi - I would like to link to a static image, and the link should be stateless. I have tried this (using Scala): val img = new Image("img", new ContextRelativeResource("images/img" + imgId + ".png")) But the link becomes stateful. I just found val img = new Image("img", new UrlResourceReference(new Url(listOfStrings, Charset.defaultCharset( Is the last example the preferred way of achieving this? Thanks in advance, René
Re: recommended static image/resource strategy
My issue appears to be not new... https://issues.apache.org/jira/browse/WICKET-1889 https://issues.apache.org/jira/browse/WICKET-1700 But the fix is for v1.4.x not v1.3.6 -- View this message in context: http://www.nabble.com/recommended-static-image-resource-strategy-tp24407111p24415044.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: recommended static image/resource strategy
My issue appears to be not new... https://issues.apache.org/jira/browse/WICKET-1889 https://issues.apache.org/jira/browse/WICKET-1700 But this only applies to v1.4. -- View this message in context: http://www.nabble.com/recommended-static-image-resource-strategy-tp24407111p24415043.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: recommended static image/resource strategy
I have added a quick start to exemplifies the issue at hand. Please see https://issues.apache.org/jira/browse/WICKET-2361 for those that are interested. Thanks -- View this message in context: http://www.nabble.com/recommended-static-image-resource-strategy-tp24407111p24413328.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: recommended static image/resource strategy
Thank Igor. Bug report has been created (WICKET-2361) Note: I was able to "work around" this issue by using QueryStringUrlCodingStrategy instead of the BookmarkablePageRequestTargetUrlCodingStrategy via the WebApplication.mountBookmarkablePage() method. From: Igor Vaynberg To: users@wicket.apache.org; Doug Leeper Sent: Thursday, July 9, 2009 10:13:05 AM Subject: Re: recommended static image/resource strategy it seems like a bug in ServletWebRequest#getRelativePathPrefixToWicketHandler(), you might want to subclass that, check for those two params in the url, and add an additional ../.. as a hack for right now. also open a jira issue for us to fix it. -igor On Wed, Jul 8, 2009 at 2:46 PM, Doug Leeper wrote: > Our app has been working great this past year but we recently encountered a > strange behavior and wanted to get the communities input on how to proceed. > > Background: > >* Wicket 1.3.6 >* JDK 1.5 >* Jetty (dev) / Apache and Tomcat (prod) >* The URL to our app follows this structure http://mydomain.com/APP > where APP is the web app name. >* We have our img src tags in our HTML utilize relative pathing, i.e. > "images/check.gif". >* Our images are contained in our web app off the root webapp > directory, i.e. "images". >* Some of our pages are bookmarkable utilizing > BookmarkablePageRequestTargetUrlCodingStrategy. >* We have turned on > getPageSettings().setAutomaticMultiWindowSupport(true) in our > Application.init() method >* FireFox 3.5 (is where we are seeing the odd behavior) > The recent change was the bookmarkable pages to produce "pretty URL's" such > as http://localhost:8080/APP/myPage.html. However, we have noticed that in > some cases, i.e. open link in new tab, the bookmarkable page URL changes to > http://localhost:8080/APP/myPage.html/wicket:pageMapName/wicket-1/. The > problem we are having now is that our images are not showing up. Viewing the > source the img src shows "images/check.gif" still. > > > I understand that our URL path has changed and that is why the gif does not > show up. But what is the best approach in handling static images/resources > and with our current configuration. Should we do one or more of the > following? > > >1. Don't use setAutomaticMultiWindowSupport (we really want this > feature so back button works as expected when new browser tab or window is > opened) > >2. Use absolute path for images (FYI...we want our war to be a single > deployable unit which includes the images...by doing this, would it require > the static information (images/css/js) to be deployed differently/separately? >3. Use a different mounted resource strategy? If so, which one? > BTW...no page parameters are needed on the mounted pages in question (they > can be ignored) > >4. Have all static resources be "wicketized" by using an resource > strategy, i.e. ContextRelativeResource. (this would require a lot of code > changes...not ideal) >5. Other???Thanks in advance, > - Doug > > BTW...My gut is pointing to #3 is the solution.
Re: recommended static image/resource strategy
it seems like a bug in ServletWebRequest#getRelativePathPrefixToWicketHandler(), you might want to subclass that, check for those two params in the url, and add an additional ../.. as a hack for right now. also open a jira issue for us to fix it. -igor On Wed, Jul 8, 2009 at 2:46 PM, Doug Leeper wrote: > Our app has been working great this past year but we recently encountered a > strange behavior and wanted to get the communities input on how to proceed. > > Background: > > * Wicket 1.3.6 > * JDK 1.5 > * Jetty (dev) / Apache and Tomcat (prod) > * The URL to our app follows this structure http://mydomain.com/APP > where APP is the web app name. > * We have our img src tags in our HTML utilize relative pathing, i.e. > "images/check.gif". > * Our images are contained in our web app off the root webapp > directory, i.e. "images". > * Some of our pages are bookmarkable utilizing > BookmarkablePageRequestTargetUrlCodingStrategy. > * We have turned on > getPageSettings().setAutomaticMultiWindowSupport(true) in our > Application.init() method > * FireFox 3.5 (is where we are seeing the odd behavior) > The recent change was the bookmarkable pages to produce "pretty URL's" such > as http://localhost:8080/APP/myPage.html. However, we have noticed that in > some cases, i.e. open link in new tab, the bookmarkable page URL changes to > http://localhost:8080/APP/myPage.html/wicket:pageMapName/wicket-1/. The > problem we are having now is that our images are not showing up. Viewing the > source the img src shows "images/check.gif" still. > > > I understand that our URL path has changed and that is why the gif does not > show up. But what is the best approach in handling static images/resources > and with our current configuration. Should we do one or more of the > following? > > > 1. Don't use setAutomaticMultiWindowSupport (we really want this > feature so back button works as expected when new browser tab or window is > opened) > > 2. Use absolute path for images (FYI...we want our war to be a single > deployable unit which includes the images...by doing this, would it require > the static information (images/css/js) to be deployed differently/separately? > 3. Use a different mounted resource strategy? If so, which one? > BTW...no page parameters are needed on the mounted pages in question (they > can be ignored) > > 4. Have all static resources be "wicketized" by using an resource > strategy, i.e. ContextRelativeResource. (this would require a lot of code > changes...not ideal) > 5. Other???Thanks in advance, > - Doug > > BTW...My gut is pointing to #3 is the solution. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
recommended static image/resource strategy
Our app has been working great this past year but we recently encountered a strange behavior and wanted to get the communities input on how to proceed. Background: * Wicket 1.3.6 * JDK 1.5 * Jetty (dev) / Apache and Tomcat (prod) * The URL to our app follows this structure http://mydomain.com/APP where APP is the web app name. * We have our img src tags in our HTML utilize relative pathing, i.e. "images/check.gif". * Our images are contained in our web app off the root webapp directory, i.e. "images". * Some of our pages are bookmarkable utilizing BookmarkablePageRequestTargetUrlCodingStrategy. * We have turned on getPageSettings().setAutomaticMultiWindowSupport(true) in our Application.init() method * FireFox 3.5 (is where we are seeing the odd behavior) The recent change was the bookmarkable pages to produce "pretty URL's" such as http://localhost:8080/APP/myPage.html. However, we have noticed that in some cases, i.e. open link in new tab, the bookmarkable page URL changes to http://localhost:8080/APP/myPage.html/wicket:pageMapName/wicket-1/. The problem we are having now is that our images are not showing up. Viewing the source the img src shows "images/check.gif" still. I understand that our URL path has changed and that is why the gif does not show up. But what is the best approach in handling static images/resources and with our current configuration. Should we do one or more of the following? 1. Don't use setAutomaticMultiWindowSupport (we really want this feature so back button works as expected when new browser tab or window is opened) 2. Use absolute path for images (FYI...we want our war to be a single deployable unit which includes the images...by doing this, would it require the static information (images/css/js) to be deployed differently/separately? 3. Use a different mounted resource strategy? If so, which one? BTW...no page parameters are needed on the mounted pages in question (they can be ignored) 4. Have all static resources be "wicketized" by using an resource strategy, i.e. ContextRelativeResource. (this would require a lot of code changes...not ideal) 5. Other???Thanks in advance, - Doug BTW...My gut is pointing to #3 is the solution.
RE: Using a static image map
Martijn C. Vos wrote: > > [...] > Ofcourse if the ImageMap's areas are completely static, you may > want to keep the shape and coordinates of the links outside the > Wicket code and only in the html, so I'm kinda wondering if it > would be possible to keep the map outside Wicket, and simply > give each area a wicket:id corresponding to a Link in your > Wicket code. > > No idea if that would work (the ImageMap is kinda old and rarely > used), but that's what I'd try. > [...] > Well, Martijn, I've tried and it actually works... :-) It's a very clean solution so I'll left a code snippet here just in case someone else needs to solve the same problem: In the HTML file: Basic Business Process (BPMN) In the Java class: // Links to the elements of the image map... add(new PageLink("module-01", Module01.class)); add(new PageLink("module-02", Module02.class)); Thanks for your help, Cristina -- View this message in context: http://www.nabble.com/Using-a-static-image-map-tp16656656p16738785.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Using a static image map
Cristina wrote: > Hello, > > I've defined a simple HTML image map from a business process diagram: > > > > > href="Module01.html" title="Subprocess 1" /> > href="Module02.html" title="Subprocess 2" /> > href="Module03.html" title="Subprocess 3" /> > > Basic Business Process (BPMN) > > > Now I would like to enable this image map within Wicket... > I've found out the ImageMap class in the API javadoc but I > don't see how I should combine it with the above HTML. What exactly is it that you want to enable about this in Wicket? Do you want the areas to remain static, and only the links to become Wicket links? As far as I can tell, the standard Wicket ImageMap lets you add areas (called ShapeLinks) to an ImageMap, and each ShapeLink has a shape (rect, circle, polygon), coordinates, and a Link. Ofcourse if the ImageMap's areas are completely static, you may want to keep the shape and coordinates of the links outside the Wicket code and only in the html, so I'm kinda wondering if it would be possible to keep the map outside Wicket, and simply give each area a wicket:id corresponding to a Link in your Wicket code. No idea if that would work (the ImageMap is kinda old and rarely used), but that's what I'd try. Otherwise, simply use the ImageMap the way it's written (which is a bit odd, I admit): give a static a wicket:id corresponding to an ImageMap, and add ShapeLinks (with shape, coords and Link) to that ImageMap. That should work. (It's probably a good idea to take my advice with a grain of salt; I'm still very new to Wicket myself. My own problem with the ImageMap is that it's not dynamic enough, instead of too dynamic.) mcv. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Using a static image map
Hello, I've defined a simple HTML image map from a business process diagram: Basic Business Process (BPMN) Now I would like to enable this image map within Wicket... I've found out the ImageMap class in the API javadoc but I don't see how I should combine it with the above HTML. Could someone please provide an example or point me to some sample code? I've looked for an example among the existing ones but I haven't found any related to this situation. Thanks so much, Cristina -- View this message in context: http://www.nabble.com/Using-a-static-image-map-tp16656656p16656656.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]