public class NegativeActionTest extends TestCase { @Action(call = "failure") private final Object object = new Object(); final Bindings bindings = new Bindings(); public void testFailure() { try { bindings.bind(this); fail("should not allow @Action binding to object with no addActionListener"); } catch (Exception e) { e.printStackTrace(); } } }
@Bindable private abstract static class Base { @Action(call = "this.refresh") JButton button = new JButton("test"); abstract public void refresh(); }
public class InaccessibleControllerMethodTest extends TestCase { // final NegativeModel model = new NegativeModel(); @Bindable final NegativeController controller = new NegativeController(); @Action(call = "privateMethod") private final JButton button = new JButton("button"); final Bindings bindings = new Bindings(); public void testFailure() { try { bindings.bind(this); fail("should not allow binding to inaccessible controller methods"); } catch (Exception e) { // passes } } }
@Action(call = "demoAction") @Action(call = "demoAction2") private final JButton demoButton2 = new JButton("demo2"); @Action(call = "count") private final JButton countButton = new JButton("count"); private final JRadioButton bazButton = new JRadioButton("Baz (Red Background)"); @Action(call = "setToFoo") private final JButton setToFooButton = new JButton("Foo"); private final JList demoList = new JList(); @Action(call = "changeList") private final JButton changeList = new JButton("Change List"); @Action(call = "selectFox") private final JButton changeSelection = new JButton("Select Fox"); @Action(call = "controller.duplicate") private final JButton dup1 = new JButton("dup1"); @Action(call = "this.duplicate") private final JButton dup2 = new JButton("dup2");
@Action(call = "demoAction") @Action(call = "demoAction2") private final JButton demoButton2 = new JButton("demo2"); @Action(call = "count") private final JButton countButton = new JButton("count"); private final JRadioButton bazButton = new JRadioButton("Baz (Red Background)"); @Action(call = "setToFoo") private final JButton setToFooButton = new JButton("Foo"); private final JList demoMultiselectList = new JList(); @Action(call = "changeList") private final JButton changeList = new JButton("Change List"); @Action(call = "selectFox") private final JButton changeSelection = new JButton("Select Fox"); @Action(call = "controller.duplicate") private final JButton dup1 = new JButton("dup1"); @Action(call = "this.duplicate") private final JButton dup2 = new JButton("dup2");
@Action(call = "changeItems") private final JButton changeItems = new JButton("Change");
@Action(call = "demoAction") @EnabledIf(to = "demoBoolean") private final JButton demoButton1 = new JButton("Button 1"); @Action(call = "demoAction2") @VisibleIf(to = "demoBoolean") private final JButton demoButton2 = new JButton("Button 2"); @Bound(to = "demoEnum", value = "BAZ") private final JRadioButton bazButton = new JRadioButton("Baz (Red Background)"); @Action(call = "setToFoo") private final JButton setToFooButton = new JButton("Foo"); @BoundSelection(to = "selectedItem") private final JList demoList = new JList(); @Action(call = "changeList") private final JButton changeList = new JButton("Change List"); @Action(call = "selectFox") private final JButton changeSelection = new JButton("Select Fox"); @OnClick(call = "listClicked", button = Button.RIGHT, count = 2) @Bound(to = "multiSelectedItems") private final JLabel multiselectContents = new JLabel(); @Action(call = "selectMulti") private final JButton selectMulti = new JButton("Select Bravo/Delta"); @Bound(to = "allowDrag") private final JCheckBox allowDrag = new JCheckBox("Allow Drag"); @Action(call = "clear") private final JButton clearButton = new JButton("Clear");