本文整理汇总了Java中org.springframework.richclient.image.ImageSource类的典型用法代码示例。如果您正苦于以下问题:Java ImageSource类的具体用法?Java ImageSource怎么用?Java ImageSource使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ImageSource类属于org.springframework.richclient.image包,在下文中一共展示了ImageSource类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testImageConfigurableWithNoImageFound
import org.springframework.richclient.image.ImageSource; //导入依赖的package包/类
public void testImageConfigurableWithNoImageFound() {
String objectName = "bogusImageConfigurable";
String iconKey = objectName + ".image";
// Create the required mock objects
ImageSource imageSource = (ImageSource) EasyMock.createMock(ImageSource.class);
ImageConfigurable configurable = (ImageConfigurable) EasyMock.createMock(ImageConfigurable.class);
// Create the configurer with the mock image source
DefaultApplicationObjectConfigurer configurer = new DefaultApplicationObjectConfigurer(null, imageSource, null,
null);
EasyMock.expect(imageSource.getImage(iconKey)).andReturn(null);
EasyMock.replay(imageSource);
EasyMock.replay(configurable);
configurer.configure(configurable, objectName);
EasyMock.verify(imageSource);
EasyMock.verify(configurable);
}
示例2: getImage
import org.springframework.richclient.image.ImageSource; //导入依赖的package包/类
public Image getImage() {
if( descriptor != null && descriptor.getImage() != null )
return descriptor.getImage();
try {
ImageSource isrc = (ImageSource) services().getService(ImageSource.class);
return isrc.getImage(DEFAULT_APPLICATION_IMAGE_KEY);
}
catch (NoSuchImageResourceException e) {
return null;
}
}
示例3: testImageConfigurable
import org.springframework.richclient.image.ImageSource; //导入依赖的package包/类
/**
* Confirms that a {@link ImageConfigurable} object will have its image set
* correctly, if the image source can find it using the key
* 'objectName.image'.
*/
public void testImageConfigurable() {
String objectName = "bogusImageConfigurable";
String iconKey = objectName + ".image";
Image expectedImage = new BufferedImage(32, 32, BufferedImage.TYPE_INT_RGB);
// Create the required mock objects
ImageSource imageSource = (ImageSource) EasyMock.createMock(ImageSource.class);
ImageConfigurable configurable = (ImageConfigurable) EasyMock.createMock(ImageConfigurable.class);
// Create the configurer with the mock image source
DefaultApplicationObjectConfigurer configurer = new DefaultApplicationObjectConfigurer(null, imageSource, null,
null);
EasyMock.expect(imageSource.getImage(iconKey)).andReturn(expectedImage);
configurable.setImage(expectedImage);
EasyMock.replay(imageSource);
EasyMock.replay(configurable);
configurer.configure(configurable, objectName);
EasyMock.verify(imageSource);
EasyMock.verify(configurable);
}
示例4: getImageSource
import org.springframework.richclient.image.ImageSource; //导入依赖的package包/类
protected ImageSource getImageSource() {
return (ImageSource)getService(ImageSource.class);
}
示例5: DefaultApplicationObjectConfigurer
import org.springframework.richclient.image.ImageSource; //导入依赖的package包/类
/**
* Creates a new {@code DefaultApplicationObjectConfigurer} that will use
* the given message, image and icon sources. If any of these services are
* null, they will be retrieved using the application services locator.
*
* @param messageSource The message source. May be null.
* @param imageSource The image source. May be null.
* @param iconSource The icon source. May be null.
* @param securityControllerManager The security controller manager. May be
* null.
*/
public DefaultApplicationObjectConfigurer(MessageSource messageSource, ImageSource imageSource,
IconSource iconSource, SecurityControllerManager securityControllerManager) {
this.messageSource = messageSource;
this.imageSource = imageSource;
this.iconSource = iconSource;
this.securityControllerManager = securityControllerManager;
}
示例6: getPropertyImage
import org.springframework.richclient.image.ImageSource; //导入依赖的package包/类
/**
* getPropertyImage.
*
* @param name String
* @return ImageIcon
*/
ImageIcon getPropertyImage(final String name) {
final ImageSource source = this.getImageSource();
final Image image = source.getImage(name);
return new ImageIcon(image);
}
示例7: getImage
import org.springframework.richclient.image.ImageSource; //导入依赖的package包/类
/**
* getImage.
*
* @param imageName String
* @return imageName
*/
public static Image getImage(final String imageName) {
final ImageSource source =
(ImageSource) ApplicationServicesLocator.services().getService(ImageSource.class);
return source.getImage(imageName);
}
示例8: setImageSource
import org.springframework.richclient.image.ImageSource; //导入依赖的package包/类
/**
* Set the image source service implementation
*
* @param imageSource
*/
public void setImageSource( ImageSource imageSource ) {
services.put( ImageSource.class, imageSource );
}
示例9: setImageSourceId
import org.springframework.richclient.image.ImageSource; //导入依赖的package包/类
/**
* Set the image source service implementation bean id
*
* @param imageSourceId bean id
*/
public void setImageSourceId( String imageSourceId ) {
services.put( ImageSource.class, imageSourceId );
}