| 1 |
|
|
| 2 |
|
|
| 3 |
|
|
| 4 |
|
|
| 5 |
|
|
| 6 |
|
|
| 7 |
|
|
| 8 |
|
|
| 9 |
|
|
| 10 |
|
|
| 11 |
|
|
| 12 |
|
|
| 13 |
|
|
| 14 |
|
|
| 15 |
|
|
| 16 |
|
|
| 17 |
|
|
| 18 |
|
|
| 19 |
|
|
| 20 |
|
|
| 21 |
|
|
| 22 |
|
package jalview.urls; |
| 23 |
|
|
| 24 |
|
import jalview.util.MessageManager; |
| 25 |
|
import jalview.util.UrlLink; |
| 26 |
|
|
| 27 |
|
import java.util.ArrayList; |
| 28 |
|
import java.util.List; |
| 29 |
|
|
| 30 |
|
|
| 31 |
|
|
| 32 |
|
|
| 33 |
|
@author |
| 34 |
|
@version |
| 35 |
|
|
| 36 |
|
|
| |
|
| 91% |
Uncovered Elements: 7 (78) |
Complexity: 30 |
Complexity Density: 0.51 |
|
| 37 |
|
public class UrlLinkDisplay |
| 38 |
|
{ |
| 39 |
|
|
| 40 |
|
public static final int DATABASE = 0; |
| 41 |
|
|
| 42 |
|
public static final int NAME = 1; |
| 43 |
|
|
| 44 |
|
public static final int URL = 2; |
| 45 |
|
|
| 46 |
|
public static final int SELECTED = 3; |
| 47 |
|
|
| 48 |
|
public static final int PRIMARY = 4; |
| 49 |
|
|
| 50 |
|
public static final int ID = 5; |
| 51 |
|
|
| 52 |
|
|
| 53 |
|
@SuppressWarnings("serial") |
| 54 |
|
private static final List<String> COLNAMES = new ArrayList<String>() |
| 55 |
|
{ |
| |
|
| 100% |
Uncovered Elements: 0 (6) |
Complexity: 1 |
Complexity Density: 0.17 |
|
| 56 |
10 |
{... |
| 57 |
10 |
add(MessageManager.formatMessage("label.database")); |
| 58 |
10 |
add(MessageManager.formatMessage("label.name")); |
| 59 |
10 |
add(MessageManager.formatMessage("label.url")); |
| 60 |
10 |
add(MessageManager.formatMessage("label.inmenu")); |
| 61 |
10 |
add(MessageManager.formatMessage("label.primary")); |
| 62 |
10 |
add(MessageManager.formatMessage("label.id")); |
| 63 |
|
} |
| 64 |
|
}; |
| 65 |
|
|
| 66 |
|
private String id; |
| 67 |
|
|
| 68 |
|
|
| 69 |
|
private boolean isPrimary; |
| 70 |
|
|
| 71 |
|
private boolean isSelected; |
| 72 |
|
|
| 73 |
|
private UrlLink link; |
| 74 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
| 75 |
6867 |
public UrlLinkDisplay(String rowId, UrlLink rowLink, boolean rowSelected,... |
| 76 |
|
boolean rowDefault) |
| 77 |
|
{ |
| 78 |
6867 |
id = rowId; |
| 79 |
6867 |
isPrimary = rowDefault; |
| 80 |
6867 |
isSelected = rowSelected; |
| 81 |
|
|
| 82 |
6867 |
link = rowLink; |
| 83 |
|
} |
| 84 |
|
|
| 85 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 86 |
436 |
public String getId()... |
| 87 |
|
{ |
| 88 |
436 |
return id; |
| 89 |
|
} |
| 90 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 91 |
127 |
public String getDescription()... |
| 92 |
|
{ |
| 93 |
127 |
return link.getLabel(); |
| 94 |
|
} |
| 95 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 96 |
24 |
public String getDBName()... |
| 97 |
|
{ |
| 98 |
24 |
return link.getTarget(); |
| 99 |
|
} |
| 100 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 101 |
67 |
public String getUrl()... |
| 102 |
|
{ |
| 103 |
67 |
return link.getUrlWithToken(); |
| 104 |
|
} |
| 105 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 106 |
6893 |
public boolean getIsPrimary()... |
| 107 |
|
{ |
| 108 |
6893 |
return isPrimary; |
| 109 |
|
} |
| 110 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 111 |
92 |
public boolean getIsSelected()... |
| 112 |
|
{ |
| 113 |
92 |
return isSelected; |
| 114 |
|
} |
| 115 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 116 |
6 |
public void setDBName(String name)... |
| 117 |
|
{ |
| 118 |
6 |
link.setTarget(name); |
| 119 |
|
} |
| 120 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 121 |
3 |
public void setUrl(String rowUrl)... |
| 122 |
|
{ |
| 123 |
3 |
link = new UrlLink(getDescription(), rowUrl, getDBName()); |
| 124 |
|
} |
| 125 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 126 |
3 |
public void setDescription(String desc)... |
| 127 |
|
{ |
| 128 |
3 |
link.setLabel(desc); |
| 129 |
|
} |
| 130 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 131 |
0 |
public void setIsDefault(boolean rowDefault)... |
| 132 |
|
{ |
| 133 |
0 |
isPrimary = rowDefault; |
| 134 |
|
} |
| 135 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 136 |
0 |
public void setIsSelected(boolean rowSelected)... |
| 137 |
|
{ |
| 138 |
0 |
isSelected = rowSelected; |
| 139 |
|
} |
| 140 |
|
|
| |
|
| 86.7% |
Uncovered Elements: 2 (15) |
Complexity: 7 |
Complexity Density: 0.47 |
|
| 141 |
74 |
public Object getValue(int index)... |
| 142 |
|
{ |
| 143 |
74 |
switch (index) |
| 144 |
|
{ |
| 145 |
3 |
case ID: |
| 146 |
3 |
return id; |
| 147 |
8 |
case URL: |
| 148 |
8 |
return getUrl(); |
| 149 |
27 |
case PRIMARY: |
| 150 |
27 |
return isPrimary; |
| 151 |
7 |
case SELECTED: |
| 152 |
7 |
return isSelected; |
| 153 |
10 |
case NAME: |
| 154 |
10 |
return getDescription(); |
| 155 |
19 |
case DATABASE: |
| 156 |
19 |
return getDBName(); |
| 157 |
0 |
default: |
| 158 |
0 |
return null; |
| 159 |
|
} |
| 160 |
|
} |
| 161 |
|
|
| |
|
| 94.7% |
Uncovered Elements: 1 (19) |
Complexity: 7 |
Complexity Density: 0.37 |
|
| 162 |
13 |
public void setValue(int index, Object value)... |
| 163 |
|
{ |
| 164 |
13 |
switch (index) |
| 165 |
|
{ |
| 166 |
1 |
case ID: |
| 167 |
1 |
id = (String) value; |
| 168 |
1 |
break; |
| 169 |
2 |
case URL: |
| 170 |
2 |
setUrl((String) value); |
| 171 |
2 |
break; |
| 172 |
3 |
case PRIMARY: |
| 173 |
3 |
isPrimary = (boolean) value; |
| 174 |
3 |
break; |
| 175 |
2 |
case SELECTED: |
| 176 |
2 |
isSelected = (boolean) value; |
| 177 |
2 |
break; |
| 178 |
2 |
case NAME: |
| 179 |
2 |
setDescription((String) value); |
| 180 |
|
|
| 181 |
3 |
case DATABASE: |
| 182 |
5 |
setDBName((String) value); |
| 183 |
5 |
break; |
| 184 |
0 |
default: |
| 185 |
|
|
| 186 |
|
} |
| 187 |
|
} |
| 188 |
|
|
| 189 |
|
|
| 190 |
|
|
| 191 |
|
|
| 192 |
|
@param |
| 193 |
|
|
| 194 |
|
@return |
| 195 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
| 196 |
62 |
public boolean isEditable(int index)... |
| 197 |
|
{ |
| 198 |
62 |
if (index == PRIMARY) |
| 199 |
|
{ |
| 200 |
|
|
| 201 |
|
|
| 202 |
12 |
return (!link.usesDBAccession()); |
| 203 |
|
} |
| 204 |
|
else |
| 205 |
|
{ |
| 206 |
50 |
return index == SELECTED; |
| 207 |
|
} |
| 208 |
|
} |
| 209 |
|
|
| 210 |
|
|
| 211 |
|
|
| 212 |
|
|
| 213 |
|
@return |
| 214 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 215 |
20 |
public static List<String> getDisplayColumnNames()... |
| 216 |
|
{ |
| 217 |
|
|
| 218 |
20 |
return COLNAMES.subList(DATABASE, ID); |
| 219 |
|
} |
| 220 |
|
} |