Re: editing response in onComponentTag
Thanks so much for your reply. I tried to do it as following. But could not make it work. Obviously I have no idea what I am doing. I would appreciate very much if you will help me out here. Thanks. private static class RequiredLabel extends SimpleFormComponentLabel { private static final long serialVersionUID = 5132250047993256659L; //private boolean required; FormComponent fc; Behavior behaviour; boolean behaviourAdded; public RequiredLabel(String id, FormComponent fc) { super(id, fc); //this.required = fc.isRequired(); this.fc = fc; behaviour = new Behavior() { public void onBeforeRender() { getResponse().write(*); // Can't remove the previously added red asterisk } public void beforeRender() { getResponse().write(*); // does not add anything. } }; } /* @Override protected void onComponentTag(ComponentTag tag) { super.onComponentTag(tag); if (fc.isRequired()) { getResponse().write(*); } }*/ @Override protected void onBeforeRender() { super.onBeforeRender(); if (fc.isRequired()) { if (!behaviourAdded) { add(behaviour); behaviourAdded = true; } } else { if (behaviourAdded) { remove(behaviour); behaviourAdded = false; } } } } -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/editing-response-in-onComponentTag-tp4671062p4671076.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
editing response in onComponentTag
Please see the following code: private static class RequiredLabel extends SimpleFormComponentLabel { private static final long serialVersionUID = 5132250047993256659L; //private boolean required; FormComponent fc; public RequiredLabel(String id, FormComponent fc) { super(id, fc); //this.required = fc.isRequired(); this.fc = fc; } @Override protected void onComponentTag(ComponentTag tag) { super.onComponentTag(tag); if (fc.isRequired()) { getResponse().write(*); } else { // ?? how do I remove the previously placed * } } } RequiredLabel is a label that is used with a FormComponent. It is used to put the red asterisk to show that input to the field is required. But what happens is that on an ajax request the red asterisks keep on piling up. And I have a case where the field may be changed to be not required. How do I remove the previosly placed red asterisk? Thanks. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/editing-response-in-onComponentTag-tp4671062.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Handling page refresh or redirect when the server reboots
myproject.zip http://apache-wicket.1842946.n4.nabble.com/file/n4668210/myproject.zip I finally got it working. And just in case some one needs to do something similar I am attaching the proof of concept project. Any feedback would be highly appreciated. Thanks to Sebastian and Martin for their inputs. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Handling-page-refresh-or-redirect-when-the-server-reboots-tp4667465p4668210.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: IndicatorAware and BookmarkablePageLink
Hi Martin Thanks for your response. And yes this explains the behavior I have seen. Any way the busy indicator can be shown during the entire page unloading and unloading process? Thanks. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/IndicatorAware-and-BookmarkablePageLink-tp4668056p4668082.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
IndicatorAware and BookmarkablePageLink
Hi, We use SuckerfishMenuPanel for our menus and in it the links use BookmarkablePageLinks. I need to make make some of the links (menu items) IndicatorAware, i.e., show the whirling wheel, when clicked. I tried some thing like following: private class LinkIndicatingAwareBehaviour extends AjaxEventBehavior implements IAjaxIndicatorAware { AjaxIndicatorAppender indicator; public LinkIndicatingAwareBehaviour( String event, Link link) { super(event); this.indicator = new AjaxIndicatorAppender(); link.add(indicator); } @Override public String getAjaxIndicatorMarkupId() { return indicator.getMarkupId(); } @Override protected void onEvent(AjaxRequestTarget target) { // please see BookmarkablePageLink.onClick() } } This shows the busy indicator for a very short while and does not cover the time when the page is getting ready to be shown. So basically of no use. can some one please suggest something? Thanks. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/IndicatorAware-and-BookmarkablePageLink-tp4668056.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Handling page refresh or redirect when the server reboots
Sebastian, thanks for your response and idea. Taking your idea myproject.zip http://apache-wicket.1842946.n4.nabble.com/file/n4667990/myproject.zip I am trying to use the following javascript code in wicket: Http.Get = function(theUrl) { var xmlHttp = null; try { xmlHttp = new XMLHttpRequest(); return xmlHttp.open(GET, theUrl, true ); xmlHttp.send(); return xmlHttp.statusText; //return xmlHttp.responseText; } catch (error) { return 'error in my code: ' + error; } } The above code is called via: add(new AjaxLink(link) { @Override public void onClick(AjaxRequestTarget target) { target.add(testLabel); } @Override protected IAjaxCallDecorator getAjaxCallDecorator() { return new IAjaxCallDecorator() { private static final long serialVersionUID = 1L; public CharSequence decorateScript( Component component, CharSequence script) { return document.getElementById('testlabel').innerHTML = 'plain ' + Http.Get('http://www.cnn.com') ; + script; } public CharSequence decorateOnSuccessScript( Component component, CharSequence script) { return document.getElementById('testlabel').innerHTML = 'on success ' + Http.Get('http://www.cnn.com') ; + script; } public CharSequence decorateOnFailureScript( Component component, CharSequence script) { return document.getElementById('testlabel').innerHTML = 'on Failure ' + Http.Get('http://www.cnn.com') ; + script; } }; } }); The problem is that when I use it in wicket the xmlHttp.statusText or xmlHttp.responseText returns nothing. Can any one please tell me what I might be doing wrong? Does the code or calling it even makes sense? I am attaching quickstart project. Please see: com.mytest.javascript.* Thanks. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Handling-page-refresh-or-redirect-when-the-server-reboots-tp4667465p4667990.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: FormValidators and messages property file
Hi Martin, Thanks for your help. That worked but I had to do a few extra things such as setting the values for '${label0}', etc. What I don't get is why do we need to do this extra thing for Form validation classes (extending AbstractFormValidator) but not for component validation classes (implementing IValidator). For others who may face the same problem, this is how got it working: @Override public void validate(Form? form) { Date fromDate = fromDateFormComponent.getConvertedInput(); Date toDate = toDateFormComponent.getConvertedInput(); if (fromDate != null toDate != null fromDate.after(toDate)) { ClassStringResourceLoader loader = new ClassStringResourceLoader(FromDateBeforeToDate.class); Application.get().getResourceSettings().getStringResourceLoaders().add(loader); ValidationError error = new ValidationError(); error.addMessageKey(getClass().getSimpleName() + . + fromDateAfterToDate); error.setVariable(label0, fromDateFormComponent.getLabel().getObject()); error.setVariable(label1, toDateFormComponent.getLabel().getObject()); fromDateFormComponent.newValidatable().error(error); } } FromDateBeforeToDate.properties FromDateBeforeToDate.fromDateAfterToDate=Invalid input: The '${label}' date is after the '${label}' date I thank you again for teh quick and helpful response. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/FormValidators-and-messages-property-file-tp4667767p4667783.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: FormValidators and messages property file
Well, I wanted these to be independent validation classes. But now it seems like a bad idea. I will make them part of the form. Martin, your comments and help are much appreciated. Thanks. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/FormValidators-and-messages-property-file-tp4667767p4667790.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
FormValidators and messages property file
Hi, I have created form validator classes as shown below. The problem is that the code is not picking up messages from the corresponding 'FromDateBeforeToDate.properties' file in the same package. It works if the messages are in the page.properties or application.properties file. I can see works OK for class implementing IValidator but can't seem to make it work for class extending AbstractFormValidator.Are my expectations wrong? If not then please tell me how I can fix the code. public class FromDateBeforeToDate extends AbstractFormValidator { /** * */ private static final long serialVersionUID = 3503966266288025266L; DateField fromDateFormComponent; DateField toDateFormComponent; public FromDateBeforeToDate( DateField fromDateFormComponent, DateField toDateFormComponent) { if (fromDateFormComponent == null) { throw new IllegalArgumentException(Argument dateFromFormComponent cannot be null); } this.fromDateFormComponent = fromDateFormComponent; if (toDateFormComponent == null) { throw new IllegalArgumentException(Argument dateToFormComponent cannot be null); } this.toDateFormComponent = toDateFormComponent; } @Override public FormComponent?[] getDependentFormComponents() { return new FormComponent?[] { fromDateFormComponent, toDateFormComponent, }; } @Override public void validate(Form? form) { Date fromDate = fromDateFormComponent.getConvertedInput(); Date toDate = toDateFormComponent.getConvertedInput(); if (fromDate != null toDate != null fromDate.after(toDate)) { //error(fromDateFormComponent, fromDateAfterToDate); ValidationError error = new ValidationError(); error.addMessageKey(getClass().getSimpleName() + . + fromDateAfterToDate); fromDateFormComponent.newValidatable().error(error); //this.error(fromDateFormComponent); } } } FromDateBeforeToDate.properties #fromDateAfterToDate=Invalid input: The '${label}' date is after the '${label}' date FromDateBeforeToDate.fromDateAfterToDate=Invalid input: The '${label}' date is after the '${label}' date Thanks. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/FormValidators-and-messages-property-file-tp4667767.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Handling page refresh or redirect when the server reboots
So we have this feature of online server upgrade in which the user can start an upgrade on the server while still logged into the (wicket) web app. This starts some scripts in the bacground which bring the jboss server down, upgrade the db, upgrade the ear file, etc., and then restart the jboss server. When the server comes back up we would like the user to be redirected to the login page of the app automatically. The last part does not work. At this time we just have a message telling the user to refresh the page and when everything is ready he will be sent to the login page. Is there a good robust way to make sure that the page is automatically refreshed and the login page is presented? Is it even possible to do it? Personally I don't think this is not a good idea but this feature is a requirement and I want to explore it as much as possible. Appreciate any help. Thanks. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Handling-page-refresh-or-redirect-when-the-server-reboots-tp4667465.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: FileDownload hides the activity indicator
Hi Ernesto, I have it like as following. @Override public void onSubmit(final AjaxRequestTarget target, Form? form) { // The veil and the activity indicator are already on when the code gets here String backupFileNameOnServer = null; try { backupFileNameOnServer = startBackup(parentPage); } catch (Exception e) { BackupTabPanel.logger.error(e); parentPage.getSession().error(e.getMessage()); target.add(parentPage.getFeedback()); } // setup for file download File sourceFile = new File(backupFileNameOnServer); String downloadFileName = backup_config_ + getServerName() + _ + getTime() + .tar; backupFileDownLoadBehaviour.initiate(sourceFile, downloadFileName, target); // after this the AjaxFileDownloadBehaviour#onResponse is called // then AjaxFileDownloadBehaviour#downloadFile (overridden in the local instance) is called // The veil and the activity indicator are gone by the time code hits AjaxFileDownloadBehaviour#onResponse. } I did not need to use another thread. Please let me know if you see any issues with this. Or a better way of doing this. Much appreciate your help. Thanks. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/FileDownload-hides-the-activity-indicator-tp4666181p4666259.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: AJAX update and file download on Wicket 1.5
Thanks for your response. Can you please kindly provide an outline or a few lines of code to get me started. My particular concerns are: 1. How do I create an Ajax request and AjaxRequestTarget. Will this be another Ajaxbehaviour. Sorry I should have learned this by now but... 2. How and when do I stop this polling and end the original onSubmit call. Thanks. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/AJAX-update-and-file-download-on-Wicket-1-5-tp4095241p4666260.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: AJAX update and file download on Wicket 1.5
Well, that is exactly what we are trying to avoid. An error page is a must fix bug. Thanks. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/AJAX-update-and-file-download-on-Wicket-1-5-tp4095241p4666262.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: FileDownload hides the activity indicator
Ernesto, Well the change seems to work. I am using a button that shows an activity indicator with a veil for the request. So now that activity indicator and veil is shown while the file is generated. But they go away when the file is downloaded and the user can start clicking the button again. When the file download is completed the requests for previous clicks start again. BTW, I just realized that my code is actually based on your code on https://cwiki.apache.org/confluence/display/WICKET/AJAX+update+and+file+download+in+one+blow Thanks for putting it up. Really helpful. May be you can update it so that it will take care of the problem that I have. That is showing the activity indicator during the complete file generation and download. Thanks again. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/FileDownload-hides-the-activity-indicator-tp4666181p4666241.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: AJAX update and file download on Wicket 1.5
Hi, Suppose there is some problem or exception in the file download. Let's say in the following method: protected IResourceStream getResourceStream() { return new AbstractResourceStreamWriter() { public void write(Response output) { WebResponse response = (WebResponse)output; byte[] buffer = new byte[256]; try { int read; while((read = is.read(buffer)) != -1) { response.write(buffer, 0, read); response.flush(); } response.close(); } catch (Exception e) { response.write(e.toString().getBytes()); response.close(); } } }; } And I want to show the error in the feedback panel for the page. How can I do that? The AjaxRequestTarget is not available here. I tried to do something like the following but it did not work: parentPage.getSession().error(error); WebApplication app = (WebApplication)getComponent().getApplication(); AjaxRequestTarget target = app.newAjaxRequestTarget(parentPage); target.add(parentPage.getFeedback()); I also tried saving the AjaxRequestTarget passed in the initiate method as a member variable of the class and use it later for posting the error. Well, for one it did not work. For second, I got the non serializable error for the target in the log. Thanks -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/AJAX-update-and-file-download-on-Wicket-1-5-tp4095241p4666243.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: FileDownload hides the activity indicator
Hi Ernesto, Thank you for your quick response. But I think I did not explain the problem that I am trying to solve. What is happening in my case is that when I click the IndicatingAjaxButton to start the file download, the activity indicator (that twirling round thing) appears. But it then disappears very quickly just when the code starts generating and downloading the file. All this while, without the activity indicator, the user does not know if any thing is happening and so may click the button again and again. The solutions that you have sent me the links to, are for problems relating to the GUI not being responsive after the file has been downloaded. I do not have that problem. I just don't want the user to click the button again while the file is being downloaded. Also, unfortunately other than Wicket and simple html, I do not know much about other GUI tools including Javascript. So I would appreciate very much if you can provide me with a solution that I can easily use in wickets. Again, thanks so much for your response. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/FileDownload-hides-the-activity-indicator-tp4666181p4666209.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: FileDownload hides the activity indicator
Hi Ernesto, Generating the file first and then triggering the download sounds like a good idea. I think at least while the file is being generated the activity indicator will show. I will try this. Thanks. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/FileDownload-hides-the-activity-indicator-tp4666181p4666212.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
FileDownload hides the activity indicator
Hi, I have code that downloads file in Ajax mode. The download is fired by IndicatingAjaxButton. The activity indicator is visible for a very short time but when file download code starts the activity indicator vanishes. It is a big problem if the file takes a long time to download. Any ideas about how to fix it? I am attaching a quick start for the test code. ajaxfileDownload.zip http://apache-wicket.1842946.n4.nabble.com/file/n4666181/ajaxfileDownload.zip As always, I would appreciate any help in fixing this issue. Thanks, -msalman -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/FileDownload-hides-the-activity-indicator-tp4666181.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: wait indicator not showing with veil for AjaxButton
Thanks for your help. I knew that it had some thing to do with the url. I found another way to make it work by extending the IndicatingAjaxButton class. It seems it knows the way to find the right URL. But that made me change the code at a lot of different places where the original button was being used. But again, thanks for your help. Here is the way that I was able to make it work. myproject.gz http://apache-wicket.1842946.n4.nabble.com/file/n4665556/myproject.gz -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/wait-indicator-not-showing-with-veil-for-AjaxButton-tp4665422p4665556.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: wait indicator not showing with veil for AjaxButton
Any help please? Thanks. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/wait-indicator-not-showing-with-veil-for-AjaxButton-tp4665422p4665434.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
wait indicator not showing with veil for AjaxButton
Hi, I am trying to show an wait indicator and a veil when an ajax button is showed. The veil works fine but despite all my effort the indicator is not working. Attached is a quick start of the project. My code is based on the code at this page: http://javathoughts.capesugarbird.com/2008/03/ajax-button-with-overlay-div-and-wait.html I have tried to port it to wicket 1.5. As always, I will appreciate any help on this issue. Thanks. -Mohammad myproject.gz http://apache-wicket.1842946.n4.nabble.com/file/n4665422/myproject.gz -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/wait-indicator-not-showing-with-veil-for-AjaxButton-tp4665422.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Confirm Navigation pop up dialog box
Thanks you very much. That worked very nicely. Good to not see the page refreshing any more and the jerk that goes with it. I always wondering what is the difference between 'setOutputMarkupId' and 'setOutputMarkupPlaceholderTag'. So this issue explains it. Can I always use 'setOutputMarkupPlaceholderTag' or are there instances where I can only use 'setOutputMarkupId'?? Thanks again. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Confirm-Navigation-pop-up-dialog-box-tp4664778p4664809.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Confirm Navigation pop up dialog box
I have a page where I switch between panels by making one of them visible and using a radio button as following: radioChoice.add(new AjaxFormChoiceComponentUpdatingBehavior() { /** * */ private static final long serialVersionUID = 1L; @Override protected void onUpdate(AjaxRequestTarget target) { if (panelSelection.equals(currentPanelSelection)) { return; } if (panelSelection.equals(PanelSelection.AGENTS)) { ldapPanel.setVisible(false); agentPanel.setVisible(true); } else { ldapPanel.setVisible(true); agentPanel.setVisible(false); } target.add(ldapPanel); target.add(agentPanel); target.add(FsUserBrowsePage.this); currentPanelSelection = panelSelection; } As you can see that page is added to the target. But this causes the confirm navigation type popup dialog box in all the browsers. If I don't include the page to the target then my changes do not happen. Because of the frame work developed here, it seems that I would just have to add the page to the target. I have tried adding following lines to the above method but they do not help: target.prependJavaScript(Wicket.Window.unloadConfirmation = false;); target.add(ldapPanel); target.add(agentPanel); target.add(FsUserBrowsePage.this); target.getHeaderResponse().renderOnEventJavaScript(target, event, javascript); I had a similar problem with a ModalWindow but target.prependJavaScript(Wicket.Window.unloadConfirmation = false;); worked. But nothing seems to work with the above problem. Can some one please help avoid the confirm navigation popup. Thanks. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Confirm-Navigation-pop-up-dialog-box-tp4664778.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Wicket and Menu support
Thanks to every one for all of your comments and suggestions. Great to know that wicket core will include jquery. Alle, I would appreciate very much if you can please share your code for using jquery tree. It would give me a good start. Thanks. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Wicket-and-Menu-support-tp4540516p4541287.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Wicket and Menu support
Wicket is a great product and I really hope that I do not offend any one by my question. Indeed this may be due to my lack of information. What I want to know is why does not Wicket 'core' supports menu and other items necessary to develop a website? I have to search for YUI wicket, wicket-stuff, and wicket-extensions, which are some what phantom like websites. After some research I find that the code I am looking for is not even supported any more. The kind developer has moved on to other stuff. So what is the qualification for you to include a control(?) into the Wicket 'core'? What is the suggested way to handle stuff like this? Thanks. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Wicket-and-Menu-support-tp4540516p4540516.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Wicket and Menu support
Well you are right that I am not good with html and css. As I say I have been forced to do GUI work - kicking and screaming. Well, I think I am OK with html but this CSS thing leaves me very frustrated. I thought that the idea behind Wicket is to take care of these things for Java programmers. I would appreciate if some basic form of menu is made part of wicket core. BTW, thanks for the ULli hint. Thanks. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Wicket-and-Menu-support-tp4540516p4540539.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Setting/changing id for components after creation.
I have a panel which adds another child panel created by other users. The problem for me is that the parent panel expects the child panel to have a particular id (formPanel). The child panel will itself be a derived class and will have a corresponding wicket:extend html file. Since there is no setId(String id) method provided, what will be the best way to handle this problem? I had thought of creating derived child panel classes with the required id set by the derived class itself. The user will create another derived class off former class ... but this just ends up with way too many classes depending on future parent panels, etc. I hope I have not made it too complicated to understand. Thanks, -msalman -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Setting-changing-id-for-components-after-creation-tp4358004p4358004.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
WicketTester and the rendered page
I am testing an application that starts with a login page. After logging in the user is taken to the home page. @Test public void test() { QuickStartApplication app = new QuickStartApplication(); Class clazz = app.getHomePage(); WicketTester tester = new WicketTester(new QuickStartApplication()); WebPage loginPage = null; try { loginPage = (WebPage) app.getHomePage().newInstance(); } catch (Exception e) { e.printStackTrace(); } // Start out with the login Page tester.startPage(loginPage); tester.assertRenderedPage(LoginPage.class); tester.assertComponent(form:name, TextField.class); tester.assertComponent(form:password, PasswordTextField.class); // login form FormTester formTester = tester.newFormTester(form); formTester.setValue(name, 1); formTester.setValue(password, 1); // click button to login tester.executeAjaxEvent(form:submit, onclick); formTester.submit(submit); // Successfully logged in. On the HomePage now tester.assertRenderedPage(HomePage.class); tester.assertComponent(form:text1, TextField.class); formTester = tester.newFormTester(form); formTester.setValue(text1, 1); // submit the home page form tester.executeAjaxEvent(form:submit, onclick); formTester.submit(submit); tester.assertRenderedPage(HomePage.class); // Fails here. // junit.framework.AssertionFailedError: expected:HomePage but was:LoginPage // Why is that? It has already asserted earlier that it is the home page.. } Am I doing this thing right? Do I understand the Wicket tester right. I am attaching a quickstart project that includes the above test. As always, I would appreciate any help. Thanks. -Mohammad http://apache-wicket.1842946.n4.nabble.com/file/n3568766/WicketTesterTest.zip WicketTesterTest.zip -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/WicketTester-and-the-rendered-page-tp3568766p3568766.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
RE: WicketTester and the rendered page
Thanks for the quick response. Well, I want it to stay at the Home Page. How did it go back to loginPage?? Thanks again. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/WicketTester-and-the-rendered-page-tp3568766p3568826.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: WicketTester and clicking a tree node
Pedro, thanks for your response. I solved my problem in the following way: For my derived DefaultMutableTreeNode class I added an Ajax link element: public class CheckBoxSelectableTreeItem extends DefaultMutableTreeNode { protected AjaxLink clickLink; // for testing the expand/collapse link public AjaxLink getClickLink() { return clickLink; } public void setClickLink(AjaxLink clickLink) { this.clickLink = clickLink; } } For my tree class I overrode the newJunctionLink method like this: public class CheckBoxTree extends LinkTree { . @Override protected Component newJunctionLink(MarkupContainer parent, final String id, final Object node) { AjaxLink link = (AjaxLink) super.newJunctionLink(parent, id, node); ((CheckBoxSelectableTreeItem)node).setClickLink(link); return link; } } So in the test when you have the node you can open (expand) it this way: CheckBoxSelectableTreeItem node= get Node AjaxLink nodeLink = node.getClickLink(); tester.executeAjaxEvent(nodeLink, onclick); -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/WicketTester-and-clicking-a-tree-node-tp3556724p3568831.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: WicketTester and clicking a tree node
Hi Pedro. But how do you get the link's id i.e., moveC3ToC2? I added all the code to the Node and Tree derive classes to so that I could get the link id. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/WicketTester-and-clicking-a-tree-node-tp3556724p3569317.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: TextField not getting the value after a validation eror
If you can please provide your code then may be I might be able to figure out the problem. Thanks. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/TextField-not-getting-the-value-after-a-validation-eror-tp3521252p3556715.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
WicketTester and clicking a tree node
Hi, I am trying to simulate/test clicking and expanding tree nodes. My Tree is based off LinkTree class. Can some one please provide me the solution or ideas. Thanks. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/WicketTester-and-clicking-a-tree-node-tp3556724p3556724.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: TextField not getting the value after a validation eror
Hi Clint: The steps are: 1- user opens page 2- user submits form (without entering any value) 3- required error appears. 4- user clicks on the link to enter value and no value appears in the text box. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/TextField-not-getting-the-value-after-a-validation-eror-tp3521252p3526513.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: TextField not getting the value after a validation eror
Hi Pedro: Thanks for that. And it fixed the problem. The onClick code is now like this: String guid = java.util.UUID.randomUUID().toString(); bean.setText(guid); textField.modelChanged(); target.addComponent(textField); Thanks you so much. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/TextField-not-getting-the-value-after-a-validation-eror-tp3521252p3526525.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
TextField not getting the value after a validation eror
I have a text field that is required to have a value. I also have a link that on being clicked inserts a value into the text field. It all works fine except if the user submits the form without setting the value for the text field. Once the form has been submitted without the required value, and the form has generated the error, the text field does seem to get/show the value that the link is trying to enter. I just hope that I am not doing something right and that some one will kindly point out the error. I am attaching a quickstart. Thanks. http://apache-wicket.1842946.n4.nabble.com/file/n3521252/TextFieldTest.zip TextFieldTest.zip -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/TextField-not-getting-the-value-after-a-validation-eror-tp3521252p3521252.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: custom html page
Hi Martin, Yes, you are very right about that. Thanks. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/custom-html-page-tp2234086p2235861.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: custom html page
Martin, Thanks for your response. I did try ((CastToYourSession) Session.get()) and that part works. I wanted to do something as following: public class MyOwnStreamLocator extends ResourceStreamLocator { //protected protected App app; public MyOwnStreamLocator(App app) { this.app = app; } public IResourceStream locate(final Class clazz, final String path) { if (clazz.getName().compareTo(com.michni.wicket.request.search.specificsupplier.PageSpcificSupplierSearchRequest)==0 ) { UserSession session = (UserSession)Session.get(); Supplier supplier = session.getSpecificSupplier(); if (supplier.getId() == 2) { String path2 = PageSpcificSupplierSearchRequest_custom.html; IResourceStream located = super.locate(clazz, trimFolders(path2)); if (located != null) { return located; } } } IResourceStream located = super.locate(clazz, trimFolders(path)); if (located != null) { return located; } located = super.locate(clazz, path); return located; } But I have found that the locate method for each Page class is called only once and so what ever html file is set for a Page once is used all the time. Is there a way to set the html file location in the Page class? So when ever that page is constructed the right custom html file is picked. I have a feeling that the key lies in the MarkupStream but I don't know how to use it. Thanks. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/custom-html-page-tp2234086p2234882.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
custom html page
Hi, Is it possible for a Page to have to have customized html files depending on certain parameter (user, customer, etc)? I want to allow users to for a certain page to be able to provide their own html file for that page or panel. So depending on the user or customer id I can pick up the right html file and use that. I tried to do this in the my ResourceStreamLocator extension class but I can't get the session object there. I guess that is the place to set the html location for the application. I also found this code on the web. The problem with it is that the markupStream object passed in is null. @Override protected void onRender(MarkupStream markupStream) { markupStream.next(); try { WebRequestCycle cycle = (WebRequestCycle)RequestCycle.get(); ServletRequest request = cycle.getWebRequest().getHttpServletRequest(); ServletResponse response = cycle.getWebResponse().getHttpServletResponse(); ServletContext context = ((WebApplication)getApplication()).getServletContext(); RequestDispatcher rd = context.getRequestDispatcher(/com/michni/wicket/../specificsupplier_custom.html); rd.include(request, response); //context.getRequestDispatcher(/ + getId() + .html).include(request, response); } catch (Exception e) { throw new WicketRuntimeException(e); } } Any ideas or suggestions please? Thanks, -Mohammad -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/custom-html-page-tp2234086p2234086.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: CheckGroup and ListView
And it was as simple as that. Thank you so much. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/CheckGroup-and-ListView-tp1886879p2197959.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: CheckGroup and ListView
Hi, Was any one able to test the quick start? Thanks. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/CheckGroup-and-ListView-tp1886879p2196464.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: CheckGroup and ListView
QuickStart project added. BTW thanks for the instructions for creating the quick start. If any one else needs the instructions then they can be found at: http://www.jeremythomerson.com/blog/2008/11/wicket-quickstart-tutorial/#more-99 Well, I hope the quick start works for others too. Thanks again. http://n4.nabble.com/file/n2134528/wicket-quickstart-checkgroup.zip wicket-quickstart-checkgroup.zip -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/CheckGroup-and-ListView-tp1886879p2134528.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: CheckGroup and ListView
Well, I have tried using ListModel as following: selectableValues = new ListViewSelectableValue(selectableValuesList, new ListModelSelectableValue(list)) { .. } and then: selectableValues.getModelObject().add(new SelectableValue(newId, value + newId++)); without any success. BTW, do I also need to set the model for the CheckGroup as following? checkGroupSelectableValues = new CheckGroupSelectableValue(selectedValues, new CollectionModelSelectableValue(list)); I did not need to do this in my other application but in this application if I don't do it then I get the model is null exception. I thought that when I add the ListView Object to the CheckGroup object then the model object is set for CheckGroup. The bottom line is that I can not make this thing what ever I tried. Please help. Thanks. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/CheckGroup-and-ListView-tp1886879p2133161.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: CheckGroup and ListView
Well, I have tried removing and then adding the ListView to the CheckGroup, but that does not work either. I have tried to debug this as much as I could and I do see that there are the right values in the java objects of ListView and the wrapped list. To me it looks like that the code that creates the html or the script is not clearing the old values. But that is just my guess. But hopefully I am just not doing some thing right and some one would please point that out to me. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/CheckGroup-and-ListView-tp1886879p2133543.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: CheckGroup and ListView
I have not heard anything on this one. I will be very thankful if I can get some help on this one. To help reproduce the problem I have attached simple code files. http://n4.nabble.com/file/n2131672/App.java App.java . http://n4.nabble.com/file/n2131672/PageCheckGroup.html PageCheckGroup.html . http://n4.nabble.com/file/n2131672/PageCheckGroup.java PageCheckGroup.java . http://n4.nabble.com/file/n2131672/SelectableValue.java SelectableValue.java . -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/CheckGroup-and-ListView-tp1886879p2131672.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: CheckGroup and ListView
Oh my. I was just about to send you a special email for my problem. But you pre-empted me. I will try your suggestion. Thanks so much Mohammad Salman (510) 673-5869 c Every problem has its solution(s) but there are problems with any solution From: Jeremy Thomerson [via Apache Wicket] ml-node+2131687-1413056525-229...@n4.nabble.com To: msalman mohammad_sal...@yahoo.com Sent: Wed, May 5, 2010 2:08:06 PM Subject: Re: CheckGroup and ListView I haven't looked at it in detail, but you shouldn't be doing that removeAll() and setList() stuff - it comes from a lack of using Models properly - which is the most common mistake I see in Wicket users. Instead, you should give the ListView constructor an instance of some IModelListSelectableValue. Then simply add your new selectable value to whatever list that model is getting it's data from. The ListView will auto-magically repaint everything correctly. -- Jeremy Thomerson http://www.wickettraining.com On Wed, May 5, 2010 at 3:59 PM, msalman [hidden email] wrote: I have not heard anything on this one. I will be very thankful if I can get some help on this one. To help reproduce the problem I have attached simple code files. http://n4.nabble.com/file/n2131672/App.java App.java . http://n4.nabble.com/file/n2131672/PageCheckGroup.html PageCheckGroup.html . http://n4.nabble.com/file/n2131672/PageCheckGroup.java PageCheckGroup.java . http://n4.nabble.com/file/n2131672/SelectableValue.javaSelectableValue.java . -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/CheckGroup-and-ListView-tp1886879p2131672.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [hidden email] For additional commands, e-mail: [hidden email] View message @ http://apache-wicket.1842946.n4.nabble.com/CheckGroup-and-ListView-tp1886879p2131687.html To unsubscribe from Re: CheckGroup and ListView, click here. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/CheckGroup-and-ListView-tp1886879p2131697.html Sent from the Wicket - User mailing list archive at Nabble.com.