Re: how do I get the selected entity of a table
hrbaer wrote: ... protected void populateItem( ListItemEntity item ) { final Entity e = item.getModelObject(); item.add( new Label( text, e.getName() ) ); e not null? item.add( new Link( Details_Link ) { @Override public void onClick() { label.setVisible( true ); selectedEntity = e; // but e is null How is that possible if e not null before? selectedEntity = item.getModelObject(); (though I doubt if this is good practice. I prefer to use Models where possible) } }); } }); } --- - --nbsp; Regards, Hans http://www.cantaa.de http://cantaa.de -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/how-do-I-get-the-selected-entity-of-a-table-tp3306749p3308481.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: how do I get the selected entity of a table
hrbaer wrote: I'm trying to get the entity of the choosen row. Can someone provide me how do achieve that? Thanks in advance! protected void populateItem( ListItemEntity item ) { final Entity entity = item.getModelObject(); // cast not needed item.add( new Label( text, e.getName() ) ); item.add( new Link( Details_Link ) { @Override public void onClick() { label.setVisible( true ); // how do I get the selected entity? // selectedEntity = ??? entity.doSomethingWithMe(); // Use it here } }); -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/how-do-I-get-the-selected-entity-of-a-table-tp3306749p3306816.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: how do I get the selected entity of a table
Hi Hans, the object pointed by entity variable is already the selected one. On Tue, Feb 15, 2011 at 12:11 PM, Hans Lesmeister 2 hans.lesmeis...@lessy-software.de wrote: hrbaer wrote: I'm trying to get the entity of the choosen row. Can someone provide me how do achieve that? Thanks in advance! protected void populateItem( ListItemEntity item ) { final Entity entity = item.getModelObject(); // cast not needed item.add( new Label( text, e.getName() ) ); item.add( new Link( Details_Link ) { @Override public void onClick() { label.setVisible( true ); // how do I get the selected entity? // selectedEntity = ??? entity.doSomethingWithMe(); // Use it here } }); -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/how-do-I-get-the-selected-entity-of-a-table-tp3306749p3306816.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 -- Pedro Henrique Oliveira dos Santos
Re: how do I get the selected entity of a table
For safety, you probably want to get the entity from the item again, right? On Tue, Feb 15, 2011 at 9:18 AM, Pedro Santos pedros...@gmail.com wrote: Hi Hans, the object pointed by entity variable is already the selected one. On Tue, Feb 15, 2011 at 12:11 PM, Hans Lesmeister 2 hans.lesmeis...@lessy-software.de wrote: hrbaer wrote: I'm trying to get the entity of the choosen row. Can someone provide me how do achieve that? Thanks in advance! protected void populateItem( ListItemEntity item ) { final Entity entity = item.getModelObject(); // cast not needed item.add( new Label( text, e.getName() ) ); item.add( new Link( Details_Link ) { @Override public void onClick() { label.setVisible( true ); // how do I get the selected entity? // selectedEntity = ??? entity.doSomethingWithMe(); // Use it here } }); -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/how-do-I-get-the-selected-entity-of-a-table-tp3306749p3306816.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 -- Pedro Henrique Oliveira dos Santos - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: how do I get the selected entity of a table
Hi, James Carman wrote: For safety, you probably want to get the entity from the item again, right? Why would that be safer? You mean in case the item's ModelObject has been replaced somewhere? Cheers Hans -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/how-do-I-get-the-selected-entity-of-a-table-tp3306749p3306995.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: how do I get the selected entity of a table
No, I mean in case the model is a LDM and they would be getting a fresh copy of the entity from the database, as opposed to a detached one. On Tue, Feb 15, 2011 at 10:47 AM, Hans Lesmeister 2 hans.lesmeis...@lessy-software.de wrote: Hi, James Carman wrote: For safety, you probably want to get the entity from the item again, right? Why would that be safer? You mean in case the item's ModelObject has been replaced somewhere? Cheers Hans -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/how-do-I-get-the-selected-entity-of-a-table-tp3306749p3306995.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 - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: how do I get the selected entity of a table
James Carman wrote: No, I mean in case the model is a LDM and they would be getting a fresh copy of the entity from the database, as opposed to a detached one. Thanks James, that's a good hint - -- Regards, Hans http://cantaa.de Voetbal is heel erg simpel. Het moeilijkste aan voetbal is, simpel te spelen (J.Cruyff) -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/how-do-I-get-the-selected-entity-of-a-table-tp3306749p3307102.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