AjaxFallbackLabel Component
I've created a simple component called 'AjaxFallbackLabel', which might be useful to have as part of the Ajax components. I particularly found it useful when explaining to the user that Ajaxified components would automatically refresh, otherwise when JavaScript is disabled it would revert to the default message which could say 'Manually refresh the page to update the component'. If you wanted to see it in action then just checkout the wicket example and run it. Anyway, if you'd like to include it into Wicket, you're more than welcome... https://code.google.com/p/mutable-password/source/browse/trunk/mutable-password-wicket-example/src/main/java/abid/password/wicket/components/AjaxFallbackLabel.java Thanks
URL
I have a page that's mounted and when accessing the page the url is: http://www.something.com/admin/userAdd When posting a form the url changes to: http://www.something.com/admin/userAdd/wicket:interface/:3:dataForm::IFormSubmitListener:: Is it possible that the url can stay clean like the first url? There was a mention of changing the url strategy to one pass, but I was wondering if something else could be done. Ps. Still learning Wicket Thanks - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Monitor external link clicks
Hi, I am using the ExternalLink class for external sites. I've noticed this class does not implement the ILinkListener interface and I am not able to monitor these clicks. I tried to implement the listener, but I did not get far. e.g. public class MonitorExternalLink extends ExternalLink implements ILinkListener { ... } Does anyone know how I can implement a listener on the ExternalLink class? Thanks - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Monitor external link clicks
Hi Martin, Do you mean the javascript 'onclick' function? Cause I have tried to implement the onLinkClicked( ) method, and copied the 'getUrl()', 'onComponentTag()' methods from the Link class. But, did not manage to get it working. Thanks On 7 October 2010 16:00, Martin Makundi martin.maku...@koodaripalvelut.com wrote: Add onclickbehavior? ** Martin 2010/10/7 Abid K abz...@gmail.com: Hi, I am using the ExternalLink class for external sites. I've noticed this class does not implement the ILinkListener interface and I am not able to monitor these clicks. I tried to implement the listener, but I did not get far. e.g. public class MonitorExternalLink extends ExternalLink implements ILinkListener { ... } Does anyone know how I can implement a listener on the ExternalLink class? Thanks - 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 - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Monitor external link clicks
Thanks, that has worked. On 7 October 2010 16:34, Martijn Dashorst martijn.dasho...@gmail.com wrote: That is the whole point of externallink: it links to an external URL. If you want to receive the request prior to sending the user onwards, use a proper Link and redirect the browser to the external url using setRequestTarget(new RedirectRequestTarget(url)); Martijn On Thu, Oct 7, 2010 at 4:55 PM, Abid K abz...@gmail.com wrote: Hi, I am using the ExternalLink class for external sites. I've noticed this class does not implement the ILinkListener interface and I am not able to monitor these clicks. I tried to implement the listener, but I did not get far. e.g. public class MonitorExternalLink extends ExternalLink implements ILinkListener { ... } Does anyone know how I can implement a listener on the ExternalLink class? Thanks - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- Become a Wicket expert, learn from the best: http://wicketinaction.com Apache Wicket 1.4 increases type safety for web applications Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.4.8 - 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
When object is null
I hope someone can help a newbie who is learning Wicket. I have the following code which accepts a parameter and then does a database query to get the 'Data' object. If the user enters the wrong Id the database query will return null and in this case I want to notify the user the data could not be found and any other component should be hidden. But, when I get an null object the code stops working and a null exception is thrown, any ideas? Or is there a elegant way to do this? public class DataView extends WebPage { private Data data; public DataView(PageParameters parameters) { long dataId = parameters.getLong(dataId); DataDao dataDao = new DataDao(); data = dataDao.getData( dataId ); // display message that the data could not be found Label dataNotFound = new Label(dataNotFound, Data could not be found); dataNotFound.setVisible(data == null); // otherwise display the panel containing the data SomePanel panel = new SomePanel(somePanel); panel.setVisible(data != null); add(dataNotFound); add(panel); } public class SomePanel extends Panel { public SomePanel(String id) { super(id); // this throws null exception when data is null Label label = new Label(someLabel, String.valueOf(data.getId())); add(label); } } } Thanks
Re: When object is null
Thanks Josh and Daniel - both methods have worked. I have gone with checking if the object is null or not like so... public class SomePanel extends Panel { public SomePanel(String id) { super(id); if ( data == null ) { return; } Label label = new Label(someLabel, String.valueOf(data.getId())); add(label); } } I have decided to do this because I am not sure how I can format a date without doing this... SimpleDateFormat dateFormat = new SimpleDateFormat( dd/MM/ ); Label dateLabel = new Label( date, dateFormat.format( data.getDate( ) ) ); Thanks.