本文整理汇总了Java中org.eclipse.draw2d.ImageFigure.setImage方法的典型用法代码示例。如果您正苦于以下问题:Java ImageFigure.setImage方法的具体用法?Java ImageFigure.setImage怎么用?Java ImageFigure.setImage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.draw2d.ImageFigure
的用法示例。
在下文中一共展示了ImageFigure.setImage方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addColumnGroup
import org.eclipse.draw2d.ImageFigure; //导入方法依赖的package包/类
@Override
public void addColumnGroup(GroupColumnFigure columnFigure, int viewMode,
String name, boolean isAdded, boolean isUpdated, boolean isRemoved) {
columnFigure.setBorder(new MarginBorder(new Insets(1, 0, 1, 0)));
final ImageFigure image = new ImageFigure();
image.setBorder(new MarginBorder(new Insets(0, 4, 0, 7)));
image.setImage(Activator.getImage(ImageKey.GROUP));
columnFigure.add(image);
final StringBuilder text = new StringBuilder();
text.append(name);
text.append(" (GROUP)");
setColumnFigureColor(columnFigure, false, false, isAdded, isUpdated, isRemoved);
final Label label = createColumnLabel();
label.setForegroundColor(ColorConstants.black);
label.setLabelAlignment(PositionConstants.RIGHT);
label.setBorder(new MarginBorder(new Insets(1, 3, 0, 4)));
label.setText(text.toString());
columnFigure.add(label);
}
示例2: addIndex
import org.eclipse.draw2d.ImageFigure; //导入方法依赖的package包/类
@Override
public void addIndex(IndexFigure indexFigure, String name, boolean isFirst) {
final ImageFigure image = new ImageFigure();
image.setBorder(new MarginBorder(new Insets(0, 0, 0, 19)));
image.setImage(Activator.getImage(ImageKey.BLANK_WHITE));
image.setOpaque(true);
indexFigure.add(image);
final StringBuilder text = new StringBuilder();
text.append(name);
final Label label = createColumnLabel();
label.setBorder(new MarginBorder(new Insets(1, 0, 0, 4)));
label.setForegroundColor(ColorConstants.black);
label.setText(text.toString());
indexFigure.add(label);
}
示例3: updateFigure
import org.eclipse.draw2d.ImageFigure; //导入方法依赖的package包/类
public void updateFigure( ExtendedItemHandle handle, IFigure figure )
{
switch( extensionType )
{
case FIGURE_EXTENSION_TYPE:
figureExtension.updateFigure(handle, figure);
break;
case IMAGE_EXTENSION_TYPE:
ImageFigure imageFigure = (ImageFigure)figure;
Image newImage = imageExtension.getImage( handle );
Image oldImage = imageFigure.getImage();
if ( newImage != oldImage )
{
imageFigure.setImage(newImage);
imageExtension.disposeImage( handle, oldImage );
}
break;
case LABEL_EXTENSION_TYPE:
((Label)figure).setText(labelExtension.getLabel( handle ));
break;
}
}
示例4: initTitleBar
import org.eclipse.draw2d.ImageFigure; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
public void initTitleBar(Figure top) {
top.setLayoutManager(new BorderLayout());
Figure title = new Figure();
top.add(title, BorderLayout.TOP);
title.setLayoutManager(new FlowLayout());
title.setBackgroundColor(ColorConstants.darkGreen);
ImageFigure image = new ImageFigure();
image.setBorder(new MarginBorder(new Insets(5, 10, 5, 2)));
image.setImage(Activator.getImageDescriptor(ImageResource.VIEW).createImage());
title.add(image);
this.nameLabel = new Label();
this.nameLabel.setBorder(new MarginBorder(new Insets(5, 0, 5, 20)));
title.add(this.nameLabel);
Figure separater = new Figure();
separater.setSize(-1, 1);
separater.setBackgroundColor(ColorConstants.black);
separater.setOpaque(true);
top.add(separater, BorderLayout.BOTTOM);
}
示例5: initTitleBar
import org.eclipse.draw2d.ImageFigure; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
public void initTitleBar(Figure top) {
top.setLayoutManager(new BorderLayout());
Figure title = new Figure();
top.add(title, BorderLayout.TOP);
title.setLayoutManager(new FlowLayout());
title.setBackgroundColor(ColorConstants.darkGreen);
ImageFigure image = new ImageFigure();
image.setBorder(new MarginBorder(new Insets(5, 10, 5, 2)));
image.setImage(Activator.getImageDescriptor(ImageResource.TABLE).createImage());
title.add(image);
this.nameLabel = new Label();
this.nameLabel.setBorder(new MarginBorder(new Insets(5, 0, 5, 20)));
title.add(this.nameLabel);
Figure separater = new Figure();
separater.setSize(100, 100);
separater.setBackgroundColor(ColorConstants.black);
separater.setOpaque(false);
top.add(separater, BorderLayout.BOTTOM);
}
示例6: initTitleBar
import org.eclipse.draw2d.ImageFigure; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public void initTitleBar(final Figure top) {
top.setLayoutManager(new BorderLayout());
final Figure title = new Figure();
top.add(title, BorderLayout.TOP);
final FlowLayout titleLayout = new FlowLayout();
titleLayout.setMinorAlignment(OrderedLayout.ALIGN_CENTER);
title.setLayoutManager(titleLayout);
final ImageFigure image = new ImageFigure();
image.setBorder(new MarginBorder(new Insets(5, 10, 5, 2)));
image.setImage(ERDiagramActivator.getImage(getTableFigure().getImageKey()));
title.add(image);
nameLabel = new Label();
nameLabel.setBorder(new MarginBorder(new Insets(5, 0, 5, 20)));
title.add(nameLabel);
final Figure separater = new Figure();
separater.setSize(-1, 1);
separater.setBackgroundColor(ColorConstants.black);
separater.setOpaque(true);
top.add(separater, BorderLayout.BOTTOM);
}
示例7: initTitleBar
import org.eclipse.draw2d.ImageFigure; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public void initTitleBar(Figure top) {
top.setLayoutManager(new BorderLayout());
Figure title = new Figure();
top.add(title, BorderLayout.TOP);
FlowLayout titleLayout = new FlowLayout();
titleLayout.setMinorAlignment(FlowLayout.ALIGN_CENTER);
title.setLayoutManager(titleLayout);
ImageFigure image = new ImageFigure();
image.setBorder(new MarginBorder(new Insets(5, 10, 5, 2)));
image.setImage(ERDiagramActivator.getImage(this.getTableFigure().getImageKey()));
title.add(image);
this.nameLabel = new Label();
this.nameLabel.setBorder(new MarginBorder(new Insets(5, 0, 5, 20)));
title.add(this.nameLabel);
Figure separater = new Figure();
separater.setSize(-1, 1);
separater.setBackgroundColor(ColorConstants.black);
separater.setOpaque(true);
top.add(separater, BorderLayout.BOTTOM);
}
示例8: initTitleBar
import org.eclipse.draw2d.ImageFigure; //导入方法依赖的package包/类
@Override
public void initTitleBar(Figure top) {
top.setLayoutManager(new BorderLayout());
final FlowLayout layout = new FlowLayout();
layout.setStretchMinorAxis(true);
final Figure title = new Figure();
top.add(title, BorderLayout.TOP);
title.setLayoutManager(layout);
title.setBorder(new MarginBorder(new Insets(2, 2, 2, 2)));
final ImageFigure image = new ImageFigure();
image.setBorder(new MarginBorder(new Insets(0, 0, 0, 0)));
image.setImage(Activator.getImage(getTableFigure().getImageKey()));
title.add(image);
this.nameLabel = new Label();
nameLabel.setBorder(new MarginBorder(new Insets(0, 0, 0, 20)));
title.add(nameLabel);
final Figure separater = new Figure();
separater.setSize(-1, 1);
separater.setBackgroundColor(ColorConstants.black);
separater.setOpaque(true);
top.add(separater, BorderLayout.BOTTOM);
}
示例9: createImage
import org.eclipse.draw2d.ImageFigure; //导入方法依赖的package包/类
private IFigure createImage(String chartType)
{
ImageFigure imageFigure = new ImageFigure();
if (CommonEclipseUtil.getImage("icons/chart/" + chartType + ".jpg").createImage() != null) {
imageFigure.setImage(CommonEclipseUtil.getImage("icons/chart/" + chartType + ".jpg")
.createImage());
return imageFigure;
} else {
imageFigure
.setImage(CommonEclipseUtil.getImage("icons/chart/column.jpg").createImage());
return imageFigure;
}
}
示例10: createTextInput
import org.eclipse.draw2d.ImageFigure; //导入方法依赖的package包/类
public IFigure createTextInput()
{
ImageFigure imageFigure = new ImageFigure();
imageFigure.setImage(CommonEclipseUtil.getImage("icons/figure/input.png").createImage());
imageFigure.setAlignment(PositionConstants.CENTER);
return imageFigure;
}
示例11: createUserTree
import org.eclipse.draw2d.ImageFigure; //导入方法依赖的package包/类
public IFigure createUserTree()
{
ImageFigure imageFigure = new ImageFigure();
imageFigure.setImage(CommonEclipseUtil.getImage("icons/figure/usertree.png").createImage());
return imageFigure;
}
示例12: makeWordFigure
import org.eclipse.draw2d.ImageFigure; //导入方法依赖的package包/类
private ElementFigure makeWordFigure(BTSWord word) {
TypedLabel label = new TypedLabel();
label.setText(word.getWChar());
label.setType(TypedLabel.TRANSLITATION);
final WordFigure rect = new WordFigure(label);
rect.setBackgroundColor(colorWordDeselected(word));
rect.setModelObject(word);
rect.setType(ElementFigure.WORD);
wordMap.put(word.get_id(), rect);
// gridLayout = new GridLayout();
// gridLayout.numColumns = 1;
// gridLayout.makeColumnsEqualWidth = false;
ToolbarLayout tl = new ToolbarLayout();
tl.setHorizontal(false);
tl.setSpacing(5);
String mdc = transformWordToMdCString(word);
if (showHieroglyphs)
{
ImageFigure imageFigure = new CompartementImageFigure();
// System.out.println("mdc " + mdc);
if (mdc != null && !"".equals(mdc) && imageList.size() < MAX_IMAGE_SIZE)
{
try {
Image image = transformToSWT(getImageData(mdc));
// String path = "E:/dev_resources/icons_48/save.png"; //$NON-NLS-1$
//
// image = new Image(Display.getDefault(), path);
imageFigure.setImage(image);
} catch (MDCSyntaxError e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
else if (mdc != null && !"".equals(mdc))
{
rect.setMdc(mdc);
}
// rect.getAttributesCompartment().add(imageFigure);
rect.setImageFigure(imageFigure);
rect.add(imageFigure);
}
if (showLemmaId)
{
// add lemma key
addLKeyToWordFigure(word, rect);
}
if (showFlexion)
{
// add flexion code
addFCodeToWordFigure(word, rect);
}
for (int i=0; i<BTSCoreConstants.LANGS.length; i++) {
String lang = BTSCoreConstants.LANGS[i];
if ((showTransLangMask>>i & 1) == 1) {
addTransToWordFigure(word, rect, lang);
}
}
rect.setSize(90, 290);
rect.addMouseListener(elementSelectionListener);
rect.setLayoutManager(tl);
appendFigure(rect);
if (!word.eAdapters().contains(notifier)) {
word.eAdapters().add(notifier);
}
return rect;
}
示例13: refreshFigureFromModel
import org.eclipse.draw2d.ImageFigure; //导入方法依赖的package包/类
private void refreshFigureFromModel(List<ElementFigure> selectedElementsInternals, BTSWord word) {
for (ElementFigure element : selectedElementsInternals)
{
if (element instanceof WordFigure)
{
WordFigure wf = (WordFigure) element;
Object o = wf.getModelObject();
if (word == null && o instanceof BTSWord)
{
word = (BTSWord) o;
}
boolean lset = false;
boolean fset = false;
for (Object fig : wf.getChildren()) {
if (fig instanceof ImageFigure) {
ImageFigure imf = (ImageFigure) fig;
String mdc = transformWordToMdCString(word);
try {
if (imf.getImage() != null)
if (!imf.getImage().isDisposed())
imf.getImage().dispose();
imf.setImage(transformToSWT(getImageData(mdc)));
} catch (MDCSyntaxError e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
else if (fig instanceof TypedLabel) {
TypedLabel l = (TypedLabel) fig;
switch (l.getType()) {
case TypedLabel.LEMMA :
l.setText(word.getLKey());
lset = true;
break;
case TypedLabel.FLEXION :
l.setText(word.getFlexCode());
fset = true;
break;
case TypedLabel.TRANSLITATION :
l.setText(word.getWChar());
break;
case TypedLabel.TRANSLATION :
if (word.getTranslation() != null) {
String lang = l.getTranslationLang();
String trans = word.getTranslation().getTranslation(lang);
l.setText(lang + ":" + (trans != null ? trans : ""));
}
break;
}
}
}
if (showLemmaId && !lset && word.getLKey() != null && !"".equals(word.getLKey()))
{
addLKeyToWordFigure(word, wf);
}
if (showFlexion && !fset && word.getFlexCode() != null && !"".equals(word.getFlexCode()))
{
addFCodeToWordFigure(word, wf);
}
//FIXME add hieroglyphs
}
}
}
示例14: refreshFigureFromModel
import org.eclipse.draw2d.ImageFigure; //导入方法依赖的package包/类
private void refreshFigureFromModel(IFigure figure, BTSWord word) {
if (figure instanceof WordFigure)
{
WordFigure wf = (WordFigure) figure;
Object o = wf.getModelObject();
if (word == null && o instanceof BTSWord)
{
word = (BTSWord) o;
}
boolean lset = false;
boolean fset = false;
for (Object fig : wf.getChildren()) {
if (fig instanceof ImageFigure) {
ImageFigure imf = (ImageFigure) fig;
String mdc = transformWordToMdCString(word);
try {
if (imf.getImage() != null)
if (!imf.getImage().isDisposed())
imf.getImage().dispose();
imf.setImage(transformToSWT(getImageData(mdc)));
} catch (MDCSyntaxError e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
else if (fig instanceof TypedLabel) {
TypedLabel l = (TypedLabel) fig;
switch (l.getType()) {
case TypedLabel.LEMMA :
l.setText(word.getLKey());
lset = true;
break;
case TypedLabel.FLEXION :
l.setText(word.getFlexCode());
fset = true;
break;
case TypedLabel.TRANSLITATION :
l.setText(word.getWChar());
break;
case TypedLabel.TRANSLATION :
if (word.getTranslation() != null) {
String lang = l.getTranslationLang();
String trans = word.getTranslation().getTranslationStrict(lang);
l.setText(lang + ":" + (trans != null ? trans : ""));
}
break;
}
}
}
if (showLemmaId && !lset && word.getLKey() != null && !"".equals(word.getLKey()))
{
addLKeyToWordFigure(word, wf);
}
if (showFlexion && !fset && word.getFlexCode() != null && !"".equals(word.getFlexCode()))
{
addFCodeToWordFigure(word, wf);
}
//FIXME add hieroglyphs
}
}
示例15: createColumn
import org.eclipse.draw2d.ImageFigure; //导入方法依赖的package包/类
public IFigure createColumn()
{
ImageFigure imageFigure = new ImageFigure();
imageFigure.setImage(CommonEclipseUtil.getImage("icons/chart/column.jpg").createImage());
return imageFigure;
}