Re: warn user a field has changed
The problem appears to be related to the code I used to replace the old onAttach code. It was: protected void onAttach() { super.onAttach(); if (firstTimeThru) { final WebMarkupContainer c = this.getBodyContainer().getBodyContainer(); c.add(new SimpleAttributeModifier("onload", "FORMCONFIRM=true;FORMISDIRTY=false;")); c.add(new SimpleAttributeModifier("class", "body1")); c.add(new SimpleAttributeModifier("onbeforeunload", "return warnOnPageExit('Data has changed. Make sure you press save " + "if you want to keep your changes!');")); firstTimeThru = false; } } now it is: public void renderHead(IHeaderResponse arg0) { if (firstTimeThru) { arg0.renderOnLoadJavascript("FORMCONFIRM=true;FORMISDIRTY=false;"); arg0.renderCSSReference("body1"); arg0.renderOnEventJavacript("window", "onbeforeunload", "return warnOnPageExit('Data has changed. Make sure you press save " + "if you want to keep your changes!');"); firstTimeThru = false; } } I'm focusing on tweaking this at the moment. Not sure yet what's going on. Kurt Heston wrote: Not yet. Still trying to figure it out. Just wanted to make sure I wasn't overlooking something in the manual that works just as as well or better. Igor Vaynberg wrote: do you know why it doesnt work? -igor On Sat, Mar 7, 2009 at 12:26 PM, Kurt Heston wrote: I haven't been able to make this work since my upgrade from 1.2.x to 1.3.5: http://javathoughts.capesugarbird.com/2007/11/warning-on-page-exit-for-wicket-12x.html It was pretty slick. I was able to warn the user that she/he had changed a field without saving when trying to navigate away. Is there a better facility in 1.3.x that I can use for the same purpose? - 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: Passing a PageParameters to a RedirectRequestTarget
redirect request target takes a url, so just build one that includes pageparameters using urlfor(page.class, pageparams) -igor On Sat, Mar 7, 2009 at 6:02 PM, Warren Bell wrote: > Is there a way of passing a PageParameters to a RedirectRequestTarget > without pulling apart PageParameters and adding them to the url? > > Thanks, > > Warren > > - > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > >
Passing a PageParameters to a RedirectRequestTarget
Is there a way of passing a PageParameters to a RedirectRequestTarget without pulling apart PageParameters and adding them to the url? Thanks, Warren - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: tinymce question: how to switch default language?
Got it.I missed the part of constructor. The way to set my lanuage works. -- TinyMCESettings settings=new TinyMCESettings(TinyMCESettings.Theme.advanced,Language.tw); -- thank you! pointbreak+wicketstuff wrote: > > The default language is based on the locale of the session. Which is > normally what you want (because it is influenced by the browser > preferences, and the same as what wicket is using). You can override it > by passing a language as second argument in the TinyMCESettings > constructor. > -- View this message in context: http://www.nabble.com/tinymce-question%3A-how-to-switch-default-language--tp22388584p22394058.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
model for entity with checkgroup (user roles relation)
Hi all, it probably that this has been answered in the list, but I can't figure out how to construct the query for gmail (I've been on the list for some time now). I have the following feature I don't know how to resolve. I am using wicket 1.4rc2 with activeobjects (orm). I have User and Role entities, and User has a manytomany relationship. I would like to have a form with a checkgroup to be able to select which roles a user have. User has: String name String password @ManyToMany(UserRole.class) Role[] roles Role has: String name and UserRole has: User user Role role all with corresponding setters and getters. How could I combine this entities to develop a form in which user could see: TextField PasswordTextField CheckGroup (with the names of the roles available) ? Thanks f(t) PS: some extra info. this is my model and form (comments other than the question would be grate also): //create user entity model userModel = new LoadableDetachableModel() { private static final long serialVersionUID = 0L; @Override protected SqsUser load() { Session session; session = (Session) getSession(); SqsUser user; if (selectedUser != null) return selectedUser; user = null; try { user = session.getEntityManager().create(SqsUser.class); } catch (SQLException ex) { Logger.getLogger(UsersPanel.class.getName()).log(Level.SEVERE, null, ex); } if (user != null) selectedUser = user; return user; } }; //create user form overriding process to begin transaction usersForm = new Form("users-form", new CompoundPropertyModel(userModel)) { private static final long serialVersionUID = 0L; private Transaction transaction; @Override public void process(IFormSubmittingComponent submittingComponent) { super.process(submittingComponent); transaction = new Transaction(((Session) getSession()).getEntityManager()) { @Override protected SqsUser run() throws SQLException { SqsUser user = getModelObject(); user.save(); return user; } }; } @Override protected void onSubmit() { try { transaction.execute(); } catch (SQLException ex) { Logger.getLogger(UsersPanel.class.getName()).log(Level.SEVERE, null, ex); onError(); } } @Override protected void onError() { } };
Re: Have a feature, want to contribute
Marat, It doesn't look like you received any response. I'd be happy to look at it. Could you file it as a patch on JIRA? Thanks, Jeremy Thomerson http://www.wickettraining.com On Thu, Dec 18, 2008 at 1:52 PM, Marat Radchenko < slonopotamusor...@gmail.com> wrote: > Wicket pages/components can be either stateful or stateless. Wicket > manages hem transparently and it is very easy to write any complex > page you want. Stateful pages are much more powerful than stateless. > However that comes at a cost of using page store for their state. On > highload sites it is usually desired to minimize session-scope data, > and move it to request-scope. That's when Wicket users approach a task > of making stateful pages stateless. However stateless state (sic!) is > very fragile, if you add a single stateful component to a page, it > instantly becomes stateful (and you even might not notice that if your > other page content can work in both modes. And here comes my lovely > feature - @StatelessComponent. It is an annotation that you should put > on components which you want to be stateless. It doesn't do any magic, > it simply uses postComponentOnBeforeRender to assert that annotated > component (and all its children) are stateless. If it doesn't, an > exception is thrown, indicating what component tries to be stateful. > > This feature isn't large enough to be put in a separate project (just > one annotation and one listener) but wee find it extremely useful on > our project. > > I'd be happy to give it to Wicket project (or wicketstuff?) at > absolutely no cost (tests included) under same license as wicket > itself, if Wicket developers are interested in it. > > I'll file a feature request with a patch, if Wicket team finds this > useful in Wicket core. > > - > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > >
Re: Wicket - Session Management
Basically, the normal Wicket facility for transferring state client side is through PageParameters. Of course, if you're building links to another app, you'll basically need to build these links your self since App1 doesn't know how to build links for App2 since App2 pages aren't mounted in App1. So, you pretty much have your normal webapp options - store the state somewhere central to both apps (DB, etc), or transfer it some other way (perhaps a messaging bus). Wicket is just OO, so you can pretty much use whatever fits your situation. -- Jeremy Thomerson http://www.wickettraining.com On Wed, Mar 4, 2009 at 2:48 AM, subbu_tce wrote: > > Jeremy, I meant to ask about both the points that you have mentioned in > your > reply message: > > (i.e) Two wicket apps in two JVMs. How do we accomplish the following? > > - transfer state from first app to second app when clicking a link in the > first app > - access state in the first app from second app > - preserve/expire state in the first app when moving to second app. > > Moreover, how do we accomplish the above three for two wicket apps in the > same JVM? > > And also does wicket provide any extension points to have the state saved > in > the client side? > > > --- > > I'm not sure exactly what you're asking. Is it one of the following? > > - I have two apps in two JVMs - how do I transfer state from one app to the > second when clicking a link from one to the other? > - I have two apps in two JVMs - how do I expire state in the first when > moving to the second? > > -- > Jeremy Thomerson > http://www.wickettraining.com > > -- > View this message in context: > http://www.nabble.com/Wicket---Session-Management-tp22288083p22325909.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: warn user a field has changed
Not yet. Still trying to figure it out. Just wanted to make sure I wasn't overlooking something in the manual that works just as as well or better. Igor Vaynberg wrote: do you know why it doesnt work? -igor On Sat, Mar 7, 2009 at 12:26 PM, Kurt Heston wrote: I haven't been able to make this work since my upgrade from 1.2.x to 1.3.5: http://javathoughts.capesugarbird.com/2007/11/warning-on-page-exit-for-wicket-12x.html It was pretty slick. I was able to warn the user that she/he had changed a field without saving when trying to navigate away. Is there a better facility in 1.3.x that I can use for the same purpose? - 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: warn user a field has changed
do you know why it doesnt work? -igor On Sat, Mar 7, 2009 at 12:26 PM, Kurt Heston wrote: > I haven't been able to make this work since my upgrade from 1.2.x to 1.3.5: > > http://javathoughts.capesugarbird.com/2007/11/warning-on-page-exit-for-wicket-12x.html > > > It was pretty slick. I was able to warn the user that she/he had > changed a field without saving when trying to navigate away. Is there a > better facility in 1.3.x that I can use for the same purpose? > > > - > 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 (not) to: IModel and Collections (and generics)
you are right, the components that just read a collection do just that, read it. they simply ignore the setter method in imodel. no big deal, just because you are given an interface doesnt mean you have to use all the methods in it. thus abstractreadonlymodel. however, a lot of components manipulate items in the collection. you are right, they can do this without ever needing a setter, but it is very convenient to have a callback that lets you know that the collection has been updated. it is even more convenient to have a callback be part of model itself because in wicket you often factor out conversions and other transformations into the model implementation itself so they are reusable across multiple components. keep in mind models are the glue between components and your domain model, so if any kind of massaging needs to be done for the domain model to work smoothly with the component the model is the perfect place to do it. -igor On Sat, Mar 7, 2009 at 12:25 PM, Johannes Schneider wrote: > >> i think "misuse" is a pretty bold word considering you are talking to >> people who designed and built imodel, dont you think? :) > > Well, I think you are right. Sorry for that. > I just mean, that it has a bad smell here... > >> >> if we do what you suggest then we would end up with: >> >> interface imodel { object getobject(); } >> interface icollectionmodel extends imodel { object convert(object); } >> interface iwhatevermodel extends imodel { void setobject(object); } >> >> then things that are built on top of imodel now have to be built on >> top of at least two hierarchies (imodel and iwhatevermodel - >> considering icollectionmodel can be a mixin which all implementations >> have to check for which makes it dirty), so we will end up with double >> the classes like loadabledetachablemodel, etc. > > Yes, I think we need at least two interfaces. I don't know whether we > need the icollectionmodel... I think that can be discussed. >> >> where as right now this works perfectly and is quiet elegant: >> >> abstract class collectionconverter implements >> imodel> { >> private final imodel> delegate; >> >> public collection getobject() { >> list list=new arraylist(delegate.getobject().size()); >> for (old o:delegate.getobject()) { >> list.add(converttonew(o)); >> } >> return list; >> } >> >> public void setobject(collection object) { >> delegate.getobject().clear(); >> for (new o:object) { >> delegate.getobject().add(converttold(o)); >> } >> } >> >> abstract new converttonew(old o); >> abstract old converttoold(new o); >> } > > Don't know, whether that is really "elegant". It feels more like a > misuse... ;). > I think there is a reason you don't simply take an object for everything > (what might be the most elegant)... > > I really don't understand why IModel must handle the conversion stuff. > That conversion thing could/should be done using some wrapper or > something else. But I don't get all the concepts of Wicket. > I just think that components that just *read* a collection, should just > read the collection... > > But well, as you mentioned correctly, you have designed it, so it is > your choice... > > > Regards, > > Johannes > > >> >> -igor >> >> > >> > Regards, >> > >> > Johannes >> > >> > > >> > > -igor >> > > >> > > On Wed, Mar 4, 2009 at 4:50 AM, Johannes Schneider >> > > wrote: >> > > > Hi, >> > > > >> > > > the concept of IModel seems to be very obvious. It is simply some kind >> > > > of reference and offers a getter and a setter. >> > > > >> > > > When used with ordinary object, everything works fine. An IModel that >> > > > contains a String can easily be mapped to a TextField. >> > > > The text field calls "getObject" to show the initial value and sets the >> > > > changed string to the model using "setObject" on form commit. >> > > > >> > > > >> > > > Everything becomes a little more complicated when collections are >> > > > affected. The problem is, that it is not obvious what those collections >> > > > represent. >> > > > >> > > > 1) A collection might be read-only (e.g. the possible choices for a >> > > > selection). >> > > > 2) But it also might be necessary to add/remove single elements (e.g. >> > > > privileged users shown within a shuffle list). >> > > > 3) And sometimes the complete collection is changed (can't find an >> > > > example here). >> > > > >> > > > >> > > > IModel only supports the *third* method where the complete collection >> > > > is >> > > > replaced. >> > > > (Don't forget that the reference to the collection changes which will >> > > > lead to several other problems.) >> > > > I strongly recommend the usage of a wrapping class for that case. >> > > > But this case is not very common. Maybe someone finds a good example - >> > > > I >> > > > can't. >> > > > >> > > > >> > > > For the other two cases it does *not* make any sense to call >> > > > IModel#setObject. >> > > > >> > > > >> > > > Summary: Nearly i
warn user a field has changed
I haven't been able to make this work since my upgrade from 1.2.x to 1.3.5: http://javathoughts.capesugarbird.com/2007/11/warning-on-page-exit-for-wicket-12x.html It was pretty slick. I was able to warn the user that she/he had changed a field without saving when trying to navigate away. Is there a better facility in 1.3.x that I can use for the same purpose? - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: How (not) to: IModel and Collections (and generics)
> i think "misuse" is a pretty bold word considering you are talking to > people who designed and built imodel, dont you think? :) Well, I think you are right. Sorry for that. I just mean, that it has a bad smell here... > > if we do what you suggest then we would end up with: > > interface imodel { object getobject(); } > interface icollectionmodel extends imodel { object convert(object); } > interface iwhatevermodel extends imodel { void setobject(object); } > > then things that are built on top of imodel now have to be built on > top of at least two hierarchies (imodel and iwhatevermodel - > considering icollectionmodel can be a mixin which all implementations > have to check for which makes it dirty), so we will end up with double > the classes like loadabledetachablemodel, etc. Yes, I think we need at least two interfaces. I don't know whether we need the icollectionmodel... I think that can be discussed. > > where as right now this works perfectly and is quiet elegant: > > abstract class collectionconverter implements > imodel> { > private final imodel> delegate; > > public collection getobject() { > list list=new arraylist(delegate.getobject().size()); > for (old o:delegate.getobject()) { > list.add(converttonew(o)); > } > return list; > } > > public void setobject(collection object) { > delegate.getobject().clear(); > for (new o:object) { > delegate.getobject().add(converttold(o)); > } > } > > abstract new converttonew(old o); > abstract old converttoold(new o); > } Don't know, whether that is really "elegant". It feels more like a misuse... ;). I think there is a reason you don't simply take an object for everything (what might be the most elegant)... I really don't understand why IModel must handle the conversion stuff. That conversion thing could/should be done using some wrapper or something else. But I don't get all the concepts of Wicket. I just think that components that just *read* a collection, should just read the collection... But well, as you mentioned correctly, you have designed it, so it is your choice... Regards, Johannes > > -igor > > > > > Regards, > > > > Johannes > > > > > > > > -igor > > > > > > On Wed, Mar 4, 2009 at 4:50 AM, Johannes Schneider > > > wrote: > > > > Hi, > > > > > > > > the concept of IModel seems to be very obvious. It is simply some kind > > > > of reference and offers a getter and a setter. > > > > > > > > When used with ordinary object, everything works fine. An IModel that > > > > contains a String can easily be mapped to a TextField. > > > > The text field calls "getObject" to show the initial value and sets the > > > > changed string to the model using "setObject" on form commit. > > > > > > > > > > > > Everything becomes a little more complicated when collections are > > > > affected. The problem is, that it is not obvious what those collections > > > > represent. > > > > > > > > 1) A collection might be read-only (e.g. the possible choices for a > > > > selection). > > > > 2) But it also might be necessary to add/remove single elements (e.g. > > > > privileged users shown within a shuffle list). > > > > 3) And sometimes the complete collection is changed (can't find an > > > > example here). > > > > > > > > > > > > IModel only supports the *third* method where the complete collection is > > > > replaced. > > > > (Don't forget that the reference to the collection changes which will > > > > lead to several other problems.) > > > > I strongly recommend the usage of a wrapping class for that case. > > > > But this case is not very common. Maybe someone finds a good example - I > > > > can't. > > > > > > > > > > > > For the other two cases it does *not* make any sense to call > > > > IModel#setObject. > > > > > > > > > > > > Summary: Nearly in every case when the IModel contains a collection, the > > > > "setObject" method does not make any sense and must not be called. > > > > > > > > > > > > Conclusion: I think we should have created some sort of IModelProvider > > > > (contains only the getObject method) and IModel (with both methods). > > > > Components that just *read* values from the model, accept the read only > > > > interface now. > > > > > > > > For special cases where a magic component adds/removes elements to a > > > > collection, we need some sort of ICollectionModel that offers "add" and > > > > "remove" methods (but no setter). > > > > That interface - of course - will be based upon a collection *without* > > > > wildcards... > > > > > > > > > > > > > > > > Regards, > > > > > > > > Johannes Schneider > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > - > > > > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > > > > For additional commands, e-mail: users-h...@wicket.apache.org > > > > > > > > > > > > > > --
Re: Creating a brandable or white label type of application
if you are just starting to think about building this you might want to consider using brix, or another cms that works well with wicket. in case of brix: each client would get their own jcr workspaces that you can fill in with a template. they are then free to edit their own workspace creating pages, uploading images, etc. it is trivial in brix to map domains to workspaces functionality for your application is then provided using brix tiles which users are free to move around their html, a tile is basically just a [brix:tile tile:id="foo"][/brix:tile] anywhere inside the markup. if this sounds too out there you can still use normal wicket code and allow your customers to edit the markup. you can store the markup itself in the database, so all things like styles and variations still work even though markup is not in the war. see IMarkupStreamProvider and IMarkupCacheKeyProvider - these allow you to override where markup comes from per page or per hierarchy of pages. there are more general things like IResourceStreamProvider that will allow you to override where resources are loaded from on a global scale. -igor On Fri, Mar 6, 2009 at 7:30 PM, Tauren Mills wrote: > I'm looking for thoughts on ways to create a site that can be branded > by a customer. It should do the following: > > * run in a single webapp deployed in a WAR file > * multiple host names resolve to this same web app > domain1.com -> myapp.com > domain2.com --> myapp.com > * based on the host name, the app selects a skin (color scheme, > images, maybe even layout changes) > * users need to be able to alter colors, images, and layout in real > time, so updating the WAR with new skins isn't possible > * need to pull alternate CSS content and perhaps HTML markup from a > database and images from a location outside of the WAR. > > This needs to be kind of like blogger.com, where a user can change > images and colors, and the application displays their blog that way. > But in my case, the content on the page primarily remains the same, > just the way it is presented changes. > > So I'm looking at the localization and style features thinking they > might help. But they rely on alternate versions of files to be in the > WAR. > http://cwiki.apache.org/WICKET/localization-and-skinning-of-applications.html > > What methods would you recommend to get the current hostname from the request? > Whould this be best done in the RequestCycle, the Session, or? > What techniques would be useful for using external CSS, images, and HTML? > Will getStyle/setStyle even help since the content is external of the WAR? > > I realize that I shouldn't allow users to modify HTML markup that > contains wicket tags. That could break things very quickly. > > I'm just starting to think about how to do this, so I'm looking for > any suggestions to direct me to the right tools for the job. > > Thanks, > Tauren > > - > 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 (not) to: IModel and Collections (and generics)
On Sat, Mar 7, 2009 at 10:15 AM, Johannes Schneider wrote: > > > setobject is still called on the model, but is called with the same > > instance of collection. this is necessary so that if you have a model > > that translates a collection of one type to a collection of another > > can perform the conversion when the component pushes new data into it. > > And this is just a *misuse* of the given method... Why not create a own > model interface for collections and add some sort of conversion > method/object? i think "misuse" is a pretty bold word considering you are talking to people who designed and built imodel, dont you think? :) if we do what you suggest then we would end up with: interface imodel { object getobject(); } interface icollectionmodel extends imodel { object convert(object); } interface iwhatevermodel extends imodel { void setobject(object); } then things that are built on top of imodel now have to be built on top of at least two hierarchies (imodel and iwhatevermodel - considering icollectionmodel can be a mixin which all implementations have to check for which makes it dirty), so we will end up with double the classes like loadabledetachablemodel, etc. where as right now this works perfectly and is quiet elegant: abstract class collectionconverter implements imodel> { private final imodel> delegate; public collection getobject() { list list=new arraylist(delegate.getobject().size()); for (old o:delegate.getobject()) { list.add(converttonew(o)); } return list; } public void setobject(collection object) { delegate.getobject().clear(); for (new o:object) { delegate.getobject().add(converttold(o)); } } abstract new converttonew(old o); abstract old converttoold(new o); } -igor > > Regards, > > Johannes > > > > > -igor > > > > On Wed, Mar 4, 2009 at 4:50 AM, Johannes Schneider > > wrote: > > > Hi, > > > > > > the concept of IModel seems to be very obvious. It is simply some kind > > > of reference and offers a getter and a setter. > > > > > > When used with ordinary object, everything works fine. An IModel that > > > contains a String can easily be mapped to a TextField. > > > The text field calls "getObject" to show the initial value and sets the > > > changed string to the model using "setObject" on form commit. > > > > > > > > > Everything becomes a little more complicated when collections are > > > affected. The problem is, that it is not obvious what those collections > > > represent. > > > > > > 1) A collection might be read-only (e.g. the possible choices for a > > > selection). > > > 2) But it also might be necessary to add/remove single elements (e.g. > > > privileged users shown within a shuffle list). > > > 3) And sometimes the complete collection is changed (can't find an > > > example here). > > > > > > > > > IModel only supports the *third* method where the complete collection is > > > replaced. > > > (Don't forget that the reference to the collection changes which will > > > lead to several other problems.) > > > I strongly recommend the usage of a wrapping class for that case. > > > But this case is not very common. Maybe someone finds a good example - I > > > can't. > > > > > > > > > For the other two cases it does *not* make any sense to call > > > IModel#setObject. > > > > > > > > > Summary: Nearly in every case when the IModel contains a collection, the > > > "setObject" method does not make any sense and must not be called. > > > > > > > > > Conclusion: I think we should have created some sort of IModelProvider > > > (contains only the getObject method) and IModel (with both methods). > > > Components that just *read* values from the model, accept the read only > > > interface now. > > > > > > For special cases where a magic component adds/removes elements to a > > > collection, we need some sort of ICollectionModel that offers "add" and > > > "remove" methods (but no setter). > > > That interface - of course - will be based upon a collection *without* > > > wildcards... > > > > > > > > > > > > Regards, > > > > > > Johannes Schneider > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > - > > > 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: user
Re: How (not) to: IModel and Collections (and generics)
On Wed, 2009-03-04 at 09:14 -0800, Igor Vaynberg wrote: > components that deal with collections in wicket always reuse the same > instance of collection is one was provided where it makes sense. Yes, and therefore a setter is not necessary. > setobject is still called on the model, but is called with the same > instance of collection. this is necessary so that if you have a model > that translates a collection of one type to a collection of another > can perform the conversion when the component pushes new data into it. And this is just a *misuse* of the given method... Why not create a own model interface for collections and add some sort of conversion method/object? Regards, Johannes > > -igor > > On Wed, Mar 4, 2009 at 4:50 AM, Johannes Schneider > wrote: > > Hi, > > > > the concept of IModel seems to be very obvious. It is simply some kind > > of reference and offers a getter and a setter. > > > > When used with ordinary object, everything works fine. An IModel that > > contains a String can easily be mapped to a TextField. > > The text field calls "getObject" to show the initial value and sets the > > changed string to the model using "setObject" on form commit. > > > > > > Everything becomes a little more complicated when collections are > > affected. The problem is, that it is not obvious what those collections > > represent. > > > > 1) A collection might be read-only (e.g. the possible choices for a > > selection). > > 2) But it also might be necessary to add/remove single elements (e.g. > > privileged users shown within a shuffle list). > > 3) And sometimes the complete collection is changed (can't find an > > example here). > > > > > > IModel only supports the *third* method where the complete collection is > > replaced. > > (Don't forget that the reference to the collection changes which will > > lead to several other problems.) > > I strongly recommend the usage of a wrapping class for that case. > > But this case is not very common. Maybe someone finds a good example - I > > can't. > > > > > > For the other two cases it does *not* make any sense to call > > IModel#setObject. > > > > > > Summary: Nearly in every case when the IModel contains a collection, the > > "setObject" method does not make any sense and must not be called. > > > > > > Conclusion: I think we should have created some sort of IModelProvider > > (contains only the getObject method) and IModel (with both methods). > > Components that just *read* values from the model, accept the read only > > interface now. > > > > For special cases where a magic component adds/removes elements to a > > collection, we need some sort of ICollectionModel that offers "add" and > > "remove" methods (but no setter). > > That interface - of course - will be based upon a collection *without* > > wildcards... > > > > > > > > Regards, > > > > Johannes Schneider > > > > > > > > > > > > > > > > > > > > > > > > > > > > - > > 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: How (not) to: IModel and Collections (and generics)
On Wed, 2009-03-04 at 08:27 -0800, Scott Swank wrote: > Does AbstractReadOnlyModel accomplish what you're talking about? Not really. I suggest a separate interface that does not extend IModel. Instead IModel should extend that one (since it adds the setter)... And of course that interface should be used within the declarations to show that only read access is used... Regards, Johannes > > Scott > > On Wed, Mar 4, 2009 at 4:50 AM, Johannes Schneider > wrote: > > Hi, > > > > the concept of IModel seems to be very obvious. It is simply some kind > > of reference and offers a getter and a setter. > > > > When used with ordinary object, everything works fine. An IModel that > > contains a String can easily be mapped to a TextField. > > The text field calls "getObject" to show the initial value and sets the > > changed string to the model using "setObject" on form commit. > > > > > > Everything becomes a little more complicated when collections are > > affected. The problem is, that it is not obvious what those collections > > represent. > > > > 1) A collection might be read-only (e.g. the possible choices for a > > selection). > > 2) But it also might be necessary to add/remove single elements (e.g. > > privileged users shown within a shuffle list). > > 3) And sometimes the complete collection is changed (can't find an > > example here). > > > > > > IModel only supports the *third* method where the complete collection is > > replaced. > > (Don't forget that the reference to the collection changes which will > > lead to several other problems.) > > I strongly recommend the usage of a wrapping class for that case. > > But this case is not very common. Maybe someone finds a good example - I > > can't. > > > > > > For the other two cases it does *not* make any sense to call > > IModel#setObject. > > > > > > Summary: Nearly in every case when the IModel contains a collection, the > > "setObject" method does not make any sense and must not be called. > > > > > > Conclusion: I think we should have created some sort of IModelProvider > > (contains only the getObject method) and IModel (with both methods). > > Components that just *read* values from the model, accept the read only > > interface now. > > > > For special cases where a magic component adds/removes elements to a > > collection, we need some sort of ICollectionModel that offers "add" and > > "remove" methods (but no setter). > > That interface - of course - will be based upon a collection *without* > > wildcards... > > > > > > > > Regards, > > > > Johannes Schneider > > > > > > > > > > > > > > > > > > > > > > > > > > > > - > > 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: Wizard and onSubmit of nested form
I created the following Jira issue for this: https://issues.apache.org/jira/browse/WICKET-2150 Dave Schoorl wrote: Thanks. But I've dug a little deeper and it turns out that the panel switching is done in the onSubmit() of the Wizard's NextButton. The Form's onSubmit() is executed after that, so that will execute the onSubmit() of the replaced (read: next) nested Form. I don't think that is correct, so I will be preparing a Jira issue later today. But I am still looking for a work around (or maybe a permanent solution that can be submitted as a patch). Regards, Dave rmattler wrote: Show us your code and I'll see if I can help. Dave Schoorl wrote: Hi Robert, thanks for your quick reply. I am not sure if I understand what you mean. How is form validation helping with the trigger of onSubmit() on the correct form? But I gave it a try and the problem remains: the onSubmit of the next step is called instead of the current step. I think that first the panel of the current step is replaced with the panel of the next step and then the onSubmit is executed. Hope someone can help me. Regards, Dave rmattler wrote: Use "public void validate(Form form)" See example below. Hope it helps. private final class Step2 extends WizardStep { public Step2() { setTitleModel(new Model("Add pictures")); add(new AbstractFormValidator() { public FormComponent[] getDependentFormComponents() { return null; } public void validate(Form form) { String dir = Constants.ADD_PROJECT_FILE_PIC_PATH + getProjects().getTblId(); File filesDir = new File(dir); if (filesDir.canRead() || filesDir.isDirectory()) { String[] fileNames = filesDir.list(); if (fileNames.length > 0) { getProjects().setNumPhotos(fileNames.length); } else { form.error("Please upload some photos"); } } else { form.error("Please upload some photos"); } } }); } } Dave Schoorl wrote: Hi all, I am building my first Wizard with the wizard from wicket-extensions version 1.3.5. Every step contains a panel with it's own form, so I have a nested form in the wizards form. I was expecting that when I click next, the onSubmit of my current form is called, but it's not. Instead the onSubmit of the form in the next step is called. This seems to be related: http://markmail.org/message/ktpvzvslq5tupo6x Am I doing something wrong? Regards, Dave - 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: Wizard and onSubmit of nested form
Thanks. But I've dug a little deeper and it turns out that the panel switching is done in the onSubmit() of the Wizard's NextButton. The Form's onSubmit() is executed after that, so that will execute the onSubmit() of the replaced (read: next) nested Form. I don't think that is correct, so I will be preparing a Jira issue later today. But I am still looking for a work around (or maybe a permanent solution that can be submitted as a patch). Regards, Dave rmattler wrote: Show us your code and I'll see if I can help. Dave Schoorl wrote: Hi Robert, thanks for your quick reply. I am not sure if I understand what you mean. How is form validation helping with the trigger of onSubmit() on the correct form? But I gave it a try and the problem remains: the onSubmit of the next step is called instead of the current step. I think that first the panel of the current step is replaced with the panel of the next step and then the onSubmit is executed. Hope someone can help me. Regards, Dave rmattler wrote: Use "public void validate(Form form)" See example below. Hope it helps. private final class Step2 extends WizardStep { public Step2() { setTitleModel(new Model("Add pictures")); add(new AbstractFormValidator() { public FormComponent[] getDependentFormComponents() { return null; } public void validate(Form form) { String dir = Constants.ADD_PROJECT_FILE_PIC_PATH + getProjects().getTblId(); File filesDir = new File(dir); if (filesDir.canRead() || filesDir.isDirectory()) { String[] fileNames = filesDir.list(); if (fileNames.length > 0) { getProjects().setNumPhotos(fileNames.length); } else { form.error("Please upload some photos"); } } else { form.error("Please upload some photos"); } } }); } } Dave Schoorl wrote: Hi all, I am building my first Wizard with the wizard from wicket-extensions version 1.3.5. Every step contains a panel with it's own form, so I have a nested form in the wizards form. I was expecting that when I click next, the onSubmit of my current form is called, but it's not. Instead the onSubmit of the form in the next step is called. This seems to be related: http://markmail.org/message/ktpvzvslq5tupo6x Am I doing something wrong? Regards, Dave - 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: tinymce question: how to switch default language?
The default language is based on the locale of the session. Which is normally what you want (because it is influenced by the browser preferences, and the same as what wicket is using). You can override it by passing a language as second argument in the TinyMCESettings constructor. On Sat, 07 Mar 2009 07:22 -0800, "rolandpeng" wrote: > > There are many languages supported by tinymce. > The default lanuage of my tinymce is "zh". > -- > TinyMCESettings settings = new TinyMCESettings( > TinyMCESettings.Theme.advanced); > Language language = settings.getLanguage(); > System.out.println(language.name()); > ==> > result: zh > -- > I can't find setLanguage() method in TinyMCESettings class. > How to switch the language from "zh" into "en",or any others? > > Thanks. > > Roland. > -- > View this message in context: > http://www.nabble.com/tinymce-question%3A-how-to-switch-default-language--tp22388584p22388584.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: Modal window not appearing in IE
We had a similar problem about modelWindow, Firefox/Opera/Google browser all worked fine, but IE did not show modelwindow, by wicket debug, I found that the server has send ajax modelwindow CDATA, the detail debug information is in attachment. http://www.nabble.com/file/p22388985/wicket-debug-message-in-ie.txt wicket-debug-message-in-ie.txt i have try to wicket-1.3.x-20090303 night build, ModelWindow also did not show in IE. my site url : http://www.517wm.com/app/share when click link(" 您当前所在的地标"), the modalwindow did not show but firefox/Google Chrome works well. can somebody help me? ecornett wrote: > > Has anyone else had trouble with modal windows appearing in Firefox but > not IE and if so, what is a good solution? I can go into more details if > necessary. > -- View this message in context: http://www.nabble.com/Modal-window-not-appearing-in-IE-tp21018938p22388985.html Sent from the Wicket - User mailing list archive at Nabble.com.
Re: Wizard and onSubmit of nested form
Show us your code and I'll see if I can help. Dave Schoorl wrote: > > Hi Robert, thanks for your quick reply. > > I am not sure if I understand what you mean. How is form validation > helping with the trigger of onSubmit() on the correct form? > But I gave it a try and the problem remains: the onSubmit of the next > step is called instead of the current step. I think that first the panel > of the current step is replaced with the panel of the next step and then > the onSubmit is executed. > > Hope someone can help me. > > Regards, > Dave > > > rmattler wrote: >> Use "public void validate(Form form)" >> >> See example below. Hope it helps. >> >> >> private final class Step2 extends WizardStep { >> public Step2() { >> setTitleModel(new Model("Add pictures")); >> >> add(new AbstractFormValidator() { >> public FormComponent[] >> getDependentFormComponents() { >> return null; >> } >> >> public void validate(Form form) { >> >> String dir = >> Constants.ADD_PROJECT_FILE_PIC_PATH + >> getProjects().getTblId(); >> >> File filesDir = new File(dir); >> if (filesDir.canRead() || >> filesDir.isDirectory()) { >> String[] fileNames = >> filesDir.list(); >> if (fileNames.length > 0) { >> >> getProjects().setNumPhotos(fileNames.length); >> } else { >> form.error("Please >> upload some photos"); >> } >> } else { >> form.error("Please upload some >> photos"); >> } >> >> } >> }); >> >> } >> } >> >> Dave Schoorl wrote: >> >>> Hi all, >>> >>> I am building my first Wizard with the wizard from wicket-extensions >>> version 1.3.5. Every step contains a panel with it's own form, so I have >>> a nested form in the wizards form. I was expecting that when I click >>> next, the onSubmit of my current form is called, but it's not. Instead >>> the onSubmit of the form in the next step is called. >>> >>> This seems to be related: http://markmail.org/message/ktpvzvslq5tupo6x >>> >>> Am I doing something wrong? >>> >>> Regards, >>> Dave >>> >>> >>> - >>> 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 > > > -- View this message in context: http://www.nabble.com/Wizard-and-onSubmit-of-nested-form-tp22375244p22388940.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
tinymce question: how to switch default language?
There are many languages supported by tinymce. The default lanuage of my tinymce is "zh". -- TinyMCESettings settings = new TinyMCESettings( TinyMCESettings.Theme.advanced); Language language = settings.getLanguage(); System.out.println(language.name()); ==> result: zh -- I can't find setLanguage() method in TinyMCESettings class. How to switch the language from "zh" into "en",or any others? Thanks. Roland. -- View this message in context: http://www.nabble.com/tinymce-question%3A-how-to-switch-default-language--tp22388584p22388584.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: Uppercasing inputs
Sorry for a late response!! In this part of the world interest works 5-6 hours a day if you are fortunate and yesterday i was not... Man, It is my pleasure to be part of a project which made me most comfortable with j2ee ( I have worked from perl, php, python, asp to .NET, struts, spring MVC ). Hope I will be able to contribute to this project in a few months ... ( right now i am busy with two office projects ) Thanks everybody taha On Fri, Mar 6, 2009 at 8:11 PM, Leszek Gawron wrote: > taha siddiqi wrote: >> >> Thanks!!( everyone MADE a joke and I BECAME one ) > > I'm sorry if you felt offended. It wasn't personal. Maybe my expression was > not exact enough. After all I have used your proposal (modify Strings > directly in domain model). What I didn't like is the requirement to change > every set*( String value ) so I used AspectJ for that (which is probably a > total overkill). > > My regards > lg > -- > Leszek Gawron > > - > 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
bug? RequestUtils.toAbsolutePath using AJAX is not constructing a valid path
Hey hey, trying to construct a URL like this: RequestUtils.toAbsolutePath(urlFor(MyPage.class, null).toString()); this works fine in general, but when executed using AJAX calls, it produces " http:/mypagemountpath " instead of the expected " http://my.host.name/mypagemountpath " Am I missing something or is this a bug? - Antoine -- We don't see things as they are, we see things as we are. - Anais Nin Whether you think you can or whether you think you can't, you're right. - Henry Ford
Re: openstreetmap in openlayers
I have to correct myself a little bit. The setCenter method does work! I had a problem with the coordinates, which were not in the right format. So, sorry for that. morbo wrote: > > Hi Nino, > > yes, I would love to contribute to this project. But I'm warning you, I am > not a very experienced javascript developer. :) > > What I have done so far, was extending the layer class for all osm layers. > For example I created a OSMMapnik class which contributes > "http://www.openstreetmap.org/openlayers/OpenStreetMap.js"; to the header > and the getJSConstructer method returns this: return new > Constructor("OpenLayers.Layer.OSM.Mapnik").add("'" + getName() + > "'").toJS(); > > As you see, I am using the OSM object. This solution works but I think it > would be nicer to use the TSM object, as I have done in my first attempt > (see above). The problem is that the script does not find the > osm_getTileURL method. I am not sure why. > > Furthermore I modified the setZoom method so, that it calls > "zoomTo(zoom)". Thats all. > > Maybe, you could give a brief introduction how the project works. I am not > sure if I understand all of your code. Especially the role of the > wicket-openlayers.js file and event handling. > > richard > > > > > nino martinez wael wrote: >> >> Hi Richard >> >> Im the author behind the openlayers contrib, I checked the code last time >> somewhere in end if december... >> >> Do you have some patches or further clues on whats not working? >> >> >> Im not directly using the openlayers integration currently so patches are >> very welcome, even co- coders would be nice :) >> regards Nino >> >> 2009/3/6 morbo >> >>> >>> Thank you very much. That really helped a lot. I am now able to render >>> the >>> different openstreetmap layers (mapnik, ti...@home, cycleMap) with the >>> above >>> mentioned OpenLayers.Layer.OSM object. >>> >>> But there still exist some problems. It is not entirely possible to edit >>> the >>> maps with the wicketstuff project. Once the map is rendered there is no >>> problem: dragging, zooming, layerswitching are working. But before >>> rendering >>> not all functions are working. For example the setCenter(lonlat, zoom) >>> function of the wicketstuff openlayers contrib seems to do nothing with >>> the >>> map. Also the setZoom function did not worked at the beginning, but >>> after >>> some changes I got it working. >>> >>> I think the project is not entirely up to date with the openlayers api? >>> Maybe a user who is more familiar with this project could give a >>> statement >>> about the problem. >>> >>> >>> >>> >>> >>> Michael O'Cleirigh wrote: >>> > >>> > Hello, >>> > >>> > Pink tiles means there is a mismatch somewhere between your layers. >>> > >>> > Does your openlayers javascript work correctly? (i.e. when not emitted >>> > from wicket openlayers?) >>> > >>> > This page embeds an openstreet map in openlayers: >>> > http://wiki.openstreetmap.org/wiki/OpenLayers >>> > >>> > But it doesn't use the OpenLayers.Layer.TMS object. It adds its own >>> > import (http://openstreetmap.org/openlayers/OpenStreetMap.js ) and >>> uses >>> > an OpenLayers.Layer.OSM object. >>> > >>> > Perhaps your integration should use that instead? >>> > >>> > There is a ticket for something similiar that might get into >>> OpenLayers >>> > 2.8 (http://trac.openlayers.org/ticket/1950) >>> > >>> > Mike >>> > >>> >> I tried a few things and I think I managed the integration of >>> >> openstreetmaps. >>> >> The browser is contacting the osm tile server BUT everything I get >>> are >>> >> pink >>> >> tiles? >>> >> >>> >> >>> >> Here is the output of the final html page: >>> >> >>> >> >>> >> >>> >> Wicket Quickstart Archetype Homepage >>> >> >> >> >>> src="resources/org.apache.wicket.markup.html.WicketEventReference/wicket-event.js"> >>> >> >> >> >>> src="resources/org.apache.wicket.ajax.WicketAjaxReference/wicket-ajax.js"> >>> >> >> >> >>> src="resources/org.apache.wicket.ajax.AbstractDefaultAjaxBehavior/wicket-ajax-debug.js"> >>> >> >> >> id="wicket-ajax-debug-enable">]]>*/ >>> >> >>> >> >> >> src="http://openlayers.org/api/OpenLayers.js";> >>> >> >>> >> >> >> >>> src="resources/org.wicketstuff.openlayers.OpenLayersMap/wicket-openlayersmap.js"> >>> >>