Package org.jamesii.gui.application.action

Examples of org.jamesii.gui.application.action.IActionAction


   * {@link org.jamesii.gui.application.action.IActionAction#IActionAction(org.jamesii.gui.application.action.IAction)}
   * .
   */
  public final void testIActionAction() {
    TestAction ta = new TestAction();
    IActionAction a = new IActionAction(ta);
    assertNotNull(a);

    Icon i =
        new ImageIcon(new BufferedImage(16, 16, BufferedImage.TYPE_INT_RGB));

    // see whether label changes are propagated
    ta.setLabel("test123");
    assertEquals("test123", a.getValue(Action.NAME));
    ta.setLabel("test");
    assertEquals("test", a.getValue(Action.NAME));

    // see whether enable changes are propagated to the IActionAction
    ta.setEnabled(!ta.isEnabled());
    assertTrue(a.isEnabled() == ta.isEnabled());
    ta.setEnabled(!ta.isEnabled());
    assertTrue(a.isEnabled() == ta.isEnabled());

    // see whether toggle state is propagated to the IActionAction
    ta.setToggleOn(true);
    assertTrue(Boolean.TRUE.equals(a.getValue(Action.SELECTED_KEY)));
    ta.setToggleOn(false);
    assertTrue(Boolean.FALSE.equals(a.getValue(Action.SELECTED_KEY)));

    // see whether enable changes are propagated to the IAction
    a.setEnabled(!a.isEnabled());
    assertTrue(a.isEnabled() == ta.isEnabled());
    a.setEnabled(!a.isEnabled());
    assertTrue(a.isEnabled() == ta.isEnabled());

    // see whether label changes are propagated to the IAction
    a.putValue(Action.NAME, "Hello");
    assertEquals("Hello", ta.getLabel());
    a.putValue(Action.NAME, "World");
    assertEquals("World", ta.getLabel());

    a.putValue(Action.SMALL_ICON, i);
    // assertEquals("Should it be propagated to ta, since there is no setIcon method yet?",
    // i, ta.getIcon());

    // see whether toggle state is propagated to the IAction
    a.putValue(Action.SELECTED_KEY, false);
    assertFalse(ta.isToggleOn());
    a.putValue(Action.SELECTED_KEY, true);
    assertTrue(ta.isToggleOn());
  }
View Full Code Here


   */
  public final void testActionPerformed() {
    // check whether the execute method of the IAction object is called when
    // calling actionPerformed on the Action
    TestAction ta = new TestAction();
    IActionAction a = new IActionAction(ta);
    assertNotNull(a);

    assertFalse(ta.executed);
    a.actionPerformed(null);
    assertTrue(ta.executed);
  }
View Full Code Here

TOP

Related Classes of org.jamesii.gui.application.action.IActionAction

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.