Re: [Wicket-user] Retrieving a value from a PropertyModel
Thanks Igor, I was having the same issue as Jason (see [Wicket-user] Getting value of a text field via Ajax, no form ) I changed to using AjaxFormComponentUpdatingBehavior and all is happy. Thanks again, Tim Igor Vaynberg wrote: havent looked at your code but here is how i would do it class mypanel extends panel { private String value; //getter+setter public mypanel() { TextField tf=new TextField(tf, new PropertyModel(this, value)); Label l=new Label(l, new propertyModel(this, value)); . } } -igor On 3/8/07, Tim Squires [EMAIL PROTECTED] wrote: Hi, I'm trying to get working a panel containing a TextField and a Label. The label contains the hex value for the TextField content. The TextField is Ajaxed so that it updates the label on each key press. Unfortunalty, I cannot retrieve the value from the TextField, it always returns a null. Will someone elighten me to the best way to retrieve the current TextField value? Code is included below. Thanks for your help, Tim public class TextFieldWithHexValue extends Panel { private static final Log logger = LogFactory .getLog(TextFieldWithHexValue.class); @SuppressWarnings(serial) public TextFieldWithHexValue(String id, final PropertyModel model, int tabindex) { super(id); final TextField textField = new TextField(text field with hex, model); textField.setOutputMarkupId(true); add(textField); textField.add(new AttributeModifier(tabindex, true, new Model( tabindex))); textField.setOutputMarkupId(true); // Server Port Hex Model hexModel = new Model() { public Object getObject(Component arg0) { logger.debug(Calculating hex value...); String value = model.getObject(null) + ; logger.debug(Pre hexed value = + value); if (StringUtils.isNotEmpty(value)) { StringBuffer buffer = new StringBuffer(); StringTokenizer tokens = new StringTokenizer(value, .); while (tokens.hasMoreTokens()) { String token = tokens.nextToken(); try { Integer hex = new Integer(token); buffer.append(StringUtils.leftPad(Integer .toHexString(hex), 2, '0')); } catch (NumberFormatException e) { logger.warn(Unable to format + token + to hex); } } return buffer.toString().toUpperCase(); } else return ; } }; final Label hexLabel = new Label(hex for text field, hexModel); hexLabel.setOutputMarkupId(true); textField.add(new AjaxEventBehavior(onkeypress) { protected void onEvent(AjaxRequestTarget target) { logger.debug(value has changed, recalculate hex value); target.addComponent(hexLabel); } }); add(hexLabel); } } The Information contained in this e-mail message is intended only for the individuals named above. If you are not the intended recipient, you should be aware that any dissemination, distribution, forwarding or other duplication of this communication is strictly prohibited. The views expressed in this e-mail are those of the individual author and not necessarily those of LINK Interchange Network Ltd. Prior to taking any action based upon this e-mail message you should seek appropriate confirmation of its authenticity. If you have received this e-mail in error, please notify the sender immediately. LINK Interchange Network Limited Tel: 01423 356000, Fax: 01423 356356 email: [EMAIL PROTECTED] http://www.link.co.uk Registered in ENGLAND Number. 3565766 Registered Office: Arundel House * 1 Liverpool Gardens * Worthing * West Sussex* BN11 1SL - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance
[Wicket-user] Retrieving a value from a PropertyModel
Hi, I'm trying to get working a panel containing a TextField and a Label. The label contains the hex value for the TextField content. The TextField is Ajaxed so that it updates the label on each key press. Unfortunalty, I cannot retrieve the value from the TextField, it always returns a null. Will someone elighten me to the best way to retrieve the current TextField value? Code is included below. Thanks for your help, Tim public class TextFieldWithHexValue extends Panel { private static final Log logger = LogFactory .getLog(TextFieldWithHexValue.class); @SuppressWarnings(serial) public TextFieldWithHexValue(String id, final PropertyModel model, int tabindex) { super(id); final TextField textField = new TextField(text field with hex, model); textField.setOutputMarkupId(true); add(textField); textField.add(new AttributeModifier(tabindex, true, new Model( tabindex))); textField.setOutputMarkupId(true); // Server Port Hex Model hexModel = new Model() { public Object getObject(Component arg0) { logger.debug(Calculating hex value...); String value = model.getObject(null) + ; logger.debug(Pre hexed value = + value); if (StringUtils.isNotEmpty(value)) { StringBuffer buffer = new StringBuffer(); StringTokenizer tokens = new StringTokenizer(value, .); while (tokens.hasMoreTokens()) { String token = tokens.nextToken(); try { Integer hex = new Integer(token); buffer.append(StringUtils.leftPad(Integer .toHexString(hex), 2, '0')); } catch (NumberFormatException e) { logger.warn(Unable to format + token + to hex); } } return buffer.toString().toUpperCase(); } else return ; } }; final Label hexLabel = new Label(hex for text field, hexModel); hexLabel.setOutputMarkupId(true); textField.add(new AjaxEventBehavior(onkeypress) { protected void onEvent(AjaxRequestTarget target) { logger.debug(value has changed, recalculate hex value); target.addComponent(hexLabel); } }); add(hexLabel); } } The Information contained in this e-mail message is intended only for the individuals named above. If you are not the intended recipient, you should be aware that any dissemination, distribution, forwarding or other duplication of this communication is strictly prohibited. The views expressed in this e-mail are those of the individual author and not necessarily those of LINK Interchange Network Ltd. Prior to taking any action based upon this e-mail message you should seek appropriate confirmation of its authenticity. If you have received this e-mail in error, please notify the sender immediately. LINK Interchange Network Limited Tel: 01423 356000, Fax: 01423 356356 email: [EMAIL PROTECTED] http://www.link.co.uk Registered in ENGLAND Number. 3565766 Registered Office: Arundel House * 1 Liverpool Gardens * Worthing * West Sussex* BN11 1SL - 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.phpp=sourceforgeCID=DEVDEV ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
[Wicket-user] No Page found for component
Hi, I have a page based on wicket.extensions.wizard. When the formValidator identifies an invalid field, I call error(a message) on that Component. At that point the following exception is thrown. java.lang.IllegalStateException: No Page found for component [MarkupContainer [Component id = status, page = No Page, path = view:status.DropDownChoice]] at wicket.Component.getPage(Component.java:1044) at wicket.Component.error(Component.java:680) at myapp.gui.wizards.EditDetailsWizardStep.init(EditDetailsWizardStep.jav a:109) ... ... Can anyone shed any light on this problem? I though all components would be able to find the containing page? Thanks, Tim The Information contained in this e-mail message is intended only for the individuals named above. If you are not the intended recipient, you should be aware that any dissemination, distribution, forwarding or other duplication of this communication is strictly prohibited. The views expressed in this e-mail are those of the individual author and not necessarily those of LINK Interchange Network Ltd. Prior to taking any action based upon this e-mail message you should seek appropriate confirmation of its authenticity. If you have received this e-mail in error, please notify the sender immediately. - 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.phpp=sourceforgeCID=DEVDEV ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
[Wicket-user] Dojo contrib: WicketServlet cannot be changed once it is set
Hi, I added wicket-contrib-dojo 0.3.1 to app and when it's redeployed I get... java.lang.IllegalStateException: WicketServlet cannot be changed once it is set wicket.protocol.http.WebApplication.setWicketServlet(WebApplication.java :400) wicket.protocol.http.WicketServlet.init(WicketServlet.java:283) javax.servlet.GenericServlet.init(GenericServlet.java:211) org.apache.catalina.authenticator.AuthenticatorBase.invoke(Authenticator Base.java:524) org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java :105) org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:1 48) org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:86 9) org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.proc essConnection(Http11BaseProtocol.java:664) org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint .java:527) org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollow erWorkerThread.java:80) org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool .java:684) java.lang.Thread.run(Thread.java:595) It does not even need to reference any of the contrib-dojo classes to break it. The app uses tomcat form based auth (via NTLM) then forwards to the wicket servlet, it's after the user is authenicated that the exception is thrown. Remove the wicket-contrib-dojo jar from the classpath and everything works again. Any ideas where I could start looking for the problem? I'm actually just after FXFeedbackIndicator - are there any other alternatives that people are using? Wicket: 1.2.4 Wicket-contrib-dojo 0.3.1 Tomcat 5.5.20 Java: 1.5 Thanks for your time, Tim The Information contained in this e-mail message is intended only for the individuals named above. If you are not the intended recipient, you should be aware that any dissemination, distribution, forwarding or other duplication of this communication is strictly prohibited. The views expressed in this e-mail are those of the individual author and not necessarily those of LINK Interchange Network Ltd. Prior to taking any action based upon this e-mail message you should seek appropriate confirmation of its authenticity. If you have received this e-mail in error, please notify the sender immediately. - 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.phpp=sourceforgeCID=DEVDEV ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] DataView modelChanged
Thanks Igor, the DataProvider /was/ caching the results. Do you know if there's a nice way of retrieving the iterator and size without retrieving the results twice? i.e. I currently have public Iterator iterator(int first, int count) { return ATMInstallsDao.getFromApplicationContext().getAllTasks().subList(first, first + count) .iterator(); } public int size() { return ATMInstallsDao.getFromApplicationContext().getAllTasks().size(); } Since it's using Sping/Hibernate/EhCache it does not actually go back to the database but it would be nice not to ask the cache for the results twice. Thanks, Tim From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Igor Vaynberg Sent: 17 January 2007 16:07 To: wicket-user@lists.sourceforge.net Subject: Re: [Wicket-user] DataView modelChanged you dont need to do anything. next request the dataprovider is polled again. if the dataview really doesnt refresh make sure your dataprovider/orm layer are not doing any caching. -igor On 1/17/07, Tim Squires [EMAIL PROTECTED] wrote: Hi again, I have a simple DataView where one of the columns contains a Link which onClick modifies the data. What is the best way of telling the DataView that the model has changed. I've tried a few things, see the comments in the code Thanks for your help, Tim DataView dataView = new DataView(tasks, new UserTaskDataProvider(user)) { protected void populateItem(final Item item) { final TaskInstance task = (TaskInstance) item.getModelObject(); item.add(new Label(taskName, task.getName())); // add a link that, when clicked, assigns the task back to // the group Link assignLink = new Link(assignLink) { @Override public void onClick() { ATMInstallsDao.getFromApplicationContext() .assignTaskToGroup(task.getId(), InstallsTeam); //-PLEASE HELP WITH THIS BIT- // tell wicket that we've changed the model so it // updates the page //tried... // modelChanged(); - does nothing (the Link objects model??) // DataView.this.modelChanged(); - does not compile no DataView parent??? // This works but is not really the most efficient!. getRequestCycle().setResponsePage(new UserTasksPage(userName)); // } }; assignLink.add(new Label(assignLinkLabel, assign to group)); item.add(assignLink); } }; The Information contained in this e-mail message is intended only for the individuals named above. If you are not the intended recipient, you should be aware that any dissemination, distribution, forwarding or other duplication of this communication is strictly prohibited. The views expressed in this e-mail are those of the individual author and not necessarily those of LINK Interchange Network Ltd. Prior to taking any action based upon this e-mail message you should seek appropriate confirmation of its authenticity. If you have received this e-mail in error, please notify the sender immediately. - 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
Re: [Wicket-user] DataView modelChanged
Ooooh detach() - I like that, not used it before but it sounds perfect, thanks Martijn. The query is part of the Jboss Rules package and while it would be nice to add a custom query to retrieve first/count results, my current job is to just replace the skin with a Wicket based web site. It's now on the list of optimisations for the next version! Tim -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Martijn Dashorst Sent: 18 January 2007 11:02 To: wicket-user@lists.sourceforge.net Subject: Re: [Wicket-user] DataView modelChanged Also, why do you retrieve all tasks? Isn't it more cost efficient to apply the first/count to the query itself? Martijn On 1/18/07, Martijn Dashorst [EMAIL PROTECTED] wrote: Cache it in your dataprovider, and have your dataprovider implement IDetachable where in detach() you reset the cached query result. Martijn On 1/18/07, Tim Squires [EMAIL PROTECTED] wrote: Thanks Igor, the DataProvider /was/ caching the results. Do you know if there's a nice way of retrieving the iterator and size without retrieving the results twice? i.e. I currently have public Iterator iterator(int first, int count) { return ATMInstallsDao.getFromApplicationContext().getAllTasks().subList(fir st, first + count) .iterator(); } public int size() { return ATMInstallsDao.getFromApplicationContext().getAllTasks().size(); } Since it's using Sping/Hibernate/EhCache it does not actually go back to the database but it would be nice not to ask the cache for the results twice. Thanks, Tim From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Igor Vaynberg Sent: 17 January 2007 16:07 To: wicket-user@lists.sourceforge.net Subject: Re: [Wicket-user] DataView modelChanged you dont need to do anything. next request the dataprovider is polled again. if the dataview really doesnt refresh make sure your dataprovider/orm layer are not doing any caching. -igor On 1/17/07, Tim Squires [EMAIL PROTECTED] wrote: Hi again, I have a simple DataView where one of the columns contains a Link which onClick modifies the data. What is the best way of telling the DataView that the model has changed. I've tried a few things, see the comments in the code Thanks for your help, Tim DataView dataView = new DataView(tasks, new UserTaskDataProvider(user)) { protected void populateItem(final Item item) { final TaskInstance task = (TaskInstance) item.getModelObject(); item.add(new Label(taskName, task.getName())); // add a link that, when clicked, assigns the task back to // the group Link assignLink = new Link(assignLink) { @Override public void onClick() { ATMInstallsDao.getFromApplicationContext() .assignTaskToGroup(task.getId(), InstallsTeam); //-PLEASE HELP WITH THIS BIT- // tell wicket that we've changed the model so it // updates the page //tried... // modelChanged(); - does nothing (the Link objects model??) // DataView.this.modelChanged(); - does not compile no DataView parent??? // This works but is not really the most efficient!. getRequestCycle().setResponsePage(new UserTasksPage(userName)); // } }; assignLink.add(new Label(assignLinkLabel, assign to group)); item.add(assignLink); } }; The Information contained in this e-mail message is intended only for the individuals named
[Wicket-user] wicket-auth-roles 1.2.4 pom
Hi, The pom for wicket-auth-roles http://wicket.sourceforge.net/maven2/wicket/wicket-auth-roles/1.2.4/wick et-auth-roles-1.2.4.pom refers to the wicket 1.2 snapshot... parent artifactIdwicket-parent/artifactId groupIdwicket/groupId version1.2-SNAPSHOT/version /parent Where as the pom for wicket-extensions goes to wicket 1.2.4... parent artifactIdwicket-parent/artifactId groupIdwicket/groupId version1.2.4/version relativePath../wicket-parent/relativePath /parent Does anyone know who to contact to have the wicket-auth-roles-1.2.4.pom updated, if this is the right thing to do? Thanks, Tim The Information contained in this e-mail message is intended only for the individuals named above. If you are not the intended recipient, you should be aware that any dissemination, distribution, forwarding or other duplication of this communication is strictly prohibited. The views expressed in this e-mail are those of the individual author and not necessarily those of LINK Interchange Network Ltd. Prior to taking any action based upon this e-mail message you should seek appropriate confirmation of its authenticity. If you have received this e-mail in error, please notify the sender immediately. - 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.phpp=sourceforgeCID=DEVDEV ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] wicket-auth-roles 1.2.4 pom
That's great. Thanks Martijn. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Martijn Dashorst Sent: 17 January 2007 12:47 To: wicket-user@lists.sourceforge.net Subject: Re: [Wicket-user] wicket-auth-roles 1.2.4 pom It is not possible to update a deployed pom on the ibiblio servers. Martijn On 1/17/07, Tim Squires [EMAIL PROTECTED] wrote: Hi, The pom for wicket-auth-roles http://wicket.sourceforge.net/maven2/wicket/wicket-auth-roles/1.2.4/wi ck et-auth-roles-1.2.4.pom refers to the wicket 1.2 snapshot... parent artifactIdwicket-parent/artifactId groupIdwicket/groupId version1.2-SNAPSHOT/version /parent Where as the pom for wicket-extensions goes to wicket 1.2.4... parent artifactIdwicket-parent/artifactId groupIdwicket/groupId version1.2.4/version relativePath../wicket-parent/relativePath /parent Does anyone know who to contact to have the wicket-auth-roles-1.2.4.pom updated, if this is the right thing to do? Thanks, Tim __ __ The Information contained in this e-mail message is intended only for the individuals named above. If you are not the intended recipient, you should be aware that any dissemination, distribution, forwarding or other duplication of this communication is strictly prohibited. The views expressed in this e-mail are those of the individual author and not necessarily those of LINK Interchange Network Ltd. Prior to taking any action based upon this e-mail message you should seek appropriate confirmation of its authenticity. If you have received this e-mail in error, please notify the sender immediately. __ __ -- --- 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.phpp=sourceforgeCID=DEV DEV ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user -- Vote for Wicket at the http://www.thebeststuffintheworld.com/vote_for/wicket Wicket 1.2.4 is as easy as 1-2-4. Download Wicket now! http://wicketframework.org - 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.phpp=sourceforgeCID=DEVDE V ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user This email has been scanned for all viruses by the MessageLabs SkyScan service. For more information on a proactive anti-virus service working around the clock, around the globe, visit http://www.messagelabs.com LINK Information Security The Information contained in this e-mail message is intended only for the individuals named above. If you are not the intended recipient, you should be aware that any dissemination, distribution, forwarding or other duplication of this communication is strictly prohibited. The views expressed in this e-mail are those of the individual author and not necessarily those of LINK Interchange Network Ltd. Prior to taking any action based upon this e-mail message you should seek appropriate confirmation of its authenticity. If you have received this e-mail in error, please notify the sender immediately. - 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.phpp=sourceforgeCID=DEVDEV ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
[Wicket-user] DataView modelChanged
Hi again, I have a simple DataView where one of the columns contains a Link which onClick modifies the data. What is the best way of telling the DataView that the model has changed. I've tried a few things, see the comments in the code Thanks for your help, Tim DataView dataView = new DataView(tasks, new UserTaskDataProvider(user)) { protected void populateItem(final Item item) { final TaskInstance task = (TaskInstance) item.getModelObject(); item.add(new Label(taskName, task.getName())); // add a link that, when clicked, assigns the task back to // the group Link assignLink = new Link(assignLink) { @Override public void onClick() { ATMInstallsDao.getFromApplicationContext() .assignTaskToGroup(task.getId(), InstallsTeam); //-PLEASE HELP WITH THIS BIT- // tell wicket that we've changed the model so it // updates the page //tried... // modelChanged(); - does nothing (the Link objects model??) // DataView.this.modelChanged(); - does not compile no DataView parent??? // This works but is not really the most efficient!. getRequestCycle().setResponsePage(new UserTasksPage(userName)); // } }; assignLink.add(new Label(assignLinkLabel, assign to group)); item.add(assignLink); } }; The Information contained in this e-mail message is intended only for the individuals named above. If you are not the intended recipient, you should be aware that any dissemination, distribution, forwarding or other duplication of this communication is strictly prohibited. The views expressed in this e-mail are those of the individual author and not necessarily those of LINK Interchange Network Ltd. Prior to taking any action based upon this e-mail message you should seek appropriate confirmation of its authenticity. If you have received this e-mail in error, please notify the sender immediately. - 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.phpp=sourceforgeCID=DEVDEV ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user