Re: Wicket freelancer job in Vienna, Austria
Hello! I am potentially interested. Can you tell me some details about the project scope and timeline. best regards, Andreas Petersson Am 08.08.2012 12:25, schrieb Marco Zapletal: we are looking for Wicket developer on a freelancer basis for an ongoing project in Vienna, Austria. If you are potentially interested please do not hesitate to contact me for further details. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: wicket showing traces that we used wicket is it a problem
this is the html code i got for a simple program using ajax it shows many traces that we used wicket i am imagining is it cause any problem to reveal what we actually used to the users. It also shows traces that you are using JQuery. That might reveal you are too lazy to code every line of javascript by hand. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: ArrayList, Label and Model
try the following: Building.this sent from my smartphone. I am still curious what I should use isntead of this to display data not in Form. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: StackOverFlowError
i had a very similar problem occuring in production when where was a cluster failover. i could never reproduce it. did something strange happen to you like, the filesystem was partially wiped during writing? - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Image Upload Using TinyMCE Within Wicket Framework
Looks very helpful on first sight. maybe it would make sense to release the used code in the form of a wicketstuff project, for better accessability for developers. I wrote an article for following topic: Image upload using TinyMce within Wicket Framework Article is based on functionality which i wrote to my project. I wrote it since during investigation i saw high demand for such fuctionality. I hope it will be helpful :) Any comments are welcome :) http://java.dzone.com/articles/image-upload-using-tinymce - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: [wicket-stuff] project sitemap-xml
On Thu, 25 Mar 2010 12:49:14 -0300, Fernando Wermus fernando.wer...@gmail.com wrote: Hi all, I need to develop sitemap for my web app. I see that there is a project related to this problem. Which is its situation? Does anyone know? thanks in advance hi! the sitemap-xml micro-project is a very simple thing that builds upon three assumptions: 1) you want to build a sitemap according to http://www.sitemaps.org/protocol.php - this is the language search engines like. 2) the urls you want to expose in this xml are all mapped with wicket bookmarkable strategies. 3) you want your xml to be generated on-the-fly as opposed to pre-rendered then you can use the sitemap-xml from wicketstuff. it helps you with the correct syntax. unfortunately after some basic tests i have not yet seen it in action being grabbed by the search engines to see if everything works fine. a bit of feedback would be nice. if there are request for enchancement or any uncertainties about it do not hesitate to ask on the mailing list. as it stands now i have a bit spare time at hand :) best regards andreas - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Intellij9 integration
i think getting official support for wicket in idea is too late. the roadmap was published about 6 months ago, for example at http://blogs.jetbrains.com/idea/2009/05/maia-eap-is-finally-here/ and there is already a beta version available at http://www.jetbrains.com/idea/nextversion/index.html but maybe it is the right time to give wicketforge some polish. my suggestions for enhancements, since it should be possible to better develop plugins since it is open source now. *) validation of propertymodels/CPM like idea does for expression Language for jsp. ability to ctrl-click to the corresponding getter and find usages of those getters *) support for find usages for wicket:ids *) central facet for wicket, to control its settings. *) ability to turn off the non-serializable field in serializable class warning in components for fields that are injected. br andreas If any of you guys are using Intellij Idea, I HIGHLY suggest you go to the EAP Forum http://intellij.net/forums/forum.jspa?forumID=22 and post that you want Wicket support in 9. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Proposal: Fake implementation of AjaxRequestTarget instead of null
I think it absolutely makes sense (for a future release of wicket). having a NullObject instance of AjaxRequestTarget would not waste a lot of cpu cycles at all, at least not how i use it. the only thing i do with the object is call .addComponent() and then refering a already-initialized variable. how likely is it that the object is in fact null? its 5% of users who have javascript disabled. so this would affect only a small amount of requests. from a jvm perspective calling methods with empty bodys very often is not something expensive. they will get inlined by the hotspot compiler and be effectively free. (i am not 100% sure if this also applys to polymorphism chains.) from a clean-code prespective it is often considered a code smell to have a lot of null checks. in your example providing a FakeDatabaseConnection that throws an UnsrupportedOperationException(you have no database!) is better than seeing a null pointer exception. Sounds weird. Why should my component burn cpu cycles to feed a fake ajax target which does nothing at all? I would prefer some null checks in that case. Would you also provide a FakeDatabaseConnection in case you application does not support databases? :-) Am 24.10.2009 um 07:42 schrieb Vladimir Kovalyuk: I believe all those null-checks of request target can be omited in user code if fallback components would provide fake implementation of AjaxRequestTarget instead of passing null. Does it make sense? - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Preventing Copy Pasting URL's In Same Browser Session
I am not aware that Wicket has direct support for this kind of (mis-)behavior. You can, however employ some kind of cheating here. if you set the http headers to no-cache with the help of a servlet filter, the browser will not allow the page to be copy-pasted from local cache, and will re-request the page. if you include a (crypted) counter as one of the page parameters, you can easily check if this page was already served (if the counter is lower or equal than the last served url) and redirect to an error page accordingly. to fully disable the browser-cache use: response.addHeader(“Pragma”, “no-cache”); response.addHeader(“Cache-Control”, “no-cache”); response.addHeader(“Cache-Control”, “must-revalidate”); response.addHeader(“Expires”, “Mon, 8 Aug 2006 10:00:00 GMT”); // some date in the past BR Andreas The users don't want this behavior. Could I make it work in such a way that I copy http://localhost/wicket:inteface=1, when i try to copy and paste it, it will redirect me to an error page? This happens even after the user has already logged in. Really need help on this one. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Preventing Copy Pasting URL's In Same Browser Session
Matej Knopp schrieb: What happens if the user (perhaps accidentally) refreshes page? -Matej he would get an error page using the described approach. clearly not what you would want in a general-purpose web app. BR Andreas - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: [wicket-stuff] project sitemap-xml - empty jar' files
Hi! being the initial commiter of sitemap-xml i sort of feel responsible for this. i am glad to hear it gathers a the problem is that i did not test if the checkin follows the maven conventions, since i don't use maven, i just tried to follow the conventions given by similar projects, which obviously failed. is the problem just that the files just need to be moved to the /src subdir? the svn seems very, very slow atm, so i can't check it. i will hang around in #wicket irc channel the next days if you want to reach me on that issue with nicks apetersson (at home) and apetersson_shado (at work). do not hesitate to contact me. best regards andreas Can you submit a patch or even just commit the fix yourself? The brutal truth is that most wicket stuff projects are abandoned toys that their owners once created. But the nice thing is that you are free to change it if you want. -- Jeremy Thomerson http://www.wickettraining.com On Thu, Sep 24, 2009 at 2:36 AM, Jens Zastrow m...@jens-zastrow.de wrote: Hi all, I already created a jira but without any feedback http://wicketstuff.org/jira/browse/ACTIVEWIDGETS-3 We want to use the sitemap-xml project but the jars in the maven-repository are empty. I checked out 1.4.1 sitemap-xml source-code from the svn... The problem exists because the directory structure (main/java) doesnt follow the default-maven-layout (src/main/java) and the pom.xml isnt reconfigured to match the (main/java) structure. I hope sombody of the sitemap-xml-source commiters will read this. Thanks Jens - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: how to use the BodyTagAttributeModifier class?
as i understand it from the javadoc you only need a BodyTagAttributeModifier if you create a PANEL that has the desire to add something to the parent body tag. since you do not have a panel, but rather an ordinary page, you can simply assign a wicket:id to your body and alter the attribute as you whish, either as described by you or by using the more common AttributeModifier in html: body wicket:id=mybody... in code: new WebMarkupContainer(mybody).add(new AttributeModifier(class, true, new ModelString(myclass))); string could only be automatically cast to model because it does not implement the IModel interface.String is not aware that IModel even exists, like all other core java classes. ok, so i did i would appreciate if someone can explain to me why the above code actually works and the BodyTagAttributeModifier didn't. btw, i now knew that String is not automatically cast to Model. my bad. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: AW: SSL - ajax login
according to some, it has to do with non-port 80 requests appearing more suspicous that port-80, and just in combination with firefox = 3.0. did you try deploying your site to http://localhost:80 and https://localhost:443 ? this worked for me. firefox 3.5 did not complain about port 8080/8443 though. i have no idea. you might want to google it. -igor On Tue, Jul 28, 2009 at 1:43 AM, Arthur Leigh Allenarthurleigh.al...@yahoo.de wrote: i use my own (graphic) buttons in wicket. after getting rid of my own code and just using a modified AjaxFallbackButton with overridden getCallbackUrl() method, the form was submitted but i could see an error in the error console of firefox (translated by me): security error: content from http://localhost:8080/projectname/?wicket:interface=:0:2::: is not allowed to load data from https://localhost:8443/projectname/?wicket:interface=:0:content:container:areaTop:2:panelTop:container:loginForm:buttonLogin:2:IBehaviorListener:0:random=0.573852961623538 error: uncaught exception: [Exception... Access to restricted URI denied code: 1012 nsresult: 0x805303f4 (NS_ERROR_DOM_BAD_URI) location: http://localhost:8080/projectname/resources/org.apache.wicket.ajax.WicketAjaxReference/wicket-ajax.js Line: 884] - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Refreshing a list while using ListDataProvider
Vasu Srinivasan schrieb: Hello: I have a simple search form , where some criteria refreshes the table based on the db. I got it working with ListView, but im trying to use ListDataProvider, I feel missing something: the trick that worked for me: just re-use the existing list instance. final List l = ... new ListDataProvider(l); ..then in an ajax button l.clear(); l.add(stuff)... so just use the instance , the ListDataProvider will pick up the changes. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: I18n and nice URLs
matches(IRequestTarget requestTarget) // but here how i can get the current locale to determine if /fr/accueil or /en/home matchs this mounter ??? Session.get().getLocale().getLanguage() decode(RequestParameters requestParameters) { // but here how i can change the current locale ? Session.get().setLocale(new Locale(#somelang#)) does this work for you? this is how i use the locale. best regards, Andreas - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: GSoC ideas for 09
- tool to migrate JSF apps to Wicket (heh heh) +1 for that. this would be the killer argument to finally start transitioning to wicket. it does not need to be a 100% converter of all jsf+backing beans - a two-way method for sharing panels/components would enable better transition to wicket. just a quick half-baked idea how this may look: using wicket in jsf w:panel clazz=com.example.SomeWebPage pageParameters=#{BackingBean.pageParams} xPath=/html/body/div[2]/div[2]/ and the other way round from jsf into wicket: XPathExpression xPath = xpath.compile(/html/body/div[2]/div[2]); add(new JsfPanel(jsfPanel,WEB-INF/somepage.jsp, xPath)); of course this means the whole page is rendered although only a part of the markup is needed. would be sufficient for my usecase. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
request: make GuiceProxyTargetLocator public
Hello! (this post went to the guice + the wicket mailing list) I would really like GuiceProxyTargetLocator to have a public constructor. Currently it is package-access. Furthermore findBindingAnnotation should be made public static I had to create a org.apache.wicket.guice.GuiceProxyTargetLocator2.cheat class + method in my codebase for to get around the limitation. My usecase: I still had problems using guice-injected members in serializable classes. Matej Knopp gave me some helpful hints on how to handle this. i have somewhat solved it, using GuiceProxyTargetLocator . AdminDao just a two - method interface of which happens to be implemented by a handful of DAOs. It is injected in factories, which in turn construct the Iterator. (not using @Inject in this case) public CommonIterator(AdminDao dao) { final Class? type = dao.getClass().getSuperclass(); this.dao = (AdminDao) LazyInitProxyFactory.createProxy(type, GuiceProxyTargetLocator2.cheat(type,null)); } Since i am not using a BindingAnnotation in this specific case, its ok to pass null. Otherwise, i would be forced to re-implement findBindingAnnotation - this could be made public static as well. getSuperclass() is used to determine the true Type of the Class, because initially it is wrapped in a Guice Proxy object. is there maybe a better - guicy- way of obtaining this information from the dao instance? Is it true that Guice will always return a proxy- if not i will end up with a ClassObject instance, which will break createProxy. --- using my approach its impossible to use CommonIterator outside of a wicket application ( Batch jobs) - since there i do not have a WicketApplication initialized. So i'm not too happy about the solution. This all feels messy, so i thought of how i think it could work - a more robust approach would be the following: When Guice injectes into serializable Classes and a Wicket Application is present, modify Guice in a way that it returns LazyInitProxyFactory.createProxy instances, so that i do not have to worry about this. I think this would be a serious change to the guice api, a sort of instantiationChain in the injector, in which the wicket app could register itself. Or is there already a mechanism in place that allows me to hook into the instantiation and obtian the information where the object is being injected into? - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: .html-templates compiler
well, that is not really what wicket does right now. i think it would be interesting to tie the markup + code more tightly together, to have the compiler already check for correctness, instead of runtime. for example warp-widgets ( http://code.google.com/p/warp-core/ ) does this in an elegant way at compile-time, using MVEL ( http://mvel.codehaus.org/ ) *i have not thought it through*, but it may be possible to annotate the html like warp-widgets does, to tie the wicket ids to constants/enums and keep everything else(pages/panels) in java code the same. this could be a typesave alternative to wicket:id, so you will not be able to compile if you didn't supply the enum. @Wicket(id=MyWebPage.BLA) pSome dummy labelText/p or ... @WicketRemove liadditional BulletPoint/li i should do a proof-of-concept when my project is finished :) best regards andreas On Tue, 17 Feb 2009 08:52:01 +, kan kan@gmail.com wrote: I mean if you have a wicket:id=abc, it will generate class with... emm... not sure, say method getAbc() which will return an object which represents an element, so it can be bound to a Component. So, in java-code you can use only elements which are actually exist in html-markup. Maybe something similar then set of java classes are generated for wsdl or xsd. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Intellij Idea Plugin Bounty
Also make sure you have the Wicket DTD loaded in Intellij. Regards, Erik. i got the dtd, but where exactly in intellij can you associate the wicket dtd with xhtml. setup external resource did not work. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Intellij Idea Plugin Bounty
i got the dtd, but where exactly in intellij can you associate the wicket dtd with xhtml. setup external resource did not work. to be more precise, i get autocompletion only for 3 attributes, not for wicket:xxx tags.. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: WicketForge 0.5.0 Available for IDEA 8
Nick Heudecker schrieb: I've published WicketForge 0.5.1 to the IDEA plugins site. - Toggling between HTML and Java is fixed. Let me know if you're still having problems with the cursor ending up at the correct location. It's work correctly here but your results may vary. - The intentions are also fixed. Nobody mentioned the intentions not working, so I'm guessing no one knew about them. There are intentions to create a markup page/panel/properties file if you alt-enter while the cursor is on the class name. great news! i have been looking forward to this :) thanks a lot for your hard work. small suggestion though: there should be a short descriptions of the funtionality in the plugin description, i did not know about half of the features until now. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
path to resource ../ attached at the beginning
hi! in the .html file i have references to images such as img src=../res/myimage.jpg width=120 height=90/ in the preview this is the correct path. as soon as i startup the apllication wicket writes out the image as img src=../../res/myimage.jpg width=120 alt=some Image height=90/ 1) why is ../ appended at the beginning? 2) how can i replace the path with something like link rel=stylesheet type=text/css href=resources/my.package.wicket.start.Start/$up$/res/main.css/ the css is included via the Start.java with add(new StyleSheetReference(mainCss, new CompressedResourceReference(Start.class,../res/main.css))); since the pictures are added in the classpath, they must be accessed via /resources/ it would be optimal if i can acieve this just by editing the html file, to keep the previewability. i hate to have duplicate references to the same resource. (java +html that both contain links to the same images...) best regards andreas - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
IoC: how to best handle non-serializable fields in wicket
hi! so, im using wicket together with guice for DI. i really wondered that the correct approach is here. at first i thought it way easy to do this, but it turns out it is more complicated..- at least more complicated to understand. my typical page looks like this: public class StartPage extends WebPage { private transient EmkDao dao; @Inject public void setDao(EmkDao dao) { this.dao = dao; } public EmkDao getDao() { return dao; } public Start() { add( Components that use the dao in various ways (models, onclick etc); } } this seems to work well, in simple cases. BUT! as soon as i press browser-back and reload most likely the dao member has become null. - NPE the expected behavior would be: transient fields are re-injected whenever the page is deserialized. obviously this is not the case. im surprised, that my StartPage is often a different instance (as seen in the debugger) , when using browser-back-reload, but the setter annotated with @Inject is not called twice. since WebPage is Serializable and most injected objects are not (they often contain references to non-serializable classes) they have to be declared transient. I use the following guice config: filter filter-nameWicketApplication/filter-name filter-classorg.apache.wicket.protocol.http.WicketFilter/filter-class init-param param-nameapplicationFactoryClassName/param-name param-valueorg.apache.wicket.guice.GuiceWebApplicationFactory/param-value /init-param init-param param-nameinjectorContextAttribute/param-name param-valuecom.google.inject.Injector/param-value /init-param /filter with bind(WebApplication.class).to(MyWicketApplication.class) in my Module. i also tried the configuration described at http://www.wideplay.com/wicketwithwarp-servlet with a simple WicketFilter (without the GuiceWebApplicationFactory) and Integrathe.with(this) in the WicketApplication, with the same result. As I'm writing this mail, it turns out, it appears to work if i just omit the transient keyword. i wonder: what will that do to wicket pages? will i prevent them to serialize any more? why doesn't it throw a NotSerializableException ? then i have to use @SuppressWarnings({NonSerializableFieldInSerializableClass}) for IntelliJ to omit the warning. somehow i am missing a coherent documentation on wicket+IoC on this matter. best regards, Andreas - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: IoC: how to best handle non-serializable fields in wicket
Timo Rantalaiho schrieb: On Fri, 06 Feb 2009, Andreas Petersson wrote: so, im using wicket together with guice for DI. i really wondered that the correct approach is here. http://wicketstuff.org/wicket13/guice/ http://cwiki.apache.org/WICKET/wicket-guice-and-ibatis-example.html Best wishes, Timo hi timo, thanks for the links. well, i've modeled my application after reading the mentioned example. from Wicket, Guice and Ibatis example: public class MyPage extends WebPage { @Inject protected MyDao myDao; --- i wonder: myDao is most likely not serializable. WebPage is. WebPage should get serialized. so why the heck does this not throw an error? what kind of magic is going on here? - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: IoC: how to best handle non-serializable fields in wicket
Timo Rantalaiho schrieb: On Fri, 06 Feb 2009, Andreas Petersson wrote: i wonder: myDao is most likely not serializable. WebPage is. WebPage should get serialized. so why the heck does this not throw an error? what kind of magic is going on here? Look at what GuiceComponentInjector does (or something it calls). The access to the dao is proxied by a serialisable proxy. The proxy can be serialised and deserialised without problems, and it will access the real dao. Best wishes, Timo ok, now the puzzle pieces come together. as described at http://cwiki.apache.org/WICKET/guice-integration-pitfall.html there are proxies/CGlib subclasses created. - now i understand why these are necessary, and why it does not matter that they are not serializable. it all makes sense now :) thanks a lot. tough a comment by Igor Vaynberg https://issues.apache.org/jira/secure/ViewProfile.jspa?name=ivaynberg at https://issues.apache.org/jira/browse/WICKET-1130 made me wonder: guice already uses annotations, so - at least for it - it would be possible to skip the proxying part. otoh, EasyMock Class Extension also creates instances of classes, even without protected no-args constructor, so i guess there must be a way to do it. --- /Igor Vaynberg https://issues.apache.org/jira/secure/ViewProfile.jspa?name=ivaynberg - 24/Mar/08 04:56 PM/ /moving this to 1.5. basically when injecting instances of concrete classes we are limited by cglib which requires a default visible constructor and no final methods so that it can create a subclass for our proxy. once we switch to jdk5 we can require usage of annotations for injection and then we can remove the proxies and use hooks in page serialization to inject objects and hooks in deserialzation to make sure injected fields are skipped. / [ Show » https://issues.apache.org/jira/browse/WICKET-1130 ] Igor Vaynberg https://issues.apache.org/jira/secure/ViewProfile.jspa?name=ivaynberg - 24/Mar/08 04:56 PM moving this to 1.5. basically when injecting instances of concrete classes we are limited by cglib which requires a default visible constructor and no final methods so that it can create a subclass for our proxy. once we switch to jdk5 we can require usage of annotations for injection and then we can remove the proxies and use hooks in page serialization to inject objects and hooks in deserialzation to make sure injected fields are skipped. /- / - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Iam getting Errors while starting the Tomcat 5.5 server
Swapna Rachamalla schrieb: Hi I Have developed HelloWorld example using Apache Wicket which is given http://wicket.apache.org/examples.html. I have compiled the java files Successfully. But while starting the tomcat 5.5 web server iam getting the following error. org.apache.catalina.core.StandardContext start SEVERE: Error filterStart org.apache.catalina.core.StandardContext start SEVERE: Context [/WicketApp] startup failed due to previous errors Please can u help me out in resoving this issue. Thanks Swapna in this case, have a look at your tomcat directory logs /tomcat/logs/ and see whats in the latest catalina-.out. there you might see a better information /stacktrace/etc what was the cause of the statup failure. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
using Gmap2 for route planning
Hi! I'm using wicket.contrib.gmap.Gmap2 to create maps. i browsed the source, and it does not appear as if there is any implementation ready to overlay routes. hay anybody extended the Gmap2 stuff? my first guess would be to create a new type of GOveray,. similar to GMarker, but slightly more complex. has anybody experience with that, or an example how to do it? best regards, andreas - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: using Gmap2 for route planning
hi again! I just finished a rough draft of a GDirections class for GMap2. this is a standalone class, no modifications at the existing resources/classes are necessary. it seems to work in my simple setting - this can also be updated with ajax. the implementation has to override getJSadd() , since it is not constructed with a constructor. please have a look at the correctness, as this is my first custom component i've written for wicket. open questions for me: is there a better way to access the core maps object? final String markupId = getParent().get(map).getMarkupId(); String jsVar = directions + markupId; sb.append(var ).append(jsVar).append( = new GDirections(Wicket.maps[').append(markupId).append('].map); i have two concerns here: 1) accessing the map id via getParent().get(map).getMarkupId() - unfortunately the map variable in GMap2 is private without an accessor. otherwise I could have written getParent().getMap().getMarkupId(). 2) hardcoding the Wicket.maps[''].map javascript reference - is there a better way to obtain this from the parent? possible features missing: *) changing of markers via GEvent.addListener(jsVar,load... *) somehow obtain the results (length) of routes. - any idea on this? *) change the type of route (don't use highways, by foot, by public transport) - import org.apache.wicket.Component; import org.apache.wicket.ajax.AjaxRequestTarget; import wicket.contrib.gmap.api.GEvent; import wicket.contrib.gmap.api.GLatLng; import wicket.contrib.gmap.api.GOverlay; import wicket.contrib.gmap.js.Array; public class GDirections extends GOverlay { private Component writeOutPutTo; private final GLatLng[] waypoints; private final boolean writeOutput; public GDirections(GLatLng... gLatLngs) { this(null, gLatLngs); } public GDirections(Component writeOutPutTo, GLatLng... gLatLngs) { this.writeOutPutTo = writeOutPutTo; waypoints = gLatLngs; writeOutput = writeOutPutTo != null; } @Override protected String getJSconstructor() { return null; } @Override public String getJSadd() { Array array = new Array(); for (GLatLng gLatLng : waypoints) { array.add(gLatLng.getJSconstructor()); } final StringBuffer sb = new StringBuffer(); final String markupId = getParent().get(map).getMarkupId(); String jsVar = directions + markupId; sb.append(var ).append(jsVar).append( = new GDirections(Wicket.maps[').append(markupId).append('].map); if (writeOutput) { sb.append(, document.getElementById('); sb.append(writeOutPutTo.getMarkupId()); sb.append(')); } sb.append();); sb.append(jsVar + .loadFromWaypoints(); appendCoordArray(sb, waypoints); sb.append();); sb.deleteCharAt(sb.length() - 1); return sb.toString(); } /** * produces a string like * [37.600470,-122.384050,37.789010,-122.425420,38.029940,-122.255420,39.026450,-119.945700] * * @param sbStringBuffer to write into * @param array list of Waypoints */ private void appendCoordArray(final StringBuffer sb, GLatLng[] array) { sb.append([); for (GLatLng coord : array) { sb.append(\).append(coord.getLat()).append(,).append(coord.getLng()).append(\); sb.append(,); } sb.deleteCharAt(sb.length() - 1); sb.append(]); } @Override protected void updateOnAjaxCall(AjaxRequestTarget target, GEvent overlayEvent) { //no clue } } - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org