Package org.springframework.richclient.image

Examples of org.springframework.richclient.image.IconSource


    public Icon getIcon() {
        if (severity == null) {
            return null;
        }
        try {
            IconSource iconSource = (IconSource)ApplicationServicesLocator.services().getService(IconSource.class);
            return iconSource.getIcon("severity." + severity.getLabel());
        }
        catch (NoSuchImageResourceException e) {
            return null;
        }
    }
View Full Code Here


    statusItem.setText(message);
    statusItem.setIcon(icon);
  }
 
    private ImageIcon getImageIcon(String key){
      IconSource iconSource = (IconSource)ApplicationServicesLocator.services().getService(IconSource.class);
      Icon icon = iconSource.getIcon(key);
      return (ImageIcon)icon;
    }
View Full Code Here

 
  public IconProgressStatusBarItem(){
  }

  public AbstractButton createCancelButton(){
    IconSource iconSource = (IconSource)ApplicationServicesLocator.services().getService(IconSource.class);
    MessageSource messageSource = (MessageSource)ApplicationServicesLocator.services().getService(MessageSource.class);
    AbstractAction action = new AbstractAction(null, iconSource.getIcon(CANCEL_ICON)){
      public void actionPerformed(ActionEvent event) {
        CancelCallback callback = getCancelCallback();
        if(callback != null){
          callback.cancelPerformed();
        }
View Full Code Here

    if (logger.isInfoEnabled()) {
      logger.info("Creating dockable frame for page component "+ pageComponent.getId());
    }
    Icon icon = pageComponent.getIcon();
    if (icon == null) {
      IconSource iconSource = (IconSource)ApplicationServicesLocator.services().getService(IconSource.class);
      icon = iconSource.getIcon("applicationInfo.image");
    }
    DockableFrame dockableFrame = new DockableFrame(pageComponent.getId(), icon);
    dockableFrame.setTitle(pageComponent.getDisplayName());
    dockableFrame.setTabTitle(pageComponent.getDisplayName());
    dockableFrame.setFrameIcon(icon);
View Full Code Here

      control.setName("dirtyOverlay");

      control.setOpaque(true);

      IconSource iconSource = (IconSource) ApplicationServicesLocator.services().getService(IconSource.class);
      Icon icon = iconSource.getIcon(DIRTY_ICON_KEY);
      dirtyLabel = new JLabel(icon);
      control.add(dirtyLabel, BorderLayout.CENTER);

      createRevertButton();
      control.add(revertButton, BorderLayout.LINE_END);
View Full Code Here

      return control;
    }

    private void createRevertButton() {
      IconSource iconSource = (IconSource) ApplicationServicesLocator.services().getService(IconSource.class);
      Icon icon = iconSource.getIcon(REVERT_ICON_KEY);

      revertButton = new JButton(icon);
      revertButton.setBorderPainted(false);
      revertButton.setContentAreaFilled(false);
      revertButton.setFocusable(false);
View Full Code Here

    String objectName = "bogusIconConfigurable";
    String iconKey = objectName + ".icon";
    Icon expectedIcon = new TestIcon(Color.GREEN);

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

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

    // Set the expectations for the mock objects. For the first run, we
    // don't want the icon
    // source to be able to find the icon, so setIcon should be called with
    // a null value.
    EasyMock.expect(iconSource.getIcon(iconKey)).andReturn(expectedIcon);
    configurable.setIcon(expectedIcon);

    EasyMock.replay(iconSource);
    EasyMock.replay(configurable);
View Full Code Here

  public void testConfigureIconConfigurableWithNoIconFound() {
    String objectName = "undefinedIconConfigurable";
    String iconKey = objectName + ".icon";

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

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

    // Set the expectations for the mock objects. For the first run, we
    // don't want the icon
    // source to be able to find the icon, so setIcon should be called with
    // a null value.
    EasyMock.expect(iconSource.getIcon(iconKey)).andReturn(null);

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

    configurer.configure(configurable, objectName);
View Full Code Here

    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);

    EasyMock.replay(iconSource);
    EasyMock.replay(configurable);
View Full Code Here

    String objectName = "bogusCommandIconConfigurable";
    String iconKey = objectName + ".icon";
    String largeIconKey = objectName + ".large.icon";

    // 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(null);
    EasyMock.expect(iconSource.getIcon(largeIconKey)).andReturn(null);

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

    configurer.configure(configurable, objectName);
View Full Code Here

TOP

Related Classes of org.springframework.richclient.image.IconSource

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.