本文整理汇总了Java中org.eclipse.nebula.widgets.gallery.GalleryItem类的典型用法代码示例。如果您正苦于以下问题:Java GalleryItem类的具体用法?Java GalleryItem怎么用?Java GalleryItem使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
GalleryItem类属于org.eclipse.nebula.widgets.gallery包,在下文中一共展示了GalleryItem类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getSelection
import org.eclipse.nebula.widgets.gallery.GalleryItem; //导入依赖的package包/类
public List<TrpPage> getSelection() {
List<TrpPage> sList = new LinkedList<>();
if (gallery.getSelectionCount() < 1) {
return sList;
}
GalleryItem[] selection = gallery.getSelection();
for(GalleryItem item : selection) {
final int index = gallery.indexOf(item);
TrpPage p = doc.getPages().get(index);
sList.add(p);
}
return sList;
}
示例2: 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);
}
}
示例3: 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);
}
}
示例4: getSelection
import org.eclipse.nebula.widgets.gallery.GalleryItem; //导入依赖的package包/类
protected Item[] getSelection(Control control) {
Item[] selection = ((Gallery) control).getSelection();
if (selection == null) {
return new GalleryItem[0];
}
List<Item> notDisposed = new ArrayList<Item>(selection.length);
for (int i = 0; i < selection.length; i++) {
if (!selection[i].isDisposed()) {
notDisposed.add(selection[i]);
} else {
System.out.println("GalleryItem was disposed (ignoring)");
}
}
selection = (GalleryItem[]) notDisposed.toArray(new GalleryItem[notDisposed.size()]);
return selection;
}
示例5: setChildCount
import org.eclipse.nebula.widgets.gallery.GalleryItem; //导入依赖的package包/类
/**
* For a GalleryViewer with a gallery with the VIRTUAL style bit set, set the number of children of the given element
* or tree path. To set the number of children of the invisible root of the gallery, you can pass the input object or
* an empty tree path.
*
* @param elementOrTreePath
* the element, or tree path
* @param count
*
* @since 3.2
*/
public void setChildCount(final Object elementOrTreePath, final int count) {
// if (isBusy())
// return;
preservingSelection(new Runnable() {
public void run() {
if (internalIsInputOrEmptyPath(elementOrTreePath)) {
getGallery().setItemCount(count);
return;
}
Widget[] items = internalFindItems(elementOrTreePath);
for (int i = 0; i < items.length; i++) {
GalleryItem galleryItem = (GalleryItem) items[i];
galleryItem.setItemCount(count);
}
}
});
}
示例6: editElement
import org.eclipse.nebula.widgets.gallery.GalleryItem; //导入依赖的package包/类
public void editElement(Object element, int column) {
if (element instanceof TreePath) {
setSelection(new TreeSelection((TreePath) element));
GalleryItem[] items = gallery.getSelection();
if (items.length == 1) {
ViewerRow row = getViewerRowFromItem(items[0]);
if (row != null) {
ViewerCell cell = row.getCell(column);
if (cell != null) {
getControl().setRedraw(false);
triggerEditorActivationEvent(new ColumnViewerEditorActivationEvent(cell));
getControl().setRedraw(true);
}
}
}
} else {
super.editElement(element, column);
}
}
示例7: 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);
}
示例8: storeSettings
import org.eclipse.nebula.widgets.gallery.GalleryItem; //导入依赖的package包/类
/**
* Store inside the wizard settings the user selection.
*/
public void storeSettings() {
Gallery gal = (Gallery) layout.topControl;
if (getSettings() == null)
return;
if (gal == null)
return;
GalleryItem[] selection = gal.getSelection();
if (selection != null && selection.length > 0) {
selectedTemplate = (TemplateBundle) selection[0].getData("template"); //$NON-NLS-1$
getSettings().put("template", selectedTemplate); //$NON-NLS-1$
} else {
getSettings().remove("template"); //$NON-NLS-1$
selectedTemplate = null;
}
}
示例9: handleItemBackground
import org.eclipse.nebula.widgets.gallery.GalleryItem; //导入依赖的package包/类
private void handleItemBackground(final GalleryItem inItem) {
if (previousItem == null) {
// old item is null
if (inItem == null) {
return;
} else {
// new item not null
previousItem = inItem;
bgColor = changeBGColor(COLOR_BACK_DRAG_OVER, previousItem);
}
} else {
// old item not null
if (previousItem.equals(inItem)) {
return;
} else {
previousItem.setBackground(bgColor);
changeBGColor(bgColor, previousItem);
previousItem = inItem;
if (inItem != null) {
// new item not null
bgColor = changeBGColor(COLOR_BACK_DRAG_OVER, previousItem);
}
}
}
}
示例10: mouseDown
import org.eclipse.nebula.widgets.gallery.GalleryItem; //导入依赖的package包/类
@Override
public void mouseDown(final MouseEvent inEvent) {
final GalleryItem lItem = gallery.getItem(new Point(inEvent.x, inEvent.y));
if (inEvent.button == 3) {
if (lItem == null) {
BrowserPopupStateController.setState(State.DISABLED, application);
return;
} else {
callback.focusRequest(FinderPane.this);
}
}
// we ensure a proper item is selected
if (lItem != null) {
handleSelection(lItem);
} else {
if (lastSelected != null) {
handleSelection(lastSelected);
}
}
}
示例11: getSelectionDescriptor
import org.eclipse.nebula.widgets.gallery.GalleryItem; //导入依赖的package包/类
public DocumentSelectionDescriptor getSelectionDescriptor() {
if (gallery.getSelectionCount() < 1) {
return null;
}
DocumentSelectionDescriptor dsd = new DocumentSelectionDescriptor();
dsd.setDocId(doc.getId());
GalleryItem[] selection = gallery.getSelection();
for(GalleryItem item : selection) {
final int index = gallery.indexOf(item);
TrpPage p = doc.getPages().get(index);
PageDescriptor pd = new PageDescriptor();
pd.setPageId(p.getPageId());
//TODO determine which transcript should be chosen
if(useGtVersions) {
int tsId = p.getCurrentTranscript().getTsId();
for(TrpTranscriptMetadata tmd : p.getTranscripts()) {
if(tmd.getStatus().equals(EditStatus.GT)) {
tsId = tmd.getTsId();
break;
}
}
pd.setTsId(tsId);
} else {
pd.setTsId(p.getCurrentTranscript().getTsId());
}
dsd.getPages().add(pd);
}
return dsd;
}
示例12: disposeOldData
import org.eclipse.nebula.widgets.gallery.GalleryItem; //导入依赖的package包/类
private void disposeOldData() {
// dispose images:
// for (ThmbImg th : thumbs) {
// th.dispose();
// }
// thumbs.clear();
// dispose gallery items:
for (GalleryItem item : group.getItems()) {
if (item != null) {
item.clear();
item.dispose();
}
}
}
示例13: determineItemColor
import org.eclipse.nebula.widgets.gallery.GalleryItem; //导入依赖的package包/类
public String determineItemColor(GalleryItem item, TrpTranscriptMetadata trpTranscriptMetadata) {
String transcribedLinesText = "";
int transcribedLines = trpTranscriptMetadata.getNrOfTranscribedLines();
int segmentedLines = trpTranscriptMetadata.getNrOfLines();
// logger.debug("segmentedLines: " + segmentedLines);
// logger.debug("transcribedLines: " + transcribedLines);
if (segmentedLines == 0){
transcribedLinesText = "\nNo lines segmented";
}
else{
transcribedLinesText = (transcribedLines > 0 ? "\nTranscribed lines: "+transcribedLines : "\nTranscribed lines: 0");
}
if (transcribedLines > 0){
totalLinesTranscribed += transcribedLines;
item.setBackground(lightGreen);
}
else if(transcribedLines == 0 && segmentedLines > 0){
item.setBackground(lightYellow);
}
else{
item.setBackground(lightRed);
}
return transcribedLinesText;
}
示例14: disposeOldData
import org.eclipse.nebula.widgets.gallery.GalleryItem; //导入依赖的package包/类
private void disposeOldData() {
// dispose images:
for (ThmbImg th : thumbs) {
th.dispose();
}
thumbs.clear();
// dispose galler items:
for (GalleryItem item : group.getItems() ) {
item.clear();
item.dispose();
}
}
示例15: getPagesString
import org.eclipse.nebula.widgets.gallery.GalleryItem; //导入依赖的package包/类
private String getPagesString() {
String pages = "";
if (gallery.getSelectionCount() > 0) {
for(GalleryItem si : gallery.getSelection()){
int selectedPageNr = gallery.indexOf(si) + 1;
String tmp = Integer.toString(selectedPageNr);
pages += (pages.equals("")? tmp : ",".concat(tmp));
}
}
//logger.debug("pages String " + pages);
return pages;
}