Re: [Wicket-user] wicket CMS type components...
I'm also interested, I've been putting of a similar project for a while now and a group effort may help me put the lazy days of Summer behind me:) On Tue, 2006-08-29 at 13:16 -0500, Philip A. Chapman wrote: I would be willing to help work on such a project. On Mon, 2006-08-28 at 19:18 -0300, Alexandre Bairos wrote: I´m also interested. Definitely it would be great to coordinate efforts. On 8/28/06, Igor Vaynberg [EMAIL PROTECTED] wrote: heh, wicket seems like /the/ framework for writing cms :) there has been a lot of talk but not a whole lot of action. i found this: http://code.google.com/p/cms12/ you might want to get in touch with the author a few students from Topicus are going to write one as a grad project - martijn has more details sounds like we need to pull the efforts together on this one since there are so many ppl interested. -Igor On 8/28/06, Erik Brakkee [EMAIL PROTECTED] wrote: Hi, I am considering to develop reusable Content Management System like components for polls, comments, blogs, news items, frequently asked questions, and links. Each component would have an interface for users and administrators. Access for regular users would be restricted to certain roles or totally unrestricted. Access to administrators would always be restricted to certain roles. Whether or not approval is required for an item by an administrator would also be configurable. Furthermore, access restrictions could also be narrowed down by the content itself. (e.g. only viewable by registered users). Each component would generate events upon use, allowing other functionality to be implemented on top of it (such as notification and statistics). Persistence for components would be pluggable with Hibernate as an implementation provided out of the box. Of course, we could be more ambitious and go directly for JSR-170 but perhaps JSR-170 would simply be an implementation of persistence. Does a project like this already exist or should I roll my own? Cheers Erik - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642 ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642 ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642 ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] wicket CMS type components...
JackRabbit looks very interesting, I'll have to download and play with it. I'm not convinced it's ideal for every application though, maybe let the plug-in decide what persistence method it wants/needs? Your other points are well taken as well. I assume there will be a lot of rewrites to fix those issues before anything would be finalized. Troy On Tue, 2006-08-29 at 15:39 -0700, Eelco Hillenius wrote: 4) I'm not the greatest standards buff on earth, but in this case, using JSR 170 would make sense imo. http://jackrabbit.apache.org/ looks like a nice implementation of this. Eelco - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642 ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642 ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Captcha
For the couple of forms I need it for this is great. I may look at making a component later, I've always meant to learn. Ajax is not really necessary. I probably wouldn't be using it at all expect I've been blown away with how easy it is to add and how much it boosts perceived performance. I have to say, moving an older 1.1 app to 1.2 (I know, I waited long enough...) that it's reduced the number of lines of code and improved functionality/performance all around. Impressive job, can't wait to see what 2.0 brings. Thanks, Troy On Thu, 2006-06-15 at 11:48 -0700, Eelco Hillenius wrote: Very welcome. I figured it was a good example to have. Unfortunately, I couldn't bend it into making a custom component, as jcaptcha is GPL. But that should be easy enough to do yourself if you need to do that. I don't know how doable the ajax variant would be; maybe Igor has an idea on how to do image (re-)loading with Ajax. Eelco On Jun 15, 2006, at 11:37 AM, Troy MacNeil wrote: Perfect! Much appreciated, and much better than what I would've come up with;) Thanks, Troy On Thu, 2006-06-15 at 11:02 -0700, Igor Vaynberg wrote: eelco created an example last night in wicket-examples project so check it out from svn, its in wicket.examples.captcha package. he is having email issues so he couldnt get the word out. maybe if he werent using a mac he wouldnt have these silly problems, but what can you do. -Igor On 6/14/06, Troy MacNeil [EMAIL PROTECTED] wrote: Just wondering if anyone has created a Captcha (form verification via a generated image) component? I was looking at some libraries (JCaptcha SimpleCaptcha) and image generation looks straightforward but I'm a little vague on how I'd validate it or make it AJAX friendly. Thanks, Troy ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Developing Wicket Menu Widgets
These articles seem to address your CSS needs. The mark-up structure is very similar to what you're aiming for. http://www.alistapart.com/articles/dropdowns http://alistapart.com/articles/hybrid Background images and divider images are specified in the CSS, which could be good or bad depending on your goals. It works for me;) There may be better ways, using AJAX for instance, but this should give you a place to start at least. Troy On Wed, 2006-06-14 at 03:08 -0800, Ayodeji Aladejebi wrote: I know of Wicket Extensions and Wicket Stuff etc but I look forward to Wicket Widgets Stuff where users can donate all sorts of resuable widgets to wicket community that carry all sorts of behaviors needed to enrich Web user experience As an example, i have been trying to create Wicket Menu bar component by trying to reduce my effort to something close to Swing I am not talking of something like echo2 now, I am talking of all those common stuffs in web development packaged in a cross browser reusable wicket components. MenuBar bar = new MenuBar(web-app-menu, ...) MenuBar will be a customizable markupcontainer that will have vertical drop down capabilities Menus and MenuItem will simply be Wicket Links instances. My major headache started when i realized how horrible CSS can be across IE breeds and Mozilla and other browsers, IE expecially so i spent more time trying to sort out making cross browser CSS vertical menus for my wicket project. Now that should not be because for me if wicket were to fulfil its vision, developers should spend more time with Java than cracking thier heads on how to do common stuffs with CSS or Javascript. Therefore I think encouraging widgets contribution will also be fine. I am not a cross browser CSS expert but there a lot out there willing to donate reusable CSS codes for creating common widgets on the browser Scrolling MenuBar etc... Anyway for me, it boils down to one thing, I am trying to create MenuBar, Menu and MenuItem for my project and i need cross browser CSS for vertical drop down menu, Something like this div wicket:id=MenuBar class=menubar ul li wicket:id=Menua wicket:id=MenuItem/a/li li wicket:id=MenuSeperator/li li wicket:id=Menua wicket:id=MenuItemimg wicket:id=MenuImage/img/a/li /ul /div But i am scared of the CSS hell out there and i dont even know where to start digging for good cross browser CSS to use for this, so please who has a reference to the CSS library that can make this life easy Thanks :) ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
[Wicket-user] Captcha
Just wondering if anyone has created a Captcha (form verification via a generated image) component? I was looking at some libraries (JCaptcha SimpleCaptcha) and image generation looks straightforward but I'm a little vague on how I'd validate it or make it AJAX friendly. Thanks, Troy ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Page Lifecycle
Thank You! This clears up a lot of confusion, and is exactly what was happening. Shortly after my last message I tried checking for a null session object and everything worked, though I expected a run time error due to the missing panel. User user = ((VSecureSession)getSession()).getUser(); if(user != null){ add(new EventListPanel(eventList, user.getId())); //add other session dependent panels } So what is happening is: 1. Page is constructed, skipping session dependent panels 2. checkAccess() is called redirecting to signIn page 3. User signs in and the session is created 4. Original page is re-constructed, this time with a session 5. Original page is rendered Not the most elegant solution, but for now so long as it works I'm happy. I'd be interested in any other approaches in the future though. Thanks, Troy On Thu, 2005-10-06 at 11:20 -0400, Todor Todorov wrote: Troy, I think you are confusing constructing a page with rendering a page. First a page is being constructed (that's where you are getting the exception I believe) then checkAccess is being invoked, and later the page is being rendered.. I'm having similar problems with protected pages - sometimes the construction depends on session information but you don't have a valid user session until checkAccess returns true. So, what you could do is, skip the construction if the user is not authenticated ( the page is not going to be rendered anyway). Or, create your page in a such a way that session based decisions are delayed until render time. Or, don't use wicket's authentication features... I consider this more a design issue because the workarounds are not satisfying for me. I'm currently experimenting with a different auth approaches... Better ideas anyone? Todor On 10/6/05, Troy MacNeil [EMAIL PROTECTED] wrote: Thanks for the reply, I'm using RC2, and my app is originally based on one of the CD apps in contrib-examples (the one with annotations) from the b4 timeframe. In my base page, I redirect to a sign-in page which adds the user object to my session. I then try to use this object in a page which extends the base page. If I link directly to a page (via setHomePage() or bookmark) that accesses the session, my session user object is still null and the page fails to render (due to the null pointer exception in my panel code). If I first link to a page that doesn't use the session variable, and _then_ link to a page that does everything works as expected. So it seemed as though checkAccess() wasn't being called until after the page rendered. I'll take a look with more alert eyes in case there are any lingering issues with the demo code (or at least any I can understand:). I'm also going to try catching the null exception, I expect they won't see data on the first page they visit but at least it won't crash. Here is a more complete version of the relevant code in case it helps... From base page: protected boolean checkAccess() { //((VSecureSession)getSession()).authenticate(admin, admin); //DEBUG boolean signedIn = ((VSecureSession)getSession()).isSignedIn(); if(!signedIn){ redirectTo(newPage(SignIn.class)); } return signedIn; } From my session: public final boolean authenticate(final String username, final String password) { if (user == null) { inUser = ((VSecureRequestCycle) getRequestCycle()).getDao().getUser(username); if((in.getPassword()).equalsIgnoreCase(password)){ this.user = in; return true; } return user != null; } And the line in the sub page (which causes the null pointer): Long userId = (((VSecureSession)getSession()).getUser()).getId(); add(new EventListPanel(eventList, userId)); Thanks, Troy On Thu, 2005-06-10 at 11:00 +0200, Johan Compagner wrote: checkAccess() is the first thing that happens before a page is rendered see Page.doRender(): public final void doRender() { if (checkAccess()) { /// Page get rendered So what do you exactly see? What version of wicket do you use? On 10/6/05, Troy MacNeil [EMAIL PROTECTED] wrote: Is there a way to call a method before any page rendering takes place? When my user logs in, checkAccess() redirects them to a sign in page which adds their information to the session for later access. This works well until I try to go directly (before login) to a (Bookmarkable) page that uses
[Wicket-user] Page Lifecycle
Is there a way to call a method before any page rendering takes place? When my user logs in, checkAccess() redirects them to a sign in page which adds their information to the session for later access. This works well until I try to go directly (before login) to a (Bookmarkable) page that uses this session information. After investigating it seems that the entire page is rendered before calling checkAccess()? Which in my case leads to numerous null pointer exceptions since the session data is uninitialized. I've tried overriding various methods to call checkAccess() earlier in the process but without any luck. I'm sure there is a very simple answer, but it's getting very late and I've been at this for a while so any help would be _greatly_ appreciated. Thanks, Troy --- This SF.Net email is sponsored by: Power Architecture Resource Center: Free content, downloads, discussions, and more. http://solutions.newsforge.com/ibmarch.tmpl ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] GridPanel
Thanks, for the pointer. DataView does look much more like what I want and I'll have to take a closer look. I'd taken a quick look at it before but wasn't sure how to get from a HibernateDataSource or List to something it would like. Thanks, Troy On Wed, 2005-14-09 at 08:14 -0700, Phil Kulak wrote: No, don't use a ListView, use a DataView. You can do what you want with the GridPanel, however, by implementing your own IColumn. That's a bit of a pain though. On 9/14/05, Troy MacNeil [EMAIL PROTECTED] wrote: Is there an easy way to add Links to a GridPanel? I'd like to change the edit button to go elsewhere instead of editing internally. I'd also like to change the column headers that are displayed. I vaguely recall seeing an example that did this using an interface (ILinkListener?) but can't find it anywhere. Right now I'm using a ListView to accomplish something like this but it's a lot of code for fewer features :) Thanks, Troy --- SF.Net email is sponsored by: Tame your development challenges with Apache's Geronimo App Server. Download it for free - -and be entered to win a 42 plasma tv or your very own Sony(tm)PSP. Click here to play: http://sourceforge.net/geronimo.php ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user --- SF.Net email is sponsored by: Tame your development challenges with Apache's Geronimo App Server. Download it for free - -and be entered to win a 42 plasma tv or your very own Sony(tm)PSP. Click here to play: http://sourceforge.net/geronimo.php ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user --- SF.Net email is sponsored by: Tame your development challenges with Apache's Geronimo App Server. Download it for free - -and be entered to win a 42 plasma tv or your very own Sony(tm)PSP. Click here to play: http://sourceforge.net/geronimo.php ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
[Wicket-user] Creating Embedded Object via Form
This isn't the brightest question I've ever asked, I feel I'm missing very obvious. But I don't see an answer in the examples/wiki so here goes... I'm wondering how to handle. So for instance if I have a Client object which has one or more Address objects as members, how can I create a new client using a single form? I've looked at the cdapp example where Categories are linked to Albums, what I want is similar except I'd like to create Categories on the fly if necessary rather than select from a pre-instantiated list. form wicket:id=form action= Name: input type=text wicket:id=firstNamebr/ Street Address: input type=text wicket:id=address.streetAddressbr/ input type=submit value=Add Client/ /form @Entity public class Client implements ComparableClient { protected Long Id; protected String Name; protected Address address; /*typical getters/setters below */ } @Entity public class Address implements ComparableAddress { protected Long Id; protected String streetAddress; /*typical getters/setters below */ } Any help or pointers in the right direction greatly appreciated... Thanks, Troy Alluvion Development http://alluvioncorp.com --- SF.Net email is Sponsored by the Better Software Conference EXPO September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices Agile Plan-Driven Development * Managing Projects Teams * Testing QA Security * Process Improvement Measurement * http://www.sqe.com/bsce5sf ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
RE: [Wicket-user] Creating Embedded Object via Form
This is ultimately what I want. The Client object will have a collection of addresses, invoices and other objects. The user can view these objects and add new ones. - I can create a form to create a new Client. - I can create a form to add an address to an existing Client (at least I think I can;) - I can't create a form to create a Client and add an Address at the same time. Right now I get bind errors if I add fields that aren't properties of the Client object itself. I suspect the solution lies with the property model. My current code references Client directly: IModel clientFormModel = new CompoundPropertyModel(new Client()); But I don't have a clear enough understanding of how Compound and Bound property models work. Thanks, Troy On Tue, 2005-13-09 at 09:15 -0700, Igor Vaynberg wrote: I think a good way to handle this would be to use two pages. First page would show the form for the client object properties along with properties for a single address, the second page would allow the user to add additional addresses to the client object they created in the previous step. Almost like a two page wizard. -Igor -Original Message- From: [EMAIL PROTECTED] [mailto:wicket-user- [EMAIL PROTECTED] On Behalf Of Troy MacNeil Sent: Tuesday, September 13, 2005 8:24 AM To: wicket-user@lists.sourceforge.net Subject: [Wicket-user] Creating Embedded Object via Form This isn't the brightest question I've ever asked, I feel I'm missing very obvious. But I don't see an answer in the examples/wiki so here goes... I'm wondering how to handle. So for instance if I have a Client object which has one or more Address objects as members, how can I create a new client using a single form? I've looked at the cdapp example where Categories are linked to Albums, what I want is similar except I'd like to create Categories on the fly if necessary rather than select from a pre-instantiated list. form wicket:id=form action= Name: input type=text wicket:id=firstNamebr/ Street Address: input type=text wicket:id=address.streetAddressbr/ input type=submit value=Add Client/ /form @Entity public class Client implements ComparableClient { protected Long Id; protected String Name; protected Address address; /*typical getters/setters below */ } @Entity public class Address implements ComparableAddress { protected Long Id; protected String streetAddress; /*typical getters/setters below */ } Any help or pointers in the right direction greatly appreciated... Thanks, Troy Alluvion Development http://alluvioncorp.com --- SF.Net email is Sponsored by the Better Software Conference EXPO September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices Agile Plan-Driven Development * Managing Projects Teams * Testing QA Security * Process Improvement Measurement * http://www.sqe.com/bsce5sf ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user --- SF.Net email is Sponsored by the Better Software Conference EXPO September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices Agile Plan-Driven Development * Managing Projects Teams * Testing QA Security * Process Improvement Measurement * http://www.sqe.com/bsce5sf ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user --- SF.Net email is Sponsored by the Better Software Conference EXPO September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices Agile Plan-Driven Development * Managing Projects Teams * Testing QA Security * Process Improvement Measurement * http://www.sqe.com/bsce5sf ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Creating Embedded Object via Form
Thanks for the response! It works, so is therefore miles ahead of what I've come up with so far:) But if I understand it, as I add more fields to Address I would need a separate converter (no problem) and a property in Client to use...so it may not work in my specific case. Thanks, Troy On Wed, 2005-14-09 at 00:00 +0800, Ingram Chen wrote: Maybe a stupid way. static class AddressConverter implements IConverter { public Object convert(Object value, Class c) { Address address = new Address() ; //value is from TextField.getInput() ; address.setStreeAddress((String) value) ; return address; } public void setLocale(Locale locale) {} public Locale getLocale() { return Locale.getDefault(); } } public class ClientForm extends Form { public ClientForm() { add(new TextField(address) { public IConverter getConverter() { return new AddressConverter(); } }); } } On 9/13/05, Troy MacNeil [EMAIL PROTECTED] wrote: This isn't the brightest question I've ever asked, I feel I'm missing very obvious. But I don't see an answer in the examples/wiki so here goes... I'm wondering how to handle. So for instance if I have a Client object which has one or more Address objects as members, how can I create a new client using a single form? I've looked at the cdapp example where Categories are linked to Albums, what I want is similar except I'd like to create Categories on the fly if necessary rather than select from a pre-instantiated list. form wicket:id=form action= Name: input type=text wicket:id=firstNamebr/ Street Address: input type=text wicket:id=address.streetAddressbr/ input type=submit value=Add Client/ /form @Entity public class Client implements ComparableClient { protected Long Id; protected String Name; protected Address address; /*typical getters/setters below */ } @Entity public class Address implements ComparableAddress { protected Long Id; protected String streetAddress; /*typical getters/setters below */ } Any help or pointers in the right direction greatly appreciated... Thanks, Troy Alluvion Development http://alluvioncorp.com --- SF.Net email is Sponsored by the Better Software Conference EXPO September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices Agile Plan-Driven Development * Managing Projects Teams * Testing QA Security * Process Improvement Measurement * http://www.sqe.com/bsce5sf ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user -- Ingram Chen Java [EMAIL PROTECTED] Institue of BioMedical Sciences Academia Sinica Taiwan blog: http://www.javaworld.com.tw/roller/page/ingramchen --- SF.Net email is Sponsored by the Better Software Conference EXPO September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices Agile Plan-Driven Development * Managing Projects Teams * Testing QA Security * Process Improvement Measurement * http://www.sqe.com/bsce5sf ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Creating Embedded Object via Form
Thanks! protected Address address = new Address() did the trick! Troy On Tue, 2005-13-09 at 19:42 +0200, Eelco Hillenius wrote: In the end, (Bound)CompoundPropertyModels are IModels. IModel just has get/setObject, where you can implement anything you want, including object creation etc. CompoundPropertyModels are meant to make your life easier in the sense that you need less code to acchieve model/property binding. The basis however, is PropertyModel. WIth PropertyModel you can bind anything you want, as long as it is a valid two-way Ognl expression. IModel clientFormModel = new CompoundPropertyModel(myClient); setModel(clientFormModel); add(new TextField(address.streetAddress); is the same as: BoundCompoundPropertyModel clientFormModel = new BoundCompoundPropertyModel(myClient); setModel(clientFormModel); add(clientFormModel.bind(new TextField(nonImportantName), address.streetAddress)); is the same as: add(new TextField(nonImportantName, new PropertyModel(myClient, address.streetAddress)); Now, the problem with your code is that the address is null by default. Ognl doesn't like that, and will throw an exception. There are a zillion ways to tackle this, including patching Ognl, patching PropertyModel, etc, but the simplest way to go here is to make sure you allways have a non-null address property. Either by declaring that property like 'protected Address address = new Address;' - your ORM will overwrite that field when it does have a saved value - or lazily create an instance in your getter - in which case you must make sure the getter is not by-passed by any code generation your ORM might do for you. I don't think you need the converter; it will work in some cases, and for some custom object they can be very convenient/ elegant, but in this case, the fact that your property can be null and Ognl doesn't try object creation is the real issue. Eelco On 9/13/05, Troy MacNeil [EMAIL PROTECTED] wrote: This is ultimately what I want. The Client object will have a collection of addresses, invoices and other objects. The user can view these objects and add new ones. - I can create a form to create a new Client. - I can create a form to add an address to an existing Client (at least I think I can;) - I can't create a form to create a Client and add an Address at the same time. Right now I get bind errors if I add fields that aren't properties of the Client object itself. I suspect the solution lies with the property model. My current code references Client directly: IModel clientFormModel = new CompoundPropertyModel(new Client()); But I don't have a clear enough understanding of how Compound and Bound property models work. Thanks, Troy On Tue, 2005-13-09 at 09:15 -0700, Igor Vaynberg wrote: I think a good way to handle this would be to use two pages. First page would show the form for the client object properties along with properties for a single address, the second page would allow the user to add additional addresses to the client object they created in the previous step. Almost like a two page wizard. -Igor -Original Message- From: [EMAIL PROTECTED] [mailto:wicket-user- [EMAIL PROTECTED] On Behalf Of Troy MacNeil Sent: Tuesday, September 13, 2005 8:24 AM To: wicket-user@lists.sourceforge.net Subject: [Wicket-user] Creating Embedded Object via Form This isn't the brightest question I've ever asked, I feel I'm missing very obvious. But I don't see an answer in the examples/wiki so here goes... I'm wondering how to handle. So for instance if I have a Client object which has one or more Address objects as members, how can I create a new client using a single form? I've looked at the cdapp example where Categories are linked to Albums, what I want is similar except I'd like to create Categories on the fly if necessary rather than select from a pre-instantiated list. form wicket:id=form action= Name: input type=text wicket:id=firstNamebr/ Street Address: input type=text wicket:id=address.streetAddressbr/ input type=submit value=Add Client/ /form @Entity public class Client implements ComparableClient { protected Long Id; protected String Name; protected Address address; /*typical getters/setters below */ } @Entity public class Address implements ComparableAddress { protected Long Id; protected String streetAddress; /*typical getters/setters below */ } Any help or pointers in the right direction greatly appreciated... Thanks, Troy Alluvion Development http://alluvioncorp.com --- SF.Net email is Sponsored by the Better Software Conference EXPO September 19
RE: [Wicket-user] Creating Embedded Object via Form
I may have celebrated a bit soon. While the form renders and submits without errors, browsing to a page with a ListView of Client objects shows that no data has been entered. All simple Client properties are empty, and the address field contains an object reference with all null values. Attempting to edit this entry causes a Hibernate exception: org.hibernate.TransientObjectException: object references an unsaved transient instance - save the transient instance before flushing: com.alluvion.test.model.Address Also, if I try to go to another page in my form onSubmit() using setResponsePage() the same Hibernate exception is thrown. This happens whether I create a new Address where it is declared or in the getAddress method. My app is originally based on the cdapp demo which uses Hibernate 3 and annotations. Any thoughts greatly appreciated, I'm going to keep looking through the Hibernate docs and maybe test to see if I can persist any embedded objects, not just the ones at creation time. Thanks, Troy On Tue, 2005-13-09 at 12:41 -0700, Igor Vaynberg wrote: This is a really good practice when you are using hibernate or ejb3. I believe in some cases it is even required. If you want to do it lazily then your getters should look something like this: Public Address getAddress() { If (address=null) address=new Address(); Return address; } -Igor -Original Message- From: [EMAIL PROTECTED] [mailto:wicket-user- [EMAIL PROTECTED] On Behalf Of Troy MacNeil Sent: Tuesday, September 13, 2005 12:14 PM To: wicket-user@lists.sourceforge.net Subject: Re: [Wicket-user] Creating Embedded Object via Form Thanks! protected Address address = new Address() did the trick! Troy On Tue, 2005-13-09 at 19:42 +0200, Eelco Hillenius wrote: In the end, (Bound)CompoundPropertyModels are IModels. IModel just has get/setObject, where you can implement anything you want, including object creation etc. CompoundPropertyModels are meant to make your life easier in the sense that you need less code to acchieve model/property binding. The basis however, is PropertyModel. WIth PropertyModel you can bind anything you want, as long as it is a valid two-way Ognl expression. IModel clientFormModel = new CompoundPropertyModel(myClient); setModel(clientFormModel); add(new TextField(address.streetAddress); is the same as: BoundCompoundPropertyModel clientFormModel = new BoundCompoundPropertyModel(myClient); setModel(clientFormModel); add(clientFormModel.bind(new TextField(nonImportantName), address.streetAddress)); is the same as: add(new TextField(nonImportantName, new PropertyModel(myClient, address.streetAddress)); Now, the problem with your code is that the address is null by default. Ognl doesn't like that, and will throw an exception. There are a zillion ways to tackle this, including patching Ognl, patching PropertyModel, etc, but the simplest way to go here is to make sure you allways have a non-null address property. Either by declaring that property like 'protected Address address = new Address;' - your ORM will overwrite that field when it does have a saved value - or lazily create an instance in your getter - in which case you must make sure the getter is not by-passed by any code generation your ORM might do for you. I don't think you need the converter; it will work in some cases, and for some custom object they can be very convenient/ elegant, but in this case, the fact that your property can be null and Ognl doesn't try object creation is the real issue. Eelco On 9/13/05, Troy MacNeil [EMAIL PROTECTED] wrote: This is ultimately what I want. The Client object will have a collection of addresses, invoices and other objects. The user can view these objects and add new ones. - I can create a form to create a new Client. - I can create a form to add an address to an existing Client (at least I think I can;) - I can't create a form to create a Client and add an Address at the same time. Right now I get bind errors if I add fields that aren't properties of the Client object itself. I suspect the solution lies with the property model. My current code references Client directly: IModel clientFormModel = new CompoundPropertyModel(new Client()); But I don't have a clear enough understanding of how Compound and Bound property models work. Thanks, Troy On Tue, 2005-13-09 at 09:15 -0700, Igor Vaynberg wrote: I think a good way to handle this would be to use two pages. First page would show the form for the client object properties along with properties for a single address, the second page would allow the user to add additional addresses to the client object they created in the previous step. Almost like a two
RE: [Wicket-user] Creating Embedded Object via Form
Thanks again, that was it. I'd tried setting the cascade property but obviously got it wrong...I'm new to annotations as well as Wicket. For anyone else looking to do this, the successful code is: //In the Client Object @ManyToOne(cascade = { CascadeType.ALL }) public Address getAddress() { if(address == null) address = new Address(); return this.address; } public void setAddress(Address aValue) { this.address = aValue; } //In the NewClient.java page add(new TextField(address.streetAddress)); Many thanks to all who helped! Troy On Tue, 2005-13-09 at 13:53 -0700, Igor Vaynberg wrote: you should set the cascade of your address relationship to include save, that way hibernate will persist all the objects in that relationship when you persist your client object. Otherwise you have to call save on every instance of new address you add into the collection. -Igor -Original Message- From: [EMAIL PROTECTED] [mailto:wicket-user- [EMAIL PROTECTED] On Behalf Of Troy MacNeil Sent: Tuesday, September 13, 2005 1:47 PM To: wicket-user@lists.sourceforge.net Subject: RE: [Wicket-user] Creating Embedded Object via Form I may have celebrated a bit soon. While the form renders and submits without errors, browsing to a page with a ListView of Client objects shows that no data has been entered. All simple Client properties are empty, and the address field contains an object reference with all null values. Attempting to edit this entry causes a Hibernate exception: org.hibernate.TransientObjectException: object references an unsaved transient instance - save the transient instance before flushing: com.alluvion.test.model.Address Also, if I try to go to another page in my form onSubmit() using setResponsePage() the same Hibernate exception is thrown. This happens whether I create a new Address where it is declared or in the getAddress method. My app is originally based on the cdapp demo which uses Hibernate 3 and annotations. Any thoughts greatly appreciated, I'm going to keep looking through the Hibernate docs and maybe test to see if I can persist any embedded objects, not just the ones at creation time. Thanks, Troy On Tue, 2005-13-09 at 12:41 -0700, Igor Vaynberg wrote: This is a really good practice when you are using hibernate or ejb3. I believe in some cases it is even required. If you want to do it lazily then your getters should look something like this: Public Address getAddress() { If (address=null) address=new Address(); Return address; } -Igor -Original Message- From: [EMAIL PROTECTED] [mailto:wicket-user- [EMAIL PROTECTED] On Behalf Of Troy MacNeil Sent: Tuesday, September 13, 2005 12:14 PM To: wicket-user@lists.sourceforge.net Subject: Re: [Wicket-user] Creating Embedded Object via Form Thanks! protected Address address = new Address() did the trick! Troy On Tue, 2005-13-09 at 19:42 +0200, Eelco Hillenius wrote: In the end, (Bound)CompoundPropertyModels are IModels. IModel just has get/setObject, where you can implement anything you want, including object creation etc. CompoundPropertyModels are meant to make your life easier in the sense that you need less code to acchieve model/property binding. The basis however, is PropertyModel. WIth PropertyModel you can bind anything you want, as long as it is a valid two-way Ognl expression. IModel clientFormModel = new CompoundPropertyModel(myClient); setModel(clientFormModel); add(new TextField(address.streetAddress); is the same as: BoundCompoundPropertyModel clientFormModel = new BoundCompoundPropertyModel(myClient); setModel(clientFormModel); add(clientFormModel.bind(new TextField(nonImportantName), address.streetAddress)); is the same as: add(new TextField(nonImportantName, new PropertyModel(myClient, address.streetAddress)); Now, the problem with your code is that the address is null by default. Ognl doesn't like that, and will throw an exception. There are a zillion ways to tackle this, including patching Ognl, patching PropertyModel, etc, but the simplest way to go here is to make sure you allways have a non-null address property. Either by declaring that property like 'protected Address address = new Address;' - your ORM will overwrite that field when it does have a saved value - or lazily create an instance in your getter - in which case you must make sure the getter is not by-passed by any code generation your ORM might do for you. I don't think you need the converter; it will work in some cases, and for some custom object they can be very convenient/ elegant
Re: [Wicket-user] a little OT...
I'm currently moving an App-Fuse Spring MVC based app to wicket, and would be interested in any code that could ease the process:) Troy On Mon, 2005-08-08 at 15:00 +0200, Juergen Donnerstag wrote: anyone interested in an old wicket based version of appfuse? It is about 6 months old because I didn't find the time to maintain it. It doesn't have all the nice features you are looking at, as it was meant to proove that wicket works with real application, but may be it is a starting point for you. As I mentioned, it may not even work with 1.0, 1.1 or HEAD. Juergen On 8/8/05, Michael Glauche [EMAIL PROTECTED] wrote: a pinkelefant wrote: Hi all, I am trying to come up with a application framework around Wicket.I want to include the following components so that its easy to build or start on a complete website and don't have to start from scratch. Please let me know if anybody has any suggestions for some partial / complete frameworks out there which I can start using. 1) Authentication : I think Acegi might be a good choice here . I have not used it , but I have read that its got good integration with other projects. 2) User Entitlements/Role Management : I know that every project will have its own little demands , but I am sure there is at least a model out there that can be used. It should provide way to create new roles and manage them and assign them to users of the system.This can be tied in with Acegi to achieve Authorization. 3)Event Management : or Notification ..Creating a generic notifications framework which can be used by the entire system ( Audit events , Error events , Application specific events etc) 4)Business Integration : Using JBI tool like Mule to integrate with the other applications and services( mail , jmx etc) 5) User Profile Management : Creating Users in a system and managing their profiles and other details 6)A generic Menu : that is tied in to the User Authorization levels. ...and any other service that a complete Application might use. A framework like this around wicket will jump start lot of applications. Any ideas or suggestions for implementations ? I'm basicly trying to archive the same at the moment. Acegi integration sounds very good. At the moment i'm trying to build up some generic Menu based on the NavMenu contrib and mygosuMenu (http://gosu.pl/dhtml/mygosumenu.html) -- Michael Glauche, Dipl. Inform. Connection GmbH [EMAIL PROTECTED] http://www.connection-net.de/ pgp key: http://www.connection-net.de/~mglauche/mglauche.asc Reclaim Your Inbox! http://www.mozilla.org/products/thunderbird/ --- SF.Net email is Sponsored by the Better Software Conference EXPO September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices Agile Plan-Driven Development * Managing Projects Teams * Testing QA Security * Process Improvement Measurement * http://www.sqe.com/bsce5sf ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user --- SF.Net email is Sponsored by the Better Software Conference EXPO September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices Agile Plan-Driven Development * Managing Projects Teams * Testing QA Security * Process Improvement Measurement * http://www.sqe.com/bsce5sf ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user --- SF.Net email is Sponsored by the Better Software Conference EXPO September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices Agile Plan-Driven Development * Managing Projects Teams * Testing QA Security * Process Improvement Measurement * http://www.sqe.com/bsce5sf ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] encoding
I'm new to Wicket, but in HTML the '' character is used to begin character codes. To actually display '' use: amp; So in your example aamp;b should give you the result you want. Troy On Fri, 2005-05-08 at 11:45 -0400, [EMAIL PROTECTED] wrote: Hi, I'm setting a parameter using the PageParameter class with value containing a '' character but when I retrieve this value to display it in a form field I get only the first part before the ''. In otherwords, setting ab, on retrieval I get only a. How do I remedy this? Francis mail2web - Check your email from the web at http://mail2web.com/ . --- SF.Net email is Sponsored by the Better Software Conference EXPO September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices Agile Plan-Driven Development * Managing Projects Teams * Testing QA Security * Process Improvement Measurement * http://www.sqe.com/bsce5sf ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user --- SF.Net email is Sponsored by the Better Software Conference EXPO September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices Agile Plan-Driven Development * Managing Projects Teams * Testing QA Security * Process Improvement Measurement * http://www.sqe.com/bsce5sf ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user