You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Rangel Preis <ra...@gmail.com> on 2009/06/22 21:08:30 UTC
How to add filter to palette component?
Hi, how can i filter the possible choices in the palette component i
read the topics below put it not helpful for me.
http://www.nabble.com/how-to-add-filter-for-Palette-choice-td23269578.html#a23269578
http://www.nabble.com/changing-choices-component-in-Palette-td23982514.html#a23982514
I have this:
final IChoiceRenderer<String> renderer = new
ChoiceRenderer<String>("name", "name");
form.add(new Palette("paletteDiretores", selectedItens,
availableItens, renderer, 10, true));
And a button:
AjaxLink btFilterPaletteContent = new AjaxLink("btFilterPaletteContent"){
@Override
public void onClick(AjaxRequestTarget target) {
availableItens = search new itens....
}
};
I try this and don't work, if i inspect the objet the value is OK, but
in the screen the palette become blank.
i try to use propertymodel to avaliableitens... don't work too..
I just want to chance the content of the avaliable itens in the panel
without affect the selecteds itens.
Anyone can help me?
Thanks.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: How to add filter to palette component?
Posted by Eyal Golan <eg...@gmail.com>.
I've just noticed.
I also added this:
palette.setOutputMarkupId(true);
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 Tue, Jun 23, 2009 at 8:58 PM, Rangel Preis <ra...@gmail.com> wrote:
> Golan... the object have the correct value in code, but in the page it's
> blank.
>
> 2009/6/23 Eyal Golan <eg...@gmail.com>:
> > It looks just like what I did.
> > Did you break-point at
> > public Object getObject() {
> > return this.avaliableList;
> > }
> >
> > ?
> >
> > or at avaliableList = getNewList();
> >
> > Is the list full?
> >
> > Maybe you should try AjaxSubmitLink (Just a thought. I don't use it that
> > often)?
> >
> >
> > 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
> >
> >
> >
> >>
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
Re: How to add filter to palette component?
Posted by Eyal Golan <eg...@gmail.com>.
BTW, here the whole code of the palette creationg:
private CustomPalette newSelectedSection(final Form form) {
final RolesCoverageDasboard rolesCoverageDasboard =
(RolesCoverageDasboard) getModelObject();
final IChoiceRenderer choiceRenderer = new
ChoiceRenderer("getConfigurationName", "getConfigurationName");
final IModel allConfigurationsModel = new AbstractReadOnlyModel() {
// Model for choices
private static final long serialVersionUID = 1L;
@Override
public Object getObject() {
final List<Configuration> allConfigsFromMap;
if (rolesCoverageDasboard.getUniverse() == null) {
allConfigsFromMap = Collections.emptyList();
return allConfigsFromMap;
}
allConfigsFromMap =
universesConfigurationsMap.get(rolesCoverageDasboard.getUniverse());
final List<Configuration> configsForPalette = new
ArrayList<Configuration>(allConfigsFromMap);
configsForPalette.remove(rolesCoverageDasboard.getMainConfiguration());
return configsForPalette;
}
};
final CustomPalette palette = new CustomPalette("palette", new
PropertyModel(rolesCoverageDasboard,
"comparedConfigurations"), allConfigurationsModel,
choiceRenderer, 10, true);
palette.setOutputMarkupId(true);
form.add(palette);
return palette;
}
It is very similar to yours. (list etc.)
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
Re: How to add filter to palette component?
Posted by Rangel Preis <ra...@gmail.com>.
Golan... the object have the correct value in code, but in the page it's blank.
2009/6/23 Eyal Golan <eg...@gmail.com>:
> It looks just like what I did.
> Did you break-point at
> public Object getObject() {
> return this.avaliableList;
> }
>
> ?
>
> or at avaliableList = getNewList();
>
> Is the list full?
>
> Maybe you should try AjaxSubmitLink (Just a thought. I don't use it that
> often)?
>
>
> 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
>
>
>
>>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: How to add filter to palette component?
Posted by Eyal Golan <eg...@gmail.com>.
It looks just like what I did.
Did you break-point at
public Object getObject() {
return this.avaliableList;
}
?
or at avaliableList = getNewList();
Is the list full?
Maybe you should try AjaxSubmitLink (Just a thought. I don't use it that
often)?
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
>
Re: How to add filter to palette component?
Posted by Rangel Preis <ra...@gmail.com>.
Thanks Fernando and Eyal.
But it's not work.
I try the code below, when I change the value of avaliable itens the
itens in the screen became blank , and don't show the new value.
Custem Palette
class MyPalette extends Palette {
private Component externalizedChoiceComponent;
@Override
protected Component newChoicesComponent() {
final Component result = super.newChoicesComponent();
this.externalizedChoiceComponent = result;
this.externalizedChoiceComponent.setOutputMarkupId(true);
return result;
}
public Component getExternalizedChoiceComponent() {
return this.externalizedChoiceComponent;
}
}
final IModel avaliableModel = new AbstractReadOnlyModel() {
@Override
public Object getObject() {
return this.avaliableList;
}
};
Palette creation
final MyPalette palette = new MyPalette("palette", inUseModel,
avaliableModel, renderer, 10, true);
this.form.add(new AjaxLink("btFind") {
@Override
public void onClick(final AjaxRequestTarget target) {
try {
avaliableList = getNewList();
} catch (final Exception e) {
log.error(e);
}
target.addComponent(palette.getExternalizedChoiceComponent());
}
});
Anyone have another tip?
Thanks.
2009/6/23 Eyal Golan <eg...@gmail.com>:
> Here what I did:
> choiceComponent in the original Palette is private, so in my custom palette
> I externalized it:
>
> private Component externalizedChoiceComponent;
>
> Then, I overridden the method newChoicesComponent :
> @Override
> protected Component newChoicesComponent() {
> final Component result = super.newChoicesComponent();
> externalizedChoiceComponent = result;
> externalizedChoiceComponent.setOutputMarkupId(true);
> return result;
> }
>
> public Component getExternalizedChoiceComponent() {
> return this.externalizedChoiceComponent;
> }
>
> My situation was that I wanted to change the choices with a DropDown
> component.
> We have a custom DropDown that is ajaxified:
> final DropDownChoice configurationChoice = new
> DropDownChoiceWithAjaxIndicator("mainConfiguration",
> getConfigurationsModel(), new
> ChoiceRenderer("configurationName", "configurationName")) {
> private static final long serialVersionUID = 1L;
>
> @Override
> public void updateOnChange(AjaxRequestTarget target) {
>
> target.addComponent(palette.getExternalizedChoiceComponent());
> }
> };
>
> Below is the IModel for the palette that needs to be changed:
> final IModel allConfigurationsModel = new AbstractReadOnlyModel() {
> private static final long serialVersionUID = 1L;
>
> @Override
> public Object getObject() {
> // Do whatever you want to get the correct choices
> }
> };
> And this is the Palette creation:
> final CustomPalette palette = new CustomPalette("palette", new
> PropertyModel(rolesCoverageDasboard,
> "comparedConfigurations"), allConfigurationsModel,
> choiceRenderer, 10, true);
>
> Is this what you need?
>
> BTW,
> I think I'll have a look at the Recorder, though I'm not sure I can use it.
>
> Maybe we should open a JIRA to have getChoicesComponent() in the Palette?
> (we use 1.3.6)
>
> 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 Mon, Jun 22, 2009 at 11:57 PM, Rangel Preis <ra...@gmail.com> wrote:
>
>> Sorry Fernando but it's not helpful.
>>
>> When i click in my search button (a button out of palette) i want to
>> change all data from the left side of palette (Available itens).
>> I don't want to interact with the palette buttons i want to use a
>> button out of the component.
>>
>> Using
>> PropertyModel availableItens = new PropertyModel(this, "listDirector");
>> or
>> Model availableItens = new Model<Serializable>((Serializable)
>> this.listDirector);
>>
>> ......
>>
>> form.add(new Palette("palette", selectedItens, availableItens,
>> renderer, 10, true));
>>
>> form.add(new(AjaxLink btFilterPaletteContent = new
>> AjaxLink("btFilterPaletteContent"){
>>
>> @Override
>> public void onClick(AjaxRequestTarget target) {
>> What i can put here to change my avaliable itens (the palette left
>> list)?
>> target.addComponent(this.form);
>> }
>> };)
>>
>>
>>
>>
>> 2009/6/22 Fernando Wermus <fe...@gmail.com>:
>> > If I understood correctly you would want to do this (which It can be
>> found
>> > at Palette comments at the begining)
>> >
>> > <strong>Ajaxifying the palette</strong>: The palette itself cannot be
>> > ajaxified because it is a
>> > panel and therefore does not receive any javascript events. Instead ajax
>> > behaviors can be
>> > attached to the recorder component which supports the javascript
>> > <code>onchange</code> event. The
>> > recorder component can be retrieved via a call to {@link
>> > #getRecorderComponent()}.
>> >
>> > Example:
>> >
>> > <pre>
>> > Form form=new Form(...);
>> > Palette palette=new Palette(...);
>> > palette.getRecorderComponent().add(new
>> > AjaxFormComponentUpdatingBehavior("onchange") {...});
>> >
>> > Then when someone click in any of the buttons you can take a decision
>> over
>> > the selected items or choiced items. You can do this without ajax
>> replacing
>> > the newUp, new newDown protected methods.
>> >
>> > I hope I help you a bit.
>> >
>> > On Mon, Jun 22, 2009 at 12:08 PM, Rangel Preis <ra...@gmail.com>
>> wrote:
>> >
>> >> Hi, how can i filter the possible choices in the palette component i
>> >> read the topics below put it not helpful for me.
>> >>
>> >>
>> >>
>> http://www.nabble.com/how-to-add-filter-for-Palette-choice-td23269578.html#a23269578
>> >>
>> >>
>> http://www.nabble.com/changing-choices-component-in-Palette-td23982514.html#a23982514
>> >>
>> >> I have this:
>> >>
>> >> final IChoiceRenderer<String> renderer = new
>> >> ChoiceRenderer<String>("name", "name");
>> >> form.add(new Palette("paletteDiretores", selectedItens,
>> >> availableItens, renderer, 10, true));
>> >>
>> >> And a button:
>> >>
>> >> AjaxLink btFilterPaletteContent = new
>> AjaxLink("btFilterPaletteContent"){
>> >>
>> >> @Override
>> >> public void onClick(AjaxRequestTarget target) {
>> >> availableItens = search new itens....
>> >> }
>> >> };
>> >>
>> >> I try this and don't work, if i inspect the objet the value is OK, but
>> >> in the screen the palette become blank.
>> >>
>> >> i try to use propertymodel to avaliableitens... don't work too..
>> >> I just want to chance the content of the avaliable itens in the panel
>> >> without affect the selecteds itens.
>> >>
>> >> Anyone can help me?
>> >>
>> >> Thanks.
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> >> For additional commands, e-mail: users-help@wicket.apache.org
>> >>
>> >>
>> >
>> >
>> > --
>> > Fernando Wermus.
>> >
>> > www.linkedin.com/in/fernandowermus
>> >
>>
>> ---------------------------------------------------------------------
>> 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 add filter to palette component?
Posted by Eyal Golan <eg...@gmail.com>.
Here what I did:
choiceComponent in the original Palette is private, so in my custom palette
I externalized it:
private Component externalizedChoiceComponent;
Then, I overridden the method newChoicesComponent :
@Override
protected Component newChoicesComponent() {
final Component result = super.newChoicesComponent();
externalizedChoiceComponent = result;
externalizedChoiceComponent.setOutputMarkupId(true);
return result;
}
public Component getExternalizedChoiceComponent() {
return this.externalizedChoiceComponent;
}
My situation was that I wanted to change the choices with a DropDown
component.
We have a custom DropDown that is ajaxified:
final DropDownChoice configurationChoice = new
DropDownChoiceWithAjaxIndicator("mainConfiguration",
getConfigurationsModel(), new
ChoiceRenderer("configurationName", "configurationName")) {
private static final long serialVersionUID = 1L;
@Override
public void updateOnChange(AjaxRequestTarget target) {
target.addComponent(palette.getExternalizedChoiceComponent());
}
};
Below is the IModel for the palette that needs to be changed:
final IModel allConfigurationsModel = new AbstractReadOnlyModel() {
private static final long serialVersionUID = 1L;
@Override
public Object getObject() {
// Do whatever you want to get the correct choices
}
};
And this is the Palette creation:
final CustomPalette palette = new CustomPalette("palette", new
PropertyModel(rolesCoverageDasboard,
"comparedConfigurations"), allConfigurationsModel,
choiceRenderer, 10, true);
Is this what you need?
BTW,
I think I'll have a look at the Recorder, though I'm not sure I can use it.
Maybe we should open a JIRA to have getChoicesComponent() in the Palette?
(we use 1.3.6)
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 Mon, Jun 22, 2009 at 11:57 PM, Rangel Preis <ra...@gmail.com> wrote:
> Sorry Fernando but it's not helpful.
>
> When i click in my search button (a button out of palette) i want to
> change all data from the left side of palette (Available itens).
> I don't want to interact with the palette buttons i want to use a
> button out of the component.
>
> Using
> PropertyModel availableItens = new PropertyModel(this, "listDirector");
> or
> Model availableItens = new Model<Serializable>((Serializable)
> this.listDirector);
>
> ......
>
> form.add(new Palette("palette", selectedItens, availableItens,
> renderer, 10, true));
>
> form.add(new(AjaxLink btFilterPaletteContent = new
> AjaxLink("btFilterPaletteContent"){
>
> @Override
> public void onClick(AjaxRequestTarget target) {
> What i can put here to change my avaliable itens (the palette left
> list)?
> target.addComponent(this.form);
> }
> };)
>
>
>
>
> 2009/6/22 Fernando Wermus <fe...@gmail.com>:
> > If I understood correctly you would want to do this (which It can be
> found
> > at Palette comments at the begining)
> >
> > <strong>Ajaxifying the palette</strong>: The palette itself cannot be
> > ajaxified because it is a
> > panel and therefore does not receive any javascript events. Instead ajax
> > behaviors can be
> > attached to the recorder component which supports the javascript
> > <code>onchange</code> event. The
> > recorder component can be retrieved via a call to {@link
> > #getRecorderComponent()}.
> >
> > Example:
> >
> > <pre>
> > Form form=new Form(...);
> > Palette palette=new Palette(...);
> > palette.getRecorderComponent().add(new
> > AjaxFormComponentUpdatingBehavior("onchange") {...});
> >
> > Then when someone click in any of the buttons you can take a decision
> over
> > the selected items or choiced items. You can do this without ajax
> replacing
> > the newUp, new newDown protected methods.
> >
> > I hope I help you a bit.
> >
> > On Mon, Jun 22, 2009 at 12:08 PM, Rangel Preis <ra...@gmail.com>
> wrote:
> >
> >> Hi, how can i filter the possible choices in the palette component i
> >> read the topics below put it not helpful for me.
> >>
> >>
> >>
> http://www.nabble.com/how-to-add-filter-for-Palette-choice-td23269578.html#a23269578
> >>
> >>
> http://www.nabble.com/changing-choices-component-in-Palette-td23982514.html#a23982514
> >>
> >> I have this:
> >>
> >> final IChoiceRenderer<String> renderer = new
> >> ChoiceRenderer<String>("name", "name");
> >> form.add(new Palette("paletteDiretores", selectedItens,
> >> availableItens, renderer, 10, true));
> >>
> >> And a button:
> >>
> >> AjaxLink btFilterPaletteContent = new
> AjaxLink("btFilterPaletteContent"){
> >>
> >> @Override
> >> public void onClick(AjaxRequestTarget target) {
> >> availableItens = search new itens....
> >> }
> >> };
> >>
> >> I try this and don't work, if i inspect the objet the value is OK, but
> >> in the screen the palette become blank.
> >>
> >> i try to use propertymodel to avaliableitens... don't work too..
> >> I just want to chance the content of the avaliable itens in the panel
> >> without affect the selecteds itens.
> >>
> >> Anyone can help me?
> >>
> >> Thanks.
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >> For additional commands, e-mail: users-help@wicket.apache.org
> >>
> >>
> >
> >
> > --
> > Fernando Wermus.
> >
> > www.linkedin.com/in/fernandowermus
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
Re: How to add filter to palette component?
Posted by Rangel Preis <ra...@gmail.com>.
Sorry Fernando but it's not helpful.
When i click in my search button (a button out of palette) i want to
change all data from the left side of palette (Available itens).
I don't want to interact with the palette buttons i want to use a
button out of the component.
Using
PropertyModel availableItens = new PropertyModel(this, "listDirector");
or
Model availableItens = new Model<Serializable>((Serializable)
this.listDirector);
......
form.add(new Palette("palette", selectedItens, availableItens,
renderer, 10, true));
form.add(new(AjaxLink btFilterPaletteContent = new
AjaxLink("btFilterPaletteContent"){
@Override
public void onClick(AjaxRequestTarget target) {
What i can put here to change my avaliable itens (the palette left list)?
target.addComponent(this.form);
}
};)
2009/6/22 Fernando Wermus <fe...@gmail.com>:
> If I understood correctly you would want to do this (which It can be found
> at Palette comments at the begining)
>
> <strong>Ajaxifying the palette</strong>: The palette itself cannot be
> ajaxified because it is a
> panel and therefore does not receive any javascript events. Instead ajax
> behaviors can be
> attached to the recorder component which supports the javascript
> <code>onchange</code> event. The
> recorder component can be retrieved via a call to {@link
> #getRecorderComponent()}.
>
> Example:
>
> <pre>
> Form form=new Form(...);
> Palette palette=new Palette(...);
> palette.getRecorderComponent().add(new
> AjaxFormComponentUpdatingBehavior("onchange") {...});
>
> Then when someone click in any of the buttons you can take a decision over
> the selected items or choiced items. You can do this without ajax replacing
> the newUp, new newDown protected methods.
>
> I hope I help you a bit.
>
> On Mon, Jun 22, 2009 at 12:08 PM, Rangel Preis <ra...@gmail.com> wrote:
>
>> Hi, how can i filter the possible choices in the palette component i
>> read the topics below put it not helpful for me.
>>
>>
>> http://www.nabble.com/how-to-add-filter-for-Palette-choice-td23269578.html#a23269578
>>
>> http://www.nabble.com/changing-choices-component-in-Palette-td23982514.html#a23982514
>>
>> I have this:
>>
>> final IChoiceRenderer<String> renderer = new
>> ChoiceRenderer<String>("name", "name");
>> form.add(new Palette("paletteDiretores", selectedItens,
>> availableItens, renderer, 10, true));
>>
>> And a button:
>>
>> AjaxLink btFilterPaletteContent = new AjaxLink("btFilterPaletteContent"){
>>
>> @Override
>> public void onClick(AjaxRequestTarget target) {
>> availableItens = search new itens....
>> }
>> };
>>
>> I try this and don't work, if i inspect the objet the value is OK, but
>> in the screen the palette become blank.
>>
>> i try to use propertymodel to avaliableitens... don't work too..
>> I just want to chance the content of the avaliable itens in the panel
>> without affect the selecteds itens.
>>
>> Anyone can help me?
>>
>> Thanks.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>
>
> --
> Fernando Wermus.
>
> www.linkedin.com/in/fernandowermus
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: How to add filter to palette component?
Posted by Fernando Wermus <fe...@gmail.com>.
If I understood correctly you would want to do this (which It can be found
at Palette comments at the begining)
<strong>Ajaxifying the palette</strong>: The palette itself cannot be
ajaxified because it is a
panel and therefore does not receive any javascript events. Instead ajax
behaviors can be
attached to the recorder component which supports the javascript
<code>onchange</code> event. The
recorder component can be retrieved via a call to {@link
#getRecorderComponent()}.
Example:
<pre>
Form form=new Form(...);
Palette palette=new Palette(...);
palette.getRecorderComponent().add(new
AjaxFormComponentUpdatingBehavior("onchange") {...});
Then when someone click in any of the buttons you can take a decision over
the selected items or choiced items. You can do this without ajax replacing
the newUp, new newDown protected methods.
I hope I help you a bit.
On Mon, Jun 22, 2009 at 12:08 PM, Rangel Preis <ra...@gmail.com> wrote:
> Hi, how can i filter the possible choices in the palette component i
> read the topics below put it not helpful for me.
>
>
> http://www.nabble.com/how-to-add-filter-for-Palette-choice-td23269578.html#a23269578
>
> http://www.nabble.com/changing-choices-component-in-Palette-td23982514.html#a23982514
>
> I have this:
>
> final IChoiceRenderer<String> renderer = new
> ChoiceRenderer<String>("name", "name");
> form.add(new Palette("paletteDiretores", selectedItens,
> availableItens, renderer, 10, true));
>
> And a button:
>
> AjaxLink btFilterPaletteContent = new AjaxLink("btFilterPaletteContent"){
>
> @Override
> public void onClick(AjaxRequestTarget target) {
> availableItens = search new itens....
> }
> };
>
> I try this and don't work, if i inspect the objet the value is OK, but
> in the screen the palette become blank.
>
> i try to use propertymodel to avaliableitens... don't work too..
> I just want to chance the content of the avaliable itens in the panel
> without affect the selecteds itens.
>
> Anyone can help me?
>
> Thanks.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
--
Fernando Wermus.
www.linkedin.com/in/fernandowermus