Statistics
| Revision:

root / org.gvsig.toolbox / trunk / org.gvsig.toolbox / org.gvsig.toolbox.gui / src / main / java / es / unex / sextante / gui / algorithm / FieldDescriptionComboBox.java @ 338

History | View | Annotate | Download (1.85 KB)

1 315 omartinez
package es.unex.sextante.gui.algorithm;
2 59 nbrodin
3 315 omartinez
public class FieldDescriptionComboBox
4 59 nbrodin
         implements
5
            Comparable {
6
7
   private String m_sDescription;
8 315 omartinez
   private Class m_Object;
9 59 nbrodin
10 315 omartinez
   public FieldDescriptionComboBox(final String sDescription,
11
                               final Class object) {
12 59 nbrodin
13
      m_sDescription = sDescription;
14
      m_Object = object;
15
16
   }
17
18
19
   public Object getObject() {
20
21
      return m_Object;
22
23
   }
24
25
26 315 omartinez
   public void setObject(final Class object) {
27 59 nbrodin
28
      m_Object = object;
29
30
   }
31
32
33
   public String getDescription() {
34
35
      return m_sDescription;
36
37
   }
38
39
40
   public void setDescription(final String sDescription) {
41
42
      m_sDescription = sDescription;
43
44
   }
45
46
47
   @Override
48
   public String toString() {
49
50
      return getDescription();
51
52
   }
53
54
55 315 omartinez
   @Override
56 59 nbrodin
   public int compareTo(final Object arg0) {
57
58 315 omartinez
      return getDescription().compareTo(((FieldDescriptionComboBox) arg0).getDescription());
59 59 nbrodin
60
   }
61
62
63
   @Override
64
   public boolean equals(final Object ob) {
65
66
      if (ob == null) {
67
         return false;
68
      }
69
70
      try {
71 315 omartinez
         final FieldDescriptionComboBox oad = (FieldDescriptionComboBox) ob;
72 59 nbrodin
         boolean bObjsEqual;
73
         boolean bDescsEqual;
74
         if (oad.getObject() == null) {
75
            bObjsEqual = m_Object == null;
76
         }
77
         else {
78
            bObjsEqual = oad.getObject().equals(m_Object);
79
         }
80
         if (oad.getDescription() == null) {
81
            bDescsEqual = m_sDescription == null;
82
         }
83
         else {
84
            bDescsEqual = oad.getDescription().equals(m_sDescription);
85
         }
86
         return bObjsEqual && bDescsEqual;
87
      }
88
      catch (final Exception e) {
89
         return false;
90
      }
91
92
   }
93
94 315 omartinez
    public String getFieldType() {
95
        return this.m_Object.getSimpleName();
96
    }
97 59 nbrodin
}