Package org.springframework.richclient.command.config

Examples of org.springframework.richclient.command.config.CommandButtonIconInfo


    if (icon == null) {
      return;
    }

    CommandButtonIconInfo iconInfo;

    if (loadOptionalIcons) {
      Icon selectedIcon = loadIcon(objectName, SELECTED_ICON_KEY, large);
      Icon rolloverIcon = loadIcon(objectName, ROLLOVER_ICON_KEY, large);
      Icon disabledIcon = loadIcon(objectName, DISABLED_ICON_KEY, large);
      Icon pressedIcon = loadIcon(objectName, PRESSED_ICON_KEY, large);
      iconInfo = new CommandButtonIconInfo(icon, selectedIcon, rolloverIcon, disabledIcon, pressedIcon);
    }
    else {
      iconInfo = new CommandButtonIconInfo(icon);
    }

    if (large) {
      object.setLargeIconInfo(iconInfo);
    }
View Full Code Here


    Icon expectedSelectedLargeIcon = new ImageIcon();
    Icon expectedRolloverLargeIcon = new ImageIcon();
    Icon expectedDisabledLargeIcon = new ImageIcon();
    Icon expectedPressedLargeIcon = new ImageIcon();

    CommandButtonIconInfo expectedIconInfo = new CommandButtonIconInfo(expectedIcon, expectedSelectedIcon,
        expectedRolloverIcon, expectedDisabledIcon, expectedPressedIcon);

    CommandButtonIconInfo expectedLargeIconInfo = new CommandButtonIconInfo(expectedLargeIcon,
        expectedSelectedLargeIcon, expectedRolloverLargeIcon, expectedDisabledLargeIcon,
        expectedPressedLargeIcon);

    // Create the required mock objects
    IconSource iconSource = (IconSource) EasyMock.createMock(IconSource.class);
    CommandIconConfigurable configurable = (CommandIconConfigurable) EasyMock
        .createMock(CommandIconConfigurable.class);

    // Create the configurer with the mock icon source
    DefaultApplicationObjectConfigurer configurer = new DefaultApplicationObjectConfigurer(null, null, iconSource,
        null);

    EasyMock.expect(iconSource.getIcon(iconKey)).andReturn(expectedIcon);
    EasyMock.expect(iconSource.getIcon(disabledIconKey)).andReturn(expectedDisabledIcon);
    EasyMock.expect(iconSource.getIcon(selectedIconKey)).andReturn(expectedSelectedIcon);
    EasyMock.expect(iconSource.getIcon(rolloverIconKey)).andReturn(expectedRolloverIcon);
    EasyMock.expect(iconSource.getIcon(pressedIconKey)).andReturn(expectedPressedIcon);
    EasyMock.expect(iconSource.getIcon(largeIconKey)).andReturn(expectedLargeIcon);
    EasyMock.expect(iconSource.getIcon(disabledLargeIconKey)).andReturn(expectedDisabledLargeIcon);
    EasyMock.expect(iconSource.getIcon(selectedLargeIconKey)).andReturn(expectedSelectedLargeIcon);
    EasyMock.expect(iconSource.getIcon(rolloverLargeIconKey)).andReturn(expectedRolloverLargeIcon);
    EasyMock.expect(iconSource.getIcon(pressedLargeIconKey)).andReturn(expectedPressedLargeIcon);
    configurable.setIconInfo(expectedIconInfo);
    configurable.setLargeIconInfo(expectedLargeIconInfo);

    EasyMock.replay(iconSource);
    EasyMock.replay(configurable);

    configurer.configure(configurable, objectName);

    EasyMock.verify(iconSource);
    EasyMock.verify(configurable);

    // Reset the mock objects for the next test
    EasyMock.reset(iconSource);
    EasyMock.reset(configurable);

    // Set the expectations. This time the loadOptionalIcons will be set to
    // false.
    configurer.setLoadOptionalIcons(false);
    expectedIconInfo = new CommandButtonIconInfo(expectedIcon);
    expectedLargeIconInfo = new CommandButtonIconInfo(expectedLargeIcon);
    EasyMock.expect(iconSource.getIcon(iconKey)).andReturn(expectedIcon);
    EasyMock.expect(iconSource.getIcon(largeIconKey)).andReturn(expectedLargeIcon);
    configurable.setIconInfo(expectedIconInfo);
    configurable.setLargeIconInfo(expectedLargeIconInfo);
View Full Code Here

TOP

Related Classes of org.springframework.richclient.command.config.CommandButtonIconInfo

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.