Wicket, Guice and the $Proxy object

2013-07-23 Thread Daniel Watrous
Hi,

I'm having an issue that I suspect is related to the wicket integration
with Guice. Any help is appreciated.

I have a Page class that uses field injection to inject a DAO. I then want
to cast my DAO to a more specific type (what I inject is the interface).
Here's what that looks like

public class CnavModify extends ConsoleBasePage {

@Inject private CnavUrlDAO cnavUrlDAO;
public CnavModify(PageParameters parameters) {
super(parameters);
if (parameters.get(cnavid).toString() != null) {
cnavid = new ObjectId(parameters.get(cnavid).toString());
}
if (cnavid != null) {
cnavUrlModel = new
DetachableCnavUrlModel(((MorphiaCnavUrlDAO)cnavUrlDAO).getCnavById(cnavid));
}
}
}

When I try to cast it I get the following error:

Last cause: $Proxy23 cannot be cast to
com.hp.honeybadger.persistence.dao.morphia.MorphiaCnavUrlDAO

I am able to use the CnavUrlDAO as a CnavUrlDAO, but its type is $Proxy23
and I am unable to cast it to a concrete type.

Is this Guice or Wicket related? Any idea how to get around this?

Thanks,
Daniel


Re: Wicket, Guice and the $Proxy object

2013-07-23 Thread Daniel Watrous
Here's a little more detail when I debug and attempt to do just the cast:

Cannot cast an instance of class $Proxy23 (loaded by instance of
org.eclipse.jetty.webapp.WebAppClassLoader(id=3511)) to an instance of
class com.hp.honeybadger.persistence.dao.morphia.MorphiaCnavUrlDAO (loaded
by instance of sun.misc.Launcher$AppClassLoader(id=2450))


On Tue, Jul 23, 2013 at 9:20 AM, Daniel Watrous dwmaill...@gmail.comwrote:

 Hi,

 I'm having an issue that I suspect is related to the wicket integration
 with Guice. Any help is appreciated.

 I have a Page class that uses field injection to inject a DAO. I then want
 to cast my DAO to a more specific type (what I inject is the interface).
 Here's what that looks like

 public class CnavModify extends ConsoleBasePage {

 @Inject private CnavUrlDAO cnavUrlDAO;
 public CnavModify(PageParameters parameters) {
 super(parameters);
 if (parameters.get(cnavid).toString() != null) {
 cnavid = new ObjectId(parameters.get(cnavid).toString());
 }
 if (cnavid != null) {
 cnavUrlModel = new
 DetachableCnavUrlModel(((MorphiaCnavUrlDAO)cnavUrlDAO).getCnavById(cnavid));
 }
 }
 }

 When I try to cast it I get the following error:

 Last cause: $Proxy23 cannot be cast to
 com.hp.honeybadger.persistence.dao.morphia.MorphiaCnavUrlDAO

 I am able to use the CnavUrlDAO as a CnavUrlDAO, but its type is $Proxy23
 and I am unable to cast it to a concrete type.

 Is this Guice or Wicket related? Any idea how to get around this?

 Thanks,
 Daniel



Re: Wicket, Guice and the $Proxy object

2013-07-23 Thread Daniel Watrous
That being the case, is there any way to get an instance that I can cast to
a concrete type?


On Tue, Jul 23, 2013 at 9:27 AM, Martin Grigorov mgrigo...@apache.orgwrote:

 Hi,


 On Tue, Jul 23, 2013 at 6:20 PM, Daniel Watrous dwmaill...@gmail.com
 wrote:

  Hi,
 
  I'm having an issue that I suspect is related to the wicket integration
  with Guice. Any help is appreciated.
 
  I have a Page class that uses field injection to inject a DAO. I then
 want
  to cast my DAO to a more specific type (what I inject is the interface).
  Here's what that looks like
 
  public class CnavModify extends ConsoleBasePage {
 
  @Inject private CnavUrlDAO cnavUrlDAO;
  public CnavModify(PageParameters parameters) {
  super(parameters);
  if (parameters.get(cnavid).toString() != null) {
  cnavid = new ObjectId(parameters.get(cnavid).toString());
  }
  if (cnavid != null) {
  cnavUrlModel = new
 
 
 DetachableCnavUrlModel(((MorphiaCnavUrlDAO)cnavUrlDAO).getCnavById(cnavid));
  }
  }
  }
 
  When I try to cast it I get the following error:
 
  Last cause: $Proxy23 cannot be cast to
  com.hp.honeybadger.persistence.dao.morphia.MorphiaCnavUrlDAO
 
  I am able to use the CnavUrlDAO as a CnavUrlDAO, but its type is $Proxy23
  and I am unable to cast it to a concrete type.
 
  Is this Guice or Wicket related? Any idea how to get around this?
 

 It is an error in your assumption.

 Wicket injects a proxy that implements CnavUrlDAO but knows nothing about
 the specific implementation about this interface.
 Whenever the proxy is used it delegates the call to the bean/service
 returned by Guice's injector (something like:
 Injector.getBinding(CnavUrlDAO.class).doSomething()).


 
  Thanks,
  Daniel
 



Re: Wicket, Guice and the $Proxy object

2013-07-23 Thread Daniel Watrous
Dan,

Good point. After considering I decided to modify my interface to expose
the function I need and let the implementation worry about casting where
necessary.

Thanks,
Daniel


On Tue, Jul 23, 2013 at 9:58 AM, Dan Retzlaff dretzl...@gmail.com wrote:

 @Inject the implementation, not the interface. @Inject'd implementations
 have some code smell, but no more than downcasting.


 On Tue, Jul 23, 2013 at 8:40 AM, Daniel Watrous dwmaill...@gmail.com
 wrote:

  That being the case, is there any way to get an instance that I can cast
 to
  a concrete type?
 
 
  On Tue, Jul 23, 2013 at 9:27 AM, Martin Grigorov mgrigo...@apache.org
  wrote:
 
   Hi,
  
  
   On Tue, Jul 23, 2013 at 6:20 PM, Daniel Watrous dwmaill...@gmail.com
   wrote:
  
Hi,
   
I'm having an issue that I suspect is related to the wicket
 integration
with Guice. Any help is appreciated.
   
I have a Page class that uses field injection to inject a DAO. I then
   want
to cast my DAO to a more specific type (what I inject is the
  interface).
Here's what that looks like
   
public class CnavModify extends ConsoleBasePage {
   
@Inject private CnavUrlDAO cnavUrlDAO;
public CnavModify(PageParameters parameters) {
super(parameters);
if (parameters.get(cnavid).toString() != null) {
cnavid = new
 ObjectId(parameters.get(cnavid).toString());
}
if (cnavid != null) {
cnavUrlModel = new
   
   
  
 
 DetachableCnavUrlModel(((MorphiaCnavUrlDAO)cnavUrlDAO).getCnavById(cnavid));
}
}
}
   
When I try to cast it I get the following error:
   
Last cause: $Proxy23 cannot be cast to
com.hp.honeybadger.persistence.dao.morphia.MorphiaCnavUrlDAO
   
I am able to use the CnavUrlDAO as a CnavUrlDAO, but its type is
  $Proxy23
and I am unable to cast it to a concrete type.
   
Is this Guice or Wicket related? Any idea how to get around this?
   
  
   It is an error in your assumption.
  
   Wicket injects a proxy that implements CnavUrlDAO but knows nothing
 about
   the specific implementation about this interface.
   Whenever the proxy is used it delegates the call to the bean/service
   returned by Guice's injector (something like:
   Injector.getBinding(CnavUrlDAO.class).doSomething()).
  
  
   
Thanks,
Daniel
   
  
 



Re: Form questions

2013-07-23 Thread Daniel Watrous
I've had a difficult time following your recommendations. However I think
I'm getting closer.

Part of the disconnect is that right now, as I show above, the model object
I create is in the Form, not the Page. In my Page I create an instance of
my Form like this:

Form form = new CnavForm(cnavForm);
add(form);

So, the first step I've taken is to implement a constructor for my Form
that receives an IModel and, rather than create my CnavUrl, I get it from
the IModel:

CnavUrl cnavUrl = (CnavUrl) model.getObject();
setModel(new Model((Serializable) cnavUrl));

Now I create my Form object like this:

DetachableCnavUrlModel cnavUrlModel = new
DetachableCnavUrlModel(new MorphiaCnavUrl());
Form form = new CnavForm(cnavForm, cnavUrlModel);
add(form);

I'm now at the page level when I create my Model and I have a
DetachableCnavUrlModel, which I also use when displaying them.

if (cnavid != null) {
cnavUrlModel = new
DetachableCnavUrlModel(cnavUrlDAO.getCnavById(cnavid));
} else {
cnavUrlModel = new DetachableCnavUrlModel(new MorphiaCnavUrl());
}
Form form = new CnavForm(cnavForm, cnavUrlModel);
add(form);

This way on edit I have a prepopulated form.

To answer my other question about the link, I created a PageParameters
object and used setResponsePage like this

item.add(new Link(editlink) {
@Override
public void onClick() {
PageParameters editParameters = new
PageParameters();
editParameters.add(cnavid,
((MorphiaCnavUrl)cnavUrl).getId());

setResponsePage(CnavModify.class, editParameters);
}
});

I can then use the value in the parameters to set cnavid

if (parameters.get(cnavid).toString() != null) {
cnavid = new ObjectId(parameters.get(cnavid).toString());
}

Thanks for all the help.

Daniel


On Fri, Jul 19, 2013 at 9:38 AM, Paul Bors p...@bors.ws wrote:

 For stateless pages it would create a new one each time (add the DebugBar
 to
 your pages and see if your page is stateless or not and also see what the
 model is per component).

 For when Wicket serializes your page, you don't want a PropertyModel alone,
 you want a detachable model (see section 9.6 of the Wicket Free Guide or go
 over chapter 9 again Wicket models and forms). You need to wrap a
 Detachable model inside a Property model like so:

 add(new TextField(url, new PropertyModelMorphiaCnavUrl(new
 LoadableDetachableModelMorphiaCnavUrl(cnavUrl), URL))
  .setRequired(true)
  .add(new UrlValidator()));

 Is best to use a CompoundPropertyModel for the entire form and get to your
 POJO that feeds the entire form (or panel) via a detachable model.

 The LoadableDetachableModel is desined to only serialize the record ID for
 which you can later retrieve the entire object from your persistence layer.

 ~ Thank you,
   Paul Bors

 -Original Message-
 From: Daniel Watrous [mailto:dwmaill...@gmail.com]
 Sent: Friday, July 19, 2013 11:24 AM
 To: users@wicket.apache.org
 Subject: Re: Form questions

 Paul,

 Thanks. I get that and understand how the Model happens. As you can see,
 the
 instance of the model object is created in the constructor. So the first
 question I had is whether a new instance is created for every request or if
 there's one instance that's serialized. I suspect it's the second, knowing
 how Wicket treats sessions. In that case, I need some way on a per request
 basis to load the model from the database.

 The other question I had is how to create a link that sends the ID to the
 page that renders the form. I need to create a link to that page, include
 an
 ID value with the request and then access that ID within the form for my
 query to load that object from the DB.

 Daniel


 On Thu, Jul 18, 2013 at 5:14 PM, Paul Bors p...@bors.ws wrote:

  Okay let's pre-populate this field:
 
  add(new TextField(url, new PropertyModel(cnavUrl, URL))
  .setRequired(true)
  .add(new UrlValidator()));
 
  Its mode is a new PropertyModel(cnavUrl, URL), which is the CnavUrl
  cnavUrl = new MorphiaCnavUrl();.
  So it's the cnavUrl.getUrl() value.
 
  What do you get when you call new MorphiaCnavUrl().getUrl()?
  That's what should appear in the TextField when you first load the
  page (normally read form the DB).
 
  ~ Thank you,
Paul Bors
 
  -Original Message-
  From: Daniel Watrous [mailto:dwmaill...@gmail.com]
  Sent: Thursday, July 18, 2013 6:03 PM
  To: users@wicket.apache.org
  Subject: Re: Form questions
 
  I've made a lot of progress and been through chapters 9 and 10 of
  Wicket Free Guide, but I'm still stumped on point #2, pre-populating the
 form.
  Here's what I have right now:
 
  public class CnavForm extends Form {
 
  @Inject private

Re: Wicket, Guice and the $Proxy object

2013-07-23 Thread Daniel Watrous
Here's a post that helped me understand this better:

http://stackoverflow.com/questions/16047829/proxy-cannot-be-cast-to-class


On Tue, Jul 23, 2013 at 2:15 PM, Daniel Watrous dwmaill...@gmail.comwrote:

 Dan,

 Good point. After considering I decided to modify my interface to expose
 the function I need and let the implementation worry about casting where
 necessary.

 Thanks,
 Daniel


 On Tue, Jul 23, 2013 at 9:58 AM, Dan Retzlaff dretzl...@gmail.com wrote:

 @Inject the implementation, not the interface. @Inject'd implementations
 have some code smell, but no more than downcasting.


 On Tue, Jul 23, 2013 at 8:40 AM, Daniel Watrous dwmaill...@gmail.com
 wrote:

  That being the case, is there any way to get an instance that I can
 cast to
  a concrete type?
 
 
  On Tue, Jul 23, 2013 at 9:27 AM, Martin Grigorov mgrigo...@apache.org
  wrote:
 
   Hi,
  
  
   On Tue, Jul 23, 2013 at 6:20 PM, Daniel Watrous dwmaill...@gmail.com
   wrote:
  
Hi,
   
I'm having an issue that I suspect is related to the wicket
 integration
with Guice. Any help is appreciated.
   
I have a Page class that uses field injection to inject a DAO. I
 then
   want
to cast my DAO to a more specific type (what I inject is the
  interface).
Here's what that looks like
   
public class CnavModify extends ConsoleBasePage {
   
@Inject private CnavUrlDAO cnavUrlDAO;
public CnavModify(PageParameters parameters) {
super(parameters);
if (parameters.get(cnavid).toString() != null) {
cnavid = new
 ObjectId(parameters.get(cnavid).toString());
}
if (cnavid != null) {
cnavUrlModel = new
   
   
  
 
 DetachableCnavUrlModel(((MorphiaCnavUrlDAO)cnavUrlDAO).getCnavById(cnavid));
}
}
}
   
When I try to cast it I get the following error:
   
Last cause: $Proxy23 cannot be cast to
com.hp.honeybadger.persistence.dao.morphia.MorphiaCnavUrlDAO
   
I am able to use the CnavUrlDAO as a CnavUrlDAO, but its type is
  $Proxy23
and I am unable to cast it to a concrete type.
   
Is this Guice or Wicket related? Any idea how to get around this?
   
  
   It is an error in your assumption.
  
   Wicket injects a proxy that implements CnavUrlDAO but knows nothing
 about
   the specific implementation about this interface.
   Whenever the proxy is used it delegates the call to the bean/service
   returned by Guice's injector (something like:
   Injector.getBinding(CnavUrlDAO.class).doSomething()).
  
  
   
Thanks,
Daniel
   
  
 





Re: Form questions

2013-07-19 Thread Daniel Watrous
Paul,

Thanks. I get that and understand how the Model happens. As you can see,
the instance of the model object is created in the constructor. So the
first question I had is whether a new instance is created for every request
or if there's one instance that's serialized. I suspect it's the second,
knowing how Wicket treats sessions. In that case, I need some way on a per
request basis to load the model from the database.

The other question I had is how to create a link that sends the ID to the
page that renders the form. I need to create a link to that page, include
an ID value with the request and then access that ID within the form for my
query to load that object from the DB.

Daniel


On Thu, Jul 18, 2013 at 5:14 PM, Paul Bors p...@bors.ws wrote:

 Okay let's pre-populate this field:

 add(new TextField(url, new PropertyModel(cnavUrl, URL))
 .setRequired(true)
 .add(new UrlValidator()));

 Its mode is a new PropertyModel(cnavUrl, URL), which is the CnavUrl
 cnavUrl = new MorphiaCnavUrl();.
 So it's the cnavUrl.getUrl() value.

 What do you get when you call new MorphiaCnavUrl().getUrl()?
 That's what should appear in the TextField when you first load the page
 (normally read form the DB).

 ~ Thank you,
   Paul Bors

 -Original Message-
 From: Daniel Watrous [mailto:dwmaill...@gmail.com]
 Sent: Thursday, July 18, 2013 6:03 PM
 To: users@wicket.apache.org
 Subject: Re: Form questions

 I've made a lot of progress and been through chapters 9 and 10 of Wicket
 Free Guide, but I'm still stumped on point #2, pre-populating the form.
 Here's what I have right now:

 public class CnavForm extends Form {

 @Inject private CnavUrlDAO cnavUrlDAO;

 public CnavForm(String id) {
 super(id);
 CnavUrl cnavUrl = new MorphiaCnavUrl();
 setModel(new Model((Serializable) cnavUrl));

 add(new TextField(url, new PropertyModel(cnavUrl, URL))
 .setRequired(true)
 .add(new UrlValidator()));
 add(new HiddenField(objectid, new PropertyModel(cnavUrl, id)));

 add(new Button(publish) {
 @Override
 public void onSubmit() {
 CnavUrl cnavUrl = (CnavUrl) CnavForm.this.getModelObject();
 // check for existing record to know if this is a create or
 update
 if (((MorphiaCnavUrlModel)cnavUrl).getId() == null) {
 // create
 cnavUrlDAO.save(cnavUrl);
 } else {
 // update
 cnavUrlDAO.save(cnavUrl);
 }
 }
 });
 }
 }

 I need to know how to do two things.
 1) how to link to the page that displays the form, and pass it the ID for
 the record I want to edit
 2) load the object from the database and have it replace the model I create
 in the constructor

 Obviously I can make a database call and get the object. Is the constructor
 called every time the page is requested, so that I could check for an ID
 and
 either create the model or load it from the database? If so, then I just
 need help with #1.

 Thanks,
 Daniel


 On Wed, Jul 17, 2013 at 10:19 AM, Daniel Watrous
 dwmaill...@gmail.comwrote:

  I think I'm getting it now. The Form needs to be embedded in a panel
  for the type of inclusion that I'm interested in.
 
  I created a CnavFormPanel.java and changed CnavForm.html to
  CnavFormPanel.html. I left CnavForm.java alone.
 
  In CnavModify.java I removed this
 
  Form form = new CnavForm(cnavFormArea);
  add(form);
 
  And added this
 
  add(new CnavFormPanel(cnavFormArea));
 
  That works. Thanks for your help.
 
  Daniel
 
 
  On Wed, Jul 17, 2013 at 10:07 AM, Daniel Watrous
 dwmaill...@gmail.comwrote:
 
  I can make it work if I put the markup from CnavForm.html directly
  into CnavModify, but the form is not as reusable then. I would have
  to duplicate the markup for other pages that use the same form...
 
  Dnaiel
 
 
  On Wed, Jul 17, 2013 at 9:55 AM, Daniel Watrous
 dwmaill...@gmail.comwrote:
 
  That's what I tried to do. I created CnavForm.java and
  CnavForm.html. In the latter file I have this
wicket:panel
  form wicket:id=cnavForm...
  // form details
  /form
  /wicket:panel
 
  Then I have CnavModify.java and CnavModify.html. You already see
  what I have in CnavModify.java from my last email. My CnavModify.html
 has this.
  wicket:extend
  span wicket:id=cnavFormAreaHere's the form/span
  /wicket:extend
 
  Rather than render I'm getting this error:
  Last cause: Component [cnavFormArea] (path = [0:cnavFormArea]) must
  be applied to a tag of type [form], not: 'span
 wicket:id=cnavFormArea
  id=cnavFormArea3' (line 0, column 0)
 
  I'll keep trying and report back when I figure it out.
 
  Daniel
 
 
  On Tue, Jul 16, 2013 at 10:50 PM, Paul Bors p...@bors.ws wrote:
 
  Wicket is a MVC component driven framework similar to Swing.
  In short, what

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

2013-07-19 Thread Daniel Watrous
This looks like a wordpress issue. Look for a problem with the .htaccess
file.

It should include something like this:

IfModule mod_rewrite.c
RewriteEngine On
RewriteBase /wordpress/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /wordpress/index.php [L]
/IfModule

Daniel


On Fri, Jul 19, 2013 at 2:42 PM, Gabriel Landon glan...@piti.pf wrote:

 The home page dos work :

 wget http://wicketinaction.com/
 --2013-07-19 10:40:45--  http://wicketinaction.com/
 Résolution de wicketinaction.com... 94.124.120.40
 Connexion vers wicketinaction.com|94.124.120.40|:80...connecté.
 requête HTTP transmise, en attente de la réponse...*200 OK*

 But not the other pages :
 wget http://wicketinaction.com/2013/02/replace-components-with-animation/
 --2013-07-19 10:41:45--
 http://wicketinaction.com/2013/02/replace-components-with-animation/
 Résolution de wicketinaction.com... 94.124.120.40
 Connexion vers wicketinaction.com|94.124.120.40|:80...connecté.
 requête HTTP transmise, en attente de la réponse...*404 Not Found*
 2013-07-19 10:41:46 ERREUR 404: Not Found.







 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/http-wicketinaction-com-broken-tp4660379p4660385.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




Last cause: can't serialize class $Proxy23

2013-07-18 Thread Daniel Watrous
My Wicket application uses Guice for DI and some AOP. I have successfully
injected a DAO and used that to display records. However, when I try to
save a new record in my form, I get the following exception



Root cause:

java.lang.IllegalArgumentException: can't serialize class $Proxy23
 at org.bson.BasicBSONEncoder._putObjectField(BasicBSONEncoder.java:270)
 at org.bson.BasicBSONEncoder.putObject(BasicBSONEncoder.java:174)
 at org.bson.BasicBSONEncoder._putObjectField(BasicBSONEncoder.java:226)
 at org.bson.BasicBSONEncoder.putObject(BasicBSONEncoder.java:174)
 at org.bson.BasicBSONEncoder._putObjectField(BasicBSONEncoder.java:226)
 at org.bson.BasicBSONEncoder.putObject(BasicBSONEncoder.java:174)
 at org.bson.BasicBSONEncoder.putObject(BasicBSONEncoder.java:120)
 at com.mongodb.DefaultDBEncoder.writeObject(DefaultDBEncoder.java:27)
 at com.mongodb.OutMessage.putObject(OutMessage.java:289)
 at com.mongodb.DBApiLayer$MyCollection.insert(DBApiLayer.java:239)
 at com.mongodb.DBApiLayer$MyCollection.insert(DBApiLayer.java:204)
 at com.mongodb.DBCollection.insert(DBCollection.java:148)
 at com.mongodb.DBCollection.insert(DBCollection.java:91)
 at com.mongodb.DBCollection.save(DBCollection.java:810)
 at com.google.code.morphia.DatastoreImpl.save(DatastoreImpl.java:731)
 at com.google.code.morphia.DatastoreImpl.save(DatastoreImpl.java:793)
 at com.google.code.morphia.DatastoreImpl.save(DatastoreImpl.java:787)
 at 
com.hp.honeybadger.persistence.dao.morphia.MorphiaCnavUrlDAO.save(MorphiaCnavUrlDAO.java:50)
 at java.lang.reflect.Method.invoke(Method.java:601)
 at 
org.apache.wicket.proxy.LazyInitProxyFactory$JdkHandler.invoke(LazyInitProxyFactory.java:435)
 at $Proxy23.save(Unknown Source)
 at com.hp.honeybadger.console.forms.CnavForm$1.onSubmit(CnavForm.java:72)
 at org.apache.wicket.markup.html.form.Form.delegateSubmit(Form.java:1253)
 at org.apache.wicket.markup.html.form.Form.process(Form.java:925)
 at org.apache.wicket.markup.html.form.Form.onFormSubmitted(Form.java:771)
 at org.apache.wicket.markup.html.form.Form.onFormSubmitted(Form.java:704)
 at java.lang.reflect.Method.invoke(Method.java:601)
 at 
org.apache.wicket.RequestListenerInterface.internalInvoke(RequestListenerInterface.java:258)
 at 
org.apache.wicket.RequestListenerInterface.invoke(RequestListenerInterface.java:216)
 at 
org.apache.wicket.core.request.handler.ListenerInterfaceRequestHandler.invokeListener(ListenerInterfaceRequestHandler.java:240)
 at 
org.apache.wicket.core.request.handler.ListenerInterfaceRequestHandler.respond(ListenerInterfaceRequestHandler.java:226)
 at 
org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:854)
 at 
org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:64)
 at 
org.apache.wicket.request.cycle.RequestCycle.execute(RequestCycle.java:254)
 at 
org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:211)
 at 
org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:282)
 at 
org.apache.wicket.protocol.http.WicketFilter.processRequestCycle(WicketFilter.java:259)
 at 
org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:201)
 at 
org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:282)
 at 
com.google.inject.servlet.FilterDefinition.doFilter(FilterDefinition.java:163)
 at 
com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:58)
 at 
com.google.inject.servlet.ManagedFilterPipeline.dispatch(ManagedFilterPipeline.java:118)
 at com.google.inject.servlet.GuiceFilter.doFilter(GuiceFilter.java:113)
 at 
org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1332)
 at 
org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:477)
 at 
org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:119)
 at 
org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:524)
 at 
org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:227)
 at 
org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1031)
 at 
org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:406)
 at 
org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:186)
 at 
org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:965)
 at 
org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117)
 at 
org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:111)
 at org.eclipse.jetty.server.Server.handle(Server.java:348)
 at 
org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:452)
 at 

Re: Last cause: can't serialize class $Proxy23

2013-07-18 Thread Daniel Watrous
I found that having my DAO implement Serializable got me past the
exception.

Is Wicket attempting to serialize my DAO?


On Thu, Jul 18, 2013 at 11:24 AM, Daniel Watrous dwmaill...@gmail.comwrote:

 My Wicket application uses Guice for DI and some AOP. I have successfully
 injected a DAO and used that to display records. However, when I try to
 save a new record in my form, I get the following exception

 

 Root cause:

 java.lang.IllegalArgumentException: can't serialize class $Proxy23
  at org.bson.BasicBSONEncoder._putObjectField(BasicBSONEncoder.java:270)
  at org.bson.BasicBSONEncoder.putObject(BasicBSONEncoder.java:174)

  at org.bson.BasicBSONEncoder._putObjectField(BasicBSONEncoder.java:226)
  at org.bson.BasicBSONEncoder.putObject(BasicBSONEncoder.java:174)
  at org.bson.BasicBSONEncoder._putObjectField(BasicBSONEncoder.java:226)

  at org.bson.BasicBSONEncoder.putObject(BasicBSONEncoder.java:174)
  at org.bson.BasicBSONEncoder.putObject(BasicBSONEncoder.java:120)
  at com.mongodb.DefaultDBEncoder.writeObject(DefaultDBEncoder.java:27)

  at com.mongodb.OutMessage.putObject(OutMessage.java:289)
  at com.mongodb.DBApiLayer$MyCollection.insert(DBApiLayer.java:239)
  at com.mongodb.DBApiLayer$MyCollection.insert(DBApiLayer.java:204)
  at com.mongodb.DBCollection.insert(DBCollection.java:148)

  at com.mongodb.DBCollection.insert(DBCollection.java:91)
  at com.mongodb.DBCollection.save(DBCollection.java:810)
  at com.google.code.morphia.DatastoreImpl.save(DatastoreImpl.java:731)
  at com.google.code.morphia.DatastoreImpl.save(DatastoreImpl.java:793)

  at com.google.code.morphia.DatastoreImpl.save(DatastoreImpl.java:787)
  at 
 com.hp.honeybadger.persistence.dao.morphia.MorphiaCnavUrlDAO.save(MorphiaCnavUrlDAO.java:50)
  at java.lang.reflect.Method.invoke(Method.java:601)

  at 
 org.apache.wicket.proxy.LazyInitProxyFactory$JdkHandler.invoke(LazyInitProxyFactory.java:435)
  at $Proxy23.save(Unknown Source)
  at com.hp.honeybadger.console.forms.CnavForm$1.onSubmit(CnavForm.java:72)

  at org.apache.wicket.markup.html.form.Form.delegateSubmit(Form.java:1253)
  at org.apache.wicket.markup.html.form.Form.process(Form.java:925)
  at org.apache.wicket.markup.html.form.Form.onFormSubmitted(Form.java:771)

  at org.apache.wicket.markup.html.form.Form.onFormSubmitted(Form.java:704)
  at java.lang.reflect.Method.invoke(Method.java:601)
  at 
 org.apache.wicket.RequestListenerInterface.internalInvoke(RequestListenerInterface.java:258)

  at 
 org.apache.wicket.RequestListenerInterface.invoke(RequestListenerInterface.java:216)
  at 
 org.apache.wicket.core.request.handler.ListenerInterfaceRequestHandler.invokeListener(ListenerInterfaceRequestHandler.java:240)

  at 
 org.apache.wicket.core.request.handler.ListenerInterfaceRequestHandler.respond(ListenerInterfaceRequestHandler.java:226)
  at 
 org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:854)

  at 
 org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:64)
  at 
 org.apache.wicket.request.cycle.RequestCycle.execute(RequestCycle.java:254)
  at 
 org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:211)

  at 
 org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:282)
  at 
 org.apache.wicket.protocol.http.WicketFilter.processRequestCycle(WicketFilter.java:259)
  at 
 org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:201)

  at 
 org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:282)
  at 
 com.google.inject.servlet.FilterDefinition.doFilter(FilterDefinition.java:163)
  at 
 com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:58)

  at 
 com.google.inject.servlet.ManagedFilterPipeline.dispatch(ManagedFilterPipeline.java:118)
  at com.google.inject.servlet.GuiceFilter.doFilter(GuiceFilter.java:113)
  at 
 org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1332)

  at 
 org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:477)
  at 
 org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:119)
  at 
 org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:524)

  at 
 org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:227)
  at 
 org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1031)
  at 
 org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:406)

  at 
 org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:186)
  at 
 org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:965

Re: Form questions

2013-07-18 Thread Daniel Watrous
I've made a lot of progress and been through chapters 9 and 10 of Wicket
Free Guide, but I'm still stumped on point #2, pre-populating the form.
Here's what I have right now:

public class CnavForm extends Form {

@Inject private CnavUrlDAO cnavUrlDAO;

public CnavForm(String id) {
super(id);
CnavUrl cnavUrl = new MorphiaCnavUrl();
setModel(new Model((Serializable) cnavUrl));

add(new TextField(url, new PropertyModel(cnavUrl, URL))
.setRequired(true)
.add(new UrlValidator()));
add(new HiddenField(objectid, new PropertyModel(cnavUrl, id)));

add(new Button(publish) {
@Override
public void onSubmit() {
CnavUrl cnavUrl = (CnavUrl) CnavForm.this.getModelObject();
// check for existing record to know if this is a create or
update
if (((MorphiaCnavUrlModel)cnavUrl).getId() == null) {
// create
cnavUrlDAO.save(cnavUrl);
} else {
// update
cnavUrlDAO.save(cnavUrl);
}
}
});
}
}

I need to know how to do two things.
1) how to link to the page that displays the form, and pass it the ID for
the record I want to edit
2) load the object from the database and have it replace the model I create
in the constructor

Obviously I can make a database call and get the object. Is the constructor
called every time the page is requested, so that I could check for an ID
and either create the model or load it from the database? If so, then I
just need help with #1.

Thanks,
Daniel


On Wed, Jul 17, 2013 at 10:19 AM, Daniel Watrous dwmaill...@gmail.comwrote:

 I think I'm getting it now. The Form needs to be embedded in a panel for
 the type of inclusion that I'm interested in.

 I created a CnavFormPanel.java and changed CnavForm.html to
 CnavFormPanel.html. I left CnavForm.java alone.

 In CnavModify.java I removed this

 Form form = new CnavForm(cnavFormArea);
 add(form);

 And added this

 add(new CnavFormPanel(cnavFormArea));

 That works. Thanks for your help.

 Daniel


 On Wed, Jul 17, 2013 at 10:07 AM, Daniel Watrous dwmaill...@gmail.comwrote:

 I can make it work if I put the markup from CnavForm.html directly into
 CnavModify, but the form is not as reusable then. I would have to duplicate
 the markup for other pages that use the same form...

 Dnaiel


 On Wed, Jul 17, 2013 at 9:55 AM, Daniel Watrous dwmaill...@gmail.comwrote:

 That's what I tried to do. I created
 CnavForm.java and CnavForm.html. In the latter file I have this
   wicket:panel
 form wicket:id=cnavForm...
 // form details
 /form
 /wicket:panel

 Then I have CnavModify.java and CnavModify.html. You already see what I
 have in CnavModify.java from my last email. My CnavModify.html has this.
 wicket:extend
 span wicket:id=cnavFormAreaHere's the form/span
 /wicket:extend

 Rather than render I'm getting this error:
 Last cause: Component [cnavFormArea] (path = [0:cnavFormArea]) must be
 applied to a tag of type [form], not: 'span wicket:id=cnavFormArea
 id=cnavFormArea3' (line 0, column 0)

 I'll keep trying and report back when I figure it out.

 Daniel


 On Tue, Jul 16, 2013 at 10:50 PM, Paul Bors p...@bors.ws wrote:

 Wicket is a MVC component driven framework similar to Swing.
 In short, what you want to do is create your own Panel with that form
 file
 of yours and add it to another Panel as a child.

 See chapter 4 Keeping control over HTML of the Wicket Free Guide at:
 http://code.google.com/p/wicket-guide/

 Also available from under the Learn section as the Books link on the
 right
 side navigation section on Wicket's home page at:
 http://wicket.apache.org/learn/books/

 ~ Thank you,
   Paul Bors

 -Original Message-
 From: Daniel Watrous [mailto:dwmaill...@gmail.com]
 Sent: Tuesday, July 16, 2013 7:13 PM
 To: users@wicket.apache.org
 Subject: Re: Form questions

 Thanks Paul and Sven. I got the form to work and available in the
 onSubmit
 handler.

 Now I'm interested in splitting the form out into it's one file. So I
 created a class that has nothing more than the form, but I'm not sure
 how to
 include this into a page.

 In my class I do this:

 public class CnavModify extends ConsoleBasePage {

 public CnavModify(PageParameters parameters) {
 super(parameters);

 Form form = new CnavForm(cnavFormArea);
 add(form);
 }
 }

 My CnavModify obviously extends a base page. What do I put inside the
 wicket:extend tag to have the form render?

 Daniel


 On Tue, Jul 16, 2013 at 12:00 AM, Sven Meier s...@meiers.net wrote:

  Hi,
 
 
   Some problems I can't figure out. The code to create the button
  complains
  that it requires a CnavUrl but gets back a String.
 
 add(new Button(publish, model) {
 @Override
 public void onSubmit

Re: Form questions

2013-07-17 Thread Daniel Watrous
That's what I tried to do. I created
CnavForm.java and CnavForm.html. In the latter file I have this
  wicket:panel
form wicket:id=cnavForm...
// form details
/form
/wicket:panel

Then I have CnavModify.java and CnavModify.html. You already see what I
have in CnavModify.java from my last email. My CnavModify.html has this.
wicket:extend
span wicket:id=cnavFormAreaHere's the form/span
/wicket:extend

Rather than render I'm getting this error:
Last cause: Component [cnavFormArea] (path = [0:cnavFormArea]) must be
applied to a tag of type [form], not: 'span wicket:id=cnavFormArea
id=cnavFormArea3' (line 0, column 0)

I'll keep trying and report back when I figure it out.

Daniel


On Tue, Jul 16, 2013 at 10:50 PM, Paul Bors p...@bors.ws wrote:

 Wicket is a MVC component driven framework similar to Swing.
 In short, what you want to do is create your own Panel with that form file
 of yours and add it to another Panel as a child.

 See chapter 4 Keeping control over HTML of the Wicket Free Guide at:
 http://code.google.com/p/wicket-guide/

 Also available from under the Learn section as the Books link on the right
 side navigation section on Wicket's home page at:
 http://wicket.apache.org/learn/books/

 ~ Thank you,
   Paul Bors

 -Original Message-
 From: Daniel Watrous [mailto:dwmaill...@gmail.com]
 Sent: Tuesday, July 16, 2013 7:13 PM
 To: users@wicket.apache.org
 Subject: Re: Form questions

 Thanks Paul and Sven. I got the form to work and available in the onSubmit
 handler.

 Now I'm interested in splitting the form out into it's one file. So I
 created a class that has nothing more than the form, but I'm not sure how
 to
 include this into a page.

 In my class I do this:

 public class CnavModify extends ConsoleBasePage {

 public CnavModify(PageParameters parameters) {
 super(parameters);

 Form form = new CnavForm(cnavFormArea);
 add(form);
 }
 }

 My CnavModify obviously extends a base page. What do I put inside the
 wicket:extend tag to have the form render?

 Daniel


 On Tue, Jul 16, 2013 at 12:00 AM, Sven Meier s...@meiers.net wrote:

  Hi,
 
 
   Some problems I can't figure out. The code to create the button
  complains
  that it requires a CnavUrl but gets back a String.
 
 add(new Button(publish, model) {
 @Override
 public void onSubmit() {
 CnavUrl cnavUrl = (CnavUrl) getModelObject();
 System.out.println(publish);
 }
 });
 
 
  a Button always has a IModelString to fill the value attribute. Note
  that in #onSubmit() you're getting the model object of the button, not
  of your form.
  You can write:
 
  add(new Button(publish, model) {
 @Override
 public void onSubmit() {
 CnavUrl cnavUrl = (CnavUrl) MyForm.this.getModelObject();
 System.out.println(publish);
 }
 });
 
 
  Using generic types in your code should help you.
 
  Sven
 
 
 
  On 07/15/2013 11:41 PM, Daniel Watrous wrote:
 
  Hello,
 
  I'm interested in creating a single Form that will accommodate the
  following use cases
  1) display blank for creating new records
  2) pre-populate for editing existing records
  3) map submitted values on to an existing domain object
  4) accommodate two actions, Save Draft -or- Publish
 
  I'm following Wicket in Action and within my Form constructor I
  create my model, like this
 
   CnavUrl cnavUrl = new BasicCnavUrl();
   IModel model = new Model((Serializable) cnavUrl);
   setModel(model);
 
  I then use PropertyModel
 
   add(new TextField(url, new PropertyModel(cnavUrl,
  url)));
 
  For the two actions, I'm creating the Button objects like this
 
   add(new Button(publish, model) {
   @Override
   public void onSubmit() {
   CnavUrl cnavUrl = (CnavUrl) getModelObject();
   System.out.println(publish);
   }
   });
 
  Some problems I can't figure out. The code to create the button
  complains that it requires a CnavUrl but gets back a String.
 
  It seems that a new BasicCnavUrl is created once with the Form. What
  happens on subsequent calls? Can I always expect my model to have the
  data from the current form submission?
 
  Is there a best way to incorporate the idea of an edit, where the
  model is pre-populated from a data source and pre-fills the Form fields?
 
  Thanks,
  Daniel
 
 
 
  --**--**--
  --- To unsubscribe, e-mail:
  users-unsubscribe@wicket.**apache.orgusers-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




Re: Form questions

2013-07-17 Thread Daniel Watrous
I can make it work if I put the markup from CnavForm.html directly into
CnavModify, but the form is not as reusable then. I would have to duplicate
the markup for other pages that use the same form...

Dnaiel


On Wed, Jul 17, 2013 at 9:55 AM, Daniel Watrous dwmaill...@gmail.comwrote:

 That's what I tried to do. I created
 CnavForm.java and CnavForm.html. In the latter file I have this
   wicket:panel
 form wicket:id=cnavForm...
 // form details
 /form
 /wicket:panel

 Then I have CnavModify.java and CnavModify.html. You already see what I
 have in CnavModify.java from my last email. My CnavModify.html has this.
 wicket:extend
 span wicket:id=cnavFormAreaHere's the form/span
 /wicket:extend

 Rather than render I'm getting this error:
 Last cause: Component [cnavFormArea] (path = [0:cnavFormArea]) must be
 applied to a tag of type [form], not: 'span wicket:id=cnavFormArea
 id=cnavFormArea3' (line 0, column 0)

 I'll keep trying and report back when I figure it out.

 Daniel


 On Tue, Jul 16, 2013 at 10:50 PM, Paul Bors p...@bors.ws wrote:

 Wicket is a MVC component driven framework similar to Swing.
 In short, what you want to do is create your own Panel with that form file
 of yours and add it to another Panel as a child.

 See chapter 4 Keeping control over HTML of the Wicket Free Guide at:
 http://code.google.com/p/wicket-guide/

 Also available from under the Learn section as the Books link on the right
 side navigation section on Wicket's home page at:
 http://wicket.apache.org/learn/books/

 ~ Thank you,
   Paul Bors

 -Original Message-
 From: Daniel Watrous [mailto:dwmaill...@gmail.com]
 Sent: Tuesday, July 16, 2013 7:13 PM
 To: users@wicket.apache.org
 Subject: Re: Form questions

 Thanks Paul and Sven. I got the form to work and available in the onSubmit
 handler.

 Now I'm interested in splitting the form out into it's one file. So I
 created a class that has nothing more than the form, but I'm not sure how
 to
 include this into a page.

 In my class I do this:

 public class CnavModify extends ConsoleBasePage {

 public CnavModify(PageParameters parameters) {
 super(parameters);

 Form form = new CnavForm(cnavFormArea);
 add(form);
 }
 }

 My CnavModify obviously extends a base page. What do I put inside the
 wicket:extend tag to have the form render?

 Daniel


 On Tue, Jul 16, 2013 at 12:00 AM, Sven Meier s...@meiers.net wrote:

  Hi,
 
 
   Some problems I can't figure out. The code to create the button
  complains
  that it requires a CnavUrl but gets back a String.
 
 add(new Button(publish, model) {
 @Override
 public void onSubmit() {
 CnavUrl cnavUrl = (CnavUrl) getModelObject();
 System.out.println(publish);
 }
 });
 
 
  a Button always has a IModelString to fill the value attribute. Note
  that in #onSubmit() you're getting the model object of the button, not
  of your form.
  You can write:
 
  add(new Button(publish, model) {
 @Override
 public void onSubmit() {
 CnavUrl cnavUrl = (CnavUrl)
 MyForm.this.getModelObject();
 System.out.println(publish);
 }
 });
 
 
  Using generic types in your code should help you.
 
  Sven
 
 
 
  On 07/15/2013 11:41 PM, Daniel Watrous wrote:
 
  Hello,
 
  I'm interested in creating a single Form that will accommodate the
  following use cases
  1) display blank for creating new records
  2) pre-populate for editing existing records
  3) map submitted values on to an existing domain object
  4) accommodate two actions, Save Draft -or- Publish
 
  I'm following Wicket in Action and within my Form constructor I
  create my model, like this
 
   CnavUrl cnavUrl = new BasicCnavUrl();
   IModel model = new Model((Serializable) cnavUrl);
   setModel(model);
 
  I then use PropertyModel
 
   add(new TextField(url, new PropertyModel(cnavUrl,
  url)));
 
  For the two actions, I'm creating the Button objects like this
 
   add(new Button(publish, model) {
   @Override
   public void onSubmit() {
   CnavUrl cnavUrl = (CnavUrl) getModelObject();
   System.out.println(publish);
   }
   });
 
  Some problems I can't figure out. The code to create the button
  complains that it requires a CnavUrl but gets back a String.
 
  It seems that a new BasicCnavUrl is created once with the Form. What
  happens on subsequent calls? Can I always expect my model to have the
  data from the current form submission?
 
  Is there a best way to incorporate the idea of an edit, where the
  model is pre-populated from a data source and pre-fills the Form
 fields?
 
  Thanks,
  Daniel
 
 
 
  --**--**--
  --- To unsubscribe, e-mail:
  users-unsubscribe@wicket.**apache.orgusers

Re: Form questions

2013-07-17 Thread Daniel Watrous
I think I'm getting it now. The Form needs to be embedded in a panel for
the type of inclusion that I'm interested in.

I created a CnavFormPanel.java and changed CnavForm.html to
CnavFormPanel.html. I left CnavForm.java alone.

In CnavModify.java I removed this

Form form = new CnavForm(cnavFormArea);
add(form);

And added this

add(new CnavFormPanel(cnavFormArea));

That works. Thanks for your help.

Daniel


On Wed, Jul 17, 2013 at 10:07 AM, Daniel Watrous dwmaill...@gmail.comwrote:

 I can make it work if I put the markup from CnavForm.html directly into
 CnavModify, but the form is not as reusable then. I would have to duplicate
 the markup for other pages that use the same form...

 Dnaiel


 On Wed, Jul 17, 2013 at 9:55 AM, Daniel Watrous dwmaill...@gmail.comwrote:

 That's what I tried to do. I created
 CnavForm.java and CnavForm.html. In the latter file I have this
   wicket:panel
 form wicket:id=cnavForm...
 // form details
 /form
 /wicket:panel

 Then I have CnavModify.java and CnavModify.html. You already see what I
 have in CnavModify.java from my last email. My CnavModify.html has this.
 wicket:extend
 span wicket:id=cnavFormAreaHere's the form/span
 /wicket:extend

 Rather than render I'm getting this error:
 Last cause: Component [cnavFormArea] (path = [0:cnavFormArea]) must be
 applied to a tag of type [form], not: 'span wicket:id=cnavFormArea
 id=cnavFormArea3' (line 0, column 0)

 I'll keep trying and report back when I figure it out.

 Daniel


 On Tue, Jul 16, 2013 at 10:50 PM, Paul Bors p...@bors.ws wrote:

 Wicket is a MVC component driven framework similar to Swing.
 In short, what you want to do is create your own Panel with that form
 file
 of yours and add it to another Panel as a child.

 See chapter 4 Keeping control over HTML of the Wicket Free Guide at:
 http://code.google.com/p/wicket-guide/

 Also available from under the Learn section as the Books link on the
 right
 side navigation section on Wicket's home page at:
 http://wicket.apache.org/learn/books/

 ~ Thank you,
   Paul Bors

 -Original Message-
 From: Daniel Watrous [mailto:dwmaill...@gmail.com]
 Sent: Tuesday, July 16, 2013 7:13 PM
 To: users@wicket.apache.org
 Subject: Re: Form questions

 Thanks Paul and Sven. I got the form to work and available in the
 onSubmit
 handler.

 Now I'm interested in splitting the form out into it's one file. So I
 created a class that has nothing more than the form, but I'm not sure
 how to
 include this into a page.

 In my class I do this:

 public class CnavModify extends ConsoleBasePage {

 public CnavModify(PageParameters parameters) {
 super(parameters);

 Form form = new CnavForm(cnavFormArea);
 add(form);
 }
 }

 My CnavModify obviously extends a base page. What do I put inside the
 wicket:extend tag to have the form render?

 Daniel


 On Tue, Jul 16, 2013 at 12:00 AM, Sven Meier s...@meiers.net wrote:

  Hi,
 
 
   Some problems I can't figure out. The code to create the button
  complains
  that it requires a CnavUrl but gets back a String.
 
 add(new Button(publish, model) {
 @Override
 public void onSubmit() {
 CnavUrl cnavUrl = (CnavUrl) getModelObject();
 System.out.println(publish);
 }
 });
 
 
  a Button always has a IModelString to fill the value attribute. Note
  that in #onSubmit() you're getting the model object of the button, not
  of your form.
  You can write:
 
  add(new Button(publish, model) {
 @Override
 public void onSubmit() {
 CnavUrl cnavUrl = (CnavUrl)
 MyForm.this.getModelObject();
 System.out.println(publish);
 }
 });
 
 
  Using generic types in your code should help you.
 
  Sven
 
 
 
  On 07/15/2013 11:41 PM, Daniel Watrous wrote:
 
  Hello,
 
  I'm interested in creating a single Form that will accommodate the
  following use cases
  1) display blank for creating new records
  2) pre-populate for editing existing records
  3) map submitted values on to an existing domain object
  4) accommodate two actions, Save Draft -or- Publish
 
  I'm following Wicket in Action and within my Form constructor I
  create my model, like this
 
   CnavUrl cnavUrl = new BasicCnavUrl();
   IModel model = new Model((Serializable) cnavUrl);
   setModel(model);
 
  I then use PropertyModel
 
   add(new TextField(url, new PropertyModel(cnavUrl,
  url)));
 
  For the two actions, I'm creating the Button objects like this
 
   add(new Button(publish, model) {
   @Override
   public void onSubmit() {
   CnavUrl cnavUrl = (CnavUrl) getModelObject();
   System.out.println(publish);
   }
   });
 
  Some problems I can't figure out. The code to create the button
  complains that it requires a CnavUrl but gets back

FeedbackPanel customization

2013-07-17 Thread Daniel Watrous
Hi,

I'm working on a modification of the FeedbackPanel to work better with my
theme. I would like to prevent the class for the actual message from being
appended to. Right now MessageListView is a private final class and
the populateItem adds an AttributeModifier to both the label and the
listItem.

I know I can override getCSSClass, but that still sets it for both the
label and listItem.

I can't extend just MessageListView since it's private and final. Even if I
could subclass that, the FeedbackPanel constructor is called before my
subclass of FeedbackPanel, so that it has already used the original
MessageListView.

Can you think of a clean way to eliminate the AttributeListener on listItem?

Daniel


Re: FeedbackPanel customization

2013-07-17 Thread Daniel Watrous
Hi Sebastian,

I looked at your example, but it's not quite what I need. I want the style
applied to 'messages' but not to 'message'. Your example seems to allow for
a style to be applied to 'message' and not to 'messages'

I've tried implementing it, but that's where I'm stuck. Am I missing
something?

Daniel


On Wed, Jul 17, 2013 at 3:20 PM, Sebastien seb...@gmail.com wrote:

 Hi Daniel,

 In such a case, you have to not use getCSSClass, but override
 newMessageDisplayComponent instead.

 You have a sample here:

 https://github.com/sebfz1/wicket-jquery-ui/blob/master/wicket-jquery-ui/src/main/java/com/googlecode/wicket/jquery/ui/panel/JQueryFeedbackPanel.java

 https://github.com/sebfz1/wicket-jquery-ui/blob/master/wicket-jquery-ui/src/main/java/com/googlecode/wicket/jquery/ui/panel/JQueryFeedbackPanel.html

 Hope this help,
 Sebastien.


 On Wed, Jul 17, 2013 at 10:54 PM, Daniel Watrous dwmaill...@gmail.com
 wrote:

  Hi,
 
  I'm working on a modification of the FeedbackPanel to work better with my
  theme. I would like to prevent the class for the actual message from
 being
  appended to. Right now MessageListView is a private final class and
  the populateItem adds an AttributeModifier to both the label and the
  listItem.
 
  I know I can override getCSSClass, but that still sets it for both the
  label and listItem.
 
  I can't extend just MessageListView since it's private and final. Even
 if I
  could subclass that, the FeedbackPanel constructor is called before my
  subclass of FeedbackPanel, so that it has already used the original
  MessageListView.
 
  Can you think of a clean way to eliminate the AttributeListener on
  listItem?
 
  Daniel
 



Re: FeedbackPanel customization

2013-07-17 Thread Daniel Watrous
This is what I ended up doing. Hopefully, as Cedric points out, it will be
more flexible in Wicket 7 and I can come back and clean it up.

Thanks.


On Wed, Jul 17, 2013 at 3:23 PM, Paul Bors p...@bors.ws wrote:

 Of course you can always override them in CSS as well.

 /* FEEDBACK MESSAGES */

 .feedbackMessages {
 padding-left: 0;
 padding-top: 0;
 text-align: left;
 margin-left: 0;
 margin-top: 0;
 padding-bottom: 1em;
 }

 .feedbackMessages div {
 padding: 0.5em;
 font-size: xx-small;
 border: none;
 }

 .feedbackMessages div.feedbackPanelERROR {
 background-color: lightsalmon;
 border: 1px solid darkred;
 }

 .feedbackMessages div.feedbackPanelWARNING {
 background-color: #FFB90F;
 border: 1px solid darkgoldenrod;
 }

 .feedbackMessages div.feedbackPanelINFO {
 background-color: lightgreen;
 border: 1px solid darkgreen;
 }

 ~ Thank you,
   Paul Bors

 -Original Message-
 From: Sebastien [mailto:seb...@gmail.com]
 Sent: Wednesday, July 17, 2013 5:21 PM
 To: users@wicket.apache.org
 Subject: Re: FeedbackPanel customization

 Hi Daniel,

 In such a case, you have to not use getCSSClass, but override
 newMessageDisplayComponent instead.

 You have a sample here:

 https://github.com/sebfz1/wicket-jquery-ui/blob/master/wicket-jquery-ui/src/
 main/java/com/googlecode/wicket/jquery/ui/panel/JQueryFeedbackPanel.java

 https://github.com/sebfz1/wicket-jquery-ui/blob/master/wicket-jquery-ui/src/
 main/java/com/googlecode/wicket/jquery/ui/panel/JQueryFeedbackPanel.html

 Hope this help,
 Sebastien.


 On Wed, Jul 17, 2013 at 10:54 PM, Daniel Watrous
 dwmaill...@gmail.comwrote:

  Hi,
 
  I'm working on a modification of the FeedbackPanel to work better with
  my theme. I would like to prevent the class for the actual message
  from being appended to. Right now MessageListView is a private final
  class and the populateItem adds an AttributeModifier to both the label
  and the listItem.
 
  I know I can override getCSSClass, but that still sets it for both the
  label and listItem.
 
  I can't extend just MessageListView since it's private and final. Even
  if I could subclass that, the FeedbackPanel constructor is called
  before my subclass of FeedbackPanel, so that it has already used the
  original MessageListView.
 
  Can you think of a clean way to eliminate the AttributeListener on
  listItem?
 
  Daniel
 


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




Re: Form questions

2013-07-16 Thread Daniel Watrous
Thanks Paul and Sven. I got the form to work and available in the onSubmit
handler.

Now I'm interested in splitting the form out into it's one file. So I
created a class that has nothing more than the form, but I'm not sure how
to include this into a page.

In my class I do this:

public class CnavModify extends ConsoleBasePage {

public CnavModify(PageParameters parameters) {
super(parameters);

Form form = new CnavForm(cnavFormArea);
add(form);
}
}

My CnavModify obviously extends a base page. What do I put inside the
wicket:extend tag to have the form render?

Daniel


On Tue, Jul 16, 2013 at 12:00 AM, Sven Meier s...@meiers.net wrote:

 Hi,


  Some problems I can't figure out. The code to create the button complains
 that it requires a CnavUrl but gets back a String.

add(new Button(publish, model) {
@Override
public void onSubmit() {
CnavUrl cnavUrl = (CnavUrl) getModelObject();
System.out.println(publish);
}
});


 a Button always has a IModelString to fill the value attribute. Note
 that in #onSubmit() you're getting the model object of the button, not of
 your form.
 You can write:

 add(new Button(publish, model) {
@Override
public void onSubmit() {
CnavUrl cnavUrl = (CnavUrl) MyForm.this.getModelObject();
System.out.println(publish);
}
});


 Using generic types in your code should help you.

 Sven



 On 07/15/2013 11:41 PM, Daniel Watrous wrote:

 Hello,

 I'm interested in creating a single Form that will accommodate the
 following use cases
 1) display blank for creating new records
 2) pre-populate for editing existing records
 3) map submitted values on to an existing domain object
 4) accommodate two actions, Save Draft -or- Publish

 I'm following Wicket in Action and within my Form constructor I create my
 model, like this

  CnavUrl cnavUrl = new BasicCnavUrl();
  IModel model = new Model((Serializable) cnavUrl);
  setModel(model);

 I then use PropertyModel

  add(new TextField(url, new PropertyModel(cnavUrl, url)));

 For the two actions, I'm creating the Button objects like this

  add(new Button(publish, model) {
  @Override
  public void onSubmit() {
  CnavUrl cnavUrl = (CnavUrl) getModelObject();
  System.out.println(publish);
  }
  });

 Some problems I can't figure out. The code to create the button complains
 that it requires a CnavUrl but gets back a String.

 It seems that a new BasicCnavUrl is created once with the Form. What
 happens on subsequent calls? Can I always expect my model to have the data
 from the current form submission?

 Is there a best way to incorporate the idea of an edit, where the model is
 pre-populated from a data source and pre-fills the Form fields?

 Thanks,
 Daniel



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




Form questions

2013-07-15 Thread Daniel Watrous
Hello,

I'm interested in creating a single Form that will accommodate the
following use cases
1) display blank for creating new records
2) pre-populate for editing existing records
3) map submitted values on to an existing domain object
4) accommodate two actions, Save Draft -or- Publish

I'm following Wicket in Action and within my Form constructor I create my
model, like this

CnavUrl cnavUrl = new BasicCnavUrl();
IModel model = new Model((Serializable) cnavUrl);
setModel(model);

I then use PropertyModel

add(new TextField(url, new PropertyModel(cnavUrl, url)));

For the two actions, I'm creating the Button objects like this

add(new Button(publish, model) {
@Override
public void onSubmit() {
CnavUrl cnavUrl = (CnavUrl) getModelObject();
System.out.println(publish);
}
});

Some problems I can't figure out. The code to create the button complains
that it requires a CnavUrl but gets back a String.

It seems that a new BasicCnavUrl is created once with the Form. What
happens on subsequent calls? Can I always expect my model to have the data
from the current form submission?

Is there a best way to incorporate the idea of an edit, where the model is
pre-populated from a data source and pre-fills the Form fields?

Thanks,
Daniel


Re: DI Through Constructors w/Wicket

2013-06-26 Thread Daniel Watrous
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 wspe...@apache.org 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




Re: Customizing links in Paging

2013-06-25 Thread Daniel Watrous
 serialVersionUID = 1L;
 @Override
 public boolean isVisible() {
 return !isShortenVersion();
 }
 };
 }

 @Override
 protected PagingNavigation newNavigation(String id, IPageable
 pageable, IPagingLabelProvider labelProvider) {
 return new AjaxPagingNavigation(navigation, pageable,
 labelProvider) {
 private static final long serialVersionUID = 1L;
 @Override
 protected Link? newPagingNavigationLink(String id,
 IPageable iPageable, long pageIndex) {
 return new AjaxPagingNavigationLink(id, iPageable,
 pageIndex);
 }
 @Override
 public boolean isVisible() {
 return !isShortenVersion();
 }
 };
 }

 @Override
 protected void onAjaxEvent(AjaxRequestTarget target) {
 updateComponents(target);
 target.add(table);
 if (target.getPage() instanceof ConsolePage) {

 target.add(((ConsolePage)target.getPage()).getFeedbackPanel());
 }
 }

 @Override
 public boolean isVisible() {
 return table.getPageCount()  1;
 }
 };
 }

 @Override
 protected WebComponent newNavigatorLabel(String navigatorId, final
 DataTable?, ? table) {
 NavigatorLabel nLabel = new NavigatorLabel(navigatorId, table) {
 private static final long serialVersionUID = 1L;
 @Override
 public boolean isVisible() {
 return isShowNavigationLabel();
 }
 };
 if (isShortenVersion()) {
 nLabel.setDefaultModel(
 new StringResourceModel(ShortNavigatorLabel, this,
 new ModelNavigationToolbarLabelData(new
 NavigationToolbarLabelData(table)), ${from} to ${to} of ${of})
 );
 }
 return nLabel;
 }

 /**
  * Override method in order to subscribe to Ajax pagination update
 events.
  */
 protected void updateComponents(AjaxRequestTarget target) { }

 /**
  * Predicator for the visibility of the {@link NavigatorLabel}.
  *
  * @return The visibility state of the navigator label.
  */
 public boolean isShowNavigationLabel() {
 return showNavigationLabel;
 }

 /**
  * Mutator for the navigation labels.
  *
  * @param   showStrechComponent Boolean flag set to codetrue/code
 if
 the
  *  navigation labels are to be displayed.
  * @return  A reference back to the same instance of this class object,
  *  useful to chain calls.
  */
 public MyAjaxNavigationToolbar setShowNavigationLabel(boolean
 showStrechComponent) {
 showNavigationLabel = showStrechComponent;
 return this;
 }

 /**
  * Controls the {@link NavigatorLabel}'s format that provides Showing x
 to y of z message given for a DataTable.br
  * The default of codefalse/code would use the longer codeShowing
 ${from} to ${to} of ${of}/code format
  * while if overridden to return codetrue/code then the shorter
 code${from} to ${to} of ${of}/code format
  * will be used
  *
  * @return  codefalse/code by default to show the long format.
  */
 public boolean isShortenVersion() {
 return false;
 }
 }

 ~ Thank you,
   Paul Bors

 -Original Message-
 From: Daniel Watrous [mailto:dwmaill...@gmail.com]
 Sent: Monday, June 24, 2013 4:15 PM
 To: users@wicket.apache.org
 Subject: Customizing links in Paging

 Hello,

 I'm using the Paging functionality with my DataProvider. I've been trying
 to
 make a simple change, but it's turned out to be very difficult.
 Hopefully you can give a little help.

 I have a class that extends PagingNavigator and provides markup specific to
 my theme. When the paging links render, the current page doesn't render
 with
 an a tag around it. It's stripped away.

 I've traced through and found that this is most likely due to AutoEnable
 being set to true in the Link that's created. That choice is hard coded in
 to the PagingNavigationLink class.

 I'm trying to avoid extending all of the Paging related classes down to the
 PagingNavigationLink in order to customize this behavior. Is there some way
 to have that active page render inside an a tag with no href?

 Thanks,
 Daniel


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




Re: Point Form action to Page

2013-06-24 Thread Daniel Watrous
I had a hard time figuring out how to follow your second suggestion and
making it work for my use case. Instead I ended up calling
parameters.clearNamed();

After I got the search term. That kept it out of my URL.

I also added a clear search link that unset the search filter parameter
in my DataProvider.

Thanks for your help.

Daniel


On Sat, Jun 22, 2013 at 10:45 AM, Paul Bors p...@bors.ws wrote:

 Try the second approach. There would be no query parameters to worry about.

 You can construct your page by taking as a constructor parameter a POJO
 that's the model object for the filter form. You can also have a default
 constructor that would construct the page with no filters.

 ~ Thank you,
Paul C Bors

 On Jun 21, 2013, at 18:11, Daniel Watrous dwmaill...@gmail.com wrote:

  That first approach worked, but it brings me back to another issue: I end
  up with a query string parameter
  searchFilter=quick
 
  This is the same problem I was running in to here:
 
 http://apache-wicket.1842946.n4.nabble.com/form-GET-and-POST-getting-mixed-up-td4659427.html
 
  When I try to load the page again, it keeps replacing that query string
 and
  so I can't get back to a broad result.
 
  Is there some way to clear the search (by clearing the query string
  parameter)?
 
  Daniel
 
  On Fri, Jun 21, 2013 at 3:51 PM, Paul Bors p...@bors.ws wrote:
 
  class SearchPanel ... {
   ...
   add(id, new SomeButtonSubmitLinkOrForm {
 @Override
   public void onSubmit() {
  // your biz logic
  PageParameter pageParameter = new PageParameters();
  pageParameters.add(searchFilter, mySearchFilter);
  setResponsePage(SearchResultsPage.class, pageParameter);
   }
   });
   ...
  }
 
 
 http://ci.apache.org/projects/wicket/apidocs/6.x/org/apache/wicket/request/m
  apper/parameter/PageParameters.html#PageParameters%28%29
 
  On a second though it might be even simpler not to use PageParameters
  (since
  you might have too many filter form fields) but to add another
 constructor
  to your SearchResultsPage that takes an instance to your SearchFilter
 POJO
  and filters itself accordingly. I normally reuse my DAO mapped POJOs.
 
  class SearchPanel ... {
   ...
   add(id, new SomeButtonSubmitLinkOrForm {
 @Override
   public void onSubmit() {
  // your biz logic creates an instance of mySearchFilter that
  encapsulates your search parameters
  setResponsePage(new SearchResultsPage(mySearchFilter)); //
 create
  this constructor and filter the page by it
   }
   });
   ...
  }
 
  ~ Thank you,
   Paul Bors
 
  -Original Message-
  From: Daniel Watrous [mailto:dwmaill...@gmail.com]
  Sent: Friday, June 21, 2013 5:40 PM
  To: users@wicket.apache.org
  Subject: Re: Point Form action to Page
 
  Within my SearchPanel onSubmit, how do I get the PageParameters to make
  that
  call to setResponsePage? I hope I'm understanding you right.
 
 
  On Fri, Jun 21, 2013 at 3:30 PM, Paul Bors p...@bors.ws wrote:
 
  There is a good reason why Wicket is not letting you override a form's
  action attribute. Is at the core of its processing.
 
  If I understand you right you have a panel that processes a search
  form and you would like to respond with SearchResultsPage.
 
  Wicket's way of doing that would be to use PageParameters. Add a
  constructor to your SearchResultsPage that takes in an instance of
  PageParameters and then pass your search parameters through it via
  setResponsePage(new SearchResultsPage(mySearchPageParameters).
 
  If I didn't understand you right, then try to better explain your
  use-case
  :)
 
  You might also be interested in the
  o.a.wicket.extensions.markup.html.repeater.data.table.filter package
  :)
 
  ~ Thank you,
   Paul Bors
 
  -Original Message-
  From: Daniel Watrous [mailto:dwmaill...@gmail.com]
  Sent: Friday, June 21, 2013 5:13 PM
  To: users@wicket.apache.org
  Subject: Point Form action to Page
 
  Hi,
 
  I have created a Panel that contains a search form. I can't figure out
  how to get the action of the Form to submit to the search results
  page. Any ideas?
 
  In other words, I was hoping to do something like this:
 
  form.add(new SimpleAttributeModifier(action,
  SearchResultsPage.class));
 
  Thanks,
  Daniel
 
 
  -
  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




Customizing links in Paging

2013-06-24 Thread Daniel Watrous
Hello,

I'm using the Paging functionality with my DataProvider. I've been trying
to make a simple change, but it's turned out to be very difficult.
Hopefully you can give a little help.

I have a class that extends PagingNavigator and provides markup specific to
my theme. When the paging links render, the current page doesn't render
with an a tag around it. It's stripped away.

I've traced through and found that this is most likely due to AutoEnable
being set to true in the Link that's created. That choice is hard coded in
to the PagingNavigationLink class.

I'm trying to avoid extending all of the Paging related classes down to the
PagingNavigationLink in order to customize this behavior. Is there some way
to have that active page render inside an a tag with no href?

Thanks,
Daniel


Point Form action to Page

2013-06-21 Thread Daniel Watrous
Hi,

I have created a Panel that contains a search form. I can't figure out how
to get the action of the Form to submit to the search results page. Any
ideas?

In other words, I was hoping to do something like this:

form.add(new SimpleAttributeModifier(action, SearchResultsPage.class));

Thanks,
Daniel


Re: Point Form action to Page

2013-06-21 Thread Daniel Watrous
Within my SearchPanel onSubmit, how do I get the PageParameters to make
that call to setResponsePage? I hope I'm understanding you right.


On Fri, Jun 21, 2013 at 3:30 PM, Paul Bors p...@bors.ws wrote:

 There is a good reason why Wicket is not letting you override a form's
 action attribute. Is at the core of its processing.

 If I understand you right you have a panel that processes a search form and
 you would like to respond with SearchResultsPage.

 Wicket's way of doing that would be to use PageParameters. Add a
 constructor
 to your SearchResultsPage that takes in an instance of PageParameters and
 then pass your search parameters through it via setResponsePage(new
 SearchResultsPage(mySearchPageParameters).

 If I didn't understand you right, then try to better explain your use-case
 :)

 You might also be interested in the
 o.a.wicket.extensions.markup.html.repeater.data.table.filter package :)

 ~ Thank you,
   Paul Bors

 -Original Message-
 From: Daniel Watrous [mailto:dwmaill...@gmail.com]
 Sent: Friday, June 21, 2013 5:13 PM
 To: users@wicket.apache.org
 Subject: Point Form action to Page

 Hi,

 I have created a Panel that contains a search form. I can't figure out how
 to get the action of the Form to submit to the search results page. Any
 ideas?

 In other words, I was hoping to do something like this:

 form.add(new SimpleAttributeModifier(action, SearchResultsPage.class));

 Thanks,
 Daniel


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




Re: Point Form action to Page

2013-06-21 Thread Daniel Watrous
That first approach worked, but it brings me back to another issue: I end
up with a query string parameter
searchFilter=quick

This is the same problem I was running in to here:
http://apache-wicket.1842946.n4.nabble.com/form-GET-and-POST-getting-mixed-up-td4659427.html

When I try to load the page again, it keeps replacing that query string and
so I can't get back to a broad result.

Is there some way to clear the search (by clearing the query string
parameter)?

Daniel

On Fri, Jun 21, 2013 at 3:51 PM, Paul Bors p...@bors.ws wrote:

 class SearchPanel ... {
   ...
   add(id, new SomeButtonSubmitLinkOrForm {
 @Override
   public void onSubmit() {
  // your biz logic
  PageParameter pageParameter = new PageParameters();
  pageParameters.add(searchFilter, mySearchFilter);
  setResponsePage(SearchResultsPage.class, pageParameter);
   }
   });
   ...
 }

 http://ci.apache.org/projects/wicket/apidocs/6.x/org/apache/wicket/request/m
 apper/parameter/PageParameters.html#PageParameters%28%29

 On a second though it might be even simpler not to use PageParameters
 (since
 you might have too many filter form fields) but to add another constructor
 to your SearchResultsPage that takes an instance to your SearchFilter POJO
 and filters itself accordingly. I normally reuse my DAO mapped POJOs.

 class SearchPanel ... {
   ...
   add(id, new SomeButtonSubmitLinkOrForm {
 @Override
   public void onSubmit() {
  // your biz logic creates an instance of mySearchFilter that
 encapsulates your search parameters
  setResponsePage(new SearchResultsPage(mySearchFilter)); // create
 this constructor and filter the page by it
   }
   });
   ...
 }

 ~ Thank you,
   Paul Bors

 -Original Message-
 From: Daniel Watrous [mailto:dwmaill...@gmail.com]
 Sent: Friday, June 21, 2013 5:40 PM
 To: users@wicket.apache.org
 Subject: Re: Point Form action to Page

 Within my SearchPanel onSubmit, how do I get the PageParameters to make
 that
 call to setResponsePage? I hope I'm understanding you right.


 On Fri, Jun 21, 2013 at 3:30 PM, Paul Bors p...@bors.ws wrote:

  There is a good reason why Wicket is not letting you override a form's
  action attribute. Is at the core of its processing.
 
  If I understand you right you have a panel that processes a search
  form and you would like to respond with SearchResultsPage.
 
  Wicket's way of doing that would be to use PageParameters. Add a
  constructor to your SearchResultsPage that takes in an instance of
  PageParameters and then pass your search parameters through it via
  setResponsePage(new SearchResultsPage(mySearchPageParameters).
 
  If I didn't understand you right, then try to better explain your
  use-case
  :)
 
  You might also be interested in the
  o.a.wicket.extensions.markup.html.repeater.data.table.filter package
  :)
 
  ~ Thank you,
Paul Bors
 
  -Original Message-
  From: Daniel Watrous [mailto:dwmaill...@gmail.com]
  Sent: Friday, June 21, 2013 5:13 PM
  To: users@wicket.apache.org
  Subject: Point Form action to Page
 
  Hi,
 
  I have created a Panel that contains a search form. I can't figure out
  how to get the action of the Form to submit to the search results
  page. Any ideas?
 
  In other words, I was hoping to do something like this:
 
  form.add(new SimpleAttributeModifier(action,
  SearchResultsPage.class));
 
  Thanks,
  Daniel
 
 
  -
  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




form GET and POST getting mixed up

2013-06-12 Thread Daniel Watrous
Hello,

I created a single page that shows some data using DataView. I then added a
form and allow a filter argument to be passed in. The problem I'm getting
is that the first time a search is done, the search value is added to the
URL for the page. Subsequent searches are ignored due to the query string.

I have looked for some way to change it to GET, but couldn't find that. I
also looked for some way to prevent the URL from being modified, but I'm
not clear on why that is happening either.

Any idea how to fix this?

Here's my Page code

public CnavDisplay(PageParameters parameters) {
super(parameters);

final TextFieldString search = new TextFieldString(search,
Model.of());
Form? form = new FormVoid(searchForm) {

@Override
protected void onSubmit() {

final String searchValue = search.getModelObject();

PageParameters pageParameters = new PageParameters();
pageParameters.add(search, searchValue);
setResponsePage(CnavDisplay.class, pageParameters);

}

};

add(form);
form.add(search);

CnavUrlDataProvider dataProvider = new CnavUrlDataProvider();
if (!parameters.get(search).isEmpty()) {
dataProvider.setSearch(parameters.get(search).toString());
}

DataViewCnavUrl dataView = new DataViewCnavUrl(repeating,
dataProvider) {
private static final long serialVersionUID = 1L;

@Override
protected void populateItem(final ItemCnavUrl item)
{
CnavUrl cnavUrl = item.getModelObject();
//item.add(new Label(cnavid,
String.valueOf(((MorphiaCnavUrl)cnavUrl).getId(;
item.add(new Label(url, cnavUrl.getURL()));
item.add(new Label(type, cnavUrl.getType()));

item.add(AttributeModifier.replace(class, new
AbstractReadOnlyModelString()
{
private static final long serialVersionUID = 1L;

@Override
public String getObject()
{
return (item.getIndex() % 2 == 1) ? even : odd;
}
}));
}
};

Here's my application where I mount the page

mountPage(/cnavlink, CnavDisplay.class);

Any ideas?

Thanks,
Daniel


Re: form GET and POST getting mixed up

2013-06-12 Thread Daniel Watrous
I found a solution that worked.

I didn't realize that by adding the value passed in to a PageParameters
object and then setting the response page I was telling Wicket to add that
to the URL. I got rid of that.

I changed my form to this use the CompoundPropertyModel:
Form? form = new FormCnavDisplay(searchForm, new
CompoundPropertyModelCnavDisplay(this));

I also added a class attribute for search and moved my onsubmit into a
Button declaration.

final CnavUrlDataProvider dataProvider = new CnavUrlDataProvider();

final TextFieldString searchField = new
TextFieldString(search, new PropertyModel(this,search));
Form? form = new FormCnavDisplay(searchForm, new
CompoundPropertyModelCnavDisplay(this));
Button submitButton = new Button(searchButton) {  // (4)
@Override
public void onSubmit() {
if (search != null  !search.isEmpty()) {
dataProvider.setSearch(search);
}
}
};

add(form);
form.add(searchField);
form.add(submitButton);

Thanks,
Daniel



On Wed, Jun 12, 2013 at 9:39 AM, Daniel Watrous dwmaill...@gmail.comwrote:

 Hello,

 I created a single page that shows some data using DataView. I then added
 a form and allow a filter argument to be passed in. The problem I'm getting
 is that the first time a search is done, the search value is added to the
 URL for the page. Subsequent searches are ignored due to the query string.

 I have looked for some way to change it to GET, but couldn't find that. I
 also looked for some way to prevent the URL from being modified, but I'm
 not clear on why that is happening either.

 Any idea how to fix this?

 Here's my Page code

 public CnavDisplay(PageParameters parameters) {
 super(parameters);

 final TextFieldString search = new TextFieldString(search,
 Model.of());
 Form? form = new FormVoid(searchForm) {

 @Override
 protected void onSubmit() {

 final String searchValue = search.getModelObject();

 PageParameters pageParameters = new PageParameters();
 pageParameters.add(search, searchValue);
  setResponsePage(CnavDisplay.class, pageParameters);

 }

 };

 add(form);
 form.add(search);

 CnavUrlDataProvider dataProvider = new CnavUrlDataProvider();
 if (!parameters.get(search).isEmpty()) {
 dataProvider.setSearch(parameters.get(search).toString());
 }

 DataViewCnavUrl dataView = new DataViewCnavUrl(repeating,
 dataProvider) {
 private static final long serialVersionUID = 1L;

 @Override
 protected void populateItem(final ItemCnavUrl item)
 {
 CnavUrl cnavUrl = item.getModelObject();
 //item.add(new Label(cnavid,
 String.valueOf(((MorphiaCnavUrl)cnavUrl).getId(;
 item.add(new Label(url, cnavUrl.getURL()));
 item.add(new Label(type, cnavUrl.getType()));

 item.add(AttributeModifier.replace(class, new
 AbstractReadOnlyModelString()
 {
 private static final long serialVersionUID = 1L;

 @Override
 public String getObject()
 {
 return (item.getIndex() % 2 == 1) ? even : odd;
 }
 }));
 }
 };

 Here's my application where I mount the page

 mountPage(/cnavlink, CnavDisplay.class);

 Any ideas?

 Thanks,
 Daniel



Paging and excessive database access (repeaters)

2013-06-11 Thread Daniel Watrous
Hi,

I'm following the example in the repeaters section for paging through large
amounts of data:
http://www.wicket-library.com/wicket-examples-6.0.x/repeater/wicket/bookmarkable/org.apache.wicket.examples.repeater.PagingPage

Based on the example and how I've had to implement this there is a lot of
data access. First is in the ContactDataProvider. The function iterator
queries for the set of data that will be displayed.

Next, all the objects that are returned need to be wrapped in
a DetachableContactModel. The load mechanism here then loads each
individual object from the datastore.

In the example, the data is in memory. In a real world scenario the data is
likely to be remote and this setup could have a significant performance
impact.

Is there some way to cut out some of the data access? For example, can I
get rid of DetachableContactModel and just use the data retrieved through
the ContactDataProvider?

Thanks,
Daniel


Do all POJOs have to implement Serializable?

2013-06-11 Thread Daniel Watrous
Hi,

I have an existing application tier that I package as a jar and place in a
maven repository. I've been working to expose some of this application
through Wicket. It's easy to include it in the pom, but I keep getting:

ERROR - JavaSerializer - Error serializing object MyObject  ...
 The object type is not Serializable!

Do all of my classes have to implement serializable in order to use them in
Wicket?

Daniel


Re: Paging and excessive database access (repeaters)

2013-06-11 Thread Daniel Watrous
So what I'm hearing is that I have to use the Detachable model, but that I
can build in some caching to prevent unnecessary datastore access.

Thanks.


On Tue, Jun 11, 2013 at 1:11 PM, Marios Skounakis msc...@gmail.com wrote:

 This example is not quite optimized. The DetachableContactModel's
 constructor is

 public DetachableContactModel(Contact c)
 {
 this(c.getId());
 }

 but it should be:


 public DetachableContactModel(Contact c)
 {
 this(c.getId());
 setObject(c);
 }

 The way it's done in the example although the model is given the contact,
 it stores only its id and needs to load it from the database in order to
 access it, even while rendering the table. The way I suggest the model is
 given the contact and does not need to load it.

 So, the way it's done in the example database access is as follows:
 - a list query to get the contacts for a given page
 - n queries by id, one for each row

 The way I'm suggesting database access is as follows:
 - a list query to get the contacts for a give page
 - no other queties

 If the row contains say a link column that accesses the row model in the
 ajax click, then you will see an additional database access by id when the
 DetachableContactModel is attached.

 Cheers
 Marios


 On Tue, Jun 11, 2013 at 6:56 PM, Daniel Watrous dwmaill...@gmail.com
 wrote:

  Hi,
 
  I'm following the example in the repeaters section for paging through
 large
  amounts of data:
 
 
 http://www.wicket-library.com/wicket-examples-6.0.x/repeater/wicket/bookmarkable/org.apache.wicket.examples.repeater.PagingPage
 
  Based on the example and how I've had to implement this there is a lot of
  data access. First is in the ContactDataProvider. The function iterator
  queries for the set of data that will be displayed.
 
  Next, all the objects that are returned need to be wrapped in
  a DetachableContactModel. The load mechanism here then loads each
  individual object from the datastore.
 
  In the example, the data is in memory. In a real world scenario the data
 is
  likely to be remote and this setup could have a significant performance
  impact.
 
  Is there some way to cut out some of the data access? For example, can I
  get rid of DetachableContactModel and just use the data retrieved through
  the ContactDataProvider?
 
  Thanks,
  Daniel
 



Re: Wicket + Guice + unittests

2012-10-16 Thread Daniel Watrous
Martin,

In this case it would be just as easy to inject a specific bean.

I did it this way because it matched some other examples that I saw.

Daniel
On Oct 16, 2012 1:08 AM, Martin Grigorov mgrigo...@apache.org wrote:

 Hi Daniel,

 public class HomePage extends WebPage {
 private static final long serialVersionUID = 1L;
 @Inject private Injector injector;

 public HomePage(final PageParameters parameters) {
 super(parameters);

 add(new Label(version,
 getApplication().getFrameworkSettings().getVersion()));

 // TODO Add your page's components here
 QuickLink quickLink = injector.getInstance(QuickLink.class);
 add(new Label(quickLink , quickLink.buildQuickLink()));
 }
 }

 Why do you inject the Injector and then ask it for beans instead of
 injecting the bean directly and use it ?

 On Mon, Oct 15, 2012 at 6:51 PM, Daniel Watrous
 daniel.watr...@gmail.com wrote:
  Dan,
 
  Thanks for all your help. I finally worked through all the details and
  have it working. Here's my write up:
 
  http://software.danielwatrous.com/wicket-guice-including-unittests/
 
  The last bit I needed clarification on was how to pass parameters to
  the WicketFilter. I think the integration between Wicket and Guice is
  clean and flexible.
 
  Thanks again,
  Daniel
 
  On Fri, Oct 12, 2012 at 12:35 PM, Daniel Watrous
  daniel.watr...@gmail.com wrote:
  yes, that's what I have in my web.xml
 
  On Fri, Oct 12, 2012 at 12:10 PM, Dan Retzlaff dretzl...@gmail.com
 wrote:
  Yes, CustomFilter = CustomWicketFilter... Those aren't our actual
 names.
  And yes, we provide filter parameters too. I just omitted them since
 they
  weren't relevant to the Guice-based application instantiation I was
  describing.
 
  Do you have this in your web.xml?
  filter
  filter-nameguiceFilter/filter-name
  filter-classcom.google.inject.servlet.GuiceFilter/filter-class
  /filter
  filter-mapping
  filter-nameguiceFilter/filter-name
  url-pattern/*/url-pattern
  /filter-mapping
 
  On Fri, Oct 12, 2012 at 6:01 PM, Daniel Watrous 
 daniel.watr...@gmail.comwrote:
 
  Dan,
 
  Thanks. I've got unittests running now, but the WicketFilter doesn't
  seem to be processing. All I get when I run the applicaiton shows a
  jetty produced directory listing.
 
  In the snippet you provided before I think that CustomFilter and
  CustomeWicketFilter should be the same thing. Is that right?
 
  In my previous approach, when I bound the WicketFilter I included some
  parameters, like this:
  filter(/*).through(WicketFilter.class,
  createWicketFilterInitParams());
 
  With this function
 
  private MapString, String createWicketFilterInitParams() {
  MapString, String wicketFilterParams = new HashMapString,
  String();
  wicketFilterParams.put(WicketFilter.FILTER_MAPPING_PARAM,
 /*);
  wicketFilterParams.put(applicationClassName,
  com.hp.honeybadger.web.WicketApplication);
  return wicketFilterParams;
  }
 
  I'm now trying to figure out how to make sure that the wicket filter
  is called...
 
  Daniel
 
  On Fri, Oct 12, 2012 at 11:03 AM, Dan Retzlaff dretzl...@gmail.com
  wrote:
   I follow you. WicketTester doesn't know about GuiceFilter, so you'll
  need a
   different way of getting your Injector into your Wicket Application.
  Rather
   than getting the Injector from your servlet context attributes, I'm
   suggesting that you let Guice instantiate your Application so you
 can
   @Inject the injector like any other dependency. The binding code I
 posted
   previously does the (non-test) setup; for the test itself it's as
 simple
  as
   https://gist.github.com/3880246.
  
   Hope that helps. By the way, I enjoyed your Wicket+EC2 article.
 Thanks
  for
   that. :)
  
   On Fri, Oct 12, 2012 at 4:08 PM, Daniel Watrous 
  daniel.watr...@gmail.comwrote:
  
   Dan,
  
   I'm not talking about my application. I'm talking about unittests.
   I've followed the Guice recommended way to integrate with servlets
   using the GuiceFilter.
  
   Now I'm trying to make the Wicket unittests work and I need the
   injector to be available in WicketTester.
  
   Daniel
  
   On Thu, Oct 11, 2012 at 6:10 PM, Dan Retzlaff dretzl...@gmail.com
 
  wrote:
For what it's worth, we instantiate our applications through
 Guice.
   Having
your application go get its Injector kind of violates the DI
  concept.
   
filter(/*).through(WicketFilter.class);
bind(WebApplication.class).to(CustomWebApplication.class);
bind(WicketFilter.class).to(CustomWicketFilter.class);
   
@Singleton
private static class CustomFilter extends WicketFilter {
@Inject private ProviderWebApplication webApplicationProvider;
 @Override
protected IWebApplicationFactory getApplicationFactory() {
return new IWebApplicationFactory() {
@Override
public WebApplication createApplication(WicketFilter filter) {
return webApplicationProvider.get();
}
@Override

Re: Wicket + Guice + unittests

2012-10-15 Thread Daniel Watrous
Dan,

Thanks for all your help. I finally worked through all the details and
have it working. Here's my write up:

http://software.danielwatrous.com/wicket-guice-including-unittests/

The last bit I needed clarification on was how to pass parameters to
the WicketFilter. I think the integration between Wicket and Guice is
clean and flexible.

Thanks again,
Daniel

On Fri, Oct 12, 2012 at 12:35 PM, Daniel Watrous
daniel.watr...@gmail.com wrote:
 yes, that's what I have in my web.xml

 On Fri, Oct 12, 2012 at 12:10 PM, Dan Retzlaff dretzl...@gmail.com wrote:
 Yes, CustomFilter = CustomWicketFilter... Those aren't our actual names.
 And yes, we provide filter parameters too. I just omitted them since they
 weren't relevant to the Guice-based application instantiation I was
 describing.

 Do you have this in your web.xml?
 filter
 filter-nameguiceFilter/filter-name
 filter-classcom.google.inject.servlet.GuiceFilter/filter-class
 /filter
 filter-mapping
 filter-nameguiceFilter/filter-name
 url-pattern/*/url-pattern
 /filter-mapping

 On Fri, Oct 12, 2012 at 6:01 PM, Daniel Watrous 
 daniel.watr...@gmail.comwrote:

 Dan,

 Thanks. I've got unittests running now, but the WicketFilter doesn't
 seem to be processing. All I get when I run the applicaiton shows a
 jetty produced directory listing.

 In the snippet you provided before I think that CustomFilter and
 CustomeWicketFilter should be the same thing. Is that right?

 In my previous approach, when I bound the WicketFilter I included some
 parameters, like this:
 filter(/*).through(WicketFilter.class,
 createWicketFilterInitParams());

 With this function

 private MapString, String createWicketFilterInitParams() {
 MapString, String wicketFilterParams = new HashMapString,
 String();
 wicketFilterParams.put(WicketFilter.FILTER_MAPPING_PARAM, /*);
 wicketFilterParams.put(applicationClassName,
 com.hp.honeybadger.web.WicketApplication);
 return wicketFilterParams;
 }

 I'm now trying to figure out how to make sure that the wicket filter
 is called...

 Daniel

 On Fri, Oct 12, 2012 at 11:03 AM, Dan Retzlaff dretzl...@gmail.com
 wrote:
  I follow you. WicketTester doesn't know about GuiceFilter, so you'll
 need a
  different way of getting your Injector into your Wicket Application.
 Rather
  than getting the Injector from your servlet context attributes, I'm
  suggesting that you let Guice instantiate your Application so you can
  @Inject the injector like any other dependency. The binding code I posted
  previously does the (non-test) setup; for the test itself it's as simple
 as
  https://gist.github.com/3880246.
 
  Hope that helps. By the way, I enjoyed your Wicket+EC2 article. Thanks
 for
  that. :)
 
  On Fri, Oct 12, 2012 at 4:08 PM, Daniel Watrous 
 daniel.watr...@gmail.comwrote:
 
  Dan,
 
  I'm not talking about my application. I'm talking about unittests.
  I've followed the Guice recommended way to integrate with servlets
  using the GuiceFilter.
 
  Now I'm trying to make the Wicket unittests work and I need the
  injector to be available in WicketTester.
 
  Daniel
 
  On Thu, Oct 11, 2012 at 6:10 PM, Dan Retzlaff dretzl...@gmail.com
 wrote:
   For what it's worth, we instantiate our applications through Guice.
  Having
   your application go get its Injector kind of violates the DI
 concept.
  
   filter(/*).through(WicketFilter.class);
   bind(WebApplication.class).to(CustomWebApplication.class);
   bind(WicketFilter.class).to(CustomWicketFilter.class);
  
   @Singleton
   private static class CustomFilter extends WicketFilter {
   @Inject private ProviderWebApplication webApplicationProvider;
@Override
   protected IWebApplicationFactory getApplicationFactory() {
   return new IWebApplicationFactory() {
   @Override
   public WebApplication createApplication(WicketFilter filter) {
   return webApplicationProvider.get();
   }
   @Override
   public void destroy(WicketFilter filter) {
   }
   };
   }
   }
  
   On Thu, Oct 11, 2012 at 11:49 PM, Daniel Watrous
   daniel.watr...@gmail.comwrote:
  
   Dan,
  
   I think you're right. Since in the WicketApplication init() function
 I
   attempt to get the bootStrapInjector like this:
   Injector bootStrapInjector = (Injector)
   this.getServletContext().getAttribute(Injector.class.getName());
  
   I just can't figure out how to get the injector into the
   ServletContext before init() is run in my WicketApplication.
  
   Daniel
  
   On Wed, Oct 10, 2012 at 6:10 PM, Dan Retzlaff dretzl...@gmail.com
  wrote:
Daniel,
   
What you're doing should work, but I think you're giving
your GuiceComponentInjector a null Injector. Unit tests don't go
  through
web.xml to set up its context listeners, so
your GuiceServletContextListener never has a chance to construct
 and
register an Injector with the ServletContext.
   
Dan
   
On Wed, Oct 10, 2012 at 5:30 PM, Daniel Watrous 
   daniel.watr...@gmail.comwrote:
   
Hi

Re: Wicket + Guice + unittests

2012-10-12 Thread Daniel Watrous
Dan,

I'm not talking about my application. I'm talking about unittests.
I've followed the Guice recommended way to integrate with servlets
using the GuiceFilter.

Now I'm trying to make the Wicket unittests work and I need the
injector to be available in WicketTester.

Daniel

On Thu, Oct 11, 2012 at 6:10 PM, Dan Retzlaff dretzl...@gmail.com wrote:
 For what it's worth, we instantiate our applications through Guice. Having
 your application go get its Injector kind of violates the DI concept.

 filter(/*).through(WicketFilter.class);
 bind(WebApplication.class).to(CustomWebApplication.class);
 bind(WicketFilter.class).to(CustomWicketFilter.class);

 @Singleton
 private static class CustomFilter extends WicketFilter {
 @Inject private ProviderWebApplication webApplicationProvider;
  @Override
 protected IWebApplicationFactory getApplicationFactory() {
 return new IWebApplicationFactory() {
 @Override
 public WebApplication createApplication(WicketFilter filter) {
 return webApplicationProvider.get();
 }
 @Override
 public void destroy(WicketFilter filter) {
 }
 };
 }
 }

 On Thu, Oct 11, 2012 at 11:49 PM, Daniel Watrous
 daniel.watr...@gmail.comwrote:

 Dan,

 I think you're right. Since in the WicketApplication init() function I
 attempt to get the bootStrapInjector like this:
 Injector bootStrapInjector = (Injector)
 this.getServletContext().getAttribute(Injector.class.getName());

 I just can't figure out how to get the injector into the
 ServletContext before init() is run in my WicketApplication.

 Daniel

 On Wed, Oct 10, 2012 at 6:10 PM, Dan Retzlaff dretzl...@gmail.com wrote:
  Daniel,
 
  What you're doing should work, but I think you're giving
  your GuiceComponentInjector a null Injector. Unit tests don't go through
  web.xml to set up its context listeners, so
  your GuiceServletContextListener never has a chance to construct and
  register an Injector with the ServletContext.
 
  Dan
 
  On Wed, Oct 10, 2012 at 5:30 PM, Daniel Watrous 
 daniel.watr...@gmail.comwrote:
 
  Hi,
 
  I've integrated Guice into Wicket successfully, but I'm struggling
  with the unittests. I'm not sure how to get the injector into my
  HomePage class. Here's my setup.
 
  I'm using GuiceFilter with a GuiceServletContextListener. That creates
  the injector and a ServletModule which defines the WicketApplication.
  I followed:
  http://code.google.com/p/google-guice/wiki/ServletModule
 
  Here's some of MyGuiceServletConfig extends GuiceServletContextListener
 
  @Override
  protected Injector getInjector() {
  return Guice.createInjector(createServletModule(), new
  MongoHoneybadgerModule());
  }
 
  private ServletModule createServletModule() {
  return new ServletModule() {
  ...
 
  In my WicketApplication extends WebApplication I have this init() method
 
  @Override
  public void init()
  {
  super.init();
  Injector bootStrapInjector = (Injector)
  this.getServletContext().getAttribute(Injector.class.getName());
  getComponentInstantiationListeners().add(new
  GuiceComponentInjector(this, bootStrapInjector));
  }
 
  Now, in my HomePage.java class I have
 
  public class HomePage extends WebPage {
  private static final long serialVersionUID = 1L;
  @Inject private Injector injector;
 
  public HomePage(final PageParameters parameters) {
  super(parameters);
  SomeType myobj = injector.getInstance(SomeType.class);
 
  add(new Label(version, myobj.getValue()));
  }
  }
 
  This all runs great inside a web container as a servlet.
 
  The PROBLEM: I'm getting a NullPointerException on the line where I
  reference the injector:
  SomeType myobj = injector.getInstance(SomeType.class);
 
  My test class is what was generated by the wicket quickstart. I'm not
  sure how to make an injector available in setUp.
 
  @Before
  public void setUp() {
  tester = new WicketTester(new WicketApplication());
  }
 
  Any ideas?
 
  Thanks,
  Daniel
 
  -
  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: Wicket + Guice + unittests

2012-10-12 Thread Daniel Watrous
Dan,

Thanks. I've got unittests running now, but the WicketFilter doesn't
seem to be processing. All I get when I run the applicaiton shows a
jetty produced directory listing.

In the snippet you provided before I think that CustomFilter and
CustomeWicketFilter should be the same thing. Is that right?

In my previous approach, when I bound the WicketFilter I included some
parameters, like this:
filter(/*).through(WicketFilter.class,
createWicketFilterInitParams());

With this function

private MapString, String createWicketFilterInitParams() {
MapString, String wicketFilterParams = new HashMapString, String();
wicketFilterParams.put(WicketFilter.FILTER_MAPPING_PARAM, /*);
wicketFilterParams.put(applicationClassName,
com.hp.honeybadger.web.WicketApplication);
return wicketFilterParams;
}

I'm now trying to figure out how to make sure that the wicket filter
is called...

Daniel

On Fri, Oct 12, 2012 at 11:03 AM, Dan Retzlaff dretzl...@gmail.com wrote:
 I follow you. WicketTester doesn't know about GuiceFilter, so you'll need a
 different way of getting your Injector into your Wicket Application. Rather
 than getting the Injector from your servlet context attributes, I'm
 suggesting that you let Guice instantiate your Application so you can
 @Inject the injector like any other dependency. The binding code I posted
 previously does the (non-test) setup; for the test itself it's as simple as
 https://gist.github.com/3880246.

 Hope that helps. By the way, I enjoyed your Wicket+EC2 article. Thanks for
 that. :)

 On Fri, Oct 12, 2012 at 4:08 PM, Daniel Watrous 
 daniel.watr...@gmail.comwrote:

 Dan,

 I'm not talking about my application. I'm talking about unittests.
 I've followed the Guice recommended way to integrate with servlets
 using the GuiceFilter.

 Now I'm trying to make the Wicket unittests work and I need the
 injector to be available in WicketTester.

 Daniel

 On Thu, Oct 11, 2012 at 6:10 PM, Dan Retzlaff dretzl...@gmail.com wrote:
  For what it's worth, we instantiate our applications through Guice.
 Having
  your application go get its Injector kind of violates the DI concept.
 
  filter(/*).through(WicketFilter.class);
  bind(WebApplication.class).to(CustomWebApplication.class);
  bind(WicketFilter.class).to(CustomWicketFilter.class);
 
  @Singleton
  private static class CustomFilter extends WicketFilter {
  @Inject private ProviderWebApplication webApplicationProvider;
   @Override
  protected IWebApplicationFactory getApplicationFactory() {
  return new IWebApplicationFactory() {
  @Override
  public WebApplication createApplication(WicketFilter filter) {
  return webApplicationProvider.get();
  }
  @Override
  public void destroy(WicketFilter filter) {
  }
  };
  }
  }
 
  On Thu, Oct 11, 2012 at 11:49 PM, Daniel Watrous
  daniel.watr...@gmail.comwrote:
 
  Dan,
 
  I think you're right. Since in the WicketApplication init() function I
  attempt to get the bootStrapInjector like this:
  Injector bootStrapInjector = (Injector)
  this.getServletContext().getAttribute(Injector.class.getName());
 
  I just can't figure out how to get the injector into the
  ServletContext before init() is run in my WicketApplication.
 
  Daniel
 
  On Wed, Oct 10, 2012 at 6:10 PM, Dan Retzlaff dretzl...@gmail.com
 wrote:
   Daniel,
  
   What you're doing should work, but I think you're giving
   your GuiceComponentInjector a null Injector. Unit tests don't go
 through
   web.xml to set up its context listeners, so
   your GuiceServletContextListener never has a chance to construct and
   register an Injector with the ServletContext.
  
   Dan
  
   On Wed, Oct 10, 2012 at 5:30 PM, Daniel Watrous 
  daniel.watr...@gmail.comwrote:
  
   Hi,
  
   I've integrated Guice into Wicket successfully, but I'm struggling
   with the unittests. I'm not sure how to get the injector into my
   HomePage class. Here's my setup.
  
   I'm using GuiceFilter with a GuiceServletContextListener. That
 creates
   the injector and a ServletModule which defines the WicketApplication.
   I followed:
   http://code.google.com/p/google-guice/wiki/ServletModule
  
   Here's some of MyGuiceServletConfig extends
 GuiceServletContextListener
  
   @Override
   protected Injector getInjector() {
   return Guice.createInjector(createServletModule(), new
   MongoHoneybadgerModule());
   }
  
   private ServletModule createServletModule() {
   return new ServletModule() {
   ...
  
   In my WicketApplication extends WebApplication I have this init()
 method
  
   @Override
   public void init()
   {
   super.init();
   Injector bootStrapInjector = (Injector)
   this.getServletContext().getAttribute(Injector.class.getName());
   getComponentInstantiationListeners().add(new
   GuiceComponentInjector(this, bootStrapInjector));
   }
  
   Now, in my HomePage.java class I have
  
   public class HomePage extends WebPage

Re: Wicket + Guice + unittests

2012-10-12 Thread Daniel Watrous
yes, that's what I have in my web.xml

On Fri, Oct 12, 2012 at 12:10 PM, Dan Retzlaff dretzl...@gmail.com wrote:
 Yes, CustomFilter = CustomWicketFilter... Those aren't our actual names.
 And yes, we provide filter parameters too. I just omitted them since they
 weren't relevant to the Guice-based application instantiation I was
 describing.

 Do you have this in your web.xml?
 filter
 filter-nameguiceFilter/filter-name
 filter-classcom.google.inject.servlet.GuiceFilter/filter-class
 /filter
 filter-mapping
 filter-nameguiceFilter/filter-name
 url-pattern/*/url-pattern
 /filter-mapping

 On Fri, Oct 12, 2012 at 6:01 PM, Daniel Watrous 
 daniel.watr...@gmail.comwrote:

 Dan,

 Thanks. I've got unittests running now, but the WicketFilter doesn't
 seem to be processing. All I get when I run the applicaiton shows a
 jetty produced directory listing.

 In the snippet you provided before I think that CustomFilter and
 CustomeWicketFilter should be the same thing. Is that right?

 In my previous approach, when I bound the WicketFilter I included some
 parameters, like this:
 filter(/*).through(WicketFilter.class,
 createWicketFilterInitParams());

 With this function

 private MapString, String createWicketFilterInitParams() {
 MapString, String wicketFilterParams = new HashMapString,
 String();
 wicketFilterParams.put(WicketFilter.FILTER_MAPPING_PARAM, /*);
 wicketFilterParams.put(applicationClassName,
 com.hp.honeybadger.web.WicketApplication);
 return wicketFilterParams;
 }

 I'm now trying to figure out how to make sure that the wicket filter
 is called...

 Daniel

 On Fri, Oct 12, 2012 at 11:03 AM, Dan Retzlaff dretzl...@gmail.com
 wrote:
  I follow you. WicketTester doesn't know about GuiceFilter, so you'll
 need a
  different way of getting your Injector into your Wicket Application.
 Rather
  than getting the Injector from your servlet context attributes, I'm
  suggesting that you let Guice instantiate your Application so you can
  @Inject the injector like any other dependency. The binding code I posted
  previously does the (non-test) setup; for the test itself it's as simple
 as
  https://gist.github.com/3880246.
 
  Hope that helps. By the way, I enjoyed your Wicket+EC2 article. Thanks
 for
  that. :)
 
  On Fri, Oct 12, 2012 at 4:08 PM, Daniel Watrous 
 daniel.watr...@gmail.comwrote:
 
  Dan,
 
  I'm not talking about my application. I'm talking about unittests.
  I've followed the Guice recommended way to integrate with servlets
  using the GuiceFilter.
 
  Now I'm trying to make the Wicket unittests work and I need the
  injector to be available in WicketTester.
 
  Daniel
 
  On Thu, Oct 11, 2012 at 6:10 PM, Dan Retzlaff dretzl...@gmail.com
 wrote:
   For what it's worth, we instantiate our applications through Guice.
  Having
   your application go get its Injector kind of violates the DI
 concept.
  
   filter(/*).through(WicketFilter.class);
   bind(WebApplication.class).to(CustomWebApplication.class);
   bind(WicketFilter.class).to(CustomWicketFilter.class);
  
   @Singleton
   private static class CustomFilter extends WicketFilter {
   @Inject private ProviderWebApplication webApplicationProvider;
@Override
   protected IWebApplicationFactory getApplicationFactory() {
   return new IWebApplicationFactory() {
   @Override
   public WebApplication createApplication(WicketFilter filter) {
   return webApplicationProvider.get();
   }
   @Override
   public void destroy(WicketFilter filter) {
   }
   };
   }
   }
  
   On Thu, Oct 11, 2012 at 11:49 PM, Daniel Watrous
   daniel.watr...@gmail.comwrote:
  
   Dan,
  
   I think you're right. Since in the WicketApplication init() function
 I
   attempt to get the bootStrapInjector like this:
   Injector bootStrapInjector = (Injector)
   this.getServletContext().getAttribute(Injector.class.getName());
  
   I just can't figure out how to get the injector into the
   ServletContext before init() is run in my WicketApplication.
  
   Daniel
  
   On Wed, Oct 10, 2012 at 6:10 PM, Dan Retzlaff dretzl...@gmail.com
  wrote:
Daniel,
   
What you're doing should work, but I think you're giving
your GuiceComponentInjector a null Injector. Unit tests don't go
  through
web.xml to set up its context listeners, so
your GuiceServletContextListener never has a chance to construct
 and
register an Injector with the ServletContext.
   
Dan
   
On Wed, Oct 10, 2012 at 5:30 PM, Daniel Watrous 
   daniel.watr...@gmail.comwrote:
   
Hi,
   
I've integrated Guice into Wicket successfully, but I'm struggling
with the unittests. I'm not sure how to get the injector into my
HomePage class. Here's my setup.
   
I'm using GuiceFilter with a GuiceServletContextListener. That
  creates
the injector and a ServletModule which defines the
 WicketApplication.
I followed:
http://code.google.com/p/google-guice/wiki/ServletModule
   
Here's some

Re: Wicket + Guice + unittests

2012-10-11 Thread Daniel Watrous
Dan,

I think you're right. Since in the WicketApplication init() function I
attempt to get the bootStrapInjector like this:
Injector bootStrapInjector = (Injector)
this.getServletContext().getAttribute(Injector.class.getName());

I just can't figure out how to get the injector into the
ServletContext before init() is run in my WicketApplication.

Daniel

On Wed, Oct 10, 2012 at 6:10 PM, Dan Retzlaff dretzl...@gmail.com wrote:
 Daniel,

 What you're doing should work, but I think you're giving
 your GuiceComponentInjector a null Injector. Unit tests don't go through
 web.xml to set up its context listeners, so
 your GuiceServletContextListener never has a chance to construct and
 register an Injector with the ServletContext.

 Dan

 On Wed, Oct 10, 2012 at 5:30 PM, Daniel Watrous 
 daniel.watr...@gmail.comwrote:

 Hi,

 I've integrated Guice into Wicket successfully, but I'm struggling
 with the unittests. I'm not sure how to get the injector into my
 HomePage class. Here's my setup.

 I'm using GuiceFilter with a GuiceServletContextListener. That creates
 the injector and a ServletModule which defines the WicketApplication.
 I followed:
 http://code.google.com/p/google-guice/wiki/ServletModule

 Here's some of MyGuiceServletConfig extends GuiceServletContextListener

 @Override
 protected Injector getInjector() {
 return Guice.createInjector(createServletModule(), new
 MongoHoneybadgerModule());
 }

 private ServletModule createServletModule() {
 return new ServletModule() {
 ...

 In my WicketApplication extends WebApplication I have this init() method

 @Override
 public void init()
 {
 super.init();
 Injector bootStrapInjector = (Injector)
 this.getServletContext().getAttribute(Injector.class.getName());
 getComponentInstantiationListeners().add(new
 GuiceComponentInjector(this, bootStrapInjector));
 }

 Now, in my HomePage.java class I have

 public class HomePage extends WebPage {
 private static final long serialVersionUID = 1L;
 @Inject private Injector injector;

 public HomePage(final PageParameters parameters) {
 super(parameters);
 SomeType myobj = injector.getInstance(SomeType.class);

 add(new Label(version, myobj.getValue()));
 }
 }

 This all runs great inside a web container as a servlet.

 The PROBLEM: I'm getting a NullPointerException on the line where I
 reference the injector:
 SomeType myobj = injector.getInstance(SomeType.class);

 My test class is what was generated by the wicket quickstart. I'm not
 sure how to make an injector available in setUp.

 @Before
 public void setUp() {
 tester = new WicketTester(new WicketApplication());
 }

 Any ideas?

 Thanks,
 Daniel

 -
 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: Wicket + Guice + unittests

2012-10-10 Thread Daniel Watrous
Thanks Ronan,

Can you share the implementation of StubProjectorApplication? That
doesn't appear to be part of Wicket or Guice.

Daniel

On Wed, Oct 10, 2012 at 12:29 PM, Ronan O'Connell
ronanoconnell1...@gmail.com wrote:
 Hi Daniel,

 I'm using Guice in a couple of wicket projects though my understanding of it
 is a little limited! My set-up matches yours except that in my unit test
 setup I call injectMembers :

 @Before
 public void setUp()
 {
 final StubProjectorApplication stubApplication = new
 StubProjectorApplication();
 _tester = new WicketTester(stubApplication);
 stubApplication.getWarpInjector().injectMembers(this); //
 getWarpInjector returns the injector built in the init method
 }

 I'm not sure this is right..it feels to me that it shouldn't be be
 necessary, but it works for me :) .

 Ronan


 On 10/10/2012 18:30, Daniel Watrous wrote:

 Hi,

 I've integrated Guice into Wicket successfully, but I'm struggling
 with the unittests. I'm not sure how to get the injector into my
 HomePage class. Here's my setup.

 I'm using GuiceFilter with a GuiceServletContextListener. That creates
 the injector and a ServletModule which defines the WicketApplication.
 I followed:
 http://code.google.com/p/google-guice/wiki/ServletModule

 Here's some of MyGuiceServletConfig extends GuiceServletContextListener

  @Override
  protected Injector getInjector() {
  return Guice.createInjector(createServletModule(), new
 MongoHoneybadgerModule());
  }

  private ServletModule createServletModule() {
  return new ServletModule() {
 ...

 In my WicketApplication extends WebApplication I have this init() method

  @Override
  public void init()
  {
  super.init();
  Injector bootStrapInjector = (Injector)
 this.getServletContext().getAttribute(Injector.class.getName());
  getComponentInstantiationListeners().add(new
 GuiceComponentInjector(this, bootStrapInjector));
  }

 Now, in my HomePage.java class I have

 public class HomePage extends WebPage {
  private static final long serialVersionUID = 1L;
  @Inject private Injector injector;

  public HomePage(final PageParameters parameters) {
 super(parameters);
  SomeType myobj = injector.getInstance(SomeType.class);

 add(new Label(version, myobj.getValue()));
  }
 }

 This all runs great inside a web container as a servlet.

 The PROBLEM: I'm getting a NullPointerException on the line where I
 reference the injector:
  SomeType myobj = injector.getInstance(SomeType.class);

 My test class is what was generated by the wicket quickstart. I'm not
 sure how to make an injector available in setUp.

  @Before
  public void setUp() {
  tester = new WicketTester(new WicketApplication());
  }

 Any ideas?

 Thanks,
 Daniel

 -
 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: Reload html in Wicket + GAE

2012-02-07 Thread Daniel Watrous
Thanks Martin,

I did make that much progress yesterday after sending this, but I
can't figure out how to get the Application inside the onBeginRequest
method that I override. In the other examples they call
getApplication()

@Override
protected void onBeginRequest() {
if 
(getApplication().getConfigurationType().equals(Application.DEVELOPMENT))
{
final GaeModificationWatcher resourceWatcher =
(GaeModificationWatcher) getApplication()
.getResourceSettings().getResourceWatcher(true);
resourceWatcher.checkResources();
}
}

How can I get the Application object?

Daniel

On Mon, Feb 6, 2012 at 11:43 PM, Martin Grigorov mgrigo...@apache.org wrote:
 Hi,

 On Tue, Feb 7, 2012 at 1:32 AM, Daniel Watrous daniel.watr...@gmail.com 
 wrote:
 Hi,

 I'm following up on a previous thread that's still unresolved. I would
 like GAE to automatically reload my HTML when I save changes. Classes
 are reloaded when I save (compile) them, but I have to restart each
 time for HTML changes.

 There are some old articles that show how to do this, but they deal
 with older versions of Wicket and GAE. For example:
 http://agilewombat.blogspot.com/2010/01/wicket-on-google-app-engine.html
 http://apache-wicket.1842946.n4.nabble.com/How-can-I-reload-HTML-in-app-engine-td3005241.html
 http://code.google.com/p/kickat26/source/browse/trunk/src/de/kickat26/ui/wicket/GAEModificationWatcher.java

 Those suggest creating a class MyWebRequestCycle extends
 WebRequestCycle, but wicket 1.5 doesn't have WebRequestCycle.

 How can I accomplish this same thing in the current version of wicket?

 application.getRequestCycleListeners().add(new MyRequestCycleListener())

 class MyRequestCycleListener extends AbstractRequestCycleListener {
  // override the method you need here
 }

 Once you have it you can contribute it to gae-initializer project so
 other people can re-use it and improve it.


 Daniel

 -
 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


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



Re: Reload html in Wicket + GAE

2012-02-07 Thread Daniel Watrous
I've now created a class MyRequestCycleListener extends
AbstractRequestCycleListener.

I'm having a little trouble building  class GaeModificationWatcher
implements IModificationWatcher. I've tried following this example:
http://agilewombat.blogspot.com/2010/01/wicket-on-google-app-engine.html

to create the public void checkResources() function, but I'm not sure
what Entry class to import. I have tried importing these two Entry
classes:
org.apache.wicket.util.collections.IntHashMap.Entry
import com.google.appengine.repackaged.com.google.common.collect.Multiset.Entry

It seems no matter which Entry class I import I get errors like:

Multiple markers at this line
- Entry cannot be resolved to a type
- The constructor
HashSetEntryIModifiable,SetIChangeListener(SetMap.EntryIModifiable,SetIChangeListener)
is
 undefined
- Incorrect number of arguments for type IntHashMap.Entry; it cannot
be parameterized with arguments IModifiable,
 SetIChangeListener

Thanks for any pointers.

Daniel


On Tue, Feb 7, 2012 at 7:07 AM, Martin Grigorov mgrigo...@apache.org wrote:
 On Tue, Feb 7, 2012 at 3:53 PM, Daniel Watrous daniel.watr...@gmail.com 
 wrote:
 Thanks Martin,

 I did make that much progress yesterday after sending this, but I
 can't figure out how to get the Application inside the onBeginRequest
 method that I override. In the other examples they call
 getApplication()

    @Override
    protected void onBeginRequest() {
        if 
 (getApplication().getConfigurationType().equals(Application.DEVELOPMENT))
 {
            final GaeModificationWatcher resourceWatcher =
 (GaeModificationWatcher) getApplication()
                    .getResourceSettings().getResourceWatcher(true);
            resourceWatcher.checkResources();
        }
    }

 How can I get the Application object?

 Application.get()


 Daniel

 On Mon, Feb 6, 2012 at 11:43 PM, Martin Grigorov mgrigo...@apache.org 
 wrote:
 Hi,

 On Tue, Feb 7, 2012 at 1:32 AM, Daniel Watrous daniel.watr...@gmail.com 
 wrote:
 Hi,

 I'm following up on a previous thread that's still unresolved. I would
 like GAE to automatically reload my HTML when I save changes. Classes
 are reloaded when I save (compile) them, but I have to restart each
 time for HTML changes.

 There are some old articles that show how to do this, but they deal
 with older versions of Wicket and GAE. For example:
 http://agilewombat.blogspot.com/2010/01/wicket-on-google-app-engine.html
 http://apache-wicket.1842946.n4.nabble.com/How-can-I-reload-HTML-in-app-engine-td3005241.html
 http://code.google.com/p/kickat26/source/browse/trunk/src/de/kickat26/ui/wicket/GAEModificationWatcher.java

 Those suggest creating a class MyWebRequestCycle extends
 WebRequestCycle, but wicket 1.5 doesn't have WebRequestCycle.

 How can I accomplish this same thing in the current version of wicket?

 application.getRequestCycleListeners().add(new MyRequestCycleListener())

 class MyRequestCycleListener extends AbstractRequestCycleListener {
  // override the method you need here
 }

 Once you have it you can contribute it to gae-initializer project so
 other people can re-use it and improve it.


 Daniel

 -
 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


 -
 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


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



Re: Reload html in Wicket + GAE

2012-02-07 Thread Daniel Watrous
That helped. I'm getting really close.

I'm now getting a null pointer exception in this function

public boolean add(IModifiable modifiable, IChangeListener listener) {
// TODO Auto-generated method stub
checkResources();
SetIChangeListener listeners = 
listenersMap.putIfAbsent(modifiable,
new HashSetIChangeListener());
return listeners.add(listener);
}

listeners is null.

I noticed that start(Duration pollFrequency) in GaeModificationWatcher
was never getting called, so I updated my WicketApplication to set it
like this:

IModificationWatcher watcher = new GaeModificationWatcher();
watcher.start(Duration.ONE_SECOND);
getResourceSettings().setResourceWatcher(watcher);

But that didn't help my problem. I'm still trying to follow
http://agilewombat.blogspot.com/2010/01/wicket-on-google-app-engine.html

Any pointers?

Thanks,
Daniel

On Tue, Feb 7, 2012 at 8:42 AM, Martin Grigorov mgrigo...@apache.org wrote:
 Try with java.util.Map.Entry

 On Tue, Feb 7, 2012 at 5:39 PM, Daniel Watrous daniel.watr...@gmail.com 
 wrote:
 I've now created a class MyRequestCycleListener extends
 AbstractRequestCycleListener.

 I'm having a little trouble building  class GaeModificationWatcher
 implements IModificationWatcher. I've tried following this example:
 http://agilewombat.blogspot.com/2010/01/wicket-on-google-app-engine.html

 to create the public void checkResources() function, but I'm not sure
 what Entry class to import. I have tried importing these two Entry
 classes:
 org.apache.wicket.util.collections.IntHashMap.Entry
 import 
 com.google.appengine.repackaged.com.google.common.collect.Multiset.Entry

 It seems no matter which Entry class I import I get errors like:

 Multiple markers at this line
        - Entry cannot be resolved to a type
        - The constructor
 HashSetEntryIModifiable,SetIChangeListener(SetMap.EntryIModifiable,SetIChangeListener)
 is
         undefined
        - Incorrect number of arguments for type IntHashMap.Entry; it cannot
 be parameterized with arguments IModifiable,
         SetIChangeListener

 Thanks for any pointers.

 Daniel


 On Tue, Feb 7, 2012 at 7:07 AM, Martin Grigorov mgrigo...@apache.org wrote:
 On Tue, Feb 7, 2012 at 3:53 PM, Daniel Watrous daniel.watr...@gmail.com 
 wrote:
 Thanks Martin,

 I did make that much progress yesterday after sending this, but I
 can't figure out how to get the Application inside the onBeginRequest
 method that I override. In the other examples they call
 getApplication()

    @Override
    protected void onBeginRequest() {
        if 
 (getApplication().getConfigurationType().equals(Application.DEVELOPMENT))
 {
            final GaeModificationWatcher resourceWatcher =
 (GaeModificationWatcher) getApplication()
                    .getResourceSettings().getResourceWatcher(true);
            resourceWatcher.checkResources();
        }
    }

 How can I get the Application object?

 Application.get()


 Daniel

 On Mon, Feb 6, 2012 at 11:43 PM, Martin Grigorov mgrigo...@apache.org 
 wrote:
 Hi,

 On Tue, Feb 7, 2012 at 1:32 AM, Daniel Watrous daniel.watr...@gmail.com 
 wrote:
 Hi,

 I'm following up on a previous thread that's still unresolved. I would
 like GAE to automatically reload my HTML when I save changes. Classes
 are reloaded when I save (compile) them, but I have to restart each
 time for HTML changes.

 There are some old articles that show how to do this, but they deal
 with older versions of Wicket and GAE. For example:
 http://agilewombat.blogspot.com/2010/01/wicket-on-google-app-engine.html
 http://apache-wicket.1842946.n4.nabble.com/How-can-I-reload-HTML-in-app-engine-td3005241.html
 http://code.google.com/p/kickat26/source/browse/trunk/src/de/kickat26/ui/wicket/GAEModificationWatcher.java

 Those suggest creating a class MyWebRequestCycle extends
 WebRequestCycle, but wicket 1.5 doesn't have WebRequestCycle.

 How can I accomplish this same thing in the current version of wicket?

 application.getRequestCycleListeners().add(new MyRequestCycleListener())

 class MyRequestCycleListener extends AbstractRequestCycleListener {
  // override the method you need here
 }

 Once you have it you can contribute it to gae-initializer project so
 other people can re-use it and improve it.


 Daniel

 -
 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


 -
 To unsubscribe, e-mail: users

Re: Reload html in Wicket + GAE

2012-02-07 Thread Daniel Watrous
So I was just looking at what I sent along and it seems that
putIfAbsent(modifiable, new HashSetIChangeListener()) should return
the value component, which should be the new HashSetIChangeListener.
Even if the key modifiable already exists, it should return the
previously created HashSetIChangeListener.

I'm confused that listener is coming back null.

Daniel

On Tue, Feb 7, 2012 at 9:21 AM, Daniel Watrous daniel.watr...@gmail.com wrote:
 That helped. I'm getting really close.

 I'm now getting a null pointer exception in this function

        public boolean add(IModifiable modifiable, IChangeListener listener) {
                // TODO Auto-generated method stub
                checkResources();
                SetIChangeListener listeners = 
 listenersMap.putIfAbsent(modifiable,
                                new HashSetIChangeListener());
                return listeners.add(listener);
        }

 listeners is null.

 I noticed that start(Duration pollFrequency) in GaeModificationWatcher
 was never getting called, so I updated my WicketApplication to set it
 like this:

                IModificationWatcher watcher = new GaeModificationWatcher();
                watcher.start(Duration.ONE_SECOND);
                getResourceSettings().setResourceWatcher(watcher);

 But that didn't help my problem. I'm still trying to follow
 http://agilewombat.blogspot.com/2010/01/wicket-on-google-app-engine.html

 Any pointers?

 Thanks,
 Daniel

 On Tue, Feb 7, 2012 at 8:42 AM, Martin Grigorov mgrigo...@apache.org wrote:
 Try with java.util.Map.Entry

 On Tue, Feb 7, 2012 at 5:39 PM, Daniel Watrous daniel.watr...@gmail.com 
 wrote:
 I've now created a class MyRequestCycleListener extends
 AbstractRequestCycleListener.

 I'm having a little trouble building  class GaeModificationWatcher
 implements IModificationWatcher. I've tried following this example:
 http://agilewombat.blogspot.com/2010/01/wicket-on-google-app-engine.html

 to create the public void checkResources() function, but I'm not sure
 what Entry class to import. I have tried importing these two Entry
 classes:
 org.apache.wicket.util.collections.IntHashMap.Entry
 import 
 com.google.appengine.repackaged.com.google.common.collect.Multiset.Entry

 It seems no matter which Entry class I import I get errors like:

 Multiple markers at this line
        - Entry cannot be resolved to a type
        - The constructor
 HashSetEntryIModifiable,SetIChangeListener(SetMap.EntryIModifiable,SetIChangeListener)
 is
         undefined
        - Incorrect number of arguments for type IntHashMap.Entry; it cannot
 be parameterized with arguments IModifiable,
         SetIChangeListener

 Thanks for any pointers.

 Daniel


 On Tue, Feb 7, 2012 at 7:07 AM, Martin Grigorov mgrigo...@apache.org 
 wrote:
 On Tue, Feb 7, 2012 at 3:53 PM, Daniel Watrous daniel.watr...@gmail.com 
 wrote:
 Thanks Martin,

 I did make that much progress yesterday after sending this, but I
 can't figure out how to get the Application inside the onBeginRequest
 method that I override. In the other examples they call
 getApplication()

    @Override
    protected void onBeginRequest() {
        if 
 (getApplication().getConfigurationType().equals(Application.DEVELOPMENT))
 {
            final GaeModificationWatcher resourceWatcher =
 (GaeModificationWatcher) getApplication()
                    .getResourceSettings().getResourceWatcher(true);
            resourceWatcher.checkResources();
        }
    }

 How can I get the Application object?

 Application.get()


 Daniel

 On Mon, Feb 6, 2012 at 11:43 PM, Martin Grigorov mgrigo...@apache.org 
 wrote:
 Hi,

 On Tue, Feb 7, 2012 at 1:32 AM, Daniel Watrous 
 daniel.watr...@gmail.com wrote:
 Hi,

 I'm following up on a previous thread that's still unresolved. I would
 like GAE to automatically reload my HTML when I save changes. Classes
 are reloaded when I save (compile) them, but I have to restart each
 time for HTML changes.

 There are some old articles that show how to do this, but they deal
 with older versions of Wicket and GAE. For example:
 http://agilewombat.blogspot.com/2010/01/wicket-on-google-app-engine.html
 http://apache-wicket.1842946.n4.nabble.com/How-can-I-reload-HTML-in-app-engine-td3005241.html
 http://code.google.com/p/kickat26/source/browse/trunk/src/de/kickat26/ui/wicket/GAEModificationWatcher.java

 Those suggest creating a class MyWebRequestCycle extends
 WebRequestCycle, but wicket 1.5 doesn't have WebRequestCycle.

 How can I accomplish this same thing in the current version of wicket?

 application.getRequestCycleListeners().add(new MyRequestCycleListener())

 class MyRequestCycleListener extends AbstractRequestCycleListener {
  // override the method you need here
 }

 Once you have it you can contribute it to gae-initializer project so
 other people can re-use it and improve it.


 Daniel

 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org

Re: Reload html in Wicket + GAE

2012-02-07 Thread Daniel Watrous
I finally got it working. Here's the modified function:

public boolean add(IModifiable modifiable, IChangeListener listener) {
// TODO Auto-generated method stub
checkResources();
HashSetIChangeListener listenerSet = new 
HashSetIChangeListener();
SetIChangeListener listeners =
listenersMap.putIfAbsent(modifiable, listenerSet);
if (listeners != null) {
return listeners.add(listener);
} else return listenerSet.add(listener);
}

I'm not sure if that's a good approach or not, but it works for me and
that's fantastic.

Daniel

On Tue, Feb 7, 2012 at 9:30 AM, Daniel Watrous daniel.watr...@gmail.com wrote:
 So I was just looking at what I sent along and it seems that
 putIfAbsent(modifiable, new HashSetIChangeListener()) should return
 the value component, which should be the new HashSetIChangeListener.
 Even if the key modifiable already exists, it should return the
 previously created HashSetIChangeListener.

 I'm confused that listener is coming back null.

 Daniel

 On Tue, Feb 7, 2012 at 9:21 AM, Daniel Watrous daniel.watr...@gmail.com 
 wrote:
 That helped. I'm getting really close.

 I'm now getting a null pointer exception in this function

        public boolean add(IModifiable modifiable, IChangeListener listener) {
                // TODO Auto-generated method stub
                checkResources();
                SetIChangeListener listeners = 
 listenersMap.putIfAbsent(modifiable,
                                new HashSetIChangeListener());
                return listeners.add(listener);
        }

 listeners is null.

 I noticed that start(Duration pollFrequency) in GaeModificationWatcher
 was never getting called, so I updated my WicketApplication to set it
 like this:

                IModificationWatcher watcher = new GaeModificationWatcher();
                watcher.start(Duration.ONE_SECOND);
                getResourceSettings().setResourceWatcher(watcher);

 But that didn't help my problem. I'm still trying to follow
 http://agilewombat.blogspot.com/2010/01/wicket-on-google-app-engine.html

 Any pointers?

 Thanks,
 Daniel

 On Tue, Feb 7, 2012 at 8:42 AM, Martin Grigorov mgrigo...@apache.org wrote:
 Try with java.util.Map.Entry

 On Tue, Feb 7, 2012 at 5:39 PM, Daniel Watrous daniel.watr...@gmail.com 
 wrote:
 I've now created a class MyRequestCycleListener extends
 AbstractRequestCycleListener.

 I'm having a little trouble building  class GaeModificationWatcher
 implements IModificationWatcher. I've tried following this example:
 http://agilewombat.blogspot.com/2010/01/wicket-on-google-app-engine.html

 to create the public void checkResources() function, but I'm not sure
 what Entry class to import. I have tried importing these two Entry
 classes:
 org.apache.wicket.util.collections.IntHashMap.Entry
 import 
 com.google.appengine.repackaged.com.google.common.collect.Multiset.Entry

 It seems no matter which Entry class I import I get errors like:

 Multiple markers at this line
        - Entry cannot be resolved to a type
        - The constructor
 HashSetEntryIModifiable,SetIChangeListener(SetMap.EntryIModifiable,SetIChangeListener)
 is
         undefined
        - Incorrect number of arguments for type IntHashMap.Entry; it cannot
 be parameterized with arguments IModifiable,
         SetIChangeListener

 Thanks for any pointers.

 Daniel


 On Tue, Feb 7, 2012 at 7:07 AM, Martin Grigorov mgrigo...@apache.org 
 wrote:
 On Tue, Feb 7, 2012 at 3:53 PM, Daniel Watrous daniel.watr...@gmail.com 
 wrote:
 Thanks Martin,

 I did make that much progress yesterday after sending this, but I
 can't figure out how to get the Application inside the onBeginRequest
 method that I override. In the other examples they call
 getApplication()

    @Override
    protected void onBeginRequest() {
        if 
 (getApplication().getConfigurationType().equals(Application.DEVELOPMENT))
 {
            final GaeModificationWatcher resourceWatcher =
 (GaeModificationWatcher) getApplication()
                    .getResourceSettings().getResourceWatcher(true);
            resourceWatcher.checkResources();
        }
    }

 How can I get the Application object?

 Application.get()


 Daniel

 On Mon, Feb 6, 2012 at 11:43 PM, Martin Grigorov mgrigo...@apache.org 
 wrote:
 Hi,

 On Tue, Feb 7, 2012 at 1:32 AM, Daniel Watrous 
 daniel.watr...@gmail.com wrote:
 Hi,

 I'm following up on a previous thread that's still unresolved. I would
 like GAE to automatically reload my HTML when I save changes. Classes
 are reloaded when I save (compile) them, but I have to restart each
 time for HTML changes.

 There are some old articles that show how to do this, but they deal
 with older versions of Wicket and GAE. For example:
 http://agilewombat.blogspot.com/2010/01/wicket-on-google-app-engine.html
 http://apache-wicket.1842946.n4.nabble.com/How-can-I-reload-HTML-in-app-engine-td3005241

Re: Reload html in Wicket + GAE

2012-02-07 Thread Daniel Watrous
Here's my write up:
http://software.danielwatrous.com/software-engineering/wicket-gae-automatic-reload

I'm not sure if I can push directly into wicketstuff, but I'm happy to
try. You can grab the source from my site and put it in there. You may
even have a more clever way to composing things.

Daniel

On Tue, Feb 7, 2012 at 12:17 PM, Kayode Odeyemi drey...@gmail.com wrote:
 Glad you got it working Daniel, as Martin mentioned earlier, I'll
 appreciate if you can contribute this to existing GaeInitializer or
 somewhere comfortable with the full code so it can be valuable to us all.

 Thanks

 On Tue, Feb 7, 2012 at 5:31 PM, Daniel Watrous 
 daniel.watr...@gmail.comwrote:

 I finally got it working. Here's the modified function:

        public boolean add(IModifiable modifiable, IChangeListener
 listener) {
                // TODO Auto-generated method stub
                checkResources();
                 HashSetIChangeListener listenerSet = new
 HashSetIChangeListener();
                SetIChangeListener listeners =
 listenersMap.putIfAbsent(modifiable, listenerSet);
                if (listeners != null) {
                        return listeners.add(listener);
                } else return listenerSet.add(listener);
        }

 I'm not sure if that's a good approach or not, but it works for me and
 that's fantastic.

 Daniel

 On Tue, Feb 7, 2012 at 9:30 AM, Daniel Watrous daniel.watr...@gmail.com
 wrote:
  So I was just looking at what I sent along and it seems that
  putIfAbsent(modifiable, new HashSetIChangeListener()) should return
  the value component, which should be the new HashSetIChangeListener.
  Even if the key modifiable already exists, it should return the
  previously created HashSetIChangeListener.
 
  I'm confused that listener is coming back null.
 
  Daniel
 
  On Tue, Feb 7, 2012 at 9:21 AM, Daniel Watrous daniel.watr...@gmail.com
 wrote:
  That helped. I'm getting really close.
 
  I'm now getting a null pointer exception in this function
 
         public boolean add(IModifiable modifiable, IChangeListener
 listener) {
                 // TODO Auto-generated method stub
                 checkResources();
                 SetIChangeListener listeners =
 listenersMap.putIfAbsent(modifiable,
                                 new HashSetIChangeListener());
                 return listeners.add(listener);
         }
 
  listeners is null.
 
  I noticed that start(Duration pollFrequency) in GaeModificationWatcher
  was never getting called, so I updated my WicketApplication to set it
  like this:
 
                 IModificationWatcher watcher = new
 GaeModificationWatcher();
                 watcher.start(Duration.ONE_SECOND);
                 getResourceSettings().setResourceWatcher(watcher);
 
  But that didn't help my problem. I'm still trying to follow
 
 http://agilewombat.blogspot.com/2010/01/wicket-on-google-app-engine.html
 
  Any pointers?
 
  Thanks,
  Daniel
 
  On Tue, Feb 7, 2012 at 8:42 AM, Martin Grigorov mgrigo...@apache.org
 wrote:
  Try with java.util.Map.Entry
 
  On Tue, Feb 7, 2012 at 5:39 PM, Daniel Watrous 
 daniel.watr...@gmail.com wrote:
  I've now created a class MyRequestCycleListener extends
  AbstractRequestCycleListener.
 
  I'm having a little trouble building  class GaeModificationWatcher
  implements IModificationWatcher. I've tried following this example:
 
 http://agilewombat.blogspot.com/2010/01/wicket-on-google-app-engine.html
 
  to create the public void checkResources() function, but I'm not sure
  what Entry class to import. I have tried importing these two Entry
  classes:
  org.apache.wicket.util.collections.IntHashMap.Entry
  import
 com.google.appengine.repackaged.com.google.common.collect.Multiset.Entry
 
  It seems no matter which Entry class I import I get errors like:
 
  Multiple markers at this line
         - Entry cannot be resolved to a type
         - The constructor
 
 HashSetEntryIModifiable,SetIChangeListener(SetMap.EntryIModifiable,SetIChangeListener)
  is
          undefined
         - Incorrect number of arguments for type IntHashMap.Entry; it
 cannot
  be parameterized with arguments IModifiable,
          SetIChangeListener
 
  Thanks for any pointers.
 
  Daniel
 
 
  On Tue, Feb 7, 2012 at 7:07 AM, Martin Grigorov mgrigo...@apache.org
 wrote:
  On Tue, Feb 7, 2012 at 3:53 PM, Daniel Watrous 
 daniel.watr...@gmail.com wrote:
  Thanks Martin,
 
  I did make that much progress yesterday after sending this, but I
  can't figure out how to get the Application inside the
 onBeginRequest
  method that I override. In the other examples they call
  getApplication()
 
     @Override
     protected void onBeginRequest() {
         if
 (getApplication().getConfigurationType().equals(Application.DEVELOPMENT))
  {
             final GaeModificationWatcher resourceWatcher =
  (GaeModificationWatcher) getApplication()
                     .getResourceSettings().getResourceWatcher(true);
             resourceWatcher.checkResources

Reload html in Wicket + GAE

2012-02-06 Thread Daniel Watrous
Hi,

I'm following up on a previous thread that's still unresolved. I would
like GAE to automatically reload my HTML when I save changes. Classes
are reloaded when I save (compile) them, but I have to restart each
time for HTML changes.

There are some old articles that show how to do this, but they deal
with older versions of Wicket and GAE. For example:
http://agilewombat.blogspot.com/2010/01/wicket-on-google-app-engine.html
http://apache-wicket.1842946.n4.nabble.com/How-can-I-reload-HTML-in-app-engine-td3005241.html
http://code.google.com/p/kickat26/source/browse/trunk/src/de/kickat26/ui/wicket/GAEModificationWatcher.java

Those suggest creating a class MyWebRequestCycle extends
WebRequestCycle, but wicket 1.5 doesn't have WebRequestCycle.

How can I accomplish this same thing in the current version of wicket?

Daniel

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



Re: AJAX Rating extension, multiple on a page

2012-01-23 Thread Daniel Watrous
It turned out to be easier than I thought (must not have been thinking
in the wicket way).

Here's what I do (notice that inside populateItem I have access to
movieItem, which I can use to getModelObject()):

// Add movieListView of existing movies
moviesForm.add(new PropertyListViewMovie(movies, movieList) {

@Override
public void populateItem(final ListItemMovie movieItem) {
final RatingModel rating = new
RatingModel(movieItem.getModelObject().getRating());
movieItem.add(new
TextFieldString(name).setType(String.class));
movieItem.add(new DropDownChoiceCategory(category,
Arrays.asList(Category.values()), new
EnumChoiceRendererCategory(this)));
movieItem.add(new RatingPanel (rating, new
PropertyModelInteger(rating, rating), 5, new
PropertyModelInteger(rating, numberOfVotes), false) {
@Override
public boolean onIsStarActive(int star) {
return rating.isActive(star);
}
@Override
public void onRated(int newRating,
AjaxRequestTarget target) {
movieItem.getModelObject().setRating(newRating);
rating.updateRating(newRating);

Session session =
HibernateUtil.getSessionFactory().getCurrentSession();
session.beginTransaction();
session.update(movieItem.getModelObject());
session.getTransaction().commit();

movieList.detach();
}
});
movieItem.add(new Link(removeLink) {
@Override
public void onClick() {
System.out.print(movieItem.getModelObject().getId());
Session session =
HibernateUtil.getSessionFactory().getCurrentSession();
session.beginTransaction();
session.delete(movieItem.getModelObject());
session.getTransaction().commit();
movieList.detach();
}
});
}
}).setVersioned(false);

Daniel

On Sun, Jan 22, 2012 at 12:46 PM, armhold armh...@gmail.com wrote:
 Just to be clear in case it wasn't obvious- thingBeingRated will be
 serialized with the rest of your page if you take this approach. If it's not
 serializable, use a reference (like a database ID) to look it up when
 needed, instead of marking the object itself as final.


 --
 View this message in context: 
 http://apache-wicket.1842946.n4.nabble.com/AJAX-Rating-extension-multiple-on-a-page-tp4317346p4318956.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


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



form processing for multiple objects

2012-01-23 Thread Daniel Watrous
I have populated a form with values representing several different
objects. This is what my markup looks like:


form wicket:id = moviesForm id = moviesForm
span wicket:id = movies id = movies
a wicket:id = removeLink(remove)/a
input type=text wicket:id=name class=nospam/
select wicket:id=category/
span wicket:id=ratingrating/span
br /
/span
input type = submit value = Update Movies id=formsubmit/
/form

The span is reproduced for each object that I pull from a database.
There is a different identifier for each span, as you can see here:
http://screencast.com/t/l8pLGZnJVn8

I want to be able to access these objects when I click submit the
form, but I'm not sure how to get access to them. This is what I have
tried so far:


Form moviesForm = new FormValueMap(moviesForm) {
/**
 * Show the resulting valid new movie
 */
@Override
public final void onSubmit() {
ValueMap values = getModelObject();

// perform validation and security here
if (StringUtils.isBlank((String) values.get(name))) {
error(Received bad input!!!);
return;
}

Session session =
HibernateUtil.getSessionFactory().getCurrentSession();
session.beginTransaction();

Movie movie = new Movie();
movie.setName((String) values.get(name));
movie.setCategory((Category) values.get(category));
session.save(movie);
session.getTransaction().commit();
}

};

The ValueMap values comes back null from getModelObject(). Any
pointers for me to get these objects back in a way that I can easily
update them?

Thanks.

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



Re: form processing for multiple objects

2012-01-23 Thread Daniel Watrous
Let me give a little more detail. The way that markup is managed is
through this:

// Add movieListView of existing movies
moviesForm.add(new PropertyListViewMovie(movies, movieList) {

@Override
public void populateItem(final ListItemMovie movieItem) {
final RatingModel rating = new
RatingModel(movieItem.getModelObject().getRating());
movieItem.add(new
TextFieldString(name).setType(String.class));
movieItem.add(new DropDownChoiceCategory(category,
Arrays.asList(Category.values()), new
EnumChoiceRendererCategory(this)));
movieItem.add(new RatingPanel (rating, new
PropertyModelInteger(rating, rating), 5, new
PropertyModelInteger(rating, numberOfVotes), false) {
@Override
public boolean onIsStarActive(int star) {
return rating.isActive(star);
}
@Override
public void onRated(int newRating,
AjaxRequestTarget target) {
movieItem.getModelObject().setRating(newRating);
rating.updateRating(newRating);

Session session =
HibernateUtil.getSessionFactory().getCurrentSession();
session.beginTransaction();
session.update(movieItem.getModelObject());
session.getTransaction().commit();

movieList.detach();
}
});
movieItem.add(new Link(removeLink) {
@Override
public void onClick() {
System.out.print(movieItem.getModelObject().getId());
Session session =
HibernateUtil.getSessionFactory().getCurrentSession();
session.beginTransaction();
session.delete(movieItem.getModelObject());
session.getTransaction().commit();
movieList.detach();
}
});
}
}).setVersioned(false);

I suppose that means that I'm not actually adding new items to the
list as a form. Maybe what I need is to treat the entire component as
a form from the beginning. I'm just not sure exactly how to do that.

Any ideas?

Daniel

On Mon, Jan 23, 2012 at 9:07 AM, Daniel Watrous
daniel.watr...@gmail.com wrote:
 I have populated a form with values representing several different
 objects. This is what my markup looks like:


            form wicket:id = moviesForm id = moviesForm
                span wicket:id = movies id = movies
                    a wicket:id = removeLink(remove)/a
                    input type=text wicket:id=name class=nospam/
                    select wicket:id=category/
                    span wicket:id=ratingrating/span
                    br /
                /span
                input type = submit value = Update Movies 
 id=formsubmit/
            /form

 The span is reproduced for each object that I pull from a database.
 There is a different identifier for each span, as you can see here:
 http://screencast.com/t/l8pLGZnJVn8

 I want to be able to access these objects when I click submit the
 form, but I'm not sure how to get access to them. This is what I have
 tried so far:


        Form moviesForm = new FormValueMap(moviesForm) {
            /**
             * Show the resulting valid new movie
             */
            @Override
            public final void onSubmit() {
                ValueMap values = getModelObject();

                // perform validation and security here
                if (StringUtils.isBlank((String) values.get(name))) {
                    error(Received bad input!!!);
                    return;
                }

                Session session =
 HibernateUtil.getSessionFactory().getCurrentSession();
                session.beginTransaction();

                Movie movie = new Movie();
                movie.setName((String) values.get(name));
                movie.setCategory((Category) values.get(category));
                session.save(movie);
                session.getTransaction().commit();
            }

        };

 The ValueMap values comes back null from getModelObject(). Any
 pointers for me to get these objects back in a way that I can easily
 update them?

 Thanks.

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



Re: form processing for multiple objects

2012-01-23 Thread Daniel Watrous
Note that I can access the objects that I populate using a
PropertyListView individually just fine.

What I am trying to do now is access them as part of a larger form so
that I can update multiple items at once. I was hoping to be able to
iterate through the items that the PropertyListView had rendered so
that I can update them one by one. That's where I'm failing. That Form
and onSubmit are defined outside of the PropertyListView.

I'm sorry if I'm not explaining this very well.

Daniel

On Mon, Jan 23, 2012 at 9:27 AM, Daniel Watrous
daniel.watr...@gmail.com wrote:
 The problem is that I can't seem to access the form submitted values
 in onSubmit().

 ValueMap values = getModelObject();

 values is null...

 Daniel

 On Mon, Jan 23, 2012 at 9:24 AM, Sven Meier s...@meiers.net wrote:
 So you're already using PropertyListView, fine.

 What's your problem once again?

 Sven


 Am 23.01.2012 17:20, schrieb Daniel Watrous:

 Let me give a little more detail. The way that markup is managed is
 through this:

         // Add movieListView of existing movies
         moviesForm.add(new PropertyListViewMovie(movies, movieList) {

             @Override
             public void populateItem(final ListItemMovie  movieItem) {
                 final RatingModel rating = new
 RatingModel(movieItem.getModelObject().getRating());
                 movieItem.add(new
 TextFieldString(name).setType(String.class));
                 movieItem.add(new DropDownChoiceCategory(category,
 Arrays.asList(Category.values()), new
 EnumChoiceRendererCategory(this)));
                 movieItem.add(new RatingPanel (rating, new
 PropertyModelInteger(rating, rating), 5, new
 PropertyModelInteger(rating, numberOfVotes), false) {
                     @Override
                     public boolean onIsStarActive(int star) {
                         return rating.isActive(star);
                     }
                     @Override
                     public void onRated(int newRating,
 AjaxRequestTarget target) {
                         movieItem.getModelObject().setRating(newRating);
                         rating.updateRating(newRating);

                         Session session =
 HibernateUtil.getSessionFactory().getCurrentSession();
                         session.beginTransaction();
                         session.update(movieItem.getModelObject());
                         session.getTransaction().commit();

                         movieList.detach();
                     }
                 });
                 movieItem.add(new Link(removeLink) {
                     @Override
                     public void onClick() {

 System.out.print(movieItem.getModelObject().getId());
                         Session session =
 HibernateUtil.getSessionFactory().getCurrentSession();
                         session.beginTransaction();
                         session.delete(movieItem.getModelObject());
                         session.getTransaction().commit();
                         movieList.detach();
                     }
                 });
             }
         }).setVersioned(false);

 I suppose that means that I'm not actually adding new items to the
 list as a form. Maybe what I need is to treat the entire component as
 a form from the beginning. I'm just not sure exactly how to do that.

 Any ideas?

 Daniel

 On Mon, Jan 23, 2012 at 9:07 AM, Daniel Watrous
 daniel.watr...@gmail.com  wrote:

 I have populated a form with values representing several different
 objects. This is what my markup looks like:


            form wicket:id = moviesForm id = moviesForm
                span wicket:id = movies id = movies
                    a wicket:id = removeLink(remove)/a
                    input type=text wicket:id=name class=nospam/
                    select wicket:id=category/
                    span wicket:id=ratingrating/span
                    br /
                /span
                input type = submit value = Update Movies
 id=formsubmit/
            /form

 The span is reproduced for each object that I pull from a database.
 There is a different identifier for each span, as you can see here:
 http://screencast.com/t/l8pLGZnJVn8

 I want to be able to access these objects when I click submit the
 form, but I'm not sure how to get access to them. This is what I have
 tried so far:


        Form moviesForm = new FormValueMap(moviesForm) {
            /**
             * Show the resulting valid new movie
             */
            @Override
            public final void onSubmit() {
                ValueMap values = getModelObject();

                // perform validation and security here
                if (StringUtils.isBlank((String) values.get(name))) {
                    error(Received bad input!!!);
                    return;
                }

                Session session =
 HibernateUtil.getSessionFactory().getCurrentSession();
                session.beginTransaction();

                Movie movie

Re: form processing for multiple objects

2012-01-23 Thread Daniel Watrous
Here's a little more code. You can see that I add the PropertyListView
to moviesForm...My listView (movieList) is a LoadableDetachableModel,
so it doesn't have the getModelObject() method. I'm still not quite
sure how to get access to the form details in onSubmit().

Form moviesForm = new FormValueMap(moviesForm) {
/**
 * Show the resulting valid new movie
 */
@Override
public final void onSubmit() {
Session session =
HibernateUtil.getSessionFactory().getCurrentSession();
session.beginTransaction();

for (Movie movie : movieList.getModelObject()) {
session.save(movie);
}
session.getTransaction().commit();
}

};

// Add movieListView of existing movies
moviesForm.add(new PropertyListViewMovie(movies, movieList) {

@Override
public void populateItem(final ListItemMovie movieItem) {
final RatingModel rating = new
RatingModel(movieItem.getModelObject().getRating());
movieItem.add(new
TextFieldString(name).setType(String.class));
movieItem.add(new DropDownChoiceCategory(category,
Arrays.asList(Category.values()), new
EnumChoiceRendererCategory(this)));
movieItem.add(new RatingPanel (rating, new
PropertyModelInteger(rating, rating), 5, new
PropertyModelInteger(rating, numberOfVotes), false) {
@Override
public boolean onIsStarActive(int star) {
return rating.isActive(star);
}
@Override
public void onRated(int newRating,
AjaxRequestTarget target) {
movieItem.getModelObject().setRating(newRating);
rating.updateRating(newRating);

Session session =
HibernateUtil.getSessionFactory().getCurrentSession();
session.beginTransaction();
session.update(movieItem.getModelObject());
session.getTransaction().commit();

movieList.detach();
}
});
movieItem.add(new Link(removeLink) {
@Override
public void onClick() {
Session session =
HibernateUtil.getSessionFactory().getCurrentSession();
session.beginTransaction();
session.delete(movieItem.getModelObject());
session.getTransaction().commit();

movieList.detach();
}
});
}
}).setVersioned(false);

add(moviesForm);





On Mon, Jan 23, 2012 at 9:33 AM, Sven Meier s...@meiers.net wrote:
 Do you have the ValueMap usage from a Wicket example (e.g. Guestbook)?
 You don't seem to have any code that wires a ValueMap into your form.

 The following should be enough:


           @Override
           public final void onSubmit() {

               Session session =
 HibernateUtil.getSessionFactory().getCurrentSession();
               session.beginTransaction();

               for (Movie movie : listView.getModelObject()) {
                   session.save(movie);
               }
               session.getTransaction().commit();
           }

 Hope this helps
 Sven


 Am 23.01.2012 17:27, schrieb Daniel Watrous:

 The problem is that I can't seem to access the form submitted values
 in onSubmit().

 ValueMap values = getModelObject();

 values is null...

 Daniel

 On Mon, Jan 23, 2012 at 9:24 AM, Sven Meiers...@meiers.net  wrote:

 So you're already using PropertyListView, fine.

 What's your problem once again?

 Sven


 Am 23.01.2012 17:20, schrieb Daniel Watrous:

 Let me give a little more detail. The way that markup is managed is
 through this:

         // Add movieListView of existing movies
         moviesForm.add(new PropertyListViewMovie(movies, movieList)
 {

             @Override
             public void populateItem(final ListItemMovie    movieItem)
 {
                 final RatingModel rating = new
 RatingModel(movieItem.getModelObject().getRating());
                 movieItem.add(new
 TextFieldString(name).setType(String.class));
                 movieItem.add(new DropDownChoiceCategory(category,
 Arrays.asList(Category.values()), new
 EnumChoiceRendererCategory(this)));
                 movieItem.add(new RatingPanel (rating, new
 PropertyModelInteger(rating, rating), 5, new
 PropertyModelInteger(rating, numberOfVotes), false) {
                     @Override
                     public boolean onIsStarActive(int star) {
                         return rating.isActive(star);
                     }
                     @Override
                     public void onRated(int newRating,
 AjaxRequestTarget target

Re: form processing for multiple objects

2012-01-23 Thread Daniel Watrous
I ended up with something similar (see also this post:
http://apache-wicket.1842946.n4.nabble.com/Add-new-items-to-a-list-within-a-form-by-ajaxlink-td2017446.html)

http://paste.pocoo.org/show/539351/

I created a class level variable that would hold my PropertyListView
which made it available to the my onSubmit() method in the form.

Thank you so much for your help.

Daniel

On Mon, Jan 23, 2012 at 10:20 AM, Sven Meier s...@meiers.net wrote:
 How about this:

  http://paste.pocoo.org/show/539346/

 Sven

 Am 23.01.2012 17:53, schrieb Daniel Watrous:

 Here's a little more code. You can see that I add the PropertyListView
 to moviesForm...My listView (movieList) is a LoadableDetachableModel,
 so it doesn't have the getModelObject() method. I'm still not quite
 sure how to get access to the form details in onSubmit().

         Form moviesForm = new FormValueMap(moviesForm) {
             /**
              * Show the resulting valid new movie
              */
             @Override
             public final void onSubmit() {
                 Session session =
 HibernateUtil.getSessionFactory().getCurrentSession();
                 session.beginTransaction();

                 for (Movie movie : movieList.getModelObject()) {
                     session.save(movie);
                 }
                 session.getTransaction().commit();
             }

         };

         // Add movieListView of existing movies
         moviesForm.add(new PropertyListViewMovie(movies, movieList) {

             @Override
             public void populateItem(final ListItemMovie  movieItem) {
                 final RatingModel rating = new
 RatingModel(movieItem.getModelObject().getRating());
                 movieItem.add(new
 TextFieldString(name).setType(String.class));
                 movieItem.add(new DropDownChoiceCategory(category,
 Arrays.asList(Category.values()), new
 EnumChoiceRendererCategory(this)));
                 movieItem.add(new RatingPanel (rating, new
 PropertyModelInteger(rating, rating), 5, new
 PropertyModelInteger(rating, numberOfVotes), false) {
                     @Override
                     public boolean onIsStarActive(int star) {
                         return rating.isActive(star);
                     }
                     @Override
                     public void onRated(int newRating,
 AjaxRequestTarget target) {
                         movieItem.getModelObject().setRating(newRating);
                         rating.updateRating(newRating);

                         Session session =
 HibernateUtil.getSessionFactory().getCurrentSession();
                         session.beginTransaction();
                         session.update(movieItem.getModelObject());
                         session.getTransaction().commit();

                         movieList.detach();
                     }
                 });
                 movieItem.add(new Link(removeLink) {
                     @Override
                     public void onClick() {
                         Session session =
 HibernateUtil.getSessionFactory().getCurrentSession();
                         session.beginTransaction();
                         session.delete(movieItem.getModelObject());
                         session.getTransaction().commit();

                         movieList.detach();
                     }
                 });
             }
         }).setVersioned(false);

         add(moviesForm);





 On Mon, Jan 23, 2012 at 9:33 AM, Sven Meiers...@meiers.net  wrote:

 Do you have the ValueMap usage from a Wicket example (e.g. Guestbook)?
 You don't seem to have any code that wires a ValueMap into your form.

 The following should be enough:


           @Override
           public final void onSubmit() {

               Session session =
 HibernateUtil.getSessionFactory().getCurrentSession();
               session.beginTransaction();

               for (Movie movie : listView.getModelObject()) {
                   session.save(movie);
               }
               session.getTransaction().commit();
           }

 Hope this helps
 Sven


 Am 23.01.2012 17:27, schrieb Daniel Watrous:

 The problem is that I can't seem to access the form submitted values
 in onSubmit().

 ValueMap values = getModelObject();

 values is null...

 Daniel

 On Mon, Jan 23, 2012 at 9:24 AM, Sven Meiers...@meiers.net    wrote:

 So you're already using PropertyListView, fine.

 What's your problem once again?

 Sven


 Am 23.01.2012 17:20, schrieb Daniel Watrous:

 Let me give a little more detail. The way that markup is managed is
 through this:

         // Add movieListView of existing movies
         moviesForm.add(new PropertyListViewMovie(movies,
 movieList)
 {

             @Override
             public void populateItem(final ListItemMovie
  movieItem)
 {
                 final RatingModel rating = new
 RatingModel(movieItem.getModelObject().getRating());
                 movieItem.add(new
 TextFieldString(name

Weekend in Wicket

2012-01-23 Thread Daniel Watrous
Hi,

I spent the weekend working on a pre-interview exercise. The outcome
was a wicket+hibernate app deployed on Amazon EC2. I'm sending it to
the list because I love finding small examples like this when I'm
trying to do something new with a technology like Wicket.

I hope it's helpful, and thanks for all your replies to my questions :)

http://software.danielwatrous.com/software-engineering/java-wicket-and-hibernate-on-ec2-pre-interview-project

Daniel

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



Can't instantiate page using constructor

2012-01-21 Thread Daniel Watrous
When I build my wicket project I'm getting the following error

Tests in error:
  homepageRendersSuccessfully(com.danielwatrous.movieratings.TestHomePage):
Can't instantiate page using constructor 'public
com.danielwatrous.movieratings.HomePage(org.apache.wicket.request.mapper.parameter.PageParameters)'
and argument ''. Might be it doesn't exist, may be it is not visible
(public).

I can't see any errors in my code. I am trying to use Hibernate and if
I comment out the hibernate code then the page compiles fine. I don't
see how the hibernate code causes an error with the class. Here's my
code.

package com.danielwatrous.movieratings;

import org.hibernate.Session;

import org.apache.wicket.request.mapper.parameter.PageParameters;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.WebPage;

import com.danielwatrous.movieratings.domain.*;
import com.danielwatrous.movieratings.util.HibernateUtil;

public class HomePage extends WebPage {
private static final long serialVersionUID = 1L;

public HomePage(final PageParameters parameters) {
add(new Label(version,
getApplication().getFrameworkSettings().getVersion()));
// TODO Add your page's components here

Session session = HibernateUtil.getSessionFactory().getCurrentSession();
session.beginTransaction();

Movie movie = new Movie();
movie.setName(Ocean's Eleven);
movie.setCategory(Category.COMEDY);
movie.setRating(Rating.FOURSTARS);
session.save(movie);

session.getTransaction().commit();
}

}

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



Re: Can't instantiate page using constructor

2012-01-21 Thread Daniel Watrous
That was the only error produced when running build. However, I tried
running the server (jetty:run) anyway and found it started and
provided a stack trace when I loaded the homepage. That helped me to
solve my problem.

I had errors outside of wicket, related to hibernate.

Thank you,
Daniel

On Sat, Jan 21, 2012 at 10:26 AM, Per Newgro per.new...@gmx.ch wrote:
 The stack trace is what?

 Am 21.01.2012 18:21, schrieb Daniel Watrous:

 When I build my wicket project I'm getting the following error

 Tests in error:

 homepageRendersSuccessfully(com.danielwatrous.movieratings.TestHomePage):
 Can't instantiate page using constructor 'public

 com.danielwatrous.movieratings.HomePage(org.apache.wicket.request.mapper.parameter.PageParameters)'
 and argument ''. Might be it doesn't exist, may be it is not visible
 (public).

 I can't see any errors in my code. I am trying to use Hibernate and if
 I comment out the hibernate code then the page compiles fine. I don't
 see how the hibernate code causes an error with the class. Here's my
 code.

 package com.danielwatrous.movieratings;

 import org.hibernate.Session;

 import org.apache.wicket.request.mapper.parameter.PageParameters;
 import org.apache.wicket.markup.html.basic.Label;
 import org.apache.wicket.markup.html.WebPage;

 import com.danielwatrous.movieratings.domain.*;
 import com.danielwatrous.movieratings.util.HibernateUtil;

 public class HomePage extends WebPage {
        private static final long serialVersionUID = 1L;

     public HomePage(final PageParameters parameters) {
                add(new Label(version,
 getApplication().getFrameworkSettings().getVersion()));
         // TODO Add your page's components here

         Session session =
 HibernateUtil.getSessionFactory().getCurrentSession();
         session.beginTransaction();

         Movie movie = new Movie();
         movie.setName(Ocean's Eleven);
         movie.setCategory(Category.COMEDY);
         movie.setRating(Rating.FOURSTARS);
         session.save(movie);

         session.getTransaction().commit();
     }

 }

 -
 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: What to add to pom.xml to use hibernate?

2012-01-21 Thread Daniel Watrous
Thank you. That link helped be get this working.

Daniel

On Sat, Jan 21, 2012 at 1:32 AM, Per Newgro per.new...@gmx.ch wrote:
 Hmm. Firstly you ask the wrong list. Hibernate is off topic.
 At second - did you do a search? With maven hibernate i
 found this link quickly:
 http://stackoverflow.com/questions/3345816/hibernate-projects-and-building-with-maven
 See the answer with the green check at the side. I think that will anser
 you question.
 You have to exhange the version numbers by 4.0.1...

 Cheers
 Per

 Am 21.01.2012 08:53, schrieb Daniel Watrous:

 I'm interested in using hibernate in my wicket application, but I
 can't find any up to date examples combining the two.

 Is there something other than hibernate that the wicket community uses for
 ORM?

 If not, what can I add to the pom.xml file to include hibernate. I
 tried adding this:

                dependency
                        groupIdorg.hibernate/groupId
                        artifactIdhibernate/artifactId
                        version4.0.1-Final/version
                /dependency

 but it doesn't work. I an error that it Could not resolve dependencies
 for project...

 I also attempted to add this alongside the other repository that is there.

         repository
             idjboss/id
             urlhttp://repository.jboss.org/maven2//url
         /repository

 I get the error about Could not resolve dependencies for project...
 but now many other jar files are not found.

 I started with the quickstart, if that helps.

 -
 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



guestbook application with database update

2012-01-21 Thread Daniel Watrous
I'm creating a small app based on the guestbook:
http://www.wicket-library.com/wicket-examples/guestbook/?1

In the guestbook app, the page view is updated every time a new
comment is added. The variable commentList is initialized at the top
like this

private static final ListComment commentList = new ArrayListComment();

// Add commentListView of existing comments
add(new PropertyListViewComment(comments, commentList)
{
@Override
public void populateItem(final ListItemComment listItem)
{
listItem.add(new Label(date));
listItem.add(new MultiLineLabel(text));
}
}).setVersioned(false);

I wanted to use a database instead, so I made the following changes

private ListMovie movieList = new ArrayListMovie();

Session session = HibernateUtil.getSessionFactory().getCurrentSession();
session.beginTransaction();
movieList = session.createQuery(from Movie).list();
session.getTransaction().commit();

// Add commentListView of existing comments
add(new PropertyListViewMovie(movies, movieList) {

@Override
public void populateItem(final ListItemMovie listItem) {
listItem.add(new
TextFieldString(name).setType(String.class));
listItem.add(new DropDownChoiceCategory(category,
Arrays.asList(Category.values()), new
EnumChoiceRendererCategory(this)));
listItem.add(new Label(rating));
}
}).setVersioned(false);

With this change, all the items in the database come up when the page
first loads, but not after each new item is added to the database. I
have to clear out the URL and load the page fresh to see what has been
added since the last fresh load.

I did try resetting movieList in the onSubmit function to load the
current database items into the variable movieList, but that still
doesn't update the list.

Any idea how to update movieList after each new item is submitted.

Daniel

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



Re: guestbook application with database update

2012-01-21 Thread Daniel Watrous
This worked GREAT! Thank you.

On Sat, Jan 21, 2012 at 2:51 PM, Sven Meier s...@meiers.net wrote:
 Use a LoadableDetachableModel to load a fresh list of movies on each
 request.

 Sven


 On 01/21/2012 10:35 PM, Daniel Watrous wrote:

 I'm creating a small app based on the guestbook:
 http://www.wicket-library.com/wicket-examples/guestbook/?1

 In the guestbook app, the page view is updated every time a new
 comment is added. The variable commentList is initialized at the top
 like this

 private static final ListComment  commentList = new
 ArrayListComment();

         // Add commentListView of existing comments
         add(new PropertyListViewComment(comments, commentList)
         {
             @Override
             public void populateItem(final ListItemComment  listItem)
             {
                 listItem.add(new Label(date));
                 listItem.add(new MultiLineLabel(text));
             }
         }).setVersioned(false);

 I wanted to use a database instead, so I made the following changes

 private ListMovie  movieList = new ArrayListMovie();

         Session session =
 HibernateUtil.getSessionFactory().getCurrentSession();
         session.beginTransaction();
         movieList = session.createQuery(from Movie).list();
         session.getTransaction().commit();

         // Add commentListView of existing comments
         add(new PropertyListViewMovie(movies, movieList) {

             @Override
             public void populateItem(final ListItemMovie  listItem) {
                 listItem.add(new
 TextFieldString(name).setType(String.class));
                 listItem.add(new DropDownChoiceCategory(category,
 Arrays.asList(Category.values()), new
 EnumChoiceRendererCategory(this)));
                 listItem.add(new Label(rating));
             }
         }).setVersioned(false);

 With this change, all the items in the database come up when the page
 first loads, but not after each new item is added to the database. I
 have to clear out the URL and load the page fresh to see what has been
 added since the last fresh load.

 I did try resetting movieList in the onSubmit function to load the
 current database items into the variable movieList, but that still
 doesn't update the list.

 Any idea how to update movieList after each new item is submitted.

 Daniel

 -
 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



AJAX Rating extension, multiple on a page

2012-01-21 Thread Daniel Watrous
Hi,

I've been working with the Rating extension found here:
http://www.wicket-library.com/wicket-examples/ajax/ratings?0

I have a case where I need to render multiple on a page, and they
render fine. Each rating panel that displays corresponds to a specific
record in a database. I would like to be able to get information from
the request to indicate which record the rating is for.

The RatingPanel as a method onRated that accepts the rating and runs
an update, like this:

@Override
public void onRated(int rating, AjaxRequestTarget target) {
HomePage.rating.addRating(rating);
}

I also noticed that the URL contains some additional information

a href=?0-4.ILinkListener-movies-0-rating-rater-element-0-link
wicket:id=link id=linkbb onclick=var
wcall=wicketAjaxGet(#039;?0-4.IBehaviorListener.0-movies-0-rating-rater-element-0-link#039;,function()
{ }.bind(this),function() { }.bind(this), function() {return
Wicket.$(#039;linkbb#039;) != null;}.bind(this));return
!wcall;img wicket:id=star
src=wicket/resource/org.apache.wicket.extensions.rating.RatingPanel/star1-ver-1326919989539.gif//a

The number between ...movies-_-rating... (where the underscore is) is
different for each group.

Is there some direct way to access information about the URL or to
modify this extension to pass the record information along with it?

Thanks,
Daniel

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



What to add to pom.xml to use hibernate?

2012-01-20 Thread Daniel Watrous
I'm interested in using hibernate in my wicket application, but I
can't find any up to date examples combining the two.

Is there something other than hibernate that the wicket community uses for ORM?

If not, what can I add to the pom.xml file to include hibernate. I
tried adding this:

dependency
groupIdorg.hibernate/groupId
artifactIdhibernate/artifactId
version4.0.1-Final/version
/dependency

but it doesn't work. I an error that it Could not resolve dependencies
for project...

I also attempted to add this alongside the other repository that is there.

repository
idjboss/id
urlhttp://repository.jboss.org/maven2//url
/repository

I get the error about Could not resolve dependencies for project...
but now many other jar files are not found.

I started with the quickstart, if that helps.

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



does the breadcrumb extension support bookmarkable links?

2012-01-18 Thread Daniel Watrous
I've been working with the breadcrumb components in the extensions
library today. Now that I have it working the way I need it to, I
noticed that none of the links are bookmarkable. I wondered if it were
possible to use this feature and still have links be bookmarkable?

I did some searching and found only a handful of references to
creating bookmarkable pages instead of panels, but before I went too
far down that road I wanted to ask if it's possible and straight
forward.

Thanks,
Daniel

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



Re: Wicket on Google App Engine

2012-01-06 Thread Daniel Watrous
Rahman,

From the error that you show in your link it appears that your
application can't find the WicketFilter class.

Are you sure that you copied the three wicket jar files (core, util,
request) to your WEB-INF/lib folder?

Daniel

On Fri, Jan 6, 2012 at 7:28 AM, Rahman USTA rahman.usta...@gmail.com wrote:
 i did Daniel's way, but when run the application,
 http://chopapp.com/#1gyxqdm6

 2012/1/6 Hielke Hoeve hielke.ho...@topicus.nl

 Hey Daniel,

 Glad to hear you got it working as well. I have some apps on google app
 engine  as well. Tried all the tutorials and 'useful' maven plugins but all
 just didn't do the trick for me.  I now use maven's resources plugin to
 copy the resources from the maven repository to the war/lib folder. Which
 allows me to update/add dependencies in the pom.xml, run maven and add the
 dependencies in eclipse manually.

 I have not found a maven plugin which just adds the google sdk as
 dependency for me so I don't have to mess around in eclipse everytime I run
 maven. Did you solve that?

 Hielke

 -Original Message-
 From: Daniel Watrous [mailto:daniel.watr...@gmail.com]
 Sent: donderdag 5 januari 2012 19:35
 To: users@wicket.apache.org
 Subject: Re: Wicket on Google App Engine

 Thanks for all your help. I've just posted the steps required to get
 current versions of wicket and gae to work together.


 http://software.danielwatrous.com/software-engineering/wordpress-plugin-licensing-wicket-on-google-app-engine

 Daniel

 On Thu, Jan 5, 2012 at 12:46 AM, Ernesto Reinaldo Barreiro 
 ernesto.reina...@jweekend.com wrote:
  I think the class to use is
 
  http://code.google.com/p/kickat26/source/browse/trunk/src/de/kickat26/
  ui/wicket/GAEModificationWatcher.java
 
 
 
  On Thu, Jan 5, 2012 at 8:31 AM, Ernesto Reinaldo Barreiro 
  ernesto.reina...@jweekend.com wrote:
 
  You could use a modified version of resource watcher that does not
  use threads and modify request cycle so that watcher is executed
  before each request cycle. I remember there was some blog somewhere
  explaining this technique... Maybe it was this...
 
 
  http://stronglytypedblog.blogspot.com/2009/07/wicket-spring-jdo-on-go
  ogle-app-engine.html
 
 
 
  On Wed, Jan 4, 2012 at 11:18 PM, Daniel Watrous 
 daniel.watr...@gmail.comwrote:
 
  I tried putting in this:
  getResourceSettings().setResourcePollFrequency(Duration.ONE_SECOND);
 
  But the resource still doesn't update without restarting the google
  app engine environment. I just tried it by running Start and that no
  longer updates automatically either.
 
  In the process of trying to make it work with GAE, I changed the
  pom.xml to have these lines in the build section
             directorysrc/main/webapp/WEB-INF/directory
 
   outputDirectorysrc/main/webapp/WEB-INF/classes/outputDirectory
 
  That means files are no longer placed in the target directory, but
  in the WEB-INF folder. Could this affect it? Have I missed another
  setting somewhere that relates to changing where the compiled
  classes are placed?
 
  Daniel
 
  On Wed, Jan 4, 2012 at 3:01 PM, Sven Meier s...@meiers.net wrote:
   Read here:
  
      https://cwiki.apache.org/WICKET/faqs.html#FAQs-Deployment
  
   The relevant setting is:
      getResourceSettings().setResourcePollFrequency(duration);
  
   Sven
  
  
   On 01/04/2012 10:31 PM, Daniel Watrous wrote:
  
   Great. I now have it working with either the jar download or the
   dependency in the pom.xml file. In the dependency xml snippet I
   didn't realize that I needed to manually provide the version, but
   after I did then it worked fine.
  
   Whenever I update a class and save it in Eclipse, that class is
   updated in the running server and I don't have to restart to see
   the changes. This is great.
  
   However, when I change an HTML page, it's not updated in the
   running server, so I have to restart everything. I know that when
   I run a quickstart app directly (using the Start class) that
   updates to the HTML are updated without requiring a restart.
  
   Do you know how to make it so the HTML files are updated in the
   live server?
  
   Thanks so much.
  
   Daniel
  
   On Wed, Jan 4, 2012 at 1:38 PM, Sven Meiers...@meiers.net  wrote:
  
   With maven it's very easy, just add the dependency to your pom
   as suggested and forget about it.
  
   Alternatively you can download the jar form maven central
   manually and add it to your project:
  
  
  
  
  http://repo2.maven.org/maven2/org/wicketstuff/wicketstuff-gae-initia
  lizer/
  
   Hope this helps
   Sven
  
  
   On 01/04/2012 09:28 PM, Daniel Watrous wrote:
  
   I'm still not sure how to create the jar file. No one is
   commenting
  on
   it so I feel a bit silly. Should it be obvious?
  
   Am I supposed to include the source with my project or a jar.
   If a jar, how should I build the jar?
  
   On Wed, Jan 4, 2012 at 1:11 PM, Sven Meiers...@meiers.net
   wrote:
  
   Hi,
  
   make sure you have compatible versions for Wicket

Re: Wicket on Google App Engine

2012-01-06 Thread Daniel Watrous
Hielke,

I'm not very sophisticated when it comes to Maven. I think what I go
through in my tutorial is more of a brute force update of my eclipse
environment so that it works with the quickstart project on GAE. I'll
have a look at the resources approach you mentioned. That might
simplify setup of future projects.

Daniel

On Fri, Jan 6, 2012 at 3:39 AM, Hielke Hoeve hielke.ho...@topicus.nl wrote:
 Hey Daniel,

 Glad to hear you got it working as well. I have some apps on google app 
 engine  as well. Tried all the tutorials and 'useful' maven plugins but all 
 just didn't do the trick for me.  I now use maven's resources plugin to copy 
 the resources from the maven repository to the war/lib folder. Which allows 
 me to update/add dependencies in the pom.xml, run maven and add the 
 dependencies in eclipse manually.

 I have not found a maven plugin which just adds the google sdk as dependency 
 for me so I don't have to mess around in eclipse everytime I run maven. Did 
 you solve that?

 Hielke

 -Original Message-
 From: Daniel Watrous [mailto:daniel.watr...@gmail.com]
 Sent: donderdag 5 januari 2012 19:35
 To: users@wicket.apache.org
 Subject: Re: Wicket on Google App Engine

 Thanks for all your help. I've just posted the steps required to get current 
 versions of wicket and gae to work together.

 http://software.danielwatrous.com/software-engineering/wordpress-plugin-licensing-wicket-on-google-app-engine

 Daniel

 On Thu, Jan 5, 2012 at 12:46 AM, Ernesto Reinaldo Barreiro 
 ernesto.reina...@jweekend.com wrote:
 I think the class to use is

 http://code.google.com/p/kickat26/source/browse/trunk/src/de/kickat26/
 ui/wicket/GAEModificationWatcher.java



 On Thu, Jan 5, 2012 at 8:31 AM, Ernesto Reinaldo Barreiro 
 ernesto.reina...@jweekend.com wrote:

 You could use a modified version of resource watcher that does not
 use threads and modify request cycle so that watcher is executed
 before each request cycle. I remember there was some blog somewhere
 explaining this technique... Maybe it was this...


 http://stronglytypedblog.blogspot.com/2009/07/wicket-spring-jdo-on-go
 ogle-app-engine.html



 On Wed, Jan 4, 2012 at 11:18 PM, Daniel Watrous 
 daniel.watr...@gmail.comwrote:

 I tried putting in this:
 getResourceSettings().setResourcePollFrequency(Duration.ONE_SECOND);

 But the resource still doesn't update without restarting the google
 app engine environment. I just tried it by running Start and that no
 longer updates automatically either.

 In the process of trying to make it work with GAE, I changed the
 pom.xml to have these lines in the build section
            directorysrc/main/webapp/WEB-INF/directory

  outputDirectorysrc/main/webapp/WEB-INF/classes/outputDirectory

 That means files are no longer placed in the target directory, but
 in the WEB-INF folder. Could this affect it? Have I missed another
 setting somewhere that relates to changing where the compiled
 classes are placed?

 Daniel

 On Wed, Jan 4, 2012 at 3:01 PM, Sven Meier s...@meiers.net wrote:
  Read here:
 
     https://cwiki.apache.org/WICKET/faqs.html#FAQs-Deployment
 
  The relevant setting is:
     getResourceSettings().setResourcePollFrequency(duration);
 
  Sven
 
 
  On 01/04/2012 10:31 PM, Daniel Watrous wrote:
 
  Great. I now have it working with either the jar download or the
  dependency in the pom.xml file. In the dependency xml snippet I
  didn't realize that I needed to manually provide the version, but
  after I did then it worked fine.
 
  Whenever I update a class and save it in Eclipse, that class is
  updated in the running server and I don't have to restart to see
  the changes. This is great.
 
  However, when I change an HTML page, it's not updated in the
  running server, so I have to restart everything. I know that when
  I run a quickstart app directly (using the Start class) that
  updates to the HTML are updated without requiring a restart.
 
  Do you know how to make it so the HTML files are updated in the
  live server?
 
  Thanks so much.
 
  Daniel
 
  On Wed, Jan 4, 2012 at 1:38 PM, Sven Meiers...@meiers.net  wrote:
 
  With maven it's very easy, just add the dependency to your pom
  as suggested and forget about it.
 
  Alternatively you can download the jar form maven central
  manually and add it to your project:
 
 
 
 
 http://repo2.maven.org/maven2/org/wicketstuff/wicketstuff-gae-initia
 lizer/
 
  Hope this helps
  Sven
 
 
  On 01/04/2012 09:28 PM, Daniel Watrous wrote:
 
  I'm still not sure how to create the jar file. No one is
  commenting
 on
  it so I feel a bit silly. Should it be obvious?
 
  Am I supposed to include the source with my project or a jar.
  If a jar, how should I build the jar?
 
  On Wed, Jan 4, 2012 at 1:11 PM, Sven Meiers...@meiers.net
  wrote:
 
  Hi,
 
  make sure you have compatible versions for Wicket and
 gae-initializer,
  i.e.
  they should be the same.
 
  Sven
 
 
 
  On 01/04/2012 08:49 PM, Daniel Watrous wrote:
 
  I'm slowly making

Re: Wicket on Google App Engine

2012-01-06 Thread Daniel Watrous
This time I think you didn't include the gae-initializer jar in your
WEB-INF/lib directory.

On Fri, Jan 6, 2012 at 8:50 AM, Rahman USTA rahman.usta...@gmail.com wrote:
 i handled them, but now server is giving me internal error,
 http://chopapp.com/#8lc105ni

 2012/1/6 Daniel Watrous daniel.watr...@gmail.com

 Rahman,

 From the error that you show in your link it appears that your
 application can't find the WicketFilter class.

 Are you sure that you copied the three wicket jar files (core, util,
 request) to your WEB-INF/lib folder?

 Daniel

 On Fri, Jan 6, 2012 at 7:28 AM, Rahman USTA rahman.usta...@gmail.com
 wrote:
  i did Daniel's way, but when run the application,
  http://chopapp.com/#1gyxqdm6
 
  2012/1/6 Hielke Hoeve hielke.ho...@topicus.nl
 
  Hey Daniel,
 
  Glad to hear you got it working as well. I have some apps on google app
  engine  as well. Tried all the tutorials and 'useful' maven plugins but
 all
  just didn't do the trick for me.  I now use maven's resources plugin to
  copy the resources from the maven repository to the war/lib folder.
 Which
  allows me to update/add dependencies in the pom.xml, run maven and add
 the
  dependencies in eclipse manually.
 
  I have not found a maven plugin which just adds the google sdk as
  dependency for me so I don't have to mess around in eclipse everytime I
 run
  maven. Did you solve that?
 
  Hielke
 
  -Original Message-
  From: Daniel Watrous [mailto:daniel.watr...@gmail.com]
  Sent: donderdag 5 januari 2012 19:35
  To: users@wicket.apache.org
  Subject: Re: Wicket on Google App Engine
 
  Thanks for all your help. I've just posted the steps required to get
  current versions of wicket and gae to work together.
 
 
 
 http://software.danielwatrous.com/software-engineering/wordpress-plugin-licensing-wicket-on-google-app-engine
 
  Daniel
 
  On Thu, Jan 5, 2012 at 12:46 AM, Ernesto Reinaldo Barreiro 
  ernesto.reina...@jweekend.com wrote:
   I think the class to use is
  
  
 http://code.google.com/p/kickat26/source/browse/trunk/src/de/kickat26/
   ui/wicket/GAEModificationWatcher.java
  
  
  
   On Thu, Jan 5, 2012 at 8:31 AM, Ernesto Reinaldo Barreiro 
   ernesto.reina...@jweekend.com wrote:
  
   You could use a modified version of resource watcher that does not
   use threads and modify request cycle so that watcher is executed
   before each request cycle. I remember there was some blog somewhere
   explaining this technique... Maybe it was this...
  
  
  
 http://stronglytypedblog.blogspot.com/2009/07/wicket-spring-jdo-on-go
   ogle-app-engine.html
  
  
  
   On Wed, Jan 4, 2012 at 11:18 PM, Daniel Watrous 
  daniel.watr...@gmail.comwrote:
  
   I tried putting in this:
   getResourceSettings().setResourcePollFrequency(Duration.ONE_SECOND);
  
   But the resource still doesn't update without restarting the google
   app engine environment. I just tried it by running Start and that no
   longer updates automatically either.
  
   In the process of trying to make it work with GAE, I changed the
   pom.xml to have these lines in the build section
              directorysrc/main/webapp/WEB-INF/directory
  
    outputDirectorysrc/main/webapp/WEB-INF/classes/outputDirectory
  
   That means files are no longer placed in the target directory, but
   in the WEB-INF folder. Could this affect it? Have I missed another
   setting somewhere that relates to changing where the compiled
   classes are placed?
  
   Daniel
  
   On Wed, Jan 4, 2012 at 3:01 PM, Sven Meier s...@meiers.net wrote:
Read here:
   
   https://cwiki.apache.org/WICKET/faqs.html#FAQs-Deployment
   
The relevant setting is:
   getResourceSettings().setResourcePollFrequency(duration);
   
Sven
   
   
On 01/04/2012 10:31 PM, Daniel Watrous wrote:
   
Great. I now have it working with either the jar download or the
dependency in the pom.xml file. In the dependency xml snippet I
didn't realize that I needed to manually provide the version, but
after I did then it worked fine.
   
Whenever I update a class and save it in Eclipse, that class is
updated in the running server and I don't have to restart to see
the changes. This is great.
   
However, when I change an HTML page, it's not updated in the
running server, so I have to restart everything. I know that when
I run a quickstart app directly (using the Start class) that
updates to the HTML are updated without requiring a restart.
   
Do you know how to make it so the HTML files are updated in the
live server?
   
Thanks so much.
   
Daniel
   
On Wed, Jan 4, 2012 at 1:38 PM, Sven Meiers...@meiers.net
  wrote:
   
With maven it's very easy, just add the dependency to your pom
as suggested and forget about it.
   
Alternatively you can download the jar form maven central
manually and add it to your project:
   
   
   
   
  
 http://repo2.maven.org/maven2/org/wicketstuff/wicketstuff-gae-initia
   lizer

Re: Wicket on Google App Engine

2012-01-06 Thread Daniel Watrous
You might be clever enough to do it in maven. I wasn't, so I added the
jar files like I show in my tutorial.

On Fri, Jan 6, 2012 at 8:55 AM, Rahman USTA rahman.usta...@gmail.com wrote:
 i did it in pom.xml, why must i add jars to lib manually? cant i do it with
 maven?

 2012/1/6 Daniel Watrous daniel.watr...@gmail.com

 This time I think you didn't include the gae-initializer jar in your
 WEB-INF/lib directory.

 On Fri, Jan 6, 2012 at 8:50 AM, Rahman USTA rahman.usta...@gmail.com
 wrote:
  i handled them, but now server is giving me internal error,
  http://chopapp.com/#8lc105ni
 
  2012/1/6 Daniel Watrous daniel.watr...@gmail.com
 
  Rahman,
 
  From the error that you show in your link it appears that your
  application can't find the WicketFilter class.
 
  Are you sure that you copied the three wicket jar files (core, util,
  request) to your WEB-INF/lib folder?
 
  Daniel
 
  On Fri, Jan 6, 2012 at 7:28 AM, Rahman USTA rahman.usta...@gmail.com
  wrote:
   i did Daniel's way, but when run the application,
   http://chopapp.com/#1gyxqdm6
  
   2012/1/6 Hielke Hoeve hielke.ho...@topicus.nl
  
   Hey Daniel,
  
   Glad to hear you got it working as well. I have some apps on google
 app
   engine  as well. Tried all the tutorials and 'useful' maven plugins
 but
  all
   just didn't do the trick for me.  I now use maven's resources plugin
 to
   copy the resources from the maven repository to the war/lib folder.
  Which
   allows me to update/add dependencies in the pom.xml, run maven and
 add
  the
   dependencies in eclipse manually.
  
   I have not found a maven plugin which just adds the google sdk as
   dependency for me so I don't have to mess around in eclipse
 everytime I
  run
   maven. Did you solve that?
  
   Hielke
  
   -Original Message-
   From: Daniel Watrous [mailto:daniel.watr...@gmail.com]
   Sent: donderdag 5 januari 2012 19:35
   To: users@wicket.apache.org
   Subject: Re: Wicket on Google App Engine
  
   Thanks for all your help. I've just posted the steps required to get
   current versions of wicket and gae to work together.
  
  
  
 
 http://software.danielwatrous.com/software-engineering/wordpress-plugin-licensing-wicket-on-google-app-engine
  
   Daniel
  
   On Thu, Jan 5, 2012 at 12:46 AM, Ernesto Reinaldo Barreiro 
   ernesto.reina...@jweekend.com wrote:
I think the class to use is
   
   
  http://code.google.com/p/kickat26/source/browse/trunk/src/de/kickat26/
ui/wicket/GAEModificationWatcher.java
   
   
   
On Thu, Jan 5, 2012 at 8:31 AM, Ernesto Reinaldo Barreiro 
ernesto.reina...@jweekend.com wrote:
   
You could use a modified version of resource watcher that does not
use threads and modify request cycle so that watcher is executed
before each request cycle. I remember there was some blog
 somewhere
explaining this technique... Maybe it was this...
   
   
   
  http://stronglytypedblog.blogspot.com/2009/07/wicket-spring-jdo-on-go
ogle-app-engine.html
   
   
   
On Wed, Jan 4, 2012 at 11:18 PM, Daniel Watrous 
   daniel.watr...@gmail.comwrote:
   
I tried putting in this:
   
 getResourceSettings().setResourcePollFrequency(Duration.ONE_SECOND);
   
But the resource still doesn't update without restarting the
 google
app engine environment. I just tried it by running Start and
 that no
longer updates automatically either.
   
In the process of trying to make it work with GAE, I changed the
pom.xml to have these lines in the build section
           directorysrc/main/webapp/WEB-INF/directory
   
   
  outputDirectorysrc/main/webapp/WEB-INF/classes/outputDirectory
   
That means files are no longer placed in the target directory,
 but
in the WEB-INF folder. Could this affect it? Have I missed
 another
setting somewhere that relates to changing where the compiled
classes are placed?
   
Daniel
   
On Wed, Jan 4, 2012 at 3:01 PM, Sven Meier s...@meiers.net
 wrote:
 Read here:

    https://cwiki.apache.org/WICKET/faqs.html#FAQs-Deployment

 The relevant setting is:
    getResourceSettings().setResourcePollFrequency(duration);

 Sven


 On 01/04/2012 10:31 PM, Daniel Watrous wrote:

 Great. I now have it working with either the jar download or
 the
 dependency in the pom.xml file. In the dependency xml snippet
 I
 didn't realize that I needed to manually provide the version,
 but
 after I did then it worked fine.

 Whenever I update a class and save it in Eclipse, that class
 is
 updated in the running server and I don't have to restart to
 see
 the changes. This is great.

 However, when I change an HTML page, it's not updated in the
 running server, so I have to restart everything. I know that
 when
 I run a quickstart app directly (using the Start class) that
 updates to the HTML are updated without requiring a restart.

 Do you know how to make it so the HTML

Re: Wicket on Google App Engine

2012-01-06 Thread Daniel Watrous
Rahman,

Are you following my tutorial or are you trying to adapt it to work
some other way.

I have to admit that I'm not very savvy when it comes to Maven and I
like the eclipse environment well enough. The Eclipse + GAE plugin
makes development easy.

Maybe I should be embarrassed to say that it took me three days to
finally get wicket going on GAE and the result of that is the tutorial
I put together. If you have something in mind other than what I
documented then I'm not going to be much help.

Daniel

On Fri, Jan 6, 2012 at 9:00 AM, Rahman USTA rahman.usta...@gmail.com wrote:
 Now, http://chopapp.com/#7pmdaqmd

 2012/1/6 Rahman USTA rahman.usta...@gmail.com

 i did it in pom.xml, why must i add jars to lib manually? cant i do it
 with maven?


 2012/1/6 Daniel Watrous daniel.watr...@gmail.com

 This time I think you didn't include the gae-initializer jar in your
 WEB-INF/lib directory.

 On Fri, Jan 6, 2012 at 8:50 AM, Rahman USTA rahman.usta...@gmail.com
 wrote:
  i handled them, but now server is giving me internal error,
  http://chopapp.com/#8lc105ni
 
  2012/1/6 Daniel Watrous daniel.watr...@gmail.com
 
  Rahman,
 
  From the error that you show in your link it appears that your
  application can't find the WicketFilter class.
 
  Are you sure that you copied the three wicket jar files (core, util,
  request) to your WEB-INF/lib folder?
 
  Daniel
 
  On Fri, Jan 6, 2012 at 7:28 AM, Rahman USTA rahman.usta...@gmail.com
  wrote:
   i did Daniel's way, but when run the application,
   http://chopapp.com/#1gyxqdm6
  
   2012/1/6 Hielke Hoeve hielke.ho...@topicus.nl
  
   Hey Daniel,
  
   Glad to hear you got it working as well. I have some apps on google
 app
   engine  as well. Tried all the tutorials and 'useful' maven plugins
 but
  all
   just didn't do the trick for me.  I now use maven's resources
 plugin to
   copy the resources from the maven repository to the war/lib folder.
  Which
   allows me to update/add dependencies in the pom.xml, run maven and
 add
  the
   dependencies in eclipse manually.
  
   I have not found a maven plugin which just adds the google sdk as
   dependency for me so I don't have to mess around in eclipse
 everytime I
  run
   maven. Did you solve that?
  
   Hielke
  
   -Original Message-
   From: Daniel Watrous [mailto:daniel.watr...@gmail.com]
   Sent: donderdag 5 januari 2012 19:35
   To: users@wicket.apache.org
   Subject: Re: Wicket on Google App Engine
  
   Thanks for all your help. I've just posted the steps required to get
   current versions of wicket and gae to work together.
  
  
  
 
 http://software.danielwatrous.com/software-engineering/wordpress-plugin-licensing-wicket-on-google-app-engine
  
   Daniel
  
   On Thu, Jan 5, 2012 at 12:46 AM, Ernesto Reinaldo Barreiro 
   ernesto.reina...@jweekend.com wrote:
I think the class to use is
   
   
  http://code.google.com/p/kickat26/source/browse/trunk/src/de/kickat26/
ui/wicket/GAEModificationWatcher.java
   
   
   
On Thu, Jan 5, 2012 at 8:31 AM, Ernesto Reinaldo Barreiro 
ernesto.reina...@jweekend.com wrote:
   
You could use a modified version of resource watcher that does
 not
use threads and modify request cycle so that watcher is executed
before each request cycle. I remember there was some blog
 somewhere
explaining this technique... Maybe it was this...
   
   
   
  http://stronglytypedblog.blogspot.com/2009/07/wicket-spring-jdo-on-go
ogle-app-engine.html
   
   
   
On Wed, Jan 4, 2012 at 11:18 PM, Daniel Watrous 
   daniel.watr...@gmail.comwrote:
   
I tried putting in this:
   
 getResourceSettings().setResourcePollFrequency(Duration.ONE_SECOND);
   
But the resource still doesn't update without restarting the
 google
app engine environment. I just tried it by running Start and
 that no
longer updates automatically either.
   
In the process of trying to make it work with GAE, I changed the
pom.xml to have these lines in the build section
           directorysrc/main/webapp/WEB-INF/directory
   
   
  outputDirectorysrc/main/webapp/WEB-INF/classes/outputDirectory
   
That means files are no longer placed in the target directory,
 but
in the WEB-INF folder. Could this affect it? Have I missed
 another
setting somewhere that relates to changing where the compiled
classes are placed?
   
Daniel
   
On Wed, Jan 4, 2012 at 3:01 PM, Sven Meier s...@meiers.net
 wrote:
 Read here:

    https://cwiki.apache.org/WICKET/faqs.html#FAQs-Deployment

 The relevant setting is:
    getResourceSettings().setResourcePollFrequency(duration);

 Sven


 On 01/04/2012 10:31 PM, Daniel Watrous wrote:

 Great. I now have it working with either the jar download or
 the
 dependency in the pom.xml file. In the dependency xml
 snippet I
 didn't realize that I needed to manually provide the
 version, but
 after I did then it worked fine

Re: Wicket on Google App Engine

2012-01-05 Thread Daniel Watrous
Thanks for all your help. I've just posted the steps required to get
current versions of wicket and gae to work together.

http://software.danielwatrous.com/software-engineering/wordpress-plugin-licensing-wicket-on-google-app-engine

Daniel

On Thu, Jan 5, 2012 at 12:46 AM, Ernesto Reinaldo Barreiro
ernesto.reina...@jweekend.com wrote:
 I think the class to use is

 http://code.google.com/p/kickat26/source/browse/trunk/src/de/kickat26/ui/wicket/GAEModificationWatcher.java



 On Thu, Jan 5, 2012 at 8:31 AM, Ernesto Reinaldo Barreiro 
 ernesto.reina...@jweekend.com wrote:

 You could use a modified version of resource watcher that does not use
 threads and modify request cycle so that watcher is executed before each
 request cycle. I remember there was some blog somewhere explaining this
 technique... Maybe it was this...


 http://stronglytypedblog.blogspot.com/2009/07/wicket-spring-jdo-on-google-app-engine.html



 On Wed, Jan 4, 2012 at 11:18 PM, Daniel Watrous 
 daniel.watr...@gmail.comwrote:

 I tried putting in this:
 getResourceSettings().setResourcePollFrequency(Duration.ONE_SECOND);

 But the resource still doesn't update without restarting the google
 app engine environment. I just tried it by running Start and that no
 longer updates automatically either.

 In the process of trying to make it work with GAE, I changed the
 pom.xml to have these lines in the build section
            directorysrc/main/webapp/WEB-INF/directory

  outputDirectorysrc/main/webapp/WEB-INF/classes/outputDirectory

 That means files are no longer placed in the target directory, but in
 the WEB-INF folder. Could this affect it? Have I missed another
 setting somewhere that relates to changing where the compiled classes
 are placed?

 Daniel

 On Wed, Jan 4, 2012 at 3:01 PM, Sven Meier s...@meiers.net wrote:
  Read here:
 
     https://cwiki.apache.org/WICKET/faqs.html#FAQs-Deployment
 
  The relevant setting is:
     getResourceSettings().setResourcePollFrequency(duration);
 
  Sven
 
 
  On 01/04/2012 10:31 PM, Daniel Watrous wrote:
 
  Great. I now have it working with either the jar download or the
  dependency in the pom.xml file. In the dependency xml snippet I didn't
  realize that I needed to manually provide the version, but after I did
  then it worked fine.
 
  Whenever I update a class and save it in Eclipse, that class is
  updated in the running server and I don't have to restart to see the
  changes. This is great.
 
  However, when I change an HTML page, it's not updated in the running
  server, so I have to restart everything. I know that when I run a
  quickstart app directly (using the Start class) that updates to the
  HTML are updated without requiring a restart.
 
  Do you know how to make it so the HTML files are updated in the live
  server?
 
  Thanks so much.
 
  Daniel
 
  On Wed, Jan 4, 2012 at 1:38 PM, Sven Meiers...@meiers.net  wrote:
 
  With maven it's very easy, just add the dependency to your pom as
  suggested
  and forget about it.
 
  Alternatively you can download the jar form maven central manually and
  add
  it to your project:
 
 
 
 
 http://repo2.maven.org/maven2/org/wicketstuff/wicketstuff-gae-initializer/
 
  Hope this helps
  Sven
 
 
  On 01/04/2012 09:28 PM, Daniel Watrous wrote:
 
  I'm still not sure how to create the jar file. No one is commenting
 on
  it so I feel a bit silly. Should it be obvious?
 
  Am I supposed to include the source with my project or a jar. If a
  jar, how should I build the jar?
 
  On Wed, Jan 4, 2012 at 1:11 PM, Sven Meiers...@meiers.net
  wrote:
 
  Hi,
 
  make sure you have compatible versions for Wicket and
 gae-initializer,
  i.e.
  they should be the same.
 
  Sven
 
 
 
  On 01/04/2012 08:49 PM, Daniel Watrous wrote:
 
  I'm slowly making progress.
 
  I see now that what Sven replied with goes in the pom.xml.
 
  What I'm not sure of is if I still need a jar file or the source as
  part of my project. I have made the update to my pom.xml, and I'm
 now
  getting this error when I attempt to run my application:
 
  java.lang.NoClassDefFoundError:
  org/apache/wicket/pageStore/memory/IDataStoreEvictionStrategy
         at java.lang.Class.getDeclaredConstructors0(Native Method)
         at java.lang.Class.privateGetDeclaredConstructors(Unknown
  Source)
         at java.lang.Class.getConstructor0(Unknown Source)
         at java.lang.Class.getDeclaredConstructor(Unknown Source)
         at
 
 
 
 com.google.appengine.tools.development.agent.runtime.Runtime$2.run(Runtime.java:133)
         at
 
 
 
 com.google.appengine.tools.development.agent.runtime.Runtime$2.run(Runtime.java:131)
         at java.security.AccessController.doPrivileged(Native
 Method)
         at
 
 
 
 com.google.appengine.tools.development.agent.runtime.Runtime.newInstance(Runtime.java:130)
         at
 
 
 
 org.apache.wicket.util.lang.WicketObjects.newInstance(WicketObjects.java:377)
         at
  org.apache.wicket.Application.addInitializer(Application.java:577

Re: Wicket on Google App Engine

2012-01-04 Thread Daniel Watrous
How do I create the gae-initializer.jar?

I have run mvn compile and generated the class files. I can zip those
up, but I'm not sure if there should be a META-INF folder and what it
should have.

Daniel

On Wed, Jan 4, 2012 at 12:21 AM, Martin Grigorov mgrigo...@apache.org wrote:
 Hi,

 gae-initializer project provides
 https://github.com/wicketstuff/core/blob/master/jdk-1.6-parent/gae-initializer-parent/gae-initializer/src/main/java/org/wicketstuff/gae/GaeInitializer.java
 which is an implementation of org.apache.wicket.IInitializer and declares it 
 in
 https://github.com/wicketstuff/core/blob/master/jdk-1.6-parent/gae-initializer-parent/gae-initializer/src/main/resources/wicket.properties.
 That means that when gae-initializer.jar is in the classpath Wicket
 will use it to initialize the Application instance.
 Check the source of GaeInitializer.jar to see what exactly it configures.

 On Wed, Jan 4, 2012 at 1:52 AM, Daniel Watrous daniel.watr...@gmail.com 
 wrote:
 Hi,

 I've been working for a few days to get a wicket application going for
 Google App Engine with mixed results. I hope these questions aren't
 too noobie for this list?

 There are a couple of really old articles which Google brings up first:
 http://stronglytypedblog.blogspot.com/2009/04/wicket-on-google-app-engine.html
 http://www.danwalmsley.com/2009/04/08/apache-wicket-on-google-app-engine-for-java/

 I've also found this resource after digging through the wicket users
 list, but I can't figure out how I'm supposed to use it:
 https://github.com/wicketstuff/core/tree/master/jdk-1.6-parent/gae-initializer-parent

 I'm using eclipse with the GAE plugin.

 So far this is what I have accomplished.
 1) the first link above provides a download demo as an eclipse
 project. I can get this to run, but it's working with old versions
 (wicket 1.3.5, appengine sdk 1.2.0). I haven't successfully updated.
 2) I can create a new google app engine project in eclipse. It runs
 fine and I can develop servlets.
 3) I can user the maven build script from the quickstart to get a
 functional wicket project.

 I'm really struggling trying to figure out how to use the
 gae-initializer or a base GAE project from eclipse and end up with a
 functional wicket application...

 I'm not sure what other information to include at this point. Please
 share any pointers or links to other tutorials that might help me.

 Daniel

 -
 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


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



Re: Wicket on Google App Engine

2012-01-04 Thread Daniel Watrous
Also, where do I put the wicket.properties file, and do I need to
update any xml files to indicate that there is a wicket.properties
file

On Wed, Jan 4, 2012 at 11:30 AM, Daniel Watrous
daniel.watr...@gmail.com wrote:
 How do I create the gae-initializer.jar?

 I have run mvn compile and generated the class files. I can zip those
 up, but I'm not sure if there should be a META-INF folder and what it
 should have.

 Daniel

 On Wed, Jan 4, 2012 at 12:21 AM, Martin Grigorov mgrigo...@apache.org wrote:
 Hi,

 gae-initializer project provides
 https://github.com/wicketstuff/core/blob/master/jdk-1.6-parent/gae-initializer-parent/gae-initializer/src/main/java/org/wicketstuff/gae/GaeInitializer.java
 which is an implementation of org.apache.wicket.IInitializer and declares it 
 in
 https://github.com/wicketstuff/core/blob/master/jdk-1.6-parent/gae-initializer-parent/gae-initializer/src/main/resources/wicket.properties.
 That means that when gae-initializer.jar is in the classpath Wicket
 will use it to initialize the Application instance.
 Check the source of GaeInitializer.jar to see what exactly it configures.

 On Wed, Jan 4, 2012 at 1:52 AM, Daniel Watrous daniel.watr...@gmail.com 
 wrote:
 Hi,

 I've been working for a few days to get a wicket application going for
 Google App Engine with mixed results. I hope these questions aren't
 too noobie for this list?

 There are a couple of really old articles which Google brings up first:
 http://stronglytypedblog.blogspot.com/2009/04/wicket-on-google-app-engine.html
 http://www.danwalmsley.com/2009/04/08/apache-wicket-on-google-app-engine-for-java/

 I've also found this resource after digging through the wicket users
 list, but I can't figure out how I'm supposed to use it:
 https://github.com/wicketstuff/core/tree/master/jdk-1.6-parent/gae-initializer-parent

 I'm using eclipse with the GAE plugin.

 So far this is what I have accomplished.
 1) the first link above provides a download demo as an eclipse
 project. I can get this to run, but it's working with old versions
 (wicket 1.3.5, appengine sdk 1.2.0). I haven't successfully updated.
 2) I can create a new google app engine project in eclipse. It runs
 fine and I can develop servlets.
 3) I can user the maven build script from the quickstart to get a
 functional wicket project.

 I'm really struggling trying to figure out how to use the
 gae-initializer or a base GAE project from eclipse and end up with a
 functional wicket application...

 I'm not sure what other information to include at this point. Please
 share any pointers or links to other tutorials that might help me.

 Daniel

 -
 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


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



Re: Wicket on Google App Engine

2012-01-04 Thread Daniel Watrous
Is that the same thing as adding the jar file to the build path in eclipse?

How do I build gae-initializer.jar? I tried running 'mvn jar', but it
gave an error about unknown lifecycle phase.

Daniel

On Wed, Jan 4, 2012 at 11:38 AM, Sven Meier s...@meiers.net wrote:
 Hi Daniel,

 you just have to add the gae-initializer as a dependency to your project:

 dependency
 groupIdorg.wicketstuff/groupId
 artifactIdwicketstuff-gae-initializer/artifactId
 version${wicket.version}/version
 /dependency

 That's all.
 Sven


 On 01/04/2012 07:35 PM, Daniel Watrous wrote:

 Also, where do I put the wicket.properties file, and do I need to
 update any xml files to indicate that there is a wicket.properties
 file

 On Wed, Jan 4, 2012 at 11:30 AM, Daniel Watrous
 daniel.watr...@gmail.com  wrote:

 How do I create the gae-initializer.jar?

 I have run mvn compile and generated the class files. I can zip those
 up, but I'm not sure if there should be a META-INF folder and what it
 should have.

 Daniel

 On Wed, Jan 4, 2012 at 12:21 AM, Martin Grigorovmgrigo...@apache.org
  wrote:

 Hi,

 gae-initializer project provides

 https://github.com/wicketstuff/core/blob/master/jdk-1.6-parent/gae-initializer-parent/gae-initializer/src/main/java/org/wicketstuff/gae/GaeInitializer.java
 which is an implementation of org.apache.wicket.IInitializer and
 declares it in

 https://github.com/wicketstuff/core/blob/master/jdk-1.6-parent/gae-initializer-parent/gae-initializer/src/main/resources/wicket.properties.
 That means that when gae-initializer.jar is in the classpath Wicket
 will use it to initialize the Application instance.
 Check the source of GaeInitializer.jar to see what exactly it
 configures.

 On Wed, Jan 4, 2012 at 1:52 AM, Daniel Watrousdaniel.watr...@gmail.com
  wrote:

 Hi,

 I've been working for a few days to get a wicket application going for
 Google App Engine with mixed results. I hope these questions aren't
 too noobie for this list?

 There are a couple of really old articles which Google brings up first:

 http://stronglytypedblog.blogspot.com/2009/04/wicket-on-google-app-engine.html

 http://www.danwalmsley.com/2009/04/08/apache-wicket-on-google-app-engine-for-java/

 I've also found this resource after digging through the wicket users
 list, but I can't figure out how I'm supposed to use it:

 https://github.com/wicketstuff/core/tree/master/jdk-1.6-parent/gae-initializer-parent

 I'm using eclipse with the GAE plugin.

 So far this is what I have accomplished.
 1) the first link above provides a download demo as an eclipse
 project. I can get this to run, but it's working with old versions
 (wicket 1.3.5, appengine sdk 1.2.0). I haven't successfully updated.
 2) I can create a new google app engine project in eclipse. It runs
 fine and I can develop servlets.
 3) I can user the maven build script from the quickstart to get a
 functional wicket project.

 I'm really struggling trying to figure out how to use the
 gae-initializer or a base GAE project from eclipse and end up with a
 functional wicket application...

 I'm not sure what other information to include at this point. Please
 share any pointers or links to other tutorials that might help me.

 Daniel

 -
 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

 -
 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: Wicket on Google App Engine

2012-01-04 Thread Daniel Watrous
I'm slowly making progress.

I see now that what Sven replied with goes in the pom.xml.

What I'm not sure of is if I still need a jar file or the source as
part of my project. I have made the update to my pom.xml, and I'm now
getting this error when I attempt to run my application:

java.lang.NoClassDefFoundError:
org/apache/wicket/pageStore/memory/IDataStoreEvictionStrategy
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
at java.lang.Class.getConstructor0(Unknown Source)
at java.lang.Class.getDeclaredConstructor(Unknown Source)
at 
com.google.appengine.tools.development.agent.runtime.Runtime$2.run(Runtime.java:133)
at 
com.google.appengine.tools.development.agent.runtime.Runtime$2.run(Runtime.java:131)
at java.security.AccessController.doPrivileged(Native Method)
at 
com.google.appengine.tools.development.agent.runtime.Runtime.newInstance(Runtime.java:130)
at 
org.apache.wicket.util.lang.WicketObjects.newInstance(WicketObjects.java:377)
at org.apache.wicket.Application.addInitializer(Application.java:577)
at org.apache.wicket.Application.load(Application.java:615)
at 
org.apache.wicket.Application.initializeComponents(Application.java:501)
at org.apache.wicket.Application.initApplication(Application.java:808)
at 
org.apache.wicket.protocol.http.WicketFilter.init(WicketFilter.java:346)
at 
org.apache.wicket.protocol.http.WicketFilter.init(WicketFilter.java:286)
at org.mortbay.jetty.servlet.FilterHolder.doStart(FilterHolder.java:97)
at 
org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
at 
org.mortbay.jetty.servlet.ServletHandler.initialize(ServletHandler.java:662)
at org.mortbay.jetty.servlet.Context.startContext(Context.java:140)
at 
org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1250)
at 
org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:517)
at 
org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:467)
at 
org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
at 
org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130)
at 
org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
at 
org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130)
at org.mortbay.jetty.Server.doStart(Server.java:224)
at 
org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
at 
com.google.appengine.tools.development.JettyContainerService.startContainer(JettyContainerService.java:191)
at 
com.google.appengine.tools.development.AbstractContainerService.startup(AbstractContainerService.java:239)
at 
com.google.appengine.tools.development.DevAppServerImpl.start(DevAppServerImpl.java:146)
at 
com.google.appengine.tools.development.DevAppServerMain$StartAction.apply(DevAppServerMain.java:164)
at 
com.google.appengine.tools.util.Parser$ParseResult.applyArgs(Parser.java:48)
at 
com.google.appengine.tools.development.DevAppServerMain.init(DevAppServerMain.java:113)
at 
com.google.appengine.tools.development.DevAppServerMain.main(DevAppServerMain.java:89)
Caused by: java.lang.ClassNotFoundException:
org.apache.wicket.pageStore.memory.IDataStoreEvictionStrategy
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at 
com.google.appengine.tools.development.IsolatedAppClassLoader.loadClass(IsolatedAppClassLoader.java:176)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 35 more

Since gae-initializer did compile when I compiled with maven I also
tried simply putting the compile classes next to my other classes for
the deployment, but it still gives this error.

Thanks for all your help.

Daniel

On Wed, Jan 4, 2012 at 11:45 AM, Daniel Watrous
daniel.watr...@gmail.com wrote:
 Is that the same thing as adding the jar file to the build path in eclipse?

 How do I build gae-initializer.jar? I tried running 'mvn jar', but it
 gave an error about unknown lifecycle phase.

 Daniel

 On Wed, Jan 4, 2012 at 11:38 AM, Sven Meier s...@meiers.net wrote:
 Hi Daniel,

 you just have to add the gae-initializer as a dependency to your project:

 dependency
 groupIdorg.wicketstuff/groupId
 artifactIdwicketstuff-gae-initializer/artifactId
 version${wicket.version}/version
 /dependency

 That's all.
 Sven


 On 01/04/2012 07:35 PM, Daniel Watrous wrote:

 Also, where do I put the wicket.properties file, and do I need to
 update any xml files to indicate that there is a wicket.properties
 file

 On Wed, Jan 4, 2012 at 11:30 AM

Re: Wicket on Google App Engine

2012-01-04 Thread Daniel Watrous
I'm still not sure how to create the jar file. No one is commenting on
it so I feel a bit silly. Should it be obvious?

Am I supposed to include the source with my project or a jar. If a
jar, how should I build the jar?

On Wed, Jan 4, 2012 at 1:11 PM, Sven Meier s...@meiers.net wrote:
 Hi,

 make sure you have compatible versions for Wicket and gae-initializer, i.e.
 they should be the same.

 Sven



 On 01/04/2012 08:49 PM, Daniel Watrous wrote:

 I'm slowly making progress.

 I see now that what Sven replied with goes in the pom.xml.

 What I'm not sure of is if I still need a jar file or the source as
 part of my project. I have made the update to my pom.xml, and I'm now
 getting this error when I attempt to run my application:

 java.lang.NoClassDefFoundError:
 org/apache/wicket/pageStore/memory/IDataStoreEvictionStrategy
        at java.lang.Class.getDeclaredConstructors0(Native Method)
        at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
        at java.lang.Class.getConstructor0(Unknown Source)
        at java.lang.Class.getDeclaredConstructor(Unknown Source)
        at
 com.google.appengine.tools.development.agent.runtime.Runtime$2.run(Runtime.java:133)
        at
 com.google.appengine.tools.development.agent.runtime.Runtime$2.run(Runtime.java:131)
        at java.security.AccessController.doPrivileged(Native Method)
        at
 com.google.appengine.tools.development.agent.runtime.Runtime.newInstance(Runtime.java:130)
        at
 org.apache.wicket.util.lang.WicketObjects.newInstance(WicketObjects.java:377)
        at
 org.apache.wicket.Application.addInitializer(Application.java:577)
        at org.apache.wicket.Application.load(Application.java:615)
        at
 org.apache.wicket.Application.initializeComponents(Application.java:501)
        at
 org.apache.wicket.Application.initApplication(Application.java:808)
        at
 org.apache.wicket.protocol.http.WicketFilter.init(WicketFilter.java:346)
        at
 org.apache.wicket.protocol.http.WicketFilter.init(WicketFilter.java:286)
        at
 org.mortbay.jetty.servlet.FilterHolder.doStart(FilterHolder.java:97)
        at
 org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
        at
 org.mortbay.jetty.servlet.ServletHandler.initialize(ServletHandler.java:662)
        at org.mortbay.jetty.servlet.Context.startContext(Context.java:140)
        at
 org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1250)
        at
 org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:517)
        at
 org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:467)
        at
 org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
        at
 org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130)
        at
 org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
        at
 org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130)
        at org.mortbay.jetty.Server.doStart(Server.java:224)
        at
 org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
        at
 com.google.appengine.tools.development.JettyContainerService.startContainer(JettyContainerService.java:191)
        at
 com.google.appengine.tools.development.AbstractContainerService.startup(AbstractContainerService.java:239)
        at
 com.google.appengine.tools.development.DevAppServerImpl.start(DevAppServerImpl.java:146)
        at
 com.google.appengine.tools.development.DevAppServerMain$StartAction.apply(DevAppServerMain.java:164)
        at
 com.google.appengine.tools.util.Parser$ParseResult.applyArgs(Parser.java:48)
        at
 com.google.appengine.tools.development.DevAppServerMain.init(DevAppServerMain.java:113)
        at
 com.google.appengine.tools.development.DevAppServerMain.main(DevAppServerMain.java:89)
 Caused by: java.lang.ClassNotFoundException:
 org.apache.wicket.pageStore.memory.IDataStoreEvictionStrategy
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at
 com.google.appengine.tools.development.IsolatedAppClassLoader.loadClass(IsolatedAppClassLoader.java:176)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        ... 35 more

 Since gae-initializer did compile when I compiled with maven I also
 tried simply putting the compile classes next to my other classes for
 the deployment, but it still gives this error.

 Thanks for all your help.

 Daniel

 On Wed, Jan 4, 2012 at 11:45 AM, Daniel Watrous
 daniel.watr...@gmail.com  wrote:

 Is that the same thing as adding the jar file to the build path in
 eclipse?

 How do I build gae-initializer.jar? I tried running 'mvn jar', but it
 gave an error about unknown lifecycle phase.

 Daniel

 On Wed, Jan 4, 2012 at 11:38 AM, Sven Meiers...@meiers.net  wrote

Re: Wicket on Google App Engine

2012-01-04 Thread Daniel Watrous
Great. I now have it working with either the jar download or the
dependency in the pom.xml file. In the dependency xml snippet I didn't
realize that I needed to manually provide the version, but after I did
then it worked fine.

Whenever I update a class and save it in Eclipse, that class is
updated in the running server and I don't have to restart to see the
changes. This is great.

However, when I change an HTML page, it's not updated in the running
server, so I have to restart everything. I know that when I run a
quickstart app directly (using the Start class) that updates to the
HTML are updated without requiring a restart.

Do you know how to make it so the HTML files are updated in the live server?

Thanks so much.

Daniel

On Wed, Jan 4, 2012 at 1:38 PM, Sven Meier s...@meiers.net wrote:
 With maven it's very easy, just add the dependency to your pom as suggested
 and forget about it.

 Alternatively you can download the jar form maven central manually and add
 it to your project:


  http://repo2.maven.org/maven2/org/wicketstuff/wicketstuff-gae-initializer/

 Hope this helps
 Sven


 On 01/04/2012 09:28 PM, Daniel Watrous wrote:

 I'm still not sure how to create the jar file. No one is commenting on
 it so I feel a bit silly. Should it be obvious?

 Am I supposed to include the source with my project or a jar. If a
 jar, how should I build the jar?

 On Wed, Jan 4, 2012 at 1:11 PM, Sven Meiers...@meiers.net  wrote:

 Hi,

 make sure you have compatible versions for Wicket and gae-initializer,
 i.e.
 they should be the same.

 Sven



 On 01/04/2012 08:49 PM, Daniel Watrous wrote:

 I'm slowly making progress.

 I see now that what Sven replied with goes in the pom.xml.

 What I'm not sure of is if I still need a jar file or the source as
 part of my project. I have made the update to my pom.xml, and I'm now
 getting this error when I attempt to run my application:

 java.lang.NoClassDefFoundError:
 org/apache/wicket/pageStore/memory/IDataStoreEvictionStrategy
        at java.lang.Class.getDeclaredConstructors0(Native Method)
        at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
        at java.lang.Class.getConstructor0(Unknown Source)
        at java.lang.Class.getDeclaredConstructor(Unknown Source)
        at

 com.google.appengine.tools.development.agent.runtime.Runtime$2.run(Runtime.java:133)
        at

 com.google.appengine.tools.development.agent.runtime.Runtime$2.run(Runtime.java:131)
        at java.security.AccessController.doPrivileged(Native Method)
        at

 com.google.appengine.tools.development.agent.runtime.Runtime.newInstance(Runtime.java:130)
        at

 org.apache.wicket.util.lang.WicketObjects.newInstance(WicketObjects.java:377)
        at
 org.apache.wicket.Application.addInitializer(Application.java:577)
        at org.apache.wicket.Application.load(Application.java:615)
        at
 org.apache.wicket.Application.initializeComponents(Application.java:501)
        at
 org.apache.wicket.Application.initApplication(Application.java:808)
        at
 org.apache.wicket.protocol.http.WicketFilter.init(WicketFilter.java:346)
        at
 org.apache.wicket.protocol.http.WicketFilter.init(WicketFilter.java:286)
        at
 org.mortbay.jetty.servlet.FilterHolder.doStart(FilterHolder.java:97)
        at
 org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
        at

 org.mortbay.jetty.servlet.ServletHandler.initialize(ServletHandler.java:662)
        at
 org.mortbay.jetty.servlet.Context.startContext(Context.java:140)
        at

 org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1250)
        at

 org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:517)
        at
 org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:467)
        at
 org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
        at

 org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130)
        at
 org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
        at

 org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130)
        at org.mortbay.jetty.Server.doStart(Server.java:224)
        at
 org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
        at

 com.google.appengine.tools.development.JettyContainerService.startContainer(JettyContainerService.java:191)
        at

 com.google.appengine.tools.development.AbstractContainerService.startup(AbstractContainerService.java:239)
        at

 com.google.appengine.tools.development.DevAppServerImpl.start(DevAppServerImpl.java:146)
        at

 com.google.appengine.tools.development.DevAppServerMain$StartAction.apply(DevAppServerMain.java:164)
        at

 com.google.appengine.tools.util.Parser$ParseResult.applyArgs(Parser.java:48)
        at

 com.google.appengine.tools.development.DevAppServerMain.init(DevAppServerMain.java:113

Re: Wicket on Google App Engine

2012-01-04 Thread Daniel Watrous
I tried putting in this:
getResourceSettings().setResourcePollFrequency(Duration.ONE_SECOND);

But the resource still doesn't update without restarting the google
app engine environment. I just tried it by running Start and that no
longer updates automatically either.

In the process of trying to make it work with GAE, I changed the
pom.xml to have these lines in the build section
directorysrc/main/webapp/WEB-INF/directory
outputDirectorysrc/main/webapp/WEB-INF/classes/outputDirectory

That means files are no longer placed in the target directory, but in
the WEB-INF folder. Could this affect it? Have I missed another
setting somewhere that relates to changing where the compiled classes
are placed?

Daniel

On Wed, Jan 4, 2012 at 3:01 PM, Sven Meier s...@meiers.net wrote:
 Read here:

    https://cwiki.apache.org/WICKET/faqs.html#FAQs-Deployment

 The relevant setting is:
    getResourceSettings().setResourcePollFrequency(duration);

 Sven


 On 01/04/2012 10:31 PM, Daniel Watrous wrote:

 Great. I now have it working with either the jar download or the
 dependency in the pom.xml file. In the dependency xml snippet I didn't
 realize that I needed to manually provide the version, but after I did
 then it worked fine.

 Whenever I update a class and save it in Eclipse, that class is
 updated in the running server and I don't have to restart to see the
 changes. This is great.

 However, when I change an HTML page, it's not updated in the running
 server, so I have to restart everything. I know that when I run a
 quickstart app directly (using the Start class) that updates to the
 HTML are updated without requiring a restart.

 Do you know how to make it so the HTML files are updated in the live
 server?

 Thanks so much.

 Daniel

 On Wed, Jan 4, 2012 at 1:38 PM, Sven Meiers...@meiers.net  wrote:

 With maven it's very easy, just add the dependency to your pom as
 suggested
 and forget about it.

 Alternatively you can download the jar form maven central manually and
 add
 it to your project:



  http://repo2.maven.org/maven2/org/wicketstuff/wicketstuff-gae-initializer/

 Hope this helps
 Sven


 On 01/04/2012 09:28 PM, Daniel Watrous wrote:

 I'm still not sure how to create the jar file. No one is commenting on
 it so I feel a bit silly. Should it be obvious?

 Am I supposed to include the source with my project or a jar. If a
 jar, how should I build the jar?

 On Wed, Jan 4, 2012 at 1:11 PM, Sven Meiers...@meiers.net    wrote:

 Hi,

 make sure you have compatible versions for Wicket and gae-initializer,
 i.e.
 they should be the same.

 Sven



 On 01/04/2012 08:49 PM, Daniel Watrous wrote:

 I'm slowly making progress.

 I see now that what Sven replied with goes in the pom.xml.

 What I'm not sure of is if I still need a jar file or the source as
 part of my project. I have made the update to my pom.xml, and I'm now
 getting this error when I attempt to run my application:

 java.lang.NoClassDefFoundError:
 org/apache/wicket/pageStore/memory/IDataStoreEvictionStrategy
        at java.lang.Class.getDeclaredConstructors0(Native Method)
        at java.lang.Class.privateGetDeclaredConstructors(Unknown
 Source)
        at java.lang.Class.getConstructor0(Unknown Source)
        at java.lang.Class.getDeclaredConstructor(Unknown Source)
        at


 com.google.appengine.tools.development.agent.runtime.Runtime$2.run(Runtime.java:133)
        at


 com.google.appengine.tools.development.agent.runtime.Runtime$2.run(Runtime.java:131)
        at java.security.AccessController.doPrivileged(Native Method)
        at


 com.google.appengine.tools.development.agent.runtime.Runtime.newInstance(Runtime.java:130)
        at


 org.apache.wicket.util.lang.WicketObjects.newInstance(WicketObjects.java:377)
        at
 org.apache.wicket.Application.addInitializer(Application.java:577)
        at org.apache.wicket.Application.load(Application.java:615)
        at

 org.apache.wicket.Application.initializeComponents(Application.java:501)
        at
 org.apache.wicket.Application.initApplication(Application.java:808)
        at

 org.apache.wicket.protocol.http.WicketFilter.init(WicketFilter.java:346)
        at

 org.apache.wicket.protocol.http.WicketFilter.init(WicketFilter.java:286)
        at
 org.mortbay.jetty.servlet.FilterHolder.doStart(FilterHolder.java:97)
        at

 org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
        at


 org.mortbay.jetty.servlet.ServletHandler.initialize(ServletHandler.java:662)
        at
 org.mortbay.jetty.servlet.Context.startContext(Context.java:140)
        at


 org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1250)
        at


 org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:517)
        at
 org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:467)
        at

 org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50

Handling POST, PUT and DELETE from a resource

2012-01-04 Thread Daniel Watrous
I'm building a web service and I wonder if there's some way to detect
and do something unique when calling a ResourceReference with
different HTTP methods.

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



Re: Handling POST, PUT and DELETE from a resource

2012-01-04 Thread Daniel Watrous
That's a fantastic answer. I'll look at other solutions.

Daniel

On Wed, Jan 4, 2012 at 7:03 PM, 7zark7 7za...@gmail.com wrote:
 I know these sort of replies are annoying, but I don't think Wicket is a good 
 choice for handling web service calls - it's pretty easy to map other paths 
 to servlets or other handlers that better deal with PUT, DELETE, etc.

 --
 Anh My
 Sent with Sparrow (http://www.sparrowmailapp.com/?sig)


 On Wednesday, January 4, 2012 at 3:49 PM, Daniel Watrous wrote:

 I'm building a web service and I wonder if there's some way to detect
 and do something unique when calling a ResourceReference with
 different HTTP methods.

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





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



Wicket on Google App Engine

2012-01-03 Thread Daniel Watrous
Hi,

I've been working for a few days to get a wicket application going for
Google App Engine with mixed results. I hope these questions aren't
too noobie for this list?

There are a couple of really old articles which Google brings up first:
http://stronglytypedblog.blogspot.com/2009/04/wicket-on-google-app-engine.html
http://www.danwalmsley.com/2009/04/08/apache-wicket-on-google-app-engine-for-java/

I've also found this resource after digging through the wicket users
list, but I can't figure out how I'm supposed to use it:
https://github.com/wicketstuff/core/tree/master/jdk-1.6-parent/gae-initializer-parent

I'm using eclipse with the GAE plugin.

So far this is what I have accomplished.
1) the first link above provides a download demo as an eclipse
project. I can get this to run, but it's working with old versions
(wicket 1.3.5, appengine sdk 1.2.0). I haven't successfully updated.
2) I can create a new google app engine project in eclipse. It runs
fine and I can develop servlets.
3) I can user the maven build script from the quickstart to get a
functional wicket project.

I'm really struggling trying to figure out how to use the
gae-initializer or a base GAE project from eclipse and end up with a
functional wicket application...

I'm not sure what other information to include at this point. Please
share any pointers or links to other tutorials that might help me.

Daniel

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



RE: best way to accommodate dynamic properties

2011-12-05 Thread Daniel Watrous
I'm still trying to figure this out. I would like to be able to do something 
like the following:

HTML:
img wicket:id=testimage

JAVA:
public class ImageTestPage extends WebPage{
public ImageTestPage() {
Image myImg = new Image(testimage);
myImg.setUrlForImageSrc(http://path/to/image.gif;);
myImg.setWidth(200);
myImg.setHeight(100);
add(myImg);
}
}

Obviously the Image class doesn't work that way... Can someone tell me how I 
would accomplish this so that I can define the image, height and width 
independent from the markup?

Daniel

-Original Message-
From: Daniel Watrous [mailto:daniel.watr...@bodybuilding.com] 
Sent: Friday, December 02, 2011 5:20 PM
To: users@wicket.apache.org
Subject: best way to accommodate dynamic properties

I'm interested in having pulling the width and height for an img from a 
database, but I'm not sure what the best way is to create a component and 
corresponding HTML mapping.

Please send an example or link to previous response if possible. I've searched 
the users list archives but didn't find what I was looking for.

Thanks.

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