本文整理汇总了Java中org.eclipse.nebula.widgets.gallery.GalleryItem.setData方法的典型用法代码示例。如果您正苦于以下问题:Java GalleryItem.setData方法的具体用法?Java GalleryItem.setData怎么用?Java GalleryItem.setData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.nebula.widgets.gallery.GalleryItem
的用法示例。
在下文中一共展示了GalleryItem.setData方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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;
}
示例4: 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);
}
示例5: 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);
}