JAL-2213 made RESNUM constant private (not used elsewhere) to reduce
[jalview.git] / src / jalview / io / PDBFeatureSettings.java
1 package jalview.io;
2
3 import jalview.api.FeatureColourI;
4 import jalview.schemes.FeatureColour;
5 import jalview.schemes.FeatureSettingsAdapter;
6
7 import java.awt.Color;
8
9 public class PDBFeatureSettings extends FeatureSettingsAdapter
10 {
11   // TODO find one central place to define feature names
12   private static final String FEATURE_INSERTION = "INSERTION";
13
14   private static final String FEATURE_RES_NUM = "RESNUM";
15
16   @Override
17   public boolean isFeatureDisplayed(String type)
18   {
19     return type.equalsIgnoreCase(FEATURE_INSERTION)
20             || type.equalsIgnoreCase(FEATURE_RES_NUM);
21   }
22
23   @Override
24   public FeatureColourI getFeatureColour(String type)
25   {
26     if (type.equalsIgnoreCase(FEATURE_INSERTION))
27     {
28       return new FeatureColour()
29       {
30
31         @Override
32         public Color getColour()
33         {
34           return Color.RED;
35         }
36       };
37     }
38     return null;
39   }
40
41   /**
42    * Order to render insertion after ResNum
43    */
44   @Override
45   public int compare(String feature1, String feature2)
46   {
47     if (feature1.equalsIgnoreCase(FEATURE_INSERTION))
48     {
49       return +1;
50     }
51     if (feature2.equalsIgnoreCase(FEATURE_INSERTION))
52     {
53       return -1;
54     }
55     if (feature1.equalsIgnoreCase(FEATURE_RES_NUM))
56     {
57       return +1;
58     }
59     if (feature2.equalsIgnoreCase(FEATURE_RES_NUM))
60     {
61       return -1;
62     }
63     return 0;
64   }
65 }
66