Changeset 1048

Show
Ignore:
Timestamp:
06/29/09 11:45:06 (4 years ago)
Author:
glickn
Message:

Fixed sample attributes that are sets so that they display in alphabetical order. (Makes the sorting look much better)

Location:
trunk
Files:
5 modified

Legend:

Unmodified
Added
Removed
  • trunk/mpdb-client/src/edu/rpi/metpetdb/client/ui/widgets/paging/columns/MultipleColumn.java

    r946 r1048  
    22 
    33import java.util.Collection; 
     4import java.util.Set; 
     5import java.util.TreeSet; 
    46 
    57import edu.rpi.metpetdb.client.model.MObject; 
    … …  
    2325                        String text = ""; 
    2426                        if (vals != null && vals.size() > 0) { 
    25                                 for(Object o : vals) { 
     27                                //sort collection first 
     28                                Set sortedSet = new TreeSet(vals); 
     29                                 
     30                                for(Object o : sortedSet) { 
    2631                                        text += o.toString() + ", "; 
    2732                                } 
  • trunk/mpdb-common/src/edu/rpi/metpetdb/client/model/MetamorphicGrade.java

    r1021 r1048  
    55import org.hibernate.search.annotations.Store; 
    66 
     7import edu.rpi.metpetdb.client.model.properties.Property; 
     8 
    79//import java.util.Set; 
    810 
    9 public class MetamorphicGrade extends MObject { 
     11public class MetamorphicGrade extends MObject implements Comparable { 
    1012        private static final long serialVersionUID = 1L; 
    1113 
    … …  
    5759                return id == 0; 
    5860        } 
     61 
     62        public int compareTo(Object mg) { 
     63                if(!(mg instanceof MetamorphicGrade)) 
     64                        throw new ClassCastException("Metamorphic Grade object expected"); 
     65                return this.getName().compareTo(((MetamorphicGrade) mg).getName()); 
     66        } 
    5967} 
  • trunk/mpdb-common/src/edu/rpi/metpetdb/client/model/Reference.java

    r1021 r1048  
    77//import java.util.Set; 
    88 
    9 public class Reference extends MObject { 
     9public class Reference extends MObject implements Comparable { 
    1010        private static final long serialVersionUID = 1L; 
    1111 
    … …  
    5656                return id == 0; 
    5757        } 
     58         
     59        public int compareTo(Object r) { 
     60                if(!(r instanceof Reference)) 
     61                        throw new ClassCastException("Reference object expected"); 
     62                return this.getName().compareTo(((Reference) r).getName()); 
     63        } 
    5864} 
  • trunk/mpdb-common/src/edu/rpi/metpetdb/client/model/Region.java

    r1021 r1048  
    77//import java.util.Set; 
    88 
    9 public class Region extends MObject { 
     9public class Region extends MObject implements Comparable { 
    1010        private static final long serialVersionUID = 1L; 
    1111 
    … …  
    5555                return id == 0; 
    5656        } 
     57         
     58        public int compareTo(Object r) { 
     59                if(!(r instanceof Region)) 
     60                        throw new ClassCastException("Region object expected"); 
     61                return this.getName().compareTo(((Region) r).getName()); 
     62        } 
    5763} 
  • trunk/mpdb-common/src/edu/rpi/metpetdb/client/model/SampleMineral.java

    r1027 r1048  
    66import org.hibernate.search.annotations.Store; 
    77 
    8 public class SampleMineral extends MObject { 
     8import edu.rpi.metpetdb.client.model.properties.Property; 
     9 
     10public class SampleMineral extends MObject implements Comparable { 
    911        private static final long serialVersionUID = 1L; 
    1012 
    … …  
    8385                return false; 
    8486        } 
     87 
     88        public int compareTo(Object sm) { 
     89                if(!(sm instanceof SampleMineral)) 
     90                        throw new ClassCastException("Sample Mineral object expected"); 
     91                Mineral anotherMineral = ((SampleMineral) sm).getMineral(); 
     92                return this.mineral.getName().compareTo(anotherMineral.getName()); 
     93        } 
    8594}Â