| 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 org.fest.swing.driver.ComponentStateValidator.validateIsEnabledAndShowing; |
| 19 |
|
import static org.fest.swing.driver.ComponentStateValidator.validateIsShowing; |
| 20 |
|
import static org.fest.swing.format.Formatting.format; |
| 21 |
|
import static org.fest.util.Strings.concat; |
| 22 |
|
|
| 23 |
|
import java.awt.*; |
| 24 |
|
|
| 25 |
|
import javax.swing.JInternalFrame; |
| 26 |
|
|
| 27 |
|
import org.fest.swing.annotation.RunsInCurrentThread; |
| 28 |
|
|
| 29 |
|
|
| 30 |
|
@link |
| 31 |
|
|
| 32 |
|
|
| 33 |
|
|
| 34 |
|
|
| 35 |
|
|
| 36 |
|
@author |
| 37 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (29) |
Complexity: 9 |
Complexity Density: 0.6 |
|
| 38 |
|
final class ContainerStateValidator { |
| 39 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (10) |
Complexity: 3 |
Complexity Density: 0.5 |
|
| 40 |
40
|
@RunsInCurrentThread... |
| 41 |
|
static void validateCanResize(Container c) { |
| 42 |
40
|
if (c instanceof JInternalFrame) { |
| 43 |
7
|
validateCanResize((JInternalFrame)c); |
| 44 |
5
|
return; |
| 45 |
|
} |
| 46 |
24
|
if (isResizable(c)) validateIsEnabledAndShowing(c); |
| 47 |
9
|
else throw containerNotResizableFailure(c); |
| 48 |
|
} |
| 49 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
| 50 |
7
|
@RunsInCurrentThread... |
| 51 |
|
private static void validateCanResize(JInternalFrame internalFrame) { |
| 52 |
7
|
validateIsShowing(internalFrame); |
| 53 |
1
|
if (!internalFrame.isResizable()) throw containerNotResizableFailure(internalFrame); |
| 54 |
|
} |
| 55 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (9) |
Complexity: 3 |
Complexity Density: 0.6 |
|
| 56 |
33
|
@RunsInCurrentThread... |
| 57 |
|
private static boolean isResizable(Container c) { |
| 58 |
4
|
if (c instanceof Dialog) return ((Dialog)c).isResizable(); |
| 59 |
28
|
if (c instanceof Frame) return ((Frame)c).isResizable(); |
| 60 |
1
|
return false; |
| 61 |
|
} |
| 62 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 63 |
10
|
@RunsInCurrentThread... |
| 64 |
|
private static IllegalStateException containerNotResizableFailure(Container c) { |
| 65 |
10
|
throw new IllegalStateException(concat("Expecting component ", format(c), " to be resizable by the user")); |
| 66 |
|
} |
| 67 |
|
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
| 68 |
|
private ContainerStateValidator() {}... |
| 69 |
|
} |