You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Kugaprakash Visagamani <kv...@infoblox.com> on 2009/08/01 04:56:35 UTC

Issue with AjaxLinks in ListView

Hi,

I have a page that has a panel with ListView<AjaxLink> (Listview
contains AjaxLink's).

 

I go to that page, click on a links - does an ajax update of one section
in a page, and then I do a target.addComponent(listViewPanel) to update
the link selection background. This works fine so far. 

 

Now I click on the second link in that listview, I am getting the below
exception:

 

org.apache.wicket.WicketRuntimeException: component
heading:menu:subMenuBar:topmenuitems:2:menuitemfragment:linkfragment:lin
kid not found on page
com.infoblox.nios.ui.page.datamgt.DataManagePage[id = 3], listener
interface = [RequestListenerInterface name=IBehaviorListener,
method=public abstract void
org.apache.wicket.behavior.IBehaviorListener.onRequest()]

      at
org.apache.wicket.request.AbstractRequestCycleProcessor.resolveListenerI
nterfaceTarget(AbstractRequestCycleProcessor.java:416)

      at
org.apache.wicket.request.AbstractRequestCycleProcessor.resolveRenderedP
age(AbstractRequestCycleProcessor.java:461)

      at
org.apache.wicket.protocol.http.WebRequestCycleProcessor.resolve(WebRequ
estCycleProcessor.java:139)

      at
com.infoblox.nios.app.NiosApplication$RedirectRequestCycleProcess.resolv
e(MYApplication.java:232)

      at org.apache.wicket.RequestCycle.step(RequestCycle.java:1233)

      at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1353)

      at org.apache.wicket.RequestCycle.request(RequestCycle.java:493)

      at
org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:355
)

 

NOTE: THIS PROBLEM IS VERY INTERMITTENT, I am unable to determine the
main cause for this. However, if I re-login, everything is fine (atleast
was able to click on the links multiple times, and did not see any
issues).

 

I am using Wicket 1.3.5

 

Please let me know if you have any ideas, any pointers would be highly
appreciated.

 

Best Regards & Thanks in Advance,

Kuga


Re: Issue with AjaxLinks in ListView

Posted by Matej Knopp <ma...@gmail.com>.
It's hard to say what's going wrong without seeing code for entire page.

-Matej

On Sun, Aug 2, 2009 at 8:29 AM, Kuga<kv...@infoblox.com> wrote:
>
> Anyone???
> Thanks
> Kuga
> --
> View this message in context: http://www.nabble.com/Issue-with-AjaxLinks-in-ListView-tp24765587p24775312.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: Issue with AjaxLinks in ListView

Posted by Kuga <kv...@infoblox.com>.
Anyone???
Thanks
Kuga
-- 
View this message in context: http://www.nabble.com/Issue-with-AjaxLinks-in-ListView-tp24765587p24775312.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: Issue with AjaxLinks in ListView

Posted by Kuga <kv...@infoblox.com>.
Replaced it with Repeating views, and seems to work so far, will know better
results in couple of days if there are any issues. Thanks JK for the support
& help with some ideas. Much appreciated.

Really wonder why that should give such wierd behavior for ListView
Thanks
Kuga

John Krasnay wrote:
> 
> On Sat, Aug 01, 2009 at 09:19:05AM -0700, Kuga wrote:
>>
>> I have not tried replacing to RepeatingView. Will it make a difference?
>> 
> 
> I have no idea. Why don't you try it?
> 
> jk
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Issue-with-AjaxLinks-in-ListView-tp24765587p24803494.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: Issue with AjaxLinks in ListView

Posted by John Krasnay <jo...@krasnay.ca>.
On Sat, Aug 01, 2009 at 09:19:05AM -0700, Kuga wrote:
>
> I have not tried replacing to RepeatingView. Will it make a difference?
> 

I have no idea. Why don't you try it?

jk

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


Re: Issue with AjaxLinks in ListView

Posted by Kuga <kv...@infoblox.com>.
Hi,
I tried using the setReusableItems(true) in the constructor,
 still no luck.
I have not tried replacing to RepeatingView. Will it make a difference?
Thanks
Kuga
-- 
View this message in context: http://www.nabble.com/Issue-with-AjaxLinks-in-ListView-tp24765587p24770473.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: Issue with AjaxLinks in ListView

Posted by John Krasnay <jo...@krasnay.ca>.
Hi Kuga,

ListView re-creates all its child items on each render, which might be
causing your problems. Try calling setReuseItems(true), or better still,
consider using RepeatingView instead.

jk

On Fri, Jul 31, 2009 at 11:30:57PM -0700, Kuga wrote:
> 
> Hi,
> Thank you for your response,
> here is the ListView code:
> private final class SubMenuListView extends ListView {
>         private static final long serialVersionUID = 0L;
> 
>         private int selectedIndex = 0;
>         
>         private SubMenuListView(final String id, final IModel model) {
>             super(id, model);
>         }
> 
>         private SubMenuListView(final String id, final List<MenuItem> list)
> {
>             super(id, list);
>         }
>         
>         /* (non-Javadoc)
> 		 * @see org.apache.wicket.markup.html.list.ListView#newItem(int)
> 		 */
> 		@Override
> 		protected ListItem newItem(int index) {
> 			// TODO Auto-generated method stub
> 			return new ListItem(index, getListItemModel(getModel(), index)){
> 
> 				/* (non-Javadoc)
> 				 * @see
> org.apache.wicket.Component#onComponentTag(org.apache.wicket.markup.ComponentTag)
> 				 */
> 				@Override
> 				protected void onComponentTag(ComponentTag tag) {					
> 					String cssClass = (String)tag.getString("class"); //$NON-NLS-1$
> 					if (cssClass == null)
> 					{
> 						cssClass = " "; //$NON-NLS-1$
> 					}				
> 					if (((MenuItem)getModelObject()).isSelected())
> 					{
> 						cssClass = "menu2-selected-long"; //$NON-NLS-1$
> 					} else{
> 						cssClass = " "; //$NON-NLS-1$
> 					}
> 					tag.put("class", cssClass.trim()); //$NON-NLS-1$
> 					super.onComponentTag(tag);
> 				}
> 				
> 			};
> 		}
> 
> 		@Override
>         protected void populateItem(final ListItem item) {
>             final MenuItem menuItem = (MenuItem) item.getModelObject();
>             if (menuItem.isSelected()) {
>                 if(menuLevel.equals(MenuLevel.TOP)) {
>                     item.add(menuIsSelected); //set CSS class if the
> top-level menu item is selected
>                 }
>                 else if(menuLevel.equals(MenuLevel.SECOND)) {
>                     item.add(menuIsSelectedLong); //set CSS class if the
> second-level menu item is selected
>                 }
>             }
>             item.add(new MenuItemFragment(menuItem));
>         }
> 
> 		/**
> 		 * @param selectedIndex the selectedIndex to set
> 		 */
> 		public void setSelectedIndex(int selectedIndex) {
> 			this.selectedIndex = selectedIndex;
> 		}
> 
> 		/**
> 		 * @return the selectedIndex
> 		 */
> 		public int getSelectedIndex() {
> 			return selectedIndex;
> 		}
>     }
> -- 
> View this message in context: http://www.nabble.com/Issue-with-AjaxLinks-in-ListView-tp24765587p24766483.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: Issue with AjaxLinks in ListView

Posted by Kuga <kv...@infoblox.com>.
Hi,
Thank you for your response,
here is the ListView code:
private final class SubMenuListView extends ListView {
        private static final long serialVersionUID = 0L;

        private int selectedIndex = 0;
        
        private SubMenuListView(final String id, final IModel model) {
            super(id, model);
        }

        private SubMenuListView(final String id, final List<MenuItem> list)
{
            super(id, list);
        }
        
        /* (non-Javadoc)
		 * @see org.apache.wicket.markup.html.list.ListView#newItem(int)
		 */
		@Override
		protected ListItem newItem(int index) {
			// TODO Auto-generated method stub
			return new ListItem(index, getListItemModel(getModel(), index)){

				/* (non-Javadoc)
				 * @see
org.apache.wicket.Component#onComponentTag(org.apache.wicket.markup.ComponentTag)
				 */
				@Override
				protected void onComponentTag(ComponentTag tag) {					
					String cssClass = (String)tag.getString("class"); //$NON-NLS-1$
					if (cssClass == null)
					{
						cssClass = " "; //$NON-NLS-1$
					}				
					if (((MenuItem)getModelObject()).isSelected())
					{
						cssClass = "menu2-selected-long"; //$NON-NLS-1$
					} else{
						cssClass = " "; //$NON-NLS-1$
					}
					tag.put("class", cssClass.trim()); //$NON-NLS-1$
					super.onComponentTag(tag);
				}
				
			};
		}

		@Override
        protected void populateItem(final ListItem item) {
            final MenuItem menuItem = (MenuItem) item.getModelObject();
            if (menuItem.isSelected()) {
                if(menuLevel.equals(MenuLevel.TOP)) {
                    item.add(menuIsSelected); //set CSS class if the
top-level menu item is selected
                }
                else if(menuLevel.equals(MenuLevel.SECOND)) {
                    item.add(menuIsSelectedLong); //set CSS class if the
second-level menu item is selected
                }
            }
            item.add(new MenuItemFragment(menuItem));
        }

		/**
		 * @param selectedIndex the selectedIndex to set
		 */
		public void setSelectedIndex(int selectedIndex) {
			this.selectedIndex = selectedIndex;
		}

		/**
		 * @return the selectedIndex
		 */
		public int getSelectedIndex() {
			return selectedIndex;
		}
    }
-- 
View this message in context: http://www.nabble.com/Issue-with-AjaxLinks-in-ListView-tp24765587p24766483.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: Issue with AjaxLinks in ListView

Posted by Mischa <de...@dasberg.nl>.
Can you post the listview piece of code so i can have a better look.

Verstuurd vanaf mijn iPhone

Op 1 aug 2009 om 04:56 heeft "Kugaprakash Visagamani" <kvisagamani@infoblox.com 
 > het volgende geschreven:\

> Hi,
>
> I have a page that has a panel with ListView<AjaxLink> (Listview
> contains AjaxLink's).
>
>
>
> I go to that page, click on a links - does an ajax update of one  
> section
> in a page, and then I do a target.addComponent(listViewPanel) to  
> update
> the link selection background. This works fine so far.
>
>
>
> Now I click on the second link in that listview, I am getting the  
> below
> exception:
>
>
>
> org.apache.wicket.WicketRuntimeException: component
> heading:menu:subMenuBar:topmenuitems: 
> 2:menuitemfragment:linkfragment:lin
> kid not found on page
> com.infoblox.nios.ui.page.datamgt.DataManagePage[id = 3], listener
> interface = [RequestListenerInterface name=IBehaviorListener,
> method=public abstract void
> org.apache.wicket.behavior.IBehaviorListener.onRequest()]
>
>      at
> org.apache.wicket.request.AbstractRequestCycleProcessor.resolveListenerI
 

> nterfaceTarget(AbstractRequestCycleProcessor.java:416)
>
>      at
> org.apache.wicket.request.AbstractRequestCycleProcessor.resolveRenderedP
 

> age(AbstractRequestCycleProcessor.java:461)
>
>      at
> org.apache.wicket.protocol.http.WebRequestCycleProcessor.resolve 
> (WebRequ
> estCycleProcessor.java:139)
>
>      at
> com.infoblox.nios.app.NiosApplication 
> $RedirectRequestCycleProcess.resolv
> e(MYApplication.java:232)
>
>      at org.apache.wicket.RequestCycle.step(RequestCycle.java:1233)
>
>      at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1353)
>
>      at org.apache.wicket.RequestCycle.request(RequestCycle.java:493)
>
>      at
> org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java: 
> 355
> )
>
>
>
> NOTE: THIS PROBLEM IS VERY INTERMITTENT, I am unable to determine the
> main cause for this. However, if I re-login, everything is fine  
> (atleast
> was able to click on the links multiple times, and did not see any
> issues).
>
>
>
> I am using Wicket 1.3.5
>
>
>
> Please let me know if you have any ideas, any pointers would be highly
> appreciated.
>
>
>
> Best Regards & Thanks in Advance,
>
> Kuga
>

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