本文整理汇总了Java中org.eclipse.nebula.widgets.gallery.GalleryItem.setImage方法的典型用法代码示例。如果您正苦于以下问题:Java GalleryItem.setImage方法的具体用法?Java GalleryItem.setImage怎么用?Java GalleryItem.setImage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.nebula.widgets.gallery.GalleryItem
的用法示例。
在下文中一共展示了GalleryItem.setImage方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createGalleryItems
import org.eclipse.nebula.widgets.gallery.GalleryItem; //导入方法依赖的package包/类
private void createGalleryItems(){
//add text
if(group.getItemCount() > 0){
return;
}
for (int i=0; i<urls.size(); ++i) {
final GalleryItem item = new GalleryItem(group, SWT.MULTI);
// item.setText(0, "String 0\nString2");
// item.setText(1, "String 1");
item.setExpanded(true);
item.setImage(Images.LOADING_IMG);
item.setData("doNotScaleImage", new Object());
String transcribedLinesText = determineItemColor(item, transcripts.get(i));
setItemText(item, i, transcribedLinesText);
}
}
示例2: createGalleryItems
import org.eclipse.nebula.widgets.gallery.GalleryItem; //导入方法依赖的package包/类
public void createGalleryItems(){
//add text
if(group.getItemCount() > 0){
return;
}
for (int i=0; i<urls.size(); ++i) {
final GalleryItem item = new GalleryItem(group, SWT.MULTI);
// item.setText(0, "String 0\nString2");
// item.setText(1, "String 1");
item.setExpanded(true);
item.setImage(Images.LOADING_IMG);
item.setData("doNotScaleImage", new Object());
String transcribedLinesText = thumbsWidget.determineItemColor(item, transcripts.get(i));
totalLinesTranscribed += transcripts.get(i).getNrOfTranscribedLines();
setItemText(item, i, transcribedLinesText);
}
}
示例3: setGallyeryItemImageInfo
import org.eclipse.nebula.widgets.gallery.GalleryItem; //导入方法依赖的package包/类
/**
* Customizes a {@link GalleryItem} in order to enrich with a "standard" image plus a "selected" image with a custom
* shadow.
* <p>
*
* Cache maps are used for performance purposes.
*
* @param item
* the gallery item to modify
* @param pluginID
* the ID of the plugin, where the image is located
* @param imagePath
* the plugin-relative path of the image
* @param selectedImagesCache
* a cache of selected images
* @param standardImagesCache
* a cache of standard images
*/
public static void setGallyeryItemImageInfo(GalleryItem item, String pluginID, String imagePath,
Map<String, Image> selectedImagesCache, Map<String, Image> standardImagesCache) {
Image selectedImg = selectedImagesCache.get(imagePath);
Image standardImg = standardImagesCache.get(imagePath);
if (selectedImg == null || standardImg == null) {
Image itemImage = ResourceManager.getPluginImage(pluginID, imagePath);
// Add viewer required effects to the images shown...
selectedImg = new Image(itemImage.getDevice(), SWTImageEffects.extendArea(itemImage.getImageData(), 20, null));
standardImg = new Image(itemImage.getDevice(), Glow.glow(itemImage.getImageData(),
ResourceManager.getColor(SWT.COLOR_GRAY), 20, 0, 255));
// Cache images
standardImagesCache.put(imagePath, standardImg);
selectedImagesCache.put(imagePath, selectedImg);
}
item.setSelectedImage(selectedImg);
item.setStandardImage(standardImg);
item.setImage(standardImg);
}
示例4: getItem
import org.eclipse.nebula.widgets.gallery.GalleryItem; //导入方法依赖的package包/类
/**
* Build a gallery item for a TemplateStyle
*
* @param style the style
* @param rootItem the root of all the items
* @return A gallery item
*/
protected GalleryItem getItem(TemplateStyle style, GalleryItem rootItem) {
GalleryItem ti = new GalleryItem(rootItem, SWT.NONE);
String description = style.getDescription();
ti.setText(description.isEmpty() ? " " : description); //$NON-NLS-1$
Image previewImage = generatePreviewFigure(style);
ti.setImage(previewImage);
ti.setSelectedImage(previewImage);
ti.setStandardImage(previewImage);
ti.setData(style);
return ti;
}
示例5: updateItem
import org.eclipse.nebula.widgets.gallery.GalleryItem; //导入方法依赖的package包/类
/**
* Update a gallery item for a TemplateStyle
*
* @param style the style
* @param itemToUpdate the item to update
*/
protected void updateItem(TemplateStyle style, GalleryItem itemToUpdate) {
String description = style.getDescription();
itemToUpdate.setText(description.isEmpty() ? " " : description); //$NON-NLS-1$
Image previewImage = generatePreviewFigure(style);
itemToUpdate.setImage(previewImage);
itemToUpdate.setSelectedImage(previewImage);
itemToUpdate.setStandardImage(previewImage);
itemToUpdate.setData(style);
}
示例6: handleEvent
import org.eclipse.nebula.widgets.gallery.GalleryItem; //导入方法依赖的package包/类
@Override
public void handleEvent(Event event) {
if(doc == null) {
return;
}
// logger.debug("setting data: " + event);
// logger.debug("item: " + event.item);
final GalleryItem item = (GalleryItem) event.item;
int index;
if (item.getParentItem() != null) { // if this is a leaft item
// -> set nr of items to 0!
index = item.getParentItem().indexOf(item);
item.setItemCount(0);
} else {
index = gallery.indexOf(item);
item.setItemCount(doc.getThumbUrls().size());
}
//logger.debug("setData index " + index); //$NON-NLS-1$
item.setExpanded(true);
try {
Image thumbImg = ImgLoader.load(doc.getPages().get(index).getThumbUrl());
if(DO_SCALE_THUMBS) {
thumbImg = Images.resize(thumbImg, itemWidth, itemHeight);
}
item.setImage(thumbImg);
} catch (IOException e) {
// Most likely happens because thumbnail image is not yet available!
// e.printStackTrace();
if (false) { // loading thumbs on the fly all the time is f****** slow
try {
// ---->Try to generate thumbnail on the fly from actual page image.
FimgStoreGetClient imgStoreClient;
imgStoreClient = new FimgStoreGetClient(doc.getPages().get(index).getUrl());
URL url = imgStoreClient.getImgXyScaled(doc.getPages().get(index).getKey(), 82, 120, false).getUri().toURL();
item.setImage(ImageDescriptor.createFromURL(url).createImage());
} catch (IOException e1) {
// If everything fails display an error thumbnail
item.setImage(Images.ERROR_IMG);
e1.printStackTrace();
}
} else {
item.setImage(Images.ERROR_IMG);
// e.printStackTrace();
}
}
//FIXME WTF does this do?
item.setData("doNotScaleImage", new Object());
setItemTextAndBackground(item, index);
}