You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by gaugat <go...@augat.org> on 2008/03/13 20:04:06 UTC
Wicket Portlet Error in Liferay
I have a simple portlet created using wicket. It contains a PageableListView
and PagingNavigator components. The portlet initially renders just fine.
When I click on one of the paging links, I get ClassCastException. Part of
the stacktrace looks like this...
java.lang.ClassCastException: com.liferay.portlet.ActionResponseImpl
at
org.apache.wicket.protocol.http.portlet.WicketFilterPortletContext.setupFilter(WicketFilterPortletContext.java:75)
at
org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:163)
Stepping through the code in WicketFilterPortletContext, it looks like
(RenderResponse)filterRequestContext.getRequest().getAttribute("javax.portlet.response")
returns com.liferay.portlet.ActionResponseImpl which does not implement
RenderResponse
I'm using Liferay 4.2.2 and Wicket 1.3.1.
Any ideas?
--
View this message in context: http://www.nabble.com/Wicket-Portlet-Error-in-Liferay-tp16036090p16036090.html
Sent from the Wicket - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
RE: How to pre-select a DropDownChoice
Posted by Michael Mehrle <mi...@ask.com>.
Yeah, I figured that out last night. That's actually a great way of
handling the component's state. Thanks for your input.
-----Original Message-----
From: Nick Heudecker [mailto:nheudecker@gmail.com]
Sent: Thursday, March 13, 2008 5:57 PM
To: users@wicket.apache.org
Subject: Re: How to pre-select a DropDownChoice
Set the model of the DDC to the value you want to have selected.
On Thu, Mar 13, 2008 at 7:53 PM, Michael Mehrle <mi...@ask.com>
wrote:
> I feel silly asking this, but I can't figure it out. I need to set my
> DropDownChoice component to the id I'm passing into my page via a
> pageparam. How do I do that? I don't see anything resembling
> setSelected().
>
> Michael
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
--
Nick Heudecker
Professional Wicket Training & Consulting
http://www.systemmobile.com
Eventful - Intelligent Event Management
http://www.eventfulhq.com
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: How to pre-select a DropDownChoice
Posted by Erik van Oosten <e....@grons.nl>.
http://cwiki.apache.org/WICKET/dropdownchoice.html
Hoover, William wrote:
> Can you add this to the wiki (http://cwiki.apache.org/WICKET/dropdownchoice-examples.html)? It seems like a commonly asked question :o)
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
RE: How to pre-select a DropDownChoice
Posted by "Hoover, William " <wh...@nemours.org>.
Can you add this to the wiki (http://cwiki.apache.org/WICKET/dropdownchoice-examples.html)? It seems like a commonly asked question :o)
-----Original Message-----
From: Erik van Oosten [mailto:e.vanoosten@grons.nl]
Sent: Friday, March 14, 2008 9:35 AM
To: users@wicket.apache.org
Subject: Re: How to pre-select a DropDownChoice
Funny, I answered the same question to my colleague this morning.
Below the code I gave him.
What happens is that the model is wrapped in another model. The wrapping
model has a defaultModel that is used to return a value when the
underlying model returns null.
Below the model wrapper you find an example on how to use it.
If you find something better, please let us know :)
import org.apache.wicket.model.IChainingModel;
import org.apache.wicket.model.AbstractWrapModel;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.IWrapModel;
/**
*
* @author Erik van Oosten
*/
public class DefaultingModelWrapper implements IWrapModel {
private IModel wrappedModel;
private IModel defaultModel;
public DefaultingModelWrapper(IModel wrappedModel, IModel
defaultModel) {
this.wrappedModel = wrappedModel;
this.defaultModel = defaultModel;
}
public IModel getWrappedModel() {
return wrappedModel;
}
public Object getObject() {
Object value = wrappedModel.getObject();
if (value == null) {
value = defaultModel.getObject();
}
return value;
}
public void setObject(Object object) {
wrappedModel.setObject(object);
}
public void detach() {
wrappedModel.detach();
defaultModel.detach();
}
}
public class DefaultingCountryDropDown extends CountryDropDown {
public DefaultingCountryDropDown(String id, IModel model) {
super(id, new DefaultingModelWrapper(model, new Model("NL")));
}
public DefaultingCountryDropDown(String id) {
super(id, new DefaultingModelWrapper(getModel(), new Model("NL")));
}
}
Regards,
Erik.
Juan Gabriel Arias wrote:
> DropDownChoice has a lot of contructors. One of them,
>
> DropDownChoice(String id, IModel model, IModel choices, ...)
>
> The first model, could be named "selectedModel". And represents the selected
> object, with a wicket model.
>
>
--
Erik van Oosten
http://day-to-day-stuff.blogspot.com/
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: How to pre-select a DropDownChoice
Posted by Erik van Oosten <e....@grons.nl>.
Funny, I answered the same question to my colleague this morning.
Below the code I gave him.
What happens is that the model is wrapped in another model. The wrapping
model has a defaultModel that is used to return a value when the
underlying model returns null.
Below the model wrapper you find an example on how to use it.
If you find something better, please let us know :)
import org.apache.wicket.model.IChainingModel;
import org.apache.wicket.model.AbstractWrapModel;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.IWrapModel;
/**
*
* @author Erik van Oosten
*/
public class DefaultingModelWrapper implements IWrapModel {
private IModel wrappedModel;
private IModel defaultModel;
public DefaultingModelWrapper(IModel wrappedModel, IModel
defaultModel) {
this.wrappedModel = wrappedModel;
this.defaultModel = defaultModel;
}
public IModel getWrappedModel() {
return wrappedModel;
}
public Object getObject() {
Object value = wrappedModel.getObject();
if (value == null) {
value = defaultModel.getObject();
}
return value;
}
public void setObject(Object object) {
wrappedModel.setObject(object);
}
public void detach() {
wrappedModel.detach();
defaultModel.detach();
}
}
public class DefaultingCountryDropDown extends CountryDropDown {
public DefaultingCountryDropDown(String id, IModel model) {
super(id, new DefaultingModelWrapper(model, new Model("NL")));
}
public DefaultingCountryDropDown(String id) {
super(id, new DefaultingModelWrapper(getModel(), new Model("NL")));
}
}
Regards,
Erik.
Juan Gabriel Arias wrote:
> DropDownChoice has a lot of contructors. One of them,
>
> DropDownChoice(String id, IModel model, IModel choices, ...)
>
> The first model, could be named "selectedModel". And represents the selected
> object, with a wicket model.
>
>
--
Erik van Oosten
http://day-to-day-stuff.blogspot.com/
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: How to pre-select a DropDownChoice
Posted by Juan Gabriel Arias <ju...@gmail.com>.
DropDownChoice has a lot of contructors. One of them,
DropDownChoice(String id, IModel model, IModel choices, ...)
The first model, could be named "selectedModel". And represents the selected
object, with a wicket model.
Re: How to pre-select a DropDownChoice
Posted by Nick Heudecker <nh...@gmail.com>.
Set the model of the DDC to the value you want to have selected.
On Thu, Mar 13, 2008 at 7:53 PM, Michael Mehrle <mi...@ask.com>
wrote:
> I feel silly asking this, but I can't figure it out. I need to set my
> DropDownChoice component to the id I'm passing into my page via a
> pageparam. How do I do that? I don't see anything resembling
> setSelected().
>
> Michael
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
--
Nick Heudecker
Professional Wicket Training & Consulting
http://www.systemmobile.com
Eventful - Intelligent Event Management
http://www.eventfulhq.com
How to pre-select a DropDownChoice
Posted by Michael Mehrle <mi...@ask.com>.
I feel silly asking this, but I can't figure it out. I need to set my
DropDownChoice component to the id I'm passing into my page via a
pageparam. How do I do that? I don't see anything resembling
setSelected().
Michael
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
RE: getConverter() in TextArea not being called
Posted by Michael Mehrle <mi...@ask.com>.
This was very helpful - thank you again, Igor!
-----Original Message-----
From: Igor Vaynberg [mailto:igor.vaynberg@gmail.com]
Sent: Thursday, March 13, 2008 12:55 PM
To: users@wicket.apache.org
Subject: Re: getConverter() in TextArea not being called
textarea.settype(mytype.class); or new
textarea("id",model,mytype.class);
yes, alternatvely you can override convertvalue()
-igor
On Thu, Mar 13, 2008 at 12:22 PM, Michael Mehrle
<mi...@ask.com> wrote:
> Thanks for help (again), Igor :-) However, I'm not sure I understand -
> could you please give me a code fragment?
>
> BTW, I just dug around in FormComponent - isn't an alternative
approach
> to override convertValue()?
>
> Michael
>
>
>
> -----Original Message-----
> From: Igor Vaynberg [mailto:igor.vaynberg@gmail.com]
> Sent: Thursday, March 13, 2008 12:12 PM
> To: users@wicket.apache.org
> Subject: Re: getConverter() in TextArea not being called
>
> you have to set the type either via constructor arg or a call to
settype
>
> -igor
>
>
> On Thu, Mar 13, 2008 at 12:08 PM, Michael Mehrle
> <mi...@ask.com> wrote:
> > I've got a custom TextArea which overrides getConverter(), however
for
> > some reason that method never gets called. getConverter() returns
an
> > implementation of IConverter - it all looks pretty basic.
> >
> > Is there anything special I have to do for getConverter() to be
> called?
> > By the way I added the @Override annotation, so I'm sure the
method
> sig
> > is correct.
> >
> > Michael
> >
> >
> >
---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: getConverter() in TextArea not being called
Posted by Igor Vaynberg <ig...@gmail.com>.
textarea.settype(mytype.class); or new textarea("id",model,mytype.class);
yes, alternatvely you can override convertvalue()
-igor
On Thu, Mar 13, 2008 at 12:22 PM, Michael Mehrle <mi...@ask.com> wrote:
> Thanks for help (again), Igor :-) However, I'm not sure I understand -
> could you please give me a code fragment?
>
> BTW, I just dug around in FormComponent - isn't an alternative approach
> to override convertValue()?
>
> Michael
>
>
>
> -----Original Message-----
> From: Igor Vaynberg [mailto:igor.vaynberg@gmail.com]
> Sent: Thursday, March 13, 2008 12:12 PM
> To: users@wicket.apache.org
> Subject: Re: getConverter() in TextArea not being called
>
> you have to set the type either via constructor arg or a call to settype
>
> -igor
>
>
> On Thu, Mar 13, 2008 at 12:08 PM, Michael Mehrle
> <mi...@ask.com> wrote:
> > I've got a custom TextArea which overrides getConverter(), however for
> > some reason that method never gets called. getConverter() returns an
> > implementation of IConverter - it all looks pretty basic.
> >
> > Is there anything special I have to do for getConverter() to be
> called?
> > By the way I added the @Override annotation, so I'm sure the method
> sig
> > is correct.
> >
> > Michael
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
RE: getConverter() in TextArea not being called
Posted by Michael Mehrle <mi...@ask.com>.
Thanks for help (again), Igor :-) However, I'm not sure I understand -
could you please give me a code fragment?
BTW, I just dug around in FormComponent - isn't an alternative approach
to override convertValue()?
Michael
-----Original Message-----
From: Igor Vaynberg [mailto:igor.vaynberg@gmail.com]
Sent: Thursday, March 13, 2008 12:12 PM
To: users@wicket.apache.org
Subject: Re: getConverter() in TextArea not being called
you have to set the type either via constructor arg or a call to settype
-igor
On Thu, Mar 13, 2008 at 12:08 PM, Michael Mehrle
<mi...@ask.com> wrote:
> I've got a custom TextArea which overrides getConverter(), however for
> some reason that method never gets called. getConverter() returns an
> implementation of IConverter - it all looks pretty basic.
>
> Is there anything special I have to do for getConverter() to be
called?
> By the way I added the @Override annotation, so I'm sure the method
sig
> is correct.
>
> Michael
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Converter gets called before Validator?
Posted by Igor Vaynberg <ig...@gmail.com>.
yes. validators work on types not strings, if they didnt then every
converter would have to attempt to type convert the string and deal
with conversion errors. so first we typeconvert, then run validators
on the result
-igor
On Thu, Mar 13, 2008 at 12:23 PM, Michael Mehrle <mi...@ask.com> wrote:
> I read the update docs and at this time assume that my component's
> Validator gets called AFTER the Converter. Is that correct for 1.3?
>
> Michael
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Converter gets called before Validator?
Posted by Michael Mehrle <mi...@ask.com>.
I read the update docs and at this time assume that my component's
Validator gets called AFTER the Converter. Is that correct for 1.3?
Michael
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: getConverter() in TextArea not being called
Posted by Igor Vaynberg <ig...@gmail.com>.
you have to set the type either via constructor arg or a call to settype
-igor
On Thu, Mar 13, 2008 at 12:08 PM, Michael Mehrle <mi...@ask.com> wrote:
> I've got a custom TextArea which overrides getConverter(), however for
> some reason that method never gets called. getConverter() returns an
> implementation of IConverter - it all looks pretty basic.
>
> Is there anything special I have to do for getConverter() to be called?
> By the way I added the @Override annotation, so I'm sure the method sig
> is correct.
>
> Michael
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
getConverter() in TextArea not being called
Posted by Michael Mehrle <mi...@ask.com>.
I've got a custom TextArea which overrides getConverter(), however for
some reason that method never gets called. getConverter() returns an
implementation of IConverter - it all looks pretty basic.
Is there anything special I have to do for getConverter() to be called?
By the way I added the @Override annotation, so I'm sure the method sig
is correct.
Michael
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org