Another approach is to actually store sortable data in the column (such as an 
image file name or some sort of status value) but use a custom renderer to 
present that data as an image.
G

On Jul 7, 2010, at 11:39 AM, Noel Grandin wrote:

> Hi
> 
> You're going to need to implement your own Comparator, and set it on the list 
> used by the TableView.
> 
> Or you could use something like the attached class, which allows you to set 
> your own comparator for a column.
> 
> -- Noel Grandin
> 
> Giguère, Philippe wrote:
>> 
>> Hi,
>>  
>> I have a TableView which allow to sort data. Everything works well except 
>> when the data are images. I can't sort the images like I want and the sort 
>> result isn't the same at each execution of the program.
>>  
>> Example of results:
>> First execution = Image1, Image1, Image2, Image2, Image3.
>> Second execution = Image3, Image1, Image1, Image2, Image2.
>>  
>> I searched why the result weren't never the same and I found that the 
>> TableViewRowComparator use the Comparable.compareTo(Object) method if the 
>> object implement Compare. If not, it use the toString() method that use the 
>> hash code of the object to sort. So, the hash code change for the object at 
>> each execution and it change the sort order as well at each execution.
>>  
>> I was wondering if there are a way already implented in Pivot to sort images 
>> or if you have some clue to do it? If not that could be an nice thing to add 
>> in the next version of Pivot.
>>  
>> Thx a lot
>>  
>> Philippe Giguère
>> Avis de confidentialité: Ce courriel et les pièces qui y sont jointes 
>> peuvent contenir des renseignements confidentiels qui ne vous sont pas 
>> destinés. Si vous avez reçu cette correspondance par erreur, veuillez la 
>> détruire et nous en aviser. Merci!
>> 
>> Devez-vous vraiment imprimer ce courriel ? Pensons à l'environnement ...
> 
> <TableViewRowComparator2.java>

Reply via email to