drag and drop
Hi I am a newbie to wicket and I want to create a page where images can be dragged and dropped. I had a look at wicketstuff-scriptaculous and downloaded the jar file but it is not compatible with wicket 1.3.2. Can someone provide me the link so that I can download the jar file straight away which is compatible with the wicket version that I am using. Any suggestions as to how this should be implemented using wicket is also welcome. eg: wicket-dojo, wicket-jquery, wicket-prototype etc Thanks -- View this message in context: http://www.nabble.com/drag-and-drop-tp22595081p22595081.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: flash with resource
tbt wrote: Hi I am using flash in my web application and currently using the example given at http://cwiki.apache.org/WICKET/object-container-adding-flash-to-a-wicket-application.html This works fine but my swf files are stored in a database and when displayed now is converted back into a swf file and stored in a temperory folder on the server. Then the image path is given to the swf file as provided in the example. But I would like to make this more efficient and like to pass the swf file stored in the db as a 'Resource'. I currently do this with the image files stored in the database like BlobImageResource blobImageResource = new BlobImageResource() { @Override protected Blob getBlob() { return images.getImageFile(); } }; Image uploadImage = new Image(uploadImage,blobImageResource); to display the images in the webpage. How can I do something similar with the 'ShockWaveComponent' class so that a 'Resource' can be passed as a constructor parameter Thanks Hi I came up with the following flash component to display an swf file stored in a database. It is attached above. http://www.nabble.com/file/p21408684/FlashComponent.txt FlashComponent.txt The example given below was used to code this flash component http://cwiki.apache.org/WICKET/how-to-display-a-flash-movie-from-a-byte-array.html The following class was coded by Robert Mattler which reads flash data stored in a file. public class FlashComponent extends WebMarkupContainer implements IResourceListener { int width; int height; String fileName; public FlashComponent(String id, int width, int height, String fileName) { super(id); this.width = width; this.height = height; this.fileName = fileName; } public void onResourceRequested() { getRequestCycle().setRequestTarget(new IRequestTarget() { public void respond(RequestCycle requestCycle) { try { requestCycle.getResponse().getOutputStream().write(getFlashByteArray()); } catch (IOException e) { e.printStackTrace(); } } public void detach(RequestCycle requestCycle) { // TODO Auto-generated method stub } }); } protected void onComponentTagBody(MarkupStream markupStream, ComponentTag openTag) { StringBuffer flashBuffer = new StringBuffer(); // in the following, we will append all the necessary body tags of flash // markup flashBuffer.append(); flashBuffer.append(embed src=\); flashBuffer.append(urlFor(IResourceListener.INTERFACE)); flashBuffer.append(\ width=\); flashBuffer.append(width); flashBuffer.append(\ height=\); flashBuffer.append(height); replaceComponentTagBody(markupStream, openTag, flashBuffer); } protected byte[] getFlashByteArray() { try { File inputFile = new File(fileName); InputStream inStream = new FileInputStream(inputFile); if (inStream != null) { ByteArrayOutputStream out = new ByteArrayOutputStream(); Streams.copy(inStream, out); return out.toByteArray(); } return new byte[0]; } catch (IOException e) { throw new WicketRuntimeException(Error while reading flash data, e); } } } additional comments and suggestions regarding these components are welcome. It would also be great to have a built in wicket flash component like 'Image' which has many constructors so that users could pass the filename, width, height or even a 'Resource' as a parameter. Thanks -- View this message in context: http://www.nabble.com/flash-with-resource-tp20698407p21408684.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: DateTimeField Error and Question
Christoph Bach wrote: Hi, I am using the org.apache.wicket.extensions.yui.calendar.DateTimeField 1. If I enter a date say 1.1.1955 in the textfield, the textfield strips ist to 01.01.55. The first time I click on the Calendar icon, the calendar shows the year 1955. From the second click on, the Calendar shows the wrong year 2055. a, How can I avoid this Error? b, How can I tell the textfield of the DateTiemField to show a 4 digit year? 2. The Calendar has two Arrow-Icons to increment and decrement the month. Is it possible to show a dropdown for the year inside the calendar? Regards Christoph Hi I am not sure if the DateTextField attribute in the DateTimeField class can be modified to change the calendar behavior. But you could use a TextField or a DateTextField and add a DatePicker instance to it like the following example TextField checkInField = new TextField(checkInField ,new PropertyModel(searchModel,checkInDate)); DatePicker checkInPicker = new DatePicker() { protected String getDatePattern() { return dd/MMM/; } }; checkInField.add(checkInPicker); regards -- View this message in context: http://www.nabble.com/DateTimeField-Error-and-Question-tp21221202p21239433.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
unit test for dropdownchoice with ajax
Hi I have coded two dropdown boxes similar to the example provided at http://http://www.wicket-library.com/wicket-examples/ajax/choice.1 The hotel dropdown is populated once a country is selected via ajax. This works fine and now i am writing a unit test for it. The code is as follows WicketTester wicketTester = getWicketTester(); wicketTester.startPage(SearchHotelsPage.class); FormTester formTester = wicketTester.newFormTester(searchHotelsForm,false); formTester.select(countryDropDown, 6); DropDownChoice countryDropDownChoice = (DropDownChoice) wicketTester.getComponentFromLastRenderedPage(searchHotelsForm:countryDropDown); assertEquals(countryDropDownChoice.getChoices().size(), 41); wicketTester.executeAjaxEvent(searchHotelsForm:countryDropDown, onchange); wicketTester.assertComponentOnAjaxResponse(searchHotelsForm:hotelDropDown); formTester.select(hotelDropDown, 12); formTester.submit(); wicketTester.assertRenderedPage(EditHotelsPage.class); but the following line fails the unit test wicketTester.assertRenderedPage(EditHotelsPage.class); the stack trace is as follows junit.framework.AssertionFailedError: expected:EditHotelsPage but was:HomePage at org.apache.wicket.util.tester.WicketTester.assertResult(WicketTester.java:575) at org.apache.wicket.util.tester.WicketTester.assertRenderedPage(WicketTester.java:522) at ogn.forms.SearchHotelsFormTest.testAjaxDropdownComponent(SearchHotelsFormTest.java:28) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at junit.framework.TestCase.runTest(TestCase.java:164) at junit.framework.TestCase.runBare(TestCase.java:130) at junit.framework.TestResult$1.protect(TestResult.java:106) at junit.framework.TestResult.runProtected(TestResult.java:124) at junit.framework.TestResult.run(TestResult.java:109) at junit.framework.TestCase.run(TestCase.java:120) at junit.framework.TestSuite.runTest(TestSuite.java:230) at junit.framework.TestSuite.run(TestSuite.java:225) at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196) Why does the page get rendered to the HomePage when the form is submitted. Am I testing the ajax dropdown component correctly. Please help. Thanks -- View this message in context: http://www.nabble.com/unit-test-for-dropdownchoice-with-ajax-tp21141772p21141772.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Dynamic Select and SelectOptions
homar70 wrote: Hi, I have trouble of finding out how to make dynamic optgroups and options from the select and selectoptions in wicket-extensions. The same issue is described in this post http://www.nabble.com/Select-and-SelectOptions-td11684707.html#a11695243 Any ideas? -Spratle Hi You could use the following classes in wicket-extensions to create an optgroup class. I have created a static dropdown with optgroups and the example is given below. A repeater like ListView or RepeatingView can be used to make it dynamic public class OptGroup extends SelectOption { String label; public OptGroup(String id, String label) { super(id); this.label = label; } protected void onComponentTag(final ComponentTag tag) { checkComponentTag(tag, optgroup); Select select = (Select)findParent(Select.class); if (select == null) { throw new WicketRuntimeException( OptGroup component [ + getPath() + ] cannot find its parent Select. All OptGroup components must be a child of or below in the hierarchy of a Select component.); } tag.put(label, label); } } public class CustomSelectOption extends SelectOption { public CustomSelectOption(String id,String displayValue) { super(id,new Model(displayValue)); } protected void onComponentTagBody(final MarkupStream markupStream, final ComponentTag openTag) { replaceComponentTagBody(markupStream, openTag, getModelObjectAsString()); } } ... OptGroup swedishOptGroup = new OptGroup(optGroup1,Swedish Cars); SelectOption option1 = new CustomSelectOption(option1,Volvo); swedishOptGroup.add(option1); SelectOption option2 = new CustomSelectOption(option2,Saab); swedishOptGroup.add(option2); select.add(swedishOptGroup); OptGroup germanOptGroup = new OptGroup(optGroup2,German Cars); SelectOption option3 = new CustomSelectOption(option3,Mercedes); germanOptGroup.add(option3); SelectOption option4 = new CustomSelectOption(option4,Audi); germanOptGroup.add(option4); select.add(germanOptGroup); .. select wicket:id=select optgroup wicket:id=optGroup1 option wicket:id=option1/option option wicket:id=option2/option /optgroup optgroup wicket:id=optGroup2 option wicket:id=option3/option option wicket:id=option4/option /optgroup /select -- View this message in context: http://www.nabble.com/Dynamic-Select-and-SelectOptions-tp21076798p21155450.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
flash with resource
Hi I am using flash in my web application and currently using the example given at http://cwiki.apache.org/WICKET/object-container-adding-flash-to-a-wicket-application.html This works fine but my swf files are stored in a database and when displayed now is converted back into a swf file and stored in a temperory folder on the server. Then the image path is given to the swf file as provided in the example. But I would like to make this more efficient and like to pass the swf file stored in the db as a 'Resource'. I currently do this with the image files stored in the database like BlobImageResource blobImageResource = new BlobImageResource() { @Override protected Blob getBlob() { return images.getImageFile(); } }; Image uploadImage = new Image(uploadImage,blobImageResource); to display the images in the webpage. How can I do something similar with the 'ShockWaveComponent' class so that a 'Resource' can be passed as a constructor parameter Thanks -- View this message in context: http://www.nabble.com/flash-with-resource-tp20698407p20698407.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
date picker
Hi I'm using wicket 1.3.2 and downloaded wicket-contrib-datepicker-1.2 because I want to use a date picker for my application. But this release is not compatible with wicket 1.3 because it gives errors. Can someone give me the link to download a date picker component that is compatible with wicket 1.3 Thanks -- View this message in context: http://www.nabble.com/date-picker-tp20317456p20317456.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
update dropdown with ajax
Hi I have a problem regarding how to update a dropdown with ajax when an option is added through a popup window. For example Page A has a dropdown and a link. When the link is clicked a popup opens and dropdown options can be added to the popup page. when the form is submitted by clicking 'add' the db is updated and the popup window is closed. but the dropdown in the parent window needs to be updated with ajax. how can this be done the wicket way. please provide an example. Thanks -- View this message in context: http://www.nabble.com/update-dropdown-with-ajax-tp19606658p19606658.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
user input not persisting during error validation
Hi I'm new to wicket and i'm using a Form class with several nested Panels which are generated dynamically using a listview. But during error validation the user input values only persist in the form input fields but disappear from input fields which are nested inside a panel. I'm passing the same model so why is this happening. Sample Code Class SampleForm extends Form { . TextField name = new TextField(name,new PropertyModel(sampleModel,name)); ListView listview = new ListView(listView,sampleModel.getPanelList()) { protected void populateItem(ListItem item) { SupplierModel supplierModel = item.getModelObject(); SupplierPanel supplierPanel = new SupplierPanel(supplierPanel,supplierModel ); item.add(supplierPanel ); } }; } SupplierPanel extends panel { SupplierPanel(String id,SupplierModel supplierModel) { ... add(new TextField(supplier,new PropertyModel(supplierModel,supplier))); ... } } The user input is not persisting in add(new TextField(supplier,new PropertyModel(supplierModel,supplier))); only during error validation. Please help Thanks -- View this message in context: http://www.nabble.com/user-input-not-persisting-during-error-validation-tp18564435p18564435.html 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: user input not persisting during error validation
I'm using a submitlink to submit the form. The submit link is included inside the form component. public class SampleForm extends Form { .. SubmitLink link = new SubmitLink(addTourLink) { public void onSubmit() { setResponsePage(new ConfirmationPage()); } }; } tbt wrote: Hi I'm new to wicket and i'm using a Form class with several nested Panels which are generated dynamically using a listview. But during error validation the user input values only persist in the form input fields but disappear from input fields which are nested inside a panel. I'm passing the same model so why is this happening. Sample Code Class SampleForm extends Form { . TextField name = new TextField(name,new PropertyModel(sampleModel,name)); ListView listview = new ListView(listView,sampleModel.getPanelList()) { protected void populateItem(ListItem item) { SupplierModel supplierModel = item.getModelObject(); SupplierPanel supplierPanel = new SupplierPanel(supplierPanel,supplierModel ); item.add(supplierPanel ); } }; } SupplierPanel extends panel { SupplierPanel(String id,SupplierModel supplierModel) { ... add(new TextField(supplier,new PropertyModel(supplierModel,supplier))); ... } } The user input is not persisting in add(new TextField(supplier,new PropertyModel(supplierModel,supplier))); only during error validation. Please help Thanks -- View this message in context: http://www.nabble.com/user-input-not-persisting-during-error-validation-tp18564435p18564531.html 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: disabling error validation
Hi Thanks for the link. But my form doesnt have static components like in the example. All the form components are dynamic and generated using ListViews and are nested inside panels. Is there a way to traverse the component hierarchy with a loop and call validate() on each component. Please provide an example. Thanks Serkan Camurcuoglu-2 wrote: this link may help you a bit.. http://cwiki.apache.org/WICKET/conditional-validation.html tbt wrote: Hi But I need the component models to be updated. Thats why i'm using a SubmitLink instead of using a Link. I was hoping there was a simple method to disable form validation with the SubmitLink such as 'link2.setFormValidation(false)' or something like that. Is there a way to disable validations for some links and enable validations for others, yet at the same time update the form components when the links are clicked. Please provide a simple example. Thanks ZedroS wrote: Hi If you don't want our form to be validated, why do you use a SubmitLink ? A simple Link wouldn't trigger the validation. Isn't that what you're looking for ? ++ zedros - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- View this message in context: http://www.nabble.com/disabling-error-validation-tp18375841p18397964.html 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: disabling error validation
Hi But I need the component models to be updated. Thats why i'm using a SubmitLink instead of using a Link. I was hoping there was a simple method to disable form validation with the SubmitLink such as 'link2.setFormValidation(false)' or something like that. Is there a way to disable validations for some links and enable validations for others, yet at the same time update the form components when the links are clicked. Please provide a simple example. Thanks ZedroS wrote: Hi If you don't want our form to be validated, why do you use a SubmitLink ? A simple Link wouldn't trigger the validation. Isn't that what you're looking for ? ++ zedros -- View this message in context: http://www.nabble.com/disabling-error-validation-tp18375841p18377623.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
disabling error validation
Hi I'm a newbie to wicket and I have a form which has several text fields and two SubmitLinks. eg:- class MyForm extends Form { public MyForm(String id) { super(id); TextField textField = new TextField(field1); textField.setRequired(true); SubmitLink link1 = new SubmitLink(link1) { public void onSubmit() { // go to page A } } SubmitLink link2 = new SubmitLink(link2) { public void onSubmit() { // go to page B } } } } I would like to know a way to stop the form components being validated when link1 is clicked and the form components to be validated as usual when link2 is clicked. On both occasions the form should get submitted and the models updated. Is there a way to do this the wicket way. Please provide an example. Thanks -- View this message in context: http://www.nabble.com/disabling-error-validation-tp18375841p18375841.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Anchor Links
Hi I'm new to wicket and I have a listview which dynamically creates links. I'm using the following code to anchor links so that when the user clicks a link, it will be directed to the correct area in the page. protected void populateItem(ListItem item) { Link boardLink = new Link(boardLink) { public void onClick() { } }; Label descriptionLabel = new Label(description); descriptionLabel.setOutputMarkupId(true); boardLink.setAnchor(descriptionLabel); item.add(descriptionLabel); item.add(boardLink ); } .. However this code is not working. How should i modify the code. Thanks -- View this message in context: http://www.nabble.com/Anchor-Links-tp16930767p16930767.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Hibernate with wicket
Hi I'm using a static block to save resources so that hibernate does not have to initialize a session each time a transaction needs to be done. static SessionFactory sessionFactory; static { try { Configuration hibernateConfig = new Configuration(); URL cfg = HibernateSession.class.getResource(hibernate.cfg.xml); sessionFactory = hibernateConfig.configure(cfg).buildSessionFactory(); } catch (Exception e) { e.printStackTrace(); } } public Session getHibernateSession() { return sessionFactory.openSession(); } ... Is this method a correct way to integrate hibernate with wicket and also saving resources at the same time. (If I create an instance of a SessionFactory, the application runs very slowly) Thanks tbt -- View this message in context: http://www.nabble.com/Hibernate-with-wicket-tp16607352p16607352.html 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: Hibernate with wicket
Hi Can anyone tell me the list of jar files that are needed to run databinder. I am having trouble running the baseball example. Thanks tbt adrienleroy wrote: you can take a look at the databinder project : http://databinder.net/ tbt wrote: Hi I'm using a static block to save resources so that hibernate does not have to initialize a session each time a transaction needs to be done. static SessionFactory sessionFactory; static { try { Configuration hibernateConfig = new Configuration(); URL cfg = HibernateSession.class.getResource(hibernate.cfg.xml); sessionFactory = hibernateConfig.configure(cfg).buildSessionFactory(); } catch (Exception e) { e.printStackTrace(); } } public Session getHibernateSession() { return sessionFactory.openSession(); } ... Is this method a correct way to integrate hibernate with wicket and also saving resources at the same time. (If I create an instance of a SessionFactory, the application runs very slowly) Thanks tbt -- View this message in context: http://www.nabble.com/Hibernate-with-wicket-tp16607352p16608597.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
property file
Hi, I like to know a way to read a property file the wicket way. Currently i'm using the following code snippet but i get the PackageResourceBlockedException. /*...*/ Properties properties = new Properties(); properties.load(PackageResource.get(ApplicationProperties.class, app.properties).getResourceStream().getInputStream()); String propertyName = properties.getProperty(name); propertyFile.close(); return propertyName; /*...*/ Is this the correct way to get property files using wicket. My app.properties file and ApplicationProperties.class is in the same package. I like to know a way to load property files which are stored in the same package as the class file. Thanks tbt -- View this message in context: http://www.nabble.com/property-file-tp16537257p16537257.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
wicket link
hi I'm a newbie to wicket and i would like to know to give a static url reference from a link component I tried the following google Link link = Link(wicketLink) { protected void onComponentTag(final ComponentTag tag) { super.onComponentTag(tag); tag.put(href,http://www.google.com;); } } ... but this is not possible because cannot onComponentTag method as it is marked final. How do i give urls from a java class to a tag Thanks tbt -- View this message in context: http://www.nabble.com/wicket-link-tp16295833p16295833.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
file uploads
Hi I am using the file upload component in wicket and I like to set the folder path to save uploaded files. Folder folder = new Folder(Uploads); folder.mkdirs(); File newFile = new File(folder,fileUpload.getClientFileName()); This code snippet saves the files in a folder called 'uploads' but is created inside the resin folder. How do I specify a relative path so that a folder is created inside my project directory thanks tbt -- View this message in context: http://www.nabble.com/file-uploads-tp16249006p16249006.html 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: hibernate
Hi How do you create a hibernate session in the class that extends the WebApplication class. is it possible to override protected void init() here and create a single static hibernate session so i can use that session instance in other places. Please provide me with an example. Thanks tbt igor.vaynberg wrote: not to mention you should not be creating session factories inside pages. you should only have a single instance of session factory per application... -igor On Tue, Mar 18, 2008 at 6:02 AM, Maurice Marrink [EMAIL PROTECTED] wrote: Typically the hibernate.cfg.xml is located in the root of your packages and the configuration is loaded in the application like this: hibernateConfig = new AnnotationConfiguration(); URL cfg = getClass().getResource(/hibernate.cfg.xml); hibernateConfig.configure(cfg); Your main problem is that you cannot get to the webapps directory from within the application's classloader. Maurice On Tue, Mar 18, 2008 at 1:50 PM, tbt [EMAIL PROTECTED] wrote: Hi I'm new to hibernate and I have a problem as the wicket page class does not detect the hibernate.cfg.xml file The code is as follows public class InfoPage extends WebPage { private static Logger log = Logger.getLogger(InfoPage.class.getName()); public InfoPage() { Session session = null; try{ // This step will read hibernate.cfg.xml and prepare hibernate for use SessionFactory sessionFactory = new Configuration() .configure(webapps/ExampleHib/Resources/hibernate.cfg.xml).buildSessionFactory(); session =sessionFactory.openSession(); //Create new instance of Contact and set values in it by reading them from form object log.info(Inserting Record); Contact contact = new Contact(); contact.setId(6); contact.setFirstName(Deepak); contact.setLastName(Kumar); contact.setEmail([EMAIL PROTECTED]); session.save(contact); log.info(Done); }catch(Exception e){ e.printStackTrace(); }finally{ // Actual contact insertion will happen at this step session.flush(); session.close(); } } } The hibernate.cfg.xml file is in ExampleHib/Resources/hibernate.cfg.xml folder. The application is run on tomcat. Is this the correct way to do this. Please provide your feedback as the way to integrate wicket with hibernate in a very simple example as I am new to hibernate. tbt -- View this message in context: http://www.nabble.com/hibernate-tp16120516p16120516.html Sent from the Wicket - User mailing list archive at Nabble.com. - 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] -- View this message in context: http://www.nabble.com/hibernate-tp16120516p16143528.html 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: Localization
Hi, I also found out that can also use input type=button class=button wicket:message=value=button.label / with WicketMessageTagHandler.enable = true in the application init method. Thanks Thomas Gier-2 wrote: tbt wrote: Hi I tried to add a attribute to a html tag using the wicket:message tag. The code is as follows HomePage.html input type=button class=button wicket:message=value:button.label / HomePage.properties button.label=save This method didnt display the label in the html page. Then in the applications init() method I added WicketMessageTagHandler.enable = true; and modified the tag as input type=button class=button wicket:message key=value:button.label / but still it is not working. Can someone tell me how to add an attribute to a tag using wicket:message Thanks Nadeeshan Erik van Oosten-3 wrote: Yes, this is possible. But actually the previous solution is usally sufficient. You can easily define a page that is extended by all other pages. In the base page you can include the stylesheet as before and all other pages will get it too. (See the wiki for component inheritance.) But anyway, here is a non tested approach: - move the style.css (and variations) somewhere on your classpath. For example in the package that contains the java file JustSomeClass.java. - remove the wicket:link from the markup file - give the stylesheet link a wicket:id, eg.: link rel=stylesheet type=text/css href=style.css wicket:id=abc/link - in the code do something like: add(new StyleSheetReference(abc, JustSomeClass.class, style.css)) Regards, Erik. tbt wrote: Hi, I like to have my css file('style.css') in a seperate folder instead of having it in the same folder as HomePage.java because multiple web pages are using the same classes in the css file. Is it possible to have both css files(style.css and style_tw.css) in a seperate folder. This applies for only css files and not property files which I would be happy to keep in the same folder as the html and java files. Thanks Erik van Oosten-3 wrote: You can call: getSession().setLocale(new Locale(en, US)) In the Java javadocs (http://java.sun.com/j2se/1.4.2/docs/api/java/util/Locale.html) you find references to language and country codes. Language code ta means Tamil so that is probably not what you want. Country Taiwan is represented by county code TW. Switching css is fairly easy. Put this in the header: wicket:linklink rel=stylesheet type=text/css href=style.css/link/wicket:link and move style.css to the same folder as HomePage.html. Now if you want to add another locale for the stylesheet, you just add a file called style_[language code].css. No other changes needed. Regards, Erik. tbt wrote: Hi I have a html page called HomePage.html html head link href=Resources/css/style.css rel=stylesheet type=text/css / /head body English Taiwanese wicket:message key=option_id / /body /html and two property files called HomePage.properties and HomePage_ta.properties. These files hold the values which should be replaced inside the wicket:message tag. How can I switch between these property files once the user selects a particular language inside my HomePage .java class. I also need to change the css file according to each language. eg:- If Taiwanese is selected it should look like link href=Resources/css/style_ta.css rel=stylesheet type=text/css / Thanks - 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] Hi, I use AttributeModifier / AttributeAppender to add attributes to HTML elements. Something like yourComponent.add(new AttributeModifier(value, true, new ResourceModel(button.label))); should do the trick. The boolean value makes sure that the attribute is added even if it is not present in the HTML. HTH Tom P.S this is my first post to the list so hello to everybody :) ... - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- View this message in context: http://www.nabble.com/Localization-tp15036142p15084381.html 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: Localization
Hi, I like to have my css file('style.css') in a seperate folder instead of having it in the same folder as HomePage.java because multiple web pages are using the same classes in the css file. Is it possible to have both css files(style.css and style_tw.css) in a seperate folder. This applies for only css files and not property files which I would be happy to keep in the same folder as the html and java files. Thanks Erik van Oosten-3 wrote: You can call: getSession().setLocale(new Locale(en, US)) In the Java javadocs (http://java.sun.com/j2se/1.4.2/docs/api/java/util/Locale.html) you find references to language and country codes. Language code ta means Tamil so that is probably not what you want. Country Taiwan is represented by county code TW. Switching css is fairly easy. Put this in the header: wicket:linklink rel=stylesheet type=text/css href=style.css/link/wicket:link and move style.css to the same folder as HomePage.html. Now if you want to add another locale for the stylesheet, you just add a file called style_[language code].css. No other changes needed. Regards, Erik. tbt wrote: Hi I have a html page called HomePage.html html head link href=Resources/css/style.css rel=stylesheet type=text/css / /head body English Taiwanese wicket:message key=option_id / /body /html and two property files called HomePage.properties and HomePage_ta.properties. These files hold the values which should be replaced inside the wicket:message tag. How can I switch between these property files once the user selects a particular language inside my HomePage .java class. I also need to change the css file according to each language. eg:- If Taiwanese is selected it should look like link href=Resources/css/style_ta.css rel=stylesheet type=text/css / Thanks - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- View this message in context: http://www.nabble.com/Localization-tp15036142p15037723.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Localization
Hi I have a html page called HomePage.html html head link href=Resources/css/style.css rel=stylesheet type=text/css / /head body English Taiwanese wicket:message key=option_id / /body /html and two property files called HomePage.properties and HomePage_ta.properties. These files hold the values which should be replaced inside the wicket:message tag. How can I switch between these property files once the user selects a particular language inside my HomePage .java class. I also need to change the css file according to each language. eg:- If Taiwanese is selected it should look like link href=Resources/css/style_ta.css rel=stylesheet type=text/css / Thanks -- View this message in context: http://www.nabble.com/Localization-tp15036142p15036142.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
dynamic url
Hi I'm a newbie to wicket and I'm using a WebSession to log users into my application. When navigating through the pages wicket generates a dynamic url such as http://192.222.7.66:8080/oem?wicket:interface=wicket-1:0:: But if you copy this url and paste it in a seperate tab the inner page is displayed. As a result users can view data without giving the username and password. How can I stop this. Thanks -- View this message in context: http://www.nabble.com/dynamic-url-tp14370171p14370171.html 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: wicket preloader
is there a stable release of wicket-extensions 1.3 Where can I download wicket-extensions 1.3 Thijs wrote: Why redirect? Use a lazyloading panel. Thijs tbt wrote: Hi I like to implement a preloader the wicket way. For example when a user does a search my code looks up the db and retrieves the relevent data. But this takes up a lot of time and i want to show a html page(preloader page) while the db search is done. When the search is completed it will automatically be redirected to a page displaying the results. Can anyone show me an example as how to do this using wicket. Thanks - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- View this message in context: http://www.nabble.com/wicket-preloader-tf4811011.html#a13854141 Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
wicket preloader
Hi I like to implement a preloader the wicket way. For example when a user does a search my code looks up the db and retrieves the relevent data. But this takes up a lot of time and i want to show a html page(preloader page) while the db search is done. When the search is completed it will automatically be redirected to a page displaying the results. Can anyone show me an example as how to do this using wicket. Thanks -- View this message in context: http://www.nabble.com/wicket-preloader-tf4811011.html#a13765110 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: Wicket runtime Exception
Hi Here is the code that uses RadioGroup public class RadioListView extends ListView { /** * */ private static final long serialVersionUID = 1L; //private static Logger log = Logger.getLogger(RadioListView.class.getName()); public RadioListView(String id,ArrayListOptionBean optionList,PaperModel paperModel) { super(id,optionList); } @Override protected void populateItem(ListItem item) { final OptionBean optionBean = (OptionBean) item.getModelObject(); Radio radioButton = new TextRadio(radio,new Model( + optionBean.getOptionId()),optionBean.getOptionId()); item.add(radioButton); Label radioLabel = new Label(radioValue,optionBean.getOptionText()); item.add(radioLabel); if(optionBean.getOptionText() != null .equals(optionBean.getOptionText())) { radioLabel.setVisible(false); } else { radioLabel.setVisible(true); } WebComponent imageLabel = new TextImage(imageLabel,optionBean.getOptionImage()); item.add(imageLabel); if(optionBean.getOptionImage() != null .equals(optionBean.getOptionImage())) { imageLabel.setVisible(false); } else { imageLabel.setVisible(true); } } } msc65jap wrote: Hello, Please send your code. J. On Nov 9, 2007 9:48 AM, tbt [EMAIL PROTECTED] wrote: Hi I'm a newbie to wicket and i'm using RadioGroup in my application. But sometimes it gives the following runtime exception ERROR (RequestCycle.java:1043) - submitted http post value [radio0] for RadioGroup component [27:paperForm:panel:radioGroup] is illegal because it does not contain relative path to a Radio componnet. Due to this the RadioGroup component cannot resolve the selected Radio component pointed to by the illegal value. A possible reason is that componment hierarchy changed between rendering and form submission. wicket.WicketRuntimeException: submitted http post value [radio0] for RadioGroup component [27:paperForm:panel:radioGroup] is illegal because it does not contain relative path to a Radio componnet. Due to this the RadioGroup component cannot resolve the selected Radio component pointed to by the illegal value. A possible reason is that componment hierarchy changed between rendering and form submission. at wicket.markup.html.form.RadioGroup.convertValue(RadioGroup.java:102) at wicket.markup.html.form.FormComponent.convert(FormComponent.java:878) at wicket.markup.html.form.Form$14.validate(Form.java:983) at wicket.markup.html.form.Form$ValidationVisitor.formComponent(Form.java:144) at wicket.markup.html.form.Form$4.component(Form.java:459) at wicket.MarkupContainer.visitChildren(MarkupContainer.java:744) at wicket.MarkupContainer.visitChildren(MarkupContainer.java:759) at wicket.markup.html.form.Form.visitFormComponents(Form.java:455) at wicket.markup.html.form.Form.validateConversion(Form.java:979) at wicket.markup.html.form.Form.validate(Form.java:953) at wicket.markup.html.form.Form.process(Form.java:867) at wicket.markup.html.form.Form.onFormSubmitted(Form.java:310) at sun.reflect.GeneratedMethodAccessor35.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at wicket.RequestListenerInterface.invoke(RequestListenerInterface.java:163) at wicket.request.target.component.listener.ListenerInterfaceRequestTarget.processEvents(ListenerInterfaceRequestTarget.java:74) at wicket.request.compound.DefaultEventProcessorStrategy.processEvents(DefaultEventProcessorStrategy.java:65) at wicket.request.compound.AbstractCompoundRequestCycleProcessor.processEvents(AbstractCompoundRequestCycleProcessor.java:57) at wicket.RequestCycle.doProcessEventsAndRespond(RequestCycle.java:896) at wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:929) at wicket.RequestCycle.step(RequestCycle.java:1010) at wicket.RequestCycle.steps(RequestCycle.java:1084) at wicket.RequestCycle.request(RequestCycle.java:454) at wicket.protocol.http.WicketServlet.doGet(WicketServlet.java:219) at wicket.protocol.http.WicketServlet.doPost(WicketServlet.java:262) at javax.servlet.http.HttpServlet.service(HttpServlet.java:710) at javax.servlet.http.HttpServlet.service(HttpServlet.java:803
Re: Wicket runtime Exception
Hi It is a ListView But I haven't called setReuseItems() The radio buttons are dynamic and replaced each time the page is loaded but this exception is thrown rarely. Johan Compagner wrote: is that a listview? do you have called setReuseItems() ? else the radio's are constantly replaced with new once and that could be the problem On Nov 12, 2007 10:31 AM, tbt [EMAIL PROTECTED] wrote: Hi Here is the code that uses RadioGroup public class RadioListView extends ListView { /** * */ private static final long serialVersionUID = 1L; //private static Logger log = Logger.getLogger(RadioListView.class.getName()); public RadioListView(String id,ArrayListOptionBean optionList,PaperModel paperModel) { super(id,optionList); } @Override protected void populateItem(ListItem item) { final OptionBean optionBean = (OptionBean) item.getModelObject(); Radio radioButton = new TextRadio(radio,new Model( + optionBean.getOptionId()),optionBean.getOptionId()); item.add(radioButton); Label radioLabel = new Label(radioValue, optionBean.getOptionText()); item.add(radioLabel); if(optionBean.getOptionText() != null .equals(optionBean.getOptionText())) { radioLabel.setVisible(false); } else { radioLabel.setVisible(true); } WebComponent imageLabel = new TextImage(imageLabel,optionBean.getOptionImage()); item.add(imageLabel); if(optionBean.getOptionImage() != null .equals(optionBean.getOptionImage())) { imageLabel.setVisible(false); } else { imageLabel.setVisible(true); } } } msc65jap wrote: Hello, Please send your code. J. On Nov 9, 2007 9:48 AM, tbt [EMAIL PROTECTED] wrote: Hi I'm a newbie to wicket and i'm using RadioGroup in my application. But sometimes it gives the following runtime exception ERROR (RequestCycle.java:1043) - submitted http post value [radio0] for RadioGroup component [27:paperForm:panel:radioGroup] is illegal because it does not contain relative path to a Radio componnet. Due to this the RadioGroup component cannot resolve the selected Radio component pointed to by the illegal value. A possible reason is that componment hierarchy changed between rendering and form submission. wicket.WicketRuntimeException: submitted http post value [radio0] for RadioGroup component [27:paperForm:panel:radioGroup] is illegal because it does not contain relative path to a Radio componnet. Due to this the RadioGroup component cannot resolve the selected Radio component pointed to by the illegal value. A possible reason is that componment hierarchy changed between rendering and form submission. at wicket.markup.html.form.RadioGroup.convertValue(RadioGroup.java:102) at wicket.markup.html.form.FormComponent.convert(FormComponent.java:878) at wicket.markup.html.form.Form$14.validate(Form.java:983) at wicket.markup.html.form.Form$ValidationVisitor.formComponent(Form.java :144) at wicket.markup.html.form.Form$4.component(Form.java:459) at wicket.MarkupContainer.visitChildren(MarkupContainer.java :744) at wicket.MarkupContainer.visitChildren(MarkupContainer.java :759) at wicket.markup.html.form.Form.visitFormComponents(Form.java:455) at wicket.markup.html.form.Form.validateConversion(Form.java :979) at wicket.markup.html.form.Form.validate(Form.java:953) at wicket.markup.html.form.Form.process(Form.java:867) at wicket.markup.html.form.Form.onFormSubmitted(Form.java:310) at sun.reflect.GeneratedMethodAccessor35.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at wicket.RequestListenerInterface.invoke(RequestListenerInterface.java :163) at wicket.request.target.component.listener.ListenerInterfaceRequestTarget.processEvents (ListenerInterfaceRequestTarget.java:74) at wicket.request.compound.DefaultEventProcessorStrategy.processEvents( DefaultEventProcessorStrategy.java:65) at wicket.request.compound.AbstractCompoundRequestCycleProcessor.processEvents (AbstractCompoundRequestCycleProcessor.java:57) at wicket.RequestCycle.doProcessEventsAndRespond(RequestCycle.java:896) at wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:929) at wicket.RequestCycle.step(RequestCycle.java:1010
Wicket runtime Exception
Hi I'm a newbie to wicket and i'm using RadioGroup in my application. But sometimes it gives the following runtime exception ERROR (RequestCycle.java:1043) - submitted http post value [radio0] for RadioGroup component [27:paperForm:panel:radioGroup] is illegal because it does not contain relative path to a Radio componnet. Due to this the RadioGroup component cannot resolve the selected Radio component pointed to by the illegal value. A possible reason is that componment hierarchy changed between rendering and form submission. wicket.WicketRuntimeException: submitted http post value [radio0] for RadioGroup component [27:paperForm:panel:radioGroup] is illegal because it does not contain relative path to a Radio componnet. Due to this the RadioGroup component cannot resolve the selected Radio component pointed to by the illegal value. A possible reason is that componment hierarchy changed between rendering and form submission. at wicket.markup.html.form.RadioGroup.convertValue(RadioGroup.java:102) at wicket.markup.html.form.FormComponent.convert(FormComponent.java:878) at wicket.markup.html.form.Form$14.validate(Form.java:983) at wicket.markup.html.form.Form$ValidationVisitor.formComponent(Form.java:144) at wicket.markup.html.form.Form$4.component(Form.java:459) at wicket.MarkupContainer.visitChildren(MarkupContainer.java:744) at wicket.MarkupContainer.visitChildren(MarkupContainer.java:759) at wicket.markup.html.form.Form.visitFormComponents(Form.java:455) at wicket.markup.html.form.Form.validateConversion(Form.java:979) at wicket.markup.html.form.Form.validate(Form.java:953) at wicket.markup.html.form.Form.process(Form.java:867) at wicket.markup.html.form.Form.onFormSubmitted(Form.java:310) at sun.reflect.GeneratedMethodAccessor35.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at wicket.RequestListenerInterface.invoke(RequestListenerInterface.java:163) at wicket.request.target.component.listener.ListenerInterfaceRequestTarget.processEvents(ListenerInterfaceRequestTarget.java:74) at wicket.request.compound.DefaultEventProcessorStrategy.processEvents(DefaultEventProcessorStrategy.java:65) at wicket.request.compound.AbstractCompoundRequestCycleProcessor.processEvents(AbstractCompoundRequestCycleProcessor.java:57) at wicket.RequestCycle.doProcessEventsAndRespond(RequestCycle.java:896) at wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:929) at wicket.RequestCycle.step(RequestCycle.java:1010) at wicket.RequestCycle.steps(RequestCycle.java:1084) at wicket.RequestCycle.request(RequestCycle.java:454) at wicket.protocol.http.WicketServlet.doGet(WicketServlet.java:219) at wicket.protocol.http.WicketServlet.doPost(WicketServlet.java:262) at javax.servlet.http.HttpServlet.service(HttpServlet.java:710) at javax.servlet.http.HttpServlet.service(HttpServlet.java:803) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:584) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447) at java.lang.Thread.run(Unknown Source) This doesn't happen often and only happens once in a while. How can I fix this Thanks -- View this message in context: http://www.nabble.com/Wicket-runtime-Exception-tf4776682.html#a13663985 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: logout
well it is the browser button that i'm concerned about :) I want it to be something like a mail account where once you logout you can't use the back button in the browser to navigate inside the application(eg: yahoo mail). Nino.Martinez wrote: session.invalidate() and use setResponsePage to navigate to where you want when pressing back button (Thinking its not the browser button?) -Nino tbt wrote: Hi I'm a newbie to wicket and i'm currently using a Session to log users into my application. When the users click a logout button a new page is shown. But they can click the back button in the browser and go into the application. Is there a wicket way of expiring the session when the logout button is clicked and showing a seperate page when the back button is clicked. thanks - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- View this message in context: http://www.nabble.com/logout-tf4592416.html#a13111382 Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
updating form component models when a link is clicked
Hi I'm a newbie to wicket and I have a form and several components attached to it. There are several links in this form and when each link is clicked a different page is loaded. But the component models are not getting updated when the onClick event is called in each link. How can the models be updated. -- View this message in context: http://www.nabble.com/updating-form-component-models-when-a-link-is-clicked-tf4434008.html#a12649853 Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]