and i forgot this in the onclick handler :
@Override
protected void onClick() {
         setResponsePage(new HomePage(parameters));
         System.out.println("clicked on link");
}

On 06/30/2010 07:59 PM, Branislav Kalas wrote:
Put this into WicketApplication.java
  @Override
    protected void init() {
        super.init();
        getPageSettings().setAutomaticMultiWindowSupport(true);
    }

Problem was, that you opened new windows in same page map.
I cannot explain it better cause, i don't understand page maps very well...

On 06/30/2010 07:40 PM, Nelson Segura wrote:
I am attaching a Quickstart project to help reproduce the problem.
On the home page, middle click in the email address shown (usually this will take a user to a detail page, but in this case it just prints a message). After that, any click on a link in the page will cause a component not found exception.

Thanks for all your help.

-Nelson



On Wed, Jun 30, 2010 at 9:18 AM, Nelson Segura <nsegu...@gmail.com <mailto:nsegu...@gmail.com>> wrote:

    Can anyone explain to me why this does not work with
    AjaxFallbackDefaultDataTable, but does with DefaultDataTable.
    Does anyone know of a solution for this problem?


    On Mon, Jun 28, 2010 at 6:18 PM, Nelson Segura
    <nsegu...@gmail.com <mailto:nsegu...@gmail.com>> wrote:

        Since AjaxLink is AJAX and not a proper link, then it does
        behave as a normal link, i.e. middle click (open link in new
        tab or new window) does not trigger the AJAX click even,
        which means you cannot chose to open the link in a new page.

        back to square one, except that know I know is a problem with
        AjaxFallbackDefaultDataTable, not with DataTable.


        -Nelson


        On Mon, Jun 28, 2010 at 5:47 PM, Nelson Segura
        <nsegu...@gmail.com <mailto:nsegu...@gmail.com>> wrote:

            Jeremy, the code is below.

            I did notice something while researching/testing more.
            The LinkPanel solution DOES work for a DataTable. The
            problem starts when changed to a
            AjaxFallbackDefaultDataTable.
            I did testing based in the datatable example in the
            wicket examples.
            Maybe using an AjaxLink instead of a normal link in the
            table is the right answer.


            Code is mostly taken from the page linked in the original
            email

            public abstract class LinkPanel<T> extends Panel {

                private static final long serialVersionUID =
            2062173455224348354L;

                public LinkPanel(final Item<?> item, final String
            componentId,
                        final IModel<T> model, final String property) {
                    super(componentId, model);

                    AjaxLink<T> link = new AjaxLink<T>("linkCell") {

                        private static final long serialVersionUID =
            2574434147588617330L;

                        @Override
                        public void onClick(AjaxRequestTarget target) {
                            LinkPanel.this.onClick();
                        }


                    };
                    add(link);
                    link.add(new Label("label", new
            PropertyModel(model,property)));
                }

                protected abstract void onClick();
            }

            ----------------- Usage ---------------

            public class LinkPanelPage extends WebPage {

                public LinkPanelPage() {
            Form form = new Form("form");
                    final LinkPanelListProvider provider = new
            LinkPanelListProvider();
                    List<IColumn> columnList = new ArrayList<IColumn>(3);
                    //columnList.add(new PropertyColumn(new
            Model("eMailAddress"),"eMailAddress"));
                    columnList.add(new AbstractColumn(new
            Model("eMailAddress"), "eMailAddress") {
                        private static final long serialVersionUID =
            -1822504503325964706L;

                        @Override
                        @SuppressWarnings("unchecked")
                        public void populateItem(Item cellItem,
            String componentId, final IModel rowModel) {
                            cellItem.add(new LinkPanel(cellItem,
            componentId, rowModel, getSortProperty()) {

                                private static final long
            serialVersionUID = -4615958634366803506L;

                                @Override
                                protected void onClick() {
                                    System.out.println("clicked on
            link");
                                }
                            });
                        }

                    });

                    columnList.add(new PropertyColumn(new
            Model("firstName"),"firstName"));
                    columnList.add(new PropertyColumn(new
            Model("lastName"),"lastName"));
                    AjaxFallbackDefaultDataTable table = new
            AjaxFallbackDefaultDataTable("link-panel-table",
            columnList, provider, 3);
                    form.add(table);
                    add(form);
            }
            }

            -Nelson


            On Mon, Jun 28, 2010 at 5:14 PM, Jeremy Thomerson
            <jer...@wickettraining.com
            <mailto:jer...@wickettraining.com>> wrote:

                please show some code

                On Mon, Jun 28, 2010 at 6:39 PM, Nelson Segura
                <nsegu...@gmail.com <mailto:nsegu...@gmail.com>> wrote:

                > I am trying to create a table based on DataTable,
                in which one of the
                > columns has links on it.
                > I tried to use the strategy described here (LinkPanel):
                >
                >
                
https://cwiki.apache.org/WICKET/adding-links-in-a-defaultdatatable.html
                >
                > But this has a problem: clicking in the links in
                succession soon causes
                > "component not found exceptions", or opening the
                link in a new window or
                > tab
                > renders the current page unusable, with the same
                exception.
                >
                > rg.apache.wicket.WicketRuntimeException: component
                ..... not found on page
                > ...
                >     at
                >
                
org.apache.wicket.request.AbstractRequestCycleProcessor.resolveListenerInterfaceTarget(AbstractRequestCycleProcessor.java:426)
                >     at
                >
                
org.apache.wicket.request.AbstractRequestCycleProcessor.resolveRenderedPage(AbstractRequestCycleProcessor.java:471)
                >     at
                >
                
org.apache.wicket.protocol.http.WebRequestCycleProcessor.resolve(WebRequestCycleProcessor.java:144)
                >     at
                org.apache.wicket.RequestCycle.step(RequestCycle.java:1310)
                > ...
                >
                > I believe this is due to the fact that a new
                LinkPanel is created when
                > rendering each column cell, and that when the click
                happens, the current
                > LinkPanels are replaced by new ones, and so the
                original page is not usable
                > anymore, because it is referring to the original
                LinkPanels.
                >
                > Our users make heavy use of opening links in a list
                in new pages or tabs,
                > so
                > this is a big deal for us :(
                >
                > Is there any solution for this problem? The only
                one I can think of is to
                > use AjaxLink instead, but I am not sure whether
                that is correct, or if it
                > could cause even more problems.
                >
                > Any help?
                >
                > -Nelson
                >



                --
                Jeremy Thomerson
                http://www.wickettraining.com







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


Reply via email to