Re: Threading wicket
If i understand correctly , I think clock example does not work for you because your first ajax request - to handle the files - has to first finish. Until that finishes the self updating behavior which is a separate ajax request will not fire. So prob you will have to do ur file stuff in a separate thread. But mind u- that thread may not have references to stuff like ur session,application objects- they might be null. So you will have to first get the reqd stuff (any dependecies- say something from ur service layer for example) and then start the thread. I was able to update a simple label to the current file number being handled for example. For this i did the file stuff in a separate thread. -swaroop Vít Rozkovec wrote: Hallo, how can I force from a middle of the loop, which may run up to few minutes to update a component's value? I am manipulating a lot of files and I would like to let the user know how much of the processing is already done. I would like to start processing the files when user reaches certain page and on this same page I want to display statistics of the process. As an example I tried to use a Clock from your ajax example, but I cannot manage it to update during running of the loop. I thought of achieving it somehow with threads, is this right direction? What is the correct way to do it? Thank you. Vitek - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- View this message in context: http://www.nabble.com/Threading-wicket-tf4566130.html#a13034201 Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: CompoundPropertyModel stops working when form validation fails.
P.S.: I'm using Wicket 1.2.6. Fabio Fioretti - WindoM - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Update of datepicker value with ajax
Hi *, I present a date by 3 DropDownChoices (year, month, day). Additionally i want to provide a datepicker. The sync from datepicker selection to dropdownchoises is working as expected. On the other hand if i change the dropdownchoise the datepicker value will be changed, but it is represented by a second icon (Or third one if i click again ...). How can i avoid that the datepicker gets a further icon after ajax update. Cheers Per Here the code fragments final DropDownChoice year = WicketComponentFactory.getNotifyDropDownChoice(year, model, _year, model.getAvailableYears()); final DateTextField text = new DateTextField(textDate, new PropertyModel(model, date)); final DatePicker dp = new DatePicker(); dp.bind(year); text.add(dp); form.add(year); form.add(text); year.setOutputMarkupId(true); year.add(new AjaxFormComponentUpdatingBehavior(onchange) { private static final long serialVersionUID = 8454408934269214172L; protected void onUpdate(AjaxRequestTarget target) { IPreSelectionModel m = (IPreSelectionModel) getModelObject(); m.makeValidFromdate(); target.addComponent(text); } }); text.setOutputMarkupId(true); text.add(new AjaxFormComponentUpdatingBehavior(onchange) { private static final long serialVersionUID = -7951690038251173325L; protected void onUpdate(AjaxRequestTarget target) { IPreSelectionModel m = (IPreSelectionModel) getModelObject(); m.setDay(m.getDate()); m.setMonth(m.getDate()); m.setYear(m.getDate()); m.makeValidFromdate(); target.addComponent(day); target.addComponent(month); target.addComponent(year); } }); add(form); -- Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen! Ideal für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to match File Pattern?
any body have an Idea regarding this.?? Edi wrote: Hello Guys, I have different file patterns like *.xls (all the xls files) n*.xls (xls file starts with n) - all the xls files starts with n How can we do this pattern matching in wicket? Please let me know. Thanking you. Regards, Edi -- View this message in context: http://www.nabble.com/How-to-match-File-Pattern--tf4561817.html#a13037186 Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Update of datepicker value with ajax
Per, a temporary fix for now would be to instead of adding the DateTextField to the AjaxRequestTarget, add text.getParent() i'll fix this misbehavior with something similar what matej did with the IndicatingAjaxButton Gerolf On 10/4/07, Per Newgro [EMAIL PROTECTED] wrote: Hi *, I present a date by 3 DropDownChoices (year, month, day). Additionally i want to provide a datepicker. The sync from datepicker selection to dropdownchoises is working as expected. On the other hand if i change the dropdownchoise the datepicker value will be changed, but it is represented by a second icon (Or third one if i click again ...). How can i avoid that the datepicker gets a further icon after ajax update. Cheers Per Here the code fragments final DropDownChoice year = WicketComponentFactory.getNotifyDropDownChoice(year, model, _year, model.getAvailableYears()); final DateTextField text = new DateTextField(textDate, new PropertyModel(model, date)); final DatePicker dp = new DatePicker(); dp.bind(year); text.add(dp); form.add(year); form.add(text); year.setOutputMarkupId(true); year.add(new AjaxFormComponentUpdatingBehavior(onchange) { private static final long serialVersionUID = 8454408934269214172L; protected void onUpdate(AjaxRequestTarget target) { IPreSelectionModel m = (IPreSelectionModel) getModelObject(); m.makeValidFromdate(); target.addComponent(text); } }); text.setOutputMarkupId(true); text.add(new AjaxFormComponentUpdatingBehavior(onchange) { private static final long serialVersionUID = -7951690038251173325L; protected void onUpdate(AjaxRequestTarget target) { IPreSelectionModel m = (IPreSelectionModel) getModelObject(); m.setDay(m.getDate()); m.setMonth(m.getDate()); m.setYear(m.getDate()); m.makeValidFromdate(); target.addComponent(day); target.addComponent(month); target.addComponent(year); } }); add(form); -- Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen! Ideal für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Wicket Meetup Amsterdam: a proposal
Hi Johan, all, i also have been asking around for a big room. And Servoy is willing to sponser a big room if needed (if there are really comming 30+ people) That's excellent news! :) Do you think the dates and location I suggested will work? These are the dates I made a reservation for: Friday November 23rd Monday November 26th Friday November 30th I didn't book any rooms yet, I just called the venue to ask which dates are still open and block them in the meantime. When we say GO for any of these three days, they'll book it for us. However, if someone has a better idea, please speak up! :) The venue is right in the center of Amsterdam, http://maps.google.com/maps?f=qhl=engeocode=time=date=ttype=q=Keizersgracht+324,+amsterdamsll=37.0625,-95.677068sspn=26.339531,58.710937ie=UTF8z=16iwloc=addrom=1 Arjé - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to match File Pattern?
what's exactly wicket's role in this? you should take a look at java.io.File / java.io.FilenameFilter and/or java.util.regex.* regards, --- jan. Edi wrote: any body have an Idea regarding this.?? Edi wrote: Hello Guys, I have different file patterns like *.xls (all the xls files) n*.xls (xls file starts with n) - all the xls files starts with n How can we do this pattern matching in wicket? Please let me know. Thanking you. Regards, Edi - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Threading wicket
swaroop belur wrote: But mind u- that thread may not have references to stuff like ur session,application objects- they might be null. So you will have to first get the reqd stuff (any dependecies- say something from ur service layer for example) and then start the thread. -swaroop Would you mind sharing a bit of your code? So far I did Application.set(app) in the run() method (app is reference to application from standart thread Wicket is running in), but I think this is not the right way as the set() method is not part of the public API. What is the best way to do this? Thanks alot. Vitek Vít Rozkovec wrote: Hallo, how can I force from a middle of the loop, which may run up to few minutes to update a component's value? I am manipulating a lot of files and I would like to let the user know how much of the processing is already done. I would like to start processing the files when user reaches certain page and on this same page I want to display statistics of the process. As an example I tried to use a Clock from your ajax example, but I cannot manage it to update during running of the loop. I thought of achieving it somehow with threads, is this right direction? What is the correct way to do it? Thank you. Vitek - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
FormComponentPanel and Validators
I've created a FormComponentPanel that wraps three text fields, to mimic a phone number. I created a custom validator, which I have added to the panel. When I submit the form, the validator does not seem to be fired. If I attach the validator to another form component, it fires without a problem, which leads me to believe that the FormComponentPanel has problems with it. Is there some trick, or is this a bug? Mike - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: FormComponentPanel and Validators
did you properly override convertintput() on the formcomponentpanel to generate an object based on the 3 children? by default it returns null and validators do not run on null values... -igor On 10/4/07, Michael Laccetti [EMAIL PROTECTED] wrote: I've created a FormComponentPanel that wraps three text fields, to mimic a phone number. I created a custom validator, which I have added to the panel. When I submit the form, the validator does not seem to be fired. If I attach the validator to another form component, it fires without a problem, which leads me to believe that the FormComponentPanel has problems with it. Is there some trick, or is this a bug? Mike - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Page.detachModels() not working like it used to
Actually, Page.detach() is not callable from a JUnit test that uses WicketTester in 1.3.0beta3. It throws an exception: org.apache.wicket.WicketRuntimeException: No RequestCycle is currently set! at org.apache.wicket.Component.getRequest(Component.java:1443) at org.apache.wicket.Page.onDetach(Page.java:1406) at org.apache.wicket.markup.html.WebPage.onDetach(WebPage.java:360) at org.apache.wicket.Component.detach(Component.java:899) In 1.2.6, you could call Page.detachModels() and the test would run fine. -Dan Here's my test: - import junit.framework.TestCase; /* //1.2.6 import wicket.Component; import wicket.Page; import wicket.model.LoadableDetachableModel; import wicket.util.tester.WicketTester; */ //1.3 import org.apache.wicket.Component; import org.apache.wicket.Page; import org.apache.wicket.model.LoadableDetachableModel; import org.apache.wicket.util.tester.WicketTester; public class WicketDetachTest extends TestCase { public WicketDetachTest() { } public void testDetach(){ WicketTester tester = new WicketTester(); Page page = tester.startPage(Wicket12Page.class); tester.debugComponentTrees(); Component c = tester.getComponentFromLastRenderedPage (listView:0:labelWithDetachableModel); LoadableDetachableModel childModel = (LoadableDetachableModel)c.getModel(); // Child currently attached due to rendering assertTrue(childModel.isAttached()); // Attached // Detach children //page.detachModels(); // 1.2.6 - Does not detach child models in 1.3 page.detach(); // 1.3 FAILS - not in request cycle assertFalse(childModel.isAttached()); // Not attached // Cause attachment c.getModelObject(); assertTrue(childModel.isAttached()); // Attached } } On 10/2/07, Kent Tong [EMAIL PROTECTED] wrote: Dan Syrstad-2 wrote: Nope. I tried detach() too and that doesn't work - the test still fails. I had to write my own method which was basically was a copy of the old Page.detachModels() code. The thing is that In beta3, Page now just acts like a Component as far as detachModels() is concerned and Component.detachModels()/detach() does notdetach all of the child models. Component.detach(), in fact, calls detachChildren() which is an empty method. detachChildren() is overriden by MarkupContainer which does detach its children (see below). So there must be something wrong with your unit test. void detachChildren() { // Loop through child components final Iterator iter = iterator(); while (iter.hasNext()) { // Get next child final Component child = (Component)iter.next(); // Call end request on the child child.detach(); } super.detachChildren(); } -- View this message in context: http://www.nabble.com/Page.detachModels%28%29-not-working-like-it-used-to-tf4549247.html#a13000103 Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: RequestCycle?
I think it is setup with ThreadLocal so you can get it easily with RequestCycle.get(). You can also provide your own version from Application.newRequestCycle which might be more what you need to hook in start/end events. Stanczak Group wrote: How can I access the request cycle so I can open and close a Hibernate session on each request? -- Justin Stanczak Stanczak Group 812-735-3600 All that is necessary for the triumph of evil is that good men do nothing. Edmund Burke - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- View this message in context: http://www.nabble.com/RequestCycle--tf4569125.html#a13041123 Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: FormComponentPanel and Validators
I take it back. It is the validator itself that isn't functioning as expected. In my panel, I did not override convertInput(), as expected. The JavaDoc suggests that I call setConvertedInput() from within convertInput(), except that setConvertedInput() does not exist. Has this been replaced with setModelValue(), and just not reflected in the JavaDoc? Mike Michael Laccetti wrote: I've created a FormComponentPanel that wraps three text fields, to mimic a phone number. I created a custom validator, which I have added to the panel. When I submit the form, the validator does not seem to be fired. If I attach the validator to another form component, it fires without a problem, which leads me to believe that the FormComponentPanel has problems with it. Is there some trick, or is this a bug? Mike - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
DateTimeField problem
Hi, I'm new to wicket, and I will appreciate if could help me! I'm having problems using DateTimeField, i'm getting the following exception: WicketMessage: Unknown tag name with Wicket namespace: 'panel'. Might be you haven't installed the appropriate resolver? I've tried to google it, but no luck... I also tried looking for some docs on the Wicket-Datetime, but no luck... I'm sorry if this is a newbie question... :) Source Code: Java: public class CreateOrder extends WebPage { public CreateOrder() { add(new CreateOrderForm(Form)); } class CreateOrderForm extends Form { OrdersServicesBeanIfc service; GenericOrderEntity order; CreateOrderModel orderModel; public CreateOrderModel getOrderModel() { return orderModel; } public void setOrderModel(CreateOrderModel orderModel) { this.orderModel = orderModel; } public GenericOrderEntity getOrder() { return order; } public void setOrder(GenericOrderEntity order) { this.order = order; } public CreateOrderForm(String s) { super(s, new CompoundPropertyModel(new CreateOrderModel())); IModel iModel = this.getModel(); orderModel = (CreateOrderModel) iModel.getObject(); //service = ServiceFactory.getService(OrdersServicesBeanIfc.class); //List rooms = service.getRoomsList(); add(new Label(currentDate, new Model(WebUtils.getCurrentDate(; add(new Label(creator, new Model(((ApplicationSession) getSession()).getUserName(; add(new TextField(recipientName)); //add(new RadioChoice(ordersRadio, new PropertyModel(orderModel, orderType), OrderTypes.getOrderTypesList())); add(new TextField(phoneNumber)); add(new DateTimeField(startDate)); add(new DateTimeField(endDate)); //add(new DropDownChoice(roomList, rooms)); //add(new CheckBoxMultipleChoice(inventoryChoices)); add(new TextArea(remarks)); add(new Button(saveButton, new ResourceModel(form.save))); add(new Button(resetButton, new ResourceModel(form.reset)) { public void onSubmit() { setResponsePage(CreateOrder.class); } }.setDefaultFormProcessing(false)); add(new Button(deleteButton, new ResourceModel(form.delete)) { public void onSubmit() { //todo delete } }.setDefaultFormProcessing(false)); } @Override protected void onSubmit() { } } } html: html body dir=rtl div form wicket:id=Form div wicket:message key=form.currentDate/wicket:message /div div wicket:message key=form.creator/wicket:message /div div wicket:message key=form.recipientName/wicket:message input name=recpientName type=text wicket:id=recpientName/ /div div wicket:message key=form.ordersRadio/wicket:message ! /div div wicket:message key=form.phoneNumber/wicket:message input name=phoneNumber type=text wicket:id=phoneNumber/ /div div wicket:message key=form.startDate/wicket:message div wicket:id=startDate/div /div div wicket:message key=form.endDate/wicket:message div wicket:id=endDate/div /div div wicket:message key=form.roomList/wicket:message ! /div div wicket:message key=form.inventoryChoices/wicket:message ! /div div wicket:message key=remarks/wicket:message textarea wicket:id=remarks rows=6 cols=20/textarea /div div input type=submit wicket:id=saveButton/ input type=submit wicket:id=resetButton/ input type=submit wicket:id=deleteButton/ /div /form /div /body /html Thanks! -- View this message in context: http://www.nabble.com/DateTimeField-problem-tf4569364.html#a13041697 Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: RequestCycle?
I'm not for sure what to use. I tried to override the newRequestCycle() but I had trouble understanding it. I'm doing something like what DataBinder does, but with 1.3. DataBinder seems to be 1.2. Either way I'd rather use my own. Does anyone have an example of providing my own request cycle, or is there an easier way? Sam Hough wrote: I think it is setup with ThreadLocal so you can get it easily with RequestCycle.get(). You can also provide your own version from Application.newRequestCycle which might be more what you need to hook in start/end events. Stanczak Group wrote: How can I access the request cycle so I can open and close a Hibernate session on each request? -- Justin Stanczak Stanczak Group 812-735-3600 All that is necessary for the triumph of evil is that good men do nothing. Edmund Burke - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Justin Stanczak Stanczak Group 812-735-3600 All that is necessary for the triumph of evil is that good men do nothing. Edmund Burke - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Adding a label when I add a FormComponent.
Hey Everyone, I want to create a subclass of a Form Component (Let's use TextField for this example) which takes a String in the constructor, and automatically adds the HTML for a Label before the field. I want to provide all the default functionality of a TextField (like adding behaviors, and validators), so I don't think a Panel will work for me. I found a post where it mentioned (as a hack)to override onRender to add HTML for the label directly, but this runs into problems when you include the Component in an AJAX page (whenever you re-add the component, it calls onRender, and you add the HTML for the label multiple times. Is there a way to do this using SimpleFormComponentLabel, or some other construct? Could I use FormComponentPanel? Or is there some configuration and functionality in AbstractTextCompnent and TextField which I would lose by using a FormComponentPanel? Thanks for any advice!! -Clay Lehman
Re: RequestCycle?
If I create my own request cycle, then what class do I extend? RequestCycle, WebRequestCycle or... ? RequestCycle requires you to implement other methods? Is there a wrapper class? Stanczak Group wrote: I'm not for sure what to use. I tried to override the newRequestCycle() but I had trouble understanding it. I'm doing something like what DataBinder does, but with 1.3. DataBinder seems to be 1.2. Either way I'd rather use my own. Does anyone have an example of providing my own request cycle, or is there an easier way? Sam Hough wrote: I think it is setup with ThreadLocal so you can get it easily with RequestCycle.get(). You can also provide your own version from Application.newRequestCycle which might be more what you need to hook in start/end events. Stanczak Group wrote: How can I access the request cycle so I can open and close a Hibernate session on each request? -- Justin Stanczak Stanczak Group 812-735-3600 All that is necessary for the triumph of evil is that good men do nothing. Edmund Burke - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Justin Stanczak Stanczak Group 812-735-3600 All that is necessary for the triumph of evil is that good men do nothing. Edmund Burke - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: FormComponentPanel and Validators
setconvertedinput() is still there. it is public final void on the formcomponent. -igor On 10/4/07, Michael Laccetti [EMAIL PROTECTED] wrote: I take it back. It is the validator itself that isn't functioning as expected. In my panel, I did not override convertInput(), as expected. The JavaDoc suggests that I call setConvertedInput() from within convertInput(), except that setConvertedInput() does not exist. Has this been replaced with setModelValue(), and just not reflected in the JavaDoc? Mike Michael Laccetti wrote: I've created a FormComponentPanel that wraps three text fields, to mimic a phone number. I created a custom validator, which I have added to the panel. When I submit the form, the validator does not seem to be fired. If I attach the validator to another form component, it fires without a problem, which leads me to believe that the FormComponentPanel has problems with it. Is there some trick, or is this a bug? Mike - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: RequestCycle?
I see DataBinder is just casting them and using WebRequestCycle, is that the right way? Stanczak Group wrote: If I create my own request cycle, then what class do I extend? RequestCycle, WebRequestCycle or... ? RequestCycle requires you to implement other methods? Is there a wrapper class? Stanczak Group wrote: I'm not for sure what to use. I tried to override the newRequestCycle() but I had trouble understanding it. I'm doing something like what DataBinder does, but with 1.3. DataBinder seems to be 1.2. Either way I'd rather use my own. Does anyone have an example of providing my own request cycle, or is there an easier way? Sam Hough wrote: I think it is setup with ThreadLocal so you can get it easily with RequestCycle.get(). You can also provide your own version from Application.newRequestCycle which might be more what you need to hook in start/end events. Stanczak Group wrote: How can I access the request cycle so I can open and close a Hibernate session on each request? -- Justin Stanczak Stanczak Group 812-735-3600 All that is necessary for the triumph of evil is that good men do nothing. Edmund Burke - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Justin Stanczak Stanczak Group 812-735-3600 All that is necessary for the triumph of evil is that good men do nothing. Edmund Burke - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Graceful handling of ajax after session expiration
I looked into this a bit more, and it looks like WebRequestCycleProcessor.resolve(RequestCycle, RequestParameters) always checks to see if an Ajax request is being made before a Page gets to be instantiated and stored in the session. If the Page doesn't exist in the PageMap, the request simply redirects to the Session Expired page. It seems like the Page could be created if its information were encoded in the Ajax request. Is there a reason why an AjaxLink couldn't encode a stateless URL a la BookmarkablePageRequestTargetUrlCodingStrategy s.t. the Ajax'ed component and its containing page could be created if the page didn't exist in the PageMap? leok wrote: Thanks for the response! I'm not sure if this solves my problem though, or if I understand this correctly. Even if I use HybridUrlCodingStrategy to mount the page, I will still get redirected to a Session Expired page if I try to use any ajax-enabled component. A second problem emerges when I get redirected to the Session Expired page, hit the back button, and attempt to invoke the ajax-enabled component again. This time Wicket thinks I'm sending the ajax request to the Session Expired page and redirects me to a plain old error page with a stack trace. It'd be nice to be able to register Wicket ajax components in some state that persists beyond a single user's session. Martijn Dashorst wrote: 1.3 has a new URL encoding strategy that would make this somehow possible: iirc it is the hybrid url coding strategy, and is for instance used at http://thoof.com The url becomes bookmarkable, and has the page nr and version number encoded in the url, but wicket will use the bookmarkable part when there is not session. Martijn On 10/3/07, leok [EMAIL PROTECTED] wrote: Hi there - I'm trying to add some graceful handling of ajax behavior during session expiration in my Wicket webapp. Is there a way to not redirect to the session expired page and invoke some other handler, using either a wicket component and/or javascript function, after the session has expired? Ideally, Ajax calls would continue to function after session expiration. I've scanned the list regarding this issue, and I think it makes sense for certain types of ajax requests, e.g. ajax requests that resemble stateless form interaction. Is there a way to hack this sort of behavior with Wicket? Thanks, leo -- View this message in context: http://www.nabble.com/Graceful-handling-of-ajax-after-session-expiration-tf4559480.html#a13011817 Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Buy Wicket in Action: http://manning.com/dashorst Apache Wicket 1.3.0-beta3 is released Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.0-beta3/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- View this message in context: http://www.nabble.com/Graceful-handling-of-ajax-after-session-expiration-tf4559480.html#a13042041 Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Adding a label when I add a FormComponent.
see icomponentborder -igor On 10/4/07, Clay Lehman [EMAIL PROTECTED] wrote: Hey Everyone, I want to create a subclass of a Form Component (Let's use TextField for this example) which takes a String in the constructor, and automatically adds the HTML for a Label before the field. I want to provide all the default functionality of a TextField (like adding behaviors, and validators), so I don't think a Panel will work for me. I found a post where it mentioned (as a hack)to override onRender to add HTML for the label directly, but this runs into problems when you include the Component in an AJAX page (whenever you re-add the component, it calls onRender, and you add the HTML for the label multiple times. Is there a way to do this using SimpleFormComponentLabel, or some other construct? Could I use FormComponentPanel? Or is there some configuration and functionality in AbstractTextCompnent and TextField which I would lose by using a FormComponentPanel? Thanks for any advice!! -Clay Lehman
Re: FormComponentPanel and Validators
I am using 1.3.0-beta2 - I popped open FormComponent in Eclipse and it doesn't seem to exist. Do I have a versioning issue? Igor Vaynberg wrote: setconvertedinput() is still there. it is public final void on the formcomponent. -igor - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: FormComponentPanel and Validators
Some form of issue - it's definitely in 1.3.0b3 (D:\Wicket\apache-wicket-1.3.0-beta3\src\jdk-1.4\wicket\src\main\java\org\apache\wicket\markup\html\form\FormComponent.java) On Thursday, October 4, 2007, 4:15:39 PM, Michael [EMAIL PROTECTED] wrote: I am using 1.3.0-beta2 - I popped open FormComponent in Eclipse and it doesn't seem to exist. Do I have a versioning issue? Igor Vaynberg wrote: setconvertedinput() is still there. it is public final void on the formcomponent. -igor - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] /Gwyn - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: FormComponentPanel and Validators
what javadoc are you looking at? The one online is based on trunk -igor On 10/4/07, Michael Laccetti [EMAIL PROTECTED] wrote: I am using 1.3.0-beta2 - I popped open FormComponent in Eclipse and it doesn't seem to exist. Do I have a versioning issue? Igor Vaynberg wrote: setconvertedinput() is still there. it is public final void on the formcomponent. -igor - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Null values in Lists question
I am sure there is a more elegant way than what I am doing so I thought I would throw out the following question. I have a List that displays a date in one of its columns. If that date is null, nothing is displayed...fine and dandy. However, when applying a style to the table, aka border to that cell, nothing will show up because the td element has nothing in it. Currently I am placing nbsp; before and after tags to ensure that the td element has something in it. Is there a more elegant way to do this, i.e. Wicket way? Thanks -- View this message in context: http://www.nabble.com/Null-values-in-Lists-question-tf4569676.html#a13042856 Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: DateTimeField problem
Ok, Sorry, it seems it was a dependency issue... I forgot to add to JBoss wicket-extension.jar Sorry!! Thanks for you help :blush: giladgaron wrote: It seems that the DateTimeField is a panel: DateTimeField java: package org.apache.wicket.extensions.yui.calendar; ... ... public class DateTimeField extends FormComponentPanel { ... } DateTimeField html: wicket:panel input type=text wicket:id=date size=8 / input type=text wicket:id=hours size=2 /nbsp;: input type=text wicket:id=minutes size=2 / select wicket:id=amOrPmChoice/select /wicket:panel Michael Laccetti-2 wrote: For the life of me I cannot see where it is getting panel from. Have you included everything? -- View this message in context: http://www.nabble.com/DateTimeField-problem-tf4569364.html#a13042913 Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: FormComponentPanel and Validators
Yeah, trunk JavaDoc, 1.3b2 code. I'll seek to keep the two sync'd in future. Thx. Igor Vaynberg wrote: what javadoc are you looking at? The one online is based on trunk -igor - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Threading wicket
how can I force from a middle of the loop, which may run up to few minutes to update a component's value? I am manipulating a lot of files and I would like to let the user know how much of the processing is already done. I would like to start processing the files when user reaches certain page and on this same page I want to display statistics of the process. As an example I tried to use a Clock from your ajax example, but I cannot manage it to update during running of the loop. I thought of achieving it somehow with threads, is this right direction? What is the correct way to do it? Check out org.apache.wicket.extensions.ajax.markup.html.form.upload.UploadProgressBar. It's not exactly what you want, but it should give you some ideas. Eelco - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Null values in Lists question
http://www.w3schools.com/css/tryit.asp?filename=trycss_table_empty-cells On 10/4/07, Doug Leeper [EMAIL PROTECTED] wrote: I am sure there is a more elegant way than what I am doing so I thought I would throw out the following question. I have a List that displays a date in one of its columns. If that date is null, nothing is displayed...fine and dandy. However, when applying a style to the table, aka border to that cell, nothing will show up because the td element has nothing in it. Currently I am placing before and after tags to ensure that the td element has something in it. Is there a more elegant way to do this, i.e. Wicket way? Thanks -- View this message in context: http://www.nabble.com/Null-values-in-Lists-question-tf4569676.html#a13042856 Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Buy Wicket in Action: http://manning.com/dashorst Apache Wicket 1.3.0-beta3 is released Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.0-beta3/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Null values in Lists question
Cool, thanks Martijn, learned something useful today! (which is a pleasant escape from my philosophy homework where I have to try understand what stuff like It follows that trying to give tensed thoughts or sentences non-token-reflexive truth-conditions, tensed or tenseless, always leads to contradiction means...) :-)) Regards, Sebastiaan Martijn Dashorst wrote: http://www.w3schools.com/css/tryit.asp?filename=trycss_table_empty-cells On 10/4/07, Doug Leeper [EMAIL PROTECTED] wrote: I am sure there is a more elegant way than what I am doing so I thought I would throw out the following question. I have a List that displays a date in one of its columns. If that date is null, nothing is displayed...fine and dandy. However, when applying a style to the table, aka border to that cell, nothing will show up because the td element has nothing in it. Currently I am placing before and after tags to ensure that the td element has something in it. Is there a more elegant way to do this, i.e. Wicket way? Thanks -- View this message in context: http://www.nabble.com/Null-values-in-Lists-question-tf4569676.html#a13042856 Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] smime.p7s Description: S/MIME Cryptographic Signature
Re: RequestCycle?
On 10/4/07, Stanczak Group [EMAIL PROTECTED] wrote: How can I access the request cycle so I can open and close a Hibernate session on each request? In your application class: @Override public RequestCycle newRequestCycle(Request request, Response response) { return new WebRequestCycle(this, (WebRequest)request, response) { @Override protected void onBeginRequest() { // open session } @Override protected void onEndRequest() { // close session } }; } If you use Spring for instance, you could just configure the hibernate session filter that comes with it instead. Eelco - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Null values in Lists question
On 10/4/07, Sebastiaan van Erk [EMAIL PROTECTED] wrote: (which is a pleasant escape from my philosophy homework where I have to try understand what stuff like It follows that trying to give tensed thoughts or sentences non-token-reflexive truth-conditions, tensed or tenseless, always leads to contradiction means...) :-)) Huh? Is Wicket in Action required reading for Philosophy? That is a quote from chapter 6. Martijn -- Buy Wicket in Action: http://manning.com/dashorst Apache Wicket 1.3.0-beta3 is released Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.0-beta3/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Null values in Lists question
Well I only have up to chapter 4 so far... too bad, maybe it would have helped :-)) Sebastiaan Martijn Dashorst wrote: On 10/4/07, Sebastiaan van Erk [EMAIL PROTECTED] wrote: (which is a pleasant escape from my philosophy homework where I have to try understand what stuff like It follows that trying to give tensed thoughts or sentences non-token-reflexive truth-conditions, tensed or tenseless, always leads to contradiction means...) :-)) Huh? Is Wicket in Action required reading for Philosophy? That is a quote from chapter 6. Martijn smime.p7s Description: S/MIME Cryptographic Signature
Re: Null values in Lists question
Much more elegant than I ever thought. Thank you very much! -- View this message in context: http://www.nabble.com/Null-values-in-Lists-question-tf4569676.html#a13043323 Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: RequestCycle?
Ok, thanks. This is what I did. public class RequestCycleImpl extends WebRequestCycle { private Session hibernateSession; public RequestCycleImpl(Application application, Request request, Response response) { super(application, (WebRequest) request, response); } @Override protected void onBeginRequest() { this.hibernateSession = HibernateUtil.getSessionFactory().openSession(); } @Override protected void onEndRequest() { if (this.hibernateSession != null) { this.hibernateSession.close(); } } public Session getHibernateSession() { return hibernateSession; } } Eelco Hillenius wrote: On 10/4/07, Stanczak Group [EMAIL PROTECTED] wrote: How can I access the request cycle so I can open and close a Hibernate session on each request? In your application class: @Override public RequestCycle newRequestCycle(Request request, Response response) { return new WebRequestCycle(this, (WebRequest)request, response) { @Override protected void onBeginRequest() { // open session } @Override protected void onEndRequest() { // close session } }; } If you use Spring for instance, you could just configure the hibernate session filter that comes with it instead. Eelco - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Justin Stanczak Stanczak Group 812-735-3600 All that is necessary for the triumph of evil is that good men do nothing. Edmund Burke - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Going back after save or cancel method?
I have a classic list and edit page setup. You select an object that you then pass to the edit page. My hang up is how to I return the user to the list page, if the list page took a constructor parameter so it knows what to list? In other words the list page has a constructor parameter, so how can I just send the user back to the list page in it last state? -- Justin Stanczak Stanczak Group 812-735-3600 All that is necessary for the triumph of evil is that good men do nothing. Edmund Burke - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Going back after save or cancel method?
pubic class ListPage { ... @override void onClick() { setResponsePage(new EditPage(getModelObject(), ListPage.this)); } } public class EditPage { private Page previousPage; public EditPage(Foo edit, Page back) { previousPage = back; ... @override protected void onSubmit() { setResponsePage(previousPage); } } } On 10/4/07, Stanczak Group [EMAIL PROTECTED] wrote: I have a classic list and edit page setup. You select an object that you then pass to the edit page. My hang up is how to I return the user to the list page, if the list page took a constructor parameter so it knows what to list? In other words the list page has a constructor parameter, so how can I just send the user back to the list page in it last state? -- Justin Stanczak Stanczak Group 812-735-3600 All that is necessary for the triumph of evil is that good men do nothing. Edmund Burke - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Buy Wicket in Action: http://manning.com/dashorst Apache Wicket 1.3.0-beta3 is released Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.0-beta3/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Going back after save or cancel method?
Great, thanks. Martijn Dashorst wrote: pubic class ListPage { ... @override void onClick() { setResponsePage(new EditPage(getModelObject(), ListPage.this)); } } public class EditPage { private Page previousPage; public EditPage(Foo edit, Page back) { previousPage = back; ... @override protected void onSubmit() { setResponsePage(previousPage); } } } On 10/4/07, Stanczak Group [EMAIL PROTECTED] wrote: I have a classic list and edit page setup. You select an object that you then pass to the edit page. My hang up is how to I return the user to the list page, if the list page took a constructor parameter so it knows what to list? In other words the list page has a constructor parameter, so how can I just send the user back to the list page in it last state? -- Justin Stanczak Stanczak Group 812-735-3600 All that is necessary for the triumph of evil is that good men do nothing. Edmund Burke - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Justin Stanczak Stanczak Group 812-735-3600 All that is necessary for the triumph of evil is that good men do nothing. Edmund Burke - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
More on Wicket/Hibernate...
I suspect I'm biting off more than I can chew conveniently but maybe someone can push me in the right direction... I'm attempting to build a fairly simple web application with Wicket, and I'd like to use Hibernate to manage the database access (although other frameworks like Cayenne have been suggested and I'll look at them too...) I think I've figured out the basic application structure, and how to map my data to an html page. But I don't think I understand the relationships between web sessions, hibernate sessions, DAO objects etc. I need to open a mysql db, read a set of objects from a table, and display them in a (paged) table on the screen. I've looked at several examples but they are using in-memory databases, or Spring along with Hibernate and I can't get a handle on what needs to be done to whom and by whom Anyone have a really simple MySQL example like that? Or an online tutorial that I could follow? Much obliged, nbc - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Javadocs download?
I can't seem to find a download versions of the javadocs, anyone know? Do I need to use maven? -- Justin Stanczak Stanczak Group 812-735-3600 All that is necessary for the triumph of evil is that good men do nothing. Edmund Burke - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Javadocs download?
Thanks. Igor Vaynberg wrote: http://wicketstuff.org/maven/repository/org/apache/wicket/wicket/1.3.0-SNAPSHOT/ -igor On 10/4/07, Stanczak Group [EMAIL PROTECTED] wrote: I can't seem to find a download versions of the javadocs, anyone know? Do I need to use maven? -- Justin Stanczak Stanczak Group 812-735-3600 All that is necessary for the triumph of evil is that good men do nothing. Edmund Burke - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Justin Stanczak Stanczak Group 812-735-3600 All that is necessary for the triumph of evil is that good men do nothing. Edmund Burke - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: More on Wicket/Hibernate...
It's really very simple. I'm doing the same thing here. You simple use the HibernateUtil example that is in the Hibernate documentation. Then you simple create a custom RequestCycle by overriding this method in your application. With the request cycle you can open and close Hibernate seesion. Then with a custom RequestCycle you can get it from anywhere, it uses thread local, and us it to access your database. Here's some example code: ## @Override public RequestCycle newRequestCycle(Request request, Response response) { return new RequestCycleImpl(this, request, response); } ## public class RequestCycleImpl extends WebRequestCycle { private Session hibernateSession; public RequestCycleImpl(Application application, Request request, Response response) { super(application, (WebRequest) request, response); } @Override protected void onBeginRequest() { this.hibernateSession = HibernateUtil.getSessionFactory().openSession(); } @Override protected void onEndRequest() { if (this.hibernateSession != null) { this.hibernateSession.close(); } } public Session getHibernateSession() { return hibernateSession; } } ## public class AllDivisionModel extends LoadableDetachableModel { protected Object load() { Session session = ((RequestCycleImpl) RequestCycle.get()).getHibernateSession(); Transaction tx = session.beginTransaction(); try { @SuppressWarnings(value = unchecked) ListDivision results = (ListDivision) session.createCriteria(Division.class) .addOrder(Order.asc(name)) .list(); tx.commit(); return results; } catch (Exception e) { Logger.getLogger(getClass()).error(e); tx.rollback(); } return new ArrayList(); } } ## private boolean isLoggedIn(String username, String password) { Session session = ((RequestCycleImpl) getRequestCycle()).getHibernateSession(); Transaction tx = session.beginTransaction(); try { SysUser user = (SysUser) session.createCriteria(SysUser.class) .add(Restrictions.eq(username, username)) .add(Restrictions.eq(password, password)) .uniqueResult(); if (!user.isLockout()) { return true; } tx.commit(); } catch (Exception e) { Logger.getLogger(getClass()).error(e); tx.rollback(); } return false; } ## All that said, I'm pretty new my self, so I'm sure it can be improved. This seems to work so far for me. Neil B. Cohen wrote: I suspect I'm biting off more than I can chew conveniently but maybe someone can push me in the right direction... I'm attempting to build a fairly simple web application with Wicket, and I'd like to use Hibernate to manage the database access (although other frameworks like Cayenne have been suggested and I'll look at them too...) I think I've figured out the basic application structure, and how to map my data to an html page. But I don't think I understand the relationships between web sessions, hibernate sessions, DAO objects etc. I need to open a mysql db, read a set of objects from a table, and display them in a (paged) table on the screen. I've looked at several examples but they are using in-memory databases, or Spring along with Hibernate and I can't get a handle on what needs to be done to whom and by whom Anyone have a really simple MySQL example like that? Or an online tutorial that I could follow? Much obliged, nbc - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Justin Stanczak Stanczak Group 812-735-3600 All that is necessary for the triumph of evil is that good men do nothing. Edmund Burke - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: More on Wicket/Hibernate...
Martijn Dashorst wrote: According to me you can use Hibernate's thread local session if you want (you still need the custom request cycle though!). This removes the need for all the casting and getting. Session.get().createCriteria(SysUser.class).add(.).uniqueResult(); Hibernate session, not Wicket's Martijn Thanks for the sample code - I'll see what I can do with it - you'll probably hear from me again :) nbc On 10/4/07, Stanczak Group [EMAIL PROTECTED] wrote: It's really very simple. I'm doing the same thing here. You simple use the HibernateUtil example that is in the Hibernate documentation. Then you simple create a custom RequestCycle by overriding this method in your application. With the request cycle you can open and close Hibernate seesion. Then with a custom RequestCycle you can get it from anywhere, it uses thread local, and us it to access your database. Here's some example code: ## @Override public RequestCycle newRequestCycle(Request request, Response response) { return new RequestCycleImpl(this, request, response); } ## public class RequestCycleImpl extends WebRequestCycle { private Session hibernateSession; public RequestCycleImpl(Application application, Request request, Response response) { super(application, (WebRequest) request, response); } @Override protected void onBeginRequest() { this.hibernateSession = HibernateUtil.getSessionFactory().openSession(); } @Override protected void onEndRequest() { if (this.hibernateSession != null) { this.hibernateSession.close(); } } public Session getHibernateSession() { return hibernateSession; } } ## public class AllDivisionModel extends LoadableDetachableModel { protected Object load() { Session session = ((RequestCycleImpl) RequestCycle.get()).getHibernateSession(); Transaction tx = session.beginTransaction(); try { @SuppressWarnings(value = unchecked) ListDivision results = (ListDivision) session.createCriteria(Division.class) .addOrder(Order.asc(name)) .list(); tx.commit(); return results; } catch (Exception e) { Logger.getLogger(getClass()).error(e); tx.rollback(); } return new ArrayList(); } } ## private boolean isLoggedIn(String username, String password) { Session session = ((RequestCycleImpl) getRequestCycle()).getHibernateSession(); Transaction tx = session.beginTransaction(); try { SysUser user = (SysUser) session.createCriteria(SysUser.class) .add(Restrictions.eq(username, username)) .add(Restrictions.eq(password, password)) .uniqueResult(); if (!user.isLockout()) { return true; } tx.commit(); } catch (Exception e) { Logger.getLogger(getClass()).error(e); tx.rollback(); } return false; } ## All that said, I'm pretty new my self, so I'm sure it can be improved. This seems to work so far for me. Neil B. Cohen wrote: I suspect I'm biting off more than I can chew conveniently but maybe someone can push me in the right direction... I'm attempting to build a fairly simple web application with Wicket, and I'd like to use Hibernate to manage the database access (although other frameworks like Cayenne have been suggested and I'll look at them too...) I think I've figured out the basic application structure, and how to map my data to an html page. But I don't think I understand the relationships between web sessions, hibernate sessions, DAO objects etc. I need to open a mysql db, read a set of objects from a table, and display them in a (paged) table on the screen. I've looked at several examples but they are using in-memory databases, or Spring along with Hibernate and I can't get a handle on what needs to be done to whom and by whom Anyone have a really simple MySQL example like that? Or an online tutorial that I could follow? Much obliged, nbc - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Justin Stanczak Stanczak Group 812-735-3600 All that is necessary for the triumph of
Re: More on Wicket/Hibernate...
According to me you can use Hibernate's thread local session if you want (you still need the custom request cycle though!). This removes the need for all the casting and getting. Session.get().createCriteria(SysUser.class).add(.).uniqueResult(); Hibernate session, not Wicket's Martijn On 10/4/07, Stanczak Group [EMAIL PROTECTED] wrote: It's really very simple. I'm doing the same thing here. You simple use the HibernateUtil example that is in the Hibernate documentation. Then you simple create a custom RequestCycle by overriding this method in your application. With the request cycle you can open and close Hibernate seesion. Then with a custom RequestCycle you can get it from anywhere, it uses thread local, and us it to access your database. Here's some example code: ## @Override public RequestCycle newRequestCycle(Request request, Response response) { return new RequestCycleImpl(this, request, response); } ## public class RequestCycleImpl extends WebRequestCycle { private Session hibernateSession; public RequestCycleImpl(Application application, Request request, Response response) { super(application, (WebRequest) request, response); } @Override protected void onBeginRequest() { this.hibernateSession = HibernateUtil.getSessionFactory().openSession(); } @Override protected void onEndRequest() { if (this.hibernateSession != null) { this.hibernateSession.close(); } } public Session getHibernateSession() { return hibernateSession; } } ## public class AllDivisionModel extends LoadableDetachableModel { protected Object load() { Session session = ((RequestCycleImpl) RequestCycle.get()).getHibernateSession(); Transaction tx = session.beginTransaction(); try { @SuppressWarnings(value = unchecked) ListDivision results = (ListDivision) session.createCriteria(Division.class) .addOrder(Order.asc(name)) .list(); tx.commit(); return results; } catch (Exception e) { Logger.getLogger(getClass()).error(e); tx.rollback(); } return new ArrayList(); } } ## private boolean isLoggedIn(String username, String password) { Session session = ((RequestCycleImpl) getRequestCycle()).getHibernateSession(); Transaction tx = session.beginTransaction(); try { SysUser user = (SysUser) session.createCriteria(SysUser.class) .add(Restrictions.eq(username, username)) .add(Restrictions.eq(password, password)) .uniqueResult(); if (!user.isLockout()) { return true; } tx.commit(); } catch (Exception e) { Logger.getLogger(getClass()).error(e); tx.rollback(); } return false; } ## All that said, I'm pretty new my self, so I'm sure it can be improved. This seems to work so far for me. Neil B. Cohen wrote: I suspect I'm biting off more than I can chew conveniently but maybe someone can push me in the right direction... I'm attempting to build a fairly simple web application with Wicket, and I'd like to use Hibernate to manage the database access (although other frameworks like Cayenne have been suggested and I'll look at them too...) I think I've figured out the basic application structure, and how to map my data to an html page. But I don't think I understand the relationships between web sessions, hibernate sessions, DAO objects etc. I need to open a mysql db, read a set of objects from a table, and display them in a (paged) table on the screen. I've looked at several examples but they are using in-memory databases, or Spring along with Hibernate and I can't get a handle on what needs to be done to whom and by whom Anyone have a really simple MySQL example like that? Or an online tutorial that I could follow? Much obliged, nbc - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Justin Stanczak Stanczak Group 812-735-3600 All that is necessary for the triumph of evil is that good
RE: Adding a label when I add a FormComponent.
I implemented a simple IComponentBorder, and anything I put in the beforeRender gets added again every time I try to update the component with AJAX. My IcomponentBorder has: public void renderBefore(Component component) { Response resp = component.getResponse(); resp.write(Label); } To update the input box using AJAX I have a behavior: Input1.add(new AjaxFormComponentUpdatingBehavior(onchange) { protected void onUpdate(AjaxRequestTarget target) { theItem.name=new value; target.addComponent(input2) } }); When I do target.addComponent(input2), the renderBefore adds Label again, so the HTML looks like: Label Label input wicket:id=input2/ Am I using IComponentBorder wrong? Thanks for any help! -Clay -Original Message- From: Igor Vaynberg [mailto:[EMAIL PROTECTED] Sent: Thursday, October 04, 2007 11:13 AM To: users@wicket.apache.org Subject: Re: Adding a label when I add a FormComponent. see icomponentborder -igor On 10/4/07, Clay Lehman [EMAIL PROTECTED] wrote: Hey Everyone, I want to create a subclass of a Form Component (Let's use TextField for this example) which takes a String in the constructor, and automatically adds the HTML for a Label before the field. I want to provide all the default functionality of a TextField (like adding behaviors, and validators), so I don't think a Panel will work for me. I found a post where it mentioned (as a hack)to override onRender to add HTML for the label directly, but this runs into problems when you include the Component in an AJAX page (whenever you re-add the component, it calls onRender, and you add the HTML for the label multiple times. Is there a way to do this using SimpleFormComponentLabel, or some other construct? Could I use FormComponentPanel? Or is there some configuration and functionality in AbstractTextCompnent and TextField which I would lose by using a FormComponentPanel? Thanks for any advice!! -Clay Lehman - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: More on Wicket/Hibernate...
this can all be done independently of wicket using a servletcontextlistener for sessionfactory start/shutdown and a servlet filter for closing the session at the end of requests. go for the simplest things first :) -igor On 10/4/07, Stanczak Group [EMAIL PROTECTED] wrote: Another piece I forgot to add is the config and shutting down of the factory. I use this in the WebApplication: @Override protected void init() { try { HibernateUtil.setSessionFactory(new Configuration().configure().buildSessionFactory()); } catch (Throwable e) { Logger.getLogger(getClass()).error(e); } } @Override protected void onDestroy() { HibernateUtil.getSessionFactory().close(); } Neil B. Cohen wrote: Martijn Dashorst wrote: According to me you can use Hibernate's thread local session if you want (you still need the custom request cycle though!). This removes the need for all the casting and getting. Session.get().createCriteria(SysUser.class).add(.).uniqueResult(); Hibernate session, not Wicket's Martijn - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Justin Stanczak Stanczak Group 812-735-3600 All that is necessary for the triumph of evil is that good men do nothing. Edmund Burke - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Adding a label when I add a FormComponent.
put a container around your component and update that via ajax instead -igor On 10/4/07, Clay Lehman [EMAIL PROTECTED] wrote: I implemented a simple IComponentBorder, and anything I put in the beforeRender gets added again every time I try to update the component with AJAX. My IcomponentBorder has: public void renderBefore(Component component) { Response resp = component.getResponse(); resp.write(Label); } To update the input box using AJAX I have a behavior: Input1.add(new AjaxFormComponentUpdatingBehavior(onchange) { protected void onUpdate(AjaxRequestTarget target) { theItem.name=new value; target.addComponent(input2) } }); When I do target.addComponent(input2), the renderBefore adds Label again, so the HTML looks like: Label Label input wicket:id=input2/ Am I using IComponentBorder wrong? Thanks for any help! -Clay -Original Message- From: Igor Vaynberg [mailto:[EMAIL PROTECTED] Sent: Thursday, October 04, 2007 11:13 AM To: users@wicket.apache.org Subject: Re: Adding a label when I add a FormComponent. see icomponentborder -igor On 10/4/07, Clay Lehman [EMAIL PROTECTED] wrote: Hey Everyone, I want to create a subclass of a Form Component (Let's use TextField for this example) which takes a String in the constructor, and automatically adds the HTML for a Label before the field. I want to provide all the default functionality of a TextField (like adding behaviors, and validators), so I don't think a Panel will work for me. I found a post where it mentioned (as a hack)to override onRender to add HTML for the label directly, but this runs into problems when you include the Component in an AJAX page (whenever you re-add the component, it calls onRender, and you add the HTML for the label multiple times. Is there a way to do this using SimpleFormComponentLabel, or some other construct? Could I use FormComponentPanel? Or is there some configuration and functionality in AbstractTextCompnent and TextField which I would lose by using a FormComponentPanel? Thanks for any advice!! -Clay Lehman - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
A button that does NOT submit form?
I don't want the cancel button to submit the form, is this the best method? I'm not sure I see how to do this. Is there examples? @Override protected void delegateSubmit(IFormSubmittingComponent component) { } -- Justin Stanczak Stanczak Group 812-735-3600 All that is necessary for the triumph of evil is that good men do nothing. Edmund Burke - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: More on Wicket/Hibernate...
If you are using Spring, you may be interested in a Servlet Filter that supports opening/closing sessions on a per-request basis: http://static.springframework.org/spring/docs/2.0.x/api/org/springframework/orm/jpa/support/OpenEntityManagerInViewFilter.html Mike Neil B. Cohen wrote: I suspect I'm biting off more than I can chew conveniently but maybe someone can push me in the right direction... I'm attempting to build a fairly simple web application with Wicket, and I'd like to use Hibernate to manage the database access (although other frameworks like Cayenne have been suggested and I'll look at them too...) I think I've figured out the basic application structure, and how to map my data to an html page. But I don't think I understand the relationships between web sessions, hibernate sessions, DAO objects etc. I need to open a mysql db, read a set of objects from a table, and display them in a (paged) table on the screen. I've looked at several examples but they are using in-memory databases, or Spring along with Hibernate and I can't get a handle on what needs to be done to whom and by whom Anyone have a really simple MySQL example like that? Or an online tutorial that I could follow? Much obliged, nbc - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: More on Wicket/Hibernate...
Another piece I forgot to add is the config and shutting down of the factory. I use this in the WebApplication: @Override protected void init() { try { HibernateUtil.setSessionFactory(new Configuration().configure().buildSessionFactory()); } catch (Throwable e) { Logger.getLogger(getClass()).error(e); } } @Override protected void onDestroy() { HibernateUtil.getSessionFactory().close(); } Neil B. Cohen wrote: Martijn Dashorst wrote: According to me you can use Hibernate's thread local session if you want (you still need the custom request cycle though!). This removes the need for all the casting and getting. Session.get().createCriteria(SysUser.class).add(.).uniqueResult(); Hibernate session, not Wicket's Martijn - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Justin Stanczak Stanczak Group 812-735-3600 All that is necessary for the triumph of evil is that good men do nothing. Edmund Burke - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Can we chain WebRequestCodingStrategies (CryptedUrlWebRequestCodingStrategy and an SSL coding strategy)
Hi, Can we chain WebRequestCodingStrategies? I want to use the CryptedUrlWebRequestCodingStrategy and an SSL coding strategy as seen on http://cwiki.apache.org/WICKET/how-to-switch-to-ssl-mode.html#HowtoswitchtoSSLmode-CreateNewResponseStrategy . Is this possible to use multiple WebRequestCodingStrategy objects? thanks chris -- View this message in context: http://www.nabble.com/Can-we-chain-WebRequestCodingStrategies-%28CryptedUrlWebRequestCodingStrategy-and-an-SSL-coding-strategy%29-tf4570425.html#a13045451 Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: A button that does NOT submit form?
best method is to add a Link to input type=button -igor On 10/4/07, Stanczak Group [EMAIL PROTECTED] wrote: I don't want the cancel button to submit the form, is this the best method? I'm not sure I see how to do this. Is there examples? @Override protected void delegateSubmit(IFormSubmittingComponent component) { } -- Justin Stanczak Stanczak Group 812-735-3600 All that is necessary for the triumph of evil is that good men do nothing. Edmund Burke - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: A button that does NOT submit form?
Really new, but do you mean use the new Link() and input... ? Like this: in code: add(new Link(cancel){...}); in html: input type=button wicket:id=cancel... Like that? Igor Vaynberg wrote: best method is to add a Link to input type=button -igor On 10/4/07, Stanczak Group [EMAIL PROTECTED] wrote: I don't want the cancel button to submit the form, is this the best method? I'm not sure I see how to do this. Is there examples? @Override protected void delegateSubmit(IFormSubmittingComponent component) { } -- Justin Stanczak Stanczak Group 812-735-3600 All that is necessary for the triumph of evil is that good men do nothing. Edmund Burke - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Justin Stanczak Stanczak Group 812-735-3600 All that is necessary for the triumph of evil is that good men do nothing. Edmund Burke - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: More on Wicket/Hibernate...
Neil B. Cohen wrote: Anyone have a really simple MySQL example like that? Or an online tutorial that I could follow? We have one of those: http://databinder.net/site/show/baseball-players I don't know if you want to use Databinder or not, but you aren't going to find a lot of code or tutorials otherwise for what you're asking because most people are using Spring managed sessions and transactions. If you need any help that is particular to Databinder please register on the forum and send me an email immediately afterward, or else the registration will be lost among 300 spam registrations. Nathan - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: More on Wicket/Hibernate...
Michael Laccetti wrote: If you are using Spring, you may be interested in a Servlet Filter that supports opening/closing sessions on a per-request basis: http://static.springframework.org/spring/docs/2.0.x/api/org/springframework/orm/jpa/support/OpenEntityManagerInViewFilter.html Mike Thanks - at the moment, I'm not using Spring - I was trying to figure out if I need to use it - that would mean yet another framework to learn at the same time as Wicket and Hibernate nbc Neil B. Cohen wrote: I suspect I'm biting off more than I can chew conveniently but maybe someone can push me in the right direction... I'm attempting to build a fairly simple web application with Wicket, and I'd like to use Hibernate to manage the database access (although other frameworks like Cayenne have been suggested and I'll look at them too...) I think I've figured out the basic application structure, and how to map my data to an html page. But I don't think I understand the relationships between web sessions, hibernate sessions, DAO objects etc. I need to open a mysql db, read a set of objects from a table, and display them in a (paged) table on the screen. I've looked at several examples but they are using in-memory databases, or Spring along with Hibernate and I can't get a handle on what needs to be done to whom and by whom Anyone have a really simple MySQL example like that? Or an online tutorial that I could follow? Much obliged, nbc - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: More on Wicket/Hibernate...
I'm not sure if Spring is something that really requires much learning - More than anything it is a good way of tying together a bunch of disparate frameworks for use together. Neil B. Cohen wrote: Michael Laccetti wrote: If you are using Spring, you may be interested in a Servlet Filter that supports opening/closing sessions on a per-request basis: http://static.springframework.org/spring/docs/2.0.x/api/org/springframework/orm/jpa/support/OpenEntityManagerInViewFilter.html Mike Thanks - at the moment, I'm not using Spring - I was trying to figure out if I need to use it - that would mean yet another framework to learn at the same time as Wicket and Hibernate nbc - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: RequestCycle?
Stanczak Group wrote: I'm not for sure what to use. I tried to override the newRequestCycle() but I had trouble understanding it. I'm doing something like what DataBinder does, but with 1.3. DataBinder seems to be 1.2. Either way I'd rather use my own. Does anyone have an example of providing my own request cycle, or is there an easier way? Sam Hough wrote: I think it is setup with ThreadLocal so you can get it easily with RequestCycle.get(). You can also provide your own version from Application.newRequestCycle which might be more what you need to hook in start/end events. Stanczak Group wrote: How can I access the request cycle so I can open and close a Hibernate session on each request? -- Justin Stanczak Stanczak Group 812-735-3600 DataBinder (1.1-SNAPSHOT) definitely works with 1.3. Databinder also does a pretty good job of integrating Hibernate into the Wicket models. Is there a use case for which Databinder does not work for you? Chuck -- View this message in context: http://www.nabble.com/RequestCycle--tf4569125.html#a13046998 Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: A button that does NOT submit form?
Ah, yes. Link-O-Matic. Use the docs, that's what they're there for. Sorry. Stanczak Group wrote: Really new, but do you mean use the new Link() and input... ? Like this: in code: add(new Link(cancel){...}); in html: input type=button wicket:id=cancel... Like that? Igor Vaynberg wrote: best method is to add a Link to input type=button -igor On 10/4/07, Stanczak Group [EMAIL PROTECTED] wrote: I don't want the cancel button to submit the form, is this the best method? I'm not sure I see how to do this. Is there examples? @Override protected void delegateSubmit(IFormSubmittingComponent component) { } -- Justin Stanczak Stanczak Group 812-735-3600 All that is necessary for the triumph of evil is that good men do nothing. Edmund Burke - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Justin Stanczak Stanczak Group 812-735-3600 All that is necessary for the triumph of evil is that good men do nothing. Edmund Burke - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: RequestCycle?
Probably not. I'll probably use it when I get a chance. I just downloaded the 1.0 tar and saw it's using 1.2 Wicket. Shot me the link and I'll see if I can give it a shot tonight. ChuckDeal wrote: Stanczak Group wrote: I'm not for sure what to use. I tried to override the newRequestCycle() but I had trouble understanding it. I'm doing something like what DataBinder does, but with 1.3. DataBinder seems to be 1.2. Either way I'd rather use my own. Does anyone have an example of providing my own request cycle, or is there an easier way? Sam Hough wrote: I think it is setup with ThreadLocal so you can get it easily with RequestCycle.get(). You can also provide your own version from Application.newRequestCycle which might be more what you need to hook in start/end events. Stanczak Group wrote: How can I access the request cycle so I can open and close a Hibernate session on each request? -- Justin Stanczak Stanczak Group 812-735-3600 DataBinder (1.1-SNAPSHOT) definitely works with 1.3. Databinder also does a pretty good job of integrating Hibernate into the Wicket models. Is there a use case for which Databinder does not work for you? Chuck -- Justin Stanczak Stanczak Group 812-735-3600 All that is necessary for the triumph of evil is that good men do nothing. Edmund Burke - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Adding a label when I add a FormComponent.
If you are going to have to add extra containers anyway, you could try it the way we do it on my project. In the html, we add both a label and input element with wicket ids. to keep it simple, the label's id is the same as the related component's id with label appended to it. Then, we have a createLabel method that takes the Component and it automatically adds the label with the proper id. TextField message = new TextField(message); message.setLabel(new Model(Message)); add(message); createFieldLabel(this, message); protected FormComponentLabel createFieldLabel(final MarkupContainer container, final FormComponent formComponent) { FormComponentLabel label = new FieldLabel(formComponent.getId() + Label, formComponent); container.add(label); return label; } Chuck igor.vaynberg wrote: put a container around your component and update that via ajax instead -igor On 10/4/07, Clay Lehman [EMAIL PROTECTED] wrote: I implemented a simple IComponentBorder, and anything I put in the beforeRender gets added again every time I try to update the component with AJAX. My IcomponentBorder has: public void renderBefore(Component component) { Response resp = component.getResponse(); resp.write(Label); } To update the input box using AJAX I have a behavior: Input1.add(new AjaxFormComponentUpdatingBehavior(onchange) { protected void onUpdate(AjaxRequestTarget target) { theItem.name=new value; target.addComponent(input2) } }); When I do target.addComponent(input2), the renderBefore adds Label again, so the HTML looks like: Label Label input wicket:id=input2/ Am I using IComponentBorder wrong? Thanks for any help! -Clay -Original Message- From: Igor Vaynberg [mailto:[EMAIL PROTECTED] Sent: Thursday, October 04, 2007 11:13 AM To: users@wicket.apache.org Subject: Re: Adding a label when I add a FormComponent. see icomponentborder -igor On 10/4/07, Clay Lehman [EMAIL PROTECTED] wrote: Hey Everyone, I want to create a subclass of a Form Component (Let's use TextField for this example) which takes a String in the constructor, and automatically adds the HTML for a Label before the field. I want to provide all the default functionality of a TextField (like adding behaviors, and validators), so I don't think a Panel will work for me. I found a post where it mentioned (as a hack)to override onRender to add HTML for the label directly, but this runs into problems when you include the Component in an AJAX page (whenever you re-add the component, it calls onRender, and you add the HTML for the label multiple times. Is there a way to do this using SimpleFormComponentLabel, or some other construct? Could I use FormComponentPanel? Or is there some configuration and functionality in AbstractTextCompnent and TextField which I would lose by using a FormComponentPanel? Thanks for any advice!! -Clay Lehman - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- View this message in context: http://www.nabble.com/Adding-a-label-when-I-add-a-FormComponent.-tf4569428.html#a13047069 Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: RequestCycle?
I don't know that 1.1 has a tar. My project uses maven, so it was a snap to add the Databinder bits to our pom. Here is the page that gives the databinder snapshot repo info: http://databinder.net/site/show/faq#updates If you don't use maven, I could always send a 1.1-SNAPSHOT directly to you... FYI, The databinder site has some examples that help with learning how to use and adapt the code to your own project. Chuck Stanczak Group wrote: Probably not. I'll probably use it when I get a chance. I just downloaded the 1.0 tar and saw it's using 1.2 Wicket. Shot me the link and I'll see if I can give it a shot tonight. ChuckDeal wrote: Stanczak Group wrote: I'm not for sure what to use. I tried to override the newRequestCycle() but I had trouble understanding it. I'm doing something like what DataBinder does, but with 1.3. DataBinder seems to be 1.2. Either way I'd rather use my own. Does anyone have an example of providing my own request cycle, or is there an easier way? Sam Hough wrote: I think it is setup with ThreadLocal so you can get it easily with RequestCycle.get(). You can also provide your own version from Application.newRequestCycle which might be more what you need to hook in start/end events. Stanczak Group wrote: How can I access the request cycle so I can open and close a Hibernate session on each request? -- Justin Stanczak Stanczak Group 812-735-3600 DataBinder (1.1-SNAPSHOT) definitely works with 1.3. Databinder also does a pretty good job of integrating Hibernate into the Wicket models. Is there a use case for which Databinder does not work for you? Chuck -- Justin Stanczak Stanczak Group 812-735-3600 All that is necessary for the triumph of evil is that good men do nothing. Edmund Burke - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- View this message in context: http://www.nabble.com/RequestCycle--tf4569125.html#a13047854 Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Adding a label when I add a FormComponent.
Is there a way to tell if a request is coming via AJAX instead of a normal request? If there is a way to do this, I could disable my ComponentBorder on secondary AJAX requests, and only use it on the original request... Thanks, -Clay -Original Message- From: Igor Vaynberg [mailto:[EMAIL PROTECTED] Sent: Thursday, October 04, 2007 2:09 PM To: users@wicket.apache.org Subject: Re: Adding a label when I add a FormComponent. put a container around your component and update that via ajax instead -igor On 10/4/07, Clay Lehman [EMAIL PROTECTED] wrote: I implemented a simple IComponentBorder, and anything I put in the beforeRender gets added again every time I try to update the component with AJAX. My IcomponentBorder has: public void renderBefore(Component component) { Response resp = component.getResponse(); resp.write(Label); } To update the input box using AJAX I have a behavior: Input1.add(new AjaxFormComponentUpdatingBehavior(onchange) { protected void onUpdate(AjaxRequestTarget target) { theItem.name=new value; target.addComponent(input2) } }); When I do target.addComponent(input2), the renderBefore adds Label again, so the HTML looks like: Label Label input wicket:id=input2/ Am I using IComponentBorder wrong? Thanks for any help! -Clay -Original Message- From: Igor Vaynberg [mailto:[EMAIL PROTECTED] Sent: Thursday, October 04, 2007 11:13 AM To: users@wicket.apache.org Subject: Re: Adding a label when I add a FormComponent. see icomponentborder -igor On 10/4/07, Clay Lehman [EMAIL PROTECTED] wrote: Hey Everyone, I want to create a subclass of a Form Component (Let's use TextField for this example) which takes a String in the constructor, and automatically adds the HTML for a Label before the field. I want to provide all the default functionality of a TextField (like adding behaviors, and validators), so I don't think a Panel will work for me. I found a post where it mentioned (as a hack)to override onRender to add HTML for the label directly, but this runs into problems when you include the Component in an AJAX page (whenever you re-add the component, it calls onRender, and you add the HTML for the label multiple times. Is there a way to do this using SimpleFormComponentLabel, or some other construct? Could I use FormComponentPanel? Or is there some configuration and functionality in AbstractTextCompnent and TextField which I would lose by using a FormComponentPanel? Thanks for any advice!! -Clay Lehman - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Is Wicket suitable for my CMS?
Eelco Hillenius wrote: On 9/28/07, pierobo [EMAIL PROTECTED] wrote: I.e., in the parent HTML page he could put a block representing a browse able list of childs. Yeah, I think Wicket is very suitable for what you want to do. So, I need a heavy component oriented framework, and Wicket seems to be suitable. But, for what I understood, Wicked is driven by pages. I would instead drive the presentation by some action (i.e. www.mycms.com/view/MyEntity/id/123), look into information system, find the suitable html page and then render it. You can implement that just the same. Replace your idea of actions by pages, and use a custom URL mapping to achieve that. There's multiple ways to do it. Learn how bookmarkable pages (would be your actions) work, and how to dynamically construct Wicket pages (investigate panels). Eelco Thanks for your reply, that's what I think after reading better this forum. And thanks to you all for remembering me that ever exists a better way to do things. Your posts about Wicket and Model 2 approaches helped me to match my OOP passion and my Web programming needs. Hope I can follow this way like I would. Bye -- View this message in context: http://www.nabble.com/Is-Wicket-suitable-for-my-CMS--tf4536847.html#a13048614 Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Adding to response header (filename)?
How can I do this in Wicket? I'm writing a csv generated file to the output, but I don't know how to tell the client what file name to use. This is what I was using before, is there another way? getResponse().setHeader(Content-Disposition, attachment;filename=\export_ + formatFile.format(Calendar.getInstance().getTime()) + .csv\); Code## getResponse().setContentType(text/csv); getResponse().setHeader(Content-Disposition, attachment;filename=\export_ + formatFile.format(Calendar.getInstance().getTime()) + .csv\); OutputStream cout = getResponse().getOutputStream(); cout.write(out.toString().getBytes()); cout.flush(); cout.close(); -- Justin Stanczak Stanczak Group 812-735-3600 All that is necessary for the triumph of evil is that good men do nothing. Edmund Burke - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Adding a label when I add a FormComponent.
WebRequest.isAjax() Eelco On 10/4/07, Clay Lehman [EMAIL PROTECTED] wrote: Is there a way to tell if a request is coming via AJAX instead of a normal request? If there is a way to do this, I could disable my ComponentBorder on secondary AJAX requests, and only use it on the original request... Thanks, -Clay -Original Message- From: Igor Vaynberg [mailto:[EMAIL PROTECTED] Sent: Thursday, October 04, 2007 2:09 PM To: users@wicket.apache.org Subject: Re: Adding a label when I add a FormComponent. put a container around your component and update that via ajax instead -igor On 10/4/07, Clay Lehman [EMAIL PROTECTED] wrote: I implemented a simple IComponentBorder, and anything I put in the beforeRender gets added again every time I try to update the component with AJAX. My IcomponentBorder has: public void renderBefore(Component component) { Response resp = component.getResponse(); resp.write(Label); } To update the input box using AJAX I have a behavior: Input1.add(new AjaxFormComponentUpdatingBehavior(onchange) { protected void onUpdate(AjaxRequestTarget target) { theItem.name=new value; target.addComponent(input2) } }); When I do target.addComponent(input2), the renderBefore adds Label again, so the HTML looks like: Label Label input wicket:id=input2/ Am I using IComponentBorder wrong? Thanks for any help! -Clay -Original Message- From: Igor Vaynberg [mailto:[EMAIL PROTECTED] Sent: Thursday, October 04, 2007 11:13 AM To: users@wicket.apache.org Subject: Re: Adding a label when I add a FormComponent. see icomponentborder -igor On 10/4/07, Clay Lehman [EMAIL PROTECTED] wrote: Hey Everyone, I want to create a subclass of a Form Component (Let's use TextField for this example) which takes a String in the constructor, and automatically adds the HTML for a Label before the field. I want to provide all the default functionality of a TextField (like adding behaviors, and validators), so I don't think a Panel will work for me. I found a post where it mentioned (as a hack)to override onRender to add HTML for the label directly, but this runs into problems when you include the Component in an AJAX page (whenever you re-add the component, it calls onRender, and you add the HTML for the label multiple times. Is there a way to do this using SimpleFormComponentLabel, or some other construct? Could I use FormComponentPanel? Or is there some configuration and functionality in AbstractTextCompnent and TextField which I would lose by using a FormComponentPanel? Thanks for any advice!! -Clay Lehman - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Wicket training:50% discount this weekend on next 3 bookings
Off you subject here, but is there any US training? jweekend wrote: The 2 day London http://jweekend.co.uk/dev/JW703/ Wicket 1.3 course this weekend still has plenty of room! Since it has been scheduled on demand and without much notice, and to give people a chance who maybe wouldn't otherwise get the opportunity to be professionally trained in Wicket, we are offering a 50% discount to the next three people to http://jweekend.co.uk/dev/BookingPage/ book a place. You will also get your free licence to WiA MEAP. Copy and paste this promotion code into your cart: JW70310060750WU Regards - Cemal http://jWeekend.co.uk jWeekend.co.uk -- Justin Stanczak Stanczak Group 812-735-3600 All that is necessary for the triumph of evil is that good men do nothing. Edmund Burke - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Adding to response header (filename)?
This works: getWebRequestCycle().getWebResponse().setContentType(text/csv); getWebRequestCycle().getWebResponse().setHeader(Content-Disposition, attachment;filename=\export_ + formatFile.format(Calendar.getInstance().getTime()) + .csv\); OutputStream cout = getWebRequestCycle().getWebResponse().getOutputStream(); cout.write(out.toString().getBytes()); cout.flush(); cout.close(); But I get this in the logs. How can I do this better? 16:31:45,391 ERROR WebResponse:190 - Unable to redirect to: ?wicket:interface=:2, HTTP Response has already been committed. Stanczak Group wrote: This maybe? Should I be using getWebRequestCycle().getWebResponse() instead of getResponse().? getWebRequestCycle().getWebResponse().setHeader() Stanczak Group wrote: How can I do this in Wicket? I'm writing a csv generated file to the output, but I don't know how to tell the client what file name to use. This is what I was using before, is there another way? getResponse().setHeader(Content-Disposition, attachment;filename=\export_ + formatFile.format(Calendar.getInstance().getTime()) + .csv\); Code## getResponse().setContentType(text/csv); getResponse().setHeader(Content-Disposition, attachment;filename=\export_ + formatFile.format(Calendar.getInstance().getTime()) + .csv\); OutputStream cout = getResponse().getOutputStream(); cout.write(out.toString().getBytes()); cout.flush(); cout.close(); -- Justin Stanczak Stanczak Group 812-735-3600 All that is necessary for the triumph of evil is that good men do nothing. Edmund Burke - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Wicket training:50% discount this weekend on next 3 bookings
The 2 day London http://jweekend.co.uk/dev/JW703/ Wicket 1.3 course this weekend still has plenty of room! Since it has been scheduled on demand and without much notice, and to give people a chance who maybe wouldn't otherwise get the opportunity to be professionally trained in Wicket, we are offering a 50% discount to the next three people to http://jweekend.co.uk/dev/BookingPage/ book a place. You will also get your free licence to WiA MEAP. Copy and paste this promotion code into your cart: JW70310060750WU Regards - Cemal http://jWeekend.co.uk jWeekend.co.uk -- View this message in context: http://www.nabble.com/Wicket-training%3A50--discount-this-weekend-on-next-3-bookings-tf4571612.html#a13049195 Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Adding to response header (filename)?
This maybe? Should I be using getWebRequestCycle().getWebResponse() instead of getResponse().? getWebRequestCycle().getWebResponse().setHeader() Stanczak Group wrote: How can I do this in Wicket? I'm writing a csv generated file to the output, but I don't know how to tell the client what file name to use. This is what I was using before, is there another way? getResponse().setHeader(Content-Disposition, attachment;filename=\export_ + formatFile.format(Calendar.getInstance().getTime()) + .csv\); Code## getResponse().setContentType(text/csv); getResponse().setHeader(Content-Disposition, attachment;filename=\export_ + formatFile.format(Calendar.getInstance().getTime()) + .csv\); OutputStream cout = getResponse().getOutputStream(); cout.write(out.toString().getBytes()); cout.flush(); cout.close(); -- Justin Stanczak Stanczak Group 812-735-3600 All that is necessary for the triumph of evil is that good men do nothing. Edmund Burke - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
How to NOT cause a hot redeploy with Jetty when HTML files change
I have been successfully developing a Wicket application with Eclipse, Maven, and the Maven Jetty plugin with hot redeploy enabled. However, I don't want Jetty to do a hot redeploy of the application when I make a change to my HTML files. I assume that Wicket will pick up these changes automatically when running in Development mode, so there should be no need to reload the whole app. I have both Eclipse and Maven compiling classes to the same directory (target/classes) so that when I make a change to a class in eclipse, Jetty picks up the change and does a hot redeploy. This is a good thing. Since my HTML files are located along side my classes, my HTML files are also automatically copied by eclipse into my target/classes dir structure. This should be a good thing too, but read on... The problem is that whenever an HTML file changes and eclipse copies it to my target/classes dir, jetty picks this up and reploys the application. I've tried adding a ScanTargetPatterns section to my jetty plugin configuration, but it doesn't work. Here is what I added: scanTargetPatterns scanTargetPattern directorytarget/classes/directory excludes exclude**/*.html/exclude /excludes /scanTargetPattern /scanTargetPatterns Has anyone else got this to work, and if so, how? Your help is much appreciated. -- Jason -- View this message in context: http://www.nabble.com/How-to-NOT-cause-a-hot-redeploy-with-Jetty-when-HTML-files-change-tf4571849.html#a13049928 Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: webpage instance scope?
I think I understand your explanations yet I struggle to see how scenario I was describing is optimization-only. Consider these scenarios: Shopping w/o signing in. 1.I go to amazon.com and fill my shopping cart with stuff without signing in. 2.I navigate away to somewhere else and short time later ( HttpSession timeout) type in 'amazon.com' to go back. At this point I'd still expect to see my cart's content. My Home Page is a portal 1. My home page is my.yahoo.com. When I launch my browser I get authenticated via a previously-stored cookie. 2.During the course of the same browser session I can navigate away to another site and then hit CTRL+H to go to my home page again. 3.As I land on my.yahoo.com seems that I am *not* re-authenticated from a persistent cookie - instead a cookie issued in #1 is used to locate my server-side state. In both of these scenarios NOT retrieving state from steps #1 is not merely a non-optimization - but unexpected behavior. Do you agree? No I don't. This is where bookmarkable pages are meant for. In both cases you would use cookies, and these bookmarkable pages read the cookies to determine what's in the cart. Eelco - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Wicket Meetup Amsterdam: a proposal
Excellent! That is only 4 blocks from where I work :) Also, all those dates are fine by me. Just an opinion: I do not expect any presentations; just a get together for a couple of hours is nice. Erik. -- Erik van Oosten http://2008.rubyenrails.nl/ http://day-to-day-stuff.blogspot.com/ Arje Cahn schreef: Hi Johan, all, i also have been asking around for a big room. And Servoy is willing to sponser a big room if needed (if there are really comming 30+ people) That's excellent news! :) Do you think the dates and location I suggested will work? These are the dates I made a reservation for: Friday November 23rd Monday November 26th Friday November 30th I didn't book any rooms yet, I just called the venue to ask which dates are still open and block them in the meantime. When we say GO for any of these three days, they'll book it for us. However, if someone has a better idea, please speak up! :) The venue is right in the center of Amsterdam, http://maps.google.com/maps?f=qhl=engeocode=time=date=ttype=q=Keizersgracht+324,+amsterdamsll=37.0625,-95.677068sspn=26.339531,58.710937ie=UTF8z=16iwloc=addrom=1 Arjé - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Best approach to localization
Hello, the *pub* example (http://wicketstuff.org/wicket13/pub/) shows how a localized string can be retrieved from a properties file and then dinamically inserted in a page. Still, with the exception of that string, the remaining markup is kept static, which results in separated, localized HTML files for each locale. So is this the current best practice regarding localization in Wicket? Or would it be better to replace all static UI labels with dynamic Wicket labels such that their localized values are defined in the corresponding properties files? I'm asking because the 2nd option, even though it allows the production of a single HTML file for all locales, obviously has a higher development cost... Would the benefit be high enough to justify that choice? Thanks so much, Cristina -- View this message in context: http://www.nabble.com/Best-approach-to-localization-tf4572706.html#a13052285 Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Best approach to localization
the *pub* example (http://wicketstuff.org/wicket13/pub/) shows how a localized string can be retrieved from a properties file and then dinamically inserted in a page. Still, with the exception of that string, the remaining markup is kept static, which results in separated, localized HTML files for each locale. So is this the current best practice regarding localization in Wicket? Or would it be better to replace all static UI labels with dynamic Wicket labels such that their localized values are defined in the corresponding properties files? I'm asking because the 2nd option, even though it allows the production of a single HTML file for all locales, obviously has a higher development cost... Would the benefit be high enough to justify that choice? Best way to go is probably to use wicket:message tags for static blocks that need to be localized. Eelco - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Best approach to localization
Best way to go is probably to use wicket:message tags for static blocks that need to be localized. To illustrate that, I just committed an alternative implementation of pub (called pub2). Please look and compare! :-) Eelco - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
ModalWindow.close() results in ERROR: Exception evaluating javascript: TypeError: window.parent.setTimeout is not a function
I am trying to use the ModalWindow as a confirmation dialog and it works fine on one page but the same code on a different page produces the above error. Closing the ModalWindow with the X in the corner work fine. The error occurs when the AjaxCallbackLink onClick handler calls ModalWindow.close(); On the page that isn't working the following code is called as the last thing in the page constructor. // The delete dialog ModalWindow deleteDialog = new ModalWindow(deleteDialog); mConfirmationPanel = new ConfirmationPanel(deleteDialog.getContentId(), new WUIResourceModel(CampaignManagerPage.class, deleteDialogQuestion), this, deleteDialog); deleteDialog.setContent(mConfirmationPanel); deleteDialog.setInitialWidth(260); deleteDialog.setInitialHeight(80); deleteDialog.setResizable(false); deleteDialog.setTitle(Delete Campaign(s) Confirmation); deleteDialog.setWindowClosedCallback( new ModalWindow.WindowClosedCallback() { private static final long serialVersionUID = 1L; public void onClose(AjaxRequestTarget pRequestTarget) { ... } } } } ); add(deleteDialog); Any ideas? -- View this message in context: http://www.nabble.com/ModalWindow.close%28%29-results-in-ERROR%3A-Exception-evaluating-javascript%3A-TypeError%3A-window.parent.setTimeout-is-not-a-function-tf4573096.html#a13053366 Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]