You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Elad Katz <el...@xtify.com> on 2009/08/05 21:18:11 UTC
Problem with Palette
Hi all,
I have a problem with the Palette component:
I'm using a palette with a model populated by an EJB entity, and I want it
to show the correct selection status when it is displayed.
I mean that when the 'edit' button is clicked on a user, the current 'event'
that s\he has selected is shown
In code:
The following:
> /*all the events (2) - checked this - it's not null*/
> List<EventsEntity> events =
> LookupHelper.getInstance().lookupEventsEntityFacade().findAll();
> /*selected events for this user (same 2) - checked this - it's not
> null*/
> List<EventsEntity> selectedEvents = new
> ArrayList<EventsEntity>(model.getObject().getEvents());
> IChoiceRenderer<EventsEntity> renderer = new
> ChoiceRenderer<EventsEntity>("name", "id");
> palette =
> new Palette<EventsEntity>("palette",
> /*Selected Events*/new
> ListModel<EventsEntity>(selectedEvents),
> /*unselected*/new CollectionModel<EventsEntity>(events),
> renderer,
> 10,
> false);
>
> add(palette);
> //For debugging purposes:
> for (Iterator<EventsEntity> it = palette.getSelectedChoices();
> it.hasNext();) {
> EventsEntity eventsEntity = it.next();
> log.error("Selected choice: " + eventsEntity.getName());
> }
Throws an exception saying that the 'palette.getSelectedChoices();' returns
null
I would expect it to write the selected events to the log...
Am I doing something wrong? did I misunderstand the API?
it said:
> Palette
>
> public *Palette*(java.lang.String id,
> org.apache.wicket.model.IModel<java.util.Collection<T <http://static.ddpoker.com/javadoc/wicket-extensions/1.4-m2/org/apache/wicket/extensions/markup/html/form/palette/Palette.html>>> model,
> org.apache.wicket.model.IModel<java.util.Collection<? extends T <http://static.ddpoker.com/javadoc/wicket-extensions/1.4-m2/org/apache/wicket/extensions/markup/html/form/palette/Palette.html>>> choicesModel,
> org.apache.wicket.markup.html.form.IChoiceRenderer<T <http://static.ddpoker.com/javadoc/wicket-extensions/1.4-m2/org/apache/wicket/extensions/markup/html/form/palette/Palette.html>> choiceRenderer,
> int rows,
> boolean allowOrder)
>
> *Parameters:*id - Component idmodel - Model representing collection of
> user's selectionschoicesModel - Model representing collection of all
> available choiceschoiceRenderer - Render used to render choices. This must
> use unique IDs for the objects, not the index.rows - Number of choices to
> be visible on the screen with out scrollingallowOrder - Allow user to move
> selections up and down
Using Wicket 1.4, EJB 3, Jboss 5.1 inside of a Liferay Portal environment.
TiA,
Elad Katz.
Re: Problem with Palette
Posted by Eyal Golan <eg...@gmail.com>.
I meant, maybe your choices model is not what you think it is.
I use the Palette in several locations, and didn't have this kind of
problem.
Eyal Golan
egolan74@gmail.com
Visit: http://jvdrums.sourceforge.net/
LinkedIn: http://www.linkedin.com/in/egolan74
P Save a tree. Please don't print this e-mail unless it's really necessary
On Fri, Aug 7, 2009 at 6:06 PM, Elad Katz <el...@xtify.com> wrote:
>
>
> egolan74 wrote:
> >
> > I guess you've checked that selectedEvents is not empty?
> >
> yes, they both have stuff in them
>
>
> egolan74 wrote:
> >
> > If it's not, I think you should check your model representing the
> choices.
> >
> What do you mean check?
>
>
> egolan74 wrote:
> >
> > BTW,
> > AFAIK, the selected choices should be a subset of the 'all available'.
> > Please corect me if i'm wrong.
> >
> That's what I understood from reading the forums, and that is how it's done
> in my implementation - but it still doesn't work
> any other ideas?
> anyone?
> --
> View this message in context:
> http://www.nabble.com/Problem-with-Palette-tp24834525p24866473.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: Problem with Palette
Posted by Igor Vaynberg <ig...@gmail.com>.
if you think something is a bug you are more then welcome to create a
jira issue with an attached quickstart.
-igor
On Tue, Aug 11, 2009 at 7:14 AM, Elad Katz<el...@xtify.com> wrote:
>
> I don't want to nag - but does anyone have any type of lead on this? or
> should i just toss the palette and assume this is a bug in the
> implementation of it?
>
> Elad Katz wrote:
>>
>> Does anybody have any ideas?
>>
>>
>> Elad Katz wrote:
>>>
>>>
>>> egolan74 wrote:
>>>>
>>>> I guess you've checked that selectedEvents is not empty?
>>>>
>>> yes, they both have stuff in them
>>>
>>>
>>> egolan74 wrote:
>>>>
>>>> If it's not, I think you should check your model representing the
>>>> choices.
>>>>
>>> What do you mean check?
>>>
>>>
>>> egolan74 wrote:
>>>>
>>>> BTW,
>>>> AFAIK, the selected choices should be a subset of the 'all available'.
>>>> Please corect me if i'm wrong.
>>>>
>>> That's what I understood from reading the forums, and that is how it's
>>> done in my implementation - but it still doesn't work
>>> any other ideas?
>>> anyone?
>>>
>>
>>
>
> --
> View this message in context: http://www.nabble.com/Problem-with-Palette-tp24834525p24918492.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
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Problem with Palette
Posted by Elad Katz <el...@xtify.com>.
I don't want to nag - but does anyone have any type of lead on this? or
should i just toss the palette and assume this is a bug in the
implementation of it?
Elad Katz wrote:
>
> Does anybody have any ideas?
>
>
> Elad Katz wrote:
>>
>>
>> egolan74 wrote:
>>>
>>> I guess you've checked that selectedEvents is not empty?
>>>
>> yes, they both have stuff in them
>>
>>
>> egolan74 wrote:
>>>
>>> If it's not, I think you should check your model representing the
>>> choices.
>>>
>> What do you mean check?
>>
>>
>> egolan74 wrote:
>>>
>>> BTW,
>>> AFAIK, the selected choices should be a subset of the 'all available'.
>>> Please corect me if i'm wrong.
>>>
>> That's what I understood from reading the forums, and that is how it's
>> done in my implementation - but it still doesn't work
>> any other ideas?
>> anyone?
>>
>
>
--
View this message in context: http://www.nabble.com/Problem-with-Palette-tp24834525p24918492.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: Problem with Palette
Posted by Elad Katz <el...@xtify.com>.
Does anybody have any ideas?
Elad Katz wrote:
>
>
> egolan74 wrote:
>>
>> I guess you've checked that selectedEvents is not empty?
>>
> yes, they both have stuff in them
>
>
> egolan74 wrote:
>>
>> If it's not, I think you should check your model representing the
>> choices.
>>
> What do you mean check?
>
>
> egolan74 wrote:
>>
>> BTW,
>> AFAIK, the selected choices should be a subset of the 'all available'.
>> Please corect me if i'm wrong.
>>
> That's what I understood from reading the forums, and that is how it's
> done in my implementation - but it still doesn't work
> any other ideas?
> anyone?
>
--
View this message in context: http://www.nabble.com/Problem-with-Palette-tp24834525p24902157.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: Problem with Palette
Posted by Elad Katz <el...@xtify.com>.
egolan74 wrote:
>
> I guess you've checked that selectedEvents is not empty?
>
yes, they both have stuff in them
egolan74 wrote:
>
> If it's not, I think you should check your model representing the choices.
>
What do you mean check?
egolan74 wrote:
>
> BTW,
> AFAIK, the selected choices should be a subset of the 'all available'.
> Please corect me if i'm wrong.
>
That's what I understood from reading the forums, and that is how it's done
in my implementation - but it still doesn't work
any other ideas?
anyone?
--
View this message in context: http://www.nabble.com/Problem-with-Palette-tp24834525p24866473.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: Problem with Palette
Posted by Eyal Golan <eg...@gmail.com>.
I guess you've checked that selectedEvents is not empty?
If it's not, I think you should check your model representing the choices.
BTW,
AFAIK, the selected choices should be a subset of the 'all available'.
Please corect me if i'm wrong.
Eyal Golan
egolan74@gmail.com
Visit: http://jvdrums.sourceforge.net/
LinkedIn: http://www.linkedin.com/in/egolan74
P Save a tree. Please don't print this e-mail unless it's really necessary
On Wed, Aug 5, 2009 at 10:18 PM, Elad Katz <el...@xtify.com> wrote:
> Hi all,
> I have a problem with the Palette component:
> I'm using a palette with a model populated by an EJB entity, and I want it
> to show the correct selection status when it is displayed.
> I mean that when the 'edit' button is clicked on a user, the current
> 'event'
> that s\he has selected is shown
> In code:
> The following:
>
> > /*all the events (2) - checked this - it's not null*/
> > List<EventsEntity> events =
> > LookupHelper.getInstance().lookupEventsEntityFacade().findAll();
> > /*selected events for this user (same 2) - checked this - it's
> not
> > null*/
> > List<EventsEntity> selectedEvents = new
> > ArrayList<EventsEntity>(model.getObject().getEvents());
> > IChoiceRenderer<EventsEntity> renderer = new
> > ChoiceRenderer<EventsEntity>("name", "id");
> > palette =
> > new Palette<EventsEntity>("palette",
> > /*Selected Events*/new
> > ListModel<EventsEntity>(selectedEvents),
> > /*unselected*/new CollectionModel<EventsEntity>(events),
> > renderer,
> > 10,
> > false);
> >
> > add(palette);
>
>
>
> > //For debugging purposes:
> > for (Iterator<EventsEntity> it =
> palette.getSelectedChoices();
> > it.hasNext();) {
> > EventsEntity eventsEntity = it.next();
> > log.error("Selected choice: " + eventsEntity.getName());
> > }
>
> Throws an exception saying that the 'palette.getSelectedChoices();'
> returns
> null
> I would expect it to write the selected events to the log...
>
> Am I doing something wrong? did I misunderstand the API?
> it said:
>
> > Palette
> >
> > public *Palette*(java.lang.String id,
> > org.apache.wicket.model.IModel<java.util.Collection<T <
> http://static.ddpoker.com/javadoc/wicket-extensions/1.4-m2/org/apache/wicket/extensions/markup/html/form/palette/Palette.html>>>
> model,
> > org.apache.wicket.model.IModel<java.util.Collection<?
> extends T <
> http://static.ddpoker.com/javadoc/wicket-extensions/1.4-m2/org/apache/wicket/extensions/markup/html/form/palette/Palette.html>>>
> choicesModel,
> > org.apache.wicket.markup.html.form.IChoiceRenderer<T <
> http://static.ddpoker.com/javadoc/wicket-extensions/1.4-m2/org/apache/wicket/extensions/markup/html/form/palette/Palette.html>>
> choiceRenderer,
> > int rows,
> > boolean allowOrder)
> >
> > *Parameters:*id - Component idmodel - Model representing collection of
> > user's selectionschoicesModel - Model representing collection of all
> > available choiceschoiceRenderer - Render used to render choices. This
> must
> > use unique IDs for the objects, not the index.rows - Number of choices to
> > be visible on the screen with out scrollingallowOrder - Allow user to
> move
> > selections up and down
>
> Using Wicket 1.4, EJB 3, Jboss 5.1 inside of a Liferay Portal environment.
> TiA,
> Elad Katz.
>