Re: Wicket and JavaFX applet
Use Firebug and add a breakpoint in your JS to see if it is getting executed. If it's not, you may try adding a semi-colon after your "startApplet()" - because I don't remember if you need it when it's run in an eval. -- Jeremy Thomerson http://www.wickettraining.com On Fri, Apr 16, 2010 at 7:25 PM, Marek Šabo wrote: > Hi all, > > I have problems with running javaFX applet inside wicket page. I call a > loading function from ajaxLink > (target.appendJavascript("startApplet()");) and in html: > > >http://dl.javafx.com/1.2/dtfx.js"; > type="text/javascript"> > >function startApplet() { >fxstring = javafxString({ >archive: "/neobax/TrafficApplet.jar", //placed in > root next to WEB-INF >draggable: true, >width: 640, >height: 480, >code: "trafficapplet.Main", >name: "TrafficApplet" >}); >document.getElementById('taContainer').innerHTML=fxstring; >} > > > > > Last thing In ajax debug is: > INFO: Initiating Ajax GET request on http://dl.javafx.com/1.2/dtfx.js > INFO: Invoking pre-call handler(s)... > > Is there any way to know more about the process for better debugging? > > TIA, > > -- > Marek Šabo > > >
my book updated for Wicket 1.4.x
Hi, I've updated my book for Wicket 1.4.x. You may check it out or download the first two chapters at http://agileskills2.org/EWDW - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Wicket and JavaFX applet
Hi all, I have problems with running javaFX applet inside wicket page. I call a loading function from ajaxLink (target.appendJavascript("startApplet()");) and in html: http://dl.javafx.com/1.2/dtfx.js"; type="text/javascript"> function startApplet() { fxstring = javafxString({ archive: "/neobax/TrafficApplet.jar", //placed in root next to WEB-INF draggable: true, width: 640, height: 480, code: "trafficapplet.Main", name: "TrafficApplet" }); document.getElementById('taContainer').innerHTML=fxstring; } Last thing In ajax debug is: INFO: Initiating Ajax GET request on http://dl.javafx.com/1.2/dtfx.js INFO: Invoking pre-call handler(s)... Is there any way to know more about the process for better debugging? TIA, -- Marek Šabo
Re: Type Inference for Wicket 1.4
What happened to the groovy wicket builder project? I know it was on hold until anonymous inner classes were going to be supported which were added in groovy 1.7 irrc. On Fri, Apr 16, 2010 at 7:58 AM, Erdinc wrote: > Or use wicket as I explained on this page :) > > http://java.dzone.com/articles/faster-development-easywicket > > > > > > > > > From: James Carman > To: users@wicket.apache.org > Sent: Fri, April 16, 2010 2:05:12 PM > Subject: Re: Type Inference for Wicket 1.4 > > And, nothing is stopping you from doing something like this in your > own code. I have a class called ComponentUtils where I put stuff like > this. I have two methods: > > public static IModel modelOf(T bean); > public static IModel modelFor(Class > beanClass); // This will instantiate the object for you. > > I also have: > > public static void detachAllModelFields(Component c); > > With static imports, you can just use these methods like they're in > your classes. > > On Fri, Apr 16, 2010 at 1:21 AM, Jeremy Thomerson > wrote: > > This is the key - and it has been discussed before (in the many grueling > 1.4 > > conversations). The short of it is that with private constructors > there's a > > huge change and an inability to extend. And without the private > > constructors, the static methods are dumb and extraneous because you > would > > need hundreds of them, and you would need even more of them on your > extended > > model and component classes. > > > > -- > > Jeremy Thomerson > > http://www.wickettraining.com > > > > > > > > On Thu, Apr 15, 2010 at 8:51 AM, Thomas Kappler > > wrote: > > > >> On 04/15/10 13:06, James Perry wrote: > >> > >>> I can sympathise with that. However I don't think it would be a > >>> maintenance nightmare if the constructors are set to private; but that > >>> would mean a dramatic API change for such convenience and I'm guessing > >>> you're not willing to do this. > >>> > >> > >> Apart from the huge change for questionable benefit, that would also > remove > >> inheritance, which is essential to the Wicket way, because you can't > extend > >> a class with private constructors only. If you can, get a hold of Bloch, > >> Effective Java, and read the insightful chapter on the constructor vs. > >> static factory method trade-off. > >> > >> -- Thomas > >> > >> > >> > >> > >>> Best, > >>> James. > >>> > >>> On 14 April 2010 17:01, Igor Vaynberg wrote: > >>> > you are going to have one factory method for each constructor, its > going to be a pita to maintain. not something we will want in core. > > -igor > > On Wed, Apr 14, 2010 at 8:51 AM, James Perry > wrote: > > > I am looking to migrate from Wicket 1.3 and Wicket 1.4 and I really > > like the type-safe goodies but I do not like its verbosity. I was > > thinking of writing a patch that provides factories to improve the > > brevity by type inference of the generic invariant. > > > > This is an example of my idea: > > > > Model model = Model.newModel(); > > > > public static Model newModel() { > >return new Model(); > > } > > > > Feedback welcomed. :-) > > > > -- > > Best, > > James. > > > > - > > 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 > >>> > >>> > >> > >> -- > >> --- > >> Thomas Kapplerthomas.kapp...@isb-sib.ch > >> Swiss Institute of Bioinformatics Tel: +41 22 379 51 89 > >> CMU, rue Michel Servet 1 > >> 1211 Geneve 4 > >> Switzerland http://www.uniprot.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: Repeating form on a page
Would a FormComponentPanel work? http://wicket.apache.org/docs/1.4/org/apache/wicket/markup/html/form/FormComponentPanel.html On Fri, Apr 16, 2010 at 4:48 PM, David Hamilton < dhamil...@hermitagelighting.com> wrote: > Thanks for the great response! I will look at RefreshingView, but right now > I'm considering yet another possibility. > I'm think of using a display-only ListView for existing items with an edit > button to populate a modal dialog. I have yet to get to the Modal dialog > part so I'll have to report back on how well that works :). > > Thanks, > > David > > -Original Message- > From: Xavier López [mailto:xavil...@gmail.com] > Sent: Friday, April 16, 2010 9:33 AM > To: users@wicket.apache.org > Subject: Re: Repeating form on a page > > Hi, > > I've been through a similar issue recently, also with a 'remove' button to > delete elements from the list. I ended up using RefreshingView (that's the > one I'd reccomend), and it worked nicely. > > However I'll expose the various solutions I've gone through, hoping to > provide some background on the subject. I'd also be grateful on > observations > and comments on these, because I'm sure I'm missing something and there are > still some aspects of these repeaters that I don't understand, so probably > part of these thoughts are wrong :) > > In the first place, I used a ListView repeater. When clicking the 'add new' > button, however, I found that all unsaved input entered on the other list > elements was lost. That's because ListView refreshes the entire List with > the backing Model objects in it's Model, and models were not being > updated, as forms were not being submitted. So, I had to make the 'add new' > link a submit button (skipping default form processing in order to avoid > validation errors on incomplete data). However, to my surprise, same thing > keeped happening (same for the delete button). Later on, I found about > 'ListView#setReuseItems(boolean)', which solved the problem. But to my > despair, the delete button always deleted the last element from the List. I > still do not understand why, and still don't know what is 'reuseItems' > really doing. (Any hints on that one?) > > Then, I was advised to use RefreshingView, and things were moreover the > same, only that instead of having a Model given to the repeater, an > Iterator had to be provided in an overriden method. In this case, a > ModelsEqual ReuseItemStrategy had to be provided in order to keep the > unsaved inputs in the forms when adding/removing. > > > As a last appreciation, I have to say I hoped there was a specific > component > addressing this behavior, being it a fairly common arrangement... If one > day > I fully understand this I'd be happy to implement one myself, even if only > for the sake of clarity in my code ;) > > Thanks, > Xavier > > 2010/4/16 David Hamilton > > > I am new to Wicket (and have had great help from this community so far - > > thank you). My question here is that I'm trying to setup a simple > > contact form where a person may have zero or more contacts. My solution > > is to make the contact info a form within a panel. However, I need to > > repeat the panel form on the page for each contact (represented by a > > POJO I can bind to the form elements). I will provide and "add" button > > at the bottom of the list to allow them to re-submit the page and add a > > new empty object bound to a new form element. > > > > > > > > So my question is really two questions. > > > > > > > > 1) Is this best approach for this situation? > > > > 2) If it is, how do I bind each POJO on the list to a unique form > > instance? > > > > > > > > The goal is to allow each contact to be individually edited and saved. > > > > > > > > Any help is greatly appreciated. > > > > > > > > Thanks, > > > > > > > > David Hamilton > > > > Web Coordinator > > > > (615) 843-3337 > > > > Hermitage Lighting Gallery > > > > www.hermitagelighting.com > > > > > > > > > > > > Keep it Green! To help protect the environment, please > > only print this email if necessary. > > Printing email can cost more than you think. > > Learn more on our website: > > http://www.hermitagelighting.com/printing_email.php > > > > The information transmitted in this email is > > intended solely for the individual or entity > > to which it is addressed and may contain > > confidential and/or privileged material. > > Any review, retransmission, dissemination or > > other use of or taking action in reliance > > upon this information by persons or entities > > other than the intended recipient is prohibited. > > If you have received this email in error please > > immediately notify us by reply email to the sender. > > You must destroy the original material and its contents from any > computer. > > > > > > > > > -- > "Klein bottle for rent--inquire within." > > >
RE: Repeating form on a page
Thanks for the great response! I will look at RefreshingView, but right now I'm considering yet another possibility. I'm think of using a display-only ListView for existing items with an edit button to populate a modal dialog. I have yet to get to the Modal dialog part so I'll have to report back on how well that works :). Thanks, David -Original Message- From: Xavier López [mailto:xavil...@gmail.com] Sent: Friday, April 16, 2010 9:33 AM To: users@wicket.apache.org Subject: Re: Repeating form on a page Hi, I've been through a similar issue recently, also with a 'remove' button to delete elements from the list. I ended up using RefreshingView (that's the one I'd reccomend), and it worked nicely. However I'll expose the various solutions I've gone through, hoping to provide some background on the subject. I'd also be grateful on observations and comments on these, because I'm sure I'm missing something and there are still some aspects of these repeaters that I don't understand, so probably part of these thoughts are wrong :) In the first place, I used a ListView repeater. When clicking the 'add new' button, however, I found that all unsaved input entered on the other list elements was lost. That's because ListView refreshes the entire List with the backing Model objects in it's Model, and models were not being updated, as forms were not being submitted. So, I had to make the 'add new' link a submit button (skipping default form processing in order to avoid validation errors on incomplete data). However, to my surprise, same thing keeped happening (same for the delete button). Later on, I found about 'ListView#setReuseItems(boolean)', which solved the problem. But to my despair, the delete button always deleted the last element from the List. I still do not understand why, and still don't know what is 'reuseItems' really doing. (Any hints on that one?) Then, I was advised to use RefreshingView, and things were moreover the same, only that instead of having a Model given to the repeater, an Iterator had to be provided in an overriden method. In this case, a ModelsEqual ReuseItemStrategy had to be provided in order to keep the unsaved inputs in the forms when adding/removing. As a last appreciation, I have to say I hoped there was a specific component addressing this behavior, being it a fairly common arrangement... If one day I fully understand this I'd be happy to implement one myself, even if only for the sake of clarity in my code ;) Thanks, Xavier 2010/4/16 David Hamilton > I am new to Wicket (and have had great help from this community so far - > thank you). My question here is that I'm trying to setup a simple > contact form where a person may have zero or more contacts. My solution > is to make the contact info a form within a panel. However, I need to > repeat the panel form on the page for each contact (represented by a > POJO I can bind to the form elements). I will provide and "add" button > at the bottom of the list to allow them to re-submit the page and add a > new empty object bound to a new form element. > > > > So my question is really two questions. > > > > 1) Is this best approach for this situation? > > 2) If it is, how do I bind each POJO on the list to a unique form > instance? > > > > The goal is to allow each contact to be individually edited and saved. > > > > Any help is greatly appreciated. > > > > Thanks, > > > > David Hamilton > > Web Coordinator > > (615) 843-3337 > > Hermitage Lighting Gallery > > www.hermitagelighting.com > > > > > > Keep it Green! To help protect the environment, please > only print this email if necessary. > Printing email can cost more than you think. > Learn more on our website: > http://www.hermitagelighting.com/printing_email.php > > The information transmitted in this email is > intended solely for the individual or entity > to which it is addressed and may contain > confidential and/or privileged material. > Any review, retransmission, dissemination or > other use of or taking action in reliance > upon this information by persons or entities > other than the intended recipient is prohibited. > If you have received this email in error please > immediately notify us by reply email to the sender. > You must destroy the original material and its contents from any computer. > > > -- "Klein bottle for rent--inquire within." Keep it Green! To help protect the environment, please only print this email if necessary. Printing email can cost more than you think. Learn more on our website: http://www.hermitagelighting.com/printing_email.php The information transmitted in this email is intended solely for the individual or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of or taking action
Changing style in the same session with setStyle
Hi, I am using setStyle in the Session to set a "skin". I am using this setting to retrieve texts from resource files based on the skin. The thing is that a user might go to other pages during the same session. Other pages might have different "skins" so they are supposed to show other texts for the same keys. What actually happens is that altough other pages reset the setStyle to other values - the texts that are retrieved from the resource files are the ones associated with the FIRST style set in the session. This is really bad as I have all texts mixed up. What is causing this? Is it the resource file lookup that is set once for a session? Something else? Anyway around this? Thanks, Arie
RE: Interstitial window prompt then open a new window
You may want to look into this. I am using this to send a user to page off our site via a link. Link myLink = new Link("myLink") { @Override public void onClick() { String url = "http://your_url";; throw new RestartResponseAtInterceptPageException(new RedirectPage(url)); } }; PopupSettings settings = new PopupSettings(); settings.setTarget("_new"); settings.setWindowName("My Other Site"); myLink.setPopupSettings(settings); add(myLink); It does not have the interstitial window prompt but this may get your closer to what you want. -Original Message- From: Doug Leeper [mailto:douglee...@yahoo.com] Sent: Friday, April 16, 2010 11:51 AM To: users@wicket.apache.org Subject: Interstitial window prompt then open a new window We are needing an interstitial window that prompts a user if they want to continue to another site. Additionally, we would like to provide a checkbox if they would not longer like to see this prompt again. I can prompt via a ModalWindow and capture their response...but what I am not sure what to do now is open a window with the destination URL via Ajax. I like the target="_blank" behavior on an href...but this can't apply since I am opening a modal window with that link. Do I have to create custom javascript to append to the Ajax request to open a new window with that url? Are there other options? Thanks in advance! - Doug - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: New blog post "Components v.s. Pages"
Thanks - I think insights from more experienced wicket developers are very welcome at the moment. I agree very much with what you say in the post that it's hard to find information about the best "shape" for a wicket application to meet your needs. Also the comment re component swapping - I certainly wasn't aware of this for quite some time, and it does shed a completely different light on how the framework can be used. - Original Message - From: "Erwin Bolwidt" To: users@wicket.apache.org Sent: Friday, 16 April, 2010 2:35:50 PM Subject: New blog post "Components v.s. Pages" Hi, I created a blog posted titled " Wicket best practices: Components v.s. Pages" http://blog.worldturner.com/worldturner/entry/wicket_best_practices_components_v We've been using wicket at my current location for quite a few projects now and I'm writing a few blog entries on the things that we've found most convenient. Regards, Erwin Bolwidt - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Detect bookmark access to nonbookmarkablepages
Thanks for the feedback, Igor, nice idea. About the page factory exception, in fact I have nonbookmarkablepages mounted as if they were, just to makeup the url's, like this: mount(new HybridUrlCodingStrategy("/pageA", PageA.class)); So that when the user enters PageA (no default constructor - non bookmarkable), he gets on the browser's location bar: http://myapplication/pageA[.x] Maybe it's a little weird, but it's working for me :) Cheers, Xavier 2010/4/16 Igor Vaynberg > use a decorator, wrap the default factory, catch the exception, > transform it into something else. > > although, if your users are bookmarking a non-bookmarkable url you > should get a page expired error. page factory is only used for > creating bookmarkable pages. > > -igor > > On Fri, Apr 16, 2010 at 1:37 AM, Xavier López wrote: > > Hi there, > > > > I'm trying to find an elegant way to detect the cases where a user tries > to > > access a nonbookmarkablepage with a bookmark. From the stack trace > produced > > in this case, I see this situation is handled in > > DefaultPageFactory#newPage(Class pageClass), like this: > > > > > >catch (NoSuchMethodException e) > >{ > >// a bit of a hack here.. > >Constructor constructor = constructor(pageClass, > > PageParameters.class); > >if (constructor != null) > >{ > >return newPage(constructor, new PageParameters()); > >} > >else > >{ > >throw new WicketRuntimeException("Unable to create page > from > > " + pageClass + > >". Class does not have a default contructor", e); > >} > >} > > > > > > I would like to present a custom page explaining the circumstances with a > > nice link to the starting place where to navigate from. > > I don't really like treating this situation as a WicketRuntimeException > and > > have it bubbling up to an internalerrorpage, because of the little > > information on the exception thrown (i don't like identifying it by its > > text, or nested exception type). > > > > Unfortunately, DefaultPageFactory#newPage(Class pageClass) is final, so > this > > behavior can not be overriden. Is providing a custom implementation of > > IPageFactory the best approach to this issue ? Any other way around ? > > > > Cheers, > > Xavier > > > > - > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > > -- "Klein bottle for rent--inquire within."
Interstitial window prompt then open a new window
We are needing an interstitial window that prompts a user if they want to continue to another site. Additionally, we would like to provide a checkbox if they would not longer like to see this prompt again. I can prompt via a ModalWindow and capture their response...but what I am not sure what to do now is open a window with the destination URL via Ajax. I like the target="_blank" behavior on an href...but this can't apply since I am opening a modal window with that link. Do I have to create custom javascript to append to the Ajax request to open a new window with that url? Are there other options? Thanks in advance! - Doug
Re: Repeating form on a page
this may give you some ideas http://wicketinaction.com/2008/10/building-a-listeditor-form-component/ -igor On Fri, Apr 16, 2010 at 6:48 AM, David Hamilton wrote: > I am new to Wicket (and have had great help from this community so far - > thank you). My question here is that I'm trying to setup a simple > contact form where a person may have zero or more contacts. My solution > is to make the contact info a form within a panel. However, I need to > repeat the panel form on the page for each contact (represented by a > POJO I can bind to the form elements). I will provide and "add" button > at the bottom of the list to allow them to re-submit the page and add a > new empty object bound to a new form element. > > > > So my question is really two questions. > > > > 1) Is this best approach for this situation? > > 2) If it is, how do I bind each POJO on the list to a unique form > instance? > > > > The goal is to allow each contact to be individually edited and saved. > > > > Any help is greatly appreciated. > > > > Thanks, > > > > David Hamilton > > Web Coordinator > > (615) 843-3337 > > Hermitage Lighting Gallery > > www.hermitagelighting.com > > > > > > Keep it Green! To help protect the environment, please > only print this email if necessary. > Printing email can cost more than you think. > Learn more on our website: http://www.hermitagelighting.com/printing_email.php > > The information transmitted in this email is > intended solely for the individual or entity > to which it is addressed and may contain > confidential and/or privileged material. > Any review, retransmission, dissemination or > other use of or taking action in reliance > upon this information by persons or entities > other than the intended recipient is prohibited. > If you have received this email in error please > immediately notify us by reply email to the sender. > You must destroy the original material and its contents from any computer. > > > - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Detect bookmark access to nonbookmarkablepages
use a decorator, wrap the default factory, catch the exception, transform it into something else. although, if your users are bookmarking a non-bookmarkable url you should get a page expired error. page factory is only used for creating bookmarkable pages. -igor On Fri, Apr 16, 2010 at 1:37 AM, Xavier López wrote: > Hi there, > > I'm trying to find an elegant way to detect the cases where a user tries to > access a nonbookmarkablepage with a bookmark. From the stack trace produced > in this case, I see this situation is handled in > DefaultPageFactory#newPage(Class pageClass), like this: > > > catch (NoSuchMethodException e) > { > // a bit of a hack here.. > Constructor constructor = constructor(pageClass, > PageParameters.class); > if (constructor != null) > { > return newPage(constructor, new PageParameters()); > } > else > { > throw new WicketRuntimeException("Unable to create page from > " + pageClass + > ". Class does not have a default contructor", e); > } > } > > > I would like to present a custom page explaining the circumstances with a > nice link to the starting place where to navigate from. > I don't really like treating this situation as a WicketRuntimeException and > have it bubbling up to an internalerrorpage, because of the little > information on the exception thrown (i don't like identifying it by its > text, or nested exception type). > > Unfortunately, DefaultPageFactory#newPage(Class pageClass) is final, so this > behavior can not be overriden. Is providing a custom implementation of > IPageFactory the best approach to this issue ? Any other way around ? > > Cheers, > Xavier > - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
YuiMenuBarItem getMenuClass menu2
I'm trying to create a YuiMenuBar for my application using the ones in the menu2 packages. It works great, but I want to style one of the YuiMenuBarItems differently. I see there is an overridable getMenuClass() method, but there are 2 issues: 1. The only way to contruct a YuiMenuBarItem is through YuiMenuBar.addMenu(), so even if I create a subclass, it does me no good. 2. The getMenuClass() is returning "yuimenuitem", but the markup already has the class attribute set to "yuimenubaritem" and it is not being overwritten by the one in the component. Am I using these components right, or does YuiMenuItem need a setMenuClass() on it? I am using version 1.4.1.
Re: Bug in Page refresh?
Hi Wolfgang, If I had to refresh the entire page on language change, I would not do it with an Ajax Request, but with a normal one instead. I do not know how will setResponsePage behave in a serverside Ajax callback. However, if you need to do it with ajax, you should add the language dependent components to the AjaxRequestTarget... Hope that helped. Cheers, Xavier 2010/4/16 Wolfgang Grossinger > We have a DropDownChoice to change the language of a page (the language in > mapped through an enum). The handler to change the code is as follows. > >@Override >protected void onSubmit(AjaxRequestTarget target) { > > getSession().setLocale(getLanguage().getObject().getLocale()); >setResponsePage(getPage()); >} > > We just have 3 pages and a login page. The code works on 2 of 3 pages but I > don't know why it doesn't work on the third page (the code to find the > language and to get the current page seems also to be correct and working). > My question is does anybody have some hints what I could do wrong? > > Regards, > > Wolfgang > > > > - > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > >
Re: Repeating form on a page
Hi, I've been through a similar issue recently, also with a 'remove' button to delete elements from the list. I ended up using RefreshingView (that's the one I'd reccomend), and it worked nicely. However I'll expose the various solutions I've gone through, hoping to provide some background on the subject. I'd also be grateful on observations and comments on these, because I'm sure I'm missing something and there are still some aspects of these repeaters that I don't understand, so probably part of these thoughts are wrong :) In the first place, I used a ListView repeater. When clicking the 'add new' button, however, I found that all unsaved input entered on the other list elements was lost. That's because ListView refreshes the entire List with the backing Model objects in it's Model, and models were not being updated, as forms were not being submitted. So, I had to make the 'add new' link a submit button (skipping default form processing in order to avoid validation errors on incomplete data). However, to my surprise, same thing keeped happening (same for the delete button). Later on, I found about 'ListView#setReuseItems(boolean)', which solved the problem. But to my despair, the delete button always deleted the last element from the List. I still do not understand why, and still don't know what is 'reuseItems' really doing. (Any hints on that one?) Then, I was advised to use RefreshingView, and things were moreover the same, only that instead of having a Model given to the repeater, an Iterator had to be provided in an overriden method. In this case, a ModelsEqual ReuseItemStrategy had to be provided in order to keep the unsaved inputs in the forms when adding/removing. As a last appreciation, I have to say I hoped there was a specific component addressing this behavior, being it a fairly common arrangement... If one day I fully understand this I'd be happy to implement one myself, even if only for the sake of clarity in my code ;) Thanks, Xavier 2010/4/16 David Hamilton > I am new to Wicket (and have had great help from this community so far - > thank you). My question here is that I'm trying to setup a simple > contact form where a person may have zero or more contacts. My solution > is to make the contact info a form within a panel. However, I need to > repeat the panel form on the page for each contact (represented by a > POJO I can bind to the form elements). I will provide and "add" button > at the bottom of the list to allow them to re-submit the page and add a > new empty object bound to a new form element. > > > > So my question is really two questions. > > > > 1) Is this best approach for this situation? > > 2) If it is, how do I bind each POJO on the list to a unique form > instance? > > > > The goal is to allow each contact to be individually edited and saved. > > > > Any help is greatly appreciated. > > > > Thanks, > > > > David Hamilton > > Web Coordinator > > (615) 843-3337 > > Hermitage Lighting Gallery > > www.hermitagelighting.com > > > > > > Keep it Green! To help protect the environment, please > only print this email if necessary. > Printing email can cost more than you think. > Learn more on our website: > http://www.hermitagelighting.com/printing_email.php > > The information transmitted in this email is > intended solely for the individual or entity > to which it is addressed and may contain > confidential and/or privileged material. > Any review, retransmission, dissemination or > other use of or taking action in reliance > upon this information by persons or entities > other than the intended recipient is prohibited. > If you have received this email in error please > immediately notify us by reply email to the sender. > You must destroy the original material and its contents from any computer. > > > -- "Klein bottle for rent--inquire within."
Re: resources folder / package
thanks Cemal and Apple. i think i got it. Will test it on Sunday. Eyal Golan egola...@gmail.com Visit: http://jvdrums.sourceforge.net/ LinkedIn: http://www.linkedin.com/in/egolan74 P Save a tree. Please don't print this e-mail unless it's really necessary On Fri, Apr 16, 2010 at 5:13 AM, Apple Grew wrote: > @Eyal > > Maybe you would like to have a look at this thread. > > http://n4.nabble.com/resource-css-loading-td1878209.html > > Regards, > Apple Grew > my blog @ http://blog.applegrew.com/ > > > On Fri, Apr 16, 2010 at 2:41 AM, Eyal Golan wrote: > > > hi, > > thanks. > > I know this, but my question was different. > > I saw in some projects that the JS and CSS files are in the same > hierarchy > > as the class that is used for their scope, but the main folder is > > different. > > > > Example: > > I have a Java class: com.myCompany.ResourceScope.java > > it is located under src. > > I have a file called MyCss.css, which is located under com.myCompany > > but it is located under resources folder. > > both src and resources are under the same project. > > > > in the projects I saw, you can call for this resource reference with the > > ResourceScope class. > > > > I tried to do the same without success. > > > > Any thoughts? > > > > > > Eyal Golan > > egola...@gmail.com > > > > Visit: http://jvdrums.sourceforge.net/ > > LinkedIn: http://www.linkedin.com/in/egolan74 > > > > P Save a tree. Please don't print this e-mail unless it's really > necessary > > > > > > On Thu, Apr 15, 2010 at 4:46 PM, Sigmar Muuga > wrote: > > > > > You can define packages and put all CSS / JS files into them. Note that > > > there must be some class also along with them, it may be an empty > class. > > > > > > Then you can reference these resources using that class declaration. > > > > > > Note that if your css uses images, then you have to put correct paths > > into > > > that css. > > > > > > Sigmar > > > > > > On Thu, Apr 15, 2010 at 2:43 PM, Eyal Golan > wrote: > > > > > > > Hello to you all, > > > > it's been a very long time since I wrote here. > > > > I have a question regarding folder locations. > > > > I am working with WiQuery and it is unbelievable great. > > > > Also the support there (thanks indiana ;) ) > > > > > > > > In WiQuery there are 'themes' and the location of the CSS and images > is > > > in > > > > a > > > > separate folder called 'resources' , which has the same structure as > of > > > the > > > > Java classes themselves. > > > > I wanted to do the same in my project without success. > > > > > > > > Should I configure something other than just put the same hierarchy? > > > > > > > > thanks for the help. > > > > > > > > My question is > > > > Eyal Golan > > > > egola...@gmail.com > > > > > > > > Visit: http://jvdrums.sourceforge.net/ > > > > LinkedIn: http://www.linkedin.com/in/egolan74 > > > > > > > > P Save a tree. Please don't print this e-mail unless it's really > > > necessary > > > > > > > > > >
Re: Repeating form on a page
The forms are all based on models. So, just make sure you use a different model for each form. I'd look into ListView, perhaps. On Fri, Apr 16, 2010 at 9:48 AM, David Hamilton wrote: > I am new to Wicket (and have had great help from this community so far - > thank you). My question here is that I'm trying to setup a simple > contact form where a person may have zero or more contacts. My solution > is to make the contact info a form within a panel. However, I need to > repeat the panel form on the page for each contact (represented by a > POJO I can bind to the form elements). I will provide and "add" button > at the bottom of the list to allow them to re-submit the page and add a > new empty object bound to a new form element. > > > > So my question is really two questions. > > > > 1) Is this best approach for this situation? > > 2) If it is, how do I bind each POJO on the list to a unique form > instance? > > > > The goal is to allow each contact to be individually edited and saved. > > > > Any help is greatly appreciated. > > > > Thanks, > > > > David Hamilton > > Web Coordinator > > (615) 843-3337 > > Hermitage Lighting Gallery > > www.hermitagelighting.com > > > > > > Keep it Green! To help protect the environment, please > only print this email if necessary. > Printing email can cost more than you think. > Learn more on our website: http://www.hermitagelighting.com/printing_email.php > > The information transmitted in this email is > intended solely for the individual or entity > to which it is addressed and may contain > confidential and/or privileged material. > Any review, retransmission, dissemination or > other use of or taking action in reliance > upon this information by persons or entities > other than the intended recipient is prohibited. > If you have received this email in error please > immediately notify us by reply email to the sender. > You must destroy the original material and its contents from any computer. > > > - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: AjaxSubmitLink javadocs
Every little bit helps - look how long it's been and nobody noticed it and brought it to our attention - but it could have thrown some people off. Thanks for the help! I'll commit a fix this weekend when I get a few free minutes. :) -- Jeremy Thomerson http://www.wickettraining.com On Fri, Apr 16, 2010 at 3:03 AM, Xavier López wrote: > Thanks for the answer, Jeremy. > > I just created issue https://issues.apache.org/jira/browse/WICKET-2837. > > I'm with you on what you state, it was obvious the only possible way to do > a > submit without JS is to have an html submit mechanism, anyway, I was just > being cautious in case I was missing something. > I'm just glad to contribute improving this great framework, even though > it's > on a lesser thing like this. > > Cheers, > Xavier > > > 2010/4/16 Jeremy Thomerson > > > This appears to be an issue in the documentation of the AjaxSubmitLink. > I > > just checked and the documentation is still the same in 1.4. I will try > to > > verify this and fix it tomorrow. In the meantime, it would be helpful if > > you opened a JIRA issue to keep track of this (post the link back to this > > thread). > > > > Anyway, the documentation is written as if this were a fallback component > > (i.e. AjaxFallbackLink). However, it is not. Obviously, if you do not > > have > > JS enabled, you can not submit a form with a link in the browser. You > > could > > only submit it with a submit button. > > > > -- > > Jeremy Thomerson > > http://www.wickettraining.com > > > > > > > > On Thu, Apr 15, 2010 at 4:12 AM, Xavier López > wrote: > > > > > Hi, > > > > > > I'm a liitle confused about AjaxSubmitLink's JavaDoc, and the code > inside > > > it... I'm using Wicket 1.3.6: > > > > > > If/when javascript is turned off in the browser, or it doesn't support > > > > javascript, then the > > > > browser will not respond to the onclick event, using the href > directly. > > > > Wicket will then use a > > > > normal request target, and call the serverside onClick with a null > > {...@link > > > > AjaxRequestTarget}. > > > > > > > > > > First question is, does it really mean 'serverside onClick' ? Or should > > it > > > read 'serverside onSubmit' ? > > > > > > And then, in the code, I see : > > > > > > protected void onComponentTag(ComponentTag tag) > > > > { > > > > super.onComponentTag(tag); > > > > > > > > if (isLinkEnabled()) > > > > { > > > > if (tag.getName().toLowerCase().equals("a")) > > > > { > > > > tag.put("href", "#"); > > > > } > > > > } > > > > else > > > > { > > > > disableLink(tag); > > > > } > > > > } > > > > > > > > > > So it seems this component never gets to have anything else than # in > its > > > href, so it won't do anything when js is not enabled... > > > > > > Is this an error in the documentation ? > > > > > > Thanks, > > > Xavier > > > > > > > > > -- > "Klein bottle for rent--inquire within." >
Repeating form on a page
I am new to Wicket (and have had great help from this community so far - thank you). My question here is that I'm trying to setup a simple contact form where a person may have zero or more contacts. My solution is to make the contact info a form within a panel. However, I need to repeat the panel form on the page for each contact (represented by a POJO I can bind to the form elements). I will provide and "add" button at the bottom of the list to allow them to re-submit the page and add a new empty object bound to a new form element. So my question is really two questions. 1) Is this best approach for this situation? 2) If it is, how do I bind each POJO on the list to a unique form instance? The goal is to allow each contact to be individually edited and saved. Any help is greatly appreciated. Thanks, David Hamilton Web Coordinator (615) 843-3337 Hermitage Lighting Gallery www.hermitagelighting.com Keep it Green! To help protect the environment, please only print this email if necessary. Printing email can cost more than you think. Learn more on our website: http://www.hermitagelighting.com/printing_email.php The information transmitted in this email is intended solely for the individual or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of or taking action in reliance upon this information by persons or entities other than the intended recipient is prohibited. If you have received this email in error please immediately notify us by reply email to the sender. You must destroy the original material and its contents from any computer.
New blog post "Components v.s. Pages"
Hi, I created a blog posted titled " Wicket best practices: Components v.s. Pages" http://blog.worldturner.com/worldturner/entry/wicket_best_practices_components_v We've been using wicket at my current location for quite a few projects now and I'm writing a few blog entries on the things that we've found most convenient. Regards, Erwin Bolwidt
Re: WicketRuntimeException: There is no application attached to current thread
Why not path the information you need to a runnable? and create a class you use as context to communicate WEB and thread layer... IMHO that will be a cleaner solution. Ernesto 2010/4/16 Martin Asenov > Should I pass the application's instance to the thread, which I can split > in a separate class? > > Best, > Martin > > > -Original Message- > From: ce...@jweekend.com [mailto:ce...@jweekend.com] On Behalf Of Cemal > Bayramoglu > Sent: Friday, April 16, 2010 4:09 PM > To: users > Subject: Re: WicketRuntimeException: There is no application attached to > current thread > > Component's getString method will try to get the laocalizer from the > Application, and the Application instance (singleton for a Wicket > web-app) is bound to the thread processing your request, not to the > one you have spawned off of it > > Regards - Cemal > jWeekend > OO & Java Technologies, Wicket > Consulting, Development, Training > http://jWeekend.com > . > > 2010/4/16 Martin Asenov : > > Hello guys! > > In a page, I have a button. The button starts a thread, just like this, > but I get the exception in the bottom. Here is some code: > > @Override > > protected void onSubmit(final AjaxRequestTarget target, Form > form) { > >final FileUpload fileUpload = fileUploadField.getFileUpload(); > >if (fileUpload != null) { > > > > final PhonebookImporter importer = new > PhonebookImporter(((AppSession) Session.get()).getManager()); > > > > logger.debug("User " + context.getEmail() > > + " uploaded an import file - " + > fileUpload.getClientFileName()); > > > > byte[] bytes = fileUpload.getBytes(); > > > > String uploadFolder; > > > > try { > >uploadFolder = System.getenv("CATALINA_HOME") > >+ props.get("uploadFolder"); > > } catch (SMSOfficeException e1) { > >logger.error("Could not resolve property!", e1); > >uploadFolder = > "/home/project/services/apache-tomcat-6.0.20/webapps/ROOT/temp/"; > > } > > > > User currentUser = ((AppSession) Session.get()).getContext() > > .getUser(); > > > > final File uploaded = new File(uploadFolder > > + String.valueOf(currentUser.getId()) + "/" + > fileUpload.getClientFileName()); > > > > uploaded.getParentFile().mkdirs(); > > > > try { > >FileOutputStream fos = new FileOutputStream(uploaded, false); > >fos.write(bytes); > >fos.close(); > >logger.info("File written on " + uploaded.getAbsolutePath()); > > } catch (IOException e) { > >logger.error("I/O Exception occurred!", e); > >return; > > } > > > > final ImportListener listener = new ImportListener() { > > > >public void info(String object, ImportMessage type) { > > textModel.append(getString(type.toString()) + object + > "\n"); > >} > > > > }; > > > > importer.setUser(((AppSession) > Session.get()).getContext().getUser()); > > importer.setDomain(((AppSession) Session.get()).getContext() > > .getDomain()); > > > > importer.addImportListener(listener); > > > > > > new Thread(new Runnable() { > > > >public void run() { > > > > try { > > > >boolean flag = importer.importContacts(uploaded, null); > > > >if (flag) { > > BulkImport.this.info > (BulkImport.this.getString("imported")); > > logger.debug("User " + context.getEmail() > > + " managed to import the contacts!"); > >} else { > > > BulkImport.this.error(BulkImport.this.getString("enc_error")); > > logger.error("User " + context.getEmail() > > + " did NOT manage to import the contacts!"); > >} > > } catch (Exception e) { > >logger.error("User " + context.getEmail() > >+ " did NOT manage to import the contacts!", e); > > > BulkImport.this.error(BulkImport.this.getString("not_imported")); > > } > > > > importer.removeImportListener(listener); > > target.addComponent(feed); > > > >} > > > > }).start(); > > > >} else { > > BulkImport.this.error(getString("no_uploaded_file")); > >} > > > > } > > And the exception: > > 16-04-2010 14:44:20,175 ERROR > com.company.project.ui.bulk.BulkImport$2$2.run:183 - User > mase...@velti.com did NOT manage to import the contacts! > > org.apache.wicket.WicketRuntimeException: There is no application > attached to current thread Thread-17 > >at org.apache.wicket.Application.get(Application.java:179) > >at > org.apache.wicket.Component.getApplication(Component.java:1323) > >at > org.apache.wicket.Component.getL
RE: WicketRuntimeException: There is no application attached to current thread
Should I pass the application's instance to the thread, which I can split in a separate class? Best, Martin -Original Message- From: ce...@jweekend.com [mailto:ce...@jweekend.com] On Behalf Of Cemal Bayramoglu Sent: Friday, April 16, 2010 4:09 PM To: users Subject: Re: WicketRuntimeException: There is no application attached to current thread Component's getString method will try to get the laocalizer from the Application, and the Application instance (singleton for a Wicket web-app) is bound to the thread processing your request, not to the one you have spawned off of it Regards - Cemal jWeekend OO & Java Technologies, Wicket Consulting, Development, Training http://jWeekend.com . 2010/4/16 Martin Asenov : > Hello guys! > In a page, I have a button. The button starts a thread, just like this, but I > get the exception in the bottom. Here is some code: > �...@override > protected void onSubmit(final AjaxRequestTarget target, Form form) { > final FileUpload fileUpload = fileUploadField.getFileUpload(); > if (fileUpload != null) { > > final PhonebookImporter importer = new > PhonebookImporter(((AppSession) Session.get()).getManager()); > > logger.debug("User " + context.getEmail() > + " uploaded an import file - " + > fileUpload.getClientFileName()); > > byte[] bytes = fileUpload.getBytes(); > > String uploadFolder; > > try { > uploadFolder = System.getenv("CATALINA_HOME") > + props.get("uploadFolder"); > } catch (SMSOfficeException e1) { > logger.error("Could not resolve property!", e1); > uploadFolder = > "/home/project/services/apache-tomcat-6.0.20/webapps/ROOT/temp/"; > } > > User currentUser = ((AppSession) Session.get()).getContext() > .getUser(); > > final File uploaded = new File(uploadFolder > + String.valueOf(currentUser.getId()) + "/" + > fileUpload.getClientFileName()); > > uploaded.getParentFile().mkdirs(); > > try { > FileOutputStream fos = new FileOutputStream(uploaded, false); > fos.write(bytes); > fos.close(); > logger.info("File written on " + uploaded.getAbsolutePath()); > } catch (IOException e) { > logger.error("I/O Exception occurred!", e); > return; > } > > final ImportListener listener = new ImportListener() { > > public void info(String object, ImportMessage type) { > textModel.append(getString(type.toString()) + object + "\n"); > } > > }; > > importer.setUser(((AppSession) > Session.get()).getContext().getUser()); > importer.setDomain(((AppSession) Session.get()).getContext() > .getDomain()); > > importer.addImportListener(listener); > > > new Thread(new Runnable() { > > public void run() { > > try { > > boolean flag = importer.importContacts(uploaded, null); > > if (flag) { > BulkImport.this.info(BulkImport.this.getString("imported")); > logger.debug("User " + context.getEmail() > + " managed to import the contacts!"); > } else { > > BulkImport.this.error(BulkImport.this.getString("enc_error")); > logger.error("User " + context.getEmail() > + " did NOT manage to import the contacts!"); > } > } catch (Exception e) { > logger.error("User " + context.getEmail() > + " did NOT manage to import the contacts!", e); > > BulkImport.this.error(BulkImport.this.getString("not_imported")); > } > > importer.removeImportListener(listener); > target.addComponent(feed); > > } > > }).start(); > > } else { > BulkImport.this.error(getString("no_uploaded_file")); > } > > } > And the exception: > 16-04-2010 14:44:20,175 ERROR > com.company.project.ui.bulk.BulkImport$2$2.run:183 - User mase...@velti.com > did NOT manage to import the contacts! > org.apache.wicket.WicketRuntimeException: There is no application attached > to current thread Thread-17 > at org.apache.wicket.Application.get(Application.java:179) > at org.apache.wicket.Component.getApplication(Component.java:1323) > at org.apache.wicket.Component.getLocalizer(Component.java:1436) > at org.apache.wicket.Component.getString(Component.java:1903) > at org.apache.wicket.Component.getString(Component.java:1890) > at com. > company.project.ui.bulk.BulkImport$2$1.info(BulkImport.java:153) > at com. > company.project.phonebook.bulk.PhonebookImporter.fireImportInfo(PhonebookImporter.java:76) > at com. > compan
RE: WicketRuntimeException: There is no application attached to current thread
I already saw one in javathoughts.com, but I don't see any major differences. Best, Martin -Original Message- From: Ernesto Reinaldo Barreiro [mailto:reier...@gmail.com] Sent: Friday, April 16, 2010 4:17 PM To: users@wicket.apache.org Subject: Re: WicketRuntimeException: There is no application attached to current thread If you need an example on how to do this I can point you to a somewhat similar example. Ernesto On Fri, Apr 16, 2010 at 3:15 PM, Ernesto Reinaldo Barreiro < reier...@gmail.com> wrote: > Do not use make references to components on the thread. Instead create an > instance of runnable to which you pass all the information you need and use > a kind of "context" to communicate with the Web layer if you need to pass > back information. > > Best, > > Ernesto > > > 2010/4/16 Martin Asenov > >> Hello guys! >> >> In a page, I have a button. The button starts a thread, just like this, >> but I get the exception in the bottom. Here is some code: >> @Override >> protected void onSubmit(final AjaxRequestTarget target, Form form) >> { >>final FileUpload fileUpload = fileUploadField.getFileUpload(); >>if (fileUpload != null) { >> >> final PhonebookImporter importer = new >> PhonebookImporter(((AppSession) Session.get()).getManager()); >> >> logger.debug("User " + context.getEmail() >> + " uploaded an import file - " + >> fileUpload.getClientFileName()); >> >> byte[] bytes = fileUpload.getBytes(); >> >> String uploadFolder; >> >> try { >>uploadFolder = System.getenv("CATALINA_HOME") >>+ props.get("uploadFolder"); >> } catch (SMSOfficeException e1) { >>logger.error("Could not resolve property!", e1); >>uploadFolder = >> "/home/project/services/apache-tomcat-6.0.20/webapps/ROOT/temp/"; >> } >> >> User currentUser = ((AppSession) Session.get()).getContext() >> .getUser(); >> >> final File uploaded = new File(uploadFolder >> + String.valueOf(currentUser.getId()) + "/" + >> fileUpload.getClientFileName()); >> >> uploaded.getParentFile().mkdirs(); >> >> try { >>FileOutputStream fos = new FileOutputStream(uploaded, false); >>fos.write(bytes); >>fos.close(); >>logger.info("File written on " + uploaded.getAbsolutePath()); >> } catch (IOException e) { >>logger.error("I/O Exception occurred!", e); >>return; >> } >> >> final ImportListener listener = new ImportListener() { >> >>public void info(String object, ImportMessage type) { >> textModel.append(getString(type.toString()) + object + "\n"); >>} >> >> }; >> >> importer.setUser(((AppSession) >> Session.get()).getContext().getUser()); >> importer.setDomain(((AppSession) Session.get()).getContext() >> .getDomain()); >> >> importer.addImportListener(listener); >> >> >> new Thread(new Runnable() { >> >>public void run() { >> >> try { >> >>boolean flag = importer.importContacts(uploaded, null); >> >>if (flag) { >> BulkImport.this.info >> (BulkImport.this.getString("imported")); >> logger.debug("User " + context.getEmail() >> + " managed to import the contacts!"); >>} else { >> >> BulkImport.this.error(BulkImport.this.getString("enc_error")); >> logger.error("User " + context.getEmail() >> + " did NOT manage to import the contacts!"); >>} >> } catch (Exception e) { >>logger.error("User " + context.getEmail() >>+ " did NOT manage to import the contacts!", e); >> >> BulkImport.this.error(BulkImport.this.getString("not_imported")); >> } >> >> importer.removeImportListener(listener); >> target.addComponent(feed); >> >>} >> >> }).start(); >> >>} else { >> BulkImport.this.error(getString("no_uploaded_file")); >>} >> >> } >> And the exception: >> 16-04-2010 14:44:20,175 ERROR >> com.company.project.ui.bulk.BulkImport$2$2.run:183 - User >> mase...@velti.com did NOT manage to import the contacts! >> org.apache.wicket.WicketRuntimeException: There is no application >> attached to current thread Thread-17 >>at org.apache.wicket.Application.get(Application.java:179) >>at >> org.apache.wicket.Component.getApplication(Component.java:1323) >>at >> org.apache.wicket.Component.getLocalizer(Component.java:1436) >>at org.apache.wicket.Component.getString(Component.java:1903) >>at org.apache.wicket.Component.getString(Component.java:1890) >>at com. company.project.ui.bulk.BulkImport
Re: WicketRuntimeException: There is no application attached to current thread
If you need an example on how to do this I can point you to a somewhat similar example. Ernesto On Fri, Apr 16, 2010 at 3:15 PM, Ernesto Reinaldo Barreiro < reier...@gmail.com> wrote: > Do not use make references to components on the thread. Instead create an > instance of runnable to which you pass all the information you need and use > a kind of "context" to communicate with the Web layer if you need to pass > back information. > > Best, > > Ernesto > > > 2010/4/16 Martin Asenov > >> Hello guys! >> >> In a page, I have a button. The button starts a thread, just like this, >> but I get the exception in the bottom. Here is some code: >> @Override >> protected void onSubmit(final AjaxRequestTarget target, Form form) >> { >>final FileUpload fileUpload = fileUploadField.getFileUpload(); >>if (fileUpload != null) { >> >> final PhonebookImporter importer = new >> PhonebookImporter(((AppSession) Session.get()).getManager()); >> >> logger.debug("User " + context.getEmail() >> + " uploaded an import file - " + >> fileUpload.getClientFileName()); >> >> byte[] bytes = fileUpload.getBytes(); >> >> String uploadFolder; >> >> try { >>uploadFolder = System.getenv("CATALINA_HOME") >>+ props.get("uploadFolder"); >> } catch (SMSOfficeException e1) { >>logger.error("Could not resolve property!", e1); >>uploadFolder = >> "/home/project/services/apache-tomcat-6.0.20/webapps/ROOT/temp/"; >> } >> >> User currentUser = ((AppSession) Session.get()).getContext() >> .getUser(); >> >> final File uploaded = new File(uploadFolder >> + String.valueOf(currentUser.getId()) + "/" + >> fileUpload.getClientFileName()); >> >> uploaded.getParentFile().mkdirs(); >> >> try { >>FileOutputStream fos = new FileOutputStream(uploaded, false); >>fos.write(bytes); >>fos.close(); >>logger.info("File written on " + uploaded.getAbsolutePath()); >> } catch (IOException e) { >>logger.error("I/O Exception occurred!", e); >>return; >> } >> >> final ImportListener listener = new ImportListener() { >> >>public void info(String object, ImportMessage type) { >> textModel.append(getString(type.toString()) + object + "\n"); >>} >> >> }; >> >> importer.setUser(((AppSession) >> Session.get()).getContext().getUser()); >> importer.setDomain(((AppSession) Session.get()).getContext() >> .getDomain()); >> >> importer.addImportListener(listener); >> >> >> new Thread(new Runnable() { >> >>public void run() { >> >> try { >> >>boolean flag = importer.importContacts(uploaded, null); >> >>if (flag) { >> BulkImport.this.info >> (BulkImport.this.getString("imported")); >> logger.debug("User " + context.getEmail() >> + " managed to import the contacts!"); >>} else { >> >> BulkImport.this.error(BulkImport.this.getString("enc_error")); >> logger.error("User " + context.getEmail() >> + " did NOT manage to import the contacts!"); >>} >> } catch (Exception e) { >>logger.error("User " + context.getEmail() >>+ " did NOT manage to import the contacts!", e); >> >> BulkImport.this.error(BulkImport.this.getString("not_imported")); >> } >> >> importer.removeImportListener(listener); >> target.addComponent(feed); >> >>} >> >> }).start(); >> >>} else { >> BulkImport.this.error(getString("no_uploaded_file")); >>} >> >> } >> And the exception: >> 16-04-2010 14:44:20,175 ERROR >> com.company.project.ui.bulk.BulkImport$2$2.run:183 - User >> mase...@velti.com did NOT manage to import the contacts! >> org.apache.wicket.WicketRuntimeException: There is no application >> attached to current thread Thread-17 >>at org.apache.wicket.Application.get(Application.java:179) >>at >> org.apache.wicket.Component.getApplication(Component.java:1323) >>at >> org.apache.wicket.Component.getLocalizer(Component.java:1436) >>at org.apache.wicket.Component.getString(Component.java:1903) >>at org.apache.wicket.Component.getString(Component.java:1890) >>at com. company.project.ui.bulk.BulkImport$2$1.info >> (BulkImport.java:153) >>at com. >> company.project.phonebook.bulk.PhonebookImporter.fireImportInfo(PhonebookImporter.java:76) >>at com. >> company.project.core.ManagerBean.saveContacts(ManagerBean.java:212) >>at com. >> company.project.core.ManagerBean$$FastClassByCGLIB$$a2c3fbf0.invoke(
Re: WicketRuntimeException: There is no application attached to current thread
Do not use make references to components on the thread. Instead create an instance of runnable to which you pass all the information you need and use a kind of "context" to communicate with the Web layer if you need to pass back information. Best, Ernesto 2010/4/16 Martin Asenov > Hello guys! > In a page, I have a button. The button starts a thread, just like this, but > I get the exception in the bottom. Here is some code: > @Override > protected void onSubmit(final AjaxRequestTarget target, Form form) > { >final FileUpload fileUpload = fileUploadField.getFileUpload(); >if (fileUpload != null) { > > final PhonebookImporter importer = new > PhonebookImporter(((AppSession) Session.get()).getManager()); > > logger.debug("User " + context.getEmail() > + " uploaded an import file - " + > fileUpload.getClientFileName()); > > byte[] bytes = fileUpload.getBytes(); > > String uploadFolder; > > try { >uploadFolder = System.getenv("CATALINA_HOME") >+ props.get("uploadFolder"); > } catch (SMSOfficeException e1) { >logger.error("Could not resolve property!", e1); >uploadFolder = > "/home/project/services/apache-tomcat-6.0.20/webapps/ROOT/temp/"; > } > > User currentUser = ((AppSession) Session.get()).getContext() > .getUser(); > > final File uploaded = new File(uploadFolder > + String.valueOf(currentUser.getId()) + "/" + > fileUpload.getClientFileName()); > > uploaded.getParentFile().mkdirs(); > > try { >FileOutputStream fos = new FileOutputStream(uploaded, false); >fos.write(bytes); >fos.close(); >logger.info("File written on " + uploaded.getAbsolutePath()); > } catch (IOException e) { >logger.error("I/O Exception occurred!", e); >return; > } > > final ImportListener listener = new ImportListener() { > >public void info(String object, ImportMessage type) { > textModel.append(getString(type.toString()) + object + "\n"); >} > > }; > > importer.setUser(((AppSession) > Session.get()).getContext().getUser()); > importer.setDomain(((AppSession) Session.get()).getContext() > .getDomain()); > > importer.addImportListener(listener); > > > new Thread(new Runnable() { > >public void run() { > > try { > >boolean flag = importer.importContacts(uploaded, null); > >if (flag) { > BulkImport.this.info > (BulkImport.this.getString("imported")); > logger.debug("User " + context.getEmail() > + " managed to import the contacts!"); >} else { > > BulkImport.this.error(BulkImport.this.getString("enc_error")); > logger.error("User " + context.getEmail() > + " did NOT manage to import the contacts!"); >} > } catch (Exception e) { >logger.error("User " + context.getEmail() >+ " did NOT manage to import the contacts!", e); > > BulkImport.this.error(BulkImport.this.getString("not_imported")); > } > > importer.removeImportListener(listener); > target.addComponent(feed); > >} > > }).start(); > >} else { > BulkImport.this.error(getString("no_uploaded_file")); >} > > } > And the exception: > 16-04-2010 14:44:20,175 ERROR > com.company.project.ui.bulk.BulkImport$2$2.run:183 - User > mase...@velti.com did NOT manage to import the contacts! > org.apache.wicket.WicketRuntimeException: There is no application > attached to current thread Thread-17 >at org.apache.wicket.Application.get(Application.java:179) >at > org.apache.wicket.Component.getApplication(Component.java:1323) >at org.apache.wicket.Component.getLocalizer(Component.java:1436) >at org.apache.wicket.Component.getString(Component.java:1903) >at org.apache.wicket.Component.getString(Component.java:1890) >at com. company.project.ui.bulk.BulkImport$2$1.info > (BulkImport.java:153) >at com. > company.project.phonebook.bulk.PhonebookImporter.fireImportInfo(PhonebookImporter.java:76) >at com. > company.project.core.ManagerBean.saveContacts(ManagerBean.java:212) >at com. > company.project.core.ManagerBean$$FastClassByCGLIB$$a2c3fbf0.invoke() >at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:191) >at > org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:692) >at > org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150) >
Re: WicketRuntimeException: There is no application attached to current thread
Component's getString method will try to get the laocalizer from the Application, and the Application instance (singleton for a Wicket web-app) is bound to the thread processing your request, not to the one you have spawned off of it Regards - Cemal jWeekend OO & Java Technologies, Wicket Consulting, Development, Training http://jWeekend.com . 2010/4/16 Martin Asenov : > Hello guys! > In a page, I have a button. The button starts a thread, just like this, but I > get the exception in the bottom. Here is some code: > �...@override > protected void onSubmit(final AjaxRequestTarget target, Form form) { > final FileUpload fileUpload = fileUploadField.getFileUpload(); > if (fileUpload != null) { > > final PhonebookImporter importer = new > PhonebookImporter(((AppSession) Session.get()).getManager()); > > logger.debug("User " + context.getEmail() > + " uploaded an import file - " + > fileUpload.getClientFileName()); > > byte[] bytes = fileUpload.getBytes(); > > String uploadFolder; > > try { > uploadFolder = System.getenv("CATALINA_HOME") > + props.get("uploadFolder"); > } catch (SMSOfficeException e1) { > logger.error("Could not resolve property!", e1); > uploadFolder = > "/home/project/services/apache-tomcat-6.0.20/webapps/ROOT/temp/"; > } > > User currentUser = ((AppSession) Session.get()).getContext() > .getUser(); > > final File uploaded = new File(uploadFolder > + String.valueOf(currentUser.getId()) + "/" + > fileUpload.getClientFileName()); > > uploaded.getParentFile().mkdirs(); > > try { > FileOutputStream fos = new FileOutputStream(uploaded, false); > fos.write(bytes); > fos.close(); > logger.info("File written on " + uploaded.getAbsolutePath()); > } catch (IOException e) { > logger.error("I/O Exception occurred!", e); > return; > } > > final ImportListener listener = new ImportListener() { > > public void info(String object, ImportMessage type) { > textModel.append(getString(type.toString()) + object + "\n"); > } > > }; > > importer.setUser(((AppSession) > Session.get()).getContext().getUser()); > importer.setDomain(((AppSession) Session.get()).getContext() > .getDomain()); > > importer.addImportListener(listener); > > > new Thread(new Runnable() { > > public void run() { > > try { > > boolean flag = importer.importContacts(uploaded, null); > > if (flag) { > BulkImport.this.info(BulkImport.this.getString("imported")); > logger.debug("User " + context.getEmail() > + " managed to import the contacts!"); > } else { > > BulkImport.this.error(BulkImport.this.getString("enc_error")); > logger.error("User " + context.getEmail() > + " did NOT manage to import the contacts!"); > } > } catch (Exception e) { > logger.error("User " + context.getEmail() > + " did NOT manage to import the contacts!", e); > > BulkImport.this.error(BulkImport.this.getString("not_imported")); > } > > importer.removeImportListener(listener); > target.addComponent(feed); > > } > > }).start(); > > } else { > BulkImport.this.error(getString("no_uploaded_file")); > } > > } > And the exception: > 16-04-2010 14:44:20,175 ERROR > com.company.project.ui.bulk.BulkImport$2$2.run:183 - User mase...@velti.com > did NOT manage to import the contacts! > org.apache.wicket.WicketRuntimeException: There is no application attached > to current thread Thread-17 > at org.apache.wicket.Application.get(Application.java:179) > at org.apache.wicket.Component.getApplication(Component.java:1323) > at org.apache.wicket.Component.getLocalizer(Component.java:1436) > at org.apache.wicket.Component.getString(Component.java:1903) > at org.apache.wicket.Component.getString(Component.java:1890) > at com. > company.project.ui.bulk.BulkImport$2$1.info(BulkImport.java:153) > at com. > company.project.phonebook.bulk.PhonebookImporter.fireImportInfo(PhonebookImporter.java:76) > at com. > company.project.core.ManagerBean.saveContacts(ManagerBean.java:212) > at com. > company.project.core.ManagerBean$$FastClassByCGLIB$$a2c3fbf0.invoke() > at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:191) > at > org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:69
WicketRuntimeException: There is no application attached to current thread
Hello guys! In a page, I have a button. The button starts a thread, just like this, but I get the exception in the bottom. Here is some code: @Override protected void onSubmit(final AjaxRequestTarget target, Form form) { final FileUpload fileUpload = fileUploadField.getFileUpload(); if (fileUpload != null) { final PhonebookImporter importer = new PhonebookImporter(((AppSession) Session.get()).getManager()); logger.debug("User " + context.getEmail() + " uploaded an import file - " + fileUpload.getClientFileName()); byte[] bytes = fileUpload.getBytes(); String uploadFolder; try { uploadFolder = System.getenv("CATALINA_HOME") + props.get("uploadFolder"); } catch (SMSOfficeException e1) { logger.error("Could not resolve property!", e1); uploadFolder = "/home/project/services/apache-tomcat-6.0.20/webapps/ROOT/temp/"; } User currentUser = ((AppSession) Session.get()).getContext() .getUser(); final File uploaded = new File(uploadFolder + String.valueOf(currentUser.getId()) + "/" + fileUpload.getClientFileName()); uploaded.getParentFile().mkdirs(); try { FileOutputStream fos = new FileOutputStream(uploaded, false); fos.write(bytes); fos.close(); logger.info("File written on " + uploaded.getAbsolutePath()); } catch (IOException e) { logger.error("I/O Exception occurred!", e); return; } final ImportListener listener = new ImportListener() { public void info(String object, ImportMessage type) { textModel.append(getString(type.toString()) + object + "\n"); } }; importer.setUser(((AppSession) Session.get()).getContext().getUser()); importer.setDomain(((AppSession) Session.get()).getContext() .getDomain()); importer.addImportListener(listener); new Thread(new Runnable() { public void run() { try { boolean flag = importer.importContacts(uploaded, null); if (flag) { BulkImport.this.info(BulkImport.this.getString("imported")); logger.debug("User " + context.getEmail() + " managed to import the contacts!"); } else { BulkImport.this.error(BulkImport.this.getString("enc_error")); logger.error("User " + context.getEmail() + " did NOT manage to import the contacts!"); } } catch (Exception e) { logger.error("User " + context.getEmail() + " did NOT manage to import the contacts!", e); BulkImport.this.error(BulkImport.this.getString("not_imported")); } importer.removeImportListener(listener); target.addComponent(feed); } }).start(); } else { BulkImport.this.error(getString("no_uploaded_file")); } } And the exception: 16-04-2010 14:44:20,175 ERROR com.company.project.ui.bulk.BulkImport$2$2.run:183 - User mase...@velti.com did NOT manage to import the contacts! org.apache.wicket.WicketRuntimeException: There is no application attached to current thread Thread-17 at org.apache.wicket.Application.get(Application.java:179) at org.apache.wicket.Component.getApplication(Component.java:1323) at org.apache.wicket.Component.getLocalizer(Component.java:1436) at org.apache.wicket.Component.getString(Component.java:1903) at org.apache.wicket.Component.getString(Component.java:1890) at com. company.project.ui.bulk.BulkImport$2$1.info(BulkImport.java:153) at com. company.project.phonebook.bulk.PhonebookImporter.fireImportInfo(PhonebookImporter.java:76) at com. company.project.core.ManagerBean.saveContacts(ManagerBean.java:212) at com. company.project.core.ManagerBean$$FastClassByCGLIB$$a2c3fbf0.invoke() at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:191) at org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:692) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106) at org.springfra
set focus on a field when opening a ModalWindow
Hello, Sorry to come back with this item, but I can't figure out how to set focus on a form element when opening a ModalWindow (iframe version). I tried to use target.focusComponent() within the calling page, but as components are created inside the called page, I can't have the right focusComponent() parameter. I also tried the FocusBehavior() class found on the wiki, but it works only for regular forms, not Ajax. I finally tried some javascript stuff within my called html page (something like frames[0].document.forms[0].elements[1].focus();), but this don't work bacause the iframe is not ready when my javascript is called. Does somebody knows how to set focus on my first form field in my modal window ? Best regards, Bernard -- View this message in context: http://n4.nabble.com/set-focus-on-a-field-when-opening-a-ModalWindow-tp1989918p1989918.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: Type Inference for Wicket 1.4
Or use wicket as I explained on this page :) http://java.dzone.com/articles/faster-development-easywicket From: James Carman To: users@wicket.apache.org Sent: Fri, April 16, 2010 2:05:12 PM Subject: Re: Type Inference for Wicket 1.4 And, nothing is stopping you from doing something like this in your own code. I have a class called ComponentUtils where I put stuff like this. I have two methods: public static IModel modelOf(T bean); public static IModel modelFor(Class beanClass); // This will instantiate the object for you. I also have: public static void detachAllModelFields(Component c); With static imports, you can just use these methods like they're in your classes. On Fri, Apr 16, 2010 at 1:21 AM, Jeremy Thomerson wrote: > This is the key - and it has been discussed before (in the many grueling 1.4 > conversations). The short of it is that with private constructors there's a > huge change and an inability to extend. And without the private > constructors, the static methods are dumb and extraneous because you would > need hundreds of them, and you would need even more of them on your extended > model and component classes. > > -- > Jeremy Thomerson > http://www.wickettraining.com > > > > On Thu, Apr 15, 2010 at 8:51 AM, Thomas Kappler > wrote: > >> On 04/15/10 13:06, James Perry wrote: >> >>> I can sympathise with that. However I don't think it would be a >>> maintenance nightmare if the constructors are set to private; but that >>> would mean a dramatic API change for such convenience and I'm guessing >>> you're not willing to do this. >>> >> >> Apart from the huge change for questionable benefit, that would also remove >> inheritance, which is essential to the Wicket way, because you can't extend >> a class with private constructors only. If you can, get a hold of Bloch, >> Effective Java, and read the insightful chapter on the constructor vs. >> static factory method trade-off. >> >> -- Thomas >> >> >> >> >>> Best, >>> James. >>> >>> On 14 April 2010 17:01, Igor Vaynberg wrote: >>> you are going to have one factory method for each constructor, its going to be a pita to maintain. not something we will want in core. -igor On Wed, Apr 14, 2010 at 8:51 AM, James Perry wrote: > I am looking to migrate from Wicket 1.3 and Wicket 1.4 and I really > like the type-safe goodies but I do not like its verbosity. I was > thinking of writing a patch that provides factories to improve the > brevity by type inference of the generic invariant. > > This is an example of my idea: > > Model model = Model.newModel(); > > public static Model newModel() { >return new Model(); > } > > Feedback welcomed. :-) > > -- > Best, > James. > > - > 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 >>> >>> >> >> -- >> --- >> Thomas Kapplerthomas.kapp...@isb-sib.ch >> Swiss Institute of Bioinformatics Tel: +41 22 379 51 89 >> CMU, rue Michel Servet 1 >> 1211 Geneve 4 >> Switzerland http://www.uniprot.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
Bug in Page refresh?
We have a DropDownChoice to change the language of a page (the language in mapped through an enum). The handler to change the code is as follows. @Override protected void onSubmit(AjaxRequestTarget target) { getSession().setLocale(getLanguage().getObject().getLocale()); setResponsePage(getPage()); } We just have 3 pages and a login page. The code works on 2 of 3 pages but I don't know why it doesn't work on the third page (the code to find the language and to get the current page seems also to be correct and working). My question is does anybody have some hints what I could do wrong? Regards, Wolfgang - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Type Inference for Wicket 1.4
And, nothing is stopping you from doing something like this in your own code. I have a class called ComponentUtils where I put stuff like this. I have two methods: public static IModel modelOf(T bean); public static IModel modelFor(Class beanClass); // This will instantiate the object for you. I also have: public static void detachAllModelFields(Component c); With static imports, you can just use these methods like they're in your classes. On Fri, Apr 16, 2010 at 1:21 AM, Jeremy Thomerson wrote: > This is the key - and it has been discussed before (in the many grueling 1.4 > conversations). The short of it is that with private constructors there's a > huge change and an inability to extend. And without the private > constructors, the static methods are dumb and extraneous because you would > need hundreds of them, and you would need even more of them on your extended > model and component classes. > > -- > Jeremy Thomerson > http://www.wickettraining.com > > > > On Thu, Apr 15, 2010 at 8:51 AM, Thomas Kappler > wrote: > >> On 04/15/10 13:06, James Perry wrote: >> >>> I can sympathise with that. However I don't think it would be a >>> maintenance nightmare if the constructors are set to private; but that >>> would mean a dramatic API change for such convenience and I'm guessing >>> you're not willing to do this. >>> >> >> Apart from the huge change for questionable benefit, that would also remove >> inheritance, which is essential to the Wicket way, because you can't extend >> a class with private constructors only. If you can, get a hold of Bloch, >> Effective Java, and read the insightful chapter on the constructor vs. >> static factory method trade-off. >> >> -- Thomas >> >> >> >> >>> Best, >>> James. >>> >>> On 14 April 2010 17:01, Igor Vaynberg wrote: >>> you are going to have one factory method for each constructor, its going to be a pita to maintain. not something we will want in core. -igor On Wed, Apr 14, 2010 at 8:51 AM, James Perry wrote: > I am looking to migrate from Wicket 1.3 and Wicket 1.4 and I really > like the type-safe goodies but I do not like its verbosity. I was > thinking of writing a patch that provides factories to improve the > brevity by type inference of the generic invariant. > > This is an example of my idea: > > Model model = Model.newModel(); > > public static Model newModel() { > return new Model(); > } > > Feedback welcomed. :-) > > -- > Best, > James. > > - > 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 >>> >>> >> >> -- >> --- >> Thomas Kappler thomas.kapp...@isb-sib.ch >> Swiss Institute of Bioinformatics Tel: +41 22 379 51 89 >> CMU, rue Michel Servet 1 >> 1211 Geneve 4 >> Switzerland http://www.uniprot.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
Detect bookmark access to nonbookmarkablepages
Hi there, I'm trying to find an elegant way to detect the cases where a user tries to access a nonbookmarkablepage with a bookmark. From the stack trace produced in this case, I see this situation is handled in DefaultPageFactory#newPage(Class pageClass), like this: catch (NoSuchMethodException e) { // a bit of a hack here.. Constructor constructor = constructor(pageClass, PageParameters.class); if (constructor != null) { return newPage(constructor, new PageParameters()); } else { throw new WicketRuntimeException("Unable to create page from " + pageClass + ". Class does not have a default contructor", e); } } I would like to present a custom page explaining the circumstances with a nice link to the starting place where to navigate from. I don't really like treating this situation as a WicketRuntimeException and have it bubbling up to an internalerrorpage, because of the little information on the exception thrown (i don't like identifying it by its text, or nested exception type). Unfortunately, DefaultPageFactory#newPage(Class pageClass) is final, so this behavior can not be overriden. Is providing a custom implementation of IPageFactory the best approach to this issue ? Any other way around ? Cheers, Xavier
Re: AjaxSubmitLink javadocs
Thanks for the answer, Jeremy. I just created issue https://issues.apache.org/jira/browse/WICKET-2837. I'm with you on what you state, it was obvious the only possible way to do a submit without JS is to have an html submit mechanism, anyway, I was just being cautious in case I was missing something. I'm just glad to contribute improving this great framework, even though it's on a lesser thing like this. Cheers, Xavier 2010/4/16 Jeremy Thomerson > This appears to be an issue in the documentation of the AjaxSubmitLink. I > just checked and the documentation is still the same in 1.4. I will try to > verify this and fix it tomorrow. In the meantime, it would be helpful if > you opened a JIRA issue to keep track of this (post the link back to this > thread). > > Anyway, the documentation is written as if this were a fallback component > (i.e. AjaxFallbackLink). However, it is not. Obviously, if you do not > have > JS enabled, you can not submit a form with a link in the browser. You > could > only submit it with a submit button. > > -- > Jeremy Thomerson > http://www.wickettraining.com > > > > On Thu, Apr 15, 2010 at 4:12 AM, Xavier López wrote: > > > Hi, > > > > I'm a liitle confused about AjaxSubmitLink's JavaDoc, and the code inside > > it... I'm using Wicket 1.3.6: > > > > If/when javascript is turned off in the browser, or it doesn't support > > > javascript, then the > > > browser will not respond to the onclick event, using the href directly. > > > Wicket will then use a > > > normal request target, and call the serverside onClick with a null > {...@link > > > AjaxRequestTarget}. > > > > > > > First question is, does it really mean 'serverside onClick' ? Or should > it > > read 'serverside onSubmit' ? > > > > And then, in the code, I see : > > > > protected void onComponentTag(ComponentTag tag) > > > { > > > super.onComponentTag(tag); > > > > > > if (isLinkEnabled()) > > > { > > > if (tag.getName().toLowerCase().equals("a")) > > > { > > > tag.put("href", "#"); > > > } > > > } > > > else > > > { > > > disableLink(tag); > > > } > > > } > > > > > > > So it seems this component never gets to have anything else than # in its > > href, so it won't do anything when js is not enabled... > > > > Is this an error in the documentation ? > > > > Thanks, > > Xavier > > > -- "Klein bottle for rent--inquire within."
Failing to remove item from list when drag and dropping
Hi, I have a use case that reads as follows: I need two lists next to each other. When starting up the left list is empty and I add items to it by dragging them from the right list and dropping them on the left. These items should be copied, (i.e. _not_ moved, the right list should be static) from the right list into the selected position in the left list. It should also be possible to reorder the items in the left list using drag and drop. The last thing is that you should be able to remove items from the left list by dragging and dropping them back to the right list. Since the right list is "static" the item should _not_ be added to the right list but rather just removed from the left list. After some investigation I've settled on using the YuiDDListView (from the wicket-yui project) which extends from a standard Wicket ListView. I've chosen this component since it supports positioning items in the list (i.e. you know to which index you dropped the item in the list). After MUCH hacking around I've managed to get most things working. There are mainly two things left and here I would really appreciate some help: 1) I cannot seem to remove _the last_ item in the left list (i.e. by drag and dropping to the right list). It works fine for all other items but for the last item it fails saying e.g.: Caused by: org.apache.wicket.WicketRuntimeException: component tabs:panel:panel:list:items:0 not found on page com.mycompany.MyPageCompany[id = 4], listener interface = [RequestListenerInterface name=IBehaviorListener, method=public abstract void org.apache.wicket.behavior.IBehaviorListener.onRequest()] at org.apache.wicket.request.AbstractRequestCycleProcessor.resolveListenerInterfaceTarget(AbstractRequestCycleProcessor.java:426) at org.apache.wicket.request.AbstractRequestCycleProcessor.resolveRenderedPage(AbstractRequestCycleProcessor.java:471) at org.apache.wicket.protocol.http.WebRequestCycleProcessor.resolve(WebRequestCycleProcessor.java:144) ... 28 more What causes this is that in the onDrop method in the left list I remove the dropped item from the list if it's dropped on the right list. Why is this happening? What's the best way to resolve it? 2) When I drag and item from the left to the right it looks like the item is added to the right list until I reload the page. I figure could be a javascript error since the javascript doesn't understand that the item shouldn't be added to the right list at all (it should instead be removed from the left list). What would be the best way to resolve this? I'm using Wicket 1.4.1. /Johan -- View this message in context: http://n4.nabble.com/Failing-to-remove-item-from-list-when-drag-and-dropping-tp1960968p1960968.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