2nd try: stateless AJAX behaviors in stateful page without its serialization
I have pretty stateful page with plenty of AJAX components. Most of these components have behaviors, which renders JavaScript code for calling AJAX requests to Java code. Because page isn't stateless, each request causes serialization of page. So far so good. But some of these AJAX requests doesn't change page ever, so serialization of page isn't necessary. For example it is forward caching data for (home-brewed) datagrid component. These requests are calling continuously and serialization of page during each request causes delays. There are some projects for stateless wicket components out there, e.g. http://code.google.com/p/jolira-tools/, but it solves another situation -- request of stateless components are processed on new instances of stateless pages. I want to process requests on existing stateful page instance but without its serialization. I have tried to implement this in my own RequestCycleProcessor.resolve(), but I hung on searching for page from requestParameters because Session.getPage() always touches page and it causes serialization after request processing. Is there any example, idea, whatever for implementing this in Wicket? Thanks, Martin Schayna - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: 2nd try: stateless AJAX behaviors in stateful page without its serialization
so for that ajax request you do want to create a new page every time the ajax request hits? 2010/4/19 Martin Schayna martin.scha...@abra.eu I have pretty stateful page with plenty of AJAX components. Most of these components have behaviors, which renders JavaScript code for calling AJAX requests to Java code. Because page isn't stateless, each request causes serialization of page. So far so good. But some of these AJAX requests doesn't change page ever, so serialization of page isn't necessary. For example it is forward caching data for (home-brewed) datagrid component. These requests are calling continuously and serialization of page during each request causes delays. There are some projects for stateless wicket components out there, e.g. http://code.google.com/p/jolira-tools/, but it solves another situation -- request of stateless components are processed on new instances of stateless pages. I want to process requests on existing stateful page instance but without its serialization. I have tried to implement this in my own RequestCycleProcessor.resolve(), but I hung on searching for page from requestParameters because Session.getPage() always touches page and it causes serialization after request processing. Is there any example, idea, whatever for implementing this in Wicket? Thanks, Martin Schayna - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: 2nd try: stateless AJAX behaviors in stateful page without its serialization
No, I want to process these requests in context of existing original page instance, but without page serialization. Standard processing of ajax requests is implemented in WebRequestCycleProcessor class, in method resolve(). This method is called with RequestParameters instance which is only parsed request parameters like page, pagemap and component identification. Standard wicket implementation of resolve() searches for page by calling Session.getPage() method -- that's ok, but calling this method calls also Session.touch() method, which causes serialization of this page after processing request... What I want is: in processing some specific requests do not serialize the page, because these requests don't change the page and they are called continuously by design. I can extend WebRequestCycleProcessor and override resolve() method, but I cannot avoid searching page by calling Session.getPage(). M. On 19.4.2010 10:37, Johan Compagner wrote: so for that ajax request you do want to create a new page every time the ajax request hits? 2010/4/19 Martin Schaynamartin.scha...@abra.eu I have pretty stateful page with plenty of AJAX components. Most of these components have behaviors, which renders JavaScript code for calling AJAX requests to Java code. Because page isn't stateless, each request causes serialization of page. So far so good. But some of these AJAX requests doesn't change page ever, so serialization of page isn't necessary. For example it is forward caching data for (home-brewed) datagrid component. These requests are calling continuously and serialization of page during each request causes delays. There are some projects for stateless wicket components out there, e.g. http://code.google.com/p/jolira-tools/, but it solves another situation -- request of stateless components are processed on new instances of stateless pages. I want to process requests on existing stateful page instance but without its serialization. I have tried to implement this in my own RequestCycleProcessor.resolve(), but I hung on searching for page from requestParameters because Session.getPage() always touches page and it causes serialization after request processing. Is there any example, idea, whatever for implementing this in Wicket? Thanks, Martin Schayna - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
how to handle clear input for custom FormComponents
Hi all, I've developed a custom FormComponent (by subclassing FormComponentPanel) to act as a reference from one object to another (eg a Customer to an Address), but am having problems figuring out how to handle clear input (ie, if the user hits the cancel button on the form). To explain a little further, the FormComponent is called EntityLink, and renders the reference (eg the Customer's homeAddress) a hyperlink. I have a button on the EntityLink panel allowing the user to perform a search for other objects of the correct type, and then select it. Doing this updates the EntityLink component, with a pending value (ie of the new homeAddress). If the user hits the OK button, then the pending value is copied over to the domain object (ie to the Customer's actual homeAddress property). In the cancel button's onSubmit() method I'm calling getForm().clearInput(), which seems to use a visitor to call clearInput() on all child FormComponent's. The FormComponent's clearInput() method seems only to set the rawInput to a constant (NO_RAW_INPUT), which looks like it's a magic value of some kind when the form component is actually rendered - all rather low level. I think what I'd like is to eagerly capture this clearInput so that I can reset my EntityLink's hyperlink back to the original value and discard the pending value. However, clearInput() is unfortunately marked as final so there doesn't seem to be any easy way to capture this. Looking at other implementations of FormComponentPanel (eg DateTimeField) they are really very little other than wrappers around simple FormComponents, so they don't offer any real clues. Can anyone help me here, then? Thanks Dan -- Dan Haywood consultant, mentor, developer, author agile, ddd, oo, java, .net, sybase MA, MBCS, CITP, CEng /mail: /d...@haywood-associates.co.uk mailto:d...@haywood-associates.co.uk /phone: /+44 (0)7961 144286 /book: /Domain Driven Design using Naked Objects http://pragprog.com/titles/dhnako /blog: /http://danhaywood.com /linked in: /http://uk.linkedin.com/in/dkhaywood /twitter: /http://twitter.com/dkhaywood /sybase: /http://sybtraining.co.uk - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
RE: how to handle clear input for custom FormComponents
You shouldn't be committing your changes to the actual domain object until the form is submitted (your ok button). Jeremy Thomerson http://www.wickettraining.com -- sent from a wireless device -Original Message- From: Dan Haywood dkhayw...@gmail.com Sent: Monday, April 19, 2010 5:53 AM To: users@wicket.apache.org Subject: how to handle clear input for custom FormComponents Hi all, I've developed a custom FormComponent (by subclassing FormComponentPanel) to act as a reference from one object to another (eg a Customer to an Address), but am having problems figuring out how to handle clear input (ie, if the user hits the cancel button on the form). To explain a little further, the FormComponent is called EntityLink, and renders the reference (eg the Customer's homeAddress) a hyperlink. I have a button on the EntityLink panel allowing the user to perform a search for other objects of the correct type, and then select it. Doing this updates the EntityLink component, with a pending value (ie of the new homeAddress). If the user hits the OK button, then the pending value is copied over to the domain object (ie to the Customer's actual homeAddress property). In the cancel button's onSubmit() method I'm calling getForm().clearInput(), which seems to use a visitor to call clearInput() on all child FormComponent's. The FormComponent's clearInput() method seems only to set the rawInput to a constant (NO_RAW_INPUT), which looks like it's a magic value of some kind when the form component is actually rendered - all rather low level. I think what I'd like is to eagerly capture this clearInput so that I can reset my EntityLink's hyperlink back to the original value and discard the pending value. However, clearInput() is unfortunately marked as final so there doesn't seem to be any easy way to capture this. Looking at other implementations of FormComponentPanel (eg DateTimeField) they are really very little other than wrappers around simple FormComponents, so they don't offer any real clues. Can anyone help me here, then? Thanks Dan -- Dan Haywood consultant, mentor, developer, author agile, ddd, oo, java, .net, sybase MA, MBCS, CITP, CEng mail: d...@haywood-associates.co.uk phone: +44 (0)7961 144286 book: Domain Driven Design using Naked Objects blog: http://danhaywood.com linked in: http://uk.linkedin.com/in/dkhaywood twitter: http://twitter.com/dkhaywood sybase: http://sybtraining.co.uk
DropDownList
Hello guys, I am using a dropdownlist that am using to display a list of objects. however i want to replace the Choose one text with the first element in the list. how do i do this. Kind regards Josh
Re: DropDownList
Preselect? dropdown.setModelObject(default); Or default in your model. ** Martin 2010/4/19 Josh Kamau joshnet2...@gmail.com: Hello guys, I am using a dropdownlist that am using to display a list of objects. however i want to replace the Choose one text with the first element in the list. how do i do this. Kind regards Josh - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: DropDownList
just override protected CharSequence getDefaultChoice(Object selected) { and return this.getChoices.get(0).toString ... but be sure what you do! -- View this message in context: http://n4.nabble.com/DropDownList-tp2015827p2015837.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: DropDownList
Thanks alot Martin and MattyDE, Martin's solution is exactly what i wanted. Regards. On Mon, Apr 19, 2010 at 3:42 PM, MattyDE ufer.mar...@gmail.com wrote: just override protected CharSequence getDefaultChoice(Object selected) { and return this.getChoices.get(0).toString ... but be sure what you do! -- View this message in context: http://n4.nabble.com/DropDownList-tp2015827p2015837.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: DropDownList
Josh, This seems to be one of the hardest things for new Wicketeers, understanding how models work. Basically, when you tell the DropDownChoice to use a model, you're saying when you want to know/update what's selected, go here. The funny thing about models is that they really are quite simple; it's just a mindset change. Good luck! James On Mon, Apr 19, 2010 at 8:52 AM, Josh Kamau joshnet2...@gmail.com wrote: Thanks alot Martin and MattyDE, Martin's solution is exactly what i wanted. Regards. On Mon, Apr 19, 2010 at 3:42 PM, MattyDE ufer.mar...@gmail.com wrote: just override protected CharSequence getDefaultChoice(Object selected) { and return this.getChoices.get(0).toString ... but be sure what you do! -- View this message in context: http://n4.nabble.com/DropDownList-tp2015827p2015837.html Sent from the Wicket - User mailing list archive at Nabble.com. - 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: DropDownList
God bless hollywood. ** Martin 2010/4/19 James Carman jcar...@carmanconsulting.com: Josh, This seems to be one of the hardest things for new Wicketeers, understanding how models work. Basically, when you tell the DropDownChoice to use a model, you're saying when you want to know/update what's selected, go here. The funny thing about models is that they really are quite simple; it's just a mindset change. Good luck! James On Mon, Apr 19, 2010 at 8:52 AM, Josh Kamau joshnet2...@gmail.com wrote: Thanks alot Martin and MattyDE, Martin's solution is exactly what i wanted. Regards. On Mon, Apr 19, 2010 at 3:42 PM, MattyDE ufer.mar...@gmail.com wrote: just override protected CharSequence getDefaultChoice(Object selected) { and return this.getChoices.get(0).toString ... but be sure what you do! -- View this message in context: http://n4.nabble.com/DropDownList-tp2015827p2015837.html Sent from the Wicket - User mailing list archive at Nabble.com. - 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: DropDownList
Thanks James. I think its slowly sinking into my Medulla Oblongata. On Mon, Apr 19, 2010 at 3:56 PM, James Carman jcar...@carmanconsulting.comwrote: Josh, This seems to be one of the hardest things for new Wicketeers, understanding how models work. Basically, when you tell the DropDownChoice to use a model, you're saying when you want to know/update what's selected, go here. The funny thing about models is that they really are quite simple; it's just a mindset change. Good luck! James On Mon, Apr 19, 2010 at 8:52 AM, Josh Kamau joshnet2...@gmail.com wrote: Thanks alot Martin and MattyDE, Martin's solution is exactly what i wanted. Regards. On Mon, Apr 19, 2010 at 3:42 PM, MattyDE ufer.mar...@gmail.com wrote: just override protected CharSequence getDefaultChoice(Object selected) { and return this.getChoices.get(0).toString ... but be sure what you do! -- View this message in context: http://n4.nabble.com/DropDownList-tp2015827p2015837.html Sent from the Wicket - User mailing list archive at Nabble.com. - 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 handle clear input for custom FormComponents
I found a way to make this work (though I worry the solution might be a little fragile). Basically, I'm overriding getInputAsArray() in my wrapper EntityLink, delegating to a hidden text field; then, in onBeforeRender() I check if there is input, and if not then infer that clearInput must've been called on and so zap the value of the hidden text field. If anyone cares to look at the code, it's on sourceforge: http://wicketobjects.svn.sourceforge.net/viewvc/wicketobjects/trunk/main/viewer/src/main/java/org/starobjects/wicket/viewer/components/entitylink/EntityLink.java?revision=78view=markup Thanks anyway Dan Dan Haywood consultant, mentor, developer, author agile, ddd, oo, java, .net, sybase MA, MBCS, CITP, CEng /mail: /d...@haywood-associates.co.uk mailto:d...@haywood-associates.co.uk /phone: /+44 (0)7961 144286 /book: /Domain Driven Design using Naked Objects http://pragprog.com/titles/dhnako /blog: /http://danhaywood.com /linked in: /http://uk.linkedin.com/in/dkhaywood /twitter: /http://twitter.com/dkhaywood /sybase: /http://sybtraining.co.uk On 19/04/2010 13:08, Jeremy Thomerson wrote: You shouldn't be committing your changes to the actual domain object until the form is submitted (your ok button). Jeremy Thomerson http://www.wickettraining.com -- sent from a wireless device From: Dan Haywood dkhayw...@gmail.com Sent: Monday, April 19, 2010 5:53 AM To: users@wicket.apache.org Subject: how to handle clear input for custom FormComponents Hi all, I've developed a custom FormComponent (by subclassing FormComponentPanel) to act as a reference from one object to another (eg a Customer to an Address), but am having problems figuring out how to handle clear input (ie, if the user hits the cancel button on the form). To explain a little further, the FormComponent is called EntityLink, and renders the reference (eg the Customer's homeAddress) a hyperlink. I have a button on the EntityLink panel allowing the user to perform a search for other objects of the correct type, and then select it. Doing this updates the EntityLink component, with a pending value (ie of the new homeAddress). If the user hits the OK button, then the pending value is copied over to the domain object (ie to the Customer's actual homeAddress property). In the cancel button's onSubmit() method I'm calling getForm().clearInput(), which seems to use a visitor to call clearInput() on all child FormComponent's. The FormComponent's clearInput() method seems only to set the rawInput to a constant (NO_RAW_INPUT), which looks like it's a magic value of some kind when the form component is actually rendered - all rather low level. I think what I'd like is to eagerly capture this clearInput so that I can reset my EntityLink's hyperlink back to the original value and discard the pending value. However, clearInput() is unfortunately marked as final so there doesn't seem to be any easy way to capture this. Looking at other implementations of FormComponentPanel (eg DateTimeField) they are really very little other than wrappers around simple FormComponents, so they don't offer any real clues. Can anyone help me here, then? Thanks Dan -- Dan Haywood consultant, mentor, developer, author agile, ddd, oo, java, .net, sybase MA, MBCS, CITP, CEng /mail: /d...@haywood-associates.co.uk mailto:d...@haywood-associates.co.uk /phone: /+44 (0)7961 144286 /book: /Domain Driven Design using Naked Objects http://pragprog.com/titles/dhnako /blog: /http://danhaywood.com /linked in: /http://uk.linkedin.com/in/dkhaywood /twitter: /http://twitter.com/dkhaywood /sybase: /http://sybtraining.co.uk - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
What is the best way to use LoadableDetachableModel with a WebPage and DataView?
Hi All, I need help with a Wicket architecture design issue that I am having. In previous Wicket applications, I have used the LoadableDetachableModel in 2 separate ways: 1) In the constructor of a WebPage, an LDM is instantiated and then used as the model for a component such as a ListView. This is staight out of Wicket In Action Chapter 4 on LDMs. 2) As the model for a SortableDataProvider to be used with a DataView component. I have more or less used the WicketStuff SortingPage example as a guide. That is, the SortableDataProvider uses an LDM to supply its own backing data. For a new Wicket application, I have a WebPage that will have the following aspects: 1) A sortable grid based on the DataView component. 2) The data behind the grid is a collection of Job Application objects that is owned by an Applicant object. 3) A link somewhere else on the page will cause a new Job Application object to be added to the Applicant's list. 4) Adding the Job Application object will cause a new record to be written to the underlying database. Hibernate will be used as the persistence framework. So here is my issue: For this new application, is the correct approach to: 1) create an LDM in the WebPage's constructor that loads the Applicant object, 2) pass the Applicant object's collection of Job Applications objects to the SortableDataProvider that is used with the DataView component? Or should the SortableDataProvider use its own LDM that is separate from the one used on the WebPage? Thanks in advance, Steve
Shutting down wicketstuff jira and confluence (temporarily)
In the light of the current JIRA XSS attacks I've shut down JIRA and Confluence, pending an investigation and upgrade of both products. Martijn -- 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.4 - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Date components
Hi All, Does anyone have any good suggestions for date/time entry components? Does Wicket offer a standard solution for this common case? Thanks, Ray Weidner
Re: Date components
You just add the following code to your java page: *add(dateTimeField = new DateTimeField(dateEnvoi, new PropertyModel(this, date)) {});* Which dateEnvoi defined in the markup file (the key of the component). And date defined in java like : private Date date = new Date(); 2010/4/19 Ray Weidner ray.weidner.wic...@gmail.com Hi All, Does anyone have any good suggestions for date/time entry components? Does Wicket offer a standard solution for this common case? Thanks, Ray Weidner
Re: Date components
Thanks, I'll give that one a try. On Mon, Apr 19, 2010 at 10:59 AM, moèz ben rhouma benrhouma.m...@gmail.comwrote: You just add the following code to your java page: *add(dateTimeField = new DateTimeField(dateEnvoi, new PropertyModel(this, date)) {});* Which dateEnvoi defined in the markup file (the key of the component). And date defined in java like : private Date date = new Date(); 2010/4/19 Ray Weidner ray.weidner.wic...@gmail.com Hi All, Does anyone have any good suggestions for date/time entry components? Does Wicket offer a standard solution for this common case? Thanks, Ray Weidner
problem populating ListMultipleChoice selection model
Hi All, I'm trying to do something pretty simple: create a choice list with multi-select, which I iterate through upon clicking a button. Unfortunately, it looks like my selections aren't being recorded in the model that's supposed to receive them. Here's what the pertinent code looks like: - Java: public EditIssuePage extends WebPage { // I've tried removing the 'transient' keyword, but that doesn't change anything transient private Set Party selectedParties = new HashMap Party (); ... public EditIssuePage () { ... Form form = new Form (editIssueForm); add (form); ... ListMultipleChoice Party partyChoice = new ListMultipleChoice Party ( parties, new PropertyModel (this, selectedParties), new LoadableDetachableModel List Party () { @Override public List Party load () { return new Vector Party (retrieveAllPartiesFromDAO ()); } }, new IChoiceRenderer Party () { public Object getDisplayValue (Party object) { return object.getFullName (); } public String getIdValue (Party object, int index) { return object.getId (); } } ); Button addPartiesButton = new Button (addPartiesButton) { @Override public void onSubmit () { logger.debug (Number of selected parties: + selectedParties.size ()); // always reporting zero! for (Party selectedParty : selectedParties) { ... } } }; form.add (partyChoice); form.add (addPartiesButton); } private Set Party retrieveAllPartiesFromDAO () { // does what it sounds like } } - HTML: (My memory is a bit hazy here; I don't have any of this code in front of me as I write this) ... select multiple wicket:id=parties option[A party should be here]/option /select submit wicket:id=addPartiesButton name=Add Selected Parties/ ... The page renders fine, with all Party objects listed for selection. But when I select one or more of the rows and click the button, the log message I see is Number of selected parties: 0, no matter what. I have very similar logic working on another page, so I'm pretty confused about what's the problem here. All advice is much appreciated. Thanks, Ray Weidner
Re: problem populating ListMultipleChoice selection model
Try to change the type of selectedParties from set to List selectedParties = new ArrayList(); 2010/4/19 Ray Weidner ray.weidner.wic...@gmail.com Hi All, I'm trying to do something pretty simple: create a choice list with multi-select, which I iterate through upon clicking a button. Unfortunately, it looks like my selections aren't being recorded in the model that's supposed to receive them. Here's what the pertinent code looks like: - Java: public EditIssuePage extends WebPage { // I've tried removing the 'transient' keyword, but that doesn't change anything transient private Set Party selectedParties = new HashMap Party (); ... public EditIssuePage () { ... Form form = new Form (editIssueForm); add (form); ... ListMultipleChoice Party partyChoice = new ListMultipleChoice Party ( parties, new PropertyModel (this, selectedParties), new LoadableDetachableModel List Party () { @Override public List Party load () { return new Vector Party (retrieveAllPartiesFromDAO ()); } }, new IChoiceRenderer Party () { public Object getDisplayValue (Party object) { return object.getFullName (); } public String getIdValue (Party object, int index) { return object.getId (); } } ); Button addPartiesButton = new Button (addPartiesButton) { @Override public void onSubmit () { logger.debug (Number of selected parties: + selectedParties.size ()); // always reporting zero! for (Party selectedParty : selectedParties) { ... } } }; form.add (partyChoice); form.add (addPartiesButton); } private Set Party retrieveAllPartiesFromDAO () { // does what it sounds like } } - HTML: (My memory is a bit hazy here; I don't have any of this code in front of me as I write this) ... select multiple wicket:id=parties option[A party should be here]/option /select submit wicket:id=addPartiesButton name=Add Selected Parties/ ... The page renders fine, with all Party objects listed for selection. But when I select one or more of the rows and click the button, the log message I see is Number of selected parties: 0, no matter what. I have very similar logic working on another page, so I'm pretty confused about what's the problem here. All advice is much appreciated. Thanks, Ray Weidner
Re: problem populating ListMultipleChoice selection model
Hi Moez, I'll give that a try when I have the code in front of me. But I'd be surprised if that works, because I am doing precisely the same thing on another page, including using a Set for the selected item model. In that instance, there's no problem. On Mon, Apr 19, 2010 at 11:55 AM, moèz ben rhouma benrhouma.m...@gmail.comwrote: Try to change the type of selectedParties from set to List selectedParties = new ArrayList(); 2010/4/19 Ray Weidner ray.weidner.wic...@gmail.com Hi All, I'm trying to do something pretty simple: create a choice list with multi-select, which I iterate through upon clicking a button. Unfortunately, it looks like my selections aren't being recorded in the model that's supposed to receive them. Here's what the pertinent code looks like: - Java: public EditIssuePage extends WebPage { // I've tried removing the 'transient' keyword, but that doesn't change anything transient private Set Party selectedParties = new HashMap Party (); ... public EditIssuePage () { ... Form form = new Form (editIssueForm); add (form); ... ListMultipleChoice Party partyChoice = new ListMultipleChoice Party ( parties, new PropertyModel (this, selectedParties), new LoadableDetachableModel List Party () { @Override public List Party load () { return new Vector Party (retrieveAllPartiesFromDAO ()); } }, new IChoiceRenderer Party () { public Object getDisplayValue (Party object) { return object.getFullName (); } public String getIdValue (Party object, int index) { return object.getId (); } } ); Button addPartiesButton = new Button (addPartiesButton) { @Override public void onSubmit () { logger.debug (Number of selected parties: + selectedParties.size ()); // always reporting zero! for (Party selectedParty : selectedParties) { ... } } }; form.add (partyChoice); form.add (addPartiesButton); } private Set Party retrieveAllPartiesFromDAO () { // does what it sounds like } } - HTML: (My memory is a bit hazy here; I don't have any of this code in front of me as I write this) ... select multiple wicket:id=parties option[A party should be here]/option /select submit wicket:id=addPartiesButton name=Add Selected Parties/ ... The page renders fine, with all Party objects listed for selection. But when I select one or more of the rows and click the button, the log message I see is Number of selected parties: 0, no matter what. I have very similar logic working on another page, so I'm pretty confused about what's the problem here. All advice is much appreciated. Thanks, Ray Weidner
Re: Wicket Branding with setStyle - question about static images in src/webapp/*
see ContextImage, create your own version that is style-aware. alternatively you can create tag handlers just like wicket:link that will add your own version of ContextImage for you. -igor On Sun, Apr 18, 2010 at 11:16 AM, Martin Makundi martin.maku...@koodaripalvelut.com wrote: Hi! I am trying to brand my app with session.setStyle. My question is about static images in src/webapp/* I have been using them like img src=/images/logo.png/ Do I have to switch them into img src=/images/logo.png wicket:id=image-tag/ and attach a corresponding Image component? Seems like a lot of work and it will not work properly with images referred in css files. Couldn't I just parametrize WicketServlet somehow to serve styled images and fallback on default when styled image is not available? Anybody done this before, care to drop few example lines of code? ** Martin - 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: Javascript template as linked header contribution?
you will have to create a TextTemplateResource to serve such resources and a TextTemplateResourceReference to create urls for them. -igor On Sun, Apr 18, 2010 at 8:25 PM, Ralf Eichinger ralf.eichin...@pixotec.de wrote: How to change add(JavascriptPackageResource.getHeaderContribution(this.getClass(), js/lightbox.js)); so that variables inside lightbox.js are replace on delivery? I tried something like this: PackagedTextTemplate jsTemplate = new PackagedTextTemplate(this .getClass(), js/lightbox.js); TextTemplateSharedResourceFactory resourceReference = new TextTemplateSharedResourceFactory(jsTemplate, this.getClass()); String webappContext = WebApplication.get().getServletContext() .getContextPath(); MapString, Object parameters = new HashMapString, Object(); parameters.put(webappContext, webappContext); TextTemplateLink ref = new TextTemplateLink(, resourceReference, parameters); ??? what to do with link ??? or when I try ... add(TextTemplateHeaderContributor.forJavaScript(jsTemplate, new Model((Serializable) parameters))); the content is rendered into head, what I do not want. I just want a header contribution to a parsed template like this: script type=text/javascript src=.../script Any ideas? - 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: What is the best way to use LoadableDetachableModel with a WebPage and DataView?
why all the complexity of ldm inside idataprovider, why not just: class mydataprovider implements idataprovider { private long applicantid; private transient applicant applicant; private applicant getapplicant() { if (applicant==null) { applicant=dao.get(applicantid); }} private iterator(..) { return getapplicant().getapplications(); } private size() { return getapplicant().getapplications().size(); } private void detach() { applicant=null; } } -igor On Mon, Apr 19, 2010 at 7:42 AM, Steve Hiller sh...@bellsouth.net wrote: Hi All, I need help with a Wicket architecture design issue that I am having. In previous Wicket applications, I have used the LoadableDetachableModel in 2 separate ways: 1) In the constructor of a WebPage, an LDM is instantiated and then used as the model for a component such as a ListView. This is staight out of Wicket In Action Chapter 4 on LDMs. 2) As the model for a SortableDataProvider to be used with a DataView component. I have more or less used the WicketStuff SortingPage example as a guide. That is, the SortableDataProvider uses an LDM to supply its own backing data. For a new Wicket application, I have a WebPage that will have the following aspects: 1) A sortable grid based on the DataView component. 2) The data behind the grid is a collection of Job Application objects that is owned by an Applicant object. 3) A link somewhere else on the page will cause a new Job Application object to be added to the Applicant's list. 4) Adding the Job Application object will cause a new record to be written to the underlying database. Hibernate will be used as the persistence framework. So here is my issue: For this new application, is the correct approach to: 1) create an LDM in the WebPage's constructor that loads the Applicant object, 2) pass the Applicant object's collection of Job Applications objects to the SortableDataProvider that is used with the DataView component? Or should the SortableDataProvider use its own LDM that is separate from the one used on the WebPage? Thanks in advance, Steve - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
how to make a BookmarkablePageLink enabled when its parent component is disabled?
I have a FormComponentPanel (called EntityLink) that holds an image, a hyperlink (a BookmarkablePageLink) and a hidden text field holding the serializable value of the reference. Initially I want the form is in read-only mode and so I have disabled all of its form components. However, I'd like the link to be enabled. Looking at the source code, Wicket calls isLinkEnabled() to determine how to render the link; this in turn calls isEnabledInHierarchy(). My problem is the latter is (correctly returning false) but I want the former to return true. Both methods are final, however. I'm obviously tackling this incorrectly - so what would be the Wicket way? Thanks Dan -- Dan Haywood consultant, mentor, developer, author agile, ddd, oo, java, .net, sybase MA, MBCS, CITP, CEng /mail: /d...@haywood-associates.co.uk mailto:d...@haywood-associates.co.uk /phone: /+44 (0)7961 144286 /book: /Domain Driven Design using Naked Objects http://pragprog.com/titles/dhnako /blog: /http://danhaywood.com /linked in: /http://uk.linkedin.com/in/dkhaywood /twitter: /http://twitter.com/dkhaywood /sybase: /http://sybtraining.co.uk - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
How to validate an entire object in a form (rather than a particular property of that object)
Another form-related question. I can see how to install a validator on a Form - Form#add(IFormValidator) - but it seems that AbstractFormValidator, the adapter, always requires a specific FormComponent to be specified in its error(...) method. How does one raise an error on the state of the form (and by implication, that of the underlying domain object) itself, without having to specify any form component? An example would be the classic fromDate endDate. A workaround would be to install the validator on - say - the endDate. But I'm after a general solution, rather than a solution for this particular example. Thanks Dan -- Dan Haywood consultant, mentor, developer, author agile, ddd, oo, java, .net, sybase MA, MBCS, CITP, CEng /mail: /d...@haywood-associates.co.uk mailto:d...@haywood-associates.co.uk /phone: /+44 (0)7961 144286 /book: /Domain Driven Design using Naked Objects http://pragprog.com/titles/dhnako /blog: /http://danhaywood.com /linked in: /http://uk.linkedin.com/in/dkhaywood /twitter: /http://twitter.com/dkhaywood /sybase: /http://sybtraining.co.uk - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: What is the best way to use LoadableDetachableModel with a WebPage and DataView?
So the Sorting DataView Example at wicket-library.com is overkill? It uses an LDM, and that's what I based my own implementations on before. -- View this message in context: http://n4.nabble.com/What-is-the-best-way-to-use-LoadableDetachableModel-with-a-WebPage-and-DataView-tp2016027p2016272.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Shutting down wicketstuff jira and confluence (temporarily)
Great news :) 2010/4/19 Martijn Dashorst martijn.dasho...@gmail.com: In the light of the current JIRA XSS attacks I've shut down JIRA and Confluence, pending an investigation and upgrade of both products. Martijn -- 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.4 - 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: Shutting down wicketstuff jira and confluence (temporarily)
Shame real shame. Why ppl have to exercise their intellectual evilness on community sites like these. Regards, Apple Grew my blog @ http://blog.applegrew.com/ On Mon, Apr 19, 2010 at 11:02 PM, nino martinez wael nino.martinez.w...@gmail.com wrote: Great news :) 2010/4/19 Martijn Dashorst martijn.dasho...@gmail.com: In the light of the current JIRA XSS attacks I've shut down JIRA and Confluence, pending an investigation and upgrade of both products. Martijn -- 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.4 - 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: Exception propagation
Okay, eventually I figured that out myself: - so, as per the wiki, the web.xml should have the following for the wicket filter: filter-mapping filter-namewicket/filter-name url-pattern/*/url-pattern dispatcherREQUEST/dispatcher dispatcherERROR/dispatcher /filter-mapping - the WebApplication subclass would have something like this (may be unconditional if needed for both development and deployment modes): if (DEPLOYMENT.equalsIgnoreCase(getConfigurationType())) { getExceptionSettings().setUnexpectedExceptionDisplay(IExceptionSettings.SHOW_NO_EXCEPTION_PAGE); } ... public final RequestCycle newRequestCycle(final Request request, final Response response) { return new ExceptionHandlingRequestCycle (this, (WebRequest)request, (WebResponse)response); } - the exception handling request cycle subclass would have (again, may be unconditional if needed for both development and deployment modes) public final Page onRuntimeException(final Page page, final RuntimeException e) { if (WebApplication.DEPLOYMENT.equalsIgnoreCase(getApplication().getConfigurationType())) { throw new AbortWithWebErrorCodeException(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); } else { return super.onRuntimeException(page, e); } } Note the AbortWithWebErrorCodeException - it's not the AbortWithHttpStatusException (which doesn't work). - now in the web.xml you can have: error-page error-code500/error-code location/xxx/location /error-page /xxx may be either another wicket mounted path or it may be a static resource not managed by wicket. Now you have standard (specwise) error handling support in the web app. -- View this message in context: http://n4.nabble.com/Exception-propagation-tp1934370p2016271.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: How to validate an entire object in a form (rather than a particular property of that object)
Hi Dan On Mon, Apr 19, 2010 at 2:04 PM, Dan Haywood dkhayw...@gmail.com wrote: Another form-related question. I can see how to install a validator on a Form - Form#add(IFormValidator) - but it seems that AbstractFormValidator, the adapter, always requires a specific FormComponent to be specified in its error(...) method. How does one raise an error on the state of the form (and by implication, that of the underlying domain object) itself, without having to specify any form component? FeedbackMessages API, is expection an Component object as reporter. Maybe add the validation error to the form component will make sense: formComponent.getForm().error( theValidationErrorNotFormComponentSpecific ) An example would be the classic fromDate endDate. A workaround would be to install the validator on - say - the endDate. But I'm after a general solution, rather than a solution for this particular example. Thanks Dan -- Dan Haywood consultant, mentor, developer, author agile, ddd, oo, java, .net, sybase MA, MBCS, CITP, CEng *mail: * d...@haywood-associates.co.uk *phone: *+44 (0)7961 144286 *book: *Domain Driven Design using Naked Objects http://pragprog.com/titles/dhnako *blog: *http://danhaywood.com *linked in: *http://uk.linkedin.com/in/dkhaywood *twitter: *http://twitter.com/dkhaywood *sybase: * http://sybtraining.co.uk - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- Pedro Henrique Oliveira dos Santos
Re: how to make a BookmarkablePageLink enabled when its parent component is disabled?
Hi, you can override the isEnable method and implement your rule, like: new BookmarkablePageLink { boolean isEnabled() { return form.getState() == allowedState; } } or you can add the link higher in the component hierarchy, don't as an form child. On Mon, Apr 19, 2010 at 1:45 PM, Dan Haywood dkhayw...@gmail.com wrote: I have a FormComponentPanel (called EntityLink) that holds an image, a hyperlink (a BookmarkablePageLink) and a hidden text field holding the serializable value of the reference. Initially I want the form is in read-only mode and so I have disabled all of its form components. However, I'd like the link to be enabled. Looking at the source code, Wicket calls isLinkEnabled() to determine how to render the link; this in turn calls isEnabledInHierarchy(). My problem is the latter is (correctly returning false) but I want the former to return true. Both methods are final, however. I'm obviously tackling this incorrectly - so what would be the Wicket way? Thanks Dan -- Dan Haywood consultant, mentor, developer, author agile, ddd, oo, java, .net, sybase MA, MBCS, CITP, CEng *mail: * d...@haywood-associates.co.uk *phone: *+44 (0)7961 144286 *book: *Domain Driven Design using Naked Objects http://pragprog.com/titles/dhnako *blog: *http://danhaywood.com *linked in: *http://uk.linkedin.com/in/dkhaywood *twitter: *http://twitter.com/dkhaywood *sybase: * http://sybtraining.co.uk - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- Pedro Henrique Oliveira dos Santos
Another beginner localization question
Hi, I'm using a wicket:message tags, property files and a ChoiceRenderer to allow users to switch the Locale. My ChoiceRenderer overrides wantOnSelectionChangedNotifications() to have the browser send a Locale change event to the server and when this call returns, all wicket:message content is updated to match the new locale's messages. This all works fine. However, I also have a DatePicker JQueryUI component component on my page which needs to be adjusted. This is done by having the browser execute the JavaScript: script type='text/javascript' $(function() { $.datepicker.setDefaults($.datepicker.regional['_[LOCALE]_']); }); /script Is it possible to have the browser to execute some dynamically-generated JavaScript using the ChoiceRenderer's onSelectionChanged() event? Thanks in advance. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Another beginner localization question
Your ChoiceRenderer can implement IHeaderContributor and add your javascript to IHeaderResponse object, since when the user change the value on the selection component, the page will to be re-rendered On Mon, Apr 19, 2010 at 4:54 PM, Alexandros Karypidis akary...@yahoo.grwrote: Hi, I'm using a wicket:message tags, property files and a ChoiceRenderer to allow users to switch the Locale. My ChoiceRenderer overrides wantOnSelectionChangedNotifications() to have the browser send a Locale change event to the server and when this call returns, all wicket:message content is updated to match the new locale's messages. This all works fine. However, I also have a DatePicker JQueryUI component component on my page which needs to be adjusted. This is done by having the browser execute the JavaScript: script type='text/javascript' $(function() { $.datepicker.setDefaults($.datepicker.regional['_[LOCALE]_']); }); /script Is it possible to have the browser to execute some dynamically-generated JavaScript using the ChoiceRenderer's onSelectionChanged() event? Thanks in advance. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- Pedro Henrique Oliveira dos Santos
Re: Another beginner localization question
Aha! ...the joys of learning Wicket! :-) On 19/4/2010 10:58 μμ, Pedro Santos wrote: Your ChoiceRenderer can implement IHeaderContributor and add your javascript to IHeaderResponse object, since when the user change the value on the selection component, the page will to be re-rendered On Mon, Apr 19, 2010 at 4:54 PM, Alexandros Karypidisakary...@yahoo.grwrote: Hi, I'm using awicket:message tags, property files and a ChoiceRenderer to allow users to switch the Locale. My ChoiceRenderer overrides wantOnSelectionChangedNotifications() to have the browser send a Locale change event to the server and when this call returns, allwicket:message content is updated to match the new locale's messages. This all works fine. However, I also have a DatePicker JQueryUI component component on my page which needs to be adjusted. This is done by having the browser execute the JavaScript: script type='text/javascript' $(function() { $.datepicker.setDefaults($.datepicker.regional['_[LOCALE]_']); }); /script Is it possible to have the browser to execute some dynamically-generated JavaScript using the ChoiceRenderer's onSelectionChanged() event? Thanks in advance. - 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
What can I do to speed up wicket initialization?
Hi there: I know it's not THAT slow, and every presentation framework has it's loading time, but in my case this is affecting me in a much worse way and there's no other solution for now. Can any wicket expert tell me what can I do (anything: pre-compile something, do something lazily, avoid something, etc) to speed up wicket initialization? In GAE environment it takes up to 10 seconds from the moment I see the log entry Started Wicket in deployment mode. I provide more details about my problem below. Thanks, Esteban My Problem: I'm using GAE and currently there's a problem that when your app gets few traffic, it gets cycled out (kicked out of the jvm) after a few minutes of not being accessed by anyone. So when your app (as mine) gets few visits, almost every visit takes up to 10 seconds because wicket initializes every time. There has been a number of solutions proposed: - Run a cron job to visit the app so it's kept warm. This is discouraged from Google guys, as it would take all of us to the Tragedy of the Commons ( http://groups.google.com/group/google-appengine/browse_thread/thread/22692895421825cb/) - Pay to reserve a JVM (not available yet, http://code.google.com/p/googleappengine/issues/detail?id=2456 ) - Do anything you can to optimize your initialization code (here I am!)
Re: mountBookmarkablePage() and ajaxlink problem.
Does Product implements Serializable? -- View this message in context: http://n4.nabble.com/mountBookmarkablePage-and-ajaxlink-problem-tp2014767p2016617.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: What can I do to speed up wicket initialization?
This is typically not Wicket initialization. The quickstart starts up in less than two seconds. You need to look at your domain / service / data layers. It's typically Spring / Hibernate loading / initializing that takes a long time (I've seen apps that take many *minutes* to start up). -- Jeremy Thomerson http://www.wickettraining.com On Mon, Apr 19, 2010 at 4:19 PM, Esteban Ignacio Masoero emaso...@getsense.com.ar wrote: Hi there: I know it's not THAT slow, and every presentation framework has it's loading time, but in my case this is affecting me in a much worse way and there's no other solution for now. Can any wicket expert tell me what can I do (anything: pre-compile something, do something lazily, avoid something, etc) to speed up wicket initialization? In GAE environment it takes up to 10 seconds from the moment I see the log entry Started Wicket in deployment mode. I provide more details about my problem below. Thanks, Esteban My Problem: I'm using GAE and currently there's a problem that when your app gets few traffic, it gets cycled out (kicked out of the jvm) after a few minutes of not being accessed by anyone. So when your app (as mine) gets few visits, almost every visit takes up to 10 seconds because wicket initializes every time. There has been a number of solutions proposed: - Run a cron job to visit the app so it's kept warm. This is discouraged from Google guys, as it would take all of us to the Tragedy of the Commons ( http://groups.google.com/group/google-appengine/browse_thread/thread/22692895421825cb/ ) - Pay to reserve a JVM (not available yet, http://code.google.com/p/googleappengine/issues/detail?id=2456 ) - Do anything you can to optimize your initialization code (here I am!)
Re: What can I do to speed up wicket initialization?
Spring / hibernate usually loads *before* seeing the message Started Wicket in deployment mode. Although i,n my project ( wicket / spring / hibernate ) it takes less than a second to finish the app loading after this message has appeared. It might be eh-cache, which usually takes a few secods to load too. Žilvinas Vilutis Mobile: (+370) 652 38353 E-mail: cika...@gmail.com On Mon, Apr 19, 2010 at 2:54 PM, Jeremy Thomerson jer...@wickettraining.com wrote: This is typically not Wicket initialization. The quickstart starts up in less than two seconds. You need to look at your domain / service / data layers. It's typically Spring / Hibernate loading / initializing that takes a long time (I've seen apps that take many *minutes* to start up). -- Jeremy Thomerson http://www.wickettraining.com On Mon, Apr 19, 2010 at 4:19 PM, Esteban Ignacio Masoero emaso...@getsense.com.ar wrote: Hi there: I know it's not THAT slow, and every presentation framework has it's loading time, but in my case this is affecting me in a much worse way and there's no other solution for now. Can any wicket expert tell me what can I do (anything: pre-compile something, do something lazily, avoid something, etc) to speed up wicket initialization? In GAE environment it takes up to 10 seconds from the moment I see the log entry Started Wicket in deployment mode. I provide more details about my problem below. Thanks, Esteban My Problem: I'm using GAE and currently there's a problem that when your app gets few traffic, it gets cycled out (kicked out of the jvm) after a few minutes of not being accessed by anyone. So when your app (as mine) gets few visits, almost every visit takes up to 10 seconds because wicket initializes every time. There has been a number of solutions proposed: - Run a cron job to visit the app so it's kept warm. This is discouraged from Google guys, as it would take all of us to the Tragedy of the Commons ( http://groups.google.com/group/google-appengine/browse_thread/thread/22692895421825cb/ ) - Pay to reserve a JVM (not available yet, http://code.google.com/p/googleappengine/issues/detail?id=2456 ) - Do anything you can to optimize your initialization code (here I am!) - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
String Resource Loading from DB
Has anybody had implemented smth like that ( @see topic ) and / or had any practice with this? I'm looking for a resource loading solution for quite a big web-site project which would be localized to many languages and may need to require update at runtime using some administration panel. Or is that so easy as implementing the IStringResourceLoader ? Looking forward for any opinion on this. Thank you Žilvinas Vilutis Mobile: (+370) 652 38353 E-mail: cika...@gmail.com - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Javascript template as linked header contribution?
Am Montag, den 19.04.2010, 09:08 -0700 schrieb Igor Vaynberg: you will have to create a TextTemplateResource to serve such resources and a TextTemplateResourceReference to create urls for them. -igor as there are no TextTemplateResource and TextTemplateResourceReference classes in Wicket 1.4.7, I tried this: PackagedTextTemplate jsTemplate = new PackagedTextTemplate(this.getClass(), js/lightbox.js); TextTemplateSharedResourceFactory ttsr = new TextTemplateSharedResourceFactory(jsTemplate, this.getClass()); String webappContext = WebApplication.get().getServletContext() .getContextPath(); MapString, Object parameters = new HashMapString, Object(); parameters.put(webappContext, webappContext); TextTemplateLink ref = new TextTemplateLink(lightbox, ttsr, parameters); add(ref); and in panels html: wicket:head script wicket:id=lightbox src=# language=JavaScript/script /wicket:head this resulted in a rendered URL (that looks weired): script wicket:id=lightbox src=resources/LightBox2Panel/%2fnetcms language=JavaScript/script And this link returns a 404 error... So what's wrong? - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: how to make a BookmarkablePageLink enabled when its parent component is disabled?
Hi Pedro, That was my first instinct, to override isEnabled(), but it turns out that it is isLinkEnabled() that gets called, in the onComponentTag() method (ie when rendering). So, no joy there. Any other suggestions, anyone? Dan On 19/04/2010 20:41, Pedro Santos wrote: Hi, you can override the isEnable method and implement your rule, like: new BookmarkablePageLink { boolean isEnabled() { return form.getState() == allowedState; } } or you can add the link higher in the component hierarchy, don't as an form child. On Mon, Apr 19, 2010 at 1:45 PM, Dan Haywood dkhayw...@gmail.com mailto:dkhayw...@gmail.com wrote: I have a FormComponentPanel (called EntityLink) that holds an image, a hyperlink (a BookmarkablePageLink) and a hidden text field holding the serializable value of the reference. Initially I want the form is in read-only mode and so I have disabled all of its form components. However, I'd like the link to be enabled. Looking at the source code, Wicket calls isLinkEnabled() to determine how to render the link; this in turn calls isEnabledInHierarchy(). My problem is the latter is (correctly returning false) but I want the former to return true. Both methods are final, however. I'm obviously tackling this incorrectly - so what would be the Wicket way? Thanks Dan -- Dan Haywood consultant, mentor, developer, author agile, ddd, oo, java, .net, sybase MA, MBCS, CITP, CEng /mail: /d...@haywood-associates.co.uk mailto:d...@haywood-associates.co.uk /phone: /+44 (0)7961 144286 /book: /Domain Driven Design using Naked Objects http://pragprog.com/titles/dhnako /blog: /http://danhaywood.com /linked in: /http://uk.linkedin.com/in/dkhaywood /twitter: /http://twitter.com/dkhaywood /sybase: /http://sybtraining.co.uk - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org mailto:users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org mailto:users-h...@wicket.apache.org -- Pedro Henrique Oliveira dos Santos - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: How to validate an entire object in a form (rather than a particular property of that object)
Hi Pedro, but my problem is that there is no form component to represent the form itself, is there? Any other thoughts? Dan On 19/04/2010 20:27, Pedro Santos wrote: Hi Dan On Mon, Apr 19, 2010 at 2:04 PM, Dan Haywood dkhayw...@gmail.com mailto:dkhayw...@gmail.com wrote: Another form-related question. I can see how to install a validator on a Form - Form#add(IFormValidator) - but it seems that AbstractFormValidator, the adapter, always requires a specific FormComponent to be specified in its error(...) method. How does one raise an error on the state of the form (and by implication, that of the underlying domain object) itself, without having to specify any form component? FeedbackMessages API, is expection an Component object as reporter. Maybe add the validation error to the form component will make sense: formComponent.getForm().error( theValidationErrorNotFormComponentSpecific ) An example would be the classic fromDate endDate. A workaround would be to install the validator on - say - the endDate. But I'm after a general solution, rather than a solution for this particular example. Thanks Dan -- Dan Haywood consultant, mentor, developer, author agile, ddd, oo, java, .net, sybase MA, MBCS, CITP, CEng /mail: /d...@haywood-associates.co.uk mailto:d...@haywood-associates.co.uk /phone: /+44 (0)7961 144286 /book: /Domain Driven Design using Naked Objects http://pragprog.com/titles/dhnako /blog: /http://danhaywood.com /linked in: /http://uk.linkedin.com/in/dkhaywood /twitter: /http://twitter.com/dkhaywood /sybase: /http://sybtraining.co.uk - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org mailto:users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org mailto:users-h...@wicket.apache.org -- Pedro Henrique Oliveira dos Santos - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Javascript template as linked header contribution?
i meant you have to create the classes... -igor On Mon, Apr 19, 2010 at 4:10 PM, Ralf Eichinger ralf.eichin...@pixotec.de wrote: Am Montag, den 19.04.2010, 09:08 -0700 schrieb Igor Vaynberg: you will have to create a TextTemplateResource to serve such resources and a TextTemplateResourceReference to create urls for them. -igor as there are no TextTemplateResource and TextTemplateResourceReference classes in Wicket 1.4.7, I tried this: PackagedTextTemplate jsTemplate = new PackagedTextTemplate(this.getClass(), js/lightbox.js); TextTemplateSharedResourceFactory ttsr = new TextTemplateSharedResourceFactory(jsTemplate, this.getClass()); String webappContext = WebApplication.get().getServletContext() .getContextPath(); MapString, Object parameters = new HashMapString, Object(); parameters.put(webappContext, webappContext); TextTemplateLink ref = new TextTemplateLink(lightbox, ttsr, parameters); add(ref); and in panels html: wicket:head script wicket:id=lightbox src=# language=JavaScript/script /wicket:head this resulted in a rendered URL (that looks weired): script wicket:id=lightbox src=resources/LightBox2Panel/%2fnetcms language=JavaScript/script And this link returns a 404 error... So what's wrong? - 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 validate an entire object in a form (rather than a particular property of that object)
you can override form.onvalidate() and do your validation there -igor On Mon, Apr 19, 2010 at 4:51 PM, Dan Haywood dkhayw...@gmail.com wrote: Hi Pedro, but my problem is that there is no form component to represent the form itself, is there? Any other thoughts? Dan On 19/04/2010 20:27, Pedro Santos wrote: Hi Dan On Mon, Apr 19, 2010 at 2:04 PM, Dan Haywood dkhayw...@gmail.com wrote: Another form-related question. I can see how to install a validator on a Form - Form#add(IFormValidator) - but it seems that AbstractFormValidator, the adapter, always requires a specific FormComponent to be specified in its error(...) method. How does one raise an error on the state of the form (and by implication, that of the underlying domain object) itself, without having to specify any form component? FeedbackMessages API, is expection an Component object as reporter. Maybe add the validation error to the form component will make sense: formComponent.getForm().error( theValidationErrorNotFormComponentSpecific ) An example would be the classic fromDate endDate. A workaround would be to install the validator on - say - the endDate. But I'm after a general solution, rather than a solution for this particular example. Thanks Dan -- Dan Haywood consultant, mentor, developer, author agile, ddd, oo, java, .net, sybase MA, MBCS, CITP, CEng *mail: * d...@haywood-associates.co.uk *phone: *+44 (0)7961 144286 *book: *Domain Driven Design using Naked Objects http://pragprog.com/titles/dhnako *blog: *http://danhaywood.com *linked in: *http://uk.linkedin.com/in/dkhaywood *twitter: *http://twitter.com/dkhaywood *sybase: * http://sybtraining.co.uk - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- Pedro Henrique Oliveira dos Santos - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org