You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Doug Leeper <do...@yahoo.com> on 2008/05/08 00:59:43 UTC

Fragment issue

Sorry for duplicate post...selected the wrong button.

I have a DataView and for each 'row', I add a different fragment based on
the object model type.

However, in each fragment I have a link (edit). The page displays fine.  But
when I select on the link, wicket indicates that that link interface is not
found.  What is even more interesting, when I had the link as an AjaxLink,
the first click produces the same error.. but when I back button and select
again, the AjaxLink works. 

If anyone knows what I need to look at, please let me know.  I am perplexed
where to start looking.

Thanks
- Doug

FYI...some additional information that may be handy...

The resultant interface path is:

replacements:replacement:1:replacementFragment:editPhone where editPhone is
the link.

The replacementFragment is actually replaced with a phoneFragment to display
the editPhone link.

The offending code is as follows: (only applicable code and hopefully the
HTML will be displayed nicely)

		dataView = new DataView("replacement", new ListDataProvider(dataList)) {
			public void populateItem(Item item) {
				item.setRenderBodyOnly(true);

				ReplacementElement data = (ReplacementElement) item
						.getModelObject();

				if (data instanceof PhoneReplacement) {
					item.add(new PhoneFragment("replacementFragment",
							NewCampaignReplacementsEditPanel.this,
							(PhoneReplacement) data));
				} else if (data instanceof ImageReplacement) {
					item.add(new ImageFragment("replacementFragment",
							NewCampaignReplacementsEditPanel.this,
							(ImageReplacement) data));
				} else if (data instanceof FlashReplacement) {
					item.add(new FlashFragment("replacementFragment",
							NewCampaignReplacementsEditPanel.this,
							(FlashReplacement) data));
				} else {
					throw new RuntimeException(
							"Unexpected replacement element: " + data);
				}
			}
		};
		add(dataView);


	private class PhoneFragment extends Fragment {

		public PhoneFragment(String id, MarkupContainer markupProvider,
				final PhoneReplacement phone) {
			super(id, "phoneFragment", markupProvider);
			this.setRenderBodyOnly(true);

			add(new ListSelectAjaxCheckBox<Integer>("id",
					new ListSelectCheckBoxModel<Integer>(selectedIds, phone
							.getTransformID())));

			add(new Label("from", new PropertyModel(phone,
					"fromPhone.formatted")));
			add(new Label("type", new PropertyModel(phone, "phoneType.label")));
			add(new Label("to", new PropertyModel(phone, "toPhone.formatted")));

			Link edit = new Link("editPhone") {
				public void onClick() {
					setResponsePage(new PhoneReplacementDetailPage(getPage(),
							phone));
				}
			};
			add(edit);
		}

	}


< table>
		< tr>
			< td class="tableHeader">Use</td>
			< td class="tableHeader" width="50">Type</td>
			< td class="tableHeader" width="100">From</td>
			< td class="tableHeader" width="100">To</td>
			< td class="tableHeader" width="50">&nbsp;</td>
		<  /tr>

		< div wicket:id="replacement">
		< tr wicket:id="replacementFragment"></tr>
		< /div>
	< /table>


	< wicket:fragment wicket:id="phoneFragment">
		< tr>
			< td><input type="checkbox" wicket:id="id"></td>
			< td>Phone</td>
			< td></td>
			< td>[] &nbsp; </td>
			< td align="center"> # Edit </td>
		< /tr>
	< /wicket:fragment>


-- 
View this message in context: http://www.nabble.com/Fragment-issue-tp17116545p17116545.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: Fragment issue

Posted by Ritz123 <ri...@gmail.com>.
There are a few things I noticed...

Your fragment markup doesnt seem to have all the wicket:id's that you have
add() for in the fragment constructor - in fact it only has the first id
column's wicket id.

Also do you really need the page thats holding the fragment to be passed to
the next page? 

The error seems to suggest editPhone component is missing on the page - make
sure you have markup and component in sync.

Are you running in development mode?


Doug Leeper wrote:
> 
> Here is something interesting...
> 
> I changed my DataView to ListView and now it works.
> 
> Any known issue in using a DataView over a ListView in this given
> circumstance?
> 

-- 
View this message in context: http://www.nabble.com/Fragment-issue-tp17116545p17120174.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: Fragment issue

Posted by Doug Leeper <do...@yahoo.com>.
Here is something interesting...

I changed my DataView to ListView and now it works.

Any known issue in using a DataView over a ListView in this given
circumstance?
-- 
View this message in context: http://www.nabble.com/Fragment-issue-tp17116545p17117671.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: Fragment issue

Posted by Doug Leeper <do...@yahoo.com>.
Sorry...I forgot to add the first time.  Here it is.

org.apache.wicket.WicketRuntimeException: component
replacements:replacement:1:replacementFragment:editPhone not found on page
com.positiontech.local.wicket.main.advertiser.advertiser.newCampaign.NewCampaignReplacements[id
= 6], listener interface = [RequestListenerInterface name=ILinkListener,
method=public abstract void
org.apache.wicket.markup.html.link.ILinkListener.onLinkClicked()]
	at
org.apache.wicket.request.AbstractRequestCycleProcessor.resolveListenerInterfaceTarget(AbstractRequestCycleProcessor.java:416)
	at
com.positiontech.local.wicket.LocalApplication$1.resolveListenerInterfaceTarget(<generated>)
	at
org.apache.wicket.request.AbstractRequestCycleProcessor.resolveRenderedPage(AbstractRequestCycleProcessor.java:461)
	at
com.positiontech.local.wicket.LocalApplication$1.resolveRenderedPage(<generated>)
	at
org.apache.wicket.protocol.http.WebRequestCycleProcessor.resolve(WebRequestCycleProcessor.java:139)
	at com.positiontech.local.wicket.LocalApplication$1.resolve(<generated>)
	at org.apache.wicket.RequestCycle.step(RequestCycle.java:1224)
	at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1331)
	at org.apache.wicket.RequestCycle.request(RequestCycle.java:493)
	at
org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:363)
	at
org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:194)
	at
org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1089)
	at
com.positiontech.hib.HibernateFilter$$M$d0d29e4c.doFilter(HibernateFilter.java:67)
	at com.positiontech.hib.HibernateFilter$$A$d0d29e4c.doFilter(<generated>)
	at com.positiontech.hib.HibernateFilter.doFilter(<generated>)
	at
org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1089)
	at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:365)
	at
org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
	at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
	at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:712)
	at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405)
	at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:139)
	at org.mortbay.jetty.Server.handle(Server.java:295)
	at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:503)
	at
org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:827)
	at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:511)
	at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:210)
	at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:379)
	at
org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:361)
	at
org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:442)
-- 
View this message in context: http://www.nabble.com/Fragment-issue-tp17116545p17117641.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: Fragment issue

Posted by Ritz123 <ri...@gmail.com>.
Can you post the exact error you get? assuming exception stacktrace.


Doug Leeper wrote:
> 
> Sorry for duplicate post...selected the wrong button.
> 
> I have a DataView and for each 'row', I add a different fragment based on
> the object model type.
> 
> However, in each fragment I have a link (edit). The page displays fine. 
> But when I select on the link, wicket indicates that that link interface
> is not found.  What is even more interesting, when I had the link as an
> AjaxLink, the first click produces the same error.. but when I back button
> and select again, the AjaxLink works. 
> 
> If anyone knows what I need to look at, please let me know.  I am
> perplexed where to start looking.
> 
> Thanks
> - Doug
> 
> FYI...some additional information that may be handy...
> 
> The resultant interface path is:
> 
> replacements:replacement:1:replacementFragment:editPhone where editPhone
> is the link.
> 
> The replacementFragment is actually replaced with a phoneFragment to
> display the editPhone link.
> 
> The offending code is as follows: (only applicable code and hopefully the
> HTML will be displayed nicely)
> 
> 		dataView = new DataView("replacement", new ListDataProvider(dataList)) {
> 			public void populateItem(Item item) {
> 				item.setRenderBodyOnly(true);
> 
> 				ReplacementElement data = (ReplacementElement) item
> 						.getModelObject();
> 
> 				if (data instanceof PhoneReplacement) {
> 					item.add(new PhoneFragment("replacementFragment",
> 							NewCampaignReplacementsEditPanel.this,
> 							(PhoneReplacement) data));
> 				} else if (data instanceof ImageReplacement) {
> 					item.add(new ImageFragment("replacementFragment",
> 							NewCampaignReplacementsEditPanel.this,
> 							(ImageReplacement) data));
> 				} else if (data instanceof FlashReplacement) {
> 					item.add(new FlashFragment("replacementFragment",
> 							NewCampaignReplacementsEditPanel.this,
> 							(FlashReplacement) data));
> 				} else {
> 					throw new RuntimeException(
> 							"Unexpected replacement element: " + data);
> 				}
> 			}
> 		};
> 		add(dataView);
> 
> 
> 	private class PhoneFragment extends Fragment {
> 
> 		public PhoneFragment(String id, MarkupContainer markupProvider,
> 				final PhoneReplacement phone) {
> 			super(id, "phoneFragment", markupProvider);
> 			this.setRenderBodyOnly(true);
> 
> 			add(new ListSelectAjaxCheckBox<Integer>("id",
> 					new ListSelectCheckBoxModel<Integer>(selectedIds, phone
> 							.getTransformID())));
> 
> 			add(new Label("from", new PropertyModel(phone,
> 					"fromPhone.formatted")));
> 			add(new Label("type", new PropertyModel(phone, "phoneType.label")));
> 			add(new Label("to", new PropertyModel(phone, "toPhone.formatted")));
> 
> 			Link edit = new Link("editPhone") {
> 				public void onClick() {
> 					setResponsePage(new PhoneReplacementDetailPage(getPage(),
> 							phone));
> 				}
> 			};
> 			add(edit);
> 		}
> 
> 	}
> 
> 
> < table>
> 		< tr>
> 			< td class="tableHeader">Use</td>
> 			< td class="tableHeader" width="50">Type</td>
> 			< td class="tableHeader" width="100">From</td>
> 			< td class="tableHeader" width="100">To</td>
> 			< td class="tableHeader" width="50">&nbsp;</td>
> 		<  /tr>
> 
> 		< div wicket:id="replacement">
> 		< tr wicket:id="replacementFragment"></tr>
> 		< /div>
> 	< /table>
> 
> 
> 	< wicket:fragment wicket:id="phoneFragment">
> 		< tr>
> 			< td><input type="checkbox" wicket:id="id"></td>
> 			< td>Phone</td>
> 			< td></td>
> 			< td>[] &nbsp; </td>
> 			< td align="center"> # Edit </td>
> 		< /tr>
> 	< /wicket:fragment>
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Fragment-issue-tp17116545p17117161.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