aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes Witched Swing JTable!! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Witched Swing JTable!!" Watch "Witched Swing JTable!!" New topic
Author

Witched Swing JTable!!

Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Hi There:

I hope anyone can give me a hint on this WEIRD behavior (I am really scared!):

Say you have this code somewhere:


In TablaAmparos.java (Which encapsulates a JTable object to add some functionality):


Now in the same Class:


So when I call getListaAmparos() the console should tell me that every row has an "Amparo". Well, surprisingly, it happens exactly that way:


DATA: RESPONSABILIDAD CIVIL CLASS: class co.com.liberty.generales.autos.domain.Amparo
DATA: PERDIDA TOTAL HURTO CLASS: class co.com.liberty.generales.autos.domain.Amparo
DATA: PERDIDA TOTAL DA#OS CLASS: class co.com.liberty.generales.autos.domain.Amparo
DATA: PERDIDA PARCIAL DA#OS CLASS: class co.com.liberty.generales.autos.domain.Amparo
DATA: ASISTENCIA JURIDICA PENAL CLASS: class co.com.liberty.generales.autos.domain.Amparo
DATA: ASISTENCIA JURIDICA CIVIL CLASS: class co.com.liberty.generales.autos.domain.Amparo //Pay special attention on this one!
DATA: P�RDIDA PARCIAL HURTO CLASS: class co.com.liberty.generales.autos.domain.Amparo
DATA: ASISTENCIA PRELEGAL AUTOS CLASS: class co.com.liberty.generales.autos.domain.Amparo
DATA: ASISTENCIA ODONTOLOGICA AUTOS CLASS: class co.com.liberty.generales.autos.domain.Amparo
DATA: GASTOS TRANSPORTE POR HURTO CLASS: class co.com.liberty.generales.autos.domain.Amparo
DATA: TERREMOTO CLASS: class co.com.liberty.generales.autos.domain.Amparo
DATA: GASTOS TRANSPORTE DA#OS CLASS: class co.com.liberty.generales.autos.domain.Amparo
DATA: AMPARO PATRIMONIAL CLASS: class co.com.liberty.generales.autos.domain.Amparo
DATA: NO APLICACION DEDUCIBLE CLASS: class co.com.liberty.generales.autos.domain.Amparo
DATA: INDICE VARIABLE CLASS: class co.com.liberty.generales.autos.domain.Amparo
DATA: ASISTENCIA EN VIAJE CLASS: class co.com.liberty.generales.autos.domain.Amparo
DATA: RESTITUCION VR A NUEVO CLASS: class co.com.liberty.generales.autos.domain.Amparo
DATA: ACCIDENTES PERSONALES CLASS: class co.com.liberty.generales.autos.domain.Amparo
DATA: RESPONSABILIDAD CIVIL GRAL FLI CLASS: class co.com.liberty.generales.autos.domain.Amparo
DATA: VEHICULO SUSTITUTO CLASS: class co.com.liberty.generales.autos.domain.Amparo
DATA: CASA CARCEL CLASS: class co.com.liberty.generales.autos.domain.Amparo


Every thing is fine until now, obviously the label appears after the toString overloading in Amparo, but...

Here comes the WEIRD thing...

This table has a TableCellEditor and Renderer that paints a checkbox in the last column and a JComboBox in the
third column of the first row (only the first), to select a value in that cell. Here is the code:

IN:


Where limite is the JComboBox...

Well, everything works fine, but, when I select something on the JComboBox or simply step to select any row in the table, the next call to
getListaAmparos() generates this output:


DATA: RESPONSABILIDAD CIVIL CLASS: class co.com.liberty.generales.autos.domain.Amparo
DATA: PERDIDA TOTAL HURTO CLASS: class co.com.liberty.generales.autos.domain.Amparo
DATA: PERDIDA TOTAL DA#OS CLASS: class co.com.liberty.generales.autos.domain.Amparo
DATA: PERDIDA PARCIAL DA#OS CLASS: class co.com.liberty.generales.autos.domain.Amparo
DATA: ASISTENCIA JURIDICA PENAL CLASS: class co.com.liberty.generales.autos.domain.Amparo
DATA: ASISTENCIA JURIDICA CIVIL CLASS: class java.lang.String //<------ CAN YOU BELIEVE THIS!!! It changes magically to String!!!
Pues este NO es un amparo: ASISTENCIA JURIDICA CIVIL - CLASS: class java.lang.String
java.lang.ClassCastException: java.lang.String
at co.com.liberty.generales.autos.webservice.client.gui.TablaAmparos.getListaAmparos(TablaAmparos.java:109)
at co.com.liberty.generales.autos.webservice.client.gui.VentanaPrincipalPE.getListaAmparos(VentanaPrincipalPE.java:243)
...



Remember how every row has an "Amparo" in the second column??? Well, here it comes Harry Potter and Stringo Patronum!!

I swear that no other code is filling the table and no body else touch the data... So...

What ITH can be happening??

I Hope somebody can do the Mith Busters job and solve this!...

Thanks in advance...

Happy Coding!
 
jQuery in Action, 2nd edition
 
subject: Witched Swing JTable!!