You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Bruce McGuire <br...@coastware.com> on 2008/03/20 19:33:08 UTC

Listview hierarchy problem

Hello.

 

I have a panel that contains a form, which contains a list view with two
items, a label and a button. I have tried a gajillion different
combinations, but I keep getting the "unable to find component" error.

 

Any hints that you can provide would be HUGELY appreciated.

 

The panel markup is:

            <wicket:panel>

                  <form wicket:id="prf">

                        <div wicket:id="uPages">

                              <span wicket:id="pn"></span>

                              <input wicket:id="rmvPage" type="submit"
value="Remove" />

                        </div>

                  </form>

                  <form wicket:id="paf">

                        <input wicket:id="name" type="text"></input>

                        <input wicket:id="addPage" type="submit" value="Add
Page" />

                  </form>

            </wicket:panel>

 

The code for the panel and so on is:

      public PageManagePanel(String id)

      {

            super(id) ;

            add(new PageRemoveForm("prf"));

            add(new PageAddForm("paf")) ;

      }

 

PageRemoveForm:

      public PageRemoveForm(String id)

      {

            super(id, Page.class);

 

            uPages = Utility.getUnassignedPages() ;

            unassignedPages = new ListView("uPages", uPages)

            {

                  private static final long serialVersionUID = 200803188L;

 

                  protected void populateItem(ListItem listItem)

                  {

                        final Page curPage = (Page)listItem.getModelObject()
;

                        Label pn = new Label("pn", curPage.getName()) ;

                        Button rp = new Button("rmvPage")

                        {

                              private static final long serialVersionUID =
20080319L;

                              public void onSubmit()

                              {

                                    Utility.removePage(curPage);

                              }

                        };

 

                        add(pn) ;

                        add(rp) ;

                  }

 

                  public boolean isVisible()

                  {

                        if (uPages.isEmpty())

                        {

                              return (false) ;

                        }

                        return (true);

                  }

            };

 

            add(unassignedPages) ;

      }

 

PageAddForm:

      public PageAddForm(String id)

      {

            super(id, Page.class);

 

            newPage = new TextField("name") ;

            addPage = new Button("addPage") ;

 

            add(newPage) ;

            add(addPage) ;

      }

 

      @Override

      protected void onSubmit()

      {

            super.onSubmit() ;

            clearPersistentObject() ;

      }

 


RE: AjaxEventBehavior never being called

Posted by Michael Mehrle <mi...@ask.com>.
Never mind - not sure what I was thinking.... needed to name the JS
event properly.

Michael

-----Original Message-----
From: Michael Mehrle [mailto:michael.mehrle@ask.com] 
Sent: Thursday, March 20, 2008 1:06 PM
To: users@wicket.apache.org
Subject: AjaxEventBehavior never being called

I've got an inner subclass of Radio:

private class FooRadio extends Radio {

            public FooRadio (String id, IModel model) {
                super(id, model);
                setOutputMarkupId(true);
                add(new AjaxEventBehavior(new
StringBuffer(id).append("onChange").toString()) {
                
                    @Override
                    protected void onEvent(AjaxRequestTarget target) {

                        group.processInput();               
                    }    
                });
            }    
        }

For some reason onEvent is never being called. When I tag the event
behavior to a vanilla Radio component it's being called. Am I forgetting
something?

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


AjaxEventBehavior never being called

Posted by Michael Mehrle <mi...@ask.com>.
I've got an inner subclass of Radio:

private class FooRadio extends Radio {

            public FooRadio (String id, IModel model) {
                super(id, model);
                setOutputMarkupId(true);
                add(new AjaxEventBehavior(new
StringBuffer(id).append("onChange").toString()) {
                
                    @Override
                    protected void onEvent(AjaxRequestTarget target) {

                        group.processInput();               
                    }    
                });
            }    
        }

For some reason onEvent is never being called. When I tag the event
behavior to a vanilla Radio component it's being called. Am I forgetting
something?

Michael
	


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


Re: Listview hierarchy problem

Posted by Igor Vaynberg <ig...@gmail.com>.
should be listItem.add(pn/rp)

also in the future it helps a lot if you paste the stacktrace

-igor


On Thu, Mar 20, 2008 at 11:33 AM, Bruce McGuire <br...@coastware.com> wrote:
> Hello.
>
>
>
>  I have a panel that contains a form, which contains a list view with two
>  items, a label and a button. I have tried a gajillion different
>  combinations, but I keep getting the "unable to find component" error.
>
>
>
>  Any hints that you can provide would be HUGELY appreciated.
>
>
>
>  The panel markup is:
>
>             <wicket:panel>
>
>                   <form wicket:id="prf">
>
>                         <div wicket:id="uPages">
>
>                               <span wicket:id="pn"></span>
>
>                               <input wicket:id="rmvPage" type="submit"
>  value="Remove" />
>
>                         </div>
>
>                   </form>
>
>                   <form wicket:id="paf">
>
>                         <input wicket:id="name" type="text"></input>
>
>                         <input wicket:id="addPage" type="submit" value="Add
>  Page" />
>
>                   </form>
>
>             </wicket:panel>
>
>
>
>  The code for the panel and so on is:
>
>       public PageManagePanel(String id)
>
>       {
>
>             super(id) ;
>
>             add(new PageRemoveForm("prf"));
>
>             add(new PageAddForm("paf")) ;
>
>       }
>
>
>
>  PageRemoveForm:
>
>       public PageRemoveForm(String id)
>
>       {
>
>             super(id, Page.class);
>
>
>
>             uPages = Utility.getUnassignedPages() ;
>
>             unassignedPages = new ListView("uPages", uPages)
>
>             {
>
>                   private static final long serialVersionUID = 200803188L;
>
>
>
>                   protected void populateItem(ListItem listItem)
>
>                   {
>
>                         final Page curPage = (Page)listItem.getModelObject()
>  ;
>
>                         Label pn = new Label("pn", curPage.getName()) ;
>
>                         Button rp = new Button("rmvPage")
>
>                         {
>
>                               private static final long serialVersionUID =
>  20080319L;
>
>                               public void onSubmit()
>
>                               {
>
>                                     Utility.removePage(curPage);
>
>                               }
>
>                         };
>
>
>
>                         add(pn) ;
>
>                         add(rp) ;
>
>                   }
>
>
>
>                   public boolean isVisible()
>
>                   {
>
>                         if (uPages.isEmpty())
>
>                         {
>
>                               return (false) ;
>
>                         }
>
>                         return (true);
>
>                   }
>
>             };
>
>
>
>             add(unassignedPages) ;
>
>       }
>
>
>
>  PageAddForm:
>
>       public PageAddForm(String id)
>
>       {
>
>             super(id, Page.class);
>
>
>
>             newPage = new TextField("name") ;
>
>             addPage = new Button("addPage") ;
>
>
>
>             add(newPage) ;
>
>             add(addPage) ;
>
>       }
>
>
>
>       @Override
>
>       protected void onSubmit()
>
>       {
>
>             super.onSubmit() ;
>
>             clearPersistentObject() ;
>
>       }
>
>
>
>

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