| 1 |
|
|
| 2 |
|
|
| 3 |
|
|
| 4 |
|
|
| 5 |
|
|
| 6 |
|
|
| 7 |
|
|
| 8 |
|
|
| 9 |
|
|
| 10 |
|
|
| 11 |
|
|
| 12 |
|
|
| 13 |
|
|
| 14 |
|
|
| 15 |
|
|
| 16 |
|
|
| 17 |
|
|
| 18 |
|
|
| 19 |
|
|
| 20 |
|
|
| 21 |
|
package jalview.gui; |
| 22 |
|
|
| 23 |
|
import java.awt.BorderLayout; |
| 24 |
|
import java.awt.Checkbox; |
| 25 |
|
import java.awt.CheckboxGroup; |
| 26 |
|
import java.awt.FlowLayout; |
| 27 |
|
import java.awt.Font; |
| 28 |
|
import java.awt.GridLayout; |
| 29 |
|
import java.awt.event.ActionEvent; |
| 30 |
|
import java.awt.event.ActionListener; |
| 31 |
|
import java.awt.event.ItemEvent; |
| 32 |
|
import java.awt.event.ItemListener; |
| 33 |
|
import java.util.ArrayList; |
| 34 |
|
import java.util.HashMap; |
| 35 |
|
import java.util.List; |
| 36 |
|
import java.util.Map; |
| 37 |
|
|
| 38 |
|
import javax.swing.JButton; |
| 39 |
|
import javax.swing.JInternalFrame; |
| 40 |
|
import javax.swing.JLayeredPane; |
| 41 |
|
import javax.swing.JPanel; |
| 42 |
|
|
| 43 |
|
import jalview.datamodel.AlignmentAnnotation; |
| 44 |
|
import jalview.datamodel.AlignmentI; |
| 45 |
|
import jalview.datamodel.SequenceGroup; |
| 46 |
|
import jalview.util.MessageManager; |
| 47 |
|
|
| 48 |
|
|
| 49 |
|
|
| 50 |
|
|
| 51 |
|
|
| 52 |
|
@author |
| 53 |
|
|
| 54 |
|
|
| 55 |
|
@SuppressWarnings("serial") |
| |
|
| 90.7% |
Uncovered Elements: 21 (225) |
Complexity: 59 |
Complexity Density: 0.39 |
|
| 56 |
|
public class AnnotationChooser extends JPanel |
| 57 |
|
{ |
| 58 |
|
|
| 59 |
|
private static final Font CHECKBOX_FONT = new Font("Serif", Font.BOLD, |
| 60 |
|
12); |
| 61 |
|
|
| 62 |
|
private static final int MY_FRAME_WIDTH = 600; |
| 63 |
|
|
| 64 |
|
private static final int MY_FRAME_HEIGHT = 250; |
| 65 |
|
|
| 66 |
|
private JInternalFrame frame; |
| 67 |
|
|
| 68 |
|
private AlignmentPanel ap; |
| 69 |
|
|
| 70 |
|
private SequenceGroup sg; |
| 71 |
|
|
| 72 |
|
|
| 73 |
|
private boolean[] resetState = null; |
| 74 |
|
|
| 75 |
|
|
| 76 |
|
private boolean showSelected; |
| 77 |
|
|
| 78 |
|
|
| 79 |
|
private boolean applyToSelectedSequences; |
| 80 |
|
|
| 81 |
|
|
| 82 |
|
private boolean applyToUnselectedSequences; |
| 83 |
|
|
| 84 |
|
|
| 85 |
|
private Map<String, String> selectedTypes = new HashMap<>(); |
| 86 |
|
|
| 87 |
|
|
| 88 |
|
|
| 89 |
|
|
| 90 |
|
@param |
| 91 |
|
|
| |
|
| 87.5% |
Uncovered Elements: 1 (8) |
Complexity: 2 |
Complexity Density: 0.25 |
|
| 92 |
17 |
public AnnotationChooser(AlignmentPanel alignPane)... |
| 93 |
|
{ |
| 94 |
17 |
super(); |
| 95 |
17 |
this.ap = alignPane; |
| 96 |
17 |
this.sg = alignPane.av.getSelectionGroup(); |
| 97 |
17 |
saveResetState(alignPane.getAlignment()); |
| 98 |
|
|
| 99 |
17 |
try |
| 100 |
|
{ |
| 101 |
17 |
jbInit(); |
| 102 |
|
} catch (Exception ex) |
| 103 |
|
{ |
| 104 |
0 |
ex.printStackTrace(); |
| 105 |
|
} |
| 106 |
17 |
showFrame(); |
| 107 |
|
} |
| 108 |
|
|
| 109 |
|
|
| 110 |
|
|
| 111 |
|
|
| 112 |
|
|
| 113 |
|
@param |
| 114 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (7) |
Complexity: 2 |
Complexity Density: 0.4 |
|
| 115 |
17 |
protected void saveResetState(AlignmentI alignment)... |
| 116 |
|
{ |
| 117 |
17 |
AlignmentAnnotation[] annotations = alignment.getAlignmentAnnotation(); |
| 118 |
17 |
final int count = annotations.length; |
| 119 |
17 |
this.resetState = new boolean[count]; |
| 120 |
170 |
for (int i = 0; i < count; i++) |
| 121 |
|
{ |
| 122 |
153 |
this.resetState[i] = annotations[i].visible; |
| 123 |
|
} |
| 124 |
|
} |
| 125 |
|
|
| 126 |
|
|
| 127 |
|
|
| 128 |
|
|
| 129 |
|
|
| 130 |
|
|
| 131 |
|
|
| 132 |
|
|
| 133 |
|
|
| 134 |
|
|
| 135 |
|
|
| 136 |
|
|
| 137 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 1 |
Complexity Density: 0.2 |
|
| 138 |
17 |
protected void jbInit()... |
| 139 |
|
{ |
| 140 |
17 |
setLayout(new GridLayout(3, 1)); |
| 141 |
17 |
add(buildAnnotationTypesPanel()); |
| 142 |
17 |
add(buildShowHideOptionsPanel()); |
| 143 |
17 |
add(buildActionButtonsPanel()); |
| 144 |
17 |
validate(); |
| 145 |
|
} |
| 146 |
|
|
| 147 |
|
|
| 148 |
|
|
| 149 |
|
|
| 150 |
|
@return |
| 151 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (8) |
Complexity: 1 |
Complexity Density: 0.12 |
|
| 152 |
17 |
protected JPanel buildAnnotationTypesPanel()... |
| 153 |
|
{ |
| 154 |
17 |
JPanel jp = new JPanel(new FlowLayout(FlowLayout.LEFT)); |
| 155 |
|
|
| 156 |
17 |
List<String> annotationTypes = getAnnotationTypes( |
| 157 |
|
this.ap.getAlignment(), true); |
| 158 |
|
|
| 159 |
17 |
for (final String type : annotationTypes) |
| 160 |
|
{ |
| 161 |
34 |
final Checkbox check = new Checkbox(type); |
| 162 |
34 |
check.setFont(CHECKBOX_FONT); |
| 163 |
34 |
check.addItemListener(new ItemListener() |
| 164 |
|
{ |
| |
|
| 100% |
Uncovered Elements: 0 (6) |
Complexity: 2 |
Complexity Density: 0.5 |
|
| 165 |
14 |
@Override... |
| 166 |
|
public void itemStateChanged(ItemEvent evt) |
| 167 |
|
{ |
| 168 |
14 |
if (evt.getStateChange() == ItemEvent.SELECTED) |
| 169 |
|
{ |
| 170 |
10 |
AnnotationChooser.this.selectedTypes.put(type, type); |
| 171 |
|
} |
| 172 |
|
else |
| 173 |
|
{ |
| 174 |
4 |
AnnotationChooser.this.selectedTypes.remove(type); |
| 175 |
|
} |
| 176 |
14 |
changeTypeSelected_actionPerformed(type); |
| 177 |
|
} |
| 178 |
|
}); |
| 179 |
34 |
jp.add(check); |
| 180 |
|
} |
| 181 |
17 |
return jp; |
| 182 |
|
} |
| 183 |
|
|
| 184 |
|
|
| 185 |
|
|
| 186 |
|
|
| 187 |
|
|
| 188 |
|
|
| 189 |
|
|
| 190 |
|
|
| 191 |
|
|
| 192 |
|
|
| 193 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
| 194 |
8 |
protected void changeApplyTo_actionPerformed()... |
| 195 |
|
{ |
| 196 |
8 |
setAnnotationVisibility(true); |
| 197 |
|
|
| 198 |
8 |
ap.updateAnnotation(); |
| 199 |
|
} |
| 200 |
|
|
| 201 |
|
|
| 202 |
|
|
| 203 |
|
|
| 204 |
|
|
| 205 |
|
|
| 206 |
|
|
| 207 |
|
|
| 208 |
|
|
| 209 |
|
|
| 210 |
|
@param |
| 211 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (9) |
Complexity: 5 |
Complexity Density: 1 |
|
| 212 |
14 |
protected void changeTypeSelected_actionPerformed(String type)... |
| 213 |
|
{ |
| 214 |
14 |
boolean typeSelected = this.selectedTypes.containsKey(type); |
| 215 |
14 |
for (AlignmentAnnotation aa : this.ap.getAlignment() |
| 216 |
|
.getAlignmentAnnotation()) |
| 217 |
|
{ |
| 218 |
126 |
if (aa.sequenceRef != null && type.equals(aa.label) |
| 219 |
|
&& isInActionScope(aa)) |
| 220 |
|
{ |
| 221 |
22 |
aa.visible = typeSelected ? this.showSelected : !this.showSelected; |
| 222 |
|
} |
| 223 |
|
} |
| 224 |
14 |
ap.updateAnnotation(); |
| 225 |
|
} |
| 226 |
|
|
| 227 |
|
|
| 228 |
|
|
| 229 |
|
|
| 230 |
|
|
| 231 |
|
|
| 232 |
|
|
| 233 |
|
|
| 234 |
|
@param |
| 235 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
| 236 |
11 |
protected void changeShowHide_actionPerformed()... |
| 237 |
|
{ |
| 238 |
11 |
setAnnotationVisibility(false); |
| 239 |
|
|
| 240 |
11 |
ap.updateAnnotation(); |
| 241 |
|
} |
| 242 |
|
|
| 243 |
|
|
| 244 |
|
|
| 245 |
|
|
| 246 |
|
@param |
| 247 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
| 248 |
19 |
protected void setAnnotationVisibility(boolean updateAllRows)... |
| 249 |
|
{ |
| 250 |
19 |
for (AlignmentAnnotation aa : this.ap.getAlignment() |
| 251 |
|
.getAlignmentAnnotation()) |
| 252 |
|
{ |
| 253 |
171 |
if (aa.sequenceRef != null) |
| 254 |
|
{ |
| 255 |
76 |
setAnnotationVisibility(aa, updateAllRows); |
| 256 |
|
} |
| 257 |
|
} |
| 258 |
|
} |
| 259 |
|
|
| 260 |
|
|
| 261 |
|
|
| 262 |
|
|
| 263 |
|
|
| 264 |
|
|
| 265 |
|
|
| 266 |
|
|
| 267 |
|
|
| 268 |
|
|
| 269 |
|
|
| 270 |
|
|
| 271 |
|
|
| 272 |
|
|
| 273 |
|
@param |
| 274 |
|
@param |
| 275 |
|
|
| |
|
| 81.8% |
Uncovered Elements: 2 (11) |
Complexity: 4 |
Complexity Density: 0.8 |
|
| 276 |
76 |
protected void setAnnotationVisibility(AlignmentAnnotation aa,... |
| 277 |
|
boolean updateAllRows) |
| 278 |
|
{ |
| 279 |
76 |
if (this.selectedTypes.containsKey(aa.label)) |
| 280 |
|
{ |
| 281 |
4 |
if (isInActionScope(aa)) |
| 282 |
|
{ |
| 283 |
3 |
aa.visible = this.showSelected; |
| 284 |
|
} |
| 285 |
1 |
else if (updateAllRows) |
| 286 |
|
{ |
| 287 |
0 |
aa.visible = !this.showSelected; |
| 288 |
|
} |
| 289 |
|
} |
| 290 |
|
|
| 291 |
|
|
| 292 |
|
} |
| 293 |
|
|
| 294 |
|
|
| 295 |
|
|
| 296 |
|
|
| 297 |
|
|
| 298 |
|
|
| 299 |
|
|
| 300 |
|
|
| 301 |
|
|
| 302 |
|
@param |
| 303 |
|
@return |
| 304 |
|
|
| |
|
| 89.5% |
Uncovered Elements: 2 (19) |
Complexity: 7 |
Complexity Density: 0.78 |
|
| 305 |
42 |
protected boolean isInActionScope(AlignmentAnnotation aa)... |
| 306 |
|
{ |
| 307 |
42 |
boolean result = false; |
| 308 |
42 |
if (this.applyToSelectedSequences && this.applyToUnselectedSequences) |
| 309 |
|
{ |
| 310 |
|
|
| 311 |
18 |
result = true; |
| 312 |
|
} |
| 313 |
24 |
else if (this.sg == null) |
| 314 |
|
{ |
| 315 |
|
|
| 316 |
0 |
result = true; |
| 317 |
|
} |
| 318 |
24 |
else if (this.sg.getSequences().contains(aa.sequenceRef)) |
| 319 |
|
{ |
| 320 |
|
|
| 321 |
11 |
result = this.applyToSelectedSequences ? true : false; |
| 322 |
|
} |
| 323 |
|
else |
| 324 |
|
{ |
| 325 |
|
|
| 326 |
13 |
result = this.applyToUnselectedSequences ? true : false; |
| 327 |
|
} |
| 328 |
42 |
return result; |
| 329 |
|
} |
| 330 |
|
|
| 331 |
|
|
| 332 |
|
|
| 333 |
|
|
| 334 |
|
|
| 335 |
|
|
| 336 |
|
|
| 337 |
|
|
| 338 |
|
@param |
| 339 |
|
@param |
| 340 |
|
@return |
| 341 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (11) |
Complexity: 4 |
Complexity Density: 0.57 |
|
| 342 |
19 |
public static List<String> getAnnotationTypes(AlignmentI alignment,... |
| 343 |
|
boolean sequenceSpecificOnly) |
| 344 |
|
{ |
| 345 |
19 |
List<String> result = new ArrayList<>(); |
| 346 |
19 |
for (AlignmentAnnotation aa : alignment.getAlignmentAnnotation()) |
| 347 |
|
{ |
| 348 |
171 |
if (!sequenceSpecificOnly || aa.sequenceRef != null) |
| 349 |
|
{ |
| 350 |
81 |
String label = aa.label; |
| 351 |
81 |
if (!result.contains(label)) |
| 352 |
|
{ |
| 353 |
43 |
result.add(label); |
| 354 |
|
} |
| 355 |
|
} |
| 356 |
|
} |
| 357 |
19 |
return result; |
| 358 |
|
} |
| 359 |
|
|
| 360 |
|
|
| 361 |
|
|
| 362 |
|
|
| 363 |
|
|
| 364 |
|
|
| 365 |
|
|
| 366 |
|
|
| 367 |
|
@return |
| 368 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (7) |
Complexity: 1 |
Complexity Density: 0.14 |
|
| 369 |
18 |
protected JPanel buildShowHideOptionsPanel()... |
| 370 |
|
{ |
| 371 |
18 |
JPanel jp = new JPanel(); |
| 372 |
18 |
jp.setLayout(new BorderLayout()); |
| 373 |
|
|
| 374 |
18 |
JPanel showHideOptions = buildShowHidePanel(); |
| 375 |
18 |
jp.add(showHideOptions, BorderLayout.CENTER); |
| 376 |
|
|
| 377 |
18 |
JPanel applyToOptions = buildApplyToOptionsPanel(); |
| 378 |
18 |
jp.add(applyToOptions, BorderLayout.SOUTH); |
| 379 |
|
|
| 380 |
18 |
return jp; |
| 381 |
|
} |
| 382 |
|
|
| 383 |
|
|
| 384 |
|
|
| 385 |
|
|
| 386 |
|
|
| 387 |
|
|
| 388 |
|
|
| 389 |
|
|
| 390 |
|
|
| 391 |
|
@return |
| 392 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (20) |
Complexity: 1 |
Complexity Density: 0.05 |
|
| 393 |
20 |
protected JPanel buildApplyToOptionsPanel()... |
| 394 |
|
{ |
| 395 |
20 |
final boolean wholeAlignment = this.sg == null; |
| 396 |
20 |
JPanel applyToOptions = new JPanel(new FlowLayout(FlowLayout.LEFT)); |
| 397 |
20 |
CheckboxGroup actingOn = new CheckboxGroup(); |
| 398 |
|
|
| 399 |
20 |
String forAll = MessageManager.getString("label.all_sequences"); |
| 400 |
20 |
final Checkbox allSequences = new Checkbox(forAll, actingOn, |
| 401 |
|
wholeAlignment); |
| 402 |
20 |
allSequences.addItemListener(new ItemListener() |
| 403 |
|
{ |
| |
|
| 83.3% |
Uncovered Elements: 1 (6) |
Complexity: 2 |
Complexity Density: 0.5 |
|
| 404 |
5 |
@Override... |
| 405 |
|
public void itemStateChanged(ItemEvent evt) |
| 406 |
|
{ |
| 407 |
5 |
if (evt.getStateChange() == ItemEvent.SELECTED) |
| 408 |
|
{ |
| 409 |
5 |
AnnotationChooser.this.setApplyToSelectedSequences(true); |
| 410 |
5 |
AnnotationChooser.this.setApplyToUnselectedSequences(true); |
| 411 |
5 |
AnnotationChooser.this.changeApplyTo_actionPerformed(); |
| 412 |
|
} |
| 413 |
|
} |
| 414 |
|
}); |
| 415 |
20 |
applyToOptions.add(allSequences); |
| 416 |
|
|
| 417 |
20 |
String forSelected = MessageManager |
| 418 |
|
.getString("label.selected_sequences"); |
| 419 |
20 |
final Checkbox selectedSequences = new Checkbox(forSelected, actingOn, |
| 420 |
|
!wholeAlignment); |
| 421 |
20 |
selectedSequences.setEnabled(!wholeAlignment); |
| 422 |
20 |
selectedSequences.addItemListener(new ItemListener() |
| 423 |
|
{ |
| |
|
| 83.3% |
Uncovered Elements: 1 (6) |
Complexity: 2 |
Complexity Density: 0.5 |
|
| 424 |
2 |
@Override... |
| 425 |
|
public void itemStateChanged(ItemEvent evt) |
| 426 |
|
{ |
| 427 |
2 |
if (evt.getStateChange() == ItemEvent.SELECTED) |
| 428 |
|
{ |
| 429 |
2 |
AnnotationChooser.this.setApplyToSelectedSequences(true); |
| 430 |
2 |
AnnotationChooser.this.setApplyToUnselectedSequences(false); |
| 431 |
2 |
AnnotationChooser.this.changeApplyTo_actionPerformed(); |
| 432 |
|
} |
| 433 |
|
} |
| 434 |
|
}); |
| 435 |
20 |
applyToOptions.add(selectedSequences); |
| 436 |
|
|
| 437 |
20 |
String exceptSelected = MessageManager |
| 438 |
|
.getString("label.except_selected_sequences"); |
| 439 |
20 |
final Checkbox unselectedSequences = new Checkbox(exceptSelected, |
| 440 |
|
actingOn, false); |
| 441 |
20 |
unselectedSequences.setEnabled(!wholeAlignment); |
| 442 |
20 |
unselectedSequences.addItemListener(new ItemListener() |
| 443 |
|
{ |
| |
|
| 83.3% |
Uncovered Elements: 1 (6) |
Complexity: 2 |
Complexity Density: 0.5 |
|
| 444 |
1 |
@Override... |
| 445 |
|
public void itemStateChanged(ItemEvent evt) |
| 446 |
|
{ |
| 447 |
1 |
if (evt.getStateChange() == ItemEvent.SELECTED) |
| 448 |
|
{ |
| 449 |
1 |
AnnotationChooser.this.setApplyToSelectedSequences(false); |
| 450 |
1 |
AnnotationChooser.this.setApplyToUnselectedSequences(true); |
| 451 |
1 |
AnnotationChooser.this.changeApplyTo_actionPerformed(); |
| 452 |
|
} |
| 453 |
|
} |
| 454 |
|
}); |
| 455 |
20 |
applyToOptions.add(unselectedSequences); |
| 456 |
|
|
| 457 |
|
|
| 458 |
20 |
this.applyToSelectedSequences = selectedSequences.getState() |
| 459 |
|
|| allSequences.getState(); |
| 460 |
20 |
this.applyToUnselectedSequences = unselectedSequences.getState() |
| 461 |
|
|| allSequences.getState(); |
| 462 |
|
|
| 463 |
20 |
return applyToOptions; |
| 464 |
|
} |
| 465 |
|
|
| 466 |
|
|
| 467 |
|
|
| 468 |
|
|
| 469 |
|
|
| 470 |
|
@return |
| 471 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (12) |
Complexity: 1 |
Complexity Density: 0.08 |
|
| 472 |
19 |
protected JPanel buildShowHidePanel()... |
| 473 |
|
{ |
| 474 |
19 |
JPanel showHideOptions = new JPanel(new FlowLayout(FlowLayout.LEFT)); |
| 475 |
19 |
CheckboxGroup showOrHide = new CheckboxGroup(); |
| 476 |
|
|
| 477 |
|
|
| 478 |
|
|
| 479 |
|
|
| 480 |
19 |
String showLabel = MessageManager |
| 481 |
|
.getString("label.show_selected_annotations"); |
| 482 |
19 |
final Checkbox showOption = new Checkbox(showLabel, showOrHide, false); |
| 483 |
19 |
showOption.addItemListener(new ItemListener() |
| 484 |
|
{ |
| |
|
| 80% |
Uncovered Elements: 1 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
| 485 |
4 |
@Override... |
| 486 |
|
public void itemStateChanged(ItemEvent evt) |
| 487 |
|
{ |
| 488 |
4 |
if (evt.getStateChange() == ItemEvent.SELECTED) |
| 489 |
|
{ |
| 490 |
4 |
AnnotationChooser.this.setShowSelected(true); |
| 491 |
4 |
AnnotationChooser.this.changeShowHide_actionPerformed(); |
| 492 |
|
} |
| 493 |
|
} |
| 494 |
|
}); |
| 495 |
19 |
showHideOptions.add(showOption); |
| 496 |
|
|
| 497 |
|
|
| 498 |
|
|
| 499 |
|
|
| 500 |
19 |
String hideLabel = MessageManager |
| 501 |
|
.getString("label.hide_selected_annotations"); |
| 502 |
19 |
final Checkbox hideOption = new Checkbox(hideLabel, showOrHide, true); |
| 503 |
19 |
hideOption.addItemListener(new ItemListener() |
| 504 |
|
{ |
| |
|
| 80% |
Uncovered Elements: 1 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
| 505 |
7 |
@Override... |
| 506 |
|
public void itemStateChanged(ItemEvent evt) |
| 507 |
|
{ |
| 508 |
7 |
if (evt.getStateChange() == ItemEvent.SELECTED) |
| 509 |
|
{ |
| 510 |
7 |
AnnotationChooser.this.setShowSelected(false); |
| 511 |
7 |
AnnotationChooser.this.changeShowHide_actionPerformed(); |
| 512 |
|
} |
| 513 |
|
} |
| 514 |
|
}); |
| 515 |
19 |
showHideOptions.add(hideOption); |
| 516 |
|
|
| 517 |
|
|
| 518 |
|
|
| 519 |
|
|
| 520 |
19 |
this.showSelected = showOption.getState(); |
| 521 |
|
|
| 522 |
19 |
return showHideOptions; |
| 523 |
|
} |
| 524 |
|
|
| 525 |
|
|
| 526 |
|
|
| 527 |
|
|
| 528 |
|
@return |
| 529 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (11) |
Complexity: 1 |
Complexity Density: 0.09 |
|
| 530 |
18 |
protected JPanel buildActionButtonsPanel()... |
| 531 |
|
{ |
| 532 |
18 |
JPanel jp = new JPanel(); |
| 533 |
18 |
final Font labelFont = JvSwingUtils.getLabelFont(); |
| 534 |
|
|
| 535 |
18 |
JButton ok = new JButton(MessageManager.getString("action.ok")); |
| 536 |
18 |
ok.setFont(labelFont); |
| 537 |
18 |
ok.addActionListener(new ActionListener() |
| 538 |
|
{ |
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 539 |
0 |
@Override... |
| 540 |
|
public void actionPerformed(ActionEvent e) |
| 541 |
|
{ |
| 542 |
0 |
close_actionPerformed(); |
| 543 |
|
} |
| 544 |
|
}); |
| 545 |
18 |
jp.add(ok); |
| 546 |
|
|
| 547 |
18 |
JButton cancel = new JButton(MessageManager.getString("action.cancel")); |
| 548 |
18 |
cancel.setFont(labelFont); |
| 549 |
18 |
cancel.addActionListener(new ActionListener() |
| 550 |
|
{ |
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 551 |
0 |
@Override... |
| 552 |
|
public void actionPerformed(ActionEvent e) |
| 553 |
|
{ |
| 554 |
0 |
cancel_actionPerformed(); |
| 555 |
|
} |
| 556 |
|
}); |
| 557 |
18 |
jp.add(cancel); |
| 558 |
|
|
| 559 |
18 |
return jp; |
| 560 |
|
} |
| 561 |
|
|
| 562 |
|
|
| 563 |
|
|
| 564 |
|
|
| |
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
| 565 |
0 |
protected void cancel_actionPerformed()... |
| 566 |
|
{ |
| 567 |
0 |
resetOriginalState(); |
| 568 |
0 |
this.ap.repaint(); |
| 569 |
0 |
close_actionPerformed(); |
| 570 |
|
} |
| 571 |
|
|
| 572 |
|
|
| 573 |
|
|
| 574 |
|
|
| 575 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
| 576 |
1 |
protected void resetOriginalState()... |
| 577 |
|
{ |
| 578 |
1 |
int i = 0; |
| 579 |
1 |
for (AlignmentAnnotation aa : this.ap.getAlignment() |
| 580 |
|
.getAlignmentAnnotation()) |
| 581 |
|
{ |
| 582 |
9 |
aa.visible = this.resetState[i++]; |
| 583 |
|
} |
| 584 |
|
} |
| 585 |
|
|
| 586 |
|
|
| 587 |
|
|
| 588 |
|
|
| |
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 2 |
Complexity Density: 1 |
|
| 589 |
0 |
protected void close_actionPerformed()... |
| 590 |
|
{ |
| 591 |
0 |
try |
| 592 |
|
{ |
| 593 |
0 |
this.frame.setClosed(true); |
| 594 |
|
} catch (Exception exe) |
| 595 |
|
{ |
| 596 |
|
} |
| 597 |
|
} |
| 598 |
|
|
| 599 |
|
|
| 600 |
|
|
| 601 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 1 |
Complexity Density: 0.2 |
|
| 602 |
17 |
private void showFrame()... |
| 603 |
|
{ |
| 604 |
17 |
frame = new JInternalFrame(); |
| 605 |
17 |
frame.setFrameIcon(null); |
| 606 |
17 |
frame.setContentPane(this); |
| 607 |
17 |
frame.setLayer(JLayeredPane.PALETTE_LAYER); |
| 608 |
17 |
Desktop.addInternalFrame(frame, |
| 609 |
|
MessageManager.getString("label.choose_annotations"), Desktop.FRAME_MAKE_VISIBLE, |
| 610 |
|
MY_FRAME_WIDTH, MY_FRAME_HEIGHT, Desktop.FRAME_ALLOW_RESIZE, Desktop.FRAME_SET_MIN_SIZE_300); |
| 611 |
|
} |
| 612 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 613 |
11 |
protected void setShowSelected(boolean showSelected)... |
| 614 |
|
{ |
| 615 |
11 |
this.showSelected = showSelected; |
| 616 |
|
} |
| 617 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 618 |
8 |
protected void setApplyToSelectedSequences(... |
| 619 |
|
boolean applyToSelectedSequences) |
| 620 |
|
{ |
| 621 |
8 |
this.applyToSelectedSequences = applyToSelectedSequences; |
| 622 |
|
} |
| 623 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 624 |
8 |
protected void setApplyToUnselectedSequences(... |
| 625 |
|
boolean applyToUnselectedSequences) |
| 626 |
|
{ |
| 627 |
8 |
this.applyToUnselectedSequences = applyToUnselectedSequences; |
| 628 |
|
} |
| 629 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 630 |
2 |
protected boolean isShowSelected()... |
| 631 |
|
{ |
| 632 |
2 |
return showSelected; |
| 633 |
|
} |
| 634 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 635 |
3 |
protected boolean isApplyToSelectedSequences()... |
| 636 |
|
{ |
| 637 |
3 |
return applyToSelectedSequences; |
| 638 |
|
} |
| 639 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 640 |
3 |
protected boolean isApplyToUnselectedSequences()... |
| 641 |
|
{ |
| 642 |
3 |
return applyToUnselectedSequences; |
| 643 |
|
} |
| 644 |
|
|
| 645 |
|
} |