Re: 6.0.x Docs Down?

2014-04-21 Thread William Speirs
Ah, OK... I get so many emails from Apache lists I must have missed that
one :-\

Thanks...

Bill-


On Mon, Apr 21, 2014 at 12:26 PM, Martin Grigorov wrote:

> As Apache committer you should be aware that the BuildBot servers are down
> because of failed disks ;)
>
> Infra works on this since a few days.
> On Apr 21, 2014 7:01 PM, "William Speirs"  wrote:
>
> > Am I looking in the wrong place, or are the 6.0.x docs down and have been
> > for almost a week now?
> >
> > http://ci.apache.org/projects/wicket/apidocs/6.0.x/
> >
> > An old link for the 1.5 docs is still up and working:
> > https://wicket.apache.org/apidocs/1.5/ But I cannot figure out how to
> > munge
> > that into something for Wicket 6.
> >
> > Thanks!
> >
> > Bill-
> > -
> > William R. Speirs
> > Metrink: www.metrink.com
> > LinkedIn: www.linkedin.com/in/williamspeirs/
> > (203) 903-4453
> >
>


6.0.x Docs Down?

2014-04-21 Thread William Speirs
Am I looking in the wrong place, or are the 6.0.x docs down and have been
for almost a week now?

http://ci.apache.org/projects/wicket/apidocs/6.0.x/

An old link for the 1.5 docs is still up and working:
https://wicket.apache.org/apidocs/1.5/ But I cannot figure out how to munge
that into something for Wicket 6.

Thanks!

Bill-
-
William R. Speirs
Metrink: www.metrink.com
LinkedIn: www.linkedin.com/in/williamspeirs/
(203) 903-4453


Re: Introducing Croquet: Combining Wicket, Jetty, Hibernate, and Guice

2014-04-15 Thread William Speirs
I hadn't heard of it. There are a few ORMs out there. I've looked at this
library as well: http://jdbi.org/ However, that's a bit too much SQL
writing for just the basic objects for me. Though it is a GREAT setup to
make unit testing REALLY easy.

I just find the JPA API so clumsy, especially when building dynamic
queries. Even Hibernate's "native" interface is MUCH better than JPA.

Bill-


On Tue, Apr 15, 2014 at 3:26 AM, Martin Grigorov wrote:

> what do you think about JOOQ ?
>
>
> http://www.petrikainulainen.net/programming/jooq/using-jooq-with-spring-crud/
>
> Martin Grigorov
> Wicket Training and Consulting
>
>
> On Tue, Apr 15, 2014 at 6:00 AM, William Speirs 
> wrote:
>
> > Off-topic a bit... on the JPA front, I'm still relatively new and finding
> > it not as useful as I would have hoped. Beyond VERY simple
> > read-by-primary-key and update/create/delete, anything else seems
> tedious.
> > I'm having to learn the JPA query language (yes, you can use SQL but then
> > you lose generics/typing). I'm highly considering updating another one of
> > my projects SOP4J-DBUTILS (https://github.com/wspeirs/sop4j-dbutils) to
> > handle JPA annotations for the basic CRUD operations, then just making it
> > slightly easier to use complex where clauses to populate POJOs.
> >
> > Thoughts?
> >
> > Bill-
> >
> > P.S. We should probably take this off the Wicket list if folks want to
> > continue discussing...
> >
> >
> >
> > On Mon, Apr 14, 2014 at 9:03 AM, Chris Snyder  > >wrote:
> >
> > > Thanks for the reply - no worries on the delay.
> > >
> > > In my case, I'm using EclipseLink. I originally was using Hibernate,
> but
> > > switched after encountering a known bug in Hibernate (the specifics of
> > > which I no longer recall). Since I was sticking to using the pure JPA
> > API,
> > > it was a quick drop-in replacement. Recently, however, I have used a
> > couple
> > > of EclipseLink-specific features, so it wouldn't be as quick to switch
> > back
> > > (assuming that the bug in Hibernate has been fixed).
> > >
> > > This certainly wouldn't stop me from checking out Croquet - if I end up
> > > adapting it to use EclipseLink, I'll be sure to share my changes.
> > >
> > > Best,
> > > Chris
> > >
> > >
> > > On Mon, Apr 14, 2014 at 8:44 AM, Bill Speirs 
> > > wrote:
> > >
> > > > Chris, sorry for not responding more quickly... was traveling back
> from
> > > > ApacheCon NA.
> > > >
> > > > Honestly, it would be non-trivial to drop in a replacement to
> > Hibernate.
> > > > The JpaPersistService (http://goo.gl/FeI6xU) handles the
> configuration
> > > > coming from persistence.xml and has nothing Hibernate specific. The
> > > problem
> > > > is the CroquetPersistService, DataSourceHibernateModule, and
> > > > EntityManagerProxyFactory classes.
> > > >
> > > > What JPA provider would you rather use? I've never used anything but
> > > > Hibernate, and never had issues with it... just curious why you'd
> like
> > to
> > > > use something else.
> > > >
> > > > Also, patches/pull requests are always happily accepted :-)
> > > >
> > > > Thanks for checking it out...
> > > >
> > > > Bill-
> > > >
> > > >
> > > > On Wed, Apr 9, 2014 at 1:05 PM, Chris Snyder <
> > chris.sny...@biologos.org
> > > > >wrote:
> > > >
> > > > > Looks like awesome work - very clean page design and excellent
> > > > > documentation, and I'm sure that the quality extends to the code as
> > > well.
> > > > > I'll definitely be looking into this for my next project, if not
> > > porting
> > > > > some of my current ones.
> > > > >
> > > > > When using Croquet, how easy would it be to drop in a different JPA
> > > > > implementation in place of Hibernate?
> > > > >
> > > > > Best,
> > > > > Chris
> > > > >
> > > > >
> > > > > On Wed, Apr 9, 2014 at 12:51 PM, William Speirs <
> wspe...@apache.org>
> > > > > wrote:
> > > > >
> > > > > > I gave a talk at ApacheCon NA yesterday on Croquet. It is a
> > > combination
> > > > > of
> > > > > > Wicket, Jetty, Hibernate, and Guice to make it super-easy to
> start
> > > > > writing
> > > > > > Wicket code almost immediately, instead of spending time
> > configuring
> > > > > > everything.
> > > > > >
> > > > > > Slides:
> > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> https://docs.google.com/presentation/d/1m3jdbpYoSBOCPz8Wes9mPvhf8TLp_3dndj_gW08iFL8/
> > > > > > Code: https://github.com/metrink/croquet
> > > > > > Docs: http://croquet.metrink.com
> > > > > >
> > > > > > Thanks...
> > > > > >
> > > > > > Bill-
> > > > > >
> > > > >
> > > >
> > >
> > >
> > >
> > > --
> > > Chris Snyder
> > > Web Developer, BioLogos
> > > 616.328.5218 x203
> > > biologos.org
> > >
> >
>


Re: Introducing Croquet: Combining Wicket, Jetty, Hibernate, and Guice

2014-04-14 Thread William Speirs
Off-topic a bit... on the JPA front, I'm still relatively new and finding
it not as useful as I would have hoped. Beyond VERY simple
read-by-primary-key and update/create/delete, anything else seems tedious.
I'm having to learn the JPA query language (yes, you can use SQL but then
you lose generics/typing). I'm highly considering updating another one of
my projects SOP4J-DBUTILS (https://github.com/wspeirs/sop4j-dbutils) to
handle JPA annotations for the basic CRUD operations, then just making it
slightly easier to use complex where clauses to populate POJOs.

Thoughts?

Bill-

P.S. We should probably take this off the Wicket list if folks want to
continue discussing...



On Mon, Apr 14, 2014 at 9:03 AM, Chris Snyder wrote:

> Thanks for the reply - no worries on the delay.
>
> In my case, I'm using EclipseLink. I originally was using Hibernate, but
> switched after encountering a known bug in Hibernate (the specifics of
> which I no longer recall). Since I was sticking to using the pure JPA API,
> it was a quick drop-in replacement. Recently, however, I have used a couple
> of EclipseLink-specific features, so it wouldn't be as quick to switch back
> (assuming that the bug in Hibernate has been fixed).
>
> This certainly wouldn't stop me from checking out Croquet - if I end up
> adapting it to use EclipseLink, I'll be sure to share my changes.
>
> Best,
> Chris
>
>
> On Mon, Apr 14, 2014 at 8:44 AM, Bill Speirs 
> wrote:
>
> > Chris, sorry for not responding more quickly... was traveling back from
> > ApacheCon NA.
> >
> > Honestly, it would be non-trivial to drop in a replacement to Hibernate.
> > The JpaPersistService (http://goo.gl/FeI6xU) handles the configuration
> > coming from persistence.xml and has nothing Hibernate specific. The
> problem
> > is the CroquetPersistService, DataSourceHibernateModule, and
> > EntityManagerProxyFactory classes.
> >
> > What JPA provider would you rather use? I've never used anything but
> > Hibernate, and never had issues with it... just curious why you'd like to
> > use something else.
> >
> > Also, patches/pull requests are always happily accepted :-)
> >
> > Thanks for checking it out...
> >
> > Bill-
> >
> >
> > On Wed, Apr 9, 2014 at 1:05 PM, Chris Snyder  > >wrote:
> >
> > > Looks like awesome work - very clean page design and excellent
> > > documentation, and I'm sure that the quality extends to the code as
> well.
> > > I'll definitely be looking into this for my next project, if not
> porting
> > > some of my current ones.
> > >
> > > When using Croquet, how easy would it be to drop in a different JPA
> > > implementation in place of Hibernate?
> > >
> > > Best,
> > > Chris
> > >
> > >
> > > On Wed, Apr 9, 2014 at 12:51 PM, William Speirs 
> > > wrote:
> > >
> > > > I gave a talk at ApacheCon NA yesterday on Croquet. It is a
> combination
> > > of
> > > > Wicket, Jetty, Hibernate, and Guice to make it super-easy to start
> > > writing
> > > > Wicket code almost immediately, instead of spending time configuring
> > > > everything.
> > > >
> > > > Slides:
> > > >
> > > >
> > >
> >
> https://docs.google.com/presentation/d/1m3jdbpYoSBOCPz8Wes9mPvhf8TLp_3dndj_gW08iFL8/
> > > > Code: https://github.com/metrink/croquet
> > > > Docs: http://croquet.metrink.com
> > > >
> > > > Thanks...
> > > >
> > > > Bill-
> > > >
> > >
> >
>
>
>
> --
> Chris Snyder
> Web Developer, BioLogos
> 616.328.5218 x203
> biologos.org
>


Introducing Croquet: Combining Wicket, Jetty, Hibernate, and Guice

2014-04-09 Thread William Speirs
I gave a talk at ApacheCon NA yesterday on Croquet. It is a combination of
Wicket, Jetty, Hibernate, and Guice to make it super-easy to start writing
Wicket code almost immediately, instead of spending time configuring
everything.

Slides:
https://docs.google.com/presentation/d/1m3jdbpYoSBOCPz8Wes9mPvhf8TLp_3dndj_gW08iFL8/
Code: https://github.com/metrink/croquet
Docs: http://croquet.metrink.com

Thanks...

Bill-


Re: Wicket + Guice + Transactional

2014-03-02 Thread William Speirs
Thanks for the idea... it worked! However the only hitch now is that I'm
force to use field injection which makes unit testing that much harder (I
really like everything constructor injected).

I guess what I'd need to do is have my Guice binding be to a @Provides
method which constructs a proxy class so that everything can be properly
injected and serialized. Any thoughts on how I'd go about doing that?

Bill-


On Sun, Mar 2, 2014 at 1:04 PM, uwe schaefer  wrote:

>
> On 02.03.2014 14:51, Bill Speirs wrote:
>
>> field in the object. However it ONLY does this when I mark the methods as
>> @Transactional
>>
> yes, guice creates a proxy if it needs to (and it needs to if it needs to
> intercept the method call due to @Transactional).
> the point is here, try wrapping a wicket proxy around (or make the
> wicket-injector do the injection rather than guice itself), and your
> serialization problems are gone.
>
> cu uwe
>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


Re: Wicket + Guice + Transactional

2014-03-01 Thread William Speirs
Does anyone have any thoughts on this?

Thanks!

Bill-


On Wed, Feb 26, 2014 at 11:10 PM, William Speirs  wrote:

> I'm using guice-persist (
> http://code.google.com/p/google-guice/wiki/GuicePersist) with Wicket and
> trying to construct a SortableDataProvider that leverages Guice's
> @Transactional annotation on the methods that read from the DB. In my page
> I pass this SortableDataProvider to a DataTable which down the line sets a
> field in a DataViewBase to this SortableDataProvider:
>
> private final IDataProvider dataProvider;
>
> When Guice constructs this SortableDataProvider it rewrites (creates new?)
> the class using CGLIB and adds a field of type
> com.google.inject.internal.InterceptorStackCallback to my
> SortableDataProvider. Unfortunately, this type is not Serializable and
> looks like it never will be:
> https://code.google.com/p/google-guice/issues/detail?id=12
>
> I see a few options for "solving" this problem:
>
> 1) The IDataProvider field in the DataViewBase could be marked as
> transient getting around the issue that InterceptorStackCallback isn't
> Serializable.
>
> 2) I can remove the @Transactional annotation from my methods. This way
> Guice does NOT rewrite (create a new) class that adds an
> InterceptorStackCallback field.
>
> So my questions are:
>
> 1) What are the chances that DataViewBase could be updated to mark the
> IDataProvider field as transient?
>
> 2) Does anyone know the implications of NOT marking my methods as
> @Transactional? I'm only doing SELECT statements in the code, and the
> EntityManager is bound to the request. I'm just familiar enough with JPA
> (Hibernate is my provider in this case) to be dangerous :-)
>
> 3) Is there anything else I can do?
>
> Thanks!
>
> Bill-
>


Wicket + Guice + Transactional

2014-02-26 Thread William Speirs
I'm using guice-persist (
http://code.google.com/p/google-guice/wiki/GuicePersist) with Wicket and
trying to construct a SortableDataProvider that leverages Guice's
@Transactional annotation on the methods that read from the DB. In my page
I pass this SortableDataProvider to a DataTable which down the line sets a
field in a DataViewBase to this SortableDataProvider:

private final IDataProvider dataProvider;

When Guice constructs this SortableDataProvider it rewrites (creates new?)
the class using CGLIB and adds a field of type
com.google.inject.internal.InterceptorStackCallback to my
SortableDataProvider. Unfortunately, this type is not Serializable and
looks like it never will be:
https://code.google.com/p/google-guice/issues/detail?id=12

I see a few options for "solving" this problem:

1) The IDataProvider field in the DataViewBase could be marked as
transient getting around the issue that InterceptorStackCallback isn't
Serializable.

2) I can remove the @Transactional annotation from my methods. This way
Guice does NOT rewrite (create a new) class that adds an
InterceptorStackCallback field.

So my questions are:

1) What are the chances that DataViewBase could be updated to mark the
IDataProvider field as transient?

2) Does anyone know the implications of NOT marking my methods as
@Transactional? I'm only doing SELECT statements in the code, and the
EntityManager is bound to the request. I'm just familiar enough with JPA
(Hibernate is my provider in this case) to be dangerous :-)

3) Is there anything else I can do?

Thanks!

Bill-


Re: Unable to find component in Development ONLY

2013-09-15 Thread William Speirs
Turns out that Eclipse was a red harring. The real issue is that when I run
in Eclipse it runs in development mode but when I run the JAR it is
deployment mode.

Is that of help to anyone?

Thanks...

Bill-
On Sep 14, 2013 10:01 PM, "William Speirs"  wrote:

Before anyone/everyone jumps on me, this code works PERFECTLY when I
build a JAR (using embedded jetty) and run it. However, it fails in
Eclipse with the following:

Last cause: Unable to find component with id 'pageTitle' in
[HtmlHeaderContainer [Component id = _header_5]]
Expected: '_header_5:pageTitle'.
Found with similar names: 'pageTitle'

So clearly my code + HTML is correct, it's more of an Eclipse issue. I
realize this isn't an Eclipse mailing list, but does anyone have any
ideas?

The page I'm trying to render extends a page class, that extends
another, that extends WebPage. Is this where _header_5 comes from?

Thanks...

Bill-


Unable to find component in Eclipse ONLY

2013-09-14 Thread William Speirs
Before anyone/everyone jumps on me, this code works PERFECTLY when I
build a JAR (using embedded jetty) and run it. However, it fails in
Eclipse with the following:

Last cause: Unable to find component with id 'pageTitle' in
[HtmlHeaderContainer [Component id = _header_5]]
Expected: '_header_5:pageTitle'.
Found with similar names: 'pageTitle'

So clearly my code + HTML is correct, it's more of an Eclipse issue. I
realize this isn't an Eclipse mailing list, but does anyone have any
ideas?

The page I'm trying to render extends a page class, that extends
another, that extends WebPage. Is this where _header_5 comes from?

Thanks...

Bill-

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



Re: http://wicketinaction.com/ broken?

2013-07-19 Thread William Speirs
Worked for me... try again?

Bill-


On Fri, Jul 19, 2013 at 2:52 PM, Gabriel Landon  wrote:

> Hi,
>
> The website wicketinaction.com seems to be down, only the home page is
> working.
> All the other pages return a 404.
>
> Where can I find a working version of the website?
>
> Regards,
> Gabriel.
>
>
>
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/http-wicketinaction-com-broken-tp4660379.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


Re: Multiple wicket.properties files in uber JAR

2013-07-08 Thread William Speirs
On Mon, Jul 8, 2013 at 8:24 AM, Sven Meier  wrote:

> Hi,
>
> for string resources you could use shade "transformers" to join the
> property files:
>
> http://stackoverflow.com/**questions/6831954/how-to-**
> package-an-apache-cxf-**application-into-a-monolithic-**
> jar-with-the-maven-s
>
> I'm currently using the Appending Transformer to append all of the
wicket.properties files together, but Wicket doesn't understand that type
of file.

The actual Initializer.properties files aren't an issue as they are in
different locations. However, Wicket never finds them, so they're never
loaded.

The more I think about this, the more I think there are only 2 solutions
for creating a shaded jar with Wicket and Wicket-Extensions:

1)  Come up with a non-colliding way of telling Wicket about Initializers.
Maybe something like wicket-*.properties. So I'd have
wicket-core.properties, wicket-extensions.properties, and
wicket-devutils.properties.

2) Use the Appending Transformer, but modify Wicket so it can handle
multiple initializers in a single wicket.properties file.

Thoughts?

Bill-


Re: Multiple wicket.properties files in uber JAR

2013-07-08 Thread William Speirs
On Jul 8, 2013 2:30 AM, "Martin Grigorov"  wrote:
>
> I don't see another solution.
> Call them manually in the beginning of your MyApp#init() method.

Calling them is one thing, but that's actually not enough. It appears I
also have to add the string resources. (That is where I was really getting
tripped up.)

I guess my real question is, what else am I missing?

Would this be considered a bug? Couldn't we have Wicket look for a single
combined Wicket.properties file, and load everthing accordingly?

I cannot be the only one trying to create a shaded JAR... how have others
solved this?

Bill-


Multiple wicket.properties files in uber JAR

2013-07-07 Thread William Speirs
I'm attempting to create an uber JAR using the Maven shade plugin and
running into an issue shading wicket, wicket-extensions and
wicket-devutils. All 3 of these module contain a wicket.properties file
that point at their respective Initializers. The problem is that when I
create the shaded JAR, the wicket.properties files all want to live in the
same place and overwrite each other. I can combine them into a single
wicket.properties file, but when the properties are loaded
via addInitializer(properties.getProperty("initializer")); only the last
one in the file is used.

Has anyone ever created an uber JAR with wicket and wicket-extensions (I
can drop wicket-devutils if needed)? If so, how did you do it?

If I needed to hack this together, knowing the names of the Initializers,
can I call them "manually"?

Thanks...

Bill-


Re: DI Through Constructors w/Wicket

2013-07-01 Thread William Speirs
There are a few of these libraries to make running Guice in JUnit easier,
Onami is another: http://onami.apache.org/test/

However, if you have to add all of this extra stuff to your unit test, is
it really worth it?

Still struggling with all of this... but starting to hone in on my
project's best practices.

Bill-


On Mon, Jul 1, 2013 at 12:44 PM, uwe schaefer  wrote:

> On 06/29/2013 03:13 PM, William Speirs wrote:
>
>  I'm strongly leaning towards the best practice of: If you're having to
>> create an injector in your unit test, then you're doing it wrong.
>>
>
> maybe it makes it worse in your perspective, but yuo might want to have a
> look at jukito.
>
> https://code.google.com/p/**jukito/ <https://code.google.com/p/jukito/>
>
> at least it makes it easy to combine mockito&guice
>
> cu uwe
>
>
> --**--**-
> To unsubscribe, e-mail: 
> users-unsubscribe@wicket.**apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


Re: clustering and failover

2013-06-29 Thread William Speirs
Another consideration is if you're using any authentication that
relies upon the tomcat session, then bouncing to another box (if
you're doing round-robin load balanced) would mean your users will
have to reauthenticate.

Been there, still have the bite marks from that :-)

Bill-

On Fri, Jun 28, 2013 at 4:50 PM, uwe schaefer  wrote:
> On 06/28/2013 09:19 AM, Martin Grigorov wrote:
>
> Hi Martin,
>
> i already saw and consider your memcached-based session management, thanks.
> the reason i ask the wicket mailing list is, that i assume that wicket only
> needs part of the pagemap (namely the current page) to serve a request, so
> that - hopefully - the data needed to serve a single request can be smaller
> if the pagemap is kept seperate from the session.
>
> is this assumption correct?
>
> cu uwe
>
>
>> I think you should ask this question in Tomcat mailing list.
>> Also check https://code.google.com/p/memcached-session-manager/
>>
>>
>> On Fri, Jun 28, 2013 at 8:46 AM, Uwe Schäfer  wrote:
>>
>>> hi
>>>
>>> quick question about clustering: am i right to believe that putting
>>> session/pagemap data in a memcached-like storage has advantages over the
>>> tomcat session clustering in terms of latency and robust failover
>>> behaviour?
>>> i mean, the latter obviously has the data nearby (when assuming sticky
>>> sessions) whereas the first needs to grab it from (and push it to)
>>> external
>>> storage every time even though it is far more selective about what it
>>> needs.
>>>
>>> i was wondering if tomcat session clustering can effectivly update only
>>> the dirty parts of the session data?
>>>
>>> i'd love any kind of feedback on that topic INCLUDING 'depends'-answers
>>> :)
>>>
>>> cu uwe
>>>
>>> --**--**-
>>> To unsubscribe, e-mail:
>>> users-unsubscribe@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: DI Through Constructors w/Wicket

2013-06-29 Thread William Speirs
I'm just getting to this now... weekend coder.

@MartinGrigorov - this looks exactly like what I want, or parts of it
at least... I'll certainly check it out. And you're right, I shouldn't
be so skeptical, you Wicket folks seem to always come through with
some library when I ask a question :-)

@DanielWatrous - your blog is helpful, except that you instantiate a
Guice instance in your unit test. I'm still wrestling with what I
consider "best practices" with respect to Guice/DI and Unit Tests, but
I'm strongly leaning towards the best practice of: If you're having to
create an injector in your unit test, then you're doing it wrong.

Dependencies should come in through the constructor and constructor
only. In the unit test, mocked instances of those dependencies should
be passed in through the constructor after you've called new to create
the object itself. This ensures you're ONLY testing the object, and
none of its dependencies in that unit test. If you cannot pass your
dependencies through the constructor, it's most likely because you're
not letting the framework create the instance for you, and this
exposes a deficiency in your implementation. This is the problem with
Wicket, it creates the pages for you (unless you implement your own
IPageFactory like in the library Martin linked), which forces you to
use field injection like you did in your blog example.

Draconian "best practice"? Maybe, but when working with a number of
developers on a project, I find it best to keep strict but simple
rules; even better when they can be enforced with things like
Checkstyle.

Am I totally wrong here? Am I missing something? I'd love people's
feedback on this!

Bill-

On Tue, Jun 25, 2013 at 10:38 PM, Daniel Watrous  wrote:
> I worked out this process:
> http://software.danielwatrous.com/wicket-guice-including-unittests/
>
> It enables unittests and may help you toward your goal.
>
> Daniel
>
>
> On Tue, Jun 25, 2013 at 7:14 PM, William Speirs  wrote:
>
>> I think I know the answer before I ask, but is there any way to do
>> constructor injection with Wicket? Say I have a web page and an email
>> service. I need the email service in the web page. Now everyone is
>> going to say, "Simply use field injection." That will work, but makes
>> unit testing a real pain because now I have to setup injection for my
>> unit test (or add additional methods to all of my pages so I can
>> manually set these field, or additional constructors that set these
>> fields). I should be able to unit test a class without needing
>> injection, but instead passing mocks through the constructor.
>>
>> I feel like this is impossible in Wicket currently because the
>> DefaultPageFactory is using reflection to create the page instances
>> instead of the injector (Guice in my case). It would be easy enough to
>> get the injector and call getInstance() to obtain a page instance. The
>> problem is when you need to pass in parameters. There is no concept of
>> parameters for a page other than what is passed via the constructor,
>> so you cannot call something like setPageParameters because it doesn't
>> exist. If using Guice, you could create an @Assisted injection, and
>> have a factory.
>>
>> Has anyone tried creating this type of IPageFactory -- a
>> GuicePageFactory? What kind of pitfalls would exist if I attempted
>> such a thing? Am I being stupid and missing something? Thoughts?
>>
>> Thanks...
>>
>> Bill-
>>
>> -
>> 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



DI Through Constructors w/Wicket

2013-06-25 Thread William Speirs
I think I know the answer before I ask, but is there any way to do
constructor injection with Wicket? Say I have a web page and an email
service. I need the email service in the web page. Now everyone is
going to say, "Simply use field injection." That will work, but makes
unit testing a real pain because now I have to setup injection for my
unit test (or add additional methods to all of my pages so I can
manually set these field, or additional constructors that set these
fields). I should be able to unit test a class without needing
injection, but instead passing mocks through the constructor.

I feel like this is impossible in Wicket currently because the
DefaultPageFactory is using reflection to create the page instances
instead of the injector (Guice in my case). It would be easy enough to
get the injector and call getInstance() to obtain a page instance. The
problem is when you need to pass in parameters. There is no concept of
parameters for a page other than what is passed via the constructor,
so you cannot call something like setPageParameters because it doesn't
exist. If using Guice, you could create an @Assisted injection, and
have a factory.

Has anyone tried creating this type of IPageFactory -- a
GuicePageFactory? What kind of pitfalls would exist if I attempted
such a thing? Am I being stupid and missing something? Thoughts?

Thanks...

Bill-

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



Re: Attaching Ajax Function to Java Method

2013-05-15 Thread William Speirs
On Wed, May 15, 2013 at 10:56 AM, David Beer  wrote:

> Hi Bill
>
> I would also suggest you take a look at the Wicket-Bootstrap project by
> agilecoders for Bootstrap integration. Is very good and has a lot of the
> bootstrap components.
>
> http://wb.agilecoders.de/demo/ and https://github.com/l0rdn1kk0n/**
> wicket-bootstrap/ 
>

That's actually where I started, but they only support providing a list of
choices up-front instead of the callback. I was able to get the callback
working and with less StringBuilder hacky code by using
a separate javascript file and TextTemplate as suggested by Martin Grigorov.

I also tried to get the AutoCompleteTextField[1] component to work with
Bootstrap, but couldn't figure out how to make all the CSS happy. Someone
more familiar with both projects could probably pull it off though, and
that would make a nice addition to Wicket or wicket-bootstrap by the Apache
foundation [2].

Thanks for everyone's help...

Bill-

[1]
http://ci.apache.org/projects/wicket/apidocs/6.x/org/apache/wicket/extensions/ajax/markup/html/autocomplete/AutoCompleteTextField.html

[2] http://mvnrepository.com/artifact/org.apache.wicket/wicket-bootstrap


Re: Attaching Ajax Function to Java Method

2013-05-14 Thread William Speirs
 public  List getOptions() {
> return Arrays.asList( new String[] {"Alabama", "Aftermath", 
> "Absinth"} );
> }
>
>  // There's probably a built-in method that does this…
>
> private String toJSONArray(List strings) {
>     StringBuffer result = new StringBuffer("[");
> for (String string : strings) {
> result.append("'");
> result.append(string);
> result.append("',");
> }
> if (strings.size() > 0) {
> result.deleteCharAt(result.lastIndexOf(","));
> }
> result.append("]");
> return result.toString();
> }
>
> }
>
>
> Hope this works for you.
>
> -- Don Ferguson
>
>
> On Tuesday, May 14, 2013 at 1:36 PM, William Speirs wrote:
>
>> I'm trying to create a typeahead component for Wicket that uses Bootstrap's
>> Typeahead:
>>
>> To set this up though I need to provide the .typeahead method in JavaScript
>> with a function that will return the results, given the query. What I'd
>> like to do is attach that JavaScript function to a Java method much like
>> what is done with an AjaxEventBehavior [2]. I cannot figure out how to go
>> about setting all of this up... any ideas?
>>
>> Thanks...
>>
>> Bill-
>>
>> [1] http://twitter.github.io/bootstrap/javascript.html#typeahead
>> [2]
>> http://ci.apache.org/projects/wicket/apidocs/6.x/org/apache/wicket/ajax/AjaxEventBehavior.html
>>
>>
>
>

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



Attaching Ajax Function to Java Method

2013-05-14 Thread William Speirs
I'm trying to create a typeahead component for Wicket that uses Bootstrap's
Typeahead:

To set this up though I need to provide the .typeahead method in JavaScript
with a function that will return the results, given the query. What I'd
like to do is attach that JavaScript function to a Java method much like
what is done with an AjaxEventBehavior [2]. I cannot figure out how to go
about setting all of this up... any ideas?

Thanks...

Bill-

[1] http://twitter.github.io/bootstrap/javascript.html#typeahead
[2]
http://ci.apache.org/projects/wicket/apidocs/6.x/org/apache/wicket/ajax/AjaxEventBehavior.html


Re: NumberTextField Issue

2013-03-11 Thread William Speirs
OK... so it's not Wicket related, it is a combination of Bootstrap + Chrome
+ HTML5. This blog post I found actually explains it quite well:
http://blog.isotoma.com/2012/03/html5-input-typenumber-and-decimalsfloats-in-chrome/

The short version is that there is a step attribute when an input's type is
number. If you don't specify a step then it defaults to 1 making decimal
values invalid. As soon as I set step="0.01" it worked like a champ (I did
that because it's a currency, but you can also set step="any").

Coming back to Wicket, since the NumberTextField component has the ability
to setMaximum & setMinimum, should it also have a setStep method? Otherwise
you're forced to use a combination of Wicket methods & HTML attributes to
control the input box.

Thoughts?

Bill-


On Mon, Mar 11, 2013 at 4:51 PM, William Speirs  wrote:

> I'll need to double check and get back to you, but I think it might be a
> bootstrap issue. The input box gets styled with controls to increase and
> decrease the number and that might be the issue.
>
> Thanks...
>
> Bill-
> On Mar 11, 2013 5:30 AM, "Martin Grigorov"  wrote:
>
>> Hi,
>>
>>
>> On Sun, Mar 10, 2013 at 9:38 PM, William Speirs 
>> wrote:
>>
>> > I'm trying to use a NumberTextField with a type of Double and the form
>> will
>> > only let me type in integers (or doubles that end in .0). Is this a
>> known
>> > issue? Is there a workaround?
>> >
>>
>> Can you explain more ? I don't remember having such restrictions when I
>> used NTF.
>> Which browser do you use ?
>> Can you create a plain HTML file (without using Wicket) and try to use
>>  with a double with higher precision ?
>>
>>
>> >
>> > My basic code...
>> >
>> > *Java*
>> > private IModel doubleModel;
>> >
>> > final NumberTextField d = new
>> NumberTextField("d",
>> > doubleModel, Double.class);
>> >
>> > d.setMinimum(1.0d);
>> > d.setMaximum(1000.0d);
>> > d.setRequired(true);
>> >
>> > form.add(d);
>> >
>> > *HTML*
>> >
>> >   
>> > Double
>> > 
>> >   
>> > 
>> >   
>> >
>> >
>> > Am I using the wrong component or HTML input type or something? Every
>> time
>> > I type in a number like 5.5 and try to submit the form I get the pop-up
>> > that say, "Invalid value."
>> >
>> > Thoughts?
>> >
>> > Thanks...
>> >
>> > Bill-
>> >
>>
>>
>>
>> --
>> Martin Grigorov
>> jWeekend
>> Training, Consulting, Development
>> http://jWeekend.com <http://jweekend.com/>
>>
>


Re: NumberTextField Issue

2013-03-11 Thread William Speirs
I'll need to double check and get back to you, but I think it might be a
bootstrap issue. The input box gets styled with controls to increase and
decrease the number and that might be the issue.

Thanks...

Bill-
On Mar 11, 2013 5:30 AM, "Martin Grigorov"  wrote:

> Hi,
>
>
> On Sun, Mar 10, 2013 at 9:38 PM, William Speirs 
> wrote:
>
> > I'm trying to use a NumberTextField with a type of Double and the form
> will
> > only let me type in integers (or doubles that end in .0). Is this a known
> > issue? Is there a workaround?
> >
>
> Can you explain more ? I don't remember having such restrictions when I
> used NTF.
> Which browser do you use ?
> Can you create a plain HTML file (without using Wicket) and try to use
>  with a double with higher precision ?
>
>
> >
> > My basic code...
> >
> > *Java*
> > private IModel doubleModel;
> >
> > final NumberTextField d = new
> NumberTextField("d",
> > doubleModel, Double.class);
> >
> > d.setMinimum(1.0d);
> > d.setMaximum(1000.0d);
> > d.setRequired(true);
> >
> > form.add(d);
> >
> > *HTML*
> >
> >   
> > Double
> > 
> >   
> > 
> >   
> >
> >
> > Am I using the wrong component or HTML input type or something? Every
> time
> > I type in a number like 5.5 and try to submit the form I get the pop-up
> > that say, "Invalid value."
> >
> > Thoughts?
> >
> > Thanks...
> >
> > Bill-
> >
>
>
>
> --
> Martin Grigorov
> jWeekend
> Training, Consulting, Development
> http://jWeekend.com <http://jweekend.com/>
>


Re: NumberTextField Issue

2013-03-10 Thread William Speirs
I tried that and get the following:

Component must be applied to a tag with [type] attribute matching [number],
not [text]

So it really wants it to be a number... just not sure why it won't accept
decimals.

Thanks...

Bill-


On Sun, Mar 10, 2013 at 4:11 PM, Paul Bors  wrote:

> Your HTML input type is "number", try using "text" as Wicket would use its
> internal converter to convert (cast) the string user input in HTML to the
> backing model object type (double in your case).
>
> HTML input tag:
> http://www.w3schools.com/tags/att_input_type.asp
>
> Wicket custom converters:
> https://cwiki.apache.org/WICKET/using-custom-converters.html
> Wicket's double converter:
>
> http://wicket.apache.org/apidocs/1.5/org/apache/wicket/util/convert/converter/DoubleConverter.html
>
> As a side note, I've noticed you're using the label's for attribute which
> wicket supports in different formats.
>
> Take a look at the Wicket's XHTML tags:
>
> https://cwiki.apache.org/WICKET/wickets-xhtml-tags.html#Wicket%2527sXHTMLtags-Attributewicket%253Afor
> And also in Java as FormComponentLabel:
>
> http://wicket.apache.org/apidocs/1.5/org/apache/wicket/markup/html/form/FormComponentLabel.html
>
> ~ Thank you,
>Paul C Bors
>
> On Mar 10, 2013, at 15:38, William Speirs  wrote:
>
> > I'm trying to use a NumberTextField with a type of Double and the form
> will
> > only let me type in integers (or doubles that end in .0). Is this a known
> > issue? Is there a workaround?
> >
> > My basic code...
> >
> > *Java*
> >private IModel doubleModel;
> >
> >final NumberTextField d = new NumberTextField("d",
> > doubleModel, Double.class);
> >
> >d.setMinimum(1.0d);
> >d.setMaximum(1000.0d);
> >d.setRequired(true);
> >
> >form.add(d);
> >
> > *HTML*
> >
> >  
> >Double
> >
> >  
> >
> >  
> >
> >
> > Am I using the wrong component or HTML input type or something? Every
> time
> > I type in a number like 5.5 and try to submit the form I get the pop-up
> > that say, "Invalid value."
> >
> > Thoughts?
> >
> > Thanks...
> >
> > Bill-
>


NumberTextField Issue

2013-03-10 Thread William Speirs
I'm trying to use a NumberTextField with a type of Double and the form will
only let me type in integers (or doubles that end in .0). Is this a known
issue? Is there a workaround?

My basic code...

*Java*
private IModel doubleModel;

final NumberTextField d = new NumberTextField("d",
doubleModel, Double.class);

d.setMinimum(1.0d);
d.setMaximum(1000.0d);
d.setRequired(true);

form.add(d);

*HTML*

  
Double

  

  


Am I using the wrong component or HTML input type or something? Every time
I type in a number like 5.5 and try to submit the form I get the pop-up
that say, "Invalid value."

Thoughts?

Thanks...

Bill-


Re: Eclipse or IntelliJ

2013-02-20 Thread William Speirs
I've always used Eclipse and am currently using Juno. The Maven support got
much better, but other stupid things seem to have "broke." For example,
switching tabs into the XML editor (or pom editor) seems to require
calculating Pi to 10 million digits each time. Actually, I think there is a
memory leak somewhere and its just a GC going off, I should load it in
VisualVM and see. There are other annoying things about Eclipse with
respect to settings, but they can usually be "fixed" by editing some file
in the .settings directory.

Tried IntelliJ once and it was terribly slow (and looked a bit ugly on
Linux)... maybe I should try 12?

At the end of the day... anything's better than vim/emacs :-)

Bill-


On Wed, Feb 20, 2013 at 8:03 AM, Martin Grigorov wrote:

> My main problem with Eclipse was that it mixes the classpaths for main and
> test.
> If you have separate config files in the test classpath some weird things
> may happen.
>
> There is a ticket about this since March 2008:
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=224708 and it says "we need
> someone to help us to implement it".
> It strange because Eclipse is OSGi based, i.e. they should have a very good
> control over the classloaders.
>
> So I moved to IDEA and I find it much better for my needs.
>
>
> On Wed, Feb 20, 2013 at 2:52 PM, Richard W. Adams  wrote:
>
> > If you do software development for a living (as opposed to a hobby), one
> > thing to consider is what tools are used at prospective employers. I work
> > at a large (40,000+) company where Eclipse is the standard tool. Partly
> > because it's open source (read "free," no budget impact) & has such a
> > large support community. Plus it meets all our needs.
> >
> > I've used Eclipse for years (both home & work), and have been satisfied
> > with it.
> >
> >
> > **
> >
> > This email and any attachments may contain information that is
> > confidential and/or privileged for the sole use of the intended
> recipient.
> >  Any use, review, disclosure, copying, distribution or reliance by
> others,
> > and any forwarding of this email or its contents, without the express
> > permission of the sender is strictly prohibited by law.  If you are not
> the
> > intended recipient, please contact the sender immediately, delete the
> > e-mail and destroy all copies.
> > **
> >
>
>
>
> --
> Martin Grigorov
> jWeekend
> Training, Consulting, Development
> http://jWeekend.com 
>


Re: Style Modifier

2013-02-03 Thread William Speirs
Cool, thanks Martin!

Bill-


On Sun, Feb 3, 2013 at 2:59 AM, Martin Grigorov wrote:

> Hi Bill,
>
> As we see there is no much interest to put this in wicket-core, but you can
> contribute it to wicketstuff-minis (
> https://github.com/wicketstuff/core/tree/master/jdk-1.6-parent/minis-parent
> )
> if you like.
>
>
> On Sun, Feb 3, 2013 at 5:38 AM, William Speirs  wrote:
>
> > @Paul Bors I would normally do the same type of thing, but I found myself
> > in a situation where I needed to style the background color of a div that
> > is dynamically loaded from a DB. ie, the user is free to chose whatever
> > color they want for the div's background.
> >
> > A quick modification of the style element was useful here...
> >
> > Bill-
> >
> >
> > On Sat, Feb 2, 2013 at 5:18 AM, vineet semwal  > >wrote:
> >
> > > yes,appears useful to me  :)
> > >  however not sure if this should be added in wicket-core..
> > > another way of doing the same thing is a reusable ondomreadyheaderitem
> > >  using jquery's css(propertyName,value) in a neat way ..
> > >
> > > On Fri, Feb 1, 2013 at 8:14 PM, William Speirs 
> > wrote:
> > > > I created a Behavior the other night that allows one to modify the
> > style
> > > > attribute of a tag by easily adding or removing a CSS property. Why
> is
> > > this
> > > > better/different than AttributeModifier? Because you can update a CSS
> > > > property inside the style attribute. Basic usage:
> > > >
> > > > myComponent.add(new StyleModifier("background-color", "blue")); //
> > > changes
> > > > (or adds) the background-color property of the style tag on this
> > > component
> > > > to blue
> > > >
> > > > myComponent.add(new StyleModifier("background-color")); // removes
> the
> > > > background-color property from the style tag on this component
> > > >
> > > > Would anyone else find this useful? Would the devs on this list
> > consider
> > > > taking it in for the next release of Wicket (if so I can open an
> JIRA)?
> > > Is
> > > > this already implemented and I'm just too stupid to have found it?
> > > >
> > > > Thanks...
> > > >
> > > > Bill-
> > >
> > >
> > >
> > > --
> > > regards,
> > >
> > > Vineet Semwal
> > >
> > > -
> > > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> > > For additional commands, e-mail: users-h...@wicket.apache.org
> > >
> > >
> >
>
>
>
> --
> Martin Grigorov
> jWeekend
> Training, Consulting, Development
> http://jWeekend.com <http://jweekend.com/>
>


Re: Style Modifier

2013-02-02 Thread William Speirs
@Paul Bors I would normally do the same type of thing, but I found myself
in a situation where I needed to style the background color of a div that
is dynamically loaded from a DB. ie, the user is free to chose whatever
color they want for the div's background.

A quick modification of the style element was useful here...

Bill-


On Sat, Feb 2, 2013 at 5:18 AM, vineet semwal wrote:

> yes,appears useful to me  :)
>  however not sure if this should be added in wicket-core..
> another way of doing the same thing is a reusable ondomreadyheaderitem
>  using jquery's css(propertyName,value) in a neat way ..
>
> On Fri, Feb 1, 2013 at 8:14 PM, William Speirs  wrote:
> > I created a Behavior the other night that allows one to modify the style
> > attribute of a tag by easily adding or removing a CSS property. Why is
> this
> > better/different than AttributeModifier? Because you can update a CSS
> > property inside the style attribute. Basic usage:
> >
> > myComponent.add(new StyleModifier("background-color", "blue")); //
> changes
> > (or adds) the background-color property of the style tag on this
> component
> > to blue
> >
> > myComponent.add(new StyleModifier("background-color")); // removes the
> > background-color property from the style tag on this component
> >
> > Would anyone else find this useful? Would the devs on this list consider
> > taking it in for the next release of Wicket (if so I can open an JIRA)?
> Is
> > this already implemented and I'm just too stupid to have found it?
> >
> > Thanks...
> >
> > Bill-
>
>
>
> --
> regards,
>
> Vineet Semwal
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


Style Modifier

2013-02-01 Thread William Speirs
I created a Behavior the other night that allows one to modify the style
attribute of a tag by easily adding or removing a CSS property. Why is this
better/different than AttributeModifier? Because you can update a CSS
property inside the style attribute. Basic usage:

myComponent.add(new StyleModifier("background-color", "blue")); // changes
(or adds) the background-color property of the style tag on this component
to blue

myComponent.add(new StyleModifier("background-color")); // removes the
background-color property from the style tag on this component

Would anyone else find this useful? Would the devs on this list consider
taking it in for the next release of Wicket (if so I can open an JIRA)? Is
this already implemented and I'm just too stupid to have found it?

Thanks...

Bill-


Re: Pages, Panels, and Dependency Injection

2013-01-29 Thread William Speirs
@Martin sounds like session is the way to go because passing something as a
page parameter means that the user could just simply change the ID to
whatever they want... never trust the client :-)

@Chris interesting project, I'll have to take a look.

Thank you both!

Bill-


On Tue, Jan 29, 2013 at 8:13 PM, Chris Colman
wrote:

> Webapps are excellent candidates for injecting into the 'thread' rather
> than providing every injectable class with its own special constructor
> (a lot of boring, mechanical work and problem not as run time efficient)
> and then setting up XML or annotations to configure the inject
> mechanisms.
>
> A simple servlet filter "injects" (attaches to) the thread on the way in
> to servicing the request and detaches from the thread on the way out.
>
> We created a very lightweight framework that uses thread injection for
> this purpose and it works magically and requires no special changes to
> UI or model code to work. It's called expojo (expose POJOs) and it's at
> expojo.com
>
> A 'ModelExposer' object is always available to any active thread via a
> call to ModelExposer.get(). The ModelExposer provides repositories (kind
> of like 'look up' DAOs that contain your query methods for your
> particular ORM) and services (DAOs that can make changes to the model).
> So from anywhere in your code you have access to all the repository and
> services you will every need.
>
> It's not the way Spring or Guice do it but it works really well and
> doesn't need any XML or annotations at all and doesn't require you
> change your model or UI objects.
>
> The exPOJO servlet also implements 'open session/persistence manager in
> view' so you can avoid all those nasty 'lazy load' exceptions with ease.
>
>
>
> >-Original Message-
> >From: Bill Speirs [mailto:bill.spe...@gmail.com]
> >Sent: Tuesday, 29 January 2013 12:28 PM
> >To: users@wicket.apache.org
> >Subject: Re: Pages, Panels, and Dependency Injection
> >
> >Still struggling with how to do this. Martin, I understand that most
> people
> >will simply call new PanelA and new PanelB inside their MyPage code
> instead
> >of trying to inject them. However, how does one setup a page that
> requires
> >some service (DAO for example) and that might optionally require a
> >UserBean.
> >
> >So without using DI, I'd simply have 2 constructors:
> >
> >MyPage(DAO myDao)
> >
> >MyPage(DAO myDao, UserBean currentUser)
> >
> >But I cannot create that second constructor as I don't have anything to
> >bind (using Guice terms) UserBean to.
> >
> >Am I required to make a factory for MyPage at that point? Is it
> bad/wrong
> >to pass the UserBean into the constructor via a response page:
> >
> >setResponsePage(new MyPage(new DAO(), currentUser));
> >
> >Thanks...
> >
> >Bill-
> >
> >
> >On Fri, Nov 30, 2012 at 3:35 AM, Martin Grigorov
> >wrote:
> >
> >> Hi,
> >>
> >> Most of the time people inject services to their components.
> >>
> >> To test just components you can use
> WicketTester#startComponentInPage()
> >> methods.
> >>
> >>
> >> On Fri, Nov 30, 2012 at 3:18 AM, William Speirs 
> >> wrote:
> >>
> >> > I'm having trouble understanding how to inject components into a
> page
> >so
> >> > that the page will be easy to unit test later. Say I have a page
> that
> >> > contains two panels. I can easily use constructor injection to
> inject
> >> these
> >> > panels into the page:
> >> >
> >> > class MyPage extends WebPage {
> >> > @Inject
> >> > public MyPage(PanelA a, PanelB b) { ... }
> >> > }
> >> >
> >> > The problem is that all Panels require an id during
> construction.[1]
> >How
> >> do
> >> > I supply the id to my Panels? I could simply construct every PanelA
> >with
> >> an
> >> > id of "panela" and every PanelB with an id of "panel", but that
> doesn't
> >> > seem very flexible. What do other people do in this situation? The
> hope
> >> > would be to pass mocked panels into the page during unit testing,
> >> > the separately test each panel.
> >> >
> >> > What if instead of a panel it was a button where the onSubmit
> method
> >must
> >> > be specified by overriding the method. How does one go about
> injecting
> >> such
> >> > a component so that it's still easy to test later in unit tests?
> >> >
> >> > All thoughts and/or best practices are greatly welcomed. For
> reference
> >> I'm
> >> > using Guice as my dependency injection framework and
> >> > GuiceWebApplicationFactory to inject components into pages.
> >> >
> >> > Thanks...
> >> >
> >> > Bill-
> >> >
> >> > [1]
> >> >
> >> >
> >>
> >http://ci.apache.org/projects/wicket/apidocs/6.0.x/org/apache/wicket/ma
> rkup
> >/html/panel/Panel.html
> >> >
> >>
> >>
> >>
> >> --
> >> Martin Grigorov
> >> jWeekend
> >> Training, Consulting, Development
> >> http://jWeekend.com <http://jweekend.com/>
> >>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


Re: How to set up GuiceWebApplicationFactory and the Guice Servlet scopes

2013-01-12 Thread William Speirs
I used the GuiceWebApplicationFactory as follows in my web.xml:

  my_project

MyProjectFilter

org.apache.wicket.protocol.http.WicketFilter


applicationClassName
com.myproject.Application


   applicationFactoryClassName

 org.apache.wicket.guice.GuiceWebApplicationFactory


   module
   com.myproject.GuiceModule


   wicket-guice.stage
   PRODUCTION


configuration
deployment




Then in the GuiceModule I link up the important bits:

@Override
protected void configure() {
bind(WebApplication.class).to(Application.class);
}

I haven't used @SessionScoped or @RequestScoped at all so I cannot help
with that. Otherwise, everything works as expected...

Bill-


On Fri, Jan 11, 2013 at 4:41 PM, Eric Jablow  wrote:

> Sirs:
>
> How do I take a Wicket-Guice project using the
> GuiceWebApplicationFactory and add support for @SessionScoped and
> @RequestScoped? I tried adding the GuiceFilter before that, but I did
> not add the Guice ServletModule; would that interfere with the web
> application factory? Do I add the ServletModule to module we are
> using, or do I even extend ServletModule?
>
> Respectfully,
> Eric Jablow
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


Re: Wicket, Heroku and scaling

2013-01-11 Thread William Speirs
@Jens Jahnke if you do create an ISessionStore for redis, please post back
if you're willing to share. I could see the use in that!

Thanks...

Bill-


On Wed, Jan 9, 2013 at 3:34 PM, Martin Grigorov wrote:

> Hi,
>
> Yes, you can create your own org.apache.wicket.session.ISessionStore.
> See the default org.apache.wicket.session.HttpSessionStore for inspiration.
> To setup it: org.apache.wicket.Application#setSessionStoreProvider()
>
>
> On Wed, Jan 9, 2013 at 8:05 PM, Jens Jahnke  wrote:
>
> > On Wed, 9 Jan 2013 18:14:51 +0100
> > Martijn Dashorst  wrote:
> >
> > MD> > Would the app benefit from rolling out more dynos?
> > MD>
> > MD> If your app is stateful and depends on the session:
> > MD> it would suck, because heroku doesn't support sticky sessions.
> > MD> Therefore requests will be sent to different dynos and several of
> > MD> Wicket's features will not work.
> > MD>
> > MD> if it isn't stateful and doesn't depend on container session state,
> > MD> then you might be able to benefit from more dynos.
> >
> > Thanks for the information. It is a stateful app. :-(
> >
> > Could it be a workaround to store the session in a redis-store and is
> > this possible with wicket?
> >
> > Regards,
> >
> > Jens
> >
> > --
> > 09. Hartung 2013, 19:01
> > Homepage : http://www.jan0sch.de
> >
> > Victory uber allies!
> >
>
>
>
> --
> Martin Grigorov
> jWeekend
> Training, Consulting, Development
> http://jWeekend.com 
>


Re: FormComponentPanel & onchange Events

2012-12-15 Thread William Speirs
I finally got some time to test a few combinations:

- onchange for panel, getRawInput() = null
- onblur for panel = event never fires

- onchange for field, getRawInput() = null
- onchange for field, getModelObject() = null

- same combinations as above but with AjaxFormComponentUpdatingBehavior;
always null

So just about all combinations still seem to only return null :-(

I put the code for my FormComponentPanel up on pastebin:
http://pastebin.com/AMvYbv2B

Any insight would be great.

Thanks...

Bill-


On Wed, Dec 12, 2012 at 10:57 PM, Colin Rogers <
colin.rog...@objectconsulting.com.au> wrote:

> William,
>
> Is the AjaxEventBehavior added to the panel or the component? What event
> is it fired on?
>
> I'd thought you'd need it to be added to the component (rather than panel)
> and say, triggered 'onblur'. And using a AjaxFormComponentUpdatingBehavior
> rather than AjaxEventBehavior?
>
> Can you post the non-working code up if those suggestions don't solve it?
> I'd be happy to have a look at it.
>
> Cheers,
> Col.
>
> -Original Message-
> From: William Speirs [mailto:wspe...@apache.org]
> Sent: Thursday, 13 December 2012 1:51 PM
> To: users
> Subject: FormComponentPanel & onchange Events
>
> I've created a FormComponentPanel with 2 text boxes: A & B. I've add this
> new FormComponentPanel to my page twice: 1 & 2. What I'd like to have
> happen is when I change the value of 1A I want that same value copied into
> 2A.
>
> I call setOutputMarkupId to true on 1A, 1B, 2A, and 2B. I setup an
> AjaxEventBehavior on panel 1 and it fires as expected. However, inside of
> the onEvent method all of the model instances I try to obtain are always
> null (therefore preventing me from setting 2A). I've tried getting the
> form's model object, the model object for panel 1, and even the model
> object for A1... everything is always null.
>
> Is there some method of FormComponentPanel that I'm not overriding that I
> need to be? Any thoughts on how to make this work?
>
> Thanks...
>
> Bill-
> EMAIL DISCLAIMER This email message and its attachments are confidential
> and may also contain copyright or privileged material. If you are not the
> intended recipient, you may not forward the email or disclose or use the
> information contained in it. If you have received this email message in
> error, please advise the sender immediately by replying to this email and
> delete the message and any associated attachments. Any views, opinions,
> conclusions, advice or statements expressed in this email message are those
> of the individual sender and should not be relied upon as the considered
> view, opinion, conclusions, advice or statement of this company except
> where the sender expressly, and with authority, states them to be the
> considered view, opinion, conclusions, advice or statement of this company.
> Every care is taken but we recommend that you scan any attachments for
> viruses.
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


FormComponentPanel & onchange Events

2012-12-12 Thread William Speirs
I've created a FormComponentPanel with 2 text boxes: A & B. I've add this
new FormComponentPanel to my page twice: 1 & 2. What I'd like to have
happen is when I change the value of 1A I want that same value copied into
2A.

I call setOutputMarkupId to true on 1A, 1B, 2A, and 2B. I setup
an AjaxEventBehavior on panel 1 and it fires as expected. However, inside
of the onEvent method all of the model instances I try to obtain are always
null (therefore preventing me from setting 2A). I've tried getting the
form's model object, the model object for panel 1, and even the model
object for A1... everything is always null.

Is there some method of FormComponentPanel that I'm not overriding that I
need to be? Any thoughts on how to make this work?

Thanks...

Bill-


Re: Recommended way to hide and show table rows dynamically?

2012-12-06 Thread William Speirs
This might be of zero use to you, but I had something similar where I was
exposing a table row by button/link. I created a somewhat generic solution
and posted it here: https://github.com/wspeirs/wicket-details-table

Bill-


On Thu, Dec 6, 2012 at 12:40 PM, shimin_q  wrote:

> I have a table that includes only two rows when it is first loaded, but
> later, depending on the selected value of the first row, I will need to add
> a number of rows to the table.  I assume it is a quite common AJAX task, is
> there a recommended way to do this?  My existing way of handing this has
> run
> into an issue where all the DropDownChoice (select option menu on HTML)
> components that were dynamically added to the table are unable to display
> the selected value after user selection, so I am trying to figure out if it
> is due to my existing AJAX code...   (I am using latest wicket 6.3 and
> jQuery mobile 1.8.2)
>
> Here is the html portion:
>
>
> 
> 
> 
> message
>
> 
> 
>
>
>
>
>
>
>   class="requiredLabel">Metaprofile Type
>   wicket:id="type">
>   default
> 
>
>
>
>   class="requiredLabel">Metaprofile
> Name
>   wicket:id="profileName"/>
>
>
>
>
>
>
>   class="requiredLabel">OXE Node
> 
>   OXENode
> 
>
>
>
>   class="requiredLabel">Free Number Range
>  
>
>
>
>class="requiredLabel">Device Type
>  
>   SIP Extension
> 
>
> ...
>
>
> Now the Wicket code for these:
>
> profileTypeBox = new
> DropDownChoice("type",
> new
> PropertyModel(profile, "type"),
> Arrays.asList(MetaProfileType.values()),
> new IChoiceRenderer() {
> private static final long
> serialVersionUID = 1L;
> @Override
> public Object
> getDisplayValue(MetaProfileType object) {
> return object.name();
> }
> @Override
> public String
> getIdValue(MetaProfileType object, int index) {
> return object.name();
> }
> }
> );
> profileTypeBox.setOutputMarkupId(true);
> add(profileTypeBox);
>
> profileTypeBox.add(new
> AjaxFormComponentUpdatingBehavior("onChange") {
> private static final long serialVersionUID = 1L;
> protected void onUpdate(AjaxRequestTarget target) {
> resetFieldsPerProfileType(target);
> //add any component that will be called in
> resetFieldsPerProfileType()
> target.add(oxeNodeAsteriskImg);
> target.add(oxeNodeLabel);
> target.add(oxeNodeBox);
> target.add(rangeAsteriskImg);
> target.add(rangeLabel);
> target.add(freeNumRangeBox);
> target.add(deviceTypeAsteriskImg);
> target.add(deviceTypeLabel);
> target.add(deviceTypeBox);
> //...
> };
> });
>
> //...
> oxeNodeModel = new
> LoadableDetachableModel>() {
> private static final long serialVersionUID
> = 1L;
> @Override
> protected List load() {
> try {
> List names = null;
> if ((profile!=null) &&
> (profile.getType().equals(MetaProfileType.OXE)
> || profile.getType().equals(MetaProfileType.OXE_WITH_OT)))
> names =
> getOXENodeList();
> if (names == null)
> return
> Collections.emptyList();
> else {
> return names;
> }
> }
> catch (Exception e) {
> return
> Collections.empt

Re: problem with editable datatable

2012-12-01 Thread William Speirs
When I've had to do this, I usually use a fragment. It keeps all the HTML
on a single page and is a bit cleaner I think:
http://wicket.apache.org/learn/examples/usingfragments.html

Bill-


On Fri, Nov 30, 2012 at 8:14 AM, hannes1608  wrote:

> Just realized that I have to create a new component for this. That works,
> but
> it's not really a nice solution.
>
>
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/problem-with-editable-datatable-tp4654370p4654381.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


Pages, Panels, and Dependency Injection

2012-11-29 Thread William Speirs
I'm having trouble understanding how to inject components into a page so
that the page will be easy to unit test later. Say I have a page that
contains two panels. I can easily use constructor injection to inject these
panels into the page:

class MyPage extends WebPage {
@Inject
public MyPage(PanelA a, PanelB b) { ... }
}

The problem is that all Panels require an id during construction.[1] How do
I supply the id to my Panels? I could simply construct every PanelA with an
id of "panela" and every PanelB with an id of "panel", but that doesn't
seem very flexible. What do other people do in this situation? The hope
would be to pass mocked panels into the page during unit testing,
the separately test each panel.

What if instead of a panel it was a button where the onSubmit method must
be specified by overriding the method. How does one go about injecting such
a component so that it's still easy to test later in unit tests?

All thoughts and/or best practices are greatly welcomed. For reference I'm
using Guice as my dependency injection framework and
GuiceWebApplicationFactory to inject components into pages.

Thanks...

Bill-

[1]
http://ci.apache.org/projects/wicket/apidocs/6.0.x/org/apache/wicket/markup/html/panel/Panel.html


Re: Dynamically Toggling a Details Row in a DataTable

2012-10-10 Thread William Speirs
Paul-

Thanks again for all your help. As an FYI, your image didn't come
through. Not sure if you forgot to attach it, or if they aren't
allowed on the mailing list.

I should have mentioned from the start that I was looking to keep this
generic/reusable. I have an implementation working and it doesn't feel
too clunky, so I think I'm on the right track. You can find all of the
code here https://github.com/wspeirs/wicket-details-table/ and the
relevant bits here
https://github.com/wspeirs/wicket-details-table/tree/master/table-test/src/main/java/org/apache/wicket/extensions/markup/html/repeater/data

In the end I extended the DataTable so that I could modify the html
source and add a details row for each repeated row. I created a new
type of column (well two actually) AbstractDetailsColumn which extends
IColumn. This column takes care of implementing the populateItem
method so long as you provide implementations for getDetailsComponent
and getCellComponent. These two methods do exactly what you think they
should/would do. Using an implementation of the AbstractDetailsColumn
you will get a details column which is displayed default for each row
in the table. If you'd rather that column toggle its visibility (my
original request), then you can use the TogglingDetailsColumn class
which adds in the few extra calls to setup an AJAX call to set the
visibility. The implementer of getCellComponent will have to setup the
toggling in whatever AjaxComponent they pick.

Could those of you on the mailing list with more internal development
experience provide some feedback? This is my first project extending
Wicket in any serious way, and I'd eventually like to file a JIRA
ticket and get this into the next release of wicket-extensions if
they'll take it.

Thanks in advance, and I hope this helps others in the future!

Bill-

On Wed, Oct 10, 2012 at 11:54 AM, Paul Bors  wrote:
> See attached "Add a row to a DataTable.png" for a before/after screen shoots
> of how our table of selected items looks like after a row has been added to
> the top of it and refreshed.
>
> ~ Thank you,
>   Paul Bors
>
> -Original Message-
> From: Paul Bors [mailto:p...@bors.ws]
> Sent: Wednesday, October 10, 2012 11:33 AM
> To: users@wicket.apache.org
> Subject: RE: Dynamically Toggling a Details Row in a DataTable
>
> Add a boolean flag to your POJO (domain model object type).
> When you click the details link, set it to true and refresh the table.
>
> When the table refreshes it will hit your DataProvider which will be in
> charge of adding the new POJO with the description at the right location in
> the list (after the one elements that have been marked with true) for the
> current page. Then when the table renders, you would grab a hold of the
> cell's TD element and set its "colspan" attribute to the number of the
> columns and render the HTML you want in it (see how toolbars to the same
> thing).
>
> As an idea, you might need a second flag to represent the type of the row
> (simplified or detailed) or use inheritance and store the type flag at the
> parent class and your collection should hold children as returned via a
> getRowContent() method.
>
> ~ Thank you,
>   Paul Bors
>
> -Original Message-
> From: William Speirs [mailto:wspe...@apache.org]
> Sent: Wednesday, October 10, 2012 10:25 AM
> To: users@wicket.apache.org
> Subject: Re: Dynamically Toggling a Details Row in a DataTable
>
> Paul-
>
> I've modified my DataProvider to provide double the rows. I've also extended
> DataTable to set display: hidden on the details row and also to expand the
> first column to all of the columns.
>
> The main issue I'm having now is linking the button (in say the first
> column) to something which can change the attributes of the cell. I guess my
> main question is, what should control the stat of if a details row is hidden
> or not?
>
> Bill-
>
> On Wed, Oct 10, 2012 at 2:20 AM, Martin Grigorov
> wrote:
>
>> Hi,
>>
>> Check
>> http://wicketinaction.com/2008/10/repainting-only-newly-created-repeat
>> er-items-via-ajax/ This may give you an idea how to add/remove
>> additional rows with Ajax.
>>
>> On Tue, Oct 9, 2012 at 11:21 PM, Bill Speirs 
>> wrote:
>> > Paul-
>> >
>> > Thanks for the response... yea, we'd like to see another row below
>> > the current one, and in an single column. This way we can put
>> > whatever component/panel we'd like in that new row. Any suggestions
>> > on where to
>> get
>> > started? I feel as though I'm going to need to re-work (more than
>> > simply
>> > extend) DataTable as I'll need to add additional ro

Re: Dynamically Toggling a Details Row in a DataTable

2012-10-10 Thread William Speirs
Paul-

I've modified my DataProvider to provide double the rows. I've also
extended DataTable to set display: hidden on the details row and also to
expand the first column to all of the columns.

The main issue I'm having now is linking the button (in say the first
column) to something which can change the attributes of the cell. I guess
my main question is, what should control the stat of if a details row is
hidden or not?

Bill-

On Wed, Oct 10, 2012 at 2:20 AM, Martin Grigorov wrote:

> Hi,
>
> Check
> http://wicketinaction.com/2008/10/repainting-only-newly-created-repeater-items-via-ajax/
> This may give you an idea how to add/remove additional rows with Ajax.
>
> On Tue, Oct 9, 2012 at 11:21 PM, Bill Speirs 
> wrote:
> > Paul-
> >
> > Thanks for the response... yea, we'd like to see another row below the
> > current one, and in an single column. This way we can put whatever
> > component/panel we'd like in that new row. Any suggestions on where to
> get
> > started? I feel as though I'm going to need to re-work (more than simply
> > extend) DataTable as I'll need to add additional rows.
> >
> > Thanks!
> >
> > Bill-
> >
> > On Tue, Oct 9, 2012 at 4:14 PM, Paul Bors  wrote:
> >
> >> Must it be in a separate row? It doesn't make much sense to have
> details in
> >> a separate row unless you want to show the same columns.
> >> And if you are going to show details for the same columns, then why not
> >> just
> >> toggle each of the cell component between a simplified and detailed
> view?
> >> I do it all the time when editing a table row, I toggle between labels
> and
> >> form fields to set the contents of the table row.
> >>
> >> If you do want to show extra details that do not match the columns in
> your
> >> table, use a pop-up or modal pop-up.
> >>
> >>
> >> ~ Thank you,
> >>   Paul Bors
> >>
> >> -Original Message-
> >> From: William Speirs [mailto:wspe...@apache.org]
> >> Sent: Tuesday, October 09, 2012 3:01 PM
> >> To: users@wicket.apache.org
> >> Subject: Dynamically Toggling a Details Row in a DataTable
> >>
> >> I would like to create a component that generates an additional row in a
> >> DataTable for each existing row. This additional row will contain
> "details"
> >> for the above row. I would like to have a column in the DataTable that
> >> contains a link/button/etc which controls the visibility (display:
> hidden
> >> for that row) of the details row. Inside the details row, the colspan
> would
> >> be set to the # of columns and contain an AjaxLazyLoadPanel such that
> when
> >> the row is displayed the getLazyLoadComponent() method is called,
> >> generating
> >> and fetching the proper component.
> >>
> >> So the DataTable will look like a normal DataTable, except when you
> click
> >> the link/button/etc a new row is shown and displays the Component
> returned
> >> from the call to the getLazyLoadComponent() method.
> >>
> >> How would I go about implementing this type of DataTable?
> >>
> >> Thanks in advance...
> >>
> >> Bill-
> >>
> >>
> >> -
> >> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> >> For additional commands, e-mail: users-h...@wicket.apache.org
> >>
> >>
>
>
>
> --
> Martin Grigorov
> jWeekend
> Training, Consulting, Development
> http://jWeekend.com
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


Dynamically Toggling a Details Row in a DataTable

2012-10-09 Thread William Speirs
I would like to create a component that generates an additional row in a
DataTable for each existing row. This additional row will contain "details"
for the above row. I would like to have a column in the DataTable that
contains a link/button/etc which controls the visibility (display: hidden
for that row) of the details row. Inside the details row, the colspan would
be set to the # of columns and contain an AjaxLazyLoadPanel such that when
the row is displayed the getLazyLoadComponent() method is called,
generating and fetching the proper component.

So the DataTable will look like a normal DataTable, except when you click
the link/button/etc a new row is shown and displays the Component returned
from the call to the getLazyLoadComponent() method.

How would I go about implementing this type of DataTable?

Thanks in advance...

Bill-


Group Select with Beans

2012-04-12 Thread William Speirs
I have 2 JavaBeans A & B. A has 2 fields: String name, Integer b_id. B has
2 fields: Integer id, String display.

I have a list of beans for B:
1, "foo"
2, "bar"

I have a single A bean, where its b_id corresponds to an id in bean B
(basically the beans represent 2 tables in a DB with the ids as references
to each other). I want to create a form to edit bean A which includes a
drop-down for all the possible options for bean B. The one hitch is that I
want groups for my drop-down, so I believe I'm forced to use Select &
SelectOption with the appropriate mark-up in HTML.

I have the form completed and working for changing A's name field, but I
cannot figure out how to link the drop-down which displays all my options
for bean B to A's b_id field. I'm using a PropertyModel to modify A's name
field, and but I missing how to link A's b_id to the id from B. Also, my
 has values like option3, option4, option5... I would think I'd
need these to be B's id field values for this to work.

Any help in the right direction would be greatly appreciated. I'm very
close, just missing this one link between my two models.

Thanks in advance...

Bill-