| 1 |
|
|
| 2 |
|
|
| 3 |
|
|
| 4 |
|
|
| 5 |
|
|
| 6 |
|
|
| 7 |
|
|
| 8 |
|
|
| 9 |
|
|
| 10 |
|
|
| 11 |
|
|
| 12 |
|
|
| 13 |
|
|
| 14 |
|
|
| 15 |
|
|
| 16 |
|
package org.fest.swing.driver; |
| 17 |
|
|
| 18 |
|
import static java.lang.Boolean.parseBoolean; |
| 19 |
|
import static org.fest.swing.edt.GuiActionRunner.execute; |
| 20 |
|
|
| 21 |
|
import java.awt.Point; |
| 22 |
|
|
| 23 |
|
import javax.swing.JCheckBox; |
| 24 |
|
import javax.swing.JTable; |
| 25 |
|
import javax.swing.text.JTextComponent; |
| 26 |
|
|
| 27 |
|
import org.fest.swing.annotation.RunsInEDT; |
| 28 |
|
import org.fest.swing.cell.JTableCellWriter; |
| 29 |
|
import org.fest.swing.core.Robot; |
| 30 |
|
import org.fest.swing.edt.GuiQuery; |
| 31 |
|
import org.fest.swing.util.Pair; |
| 32 |
|
|
| 33 |
|
|
| 34 |
|
@link |
| 35 |
|
@link |
| 36 |
|
|
| 37 |
|
@author |
| 38 |
|
@author |
| 39 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (18) |
Complexity: 6 |
Complexity Density: 0.55 |
|
| 40 |
|
public class JTableCheckBoxEditorCellWriter extends AbstractJTableCellWriter { |
| 41 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 42 |
178
|
public JTableCheckBoxEditorCellWriter(Robot robot) {... |
| 43 |
178
|
super(robot); |
| 44 |
|
} |
| 45 |
|
|
| 46 |
|
@inheritDoc |
|
|
|
| 100% |
Uncovered Elements: 0 (7) |
Complexity: 2 |
Complexity Density: 0.4 |
|
| 47 |
8
|
@RunsInEDT... |
| 48 |
|
public void enterValue(JTable table, int row, int column, String value) { |
| 49 |
8
|
boolean realValue = parseBoolean(value); |
| 50 |
8
|
Pair<Boolean, Point> editingInfo = doStartCellEditing(table, row, column, location); |
| 51 |
3
|
if (editingInfo.i == realValue) return; |
| 52 |
4
|
robot.click(table, editingInfo.ii); |
| 53 |
|
} |
| 54 |
|
|
| 55 |
|
@inheritDoc |
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 56 |
1
|
@RunsInEDT... |
| 57 |
|
public void startCellEditing(JTable table, int row, int column) { |
| 58 |
1
|
doStartCellEditing(table, row, column, location); |
| 59 |
|
} |
| 60 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 61 |
9
|
@RunsInEDT... |
| 62 |
|
private static Pair<Boolean, Point> doStartCellEditing(final JTable table, final int row, final int column, |
| 63 |
|
final JTableLocation location) { |
| 64 |
9
|
return execute(new GuiQuery<Pair<Boolean, Point>>() { |
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
| 65 |
9
|
protected Pair<Boolean, Point> executeInEDT() {... |
| 66 |
9
|
JCheckBox editor = editor(table, row, column, JCheckBox.class); |
| 67 |
7
|
scrollToCell(table, row, column, location); |
| 68 |
7
|
return new Pair<Boolean, Point>(editor.isSelected(), location.pointAt(table, row, column)); |
| 69 |
|
} |
| 70 |
|
}); |
| 71 |
|
} |
| 72 |
|
} |