I keep a little library of these (LinkPanel, BookmarkablePageLinkPanel,
etc.) that are all just a link containing a label. It would be nice if
they were part of Wicket proper. Does anyone else think so?
jk
On Thu, Sep 25, 2008 at 12:10:17PM +0200, Nino Saturnino Martinez Vazquez Wael
wrote:
> I did it once this way:
>
>
> AjaxLinkPanel.java
>
> public abstract class AjaxLinkPanel extends Panel {
> public AjaxLinkPanel(String id, String title) {
> super(id);
> AjaxLink link = new AjaxLink("ajaxLink") {
> @Override
> public void onClick(AjaxRequestTarget target) {
> onClicked(target);
> }
> };
> link.add(new Label("title",title));
> add(link);
>
> }
>
> protected abstract void onClicked(AjaxRequestTarget target);
>
> }
>
> AjaxLinkPanel.html
> <wicket:panel>
>
> <a href="#" wicket:id="ajaxLink" class="button"><span
> wicket:id="title"></span></a>
>
> <wicket:child />
> </wicket:panel>
>
>
> AjaxFallbackDefaultDataTable
>
> columns
> .add(new AbstractColumn(new
> StringResourceModel("action", null)) {
> public void populateItem(Item cellItem, String
> componentId,
> IModel model) {
> ....
> ...
> }
> };
> cellItem.add(link);
> }
> });
>
>
>
>
> Alexandre Lenoir wrote:
> >You can create your own component that involves many subcomponents and add
> >it to your datatable. Too simple?
> >
> >On Thu, Sep 25, 2008 at 11:28 AM, Nino Saturnino Martinez Vazquez Wael <
> >[EMAIL PROTECTED]> wrote:
> >
> >
> >>Do it as a panel..?
> >>
> >>
> >>Edgar Merino wrote:
> >>
> >>
> >>>Hello,
> >>>
> >>> I've got a DataTable that needs to add to each of its Items a Link and
> >>> a
> >>>Label, since I've only get one componentId from the populateItem(Item
> >>>cellItem, String componentId, IModel model) method, I don't know what to
> >>>do
> >>>to be able to accomplish what I need.
> >>>
> >>> This is what I need:
> >>>
> >>>public void populateItem(Item cellItem, String componentId, IModel model)
> >>>{
> >>> Link link = new Link(componentId) {
> >>> public void onClick() {
> >>> //do Something
> >>> }
> >>> }
> >>> link.add(new Label("WHAT SHOULD I PUT HERE"), "label");
> >>>
> >>> cellItem.add(link);
> >>>}
> >>>
> >>> I hope someone can give me a hint on what to do, thank you in advance.
> >>>
> >>>Edgar Merino
> >>>
> >>>---------------------------------------------------------------------
> >>>To unsubscribe, e-mail: [EMAIL PROTECTED]
> >>>For additional commands, e-mail: [EMAIL PROTECTED]
> >>>
> >>>
> >>>
> >>--
> >>-Wicket for love
> >>
> >>Nino Martinez Wael
> >>Java Specialist @ Jayway DK
> >>http://www.jayway.dk
> >>+45 2936 7684
> >>
> >>
> >>
> >>---------------------------------------------------------------------
> >>To unsubscribe, e-mail: [EMAIL PROTECTED]
> >>For additional commands, e-mail: [EMAIL PROTECTED]
> >>
> >>
> >>
> >
> >
>
> --
> -Wicket for love
>
> Nino Martinez Wael
> Java Specialist @ Jayway DK
> http://www.jayway.dk
> +45 2936 7684
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]