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 |
|
|
|
|
| 0% |
Uncovered Elements: 78 (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 |
|
{ |
|
|
| 0% |
Uncovered Elements: 6 (6) |
Complexity: 1 |
Complexity Density: 0.17 |
|
56 |
0 |
{... |
57 |
0 |
add(MessageManager.formatMessage("label.database")); |
58 |
0 |
add(MessageManager.formatMessage("label.name")); |
59 |
0 |
add(MessageManager.formatMessage("label.url")); |
60 |
0 |
add(MessageManager.formatMessage("label.inmenu")); |
61 |
0 |
add(MessageManager.formatMessage("label.primary")); |
62 |
0 |
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 |
|
|
|
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
75 |
0 |
public UrlLinkDisplay(String rowId, UrlLink rowLink, boolean rowSelected,... |
76 |
|
boolean rowDefault) |
77 |
|
{ |
78 |
0 |
id = rowId; |
79 |
0 |
isPrimary = rowDefault; |
80 |
0 |
isSelected = rowSelected; |
81 |
|
|
82 |
0 |
link = rowLink; |
83 |
|
} |
84 |
|
|
85 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
86 |
0 |
public String getId()... |
87 |
|
{ |
88 |
0 |
return id; |
89 |
|
} |
90 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
91 |
0 |
public String getDescription()... |
92 |
|
{ |
93 |
0 |
return link.getLabel(); |
94 |
|
} |
95 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
96 |
0 |
public String getDBName()... |
97 |
|
{ |
98 |
0 |
return link.getTarget(); |
99 |
|
} |
100 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
101 |
0 |
public String getUrl()... |
102 |
|
{ |
103 |
0 |
return link.getUrlWithToken(); |
104 |
|
} |
105 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
106 |
0 |
public boolean getIsPrimary()... |
107 |
|
{ |
108 |
0 |
return isPrimary; |
109 |
|
} |
110 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
111 |
0 |
public boolean getIsSelected()... |
112 |
|
{ |
113 |
0 |
return isSelected; |
114 |
|
} |
115 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
116 |
0 |
public void setDBName(String name)... |
117 |
|
{ |
118 |
0 |
link.setTarget(name); |
119 |
|
} |
120 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
121 |
0 |
public void setUrl(String rowUrl)... |
122 |
|
{ |
123 |
0 |
link = new UrlLink(getDescription(), rowUrl, getDBName()); |
124 |
|
} |
125 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
126 |
0 |
public void setDescription(String desc)... |
127 |
|
{ |
128 |
0 |
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 |
|
|
|
|
| 0% |
Uncovered Elements: 15 (15) |
Complexity: 7 |
Complexity Density: 0.47 |
|
141 |
0 |
public Object getValue(int index)... |
142 |
|
{ |
143 |
0 |
switch (index) |
144 |
|
{ |
145 |
0 |
case ID: |
146 |
0 |
return id; |
147 |
0 |
case URL: |
148 |
0 |
return getUrl(); |
149 |
0 |
case PRIMARY: |
150 |
0 |
return isPrimary; |
151 |
0 |
case SELECTED: |
152 |
0 |
return isSelected; |
153 |
0 |
case NAME: |
154 |
0 |
return getDescription(); |
155 |
0 |
case DATABASE: |
156 |
0 |
return getDBName(); |
157 |
0 |
default: |
158 |
0 |
return null; |
159 |
|
} |
160 |
|
} |
161 |
|
|
|
|
| 0% |
Uncovered Elements: 19 (19) |
Complexity: 7 |
Complexity Density: 0.37 |
|
162 |
0 |
public void setValue(int index, Object value)... |
163 |
|
{ |
164 |
0 |
switch (index) |
165 |
|
{ |
166 |
0 |
case ID: |
167 |
0 |
id = (String) value; |
168 |
0 |
break; |
169 |
0 |
case URL: |
170 |
0 |
setUrl((String) value); |
171 |
0 |
break; |
172 |
0 |
case PRIMARY: |
173 |
0 |
isPrimary = (boolean) value; |
174 |
0 |
break; |
175 |
0 |
case SELECTED: |
176 |
0 |
isSelected = (boolean) value; |
177 |
0 |
break; |
178 |
0 |
case NAME: |
179 |
0 |
setDescription((String) value); |
180 |
|
|
181 |
0 |
case DATABASE: |
182 |
0 |
setDBName((String) value); |
183 |
0 |
break; |
184 |
0 |
default: |
185 |
|
|
186 |
|
} |
187 |
|
} |
188 |
|
|
189 |
|
|
190 |
|
|
191 |
|
|
192 |
|
@param |
193 |
|
|
194 |
|
@return |
195 |
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
196 |
0 |
public boolean isEditable(int index)... |
197 |
|
{ |
198 |
0 |
if (index == PRIMARY) |
199 |
|
{ |
200 |
|
|
201 |
|
|
202 |
0 |
return (!link.usesDBAccession()); |
203 |
|
} |
204 |
|
else |
205 |
|
{ |
206 |
0 |
return index == SELECTED; |
207 |
|
} |
208 |
|
} |
209 |
|
|
210 |
|
|
211 |
|
|
212 |
|
|
213 |
|
@return |
214 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
215 |
0 |
public static List<String> getDisplayColumnNames()... |
216 |
|
{ |
217 |
|
|
218 |
0 |
return COLNAMES.subList(DATABASE, ID); |
219 |
|
} |
220 |
|
} |