Re: Model for dropdowns in a listview
Hello Rodrigo, sure i know that the null has to be replaced by a model. But my question was targeted to the object behind the dropdown selected option model. Let me create a more simple example: code MyComponent.java - in constructor - IModelReplyOptionsCollectingModel formModel = Model.ReplyOptionsCollectingModel of(new ReplyOptionsCollectingModel()) Form? form ...; form.add(new DropDownChoice(replysForQuestion1, new PropertyModelReplyOption(formModel, answerForQuestion1), replyOptionsForQuestion1())); form.add(new DropDownChoice(replysForQuestion2, new PropertyModelReplyOption(formModel, answerForQuestion2), replyOptionsForQuestion2())); ReplyOptionsCollectingModel.java public class ReplyOptionsCollectingModel implements Serializable { private ReplyOption answerForQuestion1; private ReplyOption answerForQuestion2; // ... getter and setter } /code But because i don't know the count of questions i have to use a repeating view. code MyComponent.java - in constructor - IModelReplyOptionsCollectingModel formModel = Model.ReplyOptionsCollectingModel of(new ReplyOptionsCollectingModel()) Form? form ...; ListViewQuestion questions = new ListView(...) { protected void populateItem(ListItemQuestion item) { item.add(new DropDownChoice(replysForQuestion, new PropertyModelReplyOption(formModel, I_dont_know_what_to_add_here), replyOptionsFor(item.getModelObject(; } } form.add(answers); ReplyOptionsCollectingModel.java public class ReplyOptionsCollectingModel implements Serializable { private MapQuestion, ReplyOption answerForQuestions; } /code Or do you mean that CompoundPropertyModel has more features handling the indexed-property stuff? Thanks for your support Per Am 21.04.2013 00:31, schrieb Rodrigo Heffner: Have you tried using CompoundPropertyModels? In that way you could bind a property to the dropdown, instead of using null - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: RequestMapper for Ajax Events
Hi, On Sat, Apr 20, 2013 at 11:08 AM, Frederic schreibf...@googlemail.comwrote: Hi, thanks for this link to the ticket. Could it also be a common way to overwrite getCallbackUrl at AjaxEventBehaviour and append the short url at the callback url? You can do this. Just make sure that you have the dispatcher the server side. And that there are no two ajax behaviors mounted on the same url. On 04/18/2013 12:59 PM, Martin Grigorov wrote: Hi, See https://issues.apache.org/**jira/browse/WICKET-5087https://issues.apache.org/jira/browse/WICKET-5087 On Thu, Apr 18, 2013 at 1:08 PM, Fred!!! schreibf...@googlemail.com wrote: Hi, I was wondering if there is a way to mount components or Ajax events like pages in wicket. For example I execute a simple Ajax link I get this URL: http://localhost:8012/Cart?0-1.IBehaviorListener.0-**http://localhost:8012/Cart?0-**1.IBehaviorListener.0-** shoppingCart-form-view-shoppingCart-shoppingCart-** shoppingCart.entries-0-shoppingCart.entry-delete-**link http://localhost:8012/**Cart?0-1.IBehaviorListener.0-** shoppingCart-form-view-**shoppingCart-shoppingCart-** shoppingCart.entries-0-**shoppingCart.entry-delete-linkhttp://localhost:8012/Cart?0-1.IBehaviorListener.0-shoppingCart-form-view-shoppingCart-shoppingCart-shoppingCart.entries-0-shoppingCart.entry-delete-link ** Is there a way to render these URL like the following example? http://localhost:8012/Cart/entry/1/deletehttp://localhost:8012/Cart/**entry/1/delete http://**localhost:8012/Cart/entry/1/**deletehttp://localhost:8012/Cart/entry/1/delete I tried to write my own IRequestHandler and IRequestMapper to handle it at Component:urlFor but that wasn’t successful. Cheers Fred. --** --**- To unsubscribe, e-mail: users-unsubscribe@wicket.**apa**che.orghttp://apache.org users-unsubscribe@**wicket.apache.orgusers-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org --**--**- To unsubscribe, e-mail: users-unsubscribe@wicket.**apache.orgusers-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com http://jweekend.com/
Wicket with Scala Book or Deep/Complete tutorial
Someone know a good resources to learning wicket + scala together?
Re: Wicket with Scala Book or Deep/Complete tutorial
Hi, There is nothing specific to use Wicket with Scala. There are few classes at https://github.com/wicketstuff/core/tree/master/jdk-1.6-parent/scala-extensions-parent which are rather experiments than something really useful. There is also a sample application. It could be a bit out of date but as you can see there is nothing specific to write your app in Scala. If you have any questions don't hesitate to ask. On Sun, Apr 21, 2013 at 4:32 PM, Bruno Moura brunormo...@gmail.com wrote: Someone know a good resources to learning wicket + scala together? -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com http://jweekend.com/
Re: Wicket with Scala Book or Deep/Complete tutorial
Hi, I would add that if you want to understand Scala, you should take the Coursera course from Martin Odersky : https://www.coursera.org/course/progfun Regards, __ Cedric Gatay (@Cedric_Gatay http://twitter.com/Cedric_Gatay) http://code-troopers.com | http://www.bloggure.info | http://cedric.gatay.fr On Sun, Apr 21, 2013 at 3:37 PM, Martin Grigorov mgrigo...@apache.orgwrote: Hi, There is nothing specific to use Wicket with Scala. There are few classes at https://github.com/wicketstuff/core/tree/master/jdk-1.6-parent/scala-extensions-parent which are rather experiments than something really useful. There is also a sample application. It could be a bit out of date but as you can see there is nothing specific to write your app in Scala. If you have any questions don't hesitate to ask. On Sun, Apr 21, 2013 at 4:32 PM, Bruno Moura brunormo...@gmail.com wrote: Someone know a good resources to learning wicket + scala together? -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com http://jweekend.com/
Populate Listitem with comboboxes and editables labes and preserve the state of each object in lines
I have created a listView with method populateList, that fills a list of customers meetings with the respective manager responsible for each line according the figure bellow: Begin End Manager Detail Total Actions 21/04/2013 09:52:41 21/04/2013 10:05:21 --V __ 00:12:40 Edit 21/04/2013 10:05:38 21/04/2013 10:05:41 --V __ 00:00:03 Edit 21/04/2013 10:36:06 21/04/2013 10:36:09 --V __ 00:00:03 Edit TOTAL - 00:12:46 Obs: I'm using scala :-D Two problems here: 1. When a new new item is created, only the fields (labels) dateBegin and dateEnd are preserved with previous assigned values, I lost the values of **Manager** *DropDownChoice* and the **Detail** *TextField* in last line of the ListItem. 2. **After change** the *DropDownChoice* of after exit from the *Detail TextField* is needed *update the model* with the respective value have chosen from each filed. So the values are kept only for labels, in truth links. Let me show the code: add(new ListView[Meetings](listMeetings, listData) { override protected def onBeforeRender() { periodTotal = new Period() super.onBeforeRender() } // for populating the listView def populateItem(item: ListItem[customer]) = { var customer = item.getModelObject() item.add(new LinkDate(beginDate, customer)) item.add(new LinkDate(endDate, customer)) val listManagers: java.util.List[Manager] = managerDAO.listManagers item.add(new DropDownChoice(managerSelection, listManagers,new ChoiceRenderer[Manager](name))) item.add(new TextField(detail)) /* * I tried to use the code bellow but it's cause a markups errors too. * Only the code above display the components without errors. */ //val managerSelection = new LinkManager(managerSelection,customer) //item.add(managerSelection) //item.add(new LinkDetail(detail, customer)) var period = new Period(customer.beginDate, customer.endDate.get) item.add(new Label(total, period.toString(getFormatter( item.add(new LinkEdit(edit, customer)) }}) The functions bellow work fine for date value and for edit a respective fields of the line: private class LinkDate(id: String, customer: Customer) extends Link[String](id) { setEnabled(false) add(new Label(label, new Model[String]() { override def getObject(): String = { var result = if (id == beginDate) { result = customer.beginDate.toString(dd/MM/ HH:mm:ss) } if (id == endDate) { result = customer.endDate.get.toString(dd/MM/ HH:mm:ss) } return result } })) // ... doing other stuff } private class LinkEdit(id: String, customer: Customer) extends Link[String](id) { add(new Label(label, new Model[String]() { override def getObject: String = edit })); // ... doing other stuff } But for DropDown and TextField I tried to do the same and I failed strongly: // Doesn't work private class LinkManager(id: String, customer: Customer) extends Link[String](id) { val listManagers: java.util.List[Manager] = managerDAO.listManagers add(new DropDownChoice(managerSelection, listManagers,new ChoiceRenderer[Manager](name) { def wantOnSelectionChangedNotifications() = { true; } def onSelectionChanged(managerSelection: Manager): String = { // saving model }) } })) // ... doing other stuff } // Doesn't work // Also here I tried to change textFiled for a inline-ajax Editable label // And I need the behaviour to change model imadiately after change value private class LinkDetail(id: String, customer: Customer) extends Link[String](id) { add(new AjaxEditableLabel(detail, new Model[String]() { override def getObject(): String = { // ... doing other stuff } })) } The piece of corresponding markup is shoewd bellow: TR wicket:id=listCustomersMettings TDa wicket:id=beginDatespan wicket:id=label/span/a/TD TDa wicket:id=endDatespan wicket:id=label/span/a/TD TD SELECT wicket:id=managerSelection name=id/SELECT BR /TD TDINPUT wicket:id=detail type=text name=obs value=_//TD TD wicket:id=total/TD TDa wicket:id=editspan wicket:id=label style=text-align: center/span/a/TD /TR I think that is needed a Object, similar to LinkDate, to deal and store the values for Manager DropDownChoice and for the textField or AjaxEditableLabel Detail, but I got in trouble to implement them. Thanks for
Re: Populate Listitem with comboboxes and editables labes and preserve the state of each object in lines
Hi, Why do you put the form components in Link component ? You need a Button or SubmitLink to submit their data, but don't put them inside. On Sun, Apr 21, 2013 at 7:11 PM, Bruno Moura brunormo...@gmail.com wrote: I have created a listView with method populateList, that fills a list of customers meetings with the respective manager responsible for each line according the figure bellow: Begin End Manager Detail Total Actions 21/04/2013 09:52:41 21/04/2013 10:05:21 --V __ 00:12:40 Edit 21/04/2013 10:05:38 21/04/2013 10:05:41 --V __ 00:00:03 Edit 21/04/2013 10:36:06 21/04/2013 10:36:09 --V __ 00:00:03 Edit TOTAL - 00:12:46 Obs: I'm using scala :-D Two problems here: 1. When a new new item is created, only the fields (labels) dateBegin and dateEnd are preserved with previous assigned values, I lost the values of **Manager** *DropDownChoice* and the **Detail** *TextField* in last line of the ListItem. 2. **After change** the *DropDownChoice* of after exit from the *Detail TextField* is needed *update the model* with the respective value have chosen from each filed. So the values are kept only for labels, in truth links. Let me show the code: add(new ListView[Meetings](listMeetings, listData) { override protected def onBeforeRender() { periodTotal = new Period() super.onBeforeRender() } // for populating the listView def populateItem(item: ListItem[customer]) = { var customer = item.getModelObject() item.add(new LinkDate(beginDate, customer)) item.add(new LinkDate(endDate, customer)) val listManagers: java.util.List[Manager] = managerDAO.listManagers item.add(new DropDownChoice(managerSelection, listManagers,new ChoiceRenderer[Manager](name))) item.add(new TextField(detail)) /* * I tried to use the code bellow but it's cause a markups errors too. * Only the code above display the components without errors. */ //val managerSelection = new LinkManager(managerSelection,customer) //item.add(managerSelection) //item.add(new LinkDetail(detail, customer)) var period = new Period(customer.beginDate, customer.endDate.get) item.add(new Label(total, period.toString(getFormatter( item.add(new LinkEdit(edit, customer)) }}) The functions bellow work fine for date value and for edit a respective fields of the line: private class LinkDate(id: String, customer: Customer) extends Link[String](id) { setEnabled(false) add(new Label(label, new Model[String]() { override def getObject(): String = { var result = if (id == beginDate) { result = customer.beginDate.toString(dd/MM/ HH:mm:ss) } if (id == endDate) { result = customer.endDate.get.toString(dd/MM/ HH:mm:ss) } return result } })) // ... doing other stuff } private class LinkEdit(id: String, customer: Customer) extends Link[String](id) { add(new Label(label, new Model[String]() { override def getObject: String = edit })); // ... doing other stuff } But for DropDown and TextField I tried to do the same and I failed strongly: // Doesn't work private class LinkManager(id: String, customer: Customer) extends Link[String](id) { val listManagers: java.util.List[Manager] = managerDAO.listManagers add(new DropDownChoice(managerSelection, listManagers,new ChoiceRenderer[Manager](name) { def wantOnSelectionChangedNotifications() = { true; } def onSelectionChanged(managerSelection: Manager): String = { // saving model }) } })) // ... doing other stuff } // Doesn't work // Also here I tried to change textFiled for a inline-ajax Editable label // And I need the behaviour to change model imadiately after change value private class LinkDetail(id: String, customer: Customer) extends Link[String](id) { add(new AjaxEditableLabel(detail, new Model[String]() { override def getObject(): String = { // ... doing other stuff } })) } The piece of corresponding markup is shoewd bellow: TR wicket:id=listCustomersMettings TDa wicket:id=beginDatespan wicket:id=label/span/a/TD TDa wicket:id=endDatespan wicket:id=label/span/a/TD TD SELECT wicket:id=managerSelection name=id/SELECT BR /TD TDINPUT wicket:id=detail type=text name=obs value=_//TD
Mongo and Morphia
Hello, I have a question regarding MongoDB, Morphia, wicket-guice and injection. I try to understand the injection of a UserDAO class in an ExampleClass. I do not understand the following point: The UserDAO class extends BasicDAO. BasicDAO needs a constructor with a Datastore variable. Question: How does wicket-guice inject the UserDAO class when the constructor needs a Datastore? The project would look as follows: pom.xml --- wicket-guice dependency groupIdorg.apache.wicket/groupId artifactIdwicket-guice/artifactId version6.6.0/version /dependency User --- @Entity(users) public class user { @Id private ObjectID id; private name; [...] } public interface IUserDAO { } UserDAO --- public class userDAO extends BasicDAOUser, ObjectId implements IUserDAO { public UserDAO(Datastore ds) { super(ds); } [...] } MongoResource public enum MongoResource { INSTANCE; private MongoClient mongoClient; private MongoResource () { mongoClient = new MongoClient(properties.getProperty(host, properties.getProperty(port))); } public Datastore getDatastore() { return new Morphia().map(User.class).createDatastore(mongoClient,mydb); } } Application - public class Application extends WebApplication { @Override protected void init() { addComponentInstantiationListener( new GuiceComponentInjector(this, new GuiceModule())); } } GuiceModule - public class GuiceModule extends AbstractModule { @Override protected void configure() { // Business object bindings go here. bind(MyDAO.class).to(UserDAO.class); } } ExampleClass - public ExampleClass { @Inject private IUserDAO userDAO; public ExampleClass() { super(); userDAO.doSomething(); } } Without injection I would initialize the UserDAO class as follows: ExampleClass - public ExampleClass { private UserDAO userDAO; public ExampleClass() { super(); Datastore ds = MongoResource.INSTANCE.getDatastore(); userDAO = new UserDAO(ds); userDAO.doSomething(); } } I would like to use injection. Can someone tell me how I have to do that? That would be great. Andre -- Andre Schütz schuetz.an...@gmx.net - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Mongo and Morphia
Hi, On Sun, Apr 21, 2013 at 11:12 PM, Andre Schütz andre-p...@gmx.de wrote: Hello, I have a question regarding MongoDB, Morphia, wicket-guice and injection. I try to understand the injection of a UserDAO class in an ExampleClass. I do not understand the following point: The UserDAO class extends BasicDAO. BasicDAO needs a constructor with a Datastore variable. Question: How does wicket-guice inject the UserDAO class when the constructor needs a Datastore? The project would look as follows: pom.xml --- wicket-guice dependency groupIdorg.apache.wicket/groupId artifactIdwicket-guice/artifactId version6.6.0/version /dependency User --- @Entity(users) public class user { @Id private ObjectID id; private name; [...] } public interface IUserDAO { } UserDAO --- public class userDAO extends BasicDAOUser, ObjectId implements IUserDAO { public UserDAO(Datastore ds) { super(ds); } [...] } MongoResource public enum MongoResource { INSTANCE; private MongoClient mongoClient; private MongoResource () { mongoClient = new MongoClient(properties.getProperty(host, properties.getProperty(port))); } public Datastore getDatastore() { return new Morphia().map(User.class).createDatastore(mongoClient,mydb); } } Application - public class Application extends WebApplication { @Override protected void init() { addComponentInstantiationListener( new GuiceComponentInjector(this, new GuiceModule())); } } GuiceModule - public class GuiceModule extends AbstractModule { @Override protected void configure() { // Business object bindings go here. Datastore ds = MongoResource.INSTANCE.getDatastore(); bind(MyDAO.class).to(new UserDAO(ds)); i.e. you can bind to an instance if it is thread-safe, i.e. stateless If you want a new instance of UserDAO (a prototype) for each usage then you can bind the Datastore and inject it in UserDAO: class UserDAO ... { ... @Inject private Datastore ds; ... } } } ExampleClass - public ExampleClass { @Inject private IUserDAO userDAO; public ExampleClass() { super(); userDAO.doSomething(); } } Without injection I would initialize the UserDAO class as follows: ExampleClass - public ExampleClass { private UserDAO userDAO; public ExampleClass() { super(); Datastore ds = MongoResource.INSTANCE.getDatastore(); userDAO = new UserDAO(ds); userDAO.doSomething(); } } I would like to use injection. Can someone tell me how I have to do that? That would be great. Andre -- Andre Schütz schuetz.an...@gmx.net - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com http://jweekend.com/
User data during request of AuthenticatedWebSession
I plan to implement a project with AuthenticatedWebApplication. The users have to sign up for an account. My question is regarding the user data that I have to load during each request of the single pages. The project will be as follows: (1) User logs into the system (2) The dashboard will be loaded (3) The user clicks the menu and gets a different representation of the information I would like to know the following two things: (a) The user registers with his email and a password (The email is unique in the database). I wanted to store the email in the AuthenticatedWebSession and load the desired user data during each request of a WebPage. Would that be a good idea? (b) I read in the documentation about the WebRequestCycle. Would it be useful to implement an own WebRequestCycle for the loading of the user data? I hope to hear some opinions. Thanks in advance. Andre - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: User data during request of AuthenticatedWebSession
Hi, you could use session's metadata to store user-relative data (provided that they are serializable) when she/he successfully logs in. IMHO creating a custom WebRequestCycle is not necessary. I plan to implement a project with AuthenticatedWebApplication. The users have to sign up for an account. My question is regarding the user data that I have to load during each request of the single pages. The project will be as follows: (1) User logs into the system (2) The dashboard will be loaded (3) The user clicks the menu and gets a different representation of the information I would like to know the following two things: (a) The user registers with his email and a password (The email is unique in the database). I wanted to store the email in the AuthenticatedWebSession and load the desired user data during each request of a WebPage. Would that be a good idea? (b) I read in the documentation about the WebRequestCycle. Would it be useful to implement an own WebRequestCycle for the loading of the user data? I hope to hear some opinions. Thanks in advance. Andre - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: User data during request of AuthenticatedWebSession
yes,you can store some key in session like emailId and then retrieve and store the user and related data in request cycle metadata ,as you are storing in requestcycle metadata ,scope of the data will be for the whole request only . no need to create your own requestcycle for that,create your requestcycle listener which onbeginrequest stores the user related data in requestcycle metadata On Mon, Apr 22, 2013 at 1:55 AM, Andre Schütz andre-p...@gmx.de wrote: I plan to implement a project with AuthenticatedWebApplication. The users have to sign up for an account. My question is regarding the user data that I have to load during each request of the single pages. The project will be as follows: (1) User logs into the system (2) The dashboard will be loaded (3) The user clicks the menu and gets a different representation of the information I would like to know the following two things: (a) The user registers with his email and a password (The email is unique in the database). I wanted to store the email in the AuthenticatedWebSession and load the desired user data during each request of a WebPage. Would that be a good idea? (b) I read in the documentation about the WebRequestCycle. Would it be useful to implement an own WebRequestCycle for the loading of the user data? I hope to hear some opinions. Thanks in advance. Andre - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- regards, Vineet Semwal
Re: Panel resfresh with AjaxRequestTarget
oninitialize is only called once like constructor,the only advantage is called after component is added to page. the easiest way for you without making any change in B will be replacing the old instance of B with new one see Component#replacewith(newcomponent) On Sun, Apr 21, 2013 at 2:46 PM, souvikbhattacharyas souvikbhattachar...@gmail.com wrote: I am new to wicket and stuck in a Panel refresh problem with AjaxRequestTarget. I am clarifying my scenario below. In the Ui I have a Panel (A) which contains another Panel (B) and B contains some buttons and tables. I Panel A, I have a Event which will refresh My Panel B (Mainly the table in Panel B) with AjaxRequestTarget. On event I am adding Panel B in my AjaxRequestTarget.add() but it's not calling my initialize method in Panel B. So, Panel B is not refreshing properly. It's a existing code so, can't move the event to Panel B. So, need to do something from Panel A itself. Any help is appreciable -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Panel-resfresh-with-AjaxRequestTarget-tp4658145.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- regards, Vineet Semwal