dynamic crumb trail

2010-09-22 Thread Luther Baker
I have a default template page that contains a  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

2010-07-26 Thread Luther Baker
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:


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";>










classpath:/com/fuzzybearings/projx/config/application.properties






${jdbc.driver}


${jdbc.url}


${jdbc.username}


${jdbc.password}










${hibernate.ddl}
${hibernate.dialect}
5
thread
true
true
org.hibernate.cache.EhCacheProvider
true




com.fuzzybearings.projx.model






-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



JNDI and mvn test

2009-12-07 Thread Luther Baker
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

2009-12-03 Thread Luther Baker
Not a huge thing but would it make sense to remove the  ... entry
from the wicket prototype?



The Apache Software License, Version 2.0
http://www.apache.org/licenses/LICENSE-2.0.txt
repo



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 :

*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

2009-10-25 Thread Luther Baker
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 wrote:

> 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 
> 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:*
> >
> > 
> > > href="style/default/main.css"/>
> > 
> >
> > *MARKUP OUT:*
> >
> > 
> >
> > 
> >
> > *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

2009-10-24 Thread Luther Baker
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:*





*MARKUP OUT:*





*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

2009-10-12 Thread Luther Baker
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 
>
> > 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

2009-10-11 Thread Luther Baker
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

2009-10-06 Thread Luther Baker
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
wrote:

> 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
> wrote:
>
> > 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

2009-09-12 Thread Luther Baker
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  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 IModel()
>  {
>public String getObject()
>{
>  ..
>}
>  ..
>  }
>
> mm:)
>
>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


Re: Slides

2009-09-11 Thread Luther Baker
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 
> 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
> >
>


Slides

2009-09-11 Thread Luther Baker
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: Need Wicket Book

2009-08-18 Thread Luther Baker
If you can read quickly, the book is free for 14 days:

http://my.safaribooksonline.com/9781932394986

-Luther


On Tue, Aug 18, 2009 at 11:14 AM, Eelco Hillenius  wrote:

> On Mon, Aug 17, 2009 at 11:45 PM, Ernesto Reinaldo
> Barreiro wrote:
> > Well, expensive is a relative term: in the country I come from $27.50 is
> > almost twice the money a developer will receive as payment for a month of
> > hard work;-)
>
> Insane, isn't it. Yet in other countries one wouldn't even accept that
> as an hourly wage.
>
> > Besides that, IMHO, the book is an excellent reading and buying it is a
> good
> > way to support those who expend so much energy and time maintaining the
> > framework.
>
> Glad to hear people are still liking the book. I wish prices would be
> distributed more to relative income, but that's out of my control :-)
>
> Anyway, I still feel that the examples project are an excellent source
> for learning about Wicket. Most important things are covered, and
> going through the examples is very hands-on. Also, you can download
> the first chapter of Wicket In Action for free, which will at least
> inform you what kind of problems the framework tries to solve.
>
> Good luck,
>
> Eelco
>
> Eelco
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


Re: dzone refcard

2009-07-06 Thread Luther Baker
Ah, got em.

Thanks much Andrew,

-Luther



On Mon, Jul 6, 2009 at 9:14 PM, Andrew Lombardi wrote:

> 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
>> here<http://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 > >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
>>>>>> >>>>>
>>>>>>  wrote:
>>>>>>>
>>>>>>>
>>>>>> It would be nice
>>>>>>
>>>>>>>
>>>>>>> -- paolo
>>>>>>>
>>>>>>> On Mon, Jul 6, 2009 at 6:07 PM, Luther Baker 
>>>>>>> wrote:
>>>>>>>
>>>>>>> Is anyone aware of a wicket
>>>>>>>
>>>>>>>> refcard<http://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 inte

Re: dzone refcard

2009-07-06 Thread Luther Baker
Sounds good. I'm giving a Wicket presentation
here<http://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 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
>>>> >>>
>>>>> wrote:
>>>>>
>>>>
>>>>  It would be nice
>>>>>
>>>>> -- paolo
>>>>>
>>>>> On Mon, Jul 6, 2009 at 6:07 PM, Luther Baker 
>>>>> wrote:
>>>>>
>>>>>  Is anyone aware of a wicket
>>>>>> refcard<http://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.
> 
>
>


dzone refcard

2009-07-06 Thread Luther Baker
Is anyone aware of a wicket
refcardinitiative?
Thoughts?

-Luther


Re: localizer and variables

2009-06-29 Thread Luther Baker
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  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 wrote:

> 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, OjO 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, OjO 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, OjO 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

dls, divs and ps and the ListView

2009-06-28 Thread Luther Baker
Wicket 1.4-rc2

Marking up a ListView with dls, divs or ps has different results.
Specifically,  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  --- the closing  occurs right away -
before the rest of the list elements render.

I've include some example code.

-Luther



A  example:


[post-title]

[author],
[published-on]



[category
name]




[tag name]


: [last-modified-on]
[post-content]


Results in:


Goodbye

        Luther 
Baker,
Jun 28, 
2009




asdf




fdsa




Hello

...



A  example:


[post-title]


[author],
[published-on]



[category
name]




[tag name]


: [last-modified-on]
[post-content]



results in:


Goodbye


        Luther 
Baker,
Jun 28, 
2009




asdf




fdsa




Hello


...



But :


[post-title]


[author],
[published-on]



[category
name]




[tag name]


: [last-modified-on]
[post-content]



results in:


**Ciao Time



        Luther 
Baker,
Jun 28, 
2009



ok





there




Whatt

...


Re: guice-injection on page vs. components

2009-06-28 Thread Luther Baker
I'm not sure this will help - but thought I'd post how I'm configuring
Guice. I've *not* had a serialization problem in my pages.

There are several ways to configure Guice and Wicket, I am configuring Guice
as a Module. I've tried to build up the example from xml configuration to
Guice Module to Dao to Service to Page ...

It's quite straightforward and the @Inject directives should be obvious but
maybe there is something else you might notice that will help.

-Luther



*web.xml*


wicket

org.apache.wicket.protocol.http.WicketFilter

  applicationFactoryClassName

org.apache.wicket.guice.GuiceWebApplicationFactory


module

org.effectiveprogramming.effprog.web.MainGuiceModule


configuration

development




*MainGuiceModule.java*

public class MainGuiceModule extends AbstractModule
{
/**
 * @see com.google.inject.AbstractModule#configure()
 */
@Override
protected void configure()
{
bind(WebApplication.class).to(MainApplication.class);

// archive
bind(ArchiveDao.class).to(ArchiveDaoImpl.class);
bind(ArchiveService.class).to(ArchiveServiceImpl.class);

// authentication
bind(UserDao.class).to(UserDaoImpl.class);
bind(UserService.class).to(UserServiceImpl.class);
bind(EncryptionService.class).to(EncryptionServiceImpl.class);

// cleanup
bind(TagCleanupStrategy.class).to(SimpleTagCleanupStrategy.class);

// category
bind(CategoryDao.class).to(CategoryDaoImpl.class);
bind(CategoryService.class).to(CategoryServiceImpl.class);

// post
bind(PostDao.class).to(PostDaoImpl.class);
bind(PostService.class).to(PostServiceImpl.class);

// profile
bind(ProfileDao.class).to(ProfileDaoImpl.class);
bind(ProfileService.class).to(ProfileServiceImpl.class);

// tag
bind(TagDao.class).to(TagDaoImpl.class);
bind(TagService.class).to(TagServiceImpl.class);
}
}


*PostDaoImpl.java*

@SuppressWarnings("unchecked")
public class PostDaoImpl implements PostDao
{
@Inject
private DaoHelper $;

/**
 * @see
org.effectiveprogramming.effprog.service.persistence.dao.PostDao#delete(org.effectiveprogramming.effprog.entity.Post)
 */
public void delete(final Post post)
{
$.delete(post);
}


*PostServiceImpl.java*

public class PostServiceImpl implements PostService
{
@Inject
private ArchiveDao archiveDao;

@Inject
private CategoryDao categoryDao;

@Inject
private PostDao postDao;

@Inject
private TagDao tagDao;


*PostEditorPage.java*

public class PostEditorPage extends BasicLayout implements
IHeaderContributor
{
public PostEditorPage()
{
super(new ResourceModel("head-title"));

// panel
final Panel feebackPanel = new FeedbackPanel("feedback-panel");
feebackPanel.setOutputMarkupPlaceholderTag(true);
feebackPanel.setOutputMarkupId(true);
add(feebackPanel);

// post
final Post post = new Post();
final PostForm form = new PostForm("new-post", post, feebackPanel);
add(form);
}

public PostEditorPage(final Post post)
{
super(new ResourceModel("head-title"));

// panel
final Panel feebackPanel = new FeedbackPanel("feedback-panel");
feebackPanel.setOutputMarkupPlaceholderTag(true);
feebackPanel.setOutputMarkupId(true);
add(feebackPanel);

// post
final PostForm form = new PostForm("new-post", post, feebackPanel);
add(form);
}

private static class PostForm extends StatelessForm
{
private static final long serialVersionUID = 1L;

private static final List EMPTY_LIST =
Collections.emptyList();

@Inject
private CategoryService categoryService;

@Inject
private PostService postService;

@Inject
private TagService tagService;

@Inject
private TagCleanupStrategy tagCleanupStrategy;


*UnpublishedPostsPage.java*

public class UnpublishedPostsPage extends BasicLayout implements
IHeaderContributor
{
@Inject
private PostService postService;

public UnpublishedPostsPage()
{
super(new ResourceModel("head-title"));

// Who am I anyway?
final UserSession sess = (UserSession) Session.get();
final User user = sess.getUser();

// display posts in a panel
final Panel panel = new PostsPanel("posts-panel", new
UnpublishedPostsModel(postService, user), PublishedFlag.UNPUBLISHED);
add(panel);
}


On Fri, Jun 26, 2009 at 12:39 PM, Igor Vaynberg wrote:

> it is wicket-guice module that wraps the service that is retrieved
> from guice with a serializable proxy, not guice itself.
>
> this module treats pages and components exactly the same way becaus

Re: guice-injection on page vs. components

2009-06-24 Thread Luther Baker
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  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?
>


Re: Extending AutoLinkResolver

2009-06-22 Thread Luther Baker
Thoughts?
-Luther


On Sat, Jun 20, 2009 at 6:55 AM, Luther Baker  wrote:

> Is there a programmatic way to override or submit an AutoLink Resolver?
>
> For instance, I'd like to resolve something like  (e.g.: prepend the app context instead of prepending
> resources/classpath ... to look in the web root directory instead of the
> classpath).
>
> 
>
> becomes
>
> 
>
> 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);
> }
>


Extending AutoLinkResolver

2009-06-20 Thread Luther Baker
Is there a programmatic way to override or submit an AutoLink Resolver?

For instance, I'd like to resolve something like 

becomes



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

2009-06-19 Thread Luther Baker
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  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(

Re: [OFF TOPIC] Java desktop applications

2009-06-15 Thread Luther Baker
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
>
>


Re: wicket:message on an attribute

2009-06-14 Thread Luther Baker
That did it - thank you,

-Luther


On Sun, Jun 14, 2009 at 10:14 AM, Maarten Bosteels
wrote:

>
> 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 
> wrote:
>
> > Is there a way to use wicket:message on markup attributes?
> >
> > Pseudo something like this?
> >
> > 
> >
> > Thanks,
> >
> > -Luther
> >
>


wicket:message on an attribute

2009-06-14 Thread Luther Baker
Is there a way to use wicket:message on markup attributes?

Pseudo something like this?



Thanks,

-Luther


Re: [OFF TOPIC] Java desktop applications

2009-06-12 Thread Luther Baker
On Fri, Jun 12, 2009 at 5:57 PM, Jeremy Thomerson  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


Re: [OFF TOPIC] Java desktop applications

2009-06-12 Thread Luther Baker
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 Compagner
> 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  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.

Re: [OFF TOPIC] Java desktop applications

2009-06-12 Thread Luther Baker
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 wrote:

> 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
> 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 Compagner
> > 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  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: refresh page

2009-06-12 Thread Luther Baker
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
 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 IModel 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  of categories
target.addComponent(categoriesParent);
}

};


To test the idea ... this works when placed in the markup after the input I
want to clean out:


document.getElementById("category_candidate1e").value =
'';


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  element from within my
Page.java?


Re: refresh page

2009-06-12 Thread Luther Baker
>
> mount the page with hybridurlcodingstrategy and your problems will go away.
>

Flawless Victory!

Thanks everybody,

-Luther


Re: refresh page

2009-06-11 Thread Luther Baker
So it turns out I'm going to want to display these values as a list  ...
 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  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 
>
> 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 > 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 > content to any >
>> 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

2009-06-11 Thread Luther Baker
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 

> 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  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  content to any 
> 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
>
>


refresh page

2009-06-11 Thread Luther Baker
If I add a few values to a page 

Re: AW: AW: wicket on java server

2009-06-10 Thread Luther Baker
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

2009-06-10 Thread Luther Baker
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  wrote:

> On Wed, Jun 10, 2009 at 11:34 AM, Frank Tegtmeyer 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

2009-06-10 Thread Luther Baker
>
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  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 Tegtmeyer 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: Ajax and LoadableDetachableModel

2009-06-09 Thread Luther Baker
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  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 OutputMarkup

Re: Ajax and LoadableDetachableModel

2009-06-09 Thread Luther Baker
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
>
>


Ajax and LoadableDetachableModel

2009-06-09 Thread Luther Baker
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: JPA EntityManager storage

2009-06-09 Thread Luther Baker
> 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
wrote:

> On Tue, Jun 9, 2009 at 8:39 AM, Martin
> Makundi 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
>
>


Re: JPA EntityManager storage

2009-06-09 Thread Luther Baker
Careful, that link got mangled:

https://www.hibernate.org/43.html

Hope this helps,

-Luther



On Tue, Jun 9, 2009 at 7:10 AM, Luther Baker  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  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

2009-06-09 Thread Luther Baker
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  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
>
>


Ajax Buttons and Form

2009-06-07 Thread Luther Baker
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 TextField *postId* = new TextField("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 IModel newModel = new
CompoundPropertyModel(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
Form 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

2009-06-06 Thread Luther Baker
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  analog of , 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

2009-06-05 Thread Luther Baker
This worked out for me:

*html*
[feedback]

*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  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 
>> 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 
>> >> 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:
>> >> >
>> >> >  
>> >> >
>> >> >  Login
>> >> > failed. Please try again.
>> >> >
>> >> >  
>> >> >
>> >> >
>> >> > 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

2009-06-04 Thread Luther Baker
Thanks ... I will try to apply a behavior ...

-Luther


On Fri, Jun 5, 2009 at 1:02 AM, Jeremy Thomerson
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 
> 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 
> >> 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:
> >> >
> >> >  
> >> >
> >> >  Login
> >> > failed. Please try again.
> >> >
> >> >  
> >> >
> >> >
> >> > 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

2009-06-04 Thread Luther Baker
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  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 
> 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:
> >
> >  
> >
> >  Login
> > failed. Please try again.
> >
> >  
> >
> >
> > 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
>
>


Dynamic green or red UL background for FeedbackPanel

2009-06-04 Thread Luther Baker
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:

  

  Login
failed. Please try again.

  


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: OT: ESB

2009-06-03 Thread Luther Baker
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 

> 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 :
> > 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 
> 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: Spring Autowired and @SpringBean

2009-06-02 Thread Luther Baker
Thanks Jeoren.

I wasn't using @Component - that could very well be it.

I'll try it - and thanks for suggestion.

-Luther



On Tue, Jun 2, 2009 at 2:42 PM, Jeroen Steenbeeke  wrote:

> Not sure if this will help, but I have the following in my Spring
> configuration file:
> 
> http://www.springframework.org/schema/beans";
>  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
>  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/context
>  http://www.springframework.org/schema/context/spring-context-2.5.xsd
>  ">
>  
>
>base-package="path.to.my.beans.impl" />
> 
> For each bean implementation I use
> @org.springframework.stereotype.Component, and for each property that needs
> to be set on these beans I use
> @org.springframework.beans.factory.annotation.Autowired.
> This way you can do the following:
>
> @Component
> public class FooServiceImpl implements FooService {
>  @Autowired
>  private BarService bar;
>  public void doSomething() {
>// Does something
>  }
>  public void setBar(BarService bar) {
>this.bar = bar;
>  }
> }
> And in your Wicket pages you use:
> public class MyPage extends Page {
>  @SpringBean
>  private FooService service;
>  public MyPage() {
>super();
>service.doSomething();
>  }
> }
> And of course, don't forget the SpringComponentInjector (which you already
> have) - and the required fields in your web.xml:
>
> 
>  contextConfigLocation
>  classpath:your_application_context.xml
>  
> Hope this helps,
> Jeroen
>


Re: Spring Autowired and @SpringBean

2009-05-31 Thread Luther Baker
Thanks for the suggestion Vasu. I tried this in my 'Service' class:

@Service(value = "logServiceImpl")
public class LogServiceImpl implements LogService
{
...

and this in my page:

public class Home extends BasicLayout
{
@SpringBean(name = "logServiceImpl")
private LogService logService;
...

as well as

public class Home extends BasicLayout
{
@SpringBean
private LogService logService;

I even changed the type in the destination classes to LogServiceImpl and no
luck.

I'm afraid the @Autowire stuff in Spring doesn't work seem to work with
@SpringBean.

Again, thanks for the suggestion. I'm thinking to go back to Guice and
manage transactions without Spring.

-Luther



Depending on what I'm testing, errors look like:

org.springframework.beans.factory.NoSuchBeanDefinitionException: No
bean named 'logServiceImpl' is defined
 at 
org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanDefinition(DefaultListableBeanFactory.java:387)
 at 
org.springframework.beans.factory.support.AbstractBeanFactory.getMergedLocalBeanDefinition(AbstractBeanFactory.java:971)
 at 
org.springframework.beans.factory.support.AbstractBeanFactory.isSingleton(AbstractBeanFactory.java:358)
 at 
org.springframework.context.support.AbstractApplicationContext.isSingleton(AbstractApplicationContext.java:896)
 at 
org.apache.wicket.spring.SpringBeanLocator.isSingletonBean(SpringBeanLocator.java:135)
 at 
org.apache.wicket.spring.injection.annot.AnnotProxyFieldValueFactory.getFieldValue(AnnotProxyFieldValueFactory.java:92)
 at org.apache.wicket.injection.Injector.inject(Injector.java:108)

or

java.lang.IllegalStateException: bean of type
[com.fuzzybearings.fuzzy.service.LogService] not found
 at 
org.apache.wicket.spring.SpringBeanLocator.getBeanNameOfClass(SpringBeanLocator.java:109)
 at 
org.apache.wicket.spring.SpringBeanLocator.getBeanName(SpringBeanLocator.java:195)
 at 
org.apache.wicket.spring.SpringBeanLocator.isSingletonBean(SpringBeanLocator.java:135)
 at 
org.apache.wicket.spring.injection.annot.AnnotProxyFieldValueFactory.getFieldValue(AnnotProxyFieldValueFactory.java:92)
 at org.apache.wicket.injection.Injector.inject(Injector.java:108)

or

java.lang.IllegalStateException: bean of type
[com.fuzzybearings.fuzzy.service.LogServiceImpl] not found
 at 
org.apache.wicket.spring.SpringBeanLocator.getBeanNameOfClass(SpringBeanLocator.java:109)
 at 
org.apache.wicket.spring.SpringBeanLocator.getBeanName(SpringBeanLocator.java:195)
 at 
org.apache.wicket.spring.SpringBeanLocator.isSingletonBean(SpringBeanLocator.java:135)
 at 
org.apache.wicket.spring.injection.annot.AnnotProxyFieldValueFactory.getFieldValue(AnnotProxyFieldValueFactory.java:92)
 at org.apache.wicket.injection.Injector.inject(Injector.java:108)






On Sun, May 31, 2009 at 10:47 PM, Vasu Srinivasan  wrote:

> Have you tried like this:
> @SpringBean(name = "xServiceImpl") XService xservice;
>
>
>
> On Sun, May 31, 2009 at 5:03 PM, Igor Vaynberg  >wrote:
>
> > wicket is looking for these beans in the spring context. if spring is
> > not putting those beans there then it will be a problem.
> >
> > -igor
> >
> > On Sun, May 31, 2009 at 2:19 PM, Luther Baker 
> > wrote:
> > > 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.com
> > >wrote:
> > >
> > >> have you read the wicket spring wiki page? you have to install the

Re: Long content

2009-05-31 Thread Luther Baker
Ah, thanks for the suggestion Vasu.

I looked at this component and don't think I'm looking to have '\n' replaced
or 's and '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  wrote:

> How about MultiLineLabel ?
>
> On Sun, May 31, 2009 at 10:43 PM, Luther Baker  >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 IModel postModel = new
> > CompoundPropertyModel(post);
> >final WebMarkupContainer outer = new WebMarkupContainer("post",
> > postModel);
> >outer.add(new Label("title"));
> >outer.add(new BookmarkablePageLink("category",
> > CategoryPage.class));
> > *outer.add(new Label("content"));*
> >outer.add(new DateLabel("publishedOn", new
> StyleDateConverter("M-",
> > true)));
> >add(outer);
> >
>
>
>
> --
> Regards,
> Vasu Srinivasan
>


Long content

2009-05-31 Thread Luther Baker
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 IModel postModel = new
CompoundPropertyModel(post);
final WebMarkupContainer outer = new WebMarkupContainer("post",
postModel);
outer.add(new Label("title"));
outer.add(new BookmarkablePageLink("category",
CategoryPage.class));
*outer.add(new Label("content"));*
outer.add(new DateLabel("publishedOn", new StyleDateConverter("M-",
true)));
add(outer);


Re: Spring Autowired and @SpringBean

2009-05-31 Thread Luther Baker
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 wrote:

> 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 
> 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
> > page<http://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
>
>


Spring Autowired and @SpringBean

2009-05-31 Thread Luther Baker
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
page,
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;


Re: Does Link work with browser BACK button?

2009-05-31 Thread Luther Baker
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 wrote:

> 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  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:
> >> *
> >> 
> >> Wicket and Legos
> >>  # [web frameworks] :
> >> wicket
> >> 
> >> 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.
> >> 
> >> 2009/05/26 Luther Baker
> >> 
> >>
> >> *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 Link link = new Link(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
>
>


Does Link work with browser BACK button?

2009-05-31 Thread Luther Baker
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:
*

Wicket and Legos
[web frameworks]: wicket

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.

2009/05/26 Luther Baker


*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 Link link = new Link(key)
{
private static final long serialVersionUID = 1L;

@Override
public void onClick()
{
final CategoryPage categoryPage = new
CategoryPage(category);
setResponsePage(categoryPage);
}
};
add(link);
}


Re: Wicket Quickstart vs WIA eclipse projects: why so different?

2009-05-30 Thread Luther Baker
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  wrote:

> Something that may be worth trying is mvn jetty:run-exploded
>
> On Fri, May 29, 2009 at 6:10 PM, Igor Vaynberg  >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
> >  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" 
> > > To: users@wicket.apache.org
> > > Cc: "david" 
> > > 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
> > >  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:
> > >>
> > >>
> > >> **
> > >> 
> > >>configuration
> > >>development
> > >> 
> > >> **
> > >>
> > >> 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
> >
> >
>


Re: nested loop view

2009-05-29 Thread Luther Baker
In my case, I was adding something to 'this' instead of the parent / outer
item:

I think the line

*add(new ListView("reportItems", reportItems) {*

is implicitly

*this.add(new ListView("reportItems", reportItems) {*

and likely not what you want ... try changing it to

*listItem*.add(new ListView("reportItems", reportItems) {


or in context:

add(new ListView("reportList", reportVector) {
   public void populateItem(final ListItem listItem) {
   Vector reportItems = ((ReportDAO)
listItem

 .getModelObject()).getReportItems();
*  listItem.add(new ListView("reportItems",
reportItems) {*


If that doesn't work for you - post the stack trace and try to match up the
line numbers to the source you've posted and someone here might spot the
problem.

-Luther



On Thu, May 28, 2009 at 11:26 PM, khamis0o wrote:

>
> Can you please share the solution?
> I am doing something similar and I get java.lang.IllegalArgumentException:
> A
> child with id 'reoirtItems' already exists
>
>
> /*java*/
> add(new ListView("reportList", reportVector) {
>public void populateItem(final ListItem listItem) {
>Vector reportItems =
> ((ReportDAO) listItem
>
>  .getModelObject()).getReportItems();
>add(new ListView("reportItems", reportItems)
> {
>protected void populateItem(final
> ListItem reportItem) {
>
>ReportItem item =
> (ReportItem) reportItem
>
>  .getModelObject();
>int copyId =
> item.getCopyID();
>String image =
> item.getItemImage();
>String itemClass =
> item.getItemClass();
>String itemSubClass =
> item.getItemSubClass();
>String itemLocation =
> item.getItemLocation();
>String actionDate =
> item.getActionDate();
>String status =
> item.getState();
>String userID =
> item.getUserID();
>
>reportItem.add(new
> Label("image",
>(image ==
> null) ? "Unavailable" : image));
>reportItem
>.add(new
> Label(
>
>"itemClass",
>
>(itemClass.equals("NA") || itemClass == null) ? "Unavailable"
>
>: itemClass));
>reportItem.add(new
> Label("itemSubClass",
>
>  (itemSubClass == null) ? "Unavailable"
>
>: itemSubClass));
>reportItem.add(new
> Label("itemLocation",
>
>  (itemLocation == null) ? "Unavailable"
>
>: itemLocation));
>reportItem
>.add(new
> Label("actionDate",
>
>actionDate == null ? "Unavailable"
>
>: actionDate));
>reportItem.add(new
> Label("status",
>status ==
> null ? "Unavailable" : status));
>reportItem.add(new
> Label("user",
>userID ==
> null ? "Unavailable" : userID));
>}
>
>});
>
>}
>});
> /*HTML*/
> 
>
>
>
>-
>
>
>
>[image path]
>
>
>
>
>Title:
>
>[Item's Title]
>
>
>
>Class:
>
>[class]
>
>
>
>
>Sub-Class:
>
>[subclass]
>
>
>
>
>
>Location:
>
>[location]
>
>
>
>
>
>Date:
>
>[Action
> Date]
>
>
>
>
>Status:
>
>[item state]
>
>
>

Re: Storing css and image files

2009-05-27 Thread Luther Baker
>
> 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  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  continues to work through all of these
changes - with no effort or manual management.

My initial posts/examples were around  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
 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 
:-) Is there an online tutorial for, not just writing components, but
implementing a markup component like ?

A ... thanks,

-Luther


Re: Storing css and image files

2009-05-27 Thread Luther Baker
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  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 
>> 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

2009-05-27 Thread Luther Baker
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 
> 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
>
>
>


wicket logo

2009-05-26 Thread Luther Baker
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

2009-05-26 Thread Luther Baker
On Tue, May 26, 2009 at 11:43 PM, Vasu Srinivasan  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

2009-05-26 Thread Luther Baker
@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*



*instead of*




-Luther



On Tue, May 26, 2009 at 9:13 PM, Luther Baker  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 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:
>>
>> 
>>
>> Wicket replaces the html with > 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 > >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  analog of ,
>> > > 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
>> > >  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  them in your markup.
>> > > >>>
>> > > >>> Martijn
>> > > >>>
>> > > >>
>> > > >> I'd like to pose a design/theoratical thought here 
>> > > >>
>> > > >> I understand that  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
>> > > followin

Re: Storing css and image files

2009-05-26 Thread Luther Baker
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  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:
>
> 
>
> Wicket replaces the html with  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  >wrote:
>
> > I like that idea!
> >
> >
> > On Tue, May 26, 2009 at 10:33 AM, Igor Vaynberg  > >wrote:
> >
> > > it may be helpful to create  analog of ,
> > > 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
> > >  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  >
> > > 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  them in your markup.
> > > >>>
> > > >>> Martijn
> > > >>>
> > > >>
> > > >> I'd like to pose a design/theoratical thought here 
> > > >>
> > > >> I understand that  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:
> > > >>
> > > >>
> > > >>
> > > >> 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:*
> > > >>

Re: Storing css and image files

2009-05-26 Thread Luther Baker
I like that idea!


On Tue, May 26, 2009 at 10:33 AM, Igor Vaynberg wrote:

> it may be helpful to create  analog of ,
> 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
>  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 
> 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  them in your markup.
> >>>
> >>> Martijn
> >>>
> >>
> >> I'd like to pose a design/theoratical thought here 
> >>
> >> I understand that  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:
> >>
> >>
> >>
> >> 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  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 () which obviates
> all
> >>   anxiety by simply letting the framework just manage it.
> >>
> >> So to your point Martijn, is using webapp/css and directly including
>  >> 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 - 

Re: Storing css and image files

2009-05-26 Thread Luther Baker
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  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:






it turns into this:



which always works. In my eyes, I am giving Wicket just enought information
to find my css files. How Wicket decides to encode the  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  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,






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



and fetching pages from webapp/ seems much more volatile to me than using



 

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 
> 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  them in your markup.
> >>
> >> Martijn
> >>
> >
> > I'd like to pose a design/theoratical thought here 
> >
> > I understand that  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:
> >
> >
> >
> > 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  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 () which obviates all
> >   anxiety by simply letting the framework just manage it.
> >
> > So to your point Martijn, is using webapp/css and directly including
>

Re: Generic BookmarkablePage

2009-05-25 Thread Luther Baker
Just exploring this a bit deeper ... these all end up doing the same thing.

final Link link = new BookmarkablePageLink("a-title",
Home.class);
this.add(link);
final IModel m = link.getModel();
final Object o = m.getObject();

final Link link = new BookmarkablePageLink("a-title",
Home.class);
this.add(link);
final IModel m = link.getModel();
final Object o = m.getObject();

final Link link = new BookmarkablePageLink("a-title",
Home.class);
this.add(link);
final IModel m = link.getModel();
final Object o = m.getObject();

This breaks for obvious reasons:

final Link link = new BookmarkablePageLink("a-title",
Home.class);
this.add(link);
final IModel m = link.getModel();
final Object o = m.getObject();

But this DOES work (incorrectly with respect to intent):

final Link link = new BookmarkablePageLink("a-title",
Home.class);
this.add(link);
*final IModel m = (IModel) link.getModel();*
final Object o = m.getObject();

And this is broken (correctly - it doesn't compile):

final Link link = new BookmarkablePageLink("a-title",
Home.class);
this.add(link);
final IModel m = (IModel) link.getModel();
final Object o = m.getObject();


Using  allows me to cast the model. Using  does not allow me to
cast. Now that I understand the idea here, I think technically, Void is
probably a better choice here. Does that make sense Igor?

Implementation aside, conceptually and with respect to intent, I also think
 seems a little more final and resolute - an explicit choice by the
developer -- whereas  seems to convey ... "ah, I need to keep my options
open :) Maybe I'll need to cast this later." Indeed, that is what prompted
me to do the test above.

For what its worth, I'd never seen  before this thread. Thanks Igor
and James.

Thanks,

-Luther


Igor's perspective -
One 'self-documenting' part


On Mon, May 25, 2009 at 10:38 AM, Igor Vaynberg wrote:

> no, you cannot instantiate , but you can instantiate  and
> assign it to  as per my example below
>
> -igor
>
> On Mon, May 25, 2009 at 6:05 AM, James Carman
>  wrote:
> > On Sun, May 24, 2009 at 11:16 PM, Igor Vaynberg 
> wrote:
> >> final Link link = new BookmarkablePageLink("a-contact",
> >>
> >> if you are not intending on using the model use  which will help
> enforce that
> >
> > Care to elaborate on that?  How does  assure that folks aren't
> > going to use the model better than ?  You can't instantiate a
> > BookmarkablePageLink.
> >
> > -
> > 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: Storing css and image files

2009-05-25 Thread Luther Baker
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 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  them in your markup.
>>
>> Martijn
>>
>
> I'd like to pose a design/theoratical thought here 
>
> I understand that  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:
>
> 
>
> 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 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 () which obviates all
>anxiety by simply letting the framework just manage it.
>
> So to your point Martijn, is using webapp/css and directly including  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  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
>  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

2009-05-25 Thread Luther Baker
**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  them in your markup.
>
> Martijn
>

I'd like to pose a design/theoratical thought here 

I understand that  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:



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 ) which obviates all
   anxiety by simply letting the framework just manage it.

So to your point Martijn, is using webapp/css and directly including  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  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
 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


Pages and Namespaces

2009-05-24 Thread Luther Baker
Assuming a parent page (Layout.html) that contains a link  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: Generic BookmarkablePage

2009-05-24 Thread Luther Baker
On Sat, May 23, 2009 at 4:34 PM, Igor Vaynberg wrote:

> final Link link=
>
> -igor
>

@James
The seems to work just fine:

final Link link = new BookmarkablePageLink("a-contact", ...);


@Igor
Just wanted to clarify ... it is hard to tell exactly what you're
suggesting:

final Link link = new BookmarkablePageLink("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
>  wrote:
> > BookmarkablePageLink perhaps?
> >
> > On Sat, May 23, 2009 at 2:05 PM, Luther Baker 
> 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 Link link = new
> >> BookmarkablePageLink("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
>
>


IModel and ResourceModel

2009-05-23 Thread Luther Baker
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:

IModel 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
IModel? 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


Generic BookmarkablePage

2009-05-23 Thread Luther Baker
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 Link link = new
BookmarkablePageLink("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


Re: Ajax appends to a Table

2009-05-23 Thread Luther Baker
On Fri, May 22, 2009 at 10:01 AM, Igor Vaynberg wrote:

> 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


Ajax appends to a Table

2009-05-21 Thread Luther Baker
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  full of 's and  of  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

2009-05-05 Thread Luther Baker
> 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

2009-05-04 Thread Luther Baker
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



-Luther


On Mon, May 4, 2009 at 5:01 PM, Jeremy Thomerson
wrote:

> 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
>  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 IModel 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
> >  wrote:
> >> why not use a  ?
> >>
> >> Martijn
> >>
> >> On Mon, May 4, 2009 at 8:08 PM, Jeremy Thomerson
> >>  wrote:
> >>> add(new Label("appTitle", new ResourceModel("your.title.key"));
> >>>
> >>> also, change your html:
> >>> this will be replaced
> >>>
> >>> 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
> >>>  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:
> 
>  
>   
>  
> 
>  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

2009-04-12 Thread Luther Baker
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 wrote:

> 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
>
>


Re: serialVersionUID

2009-04-11 Thread Luther Baker
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: serialVersionUID

2009-04-11 Thread Luther Baker
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  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  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

2009-04-11 Thread Luther Baker
>
> 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

2009-04-11 Thread Luther Baker
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  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
>
>


serialVersionUID

2009-04-11 Thread Luther Baker
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: Cache oddity ... maybe

2009-04-05 Thread Luther Baker
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);
 

Cache oddity ... maybe

2009-04-04 Thread Luther Baker
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


feedback panel

2009-04-04 Thread Luther Baker
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  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


From Window to Modal Window Form Model

2009-04-03 Thread Luther Baker
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


Submitting an Ajax Modal

2009-04-03 Thread Luther Baker
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


Forms and AjaxFallbackButton

2009-04-03 Thread Luther Baker
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


Re: View the Source

2009-04-02 Thread Luther Baker
>
>
> 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


Re: View the Source

2009-04-02 Thread Luther Baker
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
wrote:

> On Thu, Apr 2, 2009 at 3:21 PM, luther.baker 
> 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
>
>


View the Source

2009-04-02 Thread Luther Baker
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: delete onSubmit

2009-04-02 Thread Luther Baker
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
wrote:

> 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 
> 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
>
>


Re: Feedback Panel

2009-04-01 Thread Luther Baker
ty.

On Wed, Apr 1, 2009 at 9:33 PM, Jeremy Thomerson
wrote:

> this.error(getString('key'))
>
> --
> Jeremy Thomerson
> http://www.wickettraining.com
>
>
>
> On Wed, Apr 1, 2009 at 9:23 PM, Luther Baker 
> 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
> >
>


Feedback Panel

2009-04-01 Thread Luther Baker
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


delete onSubmit

2009-04-01 Thread Luther Baker
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


DropDown Models

2009-04-01 Thread Luther Baker
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()
{
List 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()
{
List 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


  1   2   >