01: package org.uispec4j;
02:
03: import junit.framework.Assert;
04: import org.uispec4j.assertion.Assertion;
05:
06: import javax.swing.*;
07: import java.awt.*;
08:
09: /**
10: * Wrapper for JToggleButton components.
11: */
12: public class ToggleButton extends AbstractButton {
13: public static final String TYPE_NAME = "toggleButton";
14: public static final Class[] SWING_CLASSES = { JToggleButton.class };
15:
16: private JToggleButton jToggleButton;
17:
18: public ToggleButton(JToggleButton jToggleButton) {
19: super (jToggleButton);
20: this .jToggleButton = jToggleButton;
21: }
22:
23: public Component getAwtComponent() {
24: return jToggleButton;
25: }
26:
27: public String getDescriptionTypeName() {
28: return TYPE_NAME;
29: }
30:
31: public Assertion isSelected() {
32: return new Assertion() {
33: public void check() {
34: Assert.assertTrue(jToggleButton.isSelected());
35: }
36: };
37: }
38: }
|