DataTable and RowSelector
[Logo]
ICEsoft.org Forums: ICEfaces, ICEmobile, ICEpdf
[Search] Search   [Recent Topics] Recent Topics   [Groups] Home Page | www.icefaces.org  [Register] Register  [Login] Login 
DataTable and RowSelector  XML
Forum Index -> JBoss Seam Integration Go to Page: 1, 2 Next 
Author Message
applefan

Joined: 03/10/2009 00:00:00
Messages: 24
Offline


Hi,
I have a problem with RowSelector. I want to get what element has been selected from a DataTable by the user.

This is the View part I wrote:
Code:
 <ice:panelGroup>
 	<ice:dataTable var="_sperimentazione" value="#{sperimentazioneList.resultList}">
 		<ice:column>
 			<ice:rowSelector selectionListener="#{testTableSelection.selectionListener}"/>
 			<f:facet name="header"><ice:outputText value="id"/></f:facet>
 			<ice:outputText value="#{_sperimentazione.id}"/>
 		</ice:column>
 		<ice:column>
 			<f:facet name="header"><ice:outputText value="idAmministrativo"/></f:facet>
 			<ice:outputText value="#{_sperimentazione.idAmministrativo}"/>
 		</ice:column>
 		<ice:column>
 			<f:facet name="header"><ice:outputText value="Tipo di sperimentazione"/></f:facet>
 			<ice:outputText value="#{_sperimentazione.clsSperimentazione.tipo}"/>
 		</ice:column>
 		<ice:column>
 			<f:facet name="header"><ice:outputText value="Descrizione"/></f:facet>
 			<ice:outputText value="#{_sperimentazione.descrizione}"/>
 		</ice:column>
 	</ice:dataTable>
 </ice:panelGroup>
 


And this is the controller hosting the selectionListener:
Code:
 @Name("testTableSelection")
 public class TestTableSelectionAct {
 
 	public void selectionListener(RowSelectorEvent rsevt) {
 		System.out.println("Listener select activated");
 	}
 }
 


I'm using Seam 2.2.0GA with ICEFaces 1.8.1
The problem is that the selectionListener is never fired.
Could someone help me?
judy.guglielmin

Joined: 20/02/2007 00:00:00
Messages: 1196
Offline


The simplest thing is probably to review the seam-comp-showcase application that is available from our downloads page.

I do note that you have no value property set for the rowSelector though. You will also want to check the configuration and packaging (are you using an ear or war deployment? If ear, then put all the ICEfaces jars into the ear/lib location).
applefan

Joined: 03/10/2009 00:00:00
Messages: 24
Offline


judy.guglielmin wrote:
The simplest thing is probably to review the seam-comp-showcase application that is available from our downloads page.

I do note that you have no value property set for the rowSelector though. You will also want to check the configuration and packaging (are you using an ear or war deployment? If ear, then put all the ICEfaces jars into the ear/lib location). 


Thank you for your answer.
I don't know why but I was sure that the value property was optional. Evidently I was wrong.

Is there a way to add a boolean attribute to the elements of a DataModel (obtained from the .resultList() method of the EntityQuery action) without altering the entity class?
judy.guglielmin

Joined: 20/02/2007 00:00:00
Messages: 1196
Offline


just make it @Transient and it won't be persisted. (the selected attribute for the boolean, that is).
applefan

Joined: 03/10/2009 00:00:00
Messages: 24
Offline


judy.guglielmin wrote:
just make it @Transient and it won't be persisted. (the selected attribute for the boolean, that is). 


It doesn't work. If I alter the Entity class adding a Transient boolean for storing the selected "flag", I get errors (null value association).

Could you provide me a working example, given a list (or DataModel) of instances of an entity (that does not have a boolean field), to implement a DataTable with RowSelector?

Thank you.
judy.guglielmin

Joined: 20/02/2007 00:00:00
Messages: 1196
Offline


just make it false in the constructor when you originally create the entity. (it's not the transient property that is the problem). I believe the open18ice example has this as well as seam-comp-showcase. Did you already check them?
applefan

Joined: 03/10/2009 00:00:00
Messages: 24
Offline


First of all, thank you for your replies.

judy.guglielmin wrote:
just make it false in the constructor when you originally create the entity. (it's not the transient property that is the problem). I believe the open18ice example has this as well as seam-comp-showcase. Did you already check them?  


Yes, I mimicked the Employee class found inside seam-comp-showcase. The error went away, the selectionListener is not fired still.

View (excerpt):
Code:
 <ice:panelGroup>
 	<ice:dataTable var="_sperimentazione" value="#{sperimentazioneList.resultList}">
 		<ice:column>
 			<ice:rowSelector value="#{_sperimentazione.selected}" 
 				selectionListener="#{testTableSelection.selectionListener}"/>
 			<f:facet name="header"><ice:outputText value="id"/></f:facet>
 			<ice:outputText value="#{_sperimentazione.id}"/>
 


Changes in the entity class:
Code:
 @Entity
 @Table(name = "Sperimentazione", catalog = "ASSC")
 public class Sperimentazione implements java.io.Serializable {
 
 .....
 
 	private transient boolean selected = false;
 
 	@Transient
 	public boolean isSelected() {
 		return selected;
 	}
 	
 	public void setSelected(boolean selected) {
 		this.selected = selected;
 	}
 


Any ideas? Thanks again.
judy.guglielmin

Joined: 20/02/2007 00:00:00
Messages: 1196
Offline


Did you check your configuration and packaging to make sure they were similar to seam-comp-showcase? (you see that it works properly in that application, correct?).
applefan

Joined: 03/10/2009 00:00:00
Messages: 24
Offline


judy.guglielmin wrote:
Did you check your configuration and packaging to make sure they were similar to seam-comp-showcase? (you see that it works properly in that application, correct?).  


I don't know how to start the seam-comp-showcase example. So I don't know if that works. I'm modyfing a seam project that was automatically created by seam-gen with ICEFaces support.
judy.guglielmin

Joined: 20/02/2007 00:00:00
Messages: 1196
Offline


Please go to the downloads page, http://www.icefaces.org/main/downloads/os-downloads.iface
and under Projects->Jboss Seam, you will find seam-comp-showcase. You can use the current distribution of Seam and ICEfaces and read the directions to build/deploy.
applefan

Joined: 03/10/2009 00:00:00
Messages: 24
Offline


judy.guglielmin wrote:
Please go to the downloads page, http://www.icefaces.org/main/downloads/os-downloads.iface
and under Projects->Jboss Seam, you will find seam-comp-showcase. You can use the current distribution of Seam and ICEfaces and read the directions to build/deploy. 


I received news that this is an ICEFaces bug. Thanks anyway.
judy.guglielmin

Joined: 20/02/2007 00:00:00
Messages: 1196
Offline


What bug is this? It works perfectly with seam-comp-showcase (as well as other sample applications). Not sure where you are getting that information.....
applefan

Joined: 03/10/2009 00:00:00
Messages: 24
Offline


judy.guglielmin wrote:
What bug is this? It works perfectly with seam-comp-showcase (as well as other sample applications). Not sure where you are getting that information..... 


You are right, I have to correct myself. I received false information from a colleague. Actually seam-comp-showcase works... but still I can't understand why my code doesn't.

My SEAM installation uses ICEFaces 1.8.1. Seam Showcase runs with ICEFaces 1.8.2. I think it's very unlikely, but could that be the problem?
Just in case, do you know how could I update the ICEFaces libraries that SEAM uses? I remember that they were automatically downloaded the first time I ran seam setup.
applefan

Joined: 03/10/2009 00:00:00
Messages: 24
Offline


I've noticed that none of the classes in seam-showcase are SEAM managed components (i.e., they are missing the @Name annotation). Could it be an ICEFaces - SEAM interaction problem? I can't figure out the reason why my code still doesn't work.

Thank you.
judy.guglielmin

Joined: 20/02/2007 00:00:00
Messages: 1196
Offline


If you look closer, you will notice other packages (com.icesoft....) that are the Seam backing beans which extend the other classes (copied over from regular component showcase). Here are the @Named Seam components. All but a few just extend the base classes for regular component showcase. There are also a few other beans that are created in components.xml. (you might want to read up on the Seam docs to figure those ones out).
 
Forum Index -> JBoss Seam Integration Go to Page: 1, 2 Next 
Go to:   
Powered by JForum 2.1.7ice © JForum Team