Hi, Just continuing from this thread.
I'm currently helping [EMAIL PROTECTED] to get their *secret* project
going. I svn co the gmap contrib with version 1712 and try to migrate
their existing code to use wicket-2.0 and pax-wicket-2.0.
During migration I noticed a couple of bug in gmap migration to wicket-2.0:
* In the gmap-examples, in the constructor of HomePage()
the label is instantiated with parent as HomePage.
the info panel is instantiated with parent as HomePage.
The homepage does not have "INFO_COMPONENT_ID" wicket id.
The fix is rather long, instead of passing component to marker, I
decided to pass the component factory. This way, we can delay the
instantiation of the label/info panel as late as possible, and also,
there is no hardcoding involve on the user of gmap to ensure the
wicket id of the component is "INFO_COMPONENT_ID".
ComponentFactory interface is added with the following signature.
<code>
public interface ComponentFactory<T extends Component> extends Serializable
{
<V extends MarkupContainer> T createComponent(V parent, String
wicketId);
}
</code>
- Update GMarker constructor to accept ComponentFactory instead of Component.
- Update GMarker#getComponent() method to use ComponentFactory. The
method signature becomes Gmarker#getComponent( MarkupContainer parent,
String wicketId )
- Update GMarkerContainer constructor to use GMarker#getComponent(
MarkupContainer, String ) and remove static checking that the
component id must be "INFO_COMPONENT_ID".
* Fix up InfoPanel at populateItem( final ListItem<Developer> item).
the labels are added to (this), where it should be added to (item).
* For some odd reason that only one marker can be clicked at the
beginning, after that NullPointerException is thrown.
<stacktrace>
SEVERE: Error while responding to an AJAX request:
[EMAIL PROTECTED] markupIdToComponent
[{1787073357512=[MarkupContainer [Component id = gmarkerContainer,
page = wicket.contrib.examples.gmap.HomePage, path =
0:gmap:gmapContainer:gmarkersLoop:1:gmarkerContainer.GMarkerContainer,
isVisible = true, isVersioned = true]]}], prependJavascript [[]],
appendJavascript [[]]
wicket.WicketRuntimeException: Error attaching this container for
rendering: [MarkupContainer [Component id = gmarkerInfo, page =
wicket.contrib.examples.gmap.HomePage, path =
0:gmap:gmapContainer:gmarkersLoop:1:gmarkerContainer:gmarkerInfo
.InfoPanel, isVisible = true, isVersioned = true]]
at wicket.MarkupContainer.attachChildren(MarkupContainer.java:383)
at wicket.Component.attach(Component.java:2784)
at wicket.MarkupContainer.attachChildren(MarkupContainer.java:372)
at wicket.Component.attach(Component.java:2784)
at
wicket.ajax.AjaxRequestTarget.respondComponents(AjaxRequestTarget.java:448)
at wicket.ajax.AjaxRequestTarget.respond(AjaxRequestTarget.java:339)
at
wicket.request.compound.DefaultResponseStrategy.respond(DefaultResponseStrategy.java:53)
at
wicket.request.compound.AbstractCompoundRequestCycleProcessor.respond(AbstractCompoundRequestCycleProcessor.j
ava:65)
at wicket.RequestCycle.doProcessEventsAndRespond(RequestCycle.java:944)
at wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:978)
at wicket.RequestCycle.step(RequestCycle.java:1054)
at wicket.RequestCycle.steps(RequestCycle.java:1125)
at wicket.RequestCycle.request(RequestCycle.java:470)
at wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:232)
at wicket.protocol.http.WicketServlet.doGet(WicketServlet.java:138)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:491)
at
org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:367)
at
org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:185)
at
org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
at
org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:689)
at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:391)
at
org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:146)
at
org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
at
org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:139)
at org.mortbay.jetty.Server.handle(Server.java:285)
at
org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:457)
at
org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:751)
at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:500)
at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:209)
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:357)
at
org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:329)
at
org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:475)
Caused by: java.lang.NullPointerException
at wicket.Page.componentStateChanging(Page.java:328)
at wicket.Component.addStateChange(Component.java:2556)
at wicket.MarkupContainer.removeAll(MarkupContainer.java:510)
at wicket.markup.html.list.ListView.onGenerateItems(ListView.java:597)
at wicket.markup.html.list.ListView.onAttach(ListView.java:550)
at wicket.Component.attach(Component.java:2773)
at wicket.MarkupContainer.attachChildren(MarkupContainer.java:372)
... 33 more
</stacktrace>
I'm not sure what caused this, and why it only works once. Hope
somebody can enlighten me :)
Regards,
Edward Yakop
Note: The attached are patch of the bug fixes.
wicket-contrib-gmap_as_1712.patch
Description: Binary data
wicket-contrib-gmap-examples_as_1712.patch
Description: Binary data
------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________ Wicket-user mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/wicket-user
