Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

Eclipse Draw2d
3.3

org.eclipse.draw2d.parts
Class Thumbnail

java.lang.Object
  extended by

org.eclipse.draw2d.Figure
      extended by
org.eclipse.draw2d.parts.Thumbnail
All Implemented Interfaces:
IFigure, UpdateListener
Direct Known Subclasses:
ScrollableThumbnail

public class Thumbnail
extends Figure
implements UpdateListener

A Thumbnail is a Figure that displays an image of its source Figure at a smaller size. The Thumbnail will maintain the aspect ratio of the source Figure.


Nested Class Summary
 
Nested classes inherited from class org.eclipse.draw2d. Figure
Figure.FigureIterator, Figure.IdentitySearch
 
Nested classes inherited from class 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
Thumbnail ()
          Creates a new Thumbnail.
Thumbnail ( IFigure fig)
          Creates a new Thumbnail with the given IFigure as its source figure.
 
Method Summary
 void deactivate ()
          Deactivates this Thumbnail.
  Dimension getPreferredSize (int wHint, int hHint)
          Returns the preferred size of this Thumbnail.
protected  float getScaleX ()
          Returns the scale factor on the X-axis.
protected  float getScaleY ()
          Returns the scale factor on the Y-axis.
protected   IFigure getSource ()
          Returns the source figure being used to generate a thumbnail.
protected   Rectangle getSourceRectangle ()
          Returns the rectangular region relative to the source figure which will be the basis of the thumbnail.
protected  Image getThumbnailImage ()
          Returns the scaled Image of the source Figure.
protected  boolean isDirty ()
          Returns true if the source figure has changed.
 void notifyPainting ( Rectangle damage, java.util.Map dirtyRegions)
          Notifies the listener that the listened to object is painting.
 void notifyValidating ()
          Notifies the listener that the listened to object is validating.
protected  void paintFigure ( Graphics graphics)
          Paints this Figure's primary representation, or background.
 void setDirty (boolean value)
          Sets the dirty flag.
protected  void setScales (float x, float y)
          Sets the X and Y scales for the Thumbnail.
 void setSource ( IFigure fig)
          Sets the source Figure.
 
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, 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, 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
 

Constructor Detail

Thumbnail

public Thumbnail()
Creates a new Thumbnail. The source Figure must be set separately if you use this constructor.


Thumbnail

public Thumbnail(
IFigure fig)
Creates a new Thumbnail with the given IFigure as its source figure.

Parameters:
fig - The source figure
Method Detail

deactivate

public void deactivate()
Deactivates this Thumbnail.


getPreferredSize

public 
Dimension getPreferredSize(int wHint,
                                  int hHint)
Returns the preferred size of this Thumbnail. The preferred size will be calculated in a way that maintains the source Figure's aspect ratio.

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

getScaleX

protected float getScaleX()
Returns the scale factor on the X-axis.

Returns:
X scale

getScaleY

protected float getScaleY()
Returns the scale factor on the Y-axis.

Returns:
Y scale

getSource

protected 
IFigure getSource()
Returns the source figure being used to generate a thumbnail.

Returns:
the source figure

getSourceRectangle

protected 
Rectangle getSourceRectangle()
Returns the rectangular region relative to the source figure which will be the basis of the thumbnail. The value may be returned by reference and should not be modified by the caller.

Returns:
the region of the source figure being used for the thumbnail
Since:
3.1

getThumbnailImage

protected Image getThumbnailImage()
Returns the scaled Image of the source Figure. If the Image needs to be updated, the ThumbnailUpdater will notified.

Returns:
The thumbnail image

isDirty

protected boolean isDirty()
Returns true if the source figure has changed.

Returns:
true if the source figure has changed

notifyPainting

public void notifyPainting(
Rectangle damage,
                           java.util.Map dirtyRegions)
Description copied from interface: UpdateListener
Notifies the listener that the listened to object is painting. The damage rectangle may be null or empty. This indicates the dirty regions were clipped or not visible. But for objects such as the Thumbnail, notification still needs to occur. The map of dirty regions is passed to allow the listener to determine if it needs to update, for instance when a particular figure is painting.

Specified by:
notifyPainting in interface UpdateListener
Parameters:
damage - The area being painted
dirtyRegions - a Map of figures to their dirty regions
See Also:
UpdateListener.notifyPainting(Rectangle, Map)

notifyValidating

public void notifyValidating()
Description copied from interface: UpdateListener
Notifies the listener that the listened to object is validating.

Specified by:
notifyValidating in interface UpdateListener
See Also:
UpdateListener.notifyValidating()

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)

setDirty

public void setDirty(boolean value)
Sets the dirty flag.

Parameters:
value - The dirty value

setScales

protected void setScales(float x,
                         float y)
Sets the X and Y scales for the Thumbnail. These scales represent the ratio between the source figure and the Thumbnail.

Parameters:
x - The X scale
y - The Y scale

setSource

public void setSource(
IFigure fig)
Sets the source Figure. Also sets the scales and creates the necessary update manager.

Parameters:
fig - The source figure

Eclipse Draw2d
3.3

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

 
 
  Published under the terms of the Eclipse Public License Version 1.0 ("EPL") Design by Interspire