dynamic crumb trail
I have a default template page that contains a ul implementation of a crumb trail. Therefore, the base class template has both the open and close tags of the list element. A few links in the crumb trail are manage by the template class - but I'd like to be able to add a few from the child pages. I've tried passing a list of 'response' Pages and labels from the child to the parent but some of the page need to be instantiated and passed arguments and I end up instantiating response pages before the user ever clicks on a link. Can someone chime in with a more elegant approach to this? I feel like I'm going down a rabbit hole. I guess I could simply create a panel - but then I'd need to get links from two places ... Thanks, -Luther
Error integrating with Hibernate and Spring
I'm sure I'm doing something incorrectly. For the most part, I copied the Spring config file from http://wicketinaction.com/2009/06/wicketspringhibernate-configuration/ but upon startup, I'm getting the following error. Specifically, I can't find where the listener type [wicketApplication] is implemented/exists/read ... Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [com/fuzzybearings/projx/config/spring.sb.xml]: Invocation of init method failed; nested exception is org.hibernate.MappingException: Unrecognized listener type [wicketApplication] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1412) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190) at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:322) ... 51 more Both jetty:run and tomcat:run do this. Thanks in advance for any suggestions, -Luther Here is the actual config I am using: ?xml version=1.0 encoding=UTF-8? beans default-autowire=autodetect xmlns=http://www.springframework.org/schema/beans; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; xmlns:aop=http://www.springframework.org/schema/aop; xmlns:tx=http://www.springframework.org/schema/tx; xmlns:context=http://www.springframework.org/schema/context; xsi:schemaLocation=http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd; bean id=wicketApplication class=com.fuzzybearings.projx.WicketApplication / bean id=placeholderConfigurer class=org.springframework.beans.factory.config.PropertyPlaceholderConfigurer property name=ignoreUnresolvablePlaceholders value=false / property name=systemPropertiesModeName value=SYSTEM_PROPERTIES_MODE_OVERRIDE / property name=ignoreResourceNotFound value=false / property name=locations list valueclasspath:/com/fuzzybearings/projx/config/application.properties/value /list /property /bean bean id=dataSource class=org.apache.commons.dbcp.BasicDataSource property name=driverClassName value${jdbc.driver}/value /property property name=url value${jdbc.url}/value /property property name=username value${jdbc.username}/value /property property name=password value${jdbc.password}/value /property /bean tx:annotation-driven transaction-manager=txManager / !-- hibernate session factory -- bean id=sessionFactory class=org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean property name=dataSource ref=dataSource / property name=hibernateProperties props prop key=hibernate.hbm2ddl.auto${hibernate.ddl}/prop prop key=hibernate.dialect${hibernate.dialect}/prop prop key=hibernate.connection.pool_size5/prop prop key=hibernate.current_session_context_classthread/prop prop key=hibernate.show_sqltrue/prop prop key=hibernate.cglib.use_reflection_optimizertrue/prop prop key=hibernate.cache.provider_classorg.hibernate.cache.EhCacheProvider/prop prop key=hibernate.hibernate.cache.use_query_cachetrue/prop /props /property property name=packagesToScan list valuecom.fuzzybearings.projx.model/value /list /property /bean context:component-scan base-package=com.fuzzybearings.projx.data.model / /beans - To unsubscribe, e-mail:
JNDI and mvn test
I'm executing the standard Wicket maven archetype's test target and it is having trouble finding my JNDI datasource. *mvn jetty:run* works just fine but when I execute the *mvn test* target from within m2eclipse, I get a huge stracktrace with the following excerpt: Caused by: javax.naming.NameNotFoundException; remaining name 'jdbc/ds' My pom references a jetty-env.xml file which includes the definition for this datasource but that entry is in the Jetty plugin section and I don't think it is is getting sourced when exec'ing the *mvn test *target. I will post to the Maven forum but before doing so was hoping someone here could suggest how to have maven test corectly see the datasource in my jetty-env.xml file while execing the *mvn test* target. Thanks, -Luther
Apache License in the Prototype
Not a huge thing but would it make sense to remove the licenses ... entry from the wicket prototype? licenses license nameThe Apache Software License, Version 2.0/name urlhttp://www.apache.org/licenses/LICENSE-2.0.txt/url distributionrepo/distribution /license /licenses Luckily, I stumbled across this before committing but I was close to publishing a new project to an GPL3 repository and this pom entry would have been confusing. Per the Maven pom guidelines http://maven.apache.org/pom.html#Licenses: *Note that a project should list only licenses that may apply directly to this project, and not list licenses that apply to this project's dependencies.* Again, no biggie. Maybe it is no big deal. -Luther
Re: Absolute static file references
Thanks Igor. We're not having performance issues. I'm just mapping what we traditionally do to Wicket. I did come across CSSPackageResource.getHeaderContribution(style/default/main.css)); which seems to do exactly what I was looking for. Back to your point, I guess I understood that Wicket 'could' manage resources - I'm just not sure when it 'should' manage them. I generally consider it a best practice to let the server handle static CSS and potentially huge js and img files but it sounds like you're suggesting start by managing the resources within Wicket and wait until performance issues actually start popping up and then consider externalizing them. What's nice to see is that Wicket appears to handle either approach pretty well. Also, ContextImage hit the nail on the head. Thanks for the suggestion -Luther On Sat, Oct 24, 2009 at 4:42 PM, Igor Vaynberg igor.vaynb...@gmail.comwrote: have you actually hit a scalability problem? if you are trying to optimize upfront you can use a less invasive technique. all resource urls in wicekt are served under the /resources/ virtual folder. you can enable the setting where wicket will append a last-modified date to the end of each resource url, and then have an apache-side cache to cache and serve everything under /resources/. alternatively see how ContextImage works if you want to serve your own stuff out of webapp folder. -igor On Sat, Oct 24, 2009 at 10:53 AM, Luther Baker lutherba...@gmail.com wrote: Have another question about serving up CSS (JS, img, etc) files statically: a) I'd like to have the option to serve my CSS up statically via an apache proxy. I'd also like to avoid serving CSS requests up via the wicket filter - even if served up by Jetty - as I think it will scale just a bit better ... b) With my current URL mounts, many pages with different base URLs refer to the same CSS file. Consequently, a relative URL for the common CSS files as referenced in the master template won't work since the CSS file would be looked up relative to each different URL mount point. Does that makes sense? So, I would like to create a simple, absolute reference mechanism for my static CSS, image or other files (without hardcoding). I'm not as knowledgeable about the way that components are mapped to wicket tags, how to add my own tags or even how to create my own components (other than Panels of course). Does the approach below adhere to the wicket way? It feels a bit manual ... and I'm not fond of the static WEB_CONTEXT assignment - but I don't see an elegant/efficient way to get it from within the Page or the AbstractBehavior on a per request basis. Just looking for a bit of advice. Does the WIKI have some detailed docs that really get into the nitty gritty of low-level component and tag design? IE: Details of ComponentTag, MarkupElement, WicketTag, On the other hand, is there any strong advice to put custom CSS, image and JS files in the classpath and reference ala wicket or is my approach perfectly reasonable here. An alternate goal of mine to keep custom components/solutions to a minimum. Thanks in advance, -Luther *MARKUP IN:* head link wicket:id=head.link rel=stylesheet href=style/default/main.css/ /head *MARKUP OUT:* head link rel=stylesheet href=*/portal/*style/default/main.css/ /head *JAVA* final static String WEB_CONTEXT = WebApplication.get().getServletContext().getContextPath(); protected DefaultPageTemplate() { // http://www.mkyong.com/wicket/how-to-dynamic-add-attribute-to-a-html-tag-in-wicket/ final WebMarkupContainerWithAssociatedMarkup cssLink = new WebMarkupContainerWithAssociatedMarkup(head.link); add(cssLink); cssLink.add(new AbstractBehavior() { private static final long serialVersionUID = 1L; @Override public void onComponentTag(final Component component, final ComponentTag tag) { String href = tag.getAttribute(href); href = WEB_CONTEXT + / + href; tag.put(href, href); } }); } - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Absolute static file references
Have another question about serving up CSS (JS, img, etc) files statically: a) I'd like to have the option to serve my CSS up statically via an apache proxy. I'd also like to avoid serving CSS requests up via the wicket filter - even if served up by Jetty - as I think it will scale just a bit better ... b) With my current URL mounts, many pages with different base URLs refer to the same CSS file. Consequently, a relative URL for the common CSS files as referenced in the master template won't work since the CSS file would be looked up relative to each different URL mount point. Does that makes sense? So, I would like to create a simple, absolute reference mechanism for my static CSS, image or other files (without hardcoding). I'm not as knowledgeable about the way that components are mapped to wicket tags, how to add my own tags or even how to create my own components (other than Panels of course). Does the approach below adhere to the wicket way? It feels a bit manual ... and I'm not fond of the static WEB_CONTEXT assignment - but I don't see an elegant/efficient way to get it from within the Page or the AbstractBehavior on a per request basis. Just looking for a bit of advice. Does the WIKI have some detailed docs that really get into the nitty gritty of low-level component and tag design? IE: Details of ComponentTag, MarkupElement, WicketTag, On the other hand, is there any strong advice to put custom CSS, image and JS files in the classpath and reference ala wicket or is my approach perfectly reasonable here. An alternate goal of mine to keep custom components/solutions to a minimum. Thanks in advance, -Luther *MARKUP IN:* head link wicket:id=head.link rel=stylesheet href=style/default/main.css/ /head *MARKUP OUT:* head link rel=stylesheet href=*/portal/*style/default/main.css/ /head *JAVA* final static String WEB_CONTEXT = WebApplication.get().getServletContext().getContextPath(); protected DefaultPageTemplate() { // http://www.mkyong.com/wicket/how-to-dynamic-add-attribute-to-a-html-tag-in-wicket/ final WebMarkupContainerWithAssociatedMarkup cssLink = new WebMarkupContainerWithAssociatedMarkup(head.link); add(cssLink); cssLink.add(new AbstractBehavior() { private static final long serialVersionUID = 1L; @Override public void onComponentTag(final Component component, final ComponentTag tag) { String href = tag.getAttribute(href); href = WEB_CONTEXT + / + href; tag.put(href, href); } }); }
Re: Ad Hoc URL Mapping
Thank nino. Unfortunately, I think you may have misunderstood my question. Indeed, I understand how to configure Wicket for RESTful URLs but my question is different. What I'm asking has to do with the PLACEMENT of the url parts. IE: I want the leftmost portion of the URL to be a parameter. RosterListPage.java should receive requests from: /cardinals/roster/list/14 /rams/roster/list/12 /falcons/roster/list/18 or think about it from a project tracking standpoint: /jira/issues/list/29 /bambool/issues/list/32 /fisheye/issues/list/25 I want urls like: http://code.google.com/guice/issues/list/45 http://code.google.com/wicket-guice/issues/list/32 http://code.google.com/jtrac/issues/list/21 Does that help clarify? Notice, the ROOT of the URL keeps changing. In my case, I want to mount parts 2 and 3 of the browser's URL to an actual Wicket page. How do I 'mount' a URL when the root of the URL keeps changing - and is itself, a parameter. Would I need to implement IRequestTargetUrlCodingStrategy myself or is there an existing strategy that I can leverage a bit? Hope that makes sense, -Luther On Mon, Oct 12, 2009 at 2:03 AM, nino martinez wael nino.martinez.w...@gmail.com wrote: You can already do this, a 2 sec google search brought this up: http://blog.xebia.com/2008/10/09/readable-url%E2%80%99s-in-wicket-an-introduction-to-wicketstuff-annotation/ http://css.dzone.com/news/wicket-creating-restful-urls 2009/10/12 Luther Baker lutherba...@gmail.com I'd like to use a RESTful URL style where the page parameters are not necessarily at the far right of the URL. For starters, I understand the basics of Indexed and/or MixedParam url mounting to convert this: /issues/list?project=*myapp*max=*14* to this: /issues/list/*myapp*/*14* but what I'm looking for is something like: /*myapp*/issues/list/*14* where /issues/list identifies the page and /myapp and /14 are the parameter values. In this case, the actually mapping looks something like: */[page]/[action]/* == Page Thoughts on the base way to manage this? -Luther
Ad Hoc URL Mapping
I'd like to use a RESTful URL style where the page parameters are not necessarily at the far right of the URL. For starters, I understand the basics of Indexed and/or MixedParam url mounting to convert this: /issues/list?project=*myapp*max=*14* to this: /issues/list/*myapp*/*14* but what I'm looking for is something like: /*myapp*/issues/list/*14* where /issues/list identifies the page and /myapp and /14 are the parameter values. In this case, the actually mapping looks something like: */[page]/[action]/* == Page Thoughts on the base way to manage this? -Luther
Re: vps hosting for wicket app
Linode - my personal favorite, http://journal.dedasys.com/2008/11/24/slicehost-vs-linode Slicehost - good reputation ServInt - great experience, great service, very fast boxes, a bit pricey A2 Hosting - very inexpensive AWS (Amazon E2) - easy setup and teardown and full image control -Luther On Tue, Oct 6, 2009 at 6:13 PM, Jeremy Thomerson jer...@wickettraining.comwrote: I've used redwoodvirtual in the past and it was always decent service. I'm not affiliated with them, but had a LVS there for a couple years for this sort of thing. -- Jeremy Thomerson http://www.wickettraining.com On Tue, Oct 6, 2009 at 1:37 PM, Fernando Wermus fernando.wer...@gmail.comwrote: Hi all, I need to deploy a wicket app for alpha and beta testing at a minimum price. Could you reccommend some vpn hosting? thanks in advance -- Fernando Wermus. www.linkedin.com/in/fernandowermus
Re: Slides
No problem. http://www.slideshare.net/lutherbaker/wicket-1987659 -Luther On Fri, Sep 11, 2009 at 11:08 PM, Jeremy Thomerson jer...@wickettraining.com wrote: Perhaps you could upload them to http://www.slideshare.net/ -- Jeremy Thomerson http://www.wickettraining.com On Fri, Sep 11, 2009 at 9:54 PM, Luther Baker lutherba...@gmail.com wrote: I have slides from my Wicket presentation last night here in St. Louis. I can't say how helpful they'd be for folks that weren't there but I'd be happy to submit them for posting somewhere in the Wicket WIKI pages. -Luther
Re: Slides
Sweet. Thanks Michael. I'll fix that now. I'm quite open to suggestions to tighten the deck up so please don't hesitate to comment. -Luther On Sat, Sep 12, 2009 at 3:25 AM, Michael Mosmann mich...@mosmann.de wrote: Hi, I have slides from my Wicket presentation last night here in St. Louis. On Page 20 you write public Object getObject(Component component) but public Object setObject(Serializable object) AFAIK getObject(Component component) is deprecated.. use getObject() .. (http://cwiki.apache.org/confluence/display/WICKET/Working+with+Wicket +models was wrong.. i have fixed it) If you use wicket 1.4.x, you will benefit from improved model with generics .. new IModelString() { public String getObject() { .. } .. } mm:) - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Slides
I have slides from my Wicket presentation last night here in St. Louis. I can't say how helpful they'd be for folks that weren't there but I'd be happy to submit them for posting somewhere in the Wicket WIKI pages. -Luther
dzone refcard
Is anyone aware of a wicket refcardhttp://refcardz.dzone.com/refcardz/core-java-concurrencyinitiative? Thoughts? -Luther
Re: dzone refcard
Sounds good. I'm giving a Wicket presentation herehttp://java.ociweb.com/javasig/in September and it would be nice to hand something like that out. Also, I've seen decks here before ... is there a central place where such presentations are collected. I'll look back through the forum but if you've got a link handy and wouldn't mind me extracting some slides ... feel free to ping me outside the forum as well. Also, any words of advice on topic progression - roughly 1.5 hours to about 35 people most of whom won't have used Wicket directly. I think we can assume they will have a good understanding of Java. Thanks, -Luther On Mon, Jul 6, 2009 at 4:22 PM, Andrew Lombardi and...@mysticcoders.comwrote: Thanks! I'll see if they can add you to the list of reviewers at some point soon. Cheers! On Jul 6, 2009, at 2:02 PM, jWeekend wrote: That'll be a nice resource for developers using Wicket, and, save jWeekend plenty of time preparing one ourselves for dZone, thanks! I'll let them know to avoid unnecessary confusion about our proposal to create it earlier today. Let me know if you need any extra pairs of eyes to review it. Regards - Cemal jWeekend OO Java Technology http://jWeekend.com kinabalu wrote: I've got one being pushed through the editorial process at DZone right now, should be out very soon. On Jul 6, 2009, at 12:48 PM, Nick Heudecker wrote: Andrew Lombardi created one some time ago. Should still be available. On Mon, Jul 6, 2009 at 12:44 PM, Paolo Di Tommaso paolo.ditomm...@gmail.com wrote: It would be nice -- paolo On Mon, Jul 6, 2009 at 6:07 PM, Luther Baker lutherba...@gmail.com wrote: Is anyone aware of a wicket refcardhttp://refcardz.dzone.com/refcardz/core-java-concurrency initiative? Thoughts? -Luther -- Nick Heudecker Professional Wicket Training Consulting http://www.systemmobile.com To our success! Mystic Coders, LLC | Code Magic | www.mysticcoders.com ANDREW LOMBARDI | and...@mysticcoders.com 2321 E 4th St. Ste C-128, Santa Ana CA 92705 ofc: 949-528-6480 fax: 714-782-6024 cell: 714-697-8046 linked-in: http://www.linkedin.com/in/andrewlombardi twitter: http://www.twitter.com/kinabalu Eco-Tip: Printing e-mails is usually a waste. This message is for the named person's use only. You must not, directly or indirectly, use, disclose, distribute, print, or copy any part of this message if you are not the intended recipient. -- View this message in context: http://www.nabble.com/dzone-refcard-tp24358337p24362753.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 To our success! Mystic Coders, LLC | Code Magic | www.mysticcoders.com ANDREW LOMBARDI | and...@mysticcoders.com 2321 E 4th St. Ste C-128, Santa Ana CA 92705 ofc: 949-528-6480 fax: 714-782-6024 cell: 714-697-8046 linked-in: http://www.linkedin.com/in/andrewlombardi twitter: http://www.twitter.com/kinabalu Eco-Tip: Printing e-mails is usually a waste. This message is for the named person's use only. You must not, directly or indirectly, use, disclose, distribute, print, or copy any part of this message if you are not the intended recipient.
Re: dzone refcard
Ah, got em. Thanks much Andrew, -Luther On Mon, Jul 6, 2009 at 9:14 PM, Andrew Lombardi and...@mysticcoders.comwrote: Luther, I gave a presentation on Wicket in March for TSSJS. The presentation should still be available at: javasymposium.techtarget.com On Jul 6, 2009, at 6:45 PM, Luther Baker wrote: Sounds good. I'm giving a Wicket presentation herehttp://java.ociweb.com/javasig/in September and it would be nice to hand something like that out. Also, I've seen decks here before ... is there a central place where such presentations are collected. I'll look back through the forum but if you've got a link handy and wouldn't mind me extracting some slides ... feel free to ping me outside the forum as well. Also, any words of advice on topic progression - roughly 1.5 hours to about 35 people most of whom won't have used Wicket directly. I think we can assume they will have a good understanding of Java. Thanks, -Luther On Mon, Jul 6, 2009 at 4:22 PM, Andrew Lombardi and...@mysticcoders.com wrote: Thanks! I'll see if they can add you to the list of reviewers at some point soon. Cheers! On Jul 6, 2009, at 2:02 PM, jWeekend wrote: That'll be a nice resource for developers using Wicket, and, save jWeekend plenty of time preparing one ourselves for dZone, thanks! I'll let them know to avoid unnecessary confusion about our proposal to create it earlier today. Let me know if you need any extra pairs of eyes to review it. Regards - Cemal jWeekend OO Java Technology http://jWeekend.com kinabalu wrote: I've got one being pushed through the editorial process at DZone right now, should be out very soon. On Jul 6, 2009, at 12:48 PM, Nick Heudecker wrote: Andrew Lombardi created one some time ago. Should still be available. On Mon, Jul 6, 2009 at 12:44 PM, Paolo Di Tommaso paolo.ditomm...@gmail.com wrote: It would be nice -- paolo On Mon, Jul 6, 2009 at 6:07 PM, Luther Baker lutherba...@gmail.com wrote: Is anyone aware of a wicket refcardhttp://refcardz.dzone.com/refcardz/core-java-concurrency initiative? Thoughts? -Luther -- Nick Heudecker Professional Wicket Training Consulting http://www.systemmobile.com To our success! Mystic Coders, LLC | Code Magic | www.mysticcoders.com ANDREW LOMBARDI | and...@mysticcoders.com 2321 E 4th St. Ste C-128, Santa Ana CA 92705 ofc: 949-528-6480 fax: 714-782-6024 cell: 714-697-8046 linked-in: http://www.linkedin.com/in/andrewlombardi twitter: http://www.twitter.com/kinabalu Eco-Tip: Printing e-mails is usually a waste. This message is for the named person's use only. You must not, directly or indirectly, use, disclose, distribute, print, or copy any part of this message if you are not the intended recipient. -- View this message in context: http://www.nabble.com/dzone-refcard-tp24358337p24362753.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 To our success! Mystic Coders, LLC | Code Magic | www.mysticcoders.com ANDREW LOMBARDI | and...@mysticcoders.com 2321 E 4th St. Ste C-128, Santa Ana CA 92705 ofc: 949-528-6480 fax: 714-782-6024 cell: 714-697-8046 linked-in: http://www.linkedin.com/in/andrewlombardi twitter: http://www.twitter.com/kinabalu Eco-Tip: Printing e-mails is usually a waste. This message is for the named person's use only. You must not, directly or indirectly, use, disclose, distribute, print, or copy any part of this message if you are not the intended recipient. To our success! Mystic Coders, LLC | Code Magic | www.mysticcoders.com ANDREW LOMBARDI | and...@mysticcoders.com 2321 E 4th St. Ste C-128, Santa Ana CA 92705 ofc: 949-528-6480 fax: 714-782-6024 cell: 714-697-8046 linked-in: http://www.linkedin.com/in/andrewlombardi twitter: http://www.twitter.com/kinabalu Eco-Tip: Printing e-mails is usually a waste. This message is for the named person's use only. You must not, directly or indirectly, use, disclose, distribute, print, or copy any part of this message if you are not the intended recipient.
Re: localizer and variables
OjO, Ideally, strings or text that users actually see and interact with are candidates for i18n. javascript, markup ids, onclick attributes and the like need not be i18n. This kind of text can strictly be considered part of your codebase. Remember, strings exist in the i18n properties files to isolate them - so that their values can easily be *replaced *by other language specific text values Before putting strings there - ask yourself if you really need language specific versions of this 'string'. From your second example, it looks like the *editLink* is a fine candidate for an i18n string ... but using i18n string for the *markupid *and *onclick *handlers is actually confusing. That'd be like putting your html markup in an i18n properties file. It is code and has no international variant. Feel comfortable keeping those strings *internal*. Don't *externalize* them. Keep them collocated/embedded in the code - since they are themselves, code. I hope I didn't misunderstand you. Hope that helps, -Luther On Mon, Jun 29, 2009 at 5:06 PM, Igor Vaynberg igor.vaynb...@gmail.comwrote: an external resource can be any file that is not javacode. eg inside your panel you can do Properties props=new Properties(); props.load(getClassLoader().getResourceAsStream(getClass().getName().replace(.,/)+.external.properties)); and have a MyPanel.external.properties file next to your MyPanel.java i dont see why you are trying to externalize such strings though, they are clearly part of the code. -igor On Mon, Jun 29, 2009 at 2:59 PM, OjOfang...@washington.edu wrote: Sorry, I did not mean to abuse them. I am seeking the right way of getting String properties associated with a panel class. What do you mean by externalized? What is an external resource? igor.vaynberg wrote: the property files are made for i18n, you are really abusing them. if you want these things externalized then load them from an external resource yourself. -igor On Mon, Jun 29, 2009 at 12:14 PM, OjOfang...@washington.edu wrote: Here is another more complex case: LinkSelection.properties: edit_label=Edit done_label=Hide Edit... linkId=toggle_link_{id} onclick=toggleEdit('{id}'); return(false); divId=toggle_div_{id} LinkSelection.java has the following in the constructor: @Override protected void populateItem(ListItem item) { bk = (BkItemI)item.getModelObject(); // 1. the edit icon Label editLink = new Label (edit_item_link, ( isEditBk(bk) ? new ResourceModel (done_label) : new ResourceModel (edit_label))) { @Override protected void onBeforeRender() { setOutputMarkupId(true); setMarkupId (getLocalizer().getString (linkIdPrefix, LinkSelection.this, new PropertyModel (LinkSelection.this.bk, id))); add (new SimpleAttributeModifier (onclick, getLocalizer().getString (onclick, LinkSelection.this, new PropertyModel (LinkSelection.this.bk, id; super.onBeforeRender(); } }; item.add (editLink); ... ERROR 29 11:58:24.086 Error attaching this container for rendering: [MarkupContainer [Component id = 0]] [o.a.w.RequestCycle] org.apache.wicket.WicketRuntimeException: Error attaching this container for rendering: [MarkupContainer [Component id = 0]] at org.apache.wicket.MarkupContainer.onBeforeRenderChildren(MarkupContainer.java:1717) at org.apache.wicket.Component.onBeforeRender(Component.java:3757) igor.vaynberg wrote: set it in onbeforerender -igor On Fri, Jun 26, 2009 at 2:03 PM, OjOfang...@washington.edu wrote: I am using the following: myCom.setMarkupId (getLocalizer().getString (handle, MyPanel.this, new Model (handleId))); but still getting WARNing: Tried to retrieve a localized string for a component that has not yet been added to the page. This can sometimes lead to an invalid or no localized resource returned. Make sure you are not calling Component#getString() inside your Component's constructor. What would be the correct way to get a property resource when a String value is needed? -- View this message in context: http://www.nabble.com/localizer-and-variables-tp16548684p24227247.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
dls, divs and ps and the ListView
Wicket 1.4-rc2 Marking up a ListView with dls, divs or ps has different results. Specifically, p doesn't wrap children correctly. If the outer/parent tags of a ListView are dl, all is well. If they are divs, all is well ... but with p --- the closing /p occurs right away - before the rest of the list elements render. I've include some example code. -Luther A dl example: dl class=post-view wicket:id=posts h4 wicket:id=title[post-title]/h4 dd class=dateline span wicket:id=author.fullName[author]/span, span wicket:id=publishedOn[published-on]/span /dd dd class=tags ul class=cloud li wicket:id=categoriesAsSortedLista href=# wicket:id=a-categoryspan wicket:id=category-name[category name]/span/a/li /ul /dd dd class=tags ul class=cloud li wicket:id=tagsAsSortedLista href=# wicket:id=a-tagspan wicket:id=tag-name[tag name]/span/a/li /ul /dd dd class=editspan wicket:id=editablea href= wicket:id=a-edit-postwicket:message key=m-edit//a: span wicket:id=lastModifiedOn[last-modified-on]/span/span/dd dd class=content wicket:id=content[post-content]/dd /dl Results in: dl class=post-view wicket:id=posts h4 wicket:id=titleGoodbye/h4 dd class=dateline span wicket:id=author.fullNameLuther Baker/span, span wicket:id=publishedOnJun 28, 2009/span /dd dd class=tags ul class=cloud li wicket:id=categoriesAsSortedLista href=category/asdf wicket:id=a-categoryspan wicket:id=category-nameasdf/span/a/li /ul /dd dd class=tags ul class=cloud li wicket:id=tagsAsSortedLista href=tag/fdsa wicket:id=a-tagspan wicket:id=tag-namefdsa/span/a/li /ul /dd dd class=edit/dd dd class=content wicket:id=contentHello/dd /dl dl class=post-view wicket:id=posts... A div example: div wicket:id=posts h4 wicket:id=title[post-title]/h4 dl class=post-view dd class=dateline span wicket:id=author.fullName[author]/span, span wicket:id=publishedOn[published-on]/span /dd dd class=tags ul class=cloud li wicket:id=categoriesAsSortedLista href=# wicket:id=a-categoryspan wicket:id=category-name[category name]/span/a/li /ul /dd dd class=tags ul class=cloud li wicket:id=tagsAsSortedLista href=# wicket:id=a-tagspan wicket:id=tag-name[tag name]/span/a/li /ul /dd dd class=editspan wicket:id=editablea href= wicket:id=a-edit-postwicket:message key=m-edit//a: span wicket:id=lastModifiedOn[last-modified-on]/span/span/dd dd class=content wicket:id=content[post-content]/dd /dl /div results in: div wicket:id=posts h4 wicket:id=titleGoodbye/h4 dl class=post-view dd class=dateline span wicket:id=author.fullNameLuther Baker/span, span wicket:id=publishedOnJun 28, 2009/span /dd dd class=tags ul class=cloud li wicket:id=categoriesAsSortedLista href=category/asdf wicket:id=a-categoryspan wicket:id=category-nameasdf/span/a/li /ul /dd dd class=tags ul class=cloud li wicket:id=tagsAsSortedLista href=tag/fdsa wicket:id=a-tagspan wicket:id=tag-namefdsa/span/a/li /ul /dd dd class=edit/dd dd class=content wicket:id=contentHello/dd /dl /div div wicket:id=posts... But p: p wicket:id=posts h4 wicket:id=title[post-title]/h4 dl class=post-view dd class=dateline span wicket:id=author.fullName[author]/span, span wicket:id=publishedOn[published-on]/span /dd dd class=tags ul class=cloud li wicket:id=categoriesAsSortedLista href=# wicket:id=a-categoryspan wicket:id=category-name[category
Re: guice-injection on page vs. components
For what it's worth ... I use Guice injection across the entire codebase. Pages get Services Services get Daos Daos get connections ... etc I even inject utility classes as needed and can't say I've had any problems. -Luther On Wed, Jun 24, 2009 at 11:38 AM, Aaron Dixon atdi...@gmail.com wrote: Hello, all - Guice/Wicket integration is excellent, but doesn't seem to work properly when I use @Inject-ed services on my *page* classes. It only seems to work when I inject services on components of my pages. I get WicketNotSerializableExceptions for services that I inject on my page class instances. So, if this is my page class: public class MyPage extends WebPage { @Inject private MyDao myDao; // causes WicketNotSerializableException public MyPage() { add(new MyPanel() { @Inject private MyDao myDao; // works fine and dandy ... } } } I get: org.apache.wicket.util.io.SerializableChecker$WicketNotSerializableException: Unable to serialize class: com.mycompany.dao.MyDao$$EnhancerByGuice$$3e6e9f94 Field hierarchy is: 2 [class=com.mycompany.pages.MyPage, path=2] private com.mycompany.dao.MyDao com.mycompany.pages.MyPage.myDao[class=com.mycompany.dao.MyDao$$EnhancerByGuice$$3e6e9f94] - field that is not serializable at org.apache.wicket.util.io.SerializableChecker.check(SerializableChecker.java:342) at org.apache.wicket.util.io.SerializableChecker.checkFields(SerializableChecker.java:610) ... Has anyone else noticed this?
Extending AutoLinkResolver
Is there a programmatic way to override or submit an AutoLink Resolver? For instance, I'd like to resolve something like link href='xxx'differently (e.g.: prepend the app context instead of prepending resources/classpath ... to look in the web root directory instead of the classpath). link href=css/standard.css/ becomes link href=/context/css/standard.css/ Thanks, -Luther public AutoLinkResolver() { // register tag reference resolvers TagReferenceResolver hrefTagReferenceResolver = new TagReferenceResolver(href); TagReferenceResolver srcTagReferenceResolver = new TagReferenceResolver(src); tagNameToTagReferenceResolvers.put(a, hrefTagReferenceResolver); tagNameToTagReferenceResolvers.put(link, hrefTagReferenceResolver); tagNameToTagReferenceResolvers.put(script, srcTagReferenceResolver); tagNameToTagReferenceResolvers.put(img, srcTagReferenceResolver); tagNameToTagReferenceResolvers.put(input, srcTagReferenceResolver); tagNameToTagReferenceResolvers.put(embed, srcTagReferenceResolver); // register autolink resolver delegates tagNameToAutolinkResolverDelegates.put(a, new AnchorResolverDelegate()); *tagNameToAutolinkResolverDelegates.put(link, new ResourceReferenceResolverDelegate(href));* ResourceReferenceResolverDelegate srcResRefResolver = new ResourceReferenceResolverDelegate( src); tagNameToAutolinkResolverDelegates.put(script, srcResRefResolver); tagNameToAutolinkResolverDelegates.put(img, srcResRefResolver); tagNameToAutolinkResolverDelegates.put(input, srcResRefResolver); tagNameToAutolinkResolverDelegates.put(embed, srcResRefResolver); }
Re: Feedback Messages Not Getting Displayed When Using AjaxSubmitLink
I'm not at a computer to try this ... but I do this all the time so it definitely works like you're hoping. You've posted alot of code so its a bit difficult to trace what is commented out and what is not ... but starting with your original post, uncomment the following: final FeedbackPanel feedback = new FeedbackPanel(feedback); feedback.setOutputMarkupId(true); add(feedback); Now, be sure to add this (I think this is the part you're missing - or I missed in reading your snippets): feedback.setOutputMarkupPlaceholderTag(true); And then make sure you add it to the target in the submit handler: target.addComponent(feedback); I think you're doing/done all of this at one time with varied components - but my guess is that you've got to double check and make sure you're doing all three things specifically for the feedback panel. Hope this helps, -Luther Its hard to tell what On Fri, Jun 19, 2009 at 4:21 PM, jpalmer1026 jpalmer1...@mchsi.com wrote: Actually, validation messages are now getting displayed for validation performed on components but I am still unable to get error messages that I have added to be displayed. For example, in the following code, I need a way to display the line No PIN found for PIN but I am not sure how to do that. Any ideas? final AjaxSubmitLink verifyPinLink = new AjaxSubmitLink(verifyPinLink) { @Override public void onSubmit(AjaxRequestTarget target, Form form) { //target.addComponent(feedback); //onError(target, form); Declaration declaration = (Declaration) form.getModelObject(); ParcelIdentification pid = declarationService.findParcelIdentification(declaration.getPin()); if (pid == null) { error(No PIN found for PIN + declaration.getPin()); } else { InitiateDeclarationVerifyPanel decVerifyPanel = new InitiateDeclarationVerifyPanel(verifyPanel, pid); parent.addOrReplace(decVerifyPanel); parent.setVisible(true); this.setEnabled(false); reenterPinLink.setVisible(true); target.addComponent(this); target.addComponent(parent); target.addComponent(reenterPinLink); } } @Override public void onError(AjaxRequestTarget target, Form form) { target.addComponent(feedback); } }; jpalmer1026 wrote: I called target.addComponent for the feedbackpanel but still no luck. My updated code is as follows: final AjaxSubmitLink verifyPinLink = new AjaxSubmitLink(verifyPinLink) { @Override public void onSubmit(AjaxRequestTarget target, Form form) { target.addComponent(feedback); onError(target, form); Declaration declaration = (Declaration) form.getModelObject(); ParcelIdentification pid = declarationService.findParcelIdentification(declaration.getPin()); if (pid == null) { error(No PIN found for PIN + declaration.getPin()); } else { InitiateDeclarationVerifyPanel decVerifyPanel = new InitiateDeclarationVerifyPanel(verifyPanel, pid); parent.addOrReplace(decVerifyPanel); parent.setVisible(true); this.setEnabled(false); reenterPinLink.setVisible(true); target.addComponent(this); target.addComponent(parent); target.addComponent(reenterPinLink); } } }; Erik van Oosten wrote: You did not call target.addComponent for the feedbackpanel or any of its parents. Regards, Erik. jpalmer1...@mchsi.com schreef: I am using an AjaxSubmitLink to submit form data. Using this, however, is preventing feedback messages from being displayed. My code is as follows: public class InitiateDeclarationPage extends EzdecBaseWebPage { @SpringBean private IDeclarationService declarationService; AjaxFallbackLink reenterPinLink; public InitiateDeclarationPage() { final Declaration declaration = new Declaration(EzdecSession.getCurrentUser().getAccount(), EzdecSession.getCurrentUser(), , County.COOK, State.ILLINOIS); //final FeedbackPanel feedback = new FeedbackPanel(feedback); //feedback.setOutputMarkupId(true); //add(feedback); add(new FeedbackPanel(feedback)); final Form form = new Form(initiateDeclarationForm, new CompoundPropertyModelDeclaration(declaration)); form.add(new Button(submitButton) { @Override
Re: [OFF TOPIC] Java desktop applications
I'd agree with Chris too. Swing apps can really attack a different a class of problems ... a completely different solution space. And in that regard - I think Swing (and/or strict desktop GUI development) would be a beneficial understanding/perspective to have in your toolbelt. I find this conversation enlightening ... one of Wicket's big selling points is the similarities to Swing's programming model ;) Once you get started, you will probably feel right at home working natively in Swing. -Luther On Mon, Jun 15, 2009 at 7:14 AM, Christopher L Merrill ch...@webperformance.com wrote: nino martinez wael wrote: The largest issue about going towards a desktop solution with java are that designing the ui really are a pain if you dont use something like mattise, it's even worse that hacking html.. I'll agree on the javaFX Granted, HTML frameworks have come a long way in the past 15 years, but even with Wicket, building GUIs is still easier with a dedicated graphics toolkit. Even SWT is better than HTML/CSS. I worked a lot with AWT/Swing in the past and now SWT/JFace/Eclipse RCP. For anything more than trivial GUIs, either one is easier than HTML. No matter how good Wicket and AJAX get, you're still fighting the underlying design principal of HTML - it was designed for rendering documents, not building GUIs. my 2c, Chris -- - Chris Merrill | Web Performance, Inc. ch...@webperformance.com| http://webperformance.com 919-433-1762| 919-845-7601 Website Load Testing and Stress Testing Software Services - - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
wicket:message on an attribute
Is there a way to use wicket:message on markup attributes? Pseudo something like this? li title='wicket:message key=category/' Thanks, -Luther
Re: wicket:message on an attribute
That did it - thank you, -Luther On Sun, Jun 14, 2009 at 10:14 AM, Maarten Bosteels mbosteels@gmail.comwrote: http://cwiki.apache.org/WICKET/wickets-xhtml-tags.html#Wicket%27sXHTMLtags-Attributewicket:message *wicket:message=attribute:resource_identifier* - Used on any tag that we want Wicket to provide an attribute with a value that's the result of a resource lookup. Maarten On Sun, Jun 14, 2009 at 5:04 PM, Luther Baker lutherba...@gmail.com wrote: Is there a way to use wicket:message on markup attributes? Pseudo something like this? li title='wicket:message key=category/' Thanks, -Luther
Re: refresh page
mount the page with hybridurlcodingstrategy and your problems will go away. Flawless Victory! Thanks everybody, -Luther
Re: refresh page
Ok, so that 'almost' wraps this up. HypbridUrlCodingStrategy works perfectly for the Ajax-added data. My last problem is related to the form fields. In AjaxFallbackButton.onSubmit ... I clean out the input that holds the value I've just added to the database and redisplayed in a list to the user. But, on subsequent manual browser refresh, the INPUT that I wiped refreshes with the user's LAST INPUT. I don't mind this for the title, content or other input fields on the page - but I don't want values showing up that I manually removed. I think this is part of standard browser/form fields behavior. I think Mike's approach would work here: ie: javascript that clears this input out on load. I 'never' want any values in this input on load. I know how to write an IHeaderContributor - is there something similar to add a body=onload? If not, my specific page (Java/html) doesn't really create the body tag ... what is the best way to grab it so that I can possibly add a behavior that would create an onLoad handler. Or, is there a better, wicket way to make sure this input is empty on browser refresh? Thanks, -Luther // add a category to the view // and clean out input that supplied it // dbase code intentionally left out final AjaxFallbackButton addCategoryButton = new AjaxFallbackButton(add-category, new ResourceModel(m-add-category), this) { private static final long serialVersionUID = 1L; @Override protected void onSubmit(final AjaxRequestTarget target, final Form? form) { final IModelString model = categoryCandidate.getModel(); final String text = model.getObject(); // make sure we should actually do something if (text == null) { return; } // cleans out the form.INPUT model.setObject(new String()); // add the new text to the categoriesModel (custom Set) categoriesModel.add(text); // redraw the form.INPUT target.addComponent(categoryCandidate); // redraw the li of categories target.addComponent(categoriesParent); } }; To test the idea ... this works when placed in the markup after the input I want to clean out: script type=text/javascript document.getElementById(category_candidate1e).value = ''; /script But I can't leave this embedded in the HTML ... and I guess the ID can change per wicket's whim. I need to add this to an body.onload event as a behavior --- how to do I get ahold of the body element from within my Page.java?
Re: [OFF TOPIC] Java desktop applications
Admittedly - it may not be standard, easy or necessarily intuitive ... but CSS ain't all bad is it? :) http://www.mezzoblue.com/zengarden/alldesigns/ -Luther On Fri, Jun 12, 2009 at 10:34 AM, Johan Compagner jcompag...@gmail.comwrote: css is really crap (until i really can use box-sizing: border-box everywhere that will be a great relieve) who ever thought about that content-box should be shot and not through the head but shot at various places so that he will die a very painfull and slow death. its completely counter intuitive and i really can understand that microsoft did implement it first wrong (quirks mode) because who in there right minds comes up with something like that. johan On Fri, Jun 12, 2009 at 17:11, Jeremy Thomerson jer...@wickettraining.comwrote: I used to hate HTML / CSS and had designers to do the layout. In the past couple years, I've had to do all my own layouts from photoshop images of what it should look like, and have become fairly proficient with HTML / CSS. To the point where I actually sort of like it. Not as much as coding the domain, service and lower layers, but I think Wicket is the thing that actually made GUI programming fun for me. Before that we had used Tapestry, which I hated. Anyway, I guess it's all familiarity. Someone's first web pages are generally ugly too, just like my first Swing apps - just look at MySpace - you'll see what I mean! -- Jeremy Thomerson http://www.wickettraining.com On Fri, Jun 12, 2009 at 2:03 AM, Johan Compagnerjcompag...@gmail.com wrote: Ha this is funny, I hear things like swing is horrible to design, from users that use wicket so html apps. I guess those dont design the webapps themselfs, because if i have to choose i would choose swing or swt over html/css any day.. I really hate css For swing apps just have a good ui builder like windows builder or matisse. Windows builder also supports SWT With grouplayout making nice ui's that always looks good over multiply os'ses or jvms is pretty easy You could try to use JavaFX but i havent experiences with that. But it should be way easier to creaty flashy ui apps.. On 11/06/2009, Jeremy Thomerson jer...@wickettraining.com wrote: I would like to build a nice-looking java desktop application. I hope that isn't an oxymoron :). I have built some desktop apps before - a lot of command line utilities in various languages, and some GUI apps (perl, java, python, php, even vb (yikes!), c# etc...). The question is - what framework do you use for your UI components and layout on a desktop app? I would like to use Java because I'll be most efficient with it and it will work for me on linux machines and others on Windoze, etc.. But when I've built Swing apps in the past, I have hated having to layout everything in the code and I can never make anything aesthetically pleasing. So 1 - do you have any recommendations on a good framework for nice looking desktop apps? 2 - any other recommendations for desktop apps in general? 3 - It should be a lightweight, easy install - and I would prefer to stay away from using the Eclipse framework for building the app (I use the IDE but it doesn't need to be something that heavy for the GUI) 4 - I have even thought about building an app that opens a swing window that contains an embedded browser and jetty servlet running the app so that I can use Wicket. Has anyone thought of or done this before? Basically, it's a CRUD application, but containing personal data that the user should not store on someone else's server. I would use an embedded database that stores the data with encryption. Ideas? -- Jeremy Thomerson http://www.wickettraining.com - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: [OFF TOPIC] Java desktop applications
As an aside, I think the art-form takes a great stride forward every time we arrive at a framework that, by its very use, improves general design and implementation. For example, I think the concepts around Spring are a huge step forward. Most young developers don't understand what *dependencies* are, don't understand why flat inheritance hierarchies are better than taller ones, don't understand how to write code you can test in 5 minutes, don't understand what test *driven* actually means, don't understand why the web Controller layer shouldn't include business logic ... but lock them in a room with Spring and force them to use it, wave your hands and say abracadabra ... and whalah, that singular exasperating experience will actually do more for them in one month than months/years of long-drawn out conversations about IoC, dependencies, injection and design by contract/interface. Likewise, give me a few newbies, JSPs, Spring Tags, JSTL, servlets and actions and watch the nastiness that will follow. It is just wa-a-ay to open ended. Anything goes - and anything does! Now, ** drum roll please **, after a few years of this initial, required, nonsense, more drum rolling , someone dreams of a better way. A framework, that, *by its very usage*, teaches/enforces/begats better coding technique. Wicket is not just front end ... it is perspective. It is self-regulating. It is structure. It teaches. It limits. It liberates. In short, it is a huge step forward. Wicket is the thing that actually made GUI programming fun for me. No surprise to me! Thank you Wicket for changing the way we _think_ about (GUI) development. :) -Luther On Fri, Jun 12, 2009 at 10:11 AM, Jeremy Thomerson jer...@wickettraining.com wrote: I used to hate HTML / CSS and had designers to do the layout. In the past couple years, I've had to do all my own layouts from photoshop images of what it should look like, and have become fairly proficient with HTML / CSS. To the point where I actually sort of like it. Not as much as coding the domain, service and lower layers, but I think Wicket is the thing that actually made GUI programming fun for me. Before that we had used Tapestry, which I hated. Anyway, I guess it's all familiarity. Someone's first web pages are generally ugly too, just like my first Swing apps - just look at MySpace - you'll see what I mean! -- Jeremy Thomerson http://www.wickettraining.com On Fri, Jun 12, 2009 at 2:03 AM, Johan Compagnerjcompag...@gmail.com wrote: Ha this is funny, I hear things like swing is horrible to design, from users that use wicket so html apps. I guess those dont design the webapps themselfs, because if i have to choose i would choose swing or swt over html/css any day.. I really hate css For swing apps just have a good ui builder like windows builder or matisse. Windows builder also supports SWT With grouplayout making nice ui's that always looks good over multiply os'ses or jvms is pretty easy You could try to use JavaFX but i havent experiences with that. But it should be way easier to creaty flashy ui apps.. On 11/06/2009, Jeremy Thomerson jer...@wickettraining.com wrote: I would like to build a nice-looking java desktop application. I hope that isn't an oxymoron :). I have built some desktop apps before - a lot of command line utilities in various languages, and some GUI apps (perl, java, python, php, even vb (yikes!), c# etc...). The question is - what framework do you use for your UI components and layout on a desktop app? I would like to use Java because I'll be most efficient with it and it will work for me on linux machines and others on Windoze, etc.. But when I've built Swing apps in the past, I have hated having to layout everything in the code and I can never make anything aesthetically pleasing. So 1 - do you have any recommendations on a good framework for nice looking desktop apps? 2 - any other recommendations for desktop apps in general? 3 - It should be a lightweight, easy install - and I would prefer to stay away from using the Eclipse framework for building the app (I use the IDE but it doesn't need to be something that heavy for the GUI) 4 - I have even thought about building an app that opens a swing window that contains an embedded browser and jetty servlet running the app so that I can use Wicket. Has anyone thought of or done this before? Basically, it's a CRUD application, but containing personal data that the user should not store on someone else's server. I would use an embedded database that stores the data with encryption. Ideas? -- Jeremy Thomerson http://www.wickettraining.com - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: [OFF TOPIC] Java desktop applications
On Fri, Jun 12, 2009 at 5:57 PM, Jeremy Thomerson jer...@wickettraining.com wrote: Those designs aren't what make me like CSS - most of them are necessarily-filled with hacks to make them work, especially across browsers. Sure. My comment was a joking plea to Johan to reconsider CSS :) css is really crap And to your point, it isn't always the CSS, per se, that is the struggle - but rather, varying browser implementations. I think those csszengarden pages, browser hacks or not, do help a bit, to illustrate what is possible with CSS. In general, the *hacks* on those pages really simulate what CSS is designed to do - not compensate for it. I think that is a subtle but important point. I still like the separation of markup for presentation and java for code Amen. And I think Wicket really elucidates those lines. @Johan It's not much consoluation but HTML has a twisted history - and CSS was really an afterthought. HTML wasn't necessarily designed for what it is being used for today/tomorrow. CSS is really - quite an elegant solution (conceptually at least) to the general problem we're stuck with. -Luther
refresh page
If I add a few values to a page div ala an Ajax button - and the user hits refresh on the page, the new values I've added go away. The user is completing a form - but hasn't formally submitted the form yet - so there is nothing stored in the database yet. The browser naturally re-renders the textarea and input values to the screen - but wipes out content to any divs I might have dynamically added data to. What would be the wicket way to allow these dynamic divs to survive a page refresh? Maybe on the a 'wicket-example'? Thanks, -Luther
Re: refresh page
I think you're right - I would need to use the Session or the Database on each Ajax invocation to add these values. But it also seems that if I store the new, dynamic, page specific values into a TextField (as opposed to a div) - they survive a page refresh. I'm not sure if that is robust or formally a standard across all browsers - so I will do a bit more research but that seems to be the behavior I'm after. Thanks, -Luther 2009/6/11 Dorothée Giernoth dorothee.giern...@kds-kg.de Hmm, is that possible ... you can't like store session-data in the browser, do you? You can only store session-details in the database on the fly with ajax while the user still fills out the form to allow the user to re-create the session on next login or something like this if he accidently hits reload (but even then I am not sure if that works ... maybe if you write the not yet submitted but in the form included information back into the fields when the site is rendered) ... Does that make sense ... or I am not understanding the question ;) - dg -Ursprüngliche Nachricht- Von: Luther Baker [mailto:lutherba...@gmail.com] Gesendet: Donnerstag, 11. Juni 2009 13:27 An: users@wicket.apache.org Betreff: refresh page If I add a few values to a page div ala an Ajax button - and the user hits refresh on the page, the new values I've added go away. The user is completing a form - but hasn't formally submitted the form yet - so there is nothing stored in the database yet. The browser naturally re-renders the textarea and input values to the screen - but wipes out content to any divs I might have dynamically added data to. What would be the wicket way to allow these dynamic divs to survive a page refresh? Maybe on the a 'wicket-example'? Thanks, -Luther - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: refresh page
So it turns out I'm going to want to display these values as a list ul ... li etc. My 'input' approach won't be adequate. Back to the Session idea ... (smells already). WIA has a security chapter that goes into storing a User in session - but does anyone have a good resource that dives a bit deeper into best practices with respect to Sessions? What about logical concepts/scopes like request, flash, conversational, etc - and how wicket facilitates them? Eg: I'd like to accumulate/remember page specific things while the user is visits a particular url. Ideally, the transient info is dropped when the user navigates away. I could create a POJO that represents the info and add getters and setters to the wicket session object I extended from the WIA security chapter ... but that smells bad. It seems heavy --- and I'm not sure it makes sense to use that pattern everywhere I have Ajax buttons putting rendering new values to the screen. Is there a more generalize Wicket mechanism for this type of thing? A localized, managed, short term, minimal, user specific, page specific type of state management? Or, given my issue, is there another way to think of this (out of box)? Again, I am user's adding a few values (tags, categories) to the screen with Ajax buttons and I need to make sure that information survives browser behaviors like page refreshes. Thanks, -Luther On Thu, Jun 11, 2009 at 7:07 AM, Luther Baker lutherba...@gmail.com wrote: I think you're right - I would need to use the Session or the Database on each Ajax invocation to add these values. But it also seems that if I store the new, dynamic, page specific values into a TextField (as opposed to a div) - they survive a page refresh. I'm not sure if that is robust or formally a standard across all browsers - so I will do a bit more research but that seems to be the behavior I'm after. Thanks, -Luther 2009/6/11 Dorothée Giernoth dorothee.giern...@kds-kg.de Hmm, is that possible ... you can't like store session-data in the browser, do you? You can only store session-details in the database on the fly with ajax while the user still fills out the form to allow the user to re-create the session on next login or something like this if he accidently hits reload (but even then I am not sure if that works ... maybe if you write the not yet submitted but in the form included information back into the fields when the site is rendered) ... Does that make sense ... or I am not understanding the question ;) - dg -Ursprüngliche Nachricht- Von: Luther Baker [mailto:lutherba...@gmail.com] Gesendet: Donnerstag, 11. Juni 2009 13:27 An: users@wicket.apache.org Betreff: refresh page If I add a few values to a page div ala an Ajax button - and the user hits refresh on the page, the new values I've added go away. The user is completing a form - but hasn't formally submitted the form yet - so there is nothing stored in the database yet. The browser naturally re-renders the textarea and input values to the screen - but wipes out content to any divs I might have dynamically added data to. What would be the wicket way to allow these dynamic divs to survive a page refresh? Maybe on the a 'wicket-example'? Thanks, -Luther - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: JPA EntityManager storage
http://faler.wordpress.com/2009/04/30/building-a-more-scalable-open-session-in-view/ Nice post. For some reason I thought Hibernate's Session could be configured to do this sort of thing intrinsically (ie: starting and ending tx are essentially noops unless something actually happened - part of the whole dirty checking thing). On another note, I know that Hibernate's Session.getCurrentSession() can be configured to be thread specific (internally using ThreadLocal) ... I've recently wondered if EntityManagerFactory.createEntityManager follows suite ? -Luther On Wed, Jun 10, 2009 at 1:04 PM, Luther Baker lutherba...@gmail.com wrote: Indeed, it can seem *spooky* to start writing code at the ThreadLocal level ... but remember, threads are created, assigned, collected and reused by the server - unless explicitly created by the application (which is highly discouraged), they are managed by the server. That said, the server receives a request, grabs a thread and assigns it to the request. I believe you can assume that same thread will start, service and end requests consistently. The OS may context switch and control may move (the thread may pause) but unless someone is trying to make their own lives extremely difficult, threads in a JEE container will not jump around randomly from request to request without completing them. (I think this might be specified in a JSR somewhere - but I can't put my finger on it right now.) -Luther On Wed, Jun 10, 2009 at 10:39 AM, James Carman jcar...@carmanconsulting.com wrote: On Wed, Jun 10, 2009 at 11:34 AM, Frank Tegtmeyerf...@fte.to wrote: I think you hit the problem here. The example I used (in German at http://rattlab.net/2008/10/persistenz-fur-den-feedreader/) implies that every Request uses its own thread and I never expected threads to be reused. I used simple initialization of the variable and closed the EntityManager in onEndRequest(). That highlights why I didn't like the ThreadLocal() approach - it depends on implementation details somewhere out of my control (and knowledge). The specification says that threads may be reused. So, it's not really an implementation-specific thing. Most servers implement their server threads this way, as they should. You should expect them to reuse threads. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: JPA EntityManager storage
Indeed, it can seem *spooky* to start writing code at the ThreadLocal level ... but remember, threads are created, assigned, collected and reused by the server - unless explicitly created by the application (which is highly discouraged), they are managed by the server. That said, the server receives a request, grabs a thread and assigns it to the request. I believe you can assume that same thread will start, service and end requests consistently. The OS may context switch and control may move (the thread may pause) but unless someone is trying to make their own lives extremely difficult, threads in a JEE container will not jump around randomly from request to request without completing them. (I think this might be specified in a JSR somewhere - but I can't put my finger on it right now.) -Luther On Wed, Jun 10, 2009 at 10:39 AM, James Carman jcar...@carmanconsulting.com wrote: On Wed, Jun 10, 2009 at 11:34 AM, Frank Tegtmeyerf...@fte.to wrote: I think you hit the problem here. The example I used (in German at http://rattlab.net/2008/10/persistenz-fur-den-feedreader/) implies that every Request uses its own thread and I never expected threads to be reused. I used simple initialization of the variable and closed the EntityManager in onEndRequest(). That highlights why I didn't like the ThreadLocal() approach - it depends on implementation details somewhere out of my control (and knowledge). The specification says that threads may be reused. So, it's not really an implementation-specific thing. Most servers implement their server threads this way, as they should. You should expect them to reuse threads. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: AW: AW: wicket on java server
If you're actually serious ... this might get you started - either way. How Tomcat Works: A Guide to Developing Your Own Java Servlet Container - http://my.safaribooksonline.com/097521280X -Luther On Wed, Jun 10, 2009 at 5:54 PM, Sam Stainsby s...@sustainablesoftware.com.au wrote: On Wed, 10 Jun 2009 14:56:59 +0200, Dorothée Giernoth wrote: No, worse, my boss :( he doesn't think tomcat is safe enough and doesn't know how tomcat works and what's going on behind the scenes ... and we can't have that I bet he won't let me use wicket ... b/c it's not safe enough either *shakes head* weirdo Paranoid? I bet ... Maybe just use Jetty if that suits. Simpler and certainly extremely easy to set up and test with maven. We do this for one client for an app that is only used by a handful of people. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: JPA EntityManager storage
Maybe this link will help: https://www.hibernate.org/43.html in the class JpaUtil. I don't like this approach because it depends on the implicit assumption that each request is handled in a thread (this depends on Wicket implementation details, therefor I dislike it) This assumption is not true. It is perfectly fine to attach the EntityManager to ThreadLocal since, per the spec, each request is guaranteed to get assigned to a different thread. This is not a wicket implementation detail, it is higher than that - threads are assigned by the container. -Luther On Tue, Jun 9, 2009 at 6:48 AM, Frank Tegtmeyer f...@fte.to wrote: Well when it comes to EntityManagers be sure to close, commit and clear your threadlocal instance after your service request cycle. Exactly that didn't work for me. I checked for open transactions, closed them, closed the EntityManager and even released it by setting the ThreadLocal variable to null. Although I created a new EntityManager in onBeginRequest() I constantly got errors during form processing because of not existing EntityManager. I solved this by leaving EntityManager there after the request and checking for its existence at the begin of the request. Any ideas about this? Regards, Frank - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: JPA EntityManager storage
Careful, that link got mangled: goog_1244383468413https://www.hibernate.org/43.html Hope this helps, -Luther On Tue, Jun 9, 2009 at 7:10 AM, Luther Baker lutherba...@gmail.com wrote: Maybe this link will help: https://www.hibernate.org/43.html in the class JpaUtil. I don't like this approach because it depends on the implicit assumption that each request is handled in a thread (this depends on Wicket implementation details, therefor I dislike it) This assumption is not true. It is perfectly fine to attach the EntityManager to ThreadLocal since, per the spec, each request is guaranteed to get assigned to a different thread. This is not a wicket implementation detail, it is higher than that - threads are assigned by the container. -Luther On Tue, Jun 9, 2009 at 6:48 AM, Frank Tegtmeyer f...@fte.to wrote: Well when it comes to EntityManagers be sure to close, commit and clear your threadlocal instance after your service request cycle. Exactly that didn't work for me. I checked for open transactions, closed them, closed the EntityManager and even released it by setting the ThreadLocal variable to null. Although I created a new EntityManager in onBeginRequest() I constantly got errors during form processing because of not existing EntityManager. I solved this by leaving EntityManager there after the request and checking for its existence at the begin of the request. Any ideas about this? Regards, Frank - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: JPA EntityManager storage
attaching Hibernate is easier via vanilla java than via Spring configuration. attaching Hibernate is [even eaiser with Guice]! :) On Tue, Jun 9, 2009 at 7:59 AM, James Carman jcar...@carmanconsulting.comwrote: On Tue, Jun 9, 2009 at 8:39 AM, Martin Makundimartin.maku...@koodaripalvelut.com wrote: Well.. with wicket it's easy when the transactions are request-scoped. It's a different ballgame somewhere else.. but then we can have EJB3 or something. Yes, but not all transactions are request-scoped. We have many times implemented asynchronous transactions, because the user didn't want to wait for the results. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Ajax and LoadableDetachableModel
Quick question regarding a blog engine I'm working on: my user is editing a blog Post and gets to the Category section. Category is implemented with a DropDownChoice and LoadableDetachableModel. For convenience - I also have a simple TextField that, when filled out, implicitly creates a new Category and attaches it to the current Post. For now, I only allow 1 Category per Post. The Category TextField takes precedence over the DropDown. IE: if the user types anything in the Category TextField, that (String) will be looked up, inserted if missing and attached to the Post as a Category. Question: after submitting this entire form (ala AjaxFallbackButton) - I intentionally stay on this page. The Category is added and the Post has been saved ... but I need the Category DropDown to refresh. Since all of this happens ala AjaxFallbackButtons - the process works except, the LoadableDetachableModel attached to the DropDownChoice (obviously) doesn't fire the load method when I add the DropDown to the target (in the submit handler). To clarify, in my submission, I just added a Category and saved the Post and ostensibly, redrawn the DropDownChoice (ie: I've set the OutputMarkupID on the DropDownChoice and attached it to the target in the ajax submit handler) ... but the underlying model isn't actually reloading. Is there something like a 'refresh' method on the LoadableDetachableModel ... or, should I attach it to the target as well? Thanks in advance for any suggestions, -Luther
Re: Ajax and LoadableDetachableModel
In my submit handler - I invoke a service to first a) the save category and then b) save the post. I put a message into the feedback panel and add the feedback panel and the drop down to the target. It is off an AjaxFallbackbutton ... so, no, I don't think I've done anything to explicitly detach the model. Is it such that when the original page is initially rendered - the model would have attached and then detached. The user then takes time to fill out the form - and upon submit, the model attaches again where I currently get the form fields ... do some *work* ... and then when I'm finished, detaches again? New ground for me here ... should I explicitly invoke detach() at the beginning of the submit handler ... and then attach() at the end so that the render phase gets new data? Thanks, -Luther On Tue, Jun 9, 2009 at 8:52 AM, Linda van der Pal lvd...@heritageagenturen.nl wrote: Did you explicitly detach the model? Regards, Linda Luther Baker wrote: Quick question regarding a blog engine I'm working on: my user is editing a blog Post and gets to the Category section. Category is implemented with a DropDownChoice and LoadableDetachableModel. For convenience - I also have a simple TextField that, when filled out, implicitly creates a new Category and attaches it to the current Post. For now, I only allow 1 Category per Post. The Category TextField takes precedence over the DropDown. IE: if the user types anything in the Category TextField, that (String) will be looked up, inserted if missing and attached to the Post as a Category. Question: after submitting this entire form (ala AjaxFallbackButton) - I intentionally stay on this page. The Category is added and the Post has been saved ... but I need the Category DropDown to refresh. Since all of this happens ala AjaxFallbackButtons - the process works except, the LoadableDetachableModel attached to the DropDownChoice (obviously) doesn't fire the load method when I add the DropDown to the target (in the submit handler). To clarify, in my submission, I just added a Category and saved the Post and ostensibly, redrawn the DropDownChoice (ie: I've set the OutputMarkupID on the DropDownChoice and attached it to the target in the ajax submit handler) ... but the underlying model isn't actually reloading. Is there something like a 'refresh' method on the LoadableDetachableModel ... or, should I attach it to the target as well? Thanks in advance for any suggestions, -Luther No virus found in this incoming message. Checked by AVG - www.avg.com Version: 8.5.339 / Virus Database: 270.12.59/2165 - Release Date: 06/09/09 05:53:00 - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Ajax and LoadableDetachableModel
To help others: while debugging ... I noticed that the model's 'load' method is being called before the button's onSubmit handler is invoked. So, under normal circumstances, when control reaches the submit handler and I save the value from the Textfield to the database as a 'Category' and add the DropDownChoice to the target ... it is to no avail, the model's load handler is not invoked again. But, per Linda's suggestion, explicitly detaching the 'categoriesModel' just before adding it to the target causes the model's 'load' method to get invoked before rending to the view: protected void onSubmit(final AjaxRequestTarget target, final Form? form) { Post updatedPost = (Post) form.getModelObject(); // new category? add to database and set in this post updateCategoryInDatabase(updatedPost, categoryCandidate.getModelObject()); // update author final User user = ((UserSession) Session.get()).getUser(); updatedPost.setAuthor(user); // save post final Post postWithId = postService.save(updatedPost); // update the form's model (with the ID if it was saved for the first time) updatedPost = (Post) form.getModelObject(); updatedPost.setId(postWithId.getId()); // tell the world final String msg = getTimestampString(m-saved); info(msg); *// redraw the categories categoryModel.detach(); target.addComponent(categories); * // render the post's id (if not already rendered) target.addComponent(postId); // render the feedback message target.addComponent(feedbackPanel); } I hope this is the generally accepted way to do this. Thanks, -Luther On Tue, Jun 9, 2009 at 11:57 AM, Luther Baker lutherba...@gmail.com wrote: In my submit handler - I invoke a service to first a) the save category and then b) save the post. I put a message into the feedback panel and add the feedback panel and the drop down to the target. It is off an AjaxFallbackbutton ... so, no, I don't think I've done anything to explicitly detach the model. Is it such that when the original page is initially rendered - the model would have attached and then detached. The user then takes time to fill out the form - and upon submit, the model attaches again where I currently get the form fields ... do some *work* ... and then when I'm finished, detaches again? New ground for me here ... should I explicitly invoke detach() at the beginning of the submit handler ... and then attach() at the end so that the render phase gets new data? Thanks, -Luther On Tue, Jun 9, 2009 at 8:52 AM, Linda van der Pal lvd...@heritageagenturen.nl wrote: Did you explicitly detach the model? Regards, Linda Luther Baker wrote: Quick question regarding a blog engine I'm working on: my user is editing a blog Post and gets to the Category section. Category is implemented with a DropDownChoice and LoadableDetachableModel. For convenience - I also have a simple TextField that, when filled out, implicitly creates a new Category and attaches it to the current Post. For now, I only allow 1 Category per Post. The Category TextField takes precedence over the DropDown. IE: if the user types anything in the Category TextField, that (String) will be looked up, inserted if missing and attached to the Post as a Category. Question: after submitting this entire form (ala AjaxFallbackButton) - I intentionally stay on this page. The Category is added and the Post has been saved ... but I need the Category DropDown to refresh. Since all of this happens ala AjaxFallbackButtons - the process works except, the LoadableDetachableModel attached to the DropDownChoice (obviously) doesn't fire the load method when I add the DropDown to the target (in the submit handler). To clarify, in my submission, I just added a Category and saved the Post and ostensibly, redrawn the DropDownChoice (ie: I've set the OutputMarkupID on the DropDownChoice and attached it to the target in the ajax submit handler) ... but the underlying model isn't actually reloading. Is there something like a 'refresh' method on the LoadableDetachableModel ... or, should I attach it to the target as well? Thanks in advance for any suggestions, -Luther No virus found in this incoming message. Checked by AVG - www.avg.com Version: 8.5.339 / Virus Database: 270.12.59/2165 - Release Date: 06/09/09 05:53:00
Ajax Buttons and Form?
I'm saving a 'Post', like a blog post, and JPA's merge function doesn't update the object in place but rather, returns an object reflecting the new database fields (like id if it were set). In my application, I'd like to manage insert / update by setting this new 'Post' as the model for my form. In this case, Updates have ids ... but the following gives me grief since the Form? is not typed. I can't cast to IModel? - so not sure of the right thing to do here. Thoughts? Here is the form field: final TextFieldString *postId* = new TextFieldString(id); postId.setOutputMarkupId(true); add(postId); Here is my save handler: @Override protected void onSubmit(final AjaxRequestTarget target, final Form? form) { ... // works fine post = (Post) form.getModelObject(); final Post postWithId = postService.save(post); // works fine final IModelPost newModel = new CompoundPropertyModelPost(postWithId); *// 1. I want to use this new 'Post' object but neither of these compile* form.setModel(newModel); form.setModelObject(postWithId); ERROR: The method setModelObject(capture#6-of ?) in the type Formcapture#6-of ? is not applicable for the arguments (Post) *2. This compiles fine but doesn't actually update the id field on screen:* form.setDefaultModelObject(postWithId); target.addComponent(*postId*); *3. Or, instead resetting the model, I can manually set the id field on the existing model - which is all I really want to accomplish in this case: * post = (Post) form.getModelObject(); final Post postWithId = postService.save(post); post.setId(postWithId.getId()); feedbackPanel.add(new SimpleAttributeModifier(class, info)); info(getString(m-successfully-saved)); target.addComponent(feedbackPanel); target.addComponent(postId); This seems to work, updates the id on screen and causes subsequent JPA 'merge' invocations to update instead of insert. As you can see, being an AJAX button, I did have to explicitly render the new id field . So, is there a well-defined approach for this sort of thing? 1 - is there a way I can actually reset the model? 2 - when I reset the DefaultModelObject - the the id isn't rendering to screen - which implies I don't know what the DefaultModelObject actually is. 3 - Is it appropriate to use the Form fields to help discern between updates and inserts - or is there a more appropriate way to manage this within Wicket that I'm missing. My next step is to HIDE the id on the screen - but wanted to make sure that it was indeed a well-received way to even manage this type of update. Thanks, -Luther
wicket:link - wicket:context
I'd like to consider writing a component similar to wicket:link. I don't think wicket:link actually does the dirty work. My cursory view at the source suggests that wicket:link sets a flag and some other classes update the actual path printed to the page. Is this an established or documented pattern that I could follow for implementing something like wicket:context? I have WIA but didn't recognize this type of component discussed. Igor mentioned: it may be helpful to create wicket:context analog of wicket:link, we already have the framework for getting the path prefix to get to contextpath Likely it is obvious - but would someone be able to briefly elaborate on the 'framework' Igor mentions here ... or anyone care to map out a high level class or object blueprint of what I might look at or how to make this happen? Any suggestions would be appreciated. Thanks, -Luther
Re: Dynamic green or red UL background for FeedbackPanel
Thanks ... I will try to apply a behavior ... -Luther On Fri, Jun 5, 2009 at 1:02 AM, Jeremy Thomerson jer...@wickettraining.comwrote: You actually could - write a behavior that runs through the messages that the FP will be displaying and set the class based on it. Or subclass FP and do the same. -- Jeremy Thomerson http://www.wickettraining.com On Fri, Jun 5, 2009 at 12:53 AM, Luther Baker lutherba...@gmail.com wrote: Yep - that is what I'm asking - and Javascript would be fine. I guess it'd also be nice if, say, I could do something directly in Java. Explicitly apply a behavior or something specific to the FeedbackPanel to set or override the CSS class attribute. Thanks Jeremy, -Luther On Fri, Jun 5, 2009 at 12:02 AM, Jeremy Thomerson jer...@wickettraining.com wrote: Use javascript. First, style your LI elements to the appropriate color. That gives the default. Then when the page loads, you can check to see if they are all error (in which case they'd all already be red). I guess what you're saying is that if ANY of them are an error message, that you want the whole UL to be red? If so, you could do that in JS. -- Jeremy Thomerson http://www.wickettraining.com On Thu, Jun 4, 2009 at 11:58 PM, Luther Baker lutherba...@gmail.com wrote: I have a minor question regarding the FeedbackPanel. I'd like to have the panel display a subtle red background on ERROR and a subtle green background on INFO. Obviously there can be more than one LI - but assuming its all errors or info ... using css on the LI isn't enough. For instance, the LI bullet shows up outside of the LI background. The css background color therefore needs to be on the UL of the resulting: ul wicket:id=feedbackul class=feedbackPanel li wicket:id=messages class=feedbackPanelINFO span wicket:id=message class=feedbackPanelINFOLogin failed. Please try again./span /li /ul Unfortunately, error or info, I the FeedbackPanel only uses feedbackPanel as the style and can't really make the background consistent with the general notice being displayed. Is there an easy way around this? I guess I want to make the UL green or red, depending on the type of message being displayed (understanding that more than one type can be displayed). -Luther - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Dynamic green or red UL background for FeedbackPanel
This worked out for me: *html* div wicket:id=feedbackPanel[feedback]/div *Java* final Panel panel = new FeedbackPanel(feedbackPanel); ... and then as necessary panel.add(new SimpleAttributeModifier(class, info)); or panel.add(new SimpleAttributeModifier(class, error)); etc ... *css* ul.feedbackPanel { /* default color scheme */ border: 1px solid #099; background-color: #eff; color: #099; } div.error ul.feedbackPanel { /* color scheme on explicit error */ background-color: #fee; border: 1px solid #900; color: #900; } div.info ul.feedbackPanel { /* color scheme on explicit info */ border: 1px solid #090; background-color: #efe; color: #090; } On Fri, Jun 5, 2009 at 1:14 AM, Luther Baker lutherba...@gmail.com wrote: Thanks ... I will try to apply a behavior ... -Luther On Fri, Jun 5, 2009 at 1:02 AM, Jeremy Thomerson jer...@wickettraining.com wrote: You actually could - write a behavior that runs through the messages that the FP will be displaying and set the class based on it. Or subclass FP and do the same. -- Jeremy Thomerson http://www.wickettraining.com On Fri, Jun 5, 2009 at 12:53 AM, Luther Baker lutherba...@gmail.com wrote: Yep - that is what I'm asking - and Javascript would be fine. I guess it'd also be nice if, say, I could do something directly in Java. Explicitly apply a behavior or something specific to the FeedbackPanel to set or override the CSS class attribute. Thanks Jeremy, -Luther On Fri, Jun 5, 2009 at 12:02 AM, Jeremy Thomerson jer...@wickettraining.com wrote: Use javascript. First, style your LI elements to the appropriate color. That gives the default. Then when the page loads, you can check to see if they are all error (in which case they'd all already be red). I guess what you're saying is that if ANY of them are an error message, that you want the whole UL to be red? If so, you could do that in JS. -- Jeremy Thomerson http://www.wickettraining.com On Thu, Jun 4, 2009 at 11:58 PM, Luther Baker lutherba...@gmail.com wrote: I have a minor question regarding the FeedbackPanel. I'd like to have the panel display a subtle red background on ERROR and a subtle green background on INFO. Obviously there can be more than one LI - but assuming its all errors or info ... using css on the LI isn't enough. For instance, the LI bullet shows up outside of the LI background. The css background color therefore needs to be on the UL of the resulting: ul wicket:id=feedbackul class=feedbackPanel li wicket:id=messages class=feedbackPanelINFO span wicket:id=message class=feedbackPanelINFOLogin failed. Please try again./span /li /ul Unfortunately, error or info, I the FeedbackPanel only uses feedbackPanel as the style and can't really make the background consistent with the general notice being displayed. Is there an easy way around this? I guess I want to make the UL green or red, depending on the type of message being displayed (understanding that more than one type can be displayed). -Luther - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Dynamic green or red UL background for FeedbackPanel
I have a minor question regarding the FeedbackPanel. I'd like to have the panel display a subtle red background on ERROR and a subtle green background on INFO. Obviously there can be more than one LI - but assuming its all errors or info ... using css on the LI isn't enough. For instance, the LI bullet shows up outside of the LI background. The css background color therefore needs to be on the UL of the resulting: ul wicket:id=feedbackul class=feedbackPanel li wicket:id=messages class=feedbackPanelINFO span wicket:id=message class=feedbackPanelINFOLogin failed. Please try again./span /li /ul Unfortunately, error or info, I the FeedbackPanel only uses feedbackPanel as the style and can't really make the background consistent with the general notice being displayed. Is there an easy way around this? I guess I want to make the UL green or red, depending on the type of message being displayed (understanding that more than one type can be displayed). -Luther
Re: Dynamic green or red UL background for FeedbackPanel
Yep - that is what I'm asking - and Javascript would be fine. I guess it'd also be nice if, say, I could do something directly in Java. Explicitly apply a behavior or something specific to the FeedbackPanel to set or override the CSS class attribute. Thanks Jeremy, -Luther On Fri, Jun 5, 2009 at 12:02 AM, Jeremy Thomerson jer...@wickettraining.com wrote: Use javascript. First, style your LI elements to the appropriate color. That gives the default. Then when the page loads, you can check to see if they are all error (in which case they'd all already be red). I guess what you're saying is that if ANY of them are an error message, that you want the whole UL to be red? If so, you could do that in JS. -- Jeremy Thomerson http://www.wickettraining.com On Thu, Jun 4, 2009 at 11:58 PM, Luther Baker lutherba...@gmail.com wrote: I have a minor question regarding the FeedbackPanel. I'd like to have the panel display a subtle red background on ERROR and a subtle green background on INFO. Obviously there can be more than one LI - but assuming its all errors or info ... using css on the LI isn't enough. For instance, the LI bullet shows up outside of the LI background. The css background color therefore needs to be on the UL of the resulting: ul wicket:id=feedbackul class=feedbackPanel li wicket:id=messages class=feedbackPanelINFO span wicket:id=message class=feedbackPanelINFOLogin failed. Please try again./span /li /ul Unfortunately, error or info, I the FeedbackPanel only uses feedbackPanel as the style and can't really make the background consistent with the general notice being displayed. Is there an easy way around this? I guess I want to make the UL green or red, depending on the type of message being displayed (understanding that more than one type can be displayed). -Luther - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: OT: ESB
No experience with Camel but have a bit of Mule experience. It has a few buggy spots but we've managed to work around them ... (ActiveMQ is not without its share of bugs ...) Mule requires you to sign up on their website for access to any significant information ... after which, they will call you to see what they can 'do' for you. They publish a couple of ESB books - but if you go Mule, I'd highly recommend Manning's latest book dedicated to Mule. The online edition is available at: http://www.manning.com/dossot/ -Luther 2009/6/3 Łukasz Lipka lukasz.lipka.develo...@gmail.com I am used Mule in few projects, and it was quite easy to configure to client needs. It would be my choice but I haven't worked with Camel + service MIx. Best regards, -- Pozdrowienia Łukasz Lipka http://lukaszlipka.blogspot.com/ 2009/6/3 Nick Heudecker nheudec...@gmail.com: I'm currently using Camel standalone, but we'll be moving to Camel+ServiceMix shortly. I've used Mule as a client on a previous project and found it brittle and confusing. That's just my experience though; I know other people that swear by it. On Wed, Jun 3, 2009 at 9:37 AM, Scott Swank scott.sw...@gmail.com wrote: Warning: Off Topic Has anyone worked with an open source ESB, and if so do you particularly like or dislike your choice? Please respond to me off the list, though of course if anyone wants a brief synopsis of what I pull together I'll gladly post it back to the list or send it outside of the list. I am specifically considering: Camel Mule ServiceMix Since we are not willing to move to NetBeans Glassfish we have eliminated OpenESB. And from a brief survey of google results no one really seems to like JBoss ESB so we're not investigating it further unless new information otherwise motivates us. Sorry for the noise. Best, Scott - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- Nick Heudecker Professional Wicket Training Consulting http://www.systemmobile.com - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Does Link work with browser BACK button?
Ah - thanks both of you. Category was still pretty much a POJO @Entity public class Category { *This fixed it:* @Entity public class Category implements Serializable { private static final long serialVersionUID = 1L; Thanks, -Luther On Sun, May 31, 2009 at 11:20 AM, Igor Vaynberg igor.vaynb...@gmail.comwrote: agreed it sounds like a serialization error, check your logs. webpage is already serializable so no need to do it there. something else you are holding a reference to must not be serializable. -igor On Sun, May 31, 2009 at 9:11 AM, joeinazusa hill...@gmail.com wrote: Yes it does. Sounds like to you need to implement serializable in your class. public class YourClass extends WebPage implements Serializable { luther.baker wrote: For this example, I have a 'blog' like front page. On this page are several posts that each, have an associated category and multiple tags. I am in the prototype/design phase right now (simply hard coding the posts and corresponding references in the Java class). *Use Case 1: *1. visit the front page and click on a 'category' link (correctly takes me to the 'CategoryPage'). 2. from the 'CategoryPage', click on the 'Home' link (correctly takes me back to the front page). 3. from font page, click on any of the three 'category' links (correctly takes me to the 'CategoryPage'). *Use Case 2: *1. visit the front page and click on a 'category' link (correctly takes me to the 'CategoryPage'). 2. from the 'CategoryPage', click *BACK BUTTON in the browser* 3. from font page, click on any of the three 'category' links (crash!) Page Expired The page you requested has expired. Return to home page http://localhost:8089/effprog/ Thanks, -Luther *Code* *Relevant markup: * dl class=post dt class=titleh4Wicket and Legos/h4/dt dd class=tagsstrong # [web frameworks] /strong: wicket/dd dd class=content Wicket makes things so easy. Make a change and you can see all the obvious things break. Its much more like putting together a lego set. Things just fit into place. /dd dd class=dateline2009/05/26 Luther Baker/dd /dl *and the Java: * public HomePage() { super(new ResourceModel(head-title)); Category category = new Category(); category.setName(web-frameworks); addCategoryLink(a-category-1, category); addCategoryLink(a-category-2, category); category = new Category(); category.setName(mac-desktop); addCategoryLink(a-category-3, category); } private void addCategoryLink(final String key, final Category category) { final LinkVoid link = new LinkVoid(key) { private static final long serialVersionUID = 1L; @Override public void onClick() { final CategoryPage categoryPage = new CategoryPage(category); setResponsePage(categoryPage); } }; add(link); } -- View this message in context: http://www.nabble.com/Does-Link-work-with-browser-BACK-button--tp23804447p23804483.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 - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Spring Autowired and @SpringBean
I'm using the following from the wicket spring page: public class MainApplication extends WebApplication { /** * @see org.apache.wicket.protocol.http.WebApplication#init() */ @Override protected void init() { super.init(); // http://cwiki.apache.org/WICKET/spring.html final SpringComponentInjector spring = new SpringComponentInjector(this); addComponentInstantiationListener(spring); } and spring indeed is wiring up the daos and services. The @Service beans are correctly receieving their @Respository dependencies. It is just the wicket page '@SpringBean' annotation don't seem to be able to fine the beans annotated with @Service. Is it possible that @Autowire doesn't work with @SpringBean and that I need to explicitly list dependencies in a config file? -Luther On Sun, May 31, 2009 at 3:55 PM, Igor Vaynberg igor.vaynb...@gmail.comwrote: have you read the wicket spring wiki page? you have to install the spring component injector for this to work. -igor On Sun, May 31, 2009 at 1:15 PM, Luther Baker lutherba...@gmail.com wrote: I'm working on a project with Spring/Wicket integration. I have most of the Spring autowire stuff working ... My @Repository(s) are successfully autowires to my @Service(s). In SpringMVC speak then, the @Service would autowire to the *...@controller*. But of course, I am using wicket, not Spring MVC. Per the wicket/spring doc pagehttp://cwiki.apache.org/WICKET/spring.html, which describes the *...@springbean* annotation, as opposed to the *...@controller * annotation, in my pages. Unfortunately, I get an error and the stack trace includes: Caused by: java.lang.IllegalStateException: bean of type [org.effectiveprogramming.effprog.service.PostService] not found Is this expected? Before deep diving I'm curious to confirm that spring-wicket integration is definitely supposed to work with Spring autowiring. Thoughts? Thanks. -Luther @Repository public class PostDaoImpl extends PostDao { ... } @Service public class PostServiceImpl implements PostService { ... @Autowired public void setPostDao(final PostDao postDao) { this.postDao = postDao; } } public class HomePage extends BasicLayout { @SpringBean private PostService postService; - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Long content
I'm working on an application something akin to blog posts. A 'Post' has a title, date, tags, a category ... and *content*. For most of the 'smaller' properties in a 'Post', I use a Label as the component and that works just fine - but for much larger datasets, say, content, I feel odd using something called 'Label'. Is there a more precise Wicket Component for, what could amount to hundreds of words or lines? (see below) (By the way, kudos on the DateLabel and everything else in wicket-date project - I just came across that ...) Thanks, -Luther final Post post = postService.findPostById(postId); final IModelPost postModel = new CompoundPropertyModelPost(post); final WebMarkupContainer outer = new WebMarkupContainer(post, postModel); outer.add(new Label(title)); outer.add(new BookmarkablePageLinkVoid(category, CategoryPage.class)); *outer.add(new Label(content));* outer.add(new DateLabel(publishedOn, new StyleDateConverter(M-, true))); add(outer);
Re: Long content
Ah, thanks for the suggestion Vasu. I looked at this component and don't think I'm looking to have '\n' replaced or br/'s and p/'s automatically generated. In my case, most cases, Post content might include some paragraphs, blockquotes, pictures and a few more paragraphs. After a blog entry, there might be a few comments - maybe someone will post some code examples ... so Post.content and Post.comments[n] might just be somewhat long strings/database fields. For what it's worth, *Label* works just fine in my little mock up - but again, Post.content doesn't really *feel* like a Label so it gave me room for pause. Thanks for the quick response Vasu. -Luther On Sun, May 31, 2009 at 10:49 PM, Vasu Srinivasan vasy...@gmail.com wrote: How about MultiLineLabel ? On Sun, May 31, 2009 at 10:43 PM, Luther Baker lutherba...@gmail.com wrote: I'm working on an application something akin to blog posts. A 'Post' has a title, date, tags, a category ... and *content*. For most of the 'smaller' properties in a 'Post', I use a Label as the component and that works just fine - but for much larger datasets, say, content, I feel odd using something called 'Label'. Is there a more precise Wicket Component for, what could amount to hundreds of words or lines? (see below) (By the way, kudos on the DateLabel and everything else in wicket-date project - I just came across that ...) Thanks, -Luther final Post post = postService.findPostById(postId); final IModelPost postModel = new CompoundPropertyModelPost(post); final WebMarkupContainer outer = new WebMarkupContainer(post, postModel); outer.add(new Label(title)); outer.add(new BookmarkablePageLinkVoid(category, CategoryPage.class)); *outer.add(new Label(content));* outer.add(new DateLabel(publishedOn, new StyleDateConverter(M-, true))); add(outer); -- Regards, Vasu Srinivasan
Re: Wicket Quickstart vs WIA eclipse projects: why so different?
For what its worth, I run a few Wicket 1.4x projects as within Eclipse/m2plugin and pages, etc refresh just fine. I use the Run/Debug Configurations and create a Maven application and then select the jetty plugin, correct workspace and jetty:run command. There are also Jetty options you can include directly in the POM file that define how and when Jetty should regularly will scan the deployed files ... restarting Jetty if changes detected. What I've described is too different mechanisms for picking up changes ... is that what you're asking for? -Luther On Sat, May 30, 2009 at 7:53 AM, Ben Tilford bentilf...@gmail.com wrote: Something that may be worth trying is mvn jetty:run-exploded On Fri, May 29, 2009 at 6:10 PM, Igor Vaynberg igor.vaynb...@gmail.com wrote: like i said, the best way is to right click the Start class and do run as java application. you can, of course, do it any other way you like - including installing jetty eclipse launcher plugin. -igor On Fri, May 29, 2009 at 3:17 PM, David Brown dbr...@sexingtechnologies.com wrote: Hello Igor, thanks for the reply. Can I just ignore the QuickStart embedded jetty and install jetty on Eclipse then do a run-as without any issues? Please advise, David. - Original Message - From: Igor Vaynberg igor.vaynb...@gmail.com To: users@wicket.apache.org Cc: david da...@davidwbrown.name Sent: Friday, May 29, 2009 4:51:02 PM GMT -06:00 US/Canada Central Subject: Re: Wicket Quickstart vs WIA eclipse projects: why so different? why dont you just start the project from eclipse directly using the Start class, that way you get debug and hotswap - which should be the real student's dream :) -igor On Fri, May 29, 2009 at 2:53 PM, David Brown dbr...@sexingtechnologies.com wrote: Hello Martin, Jeremy, dev, gurus, users and mortals. I have just finished ch. 13 of the WIA.pdf. I have followed closely the reading using the wicket-in-action eclipse project. I have the wicket-in-action running under the: mvn jetty:run. The wicket-in-action project is redeployed every 60 seconds (a student's dream). After finishing the 13th chapter I decided to leave the nest for the 1.4rc QuickStart. The new QuickStart project expanded and imported into the Eclipse workspace no-problemo. The mystery is what am I doing wrong to get the automatic 60 second re-deploy. As it stands now I have to kill jetty, mvn package and then restart jetty (mvn jetty:run). I have pasted in the: ** context-param param-nameconfiguration/param-name param-valuedevelopment/param-value /context-param ** from the wicket-in-action web.xml but no change. The Windows cmd console shows the usual Wicket WARNING: running in development mode. I plan to use the wicket-in-action almost verbatim including the Hibernate DAO for my current gig. It is probably only a few weeks before they start holding my feet to the fire. Please advise, David. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
wicket logo
Is there an official Wicket website badge? Any problems with dropping the orange Wicket logo into a Power By Wicket slogan at the bottom of a site? -Luther
Re: Storing css and image files
Hi Steve, Continue your example and mount a url to an existing page that extends BasePage: mountBookmarkablePage(/im/going/home, About.class); and tell me what happens to your js and css references when you visit that url. Hope that helps, -Luther On Wed, May 27, 2009 at 7:20 AM, Steve Swinsburg s.swinsb...@lancaster.ac.uk wrote: I don't see the issue that you all seem to be experiencing but I can offer some advice: CSS, Javascript, images etc should be stored in the webapp directory NOT mixed in with the rest of the classes and HTML. Your CSS can then get at them easily if you are using any background images etc. Martijn mentioned this and its a valid point, you can then unmount the directories and let the web server serve them statically rather than Tomcat serve them which takes up threads. You can use an IHeaderContributor to add any CSS or Javascript references into the HTML header: public class BasePage extends WebPage implements IHeaderContributor { public void renderHead(IHeaderResponse response) { response.renderCSSReference(css/jquery.cluetip.css); response.renderJavascriptReference(javascript/jquery.dimensions.js); response.renderJavascriptReference(javascript/jquery.hoverIntent.js); response.renderJavascriptReference(javascript/jquery.cluetip.js); } If you need to add any images in your page, use a ContextImage which is relative to the context always. I tend to use a BasePage which setups the header and have my other pages extend BasePage you might find it useful as well. cheers, Steve On 27 May 2009, at 06:40, Luther Baker wrote: On Tue, May 26, 2009 at 11:43 PM, Vasu Srinivasan vasy...@gmail.com wrote: @Luther: Yes - I'm using the ImageButton it to submit a form. Thanks for the suggestion to use the modifier. I will try that. Great. I think it should work for you. On a side note, I thought that having the images/css/js etc served from webserver is pretty common and would be supported by wicket without having to add the names within java code. If I had to guess ... it is probably just a matter of time. There are probably a lot of design and Wicket Way considerations the team iterates through and prioritizes. I think cases like yours bring some of these usage points into clearer focus after-which, maybe they'll get some traction. My guess is that these folks are pretty busy and that there are probably 10s of 100s of similar requests in the queue - so just need some time ... or bodies :) I understand the reasoning behind using new ResourceReference as it makes loading locale specific images very simple. But why should wicket prepend classpath etc. -- i'm not clear on that. Can't wicket simply ignore the src attribute if ResourceReference is not present and use whatever was already in the html template? That way I do not have to specify the image name within the java code and the separation between java and html is clean. It sounds reasonable to me - but I'm not knee deep in the code either/yet. -Luther
Re: Storing css and image files
Admittedly, I think this is slightly out of context here ... but a few days back, Martijn posted (no bashing intended - I try to adhere to this): There is no sane reason why anyone would put the html, js, css and properties resources in any place except *next* to the corresponding.java file. Your .java file can not function without the .html file. Your component will fail if the .properties file is not available. When the js file can't be found your component is useless. Wicket goes beyond the call of duty to provide developers with the means to encapsulate your components, bringing Object Oriented design and programming to the web tier. Moving the necessary resources outside the package folder into a separate directory structure breaks this encapsulation is definitely not the Wicket Way (tm). http://osdir.com/ml/users-wicket.apache.org/2009-03/msg01100.html On Wed, May 27, 2009 at 8:36 AM, Luther Baker lutherba...@gmail.com wrote: Hi Steve, Continue your example and mount a url to an existing page that extends BasePage: mountBookmarkablePage(/im/going/home, About.class); and tell me what happens to your js and css references when you visit that url. Hope that helps, -Luther On Wed, May 27, 2009 at 7:20 AM, Steve Swinsburg s.swinsb...@lancaster.ac.uk wrote: I don't see the issue that you all seem to be experiencing but I can offer some advice: CSS, Javascript, images etc should be stored in the webapp directory NOT mixed in with the rest of the classes and HTML. Your CSS can then get at them easily if you are using any background images etc. Martijn mentioned this and its a valid point, you can then unmount the directories and let the web server serve them statically rather than Tomcat serve them which takes up threads. You can use an IHeaderContributor to add any CSS or Javascript references into the HTML header: public class BasePage extends WebPage implements IHeaderContributor { public void renderHead(IHeaderResponse response) { response.renderCSSReference(css/jquery.cluetip.css);response.renderJavascriptReference( javascript/jquery.dimensions.js); response.renderJavascriptReference(javascript/jquery.hoverIntent.js); response.renderJavascriptReference(javascript/jquery.cluetip.js); } If you need to add any images in your page, use a ContextImage which is relative to the context always. I tend to use a BasePage which setups the header and have my other pages extend BasePage you might find it useful as well. cheers, Steve On 27 May 2009, at 06:40, Luther Baker wrote: On Tue, May 26, 2009 at 11:43 PM, Vasu Srinivasan vasy...@gmail.com wrote: @Luther: Yes - I'm using the ImageButton it to submit a form. Thanks for the suggestion to use the modifier. I will try that. Great. I think it should work for you. On a side note, I thought that having the images/css/js etc served from webserver is pretty common and would be supported by wicket without having to add the names within java code. If I had to guess ... it is probably just a matter of time. There are probably a lot of design and Wicket Way considerations the team iterates through and prioritizes. I think cases like yours bring some of these usage points into clearer focus after-which, maybe they'll get some traction. My guess is that these folks are pretty busy and that there are probably 10s of 100s of similar requests in the queue - so just need some time ... or bodies :) I understand the reasoning behind using new ResourceReference as it makes loading locale specific images very simple. But why should wicket prepend classpath etc. -- i'm not clear on that. Can't wicket simply ignore the src attribute if ResourceReference is not present and use whatever was already in the html template? That way I do not have to specify the image name within the java code and the separation between java and html is clean. It sounds reasonable to me - but I'm not knee deep in the code either/yet. -Luther
Re: Storing css and image files
The clean way in my case is as Steve suggested , to use css to display the image for button. Thanks for all the inputs. Sorry this has dragged out a bit. In my case, I am not sharing static resources across apps. I'm just looking at the best way for each page in my application to retrieve each of the core, application-wide, application-specific, static resource files (js, css, gif, jpg, etc). I might have common.css, header.css, footer.css. Maybe that falls under keep it with the source -- which works just fine / albeit somewhat limiting. So maybe the point is moot and wicket:link/ is the solution for my case. I think physically dropping files in webapp/**/*.css is just fine. I'm really just suggesting the idea of making a robust, infallible way to refer to them that can be written and included just once (in an abstract BaseLayoutPage) and never talked about again :) ... and was entertaining the idea of using the webapp/ directory for this. The suggested IHeaderContributor solution has a few problems in my case. If a developer adds a page 6 mos from now and mounts it to a new, arbitrary URL, */products/cable/offer* - I'd like the css files to all show up - automatically. Unfortunately, IHeaderContributor will not dynamically refer to the original css/styles.css pages. The paths are just echo'd as entered which means ... the single css isn't found. My other made up example - if Wicket (for whatever reason) decides that 1.5 should default to RESTful URLs, would also break anywhere people were hardcoding link href=css/styles.css ... since the new RESTful URLs wouldn't look in the proper location. On the other hand, wicket:link/ continues to work through all of these changes - with no effort or manual management. My initial posts/examples were around c:url value=/css/styles.css/ when included on base base pages, always works no matter what page the user has navigated to ... no matter how deep or shallow the url is. It creates an ABSOLUTE path that simply prepends the context the app is deployed to (which, is free to change or go to root). For what its worth, I think that provides some amount of value to my app. For my specific case, I think Igor's suggestion of a tag like wicket:context/ hit the nail on the head. I can't tell if the other suggestions here are just workarounds or really trying to address my specific use case. IHeaderContribute (thanks for including) doesn't actually do much more than hardcode a fixed path in the markup. Incidentally, I looked - and man, there are alot of pieces to wicket:link/ :-) Is there an online tutorial for, not just writing components, but implementing a markup component like wicket:link/? A ... thanks, -Luther
Re: Storing css and image files
On Tue, May 26, 2009 at 4:41 AM, Martijn Dashorst martijn.dasho...@gmail.com wrote: Why wouldn't it be a viable solution? It gives you the opportunity to let the resources be served by your container, which should be speedier than letting wicket handle it (such requests are filtered through and go to your container). Yep. The relative paths are just that: relative, and they always map to the absolute same resource URI. I think I'm missing something here. If one uses the regular webapp location to storee css, as I mentioned, http://localhost/a/b requesting css/styles.css will request a different file than http://localhost/a/NOTbrequesting the same css/styles.css. Relative paths will NOT map to the same absolute resource URI. IN the first example, the file webapps/a/b/css/styles.css is retrieved. In the second example, webapp/a/NOTb/css/styles.css is retrieved. In both files, I've used the link href=css/styles.css ... In fact, they are more stable than serving things from your classpath, as those resources are served from the path /context/resources/, and if we decide to call that path /context/foobar/ all your reasoning about stability goes out the window. Ahh I thought quite the opposite. If I have files src/main/java/a/b/Page.java src/main/resources/a/b/Page.html src/main/resources/a/b/css/styles.css and Page.html includes this: wicket:link link rel=stylesheet type=text/css href=css/standard/common.css / link rel=stylesheet type=text/css href=css/standard/header.css / /wicket:link it turns into this: link rel=stylesheet type=text/css href=resources/org.effectiveprogramming.effprog.web.markup.layout.BasicLayout/css/standard/common.css/ which always works. In my eyes, I am giving Wicket just enought information to find my css files. How Wicket decides to encode the wicket:link/ code is none of my business. As long as the contract is adhered to. I give it a very small relative link path in my resources hierarchy and Wicket encodes that and will ALWAYS find it. If Wicket decides to change how wicket:link/ encodes a resource (changes /context/resources to /context/foobar/) that is fine with me - as long as Wicket keeps reading in the resources correctly. You imply that, given my aforemetioned files, wicket:link link rel=stylesheet type=text/css href=css/standard/common.css / link rel=stylesheet type=text/css href=css/standard/header.css / /wicket:link would break if Wicket changed /context/resources to /context/foobar ... and thats not what I expected. I complete agree with the 'performance' point ... and maybe I just misundertstand your perspective but directly using the link rel=stylesheet type=text/css href=css/standard/common.css / and fetching pages from webapp/ seems much more volatile to me than using wicket:link link rel=stylesheet type=text/css href=css/standard/common.css / /wicket:link which will be encoded however wicket pleases and always served up from a path relative to the resource including it. -Luther I don't code /context/resources Martijn On Mon, May 25, 2009 at 6:38 PM, Luther Baker lutherba...@gmail.com wrote: **On Mon, May 25, 2009 at 2:34 AM, Martijn Dashorst martijn.dasho...@gmail.com wrote: or, if these images and css are for your application, and application wide (i.e. all pages include them), you could put them in src/main/webapp/.. and just link src=style.css ... / them in your markup. Martijn I'd like to pose a design/theoratical thought here I understand that wicket:link/ does the right thing for resources (like stylesheets) kept in the classpath. I love this behavior. But, as we know, depending on where my browser URL points, the following: link href=css/styles.css .../ resolves to different locations. For instance, said stylesheet referenced from: http://hostname/context/products/wires/24 physically resolves to (mavenized) webapps/*products/wires*/css/styles.css, whereas from http://hostname/context/people/hr/judy resolves to webapps/*people/hr/judy*/css/styles.css (In part, this is due to our effort NOT to hardcode the context into the link's href.) *Traditionally, I solved this one of three ways:* 1. Manually manage every application URL and every mapped file and make sure that in all cases the relative path is correct. Ugh! For obvious reasons - this technique is not maintainable. Large apps back in the early days of Struts with hundreds of actions and JSPs, this just wasn't fun. 2. JSTL came along and I started to leverage the c:url tag. For the most part, that was a workable solution - the resulting path was 'absolute' but it wasn't hardcoded. Essentially, it gives the framework a chance to work its magic (if it were to change somehow). 3. Today, I use the resource
Re: Storing css and image files
I like that idea! On Tue, May 26, 2009 at 10:33 AM, Igor Vaynberg igor.vaynb...@gmail.comwrote: it may be helpful to create wicket:context analog of wicket:link, we already have the framework for getting the path prefix to get to context path. this is of course only useful for application-specific resources as those will not be reused across projects. in our case our SA extracts the war and copies everything but WEB-INF to apache so all those static application resources can be served there. -igor On Tue, May 26, 2009 at 2:41 AM, Martijn Dashorst martijn.dasho...@gmail.com wrote: Why wouldn't it be a viable solution? It gives you the opportunity to let the resources be served by your container, which should be speedier than letting wicket handle it (such requests are filtered through and go to your container). The relative paths are just that: relative, and they always map to the absolute same resource URI. In fact, they are more stable than serving things from your classpath, as those resources are served from the path /context/resources/, and if we decide to call that path /context/foobar/ all your reasoning about stability goes out the window. Martijn On Mon, May 25, 2009 at 6:38 PM, Luther Baker lutherba...@gmail.com wrote: **On Mon, May 25, 2009 at 2:34 AM, Martijn Dashorst martijn.dasho...@gmail.com wrote: or, if these images and css are for your application, and application wide (i.e. all pages include them), you could put them in src/main/webapp/.. and just link src=style.css ... / them in your markup. Martijn I'd like to pose a design/theoratical thought here I understand that wicket:link/ does the right thing for resources (like stylesheets) kept in the classpath. I love this behavior. But, as we know, depending on where my browser URL points, the following: link href=css/styles.css .../ resolves to different locations. For instance, said stylesheet referenced from: http://hostname/context/products/wires/24 physically resolves to (mavenized) webapps/*products/wires*/css/styles.css, whereas from http://hostname/context/people/hr/judy resolves to webapps/*people/hr/judy*/css/styles.css (In part, this is due to our effort NOT to hardcode the context into the link's href.) *Traditionally, I solved this one of three ways:* 1. Manually manage every application URL and every mapped file and make sure that in all cases the relative path is correct. Ugh! For obvious reasons - this technique is not maintainable. Large apps back in the early days of Struts with hundreds of actions and JSPs, this just wasn't fun. 2. JSTL came along and I started to leverage the c:url tag. For the most part, that was a workable solution - the resulting path was 'absolute' but it wasn't hardcoded. Essentially, it gives the framework a chance to work its magic (if it were to change somehow). 3. Today, I use the resource method (wicket:link/) which obviates all anxiety by simply letting the framework just manage it. So to your point Martijn, is using webapp/css and directly including link href=css/styles.css .../ really a good - viable, long-term solution in Wicket apps? Understandably maybe today, the default URL mapper in Wicket uses query strings and not deep or hierarchical urls - but the important term for me here is today. What if, in the future, wicket decides to change the default URL mapping scheme - maybe become more RESTful. The inertia built up around legacy apps using webapp/css may pose a problem. I don't think this is premature functionality ... I think links and urls are a here a now thing and that building and migrating apps to future versions of frameworks is hard and that a loose practice here may come back to bite a developer ... ? Also, I've not yet mounted urls but I assume if I were to mount URLs - I'd have to really manage this webapp/css approach - whereas, the resource approach with wicket:link/ would just keep humming along. Some may argue that it isn't really *better* to provide multiple ways to do the same thing ... take Tapestry for instance and the technical relevance as to where markup files can or cannot reside. This post is indeed a bit philosophical/theoretical - I've often thought about this topic and wanted to clarify in my mind that maybe, these are either moot points, ignored concerns, overthinking on my part ... or just not important somehow. As I mentioned, this little detail has always been a pain point in my previous work and I've just been happy as a lark to use the wicket:link/ which protects me from whatever the future provides. I'm just surprised it isn't the suggested best practice or that dropping files into webapp/* is *ill*-advised since it assumes something about how Wicket works. Thanks
Re: Storing css and image files
You may have to look at this case by case ... In this example, what are you doing with the input field? Submitting a form? Were that the case, how about using a raw input tag and moving any wicket logic to the submit handler? -Luther On Tue, May 26, 2009 at 6:02 PM, Vasu Srinivasan vasy...@gmail.com wrote: I too have been trying to find the right way about where to put the resources (image, css, js). I work in an environment where the images/css/js are maintained by a separate team and is in apache server as they are reused across several apps/projects in different app servers. So putting it as part of the application is a no-no (src/main/resources or src/main/webapp etc.) . It doesn't work that way though -- I tried using a ImageButton without passing the new ResourceReference() in the constructor. My html is like: input type=image wicket:id=imageId src=/images/button.gif / Wicket replaces the html with input type=image src=resources/.//images/button.gif / and obviously does not find it. Is there a clean way out of this? (ie not prepend resources/... etc) Thanks! Vasya On Tue, May 26, 2009 at 12:40 PM, Luther Baker lutherba...@gmail.com wrote: I like that idea! On Tue, May 26, 2009 at 10:33 AM, Igor Vaynberg igor.vaynb...@gmail.com wrote: it may be helpful to create wicket:context analog of wicket:link, we already have the framework for getting the path prefix to get to context path. this is of course only useful for application-specific resources as those will not be reused across projects. in our case our SA extracts the war and copies everything but WEB-INF to apache so all those static application resources can be served there. -igor On Tue, May 26, 2009 at 2:41 AM, Martijn Dashorst martijn.dasho...@gmail.com wrote: Why wouldn't it be a viable solution? It gives you the opportunity to let the resources be served by your container, which should be speedier than letting wicket handle it (such requests are filtered through and go to your container). The relative paths are just that: relative, and they always map to the absolute same resource URI. In fact, they are more stable than serving things from your classpath, as those resources are served from the path /context/resources/, and if we decide to call that path /context/foobar/ all your reasoning about stability goes out the window. Martijn On Mon, May 25, 2009 at 6:38 PM, Luther Baker lutherba...@gmail.com wrote: **On Mon, May 25, 2009 at 2:34 AM, Martijn Dashorst martijn.dasho...@gmail.com wrote: or, if these images and css are for your application, and application wide (i.e. all pages include them), you could put them in src/main/webapp/.. and just link src=style.css ... / them in your markup. Martijn I'd like to pose a design/theoratical thought here I understand that wicket:link/ does the right thing for resources (like stylesheets) kept in the classpath. I love this behavior. But, as we know, depending on where my browser URL points, the following: link href=css/styles.css .../ resolves to different locations. For instance, said stylesheet referenced from: http://hostname/context/products/wires/24 physically resolves to (mavenized) webapps/*products/wires*/css/styles.css, whereas from http://hostname/context/people/hr/judy resolves to webapps/*people/hr/judy*/css/styles.css (In part, this is due to our effort NOT to hardcode the context into the link's href.) *Traditionally, I solved this one of three ways:* 1. Manually manage every application URL and every mapped file and make sure that in all cases the relative path is correct. Ugh! For obvious reasons - this technique is not maintainable. Large apps back in the early days of Struts with hundreds of actions and JSPs, this just wasn't fun. 2. JSTL came along and I started to leverage the c:url tag. For the most part, that was a workable solution - the resulting path was 'absolute' but it wasn't hardcoded. Essentially, it gives the framework a chance to work its magic (if it were to change somehow). 3. Today, I use the resource method (wicket:link/) which obviates all anxiety by simply letting the framework just manage it. So to your point Martijn, is using webapp/css and directly including link href=css/styles.css .../ really a good - viable, long-term solution in Wicket apps? Understandably maybe today, the default URL mapper in Wicket uses query strings and not deep or hierarchical urls - but the important term for me here is today. What if, in the future, wicket decides to change the default URL
Re: Storing css and image files
@Vasu Try overriding the *src* attribute with a SimpleAttributeModifier :-) You'll need to manage your static paths in Java (Constants.IMG_PATH ... etc) ... but it works as expected: final ImageButton submit = new ImageButton(i-thunder); submit.add(new SimpleAttributeModifier(src, img/thunder_medium.jpg)); *results in* input type=image wicket:id=i-thunder *src=**img/thunder_medium.jpg* name=i-thunder id=i_thunder2f/ *instead of* input type=image wicket:id=i-thunder src=resources/org.effectiveprogramming.effprog.web.markup.page.Contact/img/thunder_medium_en_US.jpg name=i-thunder id=i_thunder31/ -Luther On Tue, May 26, 2009 at 9:13 PM, Luther Baker lutherba...@gmail.com wrote: You may have to look at this case by case ... In this example, what are you doing with the input field? Submitting a form? Were that the case, how about using a raw input tag and moving any wicket logic to the submit handler? -Luther On Tue, May 26, 2009 at 6:02 PM, Vasu Srinivasan vasy...@gmail.comwrote: I too have been trying to find the right way about where to put the resources (image, css, js). I work in an environment where the images/css/js are maintained by a separate team and is in apache server as they are reused across several apps/projects in different app servers. So putting it as part of the application is a no-no (src/main/resources or src/main/webapp etc.) . It doesn't work that way though -- I tried using a ImageButton without passing the new ResourceReference() in the constructor. My html is like: input type=image wicket:id=imageId src=/images/button.gif / Wicket replaces the html with input type=image src=resources/.//images/button.gif / and obviously does not find it. Is there a clean way out of this? (ie not prepend resources/... etc) Thanks! Vasya On Tue, May 26, 2009 at 12:40 PM, Luther Baker lutherba...@gmail.com wrote: I like that idea! On Tue, May 26, 2009 at 10:33 AM, Igor Vaynberg igor.vaynb...@gmail.com wrote: it may be helpful to create wicket:context analog of wicket:link, we already have the framework for getting the path prefix to get to context path. this is of course only useful for application-specific resources as those will not be reused across projects. in our case our SA extracts the war and copies everything but WEB-INF to apache so all those static application resources can be served there. -igor On Tue, May 26, 2009 at 2:41 AM, Martijn Dashorst martijn.dasho...@gmail.com wrote: Why wouldn't it be a viable solution? It gives you the opportunity to let the resources be served by your container, which should be speedier than letting wicket handle it (such requests are filtered through and go to your container). The relative paths are just that: relative, and they always map to the absolute same resource URI. In fact, they are more stable than serving things from your classpath, as those resources are served from the path /context/resources/, and if we decide to call that path /context/foobar/ all your reasoning about stability goes out the window. Martijn On Mon, May 25, 2009 at 6:38 PM, Luther Baker lutherba...@gmail.com wrote: **On Mon, May 25, 2009 at 2:34 AM, Martijn Dashorst martijn.dasho...@gmail.com wrote: or, if these images and css are for your application, and application wide (i.e. all pages include them), you could put them in src/main/webapp/.. and just link src=style.css ... / them in your markup. Martijn I'd like to pose a design/theoratical thought here I understand that wicket:link/ does the right thing for resources (like stylesheets) kept in the classpath. I love this behavior. But, as we know, depending on where my browser URL points, the following: link href=css/styles.css .../ resolves to different locations. For instance, said stylesheet referenced from: http://hostname/context/products/wires/24 physically resolves to (mavenized) webapps/*products/wires*/css/styles.css, whereas from http://hostname/context/people/hr/judy resolves to webapps/*people/hr/judy*/css/styles.css (In part, this is due to our effort NOT to hardcode the context into the link's href.) *Traditionally, I solved this one of three ways:* 1. Manually manage every application URL and every mapped file and make sure that in all cases the relative path is correct. Ugh! For obvious reasons - this technique is not maintainable. Large apps back in the early days of Struts with hundreds of actions and JSPs, this just wasn't fun. 2. JSTL came along and I started to leverage the c:url tag. For the most part, that was a workable solution - the resulting path
Re: Storing css and image files
On Tue, May 26, 2009 at 11:43 PM, Vasu Srinivasan vasy...@gmail.com wrote: @Luther: Yes - I'm using the ImageButton it to submit a form. Thanks for the suggestion to use the modifier. I will try that. Great. I think it should work for you. On a side note, I thought that having the images/css/js etc served from webserver is pretty common and would be supported by wicket without having to add the names within java code. If I had to guess ... it is probably just a matter of time. There are probably a lot of design and Wicket Way considerations the team iterates through and prioritizes. I think cases like yours bring some of these usage points into clearer focus after-which, maybe they'll get some traction. My guess is that these folks are pretty busy and that there are probably 10s of 100s of similar requests in the queue - so just need some time ... or bodies :) I understand the reasoning behind using new ResourceReference as it makes loading locale specific images very simple. But why should wicket prepend classpath etc. -- i'm not clear on that. Can't wicket simply ignore the src attribute if ResourceReference is not present and use whatever was already in the html template? That way I do not have to specify the image name within the java code and the separation between java and html is clean. It sounds reasonable to me - but I'm not knee deep in the code either/yet. -Luther
Re: Storing css and image files
**On Mon, May 25, 2009 at 2:34 AM, Martijn Dashorst martijn.dasho...@gmail.com wrote: or, if these images and css are for your application, and application wide (i.e. all pages include them), you could put them in src/main/webapp/.. and just link src=style.css ... / them in your markup. Martijn I'd like to pose a design/theoratical thought here I understand that wicket:link/ does the right thing for resources (like stylesheets) kept in the classpath. I love this behavior. But, as we know, depending on where my browser URL points, the following: link href=css/styles.css .../ resolves to different locations. For instance, said stylesheet referenced from: http://hostname/context/products/wires/24 physically resolves to (mavenized) webapps/*products/wires*/css/styles.css, whereas from http://hostname/context/people/hr/judy resolves to webapps/*people/hr/judy*/css/styles.css (In part, this is due to our effort NOT to hardcode the context into the link's href.) *Traditionally, I solved this one of three ways:* 1. Manually manage every application URL and every mapped file and make sure that in all cases the relative path is correct. Ugh! For obvious reasons - this technique is not maintainable. Large apps back in the early days of Struts with hundreds of actions and JSPs, this just wasn't fun. 2. JSTL came along and I started to leverage the c:url tag. For the most part, that was a workable solution - the resulting path was 'absolute' but it wasn't hardcoded. Essentially, it gives the framework a chance to work its magic (if it were to change somehow). 3. Today, I use the resource method (wicket:link/) which obviates all anxiety by simply letting the framework just manage it. So to your point Martijn, is using webapp/css and directly including link href=css/styles.css .../ really a good - viable, long-term solution in Wicket apps? Understandably maybe today, the default URL mapper in Wicket uses query strings and not deep or hierarchical urls - but the important term for me here is today. What if, in the future, wicket decides to change the default URL mapping scheme - maybe become more RESTful. The inertia built up around legacy apps using webapp/css may pose a problem. I don't think this is premature functionality ... I think links and urls are a here a now thing and that building and migrating apps to future versions of frameworks is hard and that a loose practice here may come back to bite a developer ... ? Also, I've not yet mounted urls but I assume if I were to mount URLs - I'd have to really manage this webapp/css approach - whereas, the resource approach with wicket:link/ would just keep humming along. Some may argue that it isn't really *better* to provide multiple ways to do the same thing ... take Tapestry for instance and the technical relevance as to where markup files can or cannot reside. This post is indeed a bit philosophical/theoretical - I've often thought about this topic and wanted to clarify in my mind that maybe, these are either moot points, ignored concerns, overthinking on my part ... or just not important somehow. As I mentioned, this little detail has always been a pain point in my previous work and I've just been happy as a lark to use the wicket:link/ which protects me from whatever the future provides. I'm just surprised it isn't the suggested best practice or that dropping files into webapp/* is *ill*-advised since it assumes something about how Wicket works. Thanks, -Luther
Re: Storing css and image files
Where's the edit button :) Near the beginning, theoratical should be theoretical. Near the end, I'm just surprised ... that dropping files into webapp/* is *ill*-advised should read I'm just surprised ... that dropping files into webapp/* isn't *ill *-advised I'm sure there are more. Thanks, -Luther On Mon, May 25, 2009 at 11:38 AM, Luther Baker lutherba...@gmail.comwrote: **On Mon, May 25, 2009 at 2:34 AM, Martijn Dashorst martijn.dasho...@gmail.com wrote: or, if these images and css are for your application, and application wide (i.e. all pages include them), you could put them in src/main/webapp/.. and just link src=style.css ... / them in your markup. Martijn I'd like to pose a design/theoratical thought here I understand that wicket:link/ does the right thing for resources (like stylesheets) kept in the classpath. I love this behavior. But, as we know, depending on where my browser URL points, the following: link href=css/styles.css .../ resolves to different locations. For instance, said stylesheet referenced from: http://hostname/context/products/wires/24 physically resolves to (mavenized) webapps/*products/wires*/css/styles.css, whereas from http://hostname/context/people/hr/judy resolves to webapps/*people/hr/judy*/css/styles.css (In part, this is due to our effort NOT to hardcode the context into the link's href.) *Traditionally, I solved this one of three ways:* 1. Manually manage every application URL and every mapped file and make sure that in all cases the relative path is correct. Ugh! For obvious reasons - this technique is not maintainable. Large apps back in the early days of Struts with hundreds of actions and JSPs, this just wasn't fun. 2. JSTL came along and I started to leverage the c:url tag. For the most part, that was a workable solution - the resulting path was 'absolute' but it wasn't hardcoded. Essentially, it gives the framework a chance to work its magic (if it were to change somehow). 3. Today, I use the resource method (wicket:link/) which obviates all anxiety by simply letting the framework just manage it. So to your point Martijn, is using webapp/css and directly including link href=css/styles.css .../ really a good - viable, long-term solution in Wicket apps? Understandably maybe today, the default URL mapper in Wicket uses query strings and not deep or hierarchical urls - but the important term for me here is today. What if, in the future, wicket decides to change the default URL mapping scheme - maybe become more RESTful. The inertia built up around legacy apps using webapp/css may pose a problem. I don't think this is premature functionality ... I think links and urls are a here a now thing and that building and migrating apps to future versions of frameworks is hard and that a loose practice here may come back to bite a developer ... ? Also, I've not yet mounted urls but I assume if I were to mount URLs - I'd have to really manage this webapp/css approach - whereas, the resource approach with wicket:link/ would just keep humming along. Some may argue that it isn't really *better* to provide multiple ways to do the same thing ... take Tapestry for instance and the technical relevance as to where markup files can or cannot reside. This post is indeed a bit philosophical/theoretical - I've often thought about this topic and wanted to clarify in my mind that maybe, these are either moot points, ignored concerns, overthinking on my part ... or just not important somehow. As I mentioned, this little detail has always been a pain point in my previous work and I've just been happy as a lark to use the wicket:link/ which protects me from whatever the future provides. I'm just surprised it isn't the suggested best practice or that dropping files into webapp/* is *ill*-advised since it assumes something about how Wicket works. Thanks, -Luther
Re: Generic BookmarkablePage
On Sat, May 23, 2009 at 4:34 PM, Igor Vaynberg igor.vaynb...@gmail.comwrote: final Link? link= -igor @James The seems to work just fine: final LinkVoid link = new BookmarkablePageLinkVoid(a-contact, ...); @Igor Just wanted to clarify ... it is hard to tell exactly what you're suggesting: final Link? link = new BookmarkablePageLinkVoid(a-contact, final Link? link = new BookmarkablePageLink(a-contact, I'm also fine doing it the old way (no type parameter). Just wasn't sure what the suggested best practice was going to be. -Luther On Sat, May 23, 2009 at 12:55 PM, James Carman jcar...@carmanconsulting.com wrote: BookmarkablePageLinkVoid perhaps? On Sat, May 23, 2009 at 2:05 PM, Luther Baker lutherba...@gmail.com wrote: I'm afraid I'm late to the party and that this may have been discussed 'before' I moved to 1.4 - but is there an established best practice to handle something like BookmarkablePageLink ... when I'm not going to use a model? Can I confidently just leave the Type off? Is that best practice? or should we pick some well-known type? ahh .. that sounds wrong. final LinkString link = new BookmarkablePageLinkString(app-title, Home.class); vs final Link link = new BookmarkablePageLink(app-title, Home.class); I'm one of those 'hate yellow squigglies' kinda folks so it feels 'funny' ... had to ask. Thanks, -Luther - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Pages and Namespaces
Assuming a parent page (Layout.html) that contains a link a href= wicket:id=a-contact with corresponding code in Layout.java ... Now, I'd like to extend that with a child page ... that happens to contain text that also embeds a link to the same place. In my child page, I just so happen to the use the same id ... and I find out, the ids conflict. In this case it is easy enough for me to simply change one of the ids - but that seems odd. What if I were using someone else's library of pages? I would've thought there'd be some namespace style separation where id's in subclasses can't conflict with id's in super classes. Is that naive - or am I just missing a design point? Thanks, -Luther
Re: Ajax appends to a Table
On Fri, May 22, 2009 at 10:01 AM, Igor Vaynberg igor.vaynb...@gmail.comwrote: better approach is outlined in one of the articles on wicketinaction.com -igor http://wicketinaction.com/2008/10/repainting-only-newly-created-repeater-items-via-ajax/ Thanks Igor. -Luther
Generic BookmarkablePage
I'm afraid I'm late to the party and that this may have been discussed 'before' I moved to 1.4 - but is there an established best practice to handle something like BookmarkablePageLink ... when I'm not going to use a model? Can I confidently just leave the Type off? Is that best practice? or should we pick some well-known type? ahh .. that sounds wrong. final LinkString link = new BookmarkablePageLinkString(app-title, Home.class); vs final Link link = new BookmarkablePageLink(app-title, Home.class); I'm one of those 'hate yellow squigglies' kinda folks so it feels 'funny' ... had to ask. Thanks, -Luther
IModelT and ResourceModel
I typically write this out longhand (is that bad or unpopular) for ez debugging): add(new Label(quote, new ResourceModel(default-quote))); would often be: IModelString model = new ResourceModel(default-quote))); Label label = new Label(quote, model); add(label); My question is, am I correct to assume that a ResourceModel is an IModelString? I think that is what the source has but typing my application based on what the black box library uses today seems like a bad practice. I'm afraid to rely on this -- since, the source could change ... ? False alarm? Am I misunderstanding something maybe? Thanks, -Luther
Ajax appends to a Table
Hi, I have an 'Add Row' Ajax link and a Table. The table contains a list of todos. To 'add' a todo, I have created a single tr full of td's and input's that, via Ajax, get shown when someone clicks on the aforementioned 'Add Row' link. Now, on submission of said row, I'd like to append it to the bottom of the table such that, one might be able to add 'another' row. Is there an easy way to do this or would I simply want to encapsulate the entire table and refresh it via Ajax. I'm not sure that'd be as easy as I hoped either since, I'd be creating the markup, etc in the Java class for the extra row. Also, to be true to form, is it normal to show that tr of inputs without a formal encapsulating form tag or should I wrap the table in a big form to be sure any inputs in the table are formally encapsulated by a form. Just looking for some pointers in the right direction on basically, how to, via Ajax, create blank rows, allow submissions and then append said rows to a table without formally GET or POSTing the entire page. Many thanks. -Luther
Re: Putting HTML files in src/main/webapp
Separates the code from the templates so the designers don't have to checkout the whole project, also keeps all the content in one directory. Even though they are dynamic template files for wicket there is a certain amount of static stuff that would be nice to be in one place. If you simply want to separate the file types, you can separate the *.html files into the src/main/resources directory. That separates the Java code from the HTML templates, it gives you a completely separate directory tree for the *.html files and it keeps all the html content in one directory. In addition, it is standard Maven practice to separate non-Java files into the src/main/resources directory. All standard Maven builds should work just fine. Additionally, under Netbeans it seems to me to be rather daft that there is a folder is called Web Pages in the project view but all it contains is image/binary files and the WEB-INF directory. Just a little background, by definition, Wicket defines a non-traditional web application structure. It intentionally avoids the use of the web page directory structure you are likely used to. It turns out that to do what you are asking, you are actually fighting both Wicket and Maven. Traditional HTML and JSP pages can be visited directly - but not so with Wicket html files. They are read in from the classpath and much more tightly bound to an actual Java class. Trying to fit your Wicket app into a traditional structure can be done ... but it is not standard Wicket practice and you're going to end up with custom configuration that you'll have to manage. But the actual HTML files end up in the Source Packages or worse Other Sources folder. I understand the reasons for putting them in the source packages directories but it's not an ideal solution to my mind and my team. That is fair. If you're simply after your aforementioned points, try dropping the *.html files into src/main/resources. -Luther
Re: Internationalized titles
I've setup and used this approach with success as well ... public class ChildPage extends MasterLayoutPage { public ChildPage() { super(new Model ...); } One interesting factoid ... depending on how you actually mark this up, DEVELOPMENT mode can look a bit screwy. It is my experience that the wicket markup tags actually render in the title bar. I believe that was one problem I had with using something like titlewicket:message...//title -Luther On Mon, May 4, 2009 at 5:01 PM, Jeremy Thomerson jer...@wickettraining.comwrote: Yeah - that's what I've done on several sites. -- Jeremy Thomerson http://www.wickettraining.com On Mon, May 4, 2009 at 2:38 PM, James Carman jcar...@carmanconsulting.com wrote: One reason would be to let subclasses actually override it with a more complex model, if need be. The method in the superclass (assuming you're using markup inheritance) would be like this: public IModelString getTitleModel() { return new ResourceModel(page.title, [TITLE]); } But, subclasses could override this in case they have something else they want to display in the title (with other information from the current page for example). On Mon, May 4, 2009 at 3:33 PM, Martijn Dashorst martijn.dasho...@gmail.com wrote: why not use a wicket:message ? Martijn On Mon, May 4, 2009 at 8:08 PM, Jeremy Thomerson jer...@wickettraining.com wrote: add(new Label(appTitle, new ResourceModel(your.title.key)); also, change your html: title wicket:id=appTitlethis will be replaced/title Of course, if you don't use markup inheritance, you'll need to repeat this throughout each page. -- Jeremy Thomerson http://www.wickettraining.com On Mon, May 4, 2009 at 1:02 PM, Shelah Horvitz shelah.horv...@blackwave.tv wrote: I want to internationalize the title of my application, so that I would get its value from a properties file, and the HTML would look something like: head titlespan wicket:id=appTitle/span/title /head It doesn't look like I can use a header contributor to do this sort of thing, so how is it done? Thanks for your help. Shelah - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- Become a Wicket expert, learn from the best: http://wicketinaction.com Apache Wicket 1.3.5 is released Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: IMPORTANT: Nabble posting disabled due to spam
Slightly o/t ... Is there a way, in Gmane to limit the view to a bookmarkable tree of responses to a single thread? The frameset doesn't work for me since the articles I'm looking at don't appear in the URL. The article specific url doesn't work for me since it doesn't provide any context or reference to the tree. Nabble does this http://www.nabble.com/serialVersionUID-td23001300.html Can Gmane do something similar? http://news.gmane.org/group/gmane.comp.java.wicket.user/last=/force_load=t http://news.gmane.org/gmane.comp.java.wicket.user http://article.gmane.org/gmane.comp.java.wicket.user/66353 Thanks, -Luther On Mon, Mar 30, 2009 at 5:13 AM, Reinout van Schouwen rein...@gmail.comwrote: Op maandag 30-03-2009 om 11:54 uur [tijdzone +0200], schreef Martijn Dashorst: I've disabled posting through the Nabble interface because they don't seem able to prevent spam coming through their interface. If you want to ask a question, please subscribe to the list. If you don't want to do that, complain with Nabble support to improve their spam filtering. For people who dislike the large volume of mail caused by the mailinglist, I recommend the Gmane nntp/web interface: http://news.gmane.org/gmane.comp.java.wicket.user regards, -- Reinout van Schouwen - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
serialVersionUID
A quick question - is it generally acceptable to use private static final long serialVersionUID = *1L*; for most the anonymous inner class I create using Wicket? Specifically, I'm asking about using the value (-1). I've seen this idiom in the source but wasn't sure if there was some rational or serialization concerns I needed to be aware of before generally using (-1) everywhere. -Luther
Re: serialVersionUID
Thanks John, Let me take this one step farther, just to clarify. I know that in a standard web application, the web container can Serialize user HttpSessions such that one can shut an application down and upon bringing it back up, HttpSession state is restored and, for instance, a user might not have to log back in. This functionality required us to implement Serializable for anything we wanted to store in a user's HttpSession. From your response, is it safe to say that Wicket doesn't use the HttpSession that way - or at least, doesn't store all these pages and their contents out to Session such that there is no requirement from Wicket to use a valid, unique serial id for all these anonymous classes? Including the PageStore or anything else native to Wicket internals? Is there anything, whatsoever that Wicket or Java webapps would require proper serial ids for? -Luther (I hope it's clear, I am intentionally being technical and trying to clarify whether or not such unique serial ids are necessary or required for some dark corner of Wicket functionality vs just not using them because they are a pain or simply can safely be ignored or even left out.) On Sat, Apr 11, 2009 at 12:59 PM, John Krasnay j...@krasnay.ca wrote: On Sat, Apr 11, 2009 at 08:45:31AM -0500, Luther Baker wrote: A quick question - is it generally acceptable to use private static final long serialVersionUID = *1L*; for most the anonymous inner class I create using Wicket? Specifically, I'm asking about using the value (-1). I've seen this idiom in the source but wasn't sure if there was some rational or serialization concerns I needed to be aware of before generally using (-1) everywhere. -Luther An arbitrary constant (1 or -1) works just as well as any other value. Personally, I've disabled that warning in Eclipse and I don't add serialVersionUID to any of my Wicket components. jk - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: serialVersionUID
You don't need a serialVersionUID for serialization to work (and certainly not a unique one, or your plan for using 1L wouldn't very well). Thanks. -Luther
Re: serialVersionUID
This has been a good thread. I seem to remember the warning became much more over-stated when Ganymede (Eclipse 3.4) was released. An avid of user of FindBugs, I like avoiding squiggly yellow lines so I did the same here - and generating a unique id sounds so much more llike the right thing to do so yes, I've been going out of my way to put these things everywhere. It seems I was incorrectly under the impression that the JVM required this serial id to serialize correctly. So at the very least, thanks @Jim for that article! Well, at any rate, that was fine and ignorable when it was a few classes here and there - specifically, anything I was persisting to the HttpSession. It really wasn't until I started using Wicket with such a strong OO sentiment that this issue has blossomed and really begun to annoy me. Those stinking things are everywhere! Touche! Unless I find good counterpoint, I'm going to turn off the warning as well. Thanks all, -Luther On Sat, Apr 11, 2009 at 10:14 PM, Jim Pinkham pinkh...@gmail.com wrote: I'm suprised no one has mentioned the runtime cost of computing a default serialversionid which is avoided if a constant is supplied. I used to make it a habit for this reason. This thread made me curious if that was really true, so I googled a bit and found this article http://www.javaworld.com/javaworld/javaqa/2003-06/02-qa-0627-mythser.html which found no such benefit, and suggests we needn't bother. I think I'll turn off the Eclipse warning instead. -- Jim. On Sat, Apr 11, 2009 at 10:50 PM, John Krasnay j...@krasnay.ca wrote: On Sat, Apr 11, 2009 at 05:32:51PM -0400, Ben Tilford wrote: The purpose of the *public* static final long serialVersionUID is for long term storage or situations where you may potentially have made modifications to the class that make it incompatible with previous versions (distributed apps/clustering). It only prevents trivial changes (e.g. adding a public method) from breaking your serialization compatibility. You can still break the compatibility even with a serialVersionUID, e.g. by renaming a field. Besides, Wicket page maps are neither long-term storage nor remotely communicated, so I don't really see the point of putting in the effort. I'd say that its easier to just add it in case you ever need it, its only 1 line of code. Given Wicket's reliance on component inheritance, adding serialVersionUID in every place Eclipse complains about it would amount to hundreds of lines of code on my projects. Java code has enough noise already. jk - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: serialVersionUID
I don't know much about it ... but would something like Terracotta use/require/leverage the serialVersionUID for something not so obvious in normal, singly homed deployments? I think I understand that it helps confirm or explicitly 'version' components that might be working together or across, say, JVM boundaries - but it seems like, if not explicitly provided, a default value is built automatically and, unless I want an older version to work with a newer version, I am fine just letting that happen. In fact, unless I am really abiding by serialVersionUID rules (changing it explicitly - every time I make a relevant, corresponding change to the containing class) - I'm not really gaining any functionality that the runtime can't already do. In fact, unless rigorously maintained, it seems I could likely end up with two different compiled versions with identical, explicit serialVersionUIDs - which surely seems worse then leaving it alone? -Luther On Sat, Apr 11, 2009 at 10:56 PM, Adriano dos Santos Fernandes adrian...@uol.com.br wrote: Brill Pappin wrote: Actually i don't think a missing one will cause that to fail unless there are a lot of incompatible changes. Just one incompatible change of class stored in the session and it will not be deserialized. However... even if it does matter, *in no way* should anyone depend on a serialized session to store data if your app can't recover from a clean session, you have bigger problems than not adding a serialVersionId. Hum? What about stateful pages, which is the Wicket market? If you can control your serial IDs, you have the chance of write custom deserializers. That does not means you can't with an absent ID, but AFAIU just the inclusion of one field and it will change making the deserialization fail. Adriano - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Cache oddity ... maybe
I've included the Projects page which lists all the projects and the AddProjectPanel which contains the logic to save a new project and go back to the Projects page. Maybe I should explicitly create a new Projects page in the onSubmit handler of my AddProjectPanel? Oddly, even today - it doesn't consistently have this problem. Just 'sometimes' when I set the response page back to the main listing page - the list isn't updated - generally only happens the first time ... Maybe it is a Hibernate thing. I'm still digging. -Luther @RequiresAuthorization(user) public class ProjectsPage extends MenuLayout { private String confirmationMessage; public ProjectsPage() { this(new ResourceModel(defaultBodyTitle)); } public ProjectsPage(final ResourceModel bodyTitle) { super(bodyTitle, ProjectsPage.class); // // menu // // add Link link = new Link(add.category.link) { private static final long serialVersionUID = 142459578574869903L; @Override public void onClick() { final Page next = new CategoryPage(); this.setResponsePage(next); } }; this.add(link); // add project link = new Link(add.project.link) { private static final long serialVersionUID = -7045649583675065507L; @Override public void onClick() { final Page next = new AddProjectPage(); this.setResponsePage(next); } }; this.add(link); // filter final AjaxFallbackLink filterLink = new AjaxFallbackLink(filter.projects.link) { private static final long serialVersionUID = -5599387710174768323L; @Override public void onClick(final AjaxRequestTarget target) { // noop } }; this.add(filterLink); // // projects // final ListView categories = new ListView(categories, this.getCategories()) { private static final long serialVersionUID = -2181837156022701325L; @Override protected void populateItem(final ListItem item) { final Category category = (Category) item.getModelObject(); final Label label = new Label(categoryName, category.getName()); final Link link = new Link(categoryLink) { private static final long serialVersionUID = -4816807486013970750L; @Override public void onClick() { final Page next = new CategoryPage(category); this.setResponsePage(next); } }; link.add(label); item.add(link); final ListView projects = new ListView(projects, ProjectsPage.this.getProjects(category)) { private static final long serialVersionUID = -2181837156022701325L; @Override protected void populateItem(final ListItem item) { final Project project = (Project) item.getModelObject(); // project PageParameters pars = new PageParameters(); String id = project.getId().toString(); pars.add(ProjectPage.Params.ID, id); BookmarkablePageLink link = new BookmarkablePageLink(projectLink, ProjectPage.class, pars); String val = project.getName(); link.add(new Label(projectName, val)); item.add(link); // acronym val = project.getAcronym(); item.add(new Label(projectAcronym, val)); // resource final Resource res = project.getLead(); if (res != null) { id = Long.toString(res.getId()); pars = new PageParameters(); pars.add(ResourcePage.Params.ID, id); val = project.getLead().getUserName(); } link = new BookmarkablePageLink(projectLeadLink, ResourcePage.class, pars); link.add(new Label(projectLead, val)); item.add(link); // url val = project.getUrl(); item.add(new Label(projectUrl, val)); } }; item.add(projects); } }; this.add(categories); } /** * @return
feedback panel
I'd like to turn the background of a text input yellow - if it has errors. Is there a standard way to do this? I have a feedback panel - and can write some javascript. What about scanning the page for a feedback panel, and then - reading an li attribute like id=form_name_ and corresponding that to an field that needs to have a certain style .. ah - thats convoluted - but can someone suggest a general way to add attributes to elements - I've seen it but can't remember where? Furthermore, is there a way to access the creation of the FeedbackPanel.LIs? Thanks, -Luther
Cache oddity ... maybe
I have a page that displays a list of Titles. I have a few links off this page that take you to a second page where you can either a) create a new Title b) edit an existing Title c) delete an existing Title The onClick handlers for b and c create the destination page with the selected object where as option a simply prepares a blank form for the user to type in. In this simplistic case, a Title is simply a bare-bones Entity with just a Long id and a String name. All is fine -- except on the very first action. The very first meaning, right after I rebuild and restart the application. After ADDING a new Title - the onSubmit handler of that page simply sets the response page which is a POJO page that takes no arguments. That original page comes up - but the listing of Titles is always missing the very last one I entered. If I refresh the screen - all is well. If I add 25 more Titles, they always show up right away - ie: as soon as page 2 directs me back to page 1. But for some reason, the very first time - the new entry doesn't show up upon returning the first listing page. I am using some nominal Ajax on the 2nd page to go back and forth between viewing and editing ... but the final submit is always a full refresh back to the original page. I recently added b and c ... and oddly enough ... the edits or deletes do not show up on the first page ... the first time after a rebuild and restart ... but then work consistently everytime after that. Thoughts? Any quick thoughts as to what migh be going on in my env? For what its worth - I have an outer filter that is creating and commiting Hibernate transactions and they are firing as expected ... Thanks in advance, -Luther
Forms and AjaxFallbackButton
I keep receiving the following: - - - - - - - - - - - - - This is an automatically generated Delivery Status Notification Delivery to the following recipient failed permanently: users@wicket.apache.org Technical details of permanent failure: Google tried to deliver your message, but it was rejected by the recipient domain. We recommend contacting the other email provider for further information about the cause of this error. The error that the other server returned was: 552 552 spam score (5.4) exceeded threshold (state 18). - - - - - - - - - - - - - Should I leave the code out of my posts? There is very little text in my posts .. W/O code - I have a form with an AjaxFallbackButton which opens a modal dialog. I turned off setDefaultFormProcessing and I'm handling the onSubmit handler for the button - but I if I look at the Forms underlying object, it isn't populated with the contents of the original form. Thoughts? -Luther
Submitting an Ajax Modal
I have a form with an AjaxFallbackButton that populates and displays a Modal form. It all works but when I SUBMIT the Modal form I am presented with a Confirmation Dialog: Are you sure you want to navigate away from this page? Reloading this page will cause the modal window to disappear. Press OK to continue, or Cancel to stay on the current page. Is my browser doing this? Is there a flag I can set to disable this? Is it evident that there is a problem with my relationships of panels and forms such that this Confirmation Dialog shouldn't normally appear. Thanks, -Luther
From Window to Modal Window Form Model
Is there a preferred way to pass information from a Form's AjaxButton submit handler to a Modal window's panel's form? I am currently manually updating individual fields on the model instance object I am assigning to the Modal Windows Panel Form FormComponents. Since the Modal window is created way before I ever invoke modal.show(target), I assume the Model instance is already set (I assume the ctor is called when the page is first instantiated) so instead of just 'reseting' the model object's instance ... I am really copying individual fields - essentially updating the current model in place ... does that sound right? Is there another more elegant way to do this? The basics: a window has a form with a drop down - I select an option and click the AjaxButton to display a modal window allowing me to edit all the database fields of the item in the drop down. I essentially need to pass the item from the initial window to the Modal window's form's model. Sorry for the length of this question. -Luther
Re: delete onSubmit
The GenericJDBCException is correct and indeed, I shouldn't be able to delete the object - it has references to children objects. It is all of the successive attempts that make me think I can do something to CLEAN it out of memory. Successive attempts (which should also fail) are failing for a different exception ... NonUniqueNonUniqueObjectException. That, is the exception I'm trying to counter. That exception implies that the object I am trying to delete - is already attached to my hibernate session. That confuses me since, the successive delete requests are on subsequent posts which explicitly grab a new session. If I shutdown or navigate away from that page - and then visit it again, the first delete attempt results in GenericJDBCException ... which I expect. So, naively, this implies to me that maybe my framework is saving or 'caching' that object and reusing it on subsequent or immediate requests - whereas, when I navigate away, it is clearing itself and re-retrieving the object. This notion is somewhat reinforced as my drop down changes. The first attempt always prompts me with the Choose One option as well as the thing I'm trying to delete. Subsequent requests no longer include the Choose One option. IE: Wicket knows about and is holding onto the literal object I tried to delete (the model). Maybe I can set it (the model) to null or something to explicitly make that Change One appear again ... Thanks for the suggestion - I will try to mimic this in a test - but again, its not the DELETE I'm after, it is the odd exception that only shows up after subsequent DELETE attempts that I'm trying to understand better. -Luther But, the first attempt throws GenericJDBCException On Thu, Apr 2, 2009 at 8:32 AM, James Carman jcar...@carmanconsulting.comwrote: Have you tried what you're trying to do in a test case? I mean, outside of Wicket? On Wed, Apr 1, 2009 at 10:19 PM, Luther Baker lutherba...@gmail.com wrote: I am trying to delete an object in my form's Submit handler. In one case, the object has references to other objects and so it correctly complains throws a (GenericJDBCException). When the view refreshes, the Choose One method is gone and the previously selected object is selected again. If I submit the form it throws a different Hibernate error (NonUniqueObjectException) which all subsequent requests throw. If I navigate away from the page and back, the first exception to be thrown on deletion submit is again, GenericJDBCException - afterwhich subsequent requests throw NonUniqueObjectException. Per the OSIV pattern, I am creating a new Session and creating a high level transaction in an outer JEE filter. I think this is all correct behavior but I'm wondering why the NonUniqueObjectException on all subsequent delete requests from the same page. The form is indeed tied directly to an instance of the object I am deleting. I am guessing that it is, as it indicates, trying to continually delete an object that already exists in Hibernate's memory. Is there a way to correctly/formally remove the object from Hibernate's immediate memory? I think that is more than simply disconnecting it since, each request by definition creates a new Session object to which, this particular Hibernate entity object isn't attached to. Thanks in advance. I'm a noobie to both so I apologize if this is really a Hibernate question. -Luther - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
View the Source
I'd like to see how the model implementation (Model, ProeprtyModel, CompoundPropertyModel) I use affects the DropDownChoice. I can see the model get SET in the Component when I initially create the DropDownChoice. What I'd like to see is how, on a subsequent POST, the parameters I in my form get pushed into that model. I am able to get one form to work perfectly but another is not populating my model object. i.e.: in onSubmit, the id is not being set for one of my cases --- there are some subtle differencees in the parent Form model but in general, the examples are very simple and almost dead copies of each other. So - I wanted to watch the magic ... I am drilling down into Form.delegateSubmit and I'll keep stepping through but didn't see the model hydration in my first few runs so wanted to ask here. Thanks, -Luther
Re: View the Source
I recently read this http://www.angelikalanger.com/Articles/JavaSolutions/SecretsOfEquals/Equals.htmland now, at least for the time being, I take great care when writing hashCode, equals and compareTo. It is a good read if you're not already familiar with the topic. For what its worth, I tend to use the apache commons builders (HashCodeBuilder, EqualsBuilder and CompareToBuilder) but to your point, I'll have to take a look at what Eclipse can do for me. -Luther On Thu, Apr 2, 2009 at 2:24 PM, James Carman jcar...@carmanconsulting.comwrote: On Thu, Apr 2, 2009 at 3:21 PM, luther.baker lutherba...@gmail.com wrote: Found my problem. Found the relationship between validation and then model hydration and finally - that my equals operator was incorrectly comparing (that == that). Don't you generate your equals() methods? Once I found that nice little feature in my IDE, I've never looked back. I don't ever write equals() or hashCode() anymore by hand. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: View the Source
I use IntelliJ IDEA and I've never had any troubles with my equals() and hashCode() methods. That is probably fine 90% of the time but I'd be careful if you're not actually giving it a bit of thought. It is actually quite difficult to correctly implement equals in a general, universal way and since an IDE cannot infer semantics, there are times when an otherwise standard implementation will need to be adjusted. It isn't rocket science - but it can be tricky. If you're interested, see the paper I linked to earlier as well as some of Joshua Bloch's posts on the topic. -Luther
DropDown Models
This select impl works just fine ... creating a project that must include a Category from a drop down: public AddProjectForm(final String id) { super(id); this.project = new Project(); *this.setModel(new CompoundPropertyModel(this.project));* // category *IModel categoryModel = new PropertyModel(this.project, category);* IModel detachableModel = new LoadableDetachableModel() { private static final long serialVersionUID = -7673902927079196813L; @Override protected Object load() { ListCategory categories = ServiceLocator.getPersistenceService().findAll(Category.class); return categories; } }; ChoiceRenderer cr = new ChoiceRenderer(name, id); DropDownChoice ddc = new DropDownChoice(category, * categoryModel*, detachableModel, cr); ddc.setRequired(true); this.add(ddc); I see that I set a model for the form -- and then I set another model (albeit the same one) for the Drop Down. In another case, I have a simple page that tries to DELETE a CATEGORY. private static class DelCategoryForm extends Form { private Category category; public DelCategoryForm(final String id) { super(id); this.category = new Category(); *this.setModel(new Model(this.category));* // category *IModel categoryModel = new Model(this.category);* IModel detachableModel = new LoadableDetachableModel() { private static final long serialVersionUID = -6814520399090264461L; @Override protected Object load() { ListCategory categories = ServiceLocator.getPersistenceService().findAll(Category.class); return categories; } }; ChoiceRenderer cr = new ChoiceRenderer(name, id); DropDownChoice ddc = new DropDownChoice(categories, * categoryModel*, detachableModel, cr); ddc.setRequired(true); this.add(ddc); In this case, I don't think I need the CompoundPropertyModel or PropertyModel since, the contents of the DROP DOWN indeed are everything I need. So I changed the both to simply Model. Unfortunately, values are always 'null' in the onSubmit handler of the delete implementation. Any quick thoughts on what I'm doing incorrectly here? Basically, I'm trying to populate the Category object with the select. It works for the 1st example - but not in the second. In the first, it is a property of a containing object - in the 2nd, it is the loan object. Thanks, -Luther
delete onSubmit
I am trying to delete an object in my form's Submit handler. In one case, the object has references to other objects and so it correctly complains throws a (GenericJDBCException). When the view refreshes, the Choose One method is gone and the previously selected object is selected again. If I submit the form it throws a different Hibernate error (NonUniqueObjectException) which all subsequent requests throw. If I navigate away from the page and back, the first exception to be thrown on deletion submit is again, GenericJDBCException - afterwhich subsequent requests throw NonUniqueObjectException. Per the OSIV pattern, I am creating a new Session and creating a high level transaction in an outer JEE filter. I think this is all correct behavior but I'm wondering why the NonUniqueObjectException on all subsequent delete requests from the same page. The form is indeed tied directly to an instance of the object I am deleting. I am guessing that it is, as it indicates, trying to continually delete an object that already exists in Hibernate's memory. Is there a way to correctly/formally remove the object from Hibernate's immediate memory? I think that is more than simply disconnecting it since, each request by definition creates a new Session object to which, this particular Hibernate entity object isn't attached to. Thanks in advance. I'm a noobie to both so I apologize if this is really a Hibernate question. -Luther
Feedback Panel
I have an onSubmit handler that fails. I would like to catch the exception and explicitly write a message to the page's FeedbackPanel. The message would be a 'message' from Page.properties ... My problem is that a literal string works just fine ... this.error(something I said) but how do I get something from my Resource or messages file in there? Something like this.error(new ResourceModel(key)); obviously doesn't work ... but is there a well defined way? Thanks, -Luther
Re: Feedback Panel
ty. On Wed, Apr 1, 2009 at 9:33 PM, Jeremy Thomerson jer...@wickettraining.comwrote: this.error(getString('key')) -- Jeremy Thomerson http://www.wickettraining.com On Wed, Apr 1, 2009 at 9:23 PM, Luther Baker lutherba...@gmail.com wrote: I have an onSubmit handler that fails. I would like to catch the exception and explicitly write a message to the page's FeedbackPanel. The message would be a 'message' from Page.properties ... My problem is that a literal string works just fine ... this.error(something I said) but how do I get something from my Resource or messages file in there? Something like this.error(new ResourceModel(key)); obviously doesn't work ... but is there a well defined way? Thanks, -Luther
Re: How To Download Excel File?
I could be wrong - but maybe the question is about how best to structure this in Wicket .. Should it be a bookmarkable link? Should it be an action link? If I do the work in my Action style link, how does one directly return content from an action link as opposed to setting page response, etc. -Luther On Tue, Mar 31, 2009 at 9:30 AM, Linda van der Pal lvd...@heritageagenturen.nl wrote: Not related to Wicket, but this might be a start: http://api.openoffice.org/ Regards, Linda Wadi Jalil Maluf wrote: Hi All, I would like to know how can I put a link into a page so when the user clicks I fetch some data from database , export it to Excel so the user directly downloads an xls file with the content. Any help is appreciated, Thanks in advance, Wadi No virus found in this incoming message. Checked by AVG - www.avg.com Version: 8.5.285 / Virus Database: 270.11.34/2032 - Release Date: 03/31/09 06:02:00 - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: How To Download Excel File?
These responses were great! I learned something from almost each variant of the answer. For what its worth, depending on how the app will be used - one might need to be careful about writing files to the filesystem ... but again, thanks for all the great examples listed here. -Luther On Tue, Mar 31, 2009 at 10:11 AM, francisco treacy francisco.tre...@gmail.com wrote: hola wadi to generate the excel file, have a look at the poi apache project: http://poi.apache.org/spreadsheet/index.html then you will need to create a resource for that file / byte array. you might find some inspiration from this pastie: http://paste.pocoo.org/show/110449/ finally, use new ResourceLinkVoid(downloadAsExcel, new PdfResource() { (...) } declare the link on your html and you're done! francisco 2009/3/31 Wadi Jalil Maluf wad...@yahoo.com.ar: Hi All, I would like to know how can I put a link into a page so when the user clicks I fetch some data from database , export it to Excel so the user directly downloads an xls file with the content. Any help is appreciated, Thanks in advance, Wadi - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: FeedbackPanel.isVisible override
That was perfect. Thanks, -Luther On Sun, Mar 29, 2009 at 1:58 AM, Anton Veretennikov anton.veretenni...@gmail.com wrote: anyMessage(); On Sun, Mar 29, 2009 at 1:56 PM, Luther Baker lutherba...@gmail.com wrote: I am using the built-in functionality of the FeedbackPanel and I'd like to tweak it just a bit. I have some default padding/margin setup for that div ... and so even empty, it takes up some space on my page. I'd like to hide it altogether if no errors are present. Is there a well-known function I can call from my override of FeedbackPanel.isVisible() to tell me if Validation failed? Or - is there a more appropriate answer here to effectually do the same thing? -Luther - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
FeedbackPanel.isVisible override
I am using the built-in functionality of the FeedbackPanel and I'd like to tweak it just a bit. I have some default padding/margin setup for that div ... and so even empty, it takes up some space on my page. I'd like to hide it altogether if no errors are present. Is there a well-known function I can call from my override of FeedbackPanel.isVisible() to tell me if Validation failed? Or - is there a more appropriate answer here to effectually do the same thing? -Luther
nested loop view
I'm trying to create a page - similar to Jira's BROWSE PROJECTS. My initial take amounts to a loop in a loop. The outer loop is CATEGORIES and the inner loop is PROJECTS in said category. | CATEGORY 1 | p1 | p2 | p3 | CATEGORY 2 | p4 | p5 | p6 ... I've attached code below but if I removed the nested loop, I can easily loop over just CATEGORIES but as soon as I add the nested loop, it fails with the following WicketMessage: Error attaching this container for rendering: [Page class = com.fuzzybearings.milestones.web.page.user.ProjectsPage, id = 3, version = 0] Root cause: java.lang.IllegalArgumentException: A child with id 'projects' already exists: [MarkupContainer [Component id = categories]] My intuition tells me that 'wicket:id=projects' is repeating since it is contained in an outer loop ... but I'm not sure how else to identify this type of structure in a general way. Is there a loop container more suited to this ... open to suggestions. Thanks in advance, -Luther *.html snippet div wicket:id=categories table tr wicket:id=projects tda wicket:id=projectLink href=#span wicket:id=projectLabel[project]/span/a/td /tr /table /div *.java snippet public ProjectsPage(ResourceModel bodyTitle) { super(bodyTitle); ListView categories = new ListView(categories, this.getCategories()) { @Override protected void populateItem(ListItem item) { Category category = (Category) item.getModelObject(); ListView projects = new ListView(projects, ProjectsPage.this.getProjects(category)) { @Override protected void populateItem(ListItem item) { Project project = (Project) item.getModelObject(); Link link = new Link(projectLink, item.getModel()) { @Override public void onClick() { ... } }; link.add(new Label(projectLabel, project.getName())); item.add(link); } }; this.add(projects); } }; this.add(categories); }
Re: nested loop view
Ahh ... but of course! Thanks both of you. The nested structure did indeed obscure the problem. Fixed and refactored a bit - and now working as expected. Thanks for your time! -Luther On Thu, Mar 26, 2009 at 12:01 PM, Jonathan Locke jonathan.lo...@gmail.comwrote: uh, well maybe not dangerous, just less clear than it could be. Jonathan Locke wrote: i think you mean to add the projects listview to the categories list view /item/ your structure is a little dangerous here because you have one ListItem item obscuring the other. if the outer one were called outerItem and the inner one were called innerItem, i think you meant to say outerItem.add(projects) and innerItem.add(link) luther.baker wrote: I'm trying to create a page - similar to Jira's BROWSE PROJECTS. My initial take amounts to a loop in a loop. The outer loop is CATEGORIES and the inner loop is PROJECTS in said category. | CATEGORY 1 | p1 | p2 | p3 | CATEGORY 2 | p4 | p5 | p6 ... I've attached code below but if I removed the nested loop, I can easily loop over just CATEGORIES but as soon as I add the nested loop, it fails with the following WicketMessage: Error attaching this container for rendering: [Page class = com.fuzzybearings.milestones.web.page.user.ProjectsPage, id = 3, version = 0] Root cause: java.lang.IllegalArgumentException: A child with id 'projects' already exists: [MarkupContainer [Component id = categories]] My intuition tells me that 'wicket:id=projects' is repeating since it is contained in an outer loop ... but I'm not sure how else to identify this type of structure in a general way. Is there a loop container more suited to this ... open to suggestions. Thanks in advance, -Luther *.html snippet div wicket:id=categories table tr wicket:id=projects td # [project] /td /tr /table /div *.java snippet public ProjectsPage(ResourceModel bodyTitle) { super(bodyTitle); ListView categories = new ListView(categories, this.getCategories()) { @Override protected void populateItem(ListItem item) { Category category = (Category) item.getModelObject(); ListView projects = new ListView(projects, ProjectsPage.this.getProjects(category)) { @Override protected void populateItem(ListItem item) { Project project = (Project) item.getModelObject(); Link link = new Link(projectLink, item.getModel()) { @Override public void onClick() { ... } }; link.add(new Label(projectLabel, project.getName())); item.add(link); } }; this.add(projects); } }; this.add(categories); } -- View this message in context: http://www.nabble.com/nested-loop-view-tp22726252p22726482.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: Looking for a book on the jetty server
I've asked this general question myself and came away with a few valuable thoughts: http://www.theserverside.com/news/thread.tss?thread_id=15073 http://developers.slashdot.org/developers/02/08/19/2042235.shtml?tid=108 http://www.webtide.com/choose/jetty.jsp http://raibledesigns.com/rd/entry/jetty_vs_tomcat_vs_resin -Luther On Wed, Mar 25, 2009 at 9:42 AM, Martijn Dashorst martijn.dasho...@gmail.com wrote: No, I'm implying that more people use Jetty pure for development, and deploy on different production containers. Jetty is just fine afiak. Our company just uses tomcat (and one instance of glassfish) for production/test. Our devs use tomcat (with sysdeo plugin) and jetty (quickstart) in their daily development. Martijn On Wed, Mar 25, 2009 at 3:13 PM, Chenini, Mohamed mchen...@geico.com wrote: Are you implying that in a production environment Glassfish, Tomcat, or JBoss are better to use with Wicket than jetty? I was planning to learn jetty to use it in development and in production and the 'Pro Wicket' book states that it [Wicket] was is a good fit for developing Wicket applications Please advise. Thanks, Mohamed -Original Message- From: Martijn Dashorst [mailto:martijn.dasho...@gmail.com] Sent: Wednesday, March 25, 2009 9:25 AM To: users@wicket.apache.org Subject: Re: Looking for a book on the jetty server I'm not sure if most actually *deploy* their production servers on Jetty (there's nothing holding anyone back), but I think that Tomcat, Glassfish and JBoss are also very popular. Jetty is most commonly used during development because it is so easy to embed. AFAIK no books have been written for Jetty. Martijn - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org This email/fax message is for the sole use of the intended recipient(s) and may contain confidential and privileged information. Any unauthorized review, use, disclosure or distribution of this email/fax is prohibited. If you are not the intended recipient, please destroy all paper and electronic copies of the original message. -- Become a Wicket expert, learn from the best: http://wicketinaction.com Apache Wicket 1.3.5 is released Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
maven, eclipse and wicket
I am having a slight bit of trouble getting Eclipse to step into the Wicket source code while using the m2eclipse plugin. The m2eclpse has successfully downloaded the Wicket 1.3.5 distribution. My application fires up and works just fine in Eclipse. I have also enabled the m2eclipse plugin to download sources - I can see the source jars in the m2 repository now as well. I am trying to implement a security/authentiation/authorization scheme and while debugging, anytime I step out of my workspace source code, I get a window in Eclipse that says Source not found and a button that says Edit Source Lookup Path... If I click that button, I can choose to explicitly add: *Archive*: a jar or zip in the workspace containing source files *External Archive*: a jar or zip in the local file system containing source files *File System Directory*: a directory in the local file system *Java Classpath Variable*: workspace folder, local directory, or archive referenced by a variable path *Java Library*: a collection of binary archives with attached source *Java Project*: source folders in a Java project *Project*: a project in the workspace *Working Set*: *Workspace*: all projects in the workspace *Workspace Folder*: a folder in the workspace And I can click External Archive and explicitly add every single source jar file --- but I was wondering - shouldn't this automatically happen? Does anyone have a suggestion? or confirmation that these source jars must be manually added to step into Wicket code while using the m2eclipse plugin in Eclipse? I think this is probably an m2eclipse question ... but hoping someone here has dealt with this already. Thanks much, -Luther
Re: maven, eclipse and wicket
Yep - the sources came down. The problem is in automatically attaching them to the debugger. I have an Eclipse DEBUG configuration invoking mvn jetty:run and it breaks just fine into my own source code - but when I go to step into the Wicket source, it can't find it the source code. The sources are downloaded and located in the same directories as the jars in my maven repository. I can explicitly attach them via the screen I mentioned in the first post by adding them individually as External Archives ... but sounds like I'm missing something. I was thinking that the maven/jetty/m2eclipse combo would know where to look. Explicitly adding every source jar to my project is a bit painful ... and so it sounds like I'm doing something incorrectly. Is this just supposed to 'work'. -Luther On Mon, Mar 23, 2009 at 12:31 PM, francisco treacy francisco.tre...@gmail.com wrote: i'm not sure i'm using m2eclipse (but i think so). to download sources just right click on your eclipse project, go to maven download sources. if we're using the same plugin, this should work. francisco On Mon, Mar 23, 2009 at 6:23 PM, Luther Baker lutherba...@gmail.com wrote: I am having a slight bit of trouble getting Eclipse to step into the Wicket source code while using the m2eclipse plugin. The m2eclpse has successfully downloaded the Wicket 1.3.5 distribution. My application fires up and works just fine in Eclipse. I have also enabled the m2eclipse plugin to download sources - I can see the source jars in the m2 repository now as well. I am trying to implement a security/authentiation/authorization scheme and while debugging, anytime I step out of my workspace source code, I get a window in Eclipse that says Source not found and a button that says Edit Source Lookup Path... If I click that button, I can choose to explicitly add: *Archive*: a jar or zip in the workspace containing source files *External Archive*: a jar or zip in the local file system containing source files *File System Directory*: a directory in the local file system *Java Classpath Variable*: workspace folder, local directory, or archive referenced by a variable path *Java Library*: a collection of binary archives with attached source *Java Project*: source folders in a Java project *Project*: a project in the workspace *Working Set*: *Workspace*: all projects in the workspace *Workspace Folder*: a folder in the workspace And I can click External Archive and explicitly add every single source jar file --- but I was wondering - shouldn't this automatically happen? Does anyone have a suggestion? or confirmation that these source jars must be manually added to step into Wicket code while using the m2eclipse plugin in Eclipse? I think this is probably an m2eclipse question ... but hoping someone here has dealt with this already. Thanks much, -Luther - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org