Draw2d
3.9.0.201308190730

org.eclipse.draw2d
Class ImageFigure

java.lang.Object
  extended by org.eclipse.draw2d.Figure
      extended by org.eclipse.draw2d.AbstractImageFigure
          extended by org.eclipse.draw2d.ImageFigure
All Implemented Interfaces:
IFigure, IImageFigure

public class ImageFigure
extends AbstractImageFigure

A Figure that simply contains an Image. Use this Figure, instead of a Label, when displaying Images without any accompanying text. This figure is not intended to have a layout mananger or children.

Note that it is the client's responsibility to dispose the given image. There is no "free" resource management in draw2d.


Nested Class Summary
 
Nested classes/interfaces inherited from class org.eclipse.draw2d.Figure
Figure.FigureIterator, Figure.IdentitySearch
 
Nested classes/interfaces inherited from interface org.eclipse.draw2d.IImageFigure
IImageFigure.ImageChangedListener
 
Nested classes/interfaces inherited from interface org.eclipse.draw2d.IFigure
IFigure.NoInsets
 
Field Summary
 
Fields inherited from class org.eclipse.draw2d.Figure
bgColor, border, bounds, fgColor, flags, font, MAX_FLAG, maxSize, minSize, NO_MANAGER, prefSize, toolTip
 
Fields inherited from interface org.eclipse.draw2d.IFigure
MAX_DIMENSION, MIN_DIMENSION, NO_INSETS
 
Constructor Summary
ImageFigure()
          Constructor
The default alignment is PositionConstants.CENTER.
ImageFigure(Image image)
          Constructor
The default alignment is PositionConstants.CENTER.
ImageFigure(Image image, int alignment)
          Constructor
 
Method Summary
 Image getImage()
          Returns the SWT Image contained by the figure
 Dimension getPreferredSize(int wHint, int hHint)
          Calculates the necessary size to display the Image within the figure's client area.
protected  void paintFigure(Graphics graphics)
          Paints this Figure's primary representation, or background.
 void setAlignment(int flag)
          Sets the alignment of the Image within this Figure.
 void setImage(Image image)
          Sets the Image that this ImageFigure displays.
 
Methods inherited from class org.eclipse.draw2d.AbstractImageFigure
addImageChangedListener, notifyImageChanged, removeImageChangedListener
 
Methods inherited from class org.eclipse.draw2d.Figure
add, add, add, add, addAncestorListener, addCoordinateListener, addFigureListener, addFocusListener, addKeyListener, addLayoutListener, addListener, addMouseListener, addMouseMotionListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, containsPoint, containsPoint, erase, findDescendantAtExcluding, findFigureAt, findFigureAt, findFigureAt, findFigureAtExcluding, findMouseEventTargetAt, findMouseEventTargetInDescendantsAt, fireCoordinateSystemChanged, fireFigureMoved, fireMoved, firePropertyChange, firePropertyChange, firePropertyChange, getBackgroundColor, getBorder, getBounds, getChildren, getClientArea, getClientArea, getClippingStrategy, getCursor, getFlag, getFont, getForegroundColor, getInsets, getLayoutManager, getListeners, getLocalBackgroundColor, getLocalFont, getLocalForegroundColor, getLocation, getMaximumSize, getMinimumSize, getMinimumSize, getParent, getPreferredSize, getSize, getToolTip, getUpdateManager, handleFocusGained, handleFocusLost, handleKeyPressed, handleKeyReleased, handleMouseDoubleClicked, handleMouseDragged, handleMouseEntered, handleMouseExited, handleMouseHover, handleMouseMoved, handleMousePressed, handleMouseReleased, hasFocus, internalGetEventDispatcher, intersects, invalidate, invalidateTree, isCoordinateSystem, isEnabled, isFocusTraversable, isMirrored, isMouseEventTarget, isOpaque, isRequestFocusEnabled, isShowing, isValid, isValidationRoot, isVisible, layout, paint, paintBorder, paintChildren, paintClientArea, primTranslate, remove, removeAll, removeAncestorListener, removeCoordinateListener, removeFigureListener, removeFocusListener, removeKeyListener, removeLayoutListener, removeListener, removeMouseListener, removeMouseMotionListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, revalidate, setBackgroundColor, setBorder, setBounds, setChildrenDirection, setChildrenEnabled, setChildrenOrientation, setClippingStrategy, setConstraint, setCursor, setEnabled, setFlag, setFocusTraversable, setFont, setForegroundColor, setLayoutManager, setLocation, setMaximumSize, setMinimumSize, setOpaque, setParent, setPreferredSize, setPreferredSize, setRequestFocusEnabled, setSize, setSize, setToolTip, setValid, setVisible, translate, translateFromParent, translateToAbsolute, translateToParent, translateToRelative, useLocalCoordinates, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.eclipse.draw2d.IFigure
add, add, add, add, addAncestorListener, addCoordinateListener, addFigureListener, addFocusListener, addKeyListener, addLayoutListener, addMouseListener, addMouseMotionListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, containsPoint, containsPoint, erase, findFigureAt, findFigureAt, findFigureAt, findFigureAtExcluding, findMouseEventTargetAt, getBackgroundColor, getBorder, getBounds, getChildren, getClientArea, getClientArea, getClippingStrategy, getCursor, getFont, getForegroundColor, getInsets, getLayoutManager, getLocalBackgroundColor, getLocalForegroundColor, getMaximumSize, getMinimumSize, getMinimumSize, getParent, getPreferredSize, getSize, getToolTip, getUpdateManager, handleFocusGained, handleFocusLost, handleKeyPressed, handleKeyReleased, handleMouseDoubleClicked, handleMouseDragged, handleMouseEntered, handleMouseExited, handleMouseHover, handleMouseMoved, handleMousePressed, handleMouseReleased, hasFocus, internalGetEventDispatcher, intersects, invalidate, invalidateTree, isCoordinateSystem, isEnabled, isFocusTraversable, isMirrored, isOpaque, isRequestFocusEnabled, isShowing, isVisible, paint, remove, removeAncestorListener, removeCoordinateListener, removeFigureListener, removeFocusListener, removeKeyListener, removeLayoutListener, removeMouseListener, removeMouseMotionListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, revalidate, setBackgroundColor, setBorder, setBounds, setClippingStrategy, setConstraint, setCursor, setEnabled, setFocusTraversable, setFont, setForegroundColor, setLayoutManager, setLocation, setMaximumSize, setMinimumSize, setOpaque, setParent, setPreferredSize, setRequestFocusEnabled, setSize, setSize, setToolTip, setVisible, translate, translateFromParent, translateToAbsolute, translateToParent, translateToRelative, validate
 

Constructor Detail

ImageFigure

public ImageFigure()
Constructor
The default alignment is PositionConstants.CENTER.


ImageFigure

public ImageFigure(Image image)
Constructor
The default alignment is PositionConstants.CENTER.

Parameters:
image - The Image to be displayed

ImageFigure

public ImageFigure(Image image,
                   int alignment)
Constructor

Parameters:
image - The Image to be displayed
alignment - A PositionConstant indicating the alignment
See Also:
setImage(Image), setAlignment(int)
Method Detail

getImage

public Image getImage()
Description copied from interface: IImageFigure
Returns the SWT Image contained by the figure

Returns:
The Image that this Figure displays

getPreferredSize

public Dimension getPreferredSize(int wHint,
                                  int hHint)
Calculates the necessary size to display the Image within the figure's client area.

Specified by:
getPreferredSize in interface IFigure
Overrides:
getPreferredSize in class Figure
Parameters:
wHint - a width hint
hHint - a height hint
Returns:
The preferred size
See Also:
Figure.getPreferredSize(int, int)

paintFigure

protected void paintFigure(Graphics graphics)
Description copied from class: Figure
Paints this Figure's primary representation, or background. Changes made to the graphics to the graphics current state will not affect the subsequent calls to Figure.paintClientArea(Graphics) and Figure.paintBorder(Graphics). Furthermore, it is safe to call graphics.restoreState() within this method, and doing so will restore the graphics to its original state upon entry.

Overrides:
paintFigure in class Figure
Parameters:
graphics - The Graphics used to paint
See Also:
Figure.paintFigure(Graphics)

setAlignment

public void setAlignment(int flag)
Sets the alignment of the Image within this Figure. The alignment comes into play when the ImageFigure is larger than the Image. The alignment could be any valid combination of the following:

Parameters:
flag - A constant indicating the alignment

setImage

public void setImage(Image image)
Sets the Image that this ImageFigure displays.

IMPORTANT: Note that it is the client's responsibility to dispose the given image.

Parameters:
image - The Image to be displayed. It can be null.

Draw2d
3.9.0.201308190730

Copyright (c) IBM Corp. and others 2000, 2011. All Rights Reserved.