| 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.Font; |
| 24 |
|
import java.awt.event.ActionListener; |
| 25 |
|
|
| 26 |
|
import javax.swing.AbstractButton; |
| 27 |
|
import javax.swing.ButtonGroup; |
| 28 |
|
import javax.swing.JRadioButton; |
| 29 |
|
|
| |
|
| 78.4% |
Uncovered Elements: 8 (37) |
Complexity: 14 |
Complexity Density: 0.61 |
|
| 30 |
|
public class JalviewBooleanRadioButtons extends AbstractButton |
| 31 |
|
{ |
| 32 |
|
private static final Font LABEL_FONT = JvSwingUtils.getLabelFont(); |
| 33 |
|
|
| 34 |
|
private ButtonGroup buttonGroup = new ButtonGroup(); |
| 35 |
|
|
| 36 |
|
private JRadioButton buttonTrue = new JRadioButton(); |
| 37 |
|
|
| 38 |
|
private JRadioButton buttonFalse = new JRadioButton(); |
| 39 |
|
|
| |
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
| 40 |
0 |
public JalviewBooleanRadioButtons(boolean value, String trueLabel,... |
| 41 |
|
String falseLabel) |
| 42 |
|
{ |
| 43 |
0 |
init(); |
| 44 |
0 |
this.setLabels(trueLabel, falseLabel); |
| 45 |
|
} |
| 46 |
|
|
| |
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
| 47 |
0 |
public JalviewBooleanRadioButtons(boolean value)... |
| 48 |
|
{ |
| 49 |
0 |
init(); |
| 50 |
0 |
setSelected(value); |
| 51 |
|
} |
| 52 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 53 |
33 |
public JalviewBooleanRadioButtons()... |
| 54 |
|
{ |
| 55 |
33 |
init(); |
| 56 |
|
} |
| 57 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
| 58 |
33 |
protected void init()... |
| 59 |
|
{ |
| 60 |
33 |
buttonTrue.setFont(LABEL_FONT); |
| 61 |
33 |
buttonFalse.setFont(LABEL_FONT); |
| 62 |
33 |
buttonGroup.add(buttonTrue); |
| 63 |
33 |
buttonGroup.add(buttonFalse); |
| 64 |
|
} |
| 65 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
| 66 |
33 |
public void setLabels(String trueLabel, String falseLabel)... |
| 67 |
|
{ |
| 68 |
33 |
buttonTrue.setText(trueLabel); |
| 69 |
33 |
buttonFalse.setText(falseLabel); |
| 70 |
|
} |
| 71 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
| 72 |
66 |
@Override... |
| 73 |
|
public void setSelected(boolean b) |
| 74 |
|
{ |
| 75 |
66 |
buttonFalse.setSelected(!b); |
| 76 |
|
|
| 77 |
|
|
| 78 |
66 |
buttonTrue.setSelected(b); |
| 79 |
|
} |
| 80 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 81 |
107 |
@Override... |
| 82 |
|
public boolean isSelected() |
| 83 |
|
{ |
| 84 |
|
|
| 85 |
107 |
return buttonTrue.isSelected() && !buttonFalse.isSelected(); |
| 86 |
|
} |
| 87 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
| 88 |
110 |
@Override... |
| 89 |
|
public void setEnabled(boolean b) |
| 90 |
|
{ |
| 91 |
110 |
buttonTrue.setEnabled(b); |
| 92 |
110 |
buttonFalse.setEnabled(b); |
| 93 |
|
} |
| 94 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 95 |
44 |
@Override... |
| 96 |
|
public boolean isEnabled() |
| 97 |
|
{ |
| 98 |
44 |
return buttonTrue.isEnabled() && buttonFalse.isEnabled(); |
| 99 |
|
} |
| 100 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 101 |
33 |
public JRadioButton getTrueButton()... |
| 102 |
|
{ |
| 103 |
33 |
return buttonTrue; |
| 104 |
|
} |
| 105 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 106 |
33 |
public JRadioButton getFalseButton()... |
| 107 |
|
{ |
| 108 |
33 |
return buttonFalse; |
| 109 |
|
} |
| 110 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
| 111 |
33 |
@Override... |
| 112 |
|
public void addActionListener(ActionListener l) |
| 113 |
|
{ |
| 114 |
33 |
buttonTrue.addActionListener(l); |
| 115 |
33 |
buttonFalse.addActionListener(l); |
| 116 |
|
} |
| 117 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 118 |
11 |
public void addTrueActionListener(ActionListener l)... |
| 119 |
|
{ |
| 120 |
11 |
buttonTrue.addActionListener(l); |
| 121 |
|
} |
| 122 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 123 |
0 |
public void addFalseActionListener(ActionListener l)... |
| 124 |
|
{ |
| 125 |
0 |
buttonFalse.addActionListener(l); |
| 126 |
|
} |
| 127 |
|
} |