本文整理匯總了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 );
}