Apache Wicket 1.5.4 is released

2012-01-23 Thread Martin Grigorov
This is the fourth maintenance release of the Wicket 1.5.x series. This
release brings over 60 bug fixes and improvements.

Git tag:
release/wicket-1.5.4

Changelog:
https://issues.apache.org/jira/secure/ReleaseNote.jspa?projectId=12310561&version=12319051

Maven:

   org.apache.wicket
   wicket-core
   1.5.4



Download the full distribution (including source):
http://www.apache.org/dyn/closer.cgi/wicket/1.5.4

The Wicket team

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



Re: Apache Wicket 1.5.4 is released

2012-01-23 Thread Per Newgro

Shouldn't it be announce to the other list?

Cheers
Per

Am 23.01.2012 09:41, schrieb Martin Grigorov:

This is the fourth maintenance release of the Wicket 1.5.x series. This
release brings over 60 bug fixes and improvements.

Git tag:
release/wicket-1.5.4

Changelog:
https://issues.apache.org/jira/secure/ReleaseNote.jspa?projectId=12310561&version=12319051

Maven:

org.apache.wicket
wicket-core
1.5.4



Download the full distribution (including source):
http://www.apache.org/dyn/closer.cgi/wicket/1.5.4

The Wicket team

-
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: Apache Wicket 1.5.4 is released

2012-01-23 Thread Per Newgro
Oops sorry. My fault. Mail filter is filtering dev before users list. So 
it's only seen in dev folder.

Sorry.
Per

Am 23.01.2012 10:51, schrieb Per Newgro:

Shouldn't it be announce to the other list?

Cheers
Per

Am 23.01.2012 09:41, schrieb Martin Grigorov:

This is the fourth maintenance release of the Wicket 1.5.x series. This
release brings over 60 bug fixes and improvements.

Git tag:
release/wicket-1.5.4

Changelog:
https://issues.apache.org/jira/secure/ReleaseNote.jspa?projectId=12310561&version=12319051 



Maven:

org.apache.wicket
wicket-core
1.5.4



Download the full distribution (including source):
http://www.apache.org/dyn/closer.cgi/wicket/1.5.4

The Wicket team

-
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 1.5.3 RequestCycleListener redirection migration problem

2012-01-23 Thread Martin Grigorov
Hi,

On Fri, Jan 20, 2012 at 6:15 PM, Schnick  wrote:
> Hello all,
>
> I am trying to migrate to wicket 1.5.3 but am having problems. I would like
> to redirect users to a particular wicket page at any given time in their
> visit. I have overridden RequestCycleListener's onBeginRequest method so
> that it sets the request cycles response page like so
>  cycle.setResponsePage(TermsAndConditionsInputPage.class);
> and
>  scheduleRequestHandlerAfterCurrent(new RenderPageRequestHandler(new
> PageProvider(TermsAndConditionsInputPage.class))) ;
>
> but get the following error and the desired page to redirect to is not
> loaded.
>  java.lang.IllegalStateException: Header was already written to response!
>
> The following code redirects to the page I want but also generates a warning
> ... java.lang.IllegalStateException: Committed
>
> WebResponse webResponse = (WebResponse]) cycle.getResponse();
> webResponse.sendRedirect("terms-and-conditions"));
>
> I would appreciate any help and thoughts on how to solve this problem. I
> haven't found any posts of people redirecting from RequestCycleListener
> onBeginRequest method. Is their a better approach?
>
> P.S in wicket 1.4.19 the code to redirect was
> setRedirect(true);
> setResponsePage(TermsAndConditionsInputPage.class)

In 1.5.x you need just the second line.

Why do you want to do that in onBeginRequest() ? Do it where you did it in 1.4.x

>
>
>
>
>
>
> --
> View this message in context: 
> http://apache-wicket.1842946.n4.nabble.com/wicket-1-5-3-RequestCycleListener-redirection-migration-problem-tp4313664p4313664.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
>



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



Re: find object causing issue with serializing

2012-01-23 Thread Martin Grigorov
Try with 1.5.4. There is a a fixed bug in it and now SerializerChecker
will report which field exactly causes the trouble.

On Fri, Jan 20, 2012 at 10:12 PM, fachhoch  wrote:
> I am getting this error
>
>
>
> I enabled    org.apache.wicket debug , I dont see what object  is causing
> issues with serializing ,  the logs does not say that , It says could not
> serilize the page but my page has lot of objects ,  please advice  me how to
> find the object causing this issue.
>
>
> --
> View this message in context: 
> http://apache-wicket.1842946.n4.nabble.com/find-object-causing-issue-with-serializing-tp4314367p4314367.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
>



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



Re: Execute Javascript after components of a certain type render

2012-01-23 Thread Andrea Del Bene
Why not make an abstract MyPanel and provide an implementation of 
renderHead method (from IHeaderContributor)?

I mean something like:

public abstract class MyPanel extends Panel{

public void renderHead(Component component, IHeaderResponse response)
{
response.renderOnLoadJavaScript("<...your JavaScript...>");
}
}



Hello,

What is the best way to execute some Javascript code when components
of type IMyPanel render?

I was hoping that I could use
Application#addPostComponentOnBeforeRenderListener(..) and add a
listener that would add a behavior to each component of IMyPanel type.
The behavior would then execute append some Javascript in
onComponentTag() method. However, I can't seem to find the right type
of behavior to attach or maybe I should use a different
Application#addXXXListener(..) method.

Please help.

Thanks,

Alec

-
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



replace with tag

2012-01-23 Thread cosmindumy
Hello,
Due to Internet Explorer issues, I have to change all  with  
Everything was fine until I had to change a component whose value was put
using ResourceModel.
The java component is a customized AjaxButtom. 
When I instatiate the component like  submit = new SubmitButton("submit",
new ResourceModel("my.key")); there is no text on my button.
If I inspect the element "a" has a attribute value with the text.
How can I solve this?
Thanks.

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/replace-input-type-button-with-tag-a-tp4320997p4320997.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Re: replace with tag

2012-01-23 Thread Martin Grigorov
You need SubmitLink instead.
I.e. TEXT instead of 

On Mon, Jan 23, 2012 at 5:26 PM, cosmindumy  wrote:
> Hello,
> Due to Internet Explorer issues, I have to change all  type = "button"> with
> Everything was fine until I had to change a component whose value was put
> using ResourceModel.
> The java component is a customized AjaxButtom.
> When I instatiate the component like  submit = new SubmitButton("submit",
> new ResourceModel("my.key")); there is no text on my button.
> If I inspect the element "a" has a attribute value with the text.
> How can I solve this?
> Thanks.
>
> --
> View this message in context: 
> http://apache-wicket.1842946.n4.nabble.com/replace-input-type-button-with-tag-a-tp4320997p4320997.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
>



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



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 PropertyListView("movies", movieList) {

@Override
public void populateItem(final ListItem movieItem) {
final RatingModel rating = new
RatingModel(movieItem.getModelObject().getRating());
movieItem.add(new
TextField("name").setType(String.class));
movieItem.add(new DropDownChoice("category",
Arrays.asList(Category.values()), new
EnumChoiceRenderer(this)));
movieItem.add(new RatingPanel ("rating", new
PropertyModel(rating, "rating"), 5, new
PropertyModel(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  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



Re: Execute Javascript after components of a certain type render

2012-01-23 Thread Alec Swan
That's a a good idea but unfortunately my panels extend disjoint class
hierarchies and I can only group them using interfaces.

Any thoughts on how I can use Application listeners to accomplish this?

Thanks,

Alec

On Mon, Jan 23, 2012 at 3:41 AM, Andrea Del Bene  wrote:
> Why not make an abstract MyPanel and provide an implementation of renderHead
> method (from IHeaderContributor)?
> I mean something like:
>
> public abstract class MyPanel extends Panel{
>
>    public void renderHead(Component component, IHeaderResponse response)
>        {
>                response.renderOnLoadJavaScript("<...your JavaScript...>");
>        }
> }
>
>
>> Hello,
>>
>> What is the best way to execute some Javascript code when components
>> of type IMyPanel render?
>>
>> I was hoping that I could use
>> Application#addPostComponentOnBeforeRenderListener(..) and add a
>> listener that would add a behavior to each component of IMyPanel type.
>> The behavior would then execute append some Javascript in
>> onComponentTag() method. However, I can't seem to find the right type
>> of behavior to attach or maybe I should use a different
>> Application#addXXXListener(..) method.
>>
>> Please help.
>>
>> Thanks,
>>
>> Alec
>>
>> -
>> 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



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:




(remove)


rating





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 Form("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: replace with tag

2012-01-23 Thread cosmindumy
Hi,
SubmitLink doesn't know ajax, nor AjaxCallDecorator. And AjaxSubmitLink
doesn't has a model. How can I dinamically change the text in
AjaxSubmitLink? 

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/replace-input-type-button-with-tag-a-tp4320997p4321148.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Re: replace with tag

2012-01-23 Thread Martin Grigorov
org.apache.wicket.markup.html.link.AbstractLink#setBody()

On Mon, Jan 23, 2012 at 6:14 PM, cosmindumy  wrote:
> Hi,
> SubmitLink doesn't know ajax, nor AjaxCallDecorator. And AjaxSubmitLink
> doesn't has a model. How can I dinamically change the text in
> AjaxSubmitLink?
>
> --
> View this message in context: 
> http://apache-wicket.1842946.n4.nabble.com/replace-input-type-button-with-tag-a-tp4320997p4321148.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
>



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



Re: form processing for multiple objects

2012-01-23 Thread Sven Meier
You should let Wicket set the entered values directly into your Movie 
objects:


add(new PropertyListView("movies", moviesModel) {
  protected abstract void populateItem(ListItem item) {
item.add(new TextField("name"));
item.add(new DropDownChoice("category", categoriesModel));

...
  }
};

In #onSubmit() you'll just have to save the movies in the db.

Sven

Am 23.01.2012 17:07, schrieb Daniel Watrous:

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


 
 
 (remove)
 
 
 rating
 
 
 
 

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 Form("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




-
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 PropertyListView("movies", movieList) {

@Override
public void populateItem(final ListItem movieItem) {
final RatingModel rating = new
RatingModel(movieItem.getModelObject().getRating());
movieItem.add(new
TextField("name").setType(String.class));
movieItem.add(new DropDownChoice("category",
Arrays.asList(Category.values()), new
EnumChoiceRenderer(this)));
movieItem.add(new RatingPanel ("rating", new
PropertyModel(rating, "rating"), 5, new
PropertyModel(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
 wrote:
> I have populated a form with values representing several different
> objects. This is what my markup looks like:
>
>
>            
>                
>                    (remove)
>                    
>                    
>                    rating
>                    
>                
>                 id="formsubmit"/>
>            
>
> 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 Form("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 Sven Meier

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 PropertyListView("movies", movieList) {

 @Override
 public void populateItem(final ListItem  movieItem) {
 final RatingModel rating = new
RatingModel(movieItem.getModelObject().getRating());
 movieItem.add(new
TextField("name").setType(String.class));
 movieItem.add(new DropDownChoice("category",
Arrays.asList(Category.values()), new
EnumChoiceRenderer(this)));
 movieItem.add(new RatingPanel ("rating", new
PropertyModel(rating, "rating"), 5, new
PropertyModel(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
  wrote:

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




(remove)


rating





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 Form("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




-
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
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  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 PropertyListView("movies", movieList) {
>>
>>             @Override
>>             public void populateItem(final ListItem  movieItem) {
>>                 final RatingModel rating = new
>> RatingModel(movieItem.getModelObject().getRating());
>>                 movieItem.add(new
>> TextField("name").setType(String.class));
>>                 movieItem.add(new DropDownChoice("category",
>> Arrays.asList(Category.values()), new
>> EnumChoiceRenderer(this)));
>>                 movieItem.add(new RatingPanel ("rating", new
>> PropertyModel(rating, "rating"), 5, new
>> PropertyModel(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
>>   wrote:
>>>
>>> I have populated a form with values representing several different
>>> objects. This is what my markup looks like:
>>>
>>>
>>>            
>>>                
>>>                    (remove)
>>>                    
>>>                    
>>>                    rating
>>>                    
>>>                
>>>                >> id="formsubmit"/>
>>>            
>>>
>>> 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 Form("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-

Re: form processing for multiple objects

2012-01-23 Thread Sven Meier

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 Meier  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 PropertyListView("movies", movieList) {

 @Override
 public void populateItem(final ListItemmovieItem) {
 final RatingModel rating = new
RatingModel(movieItem.getModelObject().getRating());
 movieItem.add(new
TextField("name").setType(String.class));
 movieItem.add(new DropDownChoice("category",
Arrays.asList(Category.values()), new
EnumChoiceRenderer(this)));
 movieItem.add(new RatingPanel ("rating", new
PropertyModel(rating, "rating"), 5, new
PropertyModel(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
wrote:

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




(remove)


rating





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 Form("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
pointer

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
 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  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 PropertyListView("movies", movieList) {
>>>
>>>             @Override
>>>             public void populateItem(final ListItem  movieItem) {
>>>                 final RatingModel rating = new
>>> RatingModel(movieItem.getModelObject().getRating());
>>>                 movieItem.add(new
>>> TextField("name").setType(String.class));
>>>                 movieItem.add(new DropDownChoice("category",
>>> Arrays.asList(Category.values()), new
>>> EnumChoiceRenderer(this)));
>>>                 movieItem.add(new RatingPanel ("rating", new
>>> PropertyModel(rating, "rating"), 5, new
>>> PropertyModel(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
>>>   wrote:

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


            
                
                    (remove)
                    
                    
                    rating
                    
                
                >>> id="formsubmit"/>
            

 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 Form("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.beginTransacti

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 Form("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 PropertyListView("movies", movieList) {

@Override
public void populateItem(final ListItem movieItem) {
final RatingModel rating = new
RatingModel(movieItem.getModelObject().getRating());
movieItem.add(new
TextField("name").setType(String.class));
movieItem.add(new DropDownChoice("category",
Arrays.asList(Category.values()), new
EnumChoiceRenderer(this)));
movieItem.add(new RatingPanel ("rating", new
PropertyModel(rating, "rating"), 5, new
PropertyModel(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  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 Meier  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 PropertyListView("movies", movieList)
 {

             @Override
             public void populateItem(final ListItem    movieItem)
 {
                 final RatingModel rating = new
 RatingModel(movieItem.getModelObject().getRating());
                 movieItem.add(new
 TextField("name").setType(String.class));
                 movieItem.add(new DropDownChoice("category",
 Arrays.asList(Category.values()), new
 EnumChoiceRenderer(this)));
                 movieItem.add(new RatingPanel ("rating", new
 PropertyModel(rating, "rating"), 5, new
 PropertyModel(rating, "numberOfVotes"), false) {
                     @Override
                     public boolean onIsStarActive(int star) {
                         return rating.isActive(star);
                     }
                     @Override
                     pub

Re: Execute Javascript after components of a certain type render

2012-01-23 Thread Andrea Del Bene
Your idea of using PostComponentOnBeforeRenderListener sounds good to 
me, but I didn't understand exactly what you do with this kind of listener.


Once you have checked if component implements IMyPanel, I would call 
Application.getHeaderContributorListenerCollection()  and I would add a 
header contributor which renders your JavaScript as I suggested in the 
previous mail.

The code of you IComponentOnBeforeRenderListener should be something like:

 implements IComponentOnBeforeRenderListener{

onBeforeRender(Component component) {
if(component instanceof IMyPanel)

Application.get().getHeaderContributorListenerCollection().add(new 
IHeaderContributor(){
public void renderHead( IHeaderResponse 
response)

{

response.renderOnLoadJavaScript("<...your JavaScript...>");

}
});
}
}

That's a a good idea but unfortunately my panels extend disjoint class
hierarchies and I can only group them using interfaces.

Any thoughts on how I can use Application listeners to accomplish this?

Thanks,

Alec

On Mon, Jan 23, 2012 at 3:41 AM, Andrea Del Bene  wrote:




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



Re: wicket 1.5.3 RequestCycleListener redirection migration problem

2012-01-23 Thread Schnick

Martin Grigorov-4 wrote
> 
> Hi,
> 
> On Fri, Jan 20, 2012 at 6:15 PM, Schnick  wrote:
>> Hello all,
>>
>> I am trying to migrate to wicket 1.5.3 but am having problems. I would
>> like
>> to redirect users to a particular wicket page at any given time in their
>> visit. I have overridden RequestCycleListener's onBeginRequest method so
>> that it sets the request cycles response page like so
>>  cycle.setResponsePage(TermsAndConditionsInputPage.class);
>> and
>>  scheduleRequestHandlerAfterCurrent(new RenderPageRequestHandler(new
>> PageProvider(TermsAndConditionsInputPage.class))) ;
>>
>> but get the following error and the desired page to redirect to is not
>> loaded.
>>  java.lang.IllegalStateException: Header was already written to response!
>>
>> The following code redirects to the page I want but also generates a
>> warning
>> ... java.lang.IllegalStateException: Committed
>>
>> WebResponse webResponse = (WebResponse]) cycle.getResponse();
>> webResponse.sendRedirect("terms-and-conditions"));
>>
>> I would appreciate any help and thoughts on how to solve this problem. I
>> haven't found any posts of people redirecting from RequestCycleListener
>> onBeginRequest method. Is their a better approach?
>>
>> P.S in wicket 1.4.19 the code to redirect was
>> setRedirect(true);
>> setResponsePage(TermsAndConditionsInputPage.class)
> 
> In 1.5.x you need just the second line.
> 
> Why do you want to do that in onBeginRequest() ? Do it where you did it in
> 1.4.x
> 
>>
>>
>>
>>
>>
>>
>> --
>> View this message in context:
>> http://apache-wicket.1842946.n4.nabble.com/wicket-1-5-3-RequestCycleListener-redirection-migration-problem-tp4313664p4313664.html
>> Sent from the Users forum mailing list archive at Nabble.com.
>>
>> -
>> To unsubscribe, e-mail: users-unsubscribe@.apache
>> For additional commands, e-mail: users-help@.apache
>>
> 
> 
> 
> -- 
> Martin Grigorov
> jWeekend
> Training, Consulting, Development
> http://jWeekend.com
> 
> -
> To unsubscribe, e-mail: users-unsubscribe@.apache
> For additional commands, e-mail: users-help@.apache
> 

In 1.4.x I override WebRequestCycle and did the redirected in onBeginRequest
method so for 1.5 overriding the AbstractRequestCycleListener's
onBeginRequest seems like the best choice. I can't override the
applicaiton's createRequestCycle method since it has been made final. 

Changing the web request cycle was done to ensure that the user could not
perform any further actions till they agreed to the terms and conditions of
the website. Is their a better way to Wicket way to do this? At this point
all i can think of doing is adding redirects to each page. 

I've also tried overriding newWebRequest and newWebResponse but get the
following exception when I query the web session from these methods. 
  java.lang.IllegalArgumentException: Argument 'requestCycle' may not be
null.


--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/wicket-1-5-3-RequestCycleListener-redirection-migration-problem-tp4313664p4321330.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Re: form processing for multiple objects

2012-01-23 Thread Sven Meier

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 Form("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 PropertyListView("movies", movieList) {

 @Override
 public void populateItem(final ListItem  movieItem) {
 final RatingModel rating = new
RatingModel(movieItem.getModelObject().getRating());
 movieItem.add(new
TextField("name").setType(String.class));
 movieItem.add(new DropDownChoice("category",
Arrays.asList(Category.values()), new
EnumChoiceRenderer(this)));
 movieItem.add(new RatingPanel ("rating", new
PropertyModel(rating, "rating"), 5, new
PropertyModel(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  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 Meierwrote:

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 PropertyListView("movies", movieList)
{

 @Override
 public void populateItem(final ListItem  movieItem)
{
 final RatingModel rating = new
RatingModel(movieItem.getModelObject().getRating());
 movieItem.add(new
TextField("name").setType(String.class));
 movieItem.add(new DropDownChoice("category",
Arrays.asList(Category.values()), new
EnumChoiceRenderer(this)));
 movieItem.add(new RatingPanel ("rating", new
PropertyModel(rating, "rating"), 5, new
PropertyModel(rating, "numberOfVotes"), false) {
 @Override
 public boolean onIsStarActive(int star) {
 return rating.isActive(star);
 }
 @Override
 public void onRated(int newRating,
AjaxReque

Re: Wicket webshere 7

2012-01-23 Thread matteus

Yes, my application is running with the filter  Wicket Filter.

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Wicket-websphere-7-tp4310810p4321364.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Re: 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  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 Form("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 PropertyListView("movies", movieList) {
>>
>>             @Override
>>             public void populateItem(final ListItem  movieItem) {
>>                 final RatingModel rating = new
>> RatingModel(movieItem.getModelObject().getRating());
>>                 movieItem.add(new
>> TextField("name").setType(String.class));
>>                 movieItem.add(new DropDownChoice("category",
>> Arrays.asList(Category.values()), new
>> EnumChoiceRenderer(this)));
>>                 movieItem.add(new RatingPanel ("rating", new
>> PropertyModel(rating, "rating"), 5, new
>> PropertyModel(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  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 Meier    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 PropertyListView("movies",
>

Re: Execute Javascript after components of a certain type render

2012-01-23 Thread Alec Swan
It looks like your code will add an IHeaderContributor to EVERY
component once IComponentOnBeforeRenderListener finds an instance of
IMyPanel component. Which is not what I need.

I was hoping to do something like this:

addPostComponentOnBeforeRenderListener(new IComponentOnBeforeRenderListener() {
@Override
public void onBeforeRender(Component component) {
if (component instanceof MicroSitePanel) {
component.add(new XXXBehavior() {
  // somehow fire Javascript when component
renders, e.g. onComponentTag???
});
}
}
});

So, my question is what XXXBehavior should I use and how to fire
Javascript when component renders?

Thanks,

Alec

On Mon, Jan 23, 2012 at 10:09 AM, Andrea Del Bene  wrote:
> Your idea of using PostComponentOnBeforeRenderListener sounds good to me,
> but I didn't understand exactly what you do with this kind of listener.
>
> Once you have checked if component implements IMyPanel, I would call
> Application.getHeaderContributorListenerCollection()  and I would add a
> header contributor which renders your JavaScript as I suggested in the
> previous mail.
> The code of you IComponentOnBeforeRenderListener should be something like:
>
>  implements IComponentOnBeforeRenderListener{
>
>    onBeforeRender(Component component) {
>        if(component instanceof IMyPanel)
>
>  Application.get().getHeaderContributorListenerCollection().add(new
> IHeaderContributor(){
>                                public void renderHead( IHeaderResponse
> response)
>                                    {
>
>  response.renderOnLoadJavaScript("<...your JavaScript...>");
>                                    }
>            });
>
>    }
> }
>>
>> That's a a good idea but unfortunately my panels extend disjoint class
>> hierarchies and I can only group them using interfaces.
>>
>> Any thoughts on how I can use Application listeners to accomplish this?
>>
>> Thanks,
>>
>> Alec
>>
>> On Mon, Jan 23, 2012 at 3:41 AM, Andrea Del Bene
>>  wrote:
>>
>
>
> -
> 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: Execute Javascript after components of a certain type render

2012-01-23 Thread Alec Swan
Sorry "component instanceof MicroSitePanel" should have read
"component instanceof IMyPanel"

On Mon, Jan 23, 2012 at 11:26 AM, Alec Swan  wrote:
> It looks like your code will add an IHeaderContributor to EVERY
> component once IComponentOnBeforeRenderListener finds an instance of
> IMyPanel component. Which is not what I need.
>
> I was hoping to do something like this:
>
> addPostComponentOnBeforeRenderListener(new IComponentOnBeforeRenderListener() 
> {
>            @Override
>            public void onBeforeRender(Component component) {
>                if (component instanceof MicroSitePanel) {
>                    component.add(new XXXBehavior() {
>                      // somehow fire Javascript when component
> renders, e.g. onComponentTag???
>                    });
>                }
>            }
>        });
>
> So, my question is what XXXBehavior should I use and how to fire
> Javascript when component renders?
>
> Thanks,
>
> Alec
>
> On Mon, Jan 23, 2012 at 10:09 AM, Andrea Del Bene  
> wrote:
>> Your idea of using PostComponentOnBeforeRenderListener sounds good to me,
>> but I didn't understand exactly what you do with this kind of listener.
>>
>> Once you have checked if component implements IMyPanel, I would call
>> Application.getHeaderContributorListenerCollection()  and I would add a
>> header contributor which renders your JavaScript as I suggested in the
>> previous mail.
>> The code of you IComponentOnBeforeRenderListener should be something like:
>>
>>  implements IComponentOnBeforeRenderListener{
>>
>>    onBeforeRender(Component component) {
>>        if(component instanceof IMyPanel)
>>
>>  Application.get().getHeaderContributorListenerCollection().add(new
>> IHeaderContributor(){
>>                                public void renderHead( IHeaderResponse
>> response)
>>                                    {
>>
>>  response.renderOnLoadJavaScript("<...your JavaScript...>");
>>                                    }
>>            });
>>
>>    }
>> }
>>>
>>> That's a a good idea but unfortunately my panels extend disjoint class
>>> hierarchies and I can only group them using interfaces.
>>>
>>> Any thoughts on how I can use Application listeners to accomplish this?
>>>
>>> Thanks,
>>>
>>> Alec
>>>
>>> On Mon, Jan 23, 2012 at 3:41 AM, Andrea Del Bene
>>>  wrote:
>>>
>>
>>
>> -
>> 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 webshere 7

2012-01-23 Thread Andrew Geery
I've had a very similar problem with WAS 6.1 (basic functionality would
work but AJAX functionality did not).  The solution was simply to use the
Wicket servlet instead of the filter -- see
https://cwiki.apache.org/WICKET/websphere.html.  What made it hard to debug
was the fact that the Wicket filter implementation did work for aspects on
WAS, but it didn't work for AJAX calls.

HTH
Andrew

On Mon, Jan 23, 2012 at 12:23 PM, matteus  wrote:

>
> Yes, my application is running with the filter  Wicket Filter.
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Wicket-websphere-7-tp4310810p4321364.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


Re: Execute Javascript after components of a certain type render

2012-01-23 Thread Igor Vaynberg
There is no baked behavior for this. Create your own and override
renderhead method to output js. If this is a one time thing override
istemporary method to return true.

-igor

-igor
On Jan 23, 2012 10:26 AM, "Alec Swan"  wrote:

> It looks like your code will add an IHeaderContributor to EVERY
> component once IComponentOnBeforeRenderListener finds an instance of
> IMyPanel component. Which is not what I need.
>
> I was hoping to do something like this:
>
> addPostComponentOnBeforeRenderListener(new
> IComponentOnBeforeRenderListener() {
>@Override
>public void onBeforeRender(Component component) {
>if (component instanceof MicroSitePanel) {
>component.add(new XXXBehavior() {
>  // somehow fire Javascript when component
> renders, e.g. onComponentTag???
>});
>}
>}
>});
>
> So, my question is what XXXBehavior should I use and how to fire
> Javascript when component renders?
>
> Thanks,
>
> Alec
>
> On Mon, Jan 23, 2012 at 10:09 AM, Andrea Del Bene 
> wrote:
> > Your idea of using PostComponentOnBeforeRenderListener sounds good to me,
> > but I didn't understand exactly what you do with this kind of listener.
> >
> > Once you have checked if component implements IMyPanel, I would call
> > Application.getHeaderContributorListenerCollection()  and I would add a
> > header contributor which renders your JavaScript as I suggested in the
> > previous mail.
> > The code of you IComponentOnBeforeRenderListener should be something
> like:
> >
> >  implements IComponentOnBeforeRenderListener{
> >
> >onBeforeRender(Component component) {
> >if(component instanceof IMyPanel)
> >
> >  Application.get().getHeaderContributorListenerCollection().add(new
> > IHeaderContributor(){
> >public void renderHead( IHeaderResponse
> > response)
> >{
> >
> >  response.renderOnLoadJavaScript("<...your JavaScript...>");
> >}
> >});
> >
> >}
> > }
> >>
> >> That's a a good idea but unfortunately my panels extend disjoint class
> >> hierarchies and I can only group them using interfaces.
> >>
> >> Any thoughts on how I can use Application listeners to accomplish this?
> >>
> >> Thanks,
> >>
> >> Alec
> >>
> >> On Mon, Jan 23, 2012 at 3:41 AM, Andrea Del Bene
> >>  wrote:
> >>
> >
> >
> > -
> > 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 webshere 7

2012-01-23 Thread Eric Hamel
We also had similar problems on WAS 6.1 and we also used Wicket Servlet to
mitigate our issues.

We've been preparing for an upgrade of our servers, mostly comparing
WebSphere 7 and WebSphere 8. V7 seems to behave the same as V6.1 whereas V8
seems to handle the Wicket Filter much better.

On Mon, Jan 23, 2012 at 1:49 PM, Andrew Geery wrote:

> I've had a very similar problem with WAS 6.1 (basic functionality would
> work but AJAX functionality did not).  The solution was simply to use the
> Wicket servlet instead of the filter -- see
> https://cwiki.apache.org/WICKET/websphere.html.  What made it hard to
> debug
> was the fact that the Wicket filter implementation did work for aspects on
> WAS, but it didn't work for AJAX calls.
>
> HTH
> Andrew
>
> On Mon, Jan 23, 2012 at 12:23 PM, matteus  wrote:
>
> >
> > Yes, my application is running with the filter  Wicket Filter.
> >
> > --
> > View this message in context:
> >
> http://apache-wicket.1842946.n4.nabble.com/Wicket-websphere-7-tp4310810p4321364.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
> >
> >
>



-- 
Sent by Eric Hamel


Re: Execute Javascript after components of a certain type render

2012-01-23 Thread Alec Swan
What about AbstractTransformerBehavior? Can I use it to execute Javascript?

On Mon, Jan 23, 2012 at 12:08 PM, Igor Vaynberg  wrote:
> There is no baked behavior for this. Create your own and override
> renderhead method to output js. If this is a one time thing override
> istemporary method to return true.
>
> -igor
>
> -igor
> On Jan 23, 2012 10:26 AM, "Alec Swan"  wrote:
>
>> It looks like your code will add an IHeaderContributor to EVERY
>> component once IComponentOnBeforeRenderListener finds an instance of
>> IMyPanel component. Which is not what I need.
>>
>> I was hoping to do something like this:
>>
>> addPostComponentOnBeforeRenderListener(new
>> IComponentOnBeforeRenderListener() {
>>            @Override
>>            public void onBeforeRender(Component component) {
>>                if (component instanceof MicroSitePanel) {
>>                    component.add(new XXXBehavior() {
>>                      // somehow fire Javascript when component
>> renders, e.g. onComponentTag???
>>                    });
>>                }
>>            }
>>        });
>>
>> So, my question is what XXXBehavior should I use and how to fire
>> Javascript when component renders?
>>
>> Thanks,
>>
>> Alec
>>
>> On Mon, Jan 23, 2012 at 10:09 AM, Andrea Del Bene 
>> wrote:
>> > Your idea of using PostComponentOnBeforeRenderListener sounds good to me,
>> > but I didn't understand exactly what you do with this kind of listener.
>> >
>> > Once you have checked if component implements IMyPanel, I would call
>> > Application.getHeaderContributorListenerCollection()  and I would add a
>> > header contributor which renders your JavaScript as I suggested in the
>> > previous mail.
>> > The code of you IComponentOnBeforeRenderListener should be something
>> like:
>> >
>> >  implements IComponentOnBeforeRenderListener{
>> >
>> >    onBeforeRender(Component component) {
>> >        if(component instanceof IMyPanel)
>> >
>> >  Application.get().getHeaderContributorListenerCollection().add(new
>> > IHeaderContributor(){
>> >                                public void renderHead( IHeaderResponse
>> > response)
>> >                                    {
>> >
>> >  response.renderOnLoadJavaScript("<...your JavaScript...>");
>> >                                    }
>> >            });
>> >
>> >    }
>> > }
>> >>
>> >> That's a a good idea but unfortunately my panels extend disjoint class
>> >> hierarchies and I can only group them using interfaces.
>> >>
>> >> Any thoughts on how I can use Application listeners to accomplish this?
>> >>
>> >> Thanks,
>> >>
>> >> Alec
>> >>
>> >> On Mon, Jan 23, 2012 at 3:41 AM, Andrea Del Bene
>> >>  wrote:
>> >>
>> >
>> >
>> > -
>> > 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 spring security sample app

2012-01-23 Thread Brian Lavender
The following worked.

$ mvn install 

How do I run the Start class?

I tried the following, but I get a class not found error. Usually, I have run
classes inside the src/java area, but not in src/test .

$ cd example
$ mvn exec:java -Dexec.mainClass="org.wicketopia.example.web.util.Start"

brian

On Fri, Jan 20, 2012 at 06:14:24PM -0500, James Carman wrote:
> Run mvn install from the top-level directory.
> 
> Then, in the example webapp project, there is a class called Start:
> 
> https://github.com/jwcarman/Wicketopia/blob/master/example/src/test/java/org/wicketopia/example/web/util/Start.java
> 
> Run that.  Good luck!
> 
> On Thu, Jan 19, 2012 at 5:35 PM, Brian Lavender  wrote:
> > James,
> >
> > I cloned the repository.
> >
> > $ git clone https://github.com/jwcarman/Wicketopia.git
> > $ cd Wicketopia
> > $ mvn eclipse:eclipse
> >
> > a few errors including the below error.
> >
> > [ERROR] Failed to execute goal on project wicketopia-persistence: Could not 
> > resolve dependencies for project 
> > org.wicketopia:wicketopia-persistence:jar:1.0-SNAPSHOT: Could not find 
> > artifact org.wicketopia:wicketopia:jar:1.0-20110328.173826-2 in 
> > sonatype-nexus-snapshots 
> > (https://oss.sonatype.org/content/repositories/snapshots) -> [Help 1]
> > [ERROR]
> >
> > Imported it into Eclipse.
> >
> > Which test case do I run?
> >
> > I tried changing into the example directory and doing a "mvn 
> > eclipse:eclipse" too, but it gave the below error.
> >
> > [ERROR] Failed to execute goal on project wicketopia-example: Could not 
> > resolve dependencies for project 
> > org.wicketopia:wicketopia-example:war:1.0-SNAPSHOT: The following artifacts 
> > could not be resolved: org.wicketopia:wicketopia:jar:1.0-SNAPSHOT, 
> > org.wicketopia:wicketopia-joda:jar:1.0-SNAPSHOT, 
> > org.wicketopia:wicketopia-cdi-weld:jar:1.0-SNAPSHOT, 
> > org.wicketopia:wicketopia-spring-security:jar:1.0-SNAPSHOT, 
> > org.wicketopia:wicketopia-hibernate:jar:1.0-SNAPSHOT, 
> > org.wicketopia:wicketopia:jar:tests:1.0-SNAPSHOT: Failure to find 
> > org.wicketopia:wicketopia:jar:1.0-20110328.173826-2 in 
> > https://oss.sonatype.org/content/repositories/snapshots was cached in the 
> > local repository, resolution will not be reattempted until the update 
> > interval of sonatype-nexus-snapshots has elapsed or updates are forced -> 
> > [Help 1]
> >
> >
> > brian
> >
> > On Wed, Jan 18, 2012 at 06:58:08AM -0500, James Carman wrote:
> >> Either way, you can open it in your IDE and run the jetty test server
> >> that's included.  That's how I run it usually so that I can easily
> >> debug and play around.
> >>
> >> On Wed, Jan 18, 2012 at 6:57 AM, James Carman
> >>  wrote:
> >> > I don't know if the plugin is turned on for the example application.
> >> > But, you'd need to make sure you are in the example module before you
> >> > try.
> >> >
> >> > On Wed, Jan 18, 2012 at 1:15 AM, Brian Lavender  wrote:
> >> >> On Sun, Jan 15, 2012 at 12:36:48PM +0200, Martin Grigorov wrote:
> >> >>> See https://github.com/jwcarman/Wicketopia
> >> >>
> >> >> Maybe I missed something, but I wasn't able to do a
> >> >>
> >> >> mvn jetty:run
> >> >>
> >> >> or did the war package run after generating a war file.
> >> >>
> >> >> brian
> >> >> --
> >> >> Brian Lavender
> >> >> http://www.brie.com/brian/
> >> >>
> >> >> "There are two ways of constructing a software design. One way is to
> >> >> make it so simple that there are obviously no deficiencies. And the 
> >> >> other
> >> >> way is to make it so complicated that there are no obvious 
> >> >> deficiencies."
> >> >>
> >> >> Professor C. A. R. Hoare
> >> >> The 1980 Turing award lecture
> >> >>
> >> >> -
> >> >> 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
> >>
> >
> > --
> > Brian Lavender
> > http://www.brie.com/brian/
> >
> > "There are two ways of constructing a software design. One way is to
> > make it so simple that there are obviously no deficiencies. And the other
> > way is to make it so complicated that there are no obvious deficiencies."
> >
> > Professor C. A. R. Hoare
> > The 1980 Turing award lecture
> >
> > -
> > 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
> 

-- 
Brian Lavender
http://www.brie.com/brian/

"There are two ways of constructing a software design. One way is to
mak

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



AjaxSubmitLink : Simple attribute modifier (confirm javascript popup) never calld , form not submited

2012-01-23 Thread chimaira
Hello , sorry for my english ! 


I m facing a probleme with AjaxSubmitLink on a form compoenent 

I want to add a simple attribute modifier with a on click and a confirm 
javascript popup, to get to user confirmation befor submiting.

That works fine with a simple wicket button , but I want to use
AjaxSubmitLink that way I can overrid the OnError methode and refresh my
form feedback, so I create I class AjaxConfirmButton extends AjaxSubmitLink.
and in the constructor I add the behaviour (add( new
SimpleAttributeModifier('onclick', "return confirm(...)").

the probleme is the on click javascript is never calld and the form is never
submited.

is there a way to fix this issue? 
 hanks a lot 


--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/AjaxSubmitLink-Simple-attribute-modifier-confirm-javascript-popup-never-calld-form-not-submited-tp4322492p4322492.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Re: AjaxSubmitLink : Simple attribute modifier (confirm javascript popup) never calld , form not submited

2012-01-23 Thread Igor Vaynberg
for ajax links you need to use an IAjaxCallDecorator to tweak the
javascript. below is a possible impl.

-igor

public class JavascriptConfirmDecorator extends AjaxCallDecorator
{
private final String confirmMessage;

public JavascriptConfirmDecorator(String confirmMessage){
this.confirmMessage = confirmMessage;
}

@Override
public CharSequence decorateScript(Component c, CharSequence script)
{
return "if (!confirm('" + 
StringUtils.replace(confirmMessage, "'",
"\'") + "')) return false;\n" + script;
}
}

On Mon, Jan 23, 2012 at 3:53 PM, chimaira  wrote:
> Hello , sorry for my english !
>
>
> I m facing a probleme with AjaxSubmitLink on a form compoenent
>
> I want to add a simple attribute modifier with a on click and a confirm
> javascript popup, to get to user confirmation befor submiting.
>
> That works fine with a simple wicket button , but I want to use
> AjaxSubmitLink that way I can overrid the OnError methode and refresh my
> form feedback, so I create I class AjaxConfirmButton extends AjaxSubmitLink.
> and in the constructor I add the behaviour (add( new
> SimpleAttributeModifier('onclick', "return confirm(...)").
>
> the probleme is the on click javascript is never calld and the form is never
> submited.
>
> is there a way to fix this issue?
>  hanks a lot
>
>
> --
> View this message in context: 
> http://apache-wicket.1842946.n4.nabble.com/AjaxSubmitLink-Simple-attribute-modifier-confirm-javascript-popup-never-calld-form-not-submited-tp4322492p4322492.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



To enable client-side page caching

2012-01-23 Thread Michael Allan
I'd like to enable client-side page caching for stateless pages.  I'm
migrating from 1.3 to 1.5 and the migration guide says, "All Wicket
pages are by default non-cacheable as in 1.4".
https://cwiki.apache.org/WICKET/caching-in-wicket-15.html

We do a lot of back-and-forth navigation and I'd like to keep it light
and responsive.  Is there an API to re-enable caching?  Or do I set
the response headers myself?

Should I expect any problems?  Again, I'm not sure it makes a
difference, but this is only for pages that pass the
@StatelessComponent test.

-- 
Michael Allan

Toronto, +1 416-699-9528
http://zelea.com/

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



Re: To enable client-side page caching

2012-01-23 Thread Michael Allan
> We do a lot of back-and-forth navigation and I'd like to keep it light
> and responsive.  Is there an API to re-enable caching?  Or do I set
> the response headers myself?

Sorry, I see the answer is WebResponse.enableCaching().  Just this
question, then:

> Should I expect any problems?  Again, I'm not sure it makes a
> difference, but this is only for pages that pass the
> @StatelessComponent test.


-- 
Michael Allan

Toronto, +1 416-699-9528
http://zelea.com/

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



Re: wicket appl architecture

2012-01-23 Thread nazeem
This is an interesting article referring to the Linked In tech team
experience and how they are addressing using client side template.. 

http://blogs.developerforce.com/developer-relations/2011/12/thoughts-on-ui-architectures.html
Thoughts on UI Architecture


In the above article he refers to this 
https://engineering.linkedin.com/frontend/leaving-jsps-dust-moving-linkedin-dustjs-client-side-templates


So, the concept of single json/rest api interface addressing to all type of
client (full web based app, mobile version of html app, ios, android, etc).
In this case how can I write wicket components to render from jsons ? i
believe its not required since its more on the server side, direct pojos
should be fine.

But at the last he also mentions "Server-side templating should continue to
be the default choice for most web applications as it offers many benefits
like performance, security etc.".  
This seemed contradicting to the full details explained. 

Can any one clarify where does wicket fall in this structure and how we can
leverage both (server side templating + client side templating for mobile
apps)


--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/wicket-appl-architecture-tp4305917p4322698.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Re: Wicket spring security sample app

2012-01-23 Thread Brian Lavender
Quick Start for getting Wicktopia running or at least see it running. I
wasn't sure how to run Wicketopia. Certainly James can post these
details, but I thought I would since he hasn't yet. Or, maybe it is
posted somewhere else. 

$ git clone https://github.com/jwcarman/Wicketopia.git 
$ cd Wicketopia 
$ mvn install 
$ cd example
$ mvn exec:java \
 -Dexec.mainClass="org.wicketopia.example.web.util.Start" \
 -Dexec.classpathScope="test 

 Point your browser to the following.

http://localhost:8080  


On Mon, Jan 23, 2012 at 01:10:07PM -0800, Brian Lavender wrote:
> The following worked.
> 
> $ mvn install 
> 
> How do I run the Start class?
> 
> I tried the following, but I get a class not found error. Usually, I have run
> classes inside the src/java area, but not in src/test .
> 
> $ cd example
> $ mvn exec:java -Dexec.mainClass="org.wicketopia.example.web.util.Start"
> 
> brian
> 
> On Fri, Jan 20, 2012 at 06:14:24PM -0500, James Carman wrote:
> > Run mvn install from the top-level directory.
> > 
> > Then, in the example webapp project, there is a class called Start:
> > 
> > https://github.com/jwcarman/Wicketopia/blob/master/example/src/test/java/org/wicketopia/example/web/util/Start.java
> > 
> > Run that.  Good luck!
> > 
> > On Thu, Jan 19, 2012 at 5:35 PM, Brian Lavender  wrote:
> > > James,
> > >
> > > I cloned the repository.
> > >
> > > $ git clone https://github.com/jwcarman/Wicketopia.git
> > > $ cd Wicketopia
> > > $ mvn eclipse:eclipse
> > >
> > > a few errors including the below error.
> > >
> > > [ERROR] Failed to execute goal on project wicketopia-persistence: Could 
> > > not resolve dependencies for project 
> > > org.wicketopia:wicketopia-persistence:jar:1.0-SNAPSHOT: Could not find 
> > > artifact org.wicketopia:wicketopia:jar:1.0-20110328.173826-2 in 
> > > sonatype-nexus-snapshots 
> > > (https://oss.sonatype.org/content/repositories/snapshots) -> [Help 1]
> > > [ERROR]
> > >
> > > Imported it into Eclipse.
> > >
> > > Which test case do I run?
> > >
> > > I tried changing into the example directory and doing a "mvn 
> > > eclipse:eclipse" too, but it gave the below error.
> > >
> > > [ERROR] Failed to execute goal on project wicketopia-example: Could not 
> > > resolve dependencies for project 
> > > org.wicketopia:wicketopia-example:war:1.0-SNAPSHOT: The following 
> > > artifacts could not be resolved: 
> > > org.wicketopia:wicketopia:jar:1.0-SNAPSHOT, 
> > > org.wicketopia:wicketopia-joda:jar:1.0-SNAPSHOT, 
> > > org.wicketopia:wicketopia-cdi-weld:jar:1.0-SNAPSHOT, 
> > > org.wicketopia:wicketopia-spring-security:jar:1.0-SNAPSHOT, 
> > > org.wicketopia:wicketopia-hibernate:jar:1.0-SNAPSHOT, 
> > > org.wicketopia:wicketopia:jar:tests:1.0-SNAPSHOT: Failure to find 
> > > org.wicketopia:wicketopia:jar:1.0-20110328.173826-2 in 
> > > https://oss.sonatype.org/content/repositories/snapshots was cached in the 
> > > local repository, resolution will not be reattempted until the update 
> > > interval of sonatype-nexus-snapshots has elapsed or updates are forced -> 
> > > [Help 1]
> > >
> > >
> > > brian
> > >
> > > On Wed, Jan 18, 2012 at 06:58:08AM -0500, James Carman wrote:
> > >> Either way, you can open it in your IDE and run the jetty test server
> > >> that's included.  That's how I run it usually so that I can easily
> > >> debug and play around.
> > >>
> > >> On Wed, Jan 18, 2012 at 6:57 AM, James Carman
> > >>  wrote:
> > >> > I don't know if the plugin is turned on for the example application.
> > >> > But, you'd need to make sure you are in the example module before you
> > >> > try.
> > >> >
> > >> > On Wed, Jan 18, 2012 at 1:15 AM, Brian Lavender  wrote:
> > >> >> On Sun, Jan 15, 2012 at 12:36:48PM +0200, Martin Grigorov wrote:
> > >> >>> See https://github.com/jwcarman/Wicketopia
> > >> >>
> > >> >> Maybe I missed something, but I wasn't able to do a
> > >> >>
> > >> >> mvn jetty:run
> > >> >>
> > >> >> or did the war package run after generating a war file.
> > >> >>
> > >> >> brian
> > >> >> --
> > >> >> Brian Lavender
> > >> >> http://www.brie.com/brian/
> > >> >>
> > >> >> "There are two ways of constructing a software design. One way is to
> > >> >> make it so simple that there are obviously no deficiencies. And the 
> > >> >> other
> > >> >> way is to make it so complicated that there are no obvious 
> > >> >> deficiencies."
> > >> >>
> > >> >> Professor C. A. R. Hoare
> > >> >> The 1980 Turing award lecture
> > >> >>
> > >> >> -
> > >> >> 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
> > >>
> > >
> > > --
> > > Brian Lav

Problems with requests to MountPath and optional parameters

2012-01-23 Thread shayy
Hi, 

I'm trying to use @MountPath in conjunction with Wicket 1.5 but I'm
encountering an issue. 

I've configured the following mount path on one of my page classes: 
@MountPath("/items/#{itemName}/#{itemNumber}/#{itemDate}/#{subItemName}") 

Requesting the following URL results in a 404 when using Firefox or IE and
is in constant "loading" mode when using Chrome: 
host/items/itemName/381/2011-12-22T21:08:32.960+0200/sub.item:221 

But requesting the same URL with a trailing "/" works. 

I am thinking it might be a problem with the special characters, as the
request succeeds with no trailing "/" if I substitue all values to simple
strings: 
host/items/itemName/381/itemDate/subitemName 

Am I misconfiguring the mount path in any way? 
Could it be that the special characters are the cause of this behavior? 

Thanks, 
Shay

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Problems-with-requests-to-MountPath-and-optional-parameters-tp4323095p4323095.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