Best practice on i18n
Hello, I have read and understand about i18n but I am curious about best practices. Is it really a good option to have several language files per component? F.e. my form component needs i18n, so does my page which holds the form alone. Wicket does of course not search in the i18n files for the page. I have the option to put all i18n in one file (which is ok for the moment but will be worse later) or to add 4 language files. Another alternative is to build up a custom IStringResourceLoader which loads the list from the database. This seems the best option to me from maintenance aspects. Any comments appreciated :-) Best regards, Christian - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: 1.5.x javadoc
I uploaded a 1.5 javadoc for my own use here: http://projects.grobmeier.de/javadoc/wicket-core/1.5-snapshot/ Its from a 2 day old trunk version - guess this will not change much until 1.5 is released On Fri, Jan 28, 2011 at 5:43 PM, Zhubin Salehi zhubin.sal...@route1.com wrote: No 1.5.x! -Original Message- From: Steve Swinsburg [mailto:steve.swinsb...@gmail.com] Sent: January 28, 2011 12:04 AM To: users@wicket.apache.org Subject: Re: 1.5.x javadoc Wicket By Example has a section for the Javadocs, but it needs a refresh. http://wicketbyexample.com/api/ cheers, Steve On 28/01/2011, at 10:36 AM, Todd Wolff wrote: Hi, Is there a URL where I can pull up javadoc for latest 1.5 RC without having to checkout source and generate myself? Thanks. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- http://www.grobmeier.de - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Best practice on i18n
Hi, After some trying we found a good practice is: - Self contained independant components have their own resource file - a page has its own file which also contains the keys for the panels on that page (as long as those panels are not being reused on other pages and are in the same package, otherwise those panels are treated as components) - common strings like save, cancel are stored in a resource file with the base page Cheers Hans Am 29.01.2011 um 09:03 schrieb Christian Grobmeier grobme...@gmail.com: Hello, I have read and understand about i18n but I am curious about best practices. Is it really a good option to have several language files per component? snip... - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Best practice on i18n
Hi In the company I work in we always put resources in one file per language. I don't see much problems maintaining it, except if we had reusable components that were shared across applications. In reusable components' case it would seem a very good idea. Actually, once a customer specifically requested that resources are in one single file because it would make them easier for them to review and edit. I also like the fact that I don't have to think about which file to put each message in. -s - Original Message - From: Christian Grobmeier Sent: 01/29/11 10:03 AM To: users@wicket.apache.org Subject: Best practice on i18n Hello, I have read and understand about i18n but I am curious about best practices. Is it really a good option to have several language files per component? F.e. my form component needs i18n, so does my page which holds the form alone. Wicket does of course not search in the i18n files for the page. I have the option to put all i18n in one file (which is ok for the moment but will be worse later) or to add 4 language files. Another alternative is to build up a custom IStringResourceLoader which loads the list from the database. This seems the best option to me from maintenance aspects. Any comments appreciated :-) Best regards, Christian - 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
User configuration files
Hello I tried to figure out how one can load own configuration files into wicket, for example with configuration on smtp host or something like that. It seems there is no standard way- is this correct? My solution is below, but it feels rather overcomplicated to me. I have overridden the init method and used the PropertiesFactory to load my own properties file into a member variable of my application class. I want my properties be available as long as the application lives (application scope) and accessible from various components. If you know any ways to make this easier, please let me know. Thanks Christian In my WebApplication class: @Override public void init() { ... PropertiesFactory properties = new PropertiesFactory(this); String configFile = WEB-INF/config-deployment.; if(RuntimeConfigurationType.DEVELOPMENT.equals(this.getConfigurationType())) { configFile = WEB-INF/config-development.; } Properties p = properties.load(TimeAndBillApplication.class, configFile); if(p != null) { applicationProperties = new Properties(applicationProperties, p.getAll()); } - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: User configuration files
Are you using Spring? On Sat, Jan 29, 2011 at 11:17 AM, Christian Grobmeier grobme...@gmail.com wrote: Hello I tried to figure out how one can load own configuration files into wicket, for example with configuration on smtp host or something like that. It seems there is no standard way- is this correct? My solution is below, but it feels rather overcomplicated to me. I have overridden the init method and used the PropertiesFactory to load my own properties file into a member variable of my application class. I want my properties be available as long as the application lives (application scope) and accessible from various components. If you know any ways to make this easier, please let me know. Thanks Christian In my WebApplication class: @Override public void init() { ... PropertiesFactory properties = new PropertiesFactory(this); String configFile = WEB-INF/config-deployment.; if(RuntimeConfigurationType.DEVELOPMENT.equals(this.getConfigurationType())) { configFile = WEB-INF/config-development.; } Properties p = properties.load(TimeAndBillApplication.class, configFile); if(p != null) { applicationProperties = new Properties(applicationProperties, p.getAll()); } - 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: User configuration files
No. I wanted to go with plain wicket. However, is it recommended by the wicket team to use Spring? It is possible for me, but want to keep my project as small as possible. On Sat, Jan 29, 2011 at 5:23 PM, James Carman ja...@carmanconsulting.com wrote: Are you using Spring? On Sat, Jan 29, 2011 at 11:17 AM, Christian Grobmeier grobme...@gmail.com wrote: Hello I tried to figure out how one can load own configuration files into wicket, for example with configuration on smtp host or something like that. It seems there is no standard way- is this correct? My solution is below, but it feels rather overcomplicated to me. I have overridden the init method and used the PropertiesFactory to load my own properties file into a member variable of my application class. I want my properties be available as long as the application lives (application scope) and accessible from various components. If you know any ways to make this easier, please let me know. Thanks Christian In my WebApplication class: @Override public void init() { ... PropertiesFactory properties = new PropertiesFactory(this); String configFile = WEB-INF/config-deployment.; if(RuntimeConfigurationType.DEVELOPMENT.equals(this.getConfigurationType())) { configFile = WEB-INF/config-development.; } Properties p = properties.load(TimeAndBillApplication.class, configFile); if(p != null) { applicationProperties = new Properties(applicationProperties, p.getAll()); } - 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 -- http://www.grobmeier.de - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: User configuration files
that actually looks pretty simple to me... -igor On Sat, Jan 29, 2011 at 8:17 AM, Christian Grobmeier grobme...@gmail.com wrote: Hello I tried to figure out how one can load own configuration files into wicket, for example with configuration on smtp host or something like that. It seems there is no standard way- is this correct? My solution is below, but it feels rather overcomplicated to me. I have overridden the init method and used the PropertiesFactory to load my own properties file into a member variable of my application class. I want my properties be available as long as the application lives (application scope) and accessible from various components. If you know any ways to make this easier, please let me know. Thanks Christian In my WebApplication class: @Override public void init() { ... PropertiesFactory properties = new PropertiesFactory(this); String configFile = WEB-INF/config-deployment.; if(RuntimeConfigurationType.DEVELOPMENT.equals(this.getConfigurationType())) { configFile = WEB-INF/config-development.; } Properties p = properties.load(TimeAndBillApplication.class, configFile); if(p != null) { applicationProperties = new Properties(applicationProperties, p.getAll()); } - 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: Wicket : Articles Blogs
We just release our CMS based on wicket as opensource. Please check our official site at www.cameleoncms.com or the technical site at cameleoncms.googlecode.com Send me emails if you need more help. Thanks. Jérôme -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Wicket-Articles-Blogs-tp3245765p3246241.html Sent from the Users forum 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: User configuration files
On Sat, Jan 29, 2011 at 6:27 PM, Igor Vaynberg igor.vaynb...@gmail.com wrote: that actually looks pretty simple to me... On first glance yes. But bringing the application parameters into another component or api will become complicated. WIth this code I can only extend my Application with a new method (getProperties). I have to introduce a new interface to make my components generic, otherwise I need casting. I looked at the ApplicationSettings and I am wondering why this class does not provide the functionality to set user defined parameters in key/value manner. Are there any reasons against this? I can imagine a loadUserProperties which does what I wrote below and stores the key/values in ApplicationSettings.getValue( String key) - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Add Component if markup exists?
Thank you, Igor. I will need some time to figure your hints out. Do I understand right: The solution analyze the markup and add... is possible from 1.5 on? Benedikt Am 28.01.2011 23:37, schrieb Igor Vaynberg: if it only needs to live during render there is IComponentResolver if you need it to have a normal lifecycle you can analyze the markup and add the component if not already added. in 1.5 you can use getmarkup in onmarkupattached() or oninitialize() -igor On Fri, Jan 28, 2011 at 2:11 PM, Benedikt Rothebenedikt.ro...@qleo.de wrote: Hi everybody Is it possible to add a Wicket-Component depending on the existence of a wicket:id in the Markup? Something like // Code with adding Components if there is a Markup-Element with WicketId Submit then this.add(new Button(Submit,...)); As far as I understood, it is not possible in this way. But maybe there's an # equivalent solution? Bye Benedikt - 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: 1.5.x javadoc
The easiest is to just download it through maven (or in eclipse.org/m2e just check download sources and javadocs) but you can also get the javadoc.jar from the maven repository directly. i.e. wget http://repo2.maven.org/maven2/org/apache/wicket/wicket-core/1.5-RC1/wicket-core-1.5-RC1-javadoc.jar Or you could get the latest 1.5-SNAPSHOT javadoc jar like this: wget https://repository.apache.org/content/groups/snapshots/org/apache/wicket/wicket-core/1.5-SNAPSHOT/wicket-core-1.5-20110129.002838-144-javadoc.jar Consult with the https://repository.apache.org/content/groups/snapshots/org/apache/wicket/wicket-core/1.5-SNAPSHOT/maven-metadata.xml to see which file is the most recent. (there is probably an automated way to do this). Regards, Mike I uploaded a 1.5 javadoc for my own use here: http://projects.grobmeier.de/javadoc/wicket-core/1.5-snapshot/ Its from a 2 day old trunk version - guess this will not change much until 1.5 is released On Fri, Jan 28, 2011 at 5:43 PM, Zhubin Salehizhubin.sal...@route1.com wrote: No 1.5.x! -Original Message- From: Steve Swinsburg [mailto:steve.swinsb...@gmail.com] Sent: January 28, 2011 12:04 AM To: users@wicket.apache.org Subject: Re: 1.5.x javadoc Wicket By Example has a section for the Javadocs, but it needs a refresh. http://wicketbyexample.com/api/ cheers, Steve On 28/01/2011, at 10:36 AM, Todd Wolff wrote: Hi, Is there a URL where I can pull up javadoc for latest 1.5 RC without having to checkout source and generate myself? Thanks. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Using Wicket with businness model classes that check for rules
Another way to handle this is to leverage the wicket validation process by extending FormComponentPanel. Your userEditPanel would be composed of individual textfields whose models are not linked to your IModelUser. Then implement the convertInput method that builds a new User object from the validated field values when the form is submitted. For example: public class UserEditPanel extends FormComponentPanelUser { private TextFieldStringemailField; /** * @param id */ public UserEditPanel(String id, IModelUseruserModel) { super(id, userModel); emailField = new TextField(emailField, new ModelString()); emailField.add(new EmailValidator()); } @Override protected void convertInput() { /** * Build up a new User instance from the values in the fields. * */ User u = new User(emailField.getModelObject(), ...); setConvertedInput(u); } /* * Here we pull out each field from the User if it exists and put the contents into the fields. */ @Override protected void onBeforeRender() { User u = this.getModelObject(); if (u != null) { // copy the field values into the form fields. this.emailField.setModelObject(u.getEmailAddress()); } } } I only implemented for one field but you can see that if you refactored the User.testSetEmail() into a static utility class then you could use it inside the EmailValidator(). This would allow you to show errors as required to ensure the fields of the User object were entered in correctly. Further you can add Validators directly to the UserEditPanel that can be used to validate the built User object. I find this useful especially for cases like you describe with multiple layers of IModel's; it allows the complexity to be internalized and then users of the panel don't need to care about the internals only that when it validates properly you call .getModelObject() and get the valid User object back. e.g. UserEditPanel userEditPanel = new UserEditPanel (userPanel, new ModelUser()); add (form = new Form(form) { @Override protected void onSubmit() { // this is only called if there are no validation errors in the form fields // the validation logic built into the UserEditPanel is implicity used and will prevent this method from being called // if an error is detected. User u = userEditPanel.getModelObject(); userService.save(u); } }); form.add (userEditPanel); Regards, Mike Thanks James I'll investigate on extending PropertyModel. Currently I'm doing the following: public class UserRegistrationPage extends WebPage { @SpringBean private UserService userService; private FeedbackPanel feedbackPanel; private UserDto userDto; // only has the User properties @SuppressWarnings(unchecked) public UserRegistrationPage() { feedbackPanel = new FeedbackPanel(feedback); userDto = new UserDto(); CompoundPropertyModel userDtoModel = new CompoundPropertyModel(userDto); // bind to the DTO Form registrarForm = new Form(registerForm, userDtoModel){ @Override protected void onSubmit() { try { // Create a real User and obtain the data from the DTO User user = new User(userDto.getEmail(), userDto.getName(), userDto.getPassword(), userDto.getBirth()); userService.save(user); // service calls the dao which actually saves to DB } catch (Exception e) { // The Businness Exception has the message error feedbackPanel.warn(e.getMessage()); } } }; registerForm.add(new TextField(email).setRequired(true)); // form binded to the DTO properties ... - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Using Wicket with businness model classes that check for rules
Thank you all for the responses ! And if you have more ideas let me know ! -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Using-Wicket-with-businness-model-classes-that-check-for-rules-tp3245298p3246809.html Sent from the Users forum 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: Best practice on i18n
The only relevant technical point here is Inheritance. If Component A inherits Component B, then the properties would have to be repeated in the property file corresponding to the inherited Component as i don't think properties follow inheritance rules (imo). Regarding Gobal vs Local: This is so open to perception probably not worth debating ,..just imo if one is following a component oriented approach (specially in product development); maintaining a Global property list cannot be a good thing. For service oriented projects one can argue since its about preferences; like ease of maintenance etc. for clients. thanks - Don't take life too seriously, your'e not getting out it alive anyway! -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Best-practice-on-i18n-tp3245918p3246828.html Sent from the Users forum 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
Wicket E-Commerce
I know that there were talks of a Wicket Cart on the forum that never materialized. I looked at Apache OFBiz, BroadLeaf, Konakart etc... I ran their examples. I was curious if anyone knew of a pure backend JEE solution for e-commerce, so that integrating the business logic might be well documented regardless of the front end. OfBiz has too much compared to what I need at the moment. BroadLeaf seems somewhat complicated as it is geared to JSP pages seemingly and there is little documentation available (I have attempted to go through source code, but I am not further then I was when I started). I like Wicket not JSPs. Though it seems like it would be a fine solution otherwise, though it extensively uses Spring and I don't, but probably not a big deal. Konakart is simply not open Though there is a Ted who has commented and put some insight into how to get the code running in Wicket. Have others used this framework? Thoughts? I guess I am a little bit lost with all the options and I am not having much luck in regard to searches or understanding these other frameworks in regard to getting them into Wicket. Has anyone had insight into these frameworks and Wicket? Any advice? Better frameworks to try? Thank you in advance. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Wicket-E-Commerce-tp3246883p3246883.html Sent from the Users forum 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: User configuration files
your class loads one file from one directory if app is in dev mode, another if app in deploy mode. not everyone wants this. further we would have the names of properties configurable. another pain. maybe someone wants to use an xml file to load properties because key value pairs are not enough, should we support that as well? the rabbit hole goes down pretty far. the application settings are meant there for you to configure wicket, not your own application. simply expose the properties in the application and then your components can get them like this: MyApplication.get().getProperty(foo); not so bad. write a IComponentInstantiationListener and inject the properties, so you can have @Properties Properties props; fields in your component that are magically populated. there is no one way to do this, and its certainly not the job of the UI layer to handle it for you. thus we do not do it. as a last note, you can leverage wicket's i18n to load properties stored in your MyApplication.properties. getString(myproperty) is all you need. -igor On Sat, Jan 29, 2011 at 11:02 AM, Christian Grobmeier grobme...@gmail.com wrote: On Sat, Jan 29, 2011 at 6:27 PM, Igor Vaynberg igor.vaynb...@gmail.com wrote: that actually looks pretty simple to me... On first glance yes. But bringing the application parameters into another component or api will become complicated. WIth this code I can only extend my Application with a new method (getProperties). I have to introduce a new interface to make my components generic, otherwise I need casting. I looked at the ApplicationSettings and I am wondering why this class does not provide the functionality to set user defined parameters in key/value manner. Are there any reasons against this? I can imagine a loadUserProperties which does what I wrote below and stores the key/values in ApplicationSettings.getValue( String key) - 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: Add Component if markup exists?
yes, see component.getmarkup() -igor On Sat, Jan 29, 2011 at 1:17 PM, Benedikt Rothe benedikt.ro...@qleo.de wrote: Thank you, Igor. I will need some time to figure your hints out. Do I understand right: The solution analyze the markup and add... is possible from 1.5 on? Benedikt Am 28.01.2011 23:37, schrieb Igor Vaynberg: if it only needs to live during render there is IComponentResolver if you need it to have a normal lifecycle you can analyze the markup and add the component if not already added. in 1.5 you can use getmarkup in onmarkupattached() or oninitialize() -igor On Fri, Jan 28, 2011 at 2:11 PM, Benedikt Rothebenedikt.ro...@qleo.de wrote: Hi everybody Is it possible to add a Wicket-Component depending on the existence of a wicket:id in the Markup? Something like // Code with adding Components if there is a Markup-Element with WicketId Submit then this.add(new Button(Submit,...)); As far as I understood, it is not possible in this way. But maybe there's an # equivalent solution? Bye Benedikt - 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 - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Best practice on i18n
properties do follow inheritance afair. -igor On Sat, Jan 29, 2011 at 7:31 PM, Arjun Dhar dhar...@yahoo.com wrote: The only relevant technical point here is Inheritance. If Component A inherits Component B, then the properties would have to be repeated in the property file corresponding to the inherited Component as i don't think properties follow inheritance rules (imo). Regarding Gobal vs Local: This is so open to perception probably not worth debating ,..just imo if one is following a component oriented approach (specially in product development); maintaining a Global property list cannot be a good thing. For service oriented projects one can argue since its about preferences; like ease of maintenance etc. for clients. thanks - Don't take life too seriously, your'e not getting out it alive anyway! -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Best-practice-on-i18n-tp3245918p3246828.html Sent from the Users forum 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