Package ptolemy.actor.lib.image
Class ImageDisplayJavaSE
- java.lang.Object
-
- ptolemy.actor.gui.AbstractPlaceableJavaSE
-
- ptolemy.actor.lib.image.ImageDisplayJavaSE
-
- All Implemented Interfaces:
ImageDisplayInterface
- Direct Known Subclasses:
ImageDisplayJavaSE
public class ImageDisplayJavaSE extends AbstractPlaceableJavaSE implements ImageDisplayInterface
ImageDisplayJavaSE is the implementation of the ImageDisplayInterface that uses AWT and Swing classes.
Note that this class does not work well when executed within Eclipse. In Eclipse, the Swing event thread blocks "waiting for: OGLRenderQueue$QueueFluher", and spends most of its time blocked rather than rendering. Hence, we do not get smooth updates of images.- Since:
- Ptolemy II 10.0
- Version:
- $Id$
- Author:
- Jianwu Wang, Based on code by James Yeh, Edward A. Lee
- Pt.AcceptedRating:
- Pt.ProposedRating:
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected classImageDisplayJavaSE.ImageWindowVersion of TableauFrame that removes its association with the ImageDisplay upon closing, and also records the size of the display.
-
Field Summary
Fields Modifier and Type Field Description protected java.awt.Container_containerThe container for the image display, set by calling place().protected ImageTokenEffigy_effigyThe effigy for the image data.protected ImageDisplayJavaSE.ImageWindow_imageWindowFrameThe frame, if one is used.protected int_oldXSizeThe horizontal size of the previous image.protected int_oldYSizeThe vertical size of the previous image.protected Picture_pictureThe picture panel.-
Fields inherited from class ptolemy.actor.gui.AbstractPlaceableJavaSE
_frame, _paneSize, _windowClosingAdapter, _windowProperties
-
-
Constructor Summary
Constructors Constructor Description ImageDisplayJavaSE()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcleanUp()Free up memory when closing.voiddisplay(Token in)Display the specified token.java.awt.ColorgetBackground()Get the background.java.lang.ObjectgetFrame()Get the image's frame.java.lang.ObjectgetPicture()Get the platform dependent picture that contains the image.java.lang.ObjectgetPlatformContainer()Get the platform dependent container that contains the image.java.lang.ObjectgetTableau()Get the image tableau.voidinit(ImageDisplay imageDisplayActor)Initialize an object.voidinitializeEffigy()Initialize the effigy of the image.voidinitWindowAndSizeProperties()Initialize the effigy of the plotter.voidplaceContainer(java.awt.Container container)Remove the plot from the frame if the container is null.voidsetBackground(java.awt.Color background)Set the background.voidsetFrame(java.lang.Object frame)Set the frame of the image.voidsetPicture(java.lang.Object picture)Set the platform dependent picture of the image.voidsetPlatformContainer(java.lang.Object container)Set the platform dependent container of the image.-
Methods inherited from class ptolemy.actor.gui.AbstractPlaceableJavaSE
_exportMoMLContents, init, setFrame
-
-
-
-
Field Detail
-
_container
protected java.awt.Container _container
The container for the image display, set by calling place().
-
_effigy
protected ImageTokenEffigy _effigy
The effigy for the image data.
-
_imageWindowFrame
protected ImageDisplayJavaSE.ImageWindow _imageWindowFrame
The frame, if one is used.
-
_picture
protected Picture _picture
The picture panel.
-
_oldXSize
protected int _oldXSize
The horizontal size of the previous image.
-
_oldYSize
protected int _oldYSize
The vertical size of the previous image.
-
-
Method Detail
-
cleanUp
public void cleanUp()
Free up memory when closing.- Specified by:
cleanUpin interfaceImageDisplayInterface- Overrides:
cleanUpin classAbstractPlaceableJavaSE
-
display
public void display(Token in) throws IllegalActionException
Display the specified token. This must be called in the Swing event thread.- Specified by:
displayin interfaceImageDisplayInterface- Parameters:
in- The token to display- Throws:
IllegalActionException- If the input is not an ImageToken
-
getBackground
public java.awt.Color getBackground()
Get the background.- Specified by:
getBackgroundin interfaceImageDisplayInterface- Returns:
- The background color.
- See Also:
setBackground(Color)
-
getFrame
public java.lang.Object getFrame()
Get the image's frame.- Specified by:
getFramein interfaceImageDisplayInterface- Returns:
- the image's frame.
- See Also:
setFrame(Object)
-
getPicture
public java.lang.Object getPicture()
Get the platform dependent picture that contains the image.- Specified by:
getPicturein interfaceImageDisplayInterface- Returns:
- the platform dependent container.
- See Also:
setPicture(Object)
-
getPlatformContainer
public java.lang.Object getPlatformContainer()
Get the platform dependent container that contains the image.- Specified by:
getPlatformContainerin interfaceImageDisplayInterface- Returns:
- the platform dependent container.
- See Also:
setPlatformContainer(Object)
-
getTableau
public java.lang.Object getTableau()
Get the image tableau.- Specified by:
getTableauin interfaceImageDisplayInterface- Returns:
- the image tableau.
-
init
public void init(ImageDisplay imageDisplayActor) throws IllegalActionException, NameDuplicationException
Initialize an object.- Specified by:
initin interfaceImageDisplayInterface- Parameters:
imageDisplayActor- The object to be initialized.- Throws:
IllegalActionException- If the entity cannot be contained by the proposed container.NameDuplicationException- If the container already has an actor with this name.
-
initializeEffigy
public void initializeEffigy() throws IllegalActionExceptionInitialize the effigy of the image.- Specified by:
initializeEffigyin interfaceImageDisplayInterface- Throws:
IllegalActionException- If there is a problem initializing the effigy
-
initWindowAndSizeProperties
public void initWindowAndSizeProperties() throws IllegalActionException, NameDuplicationExceptionInitialize the effigy of the plotter.- Specified by:
initWindowAndSizePropertiesin interfaceImageDisplayInterface- Throws:
IllegalActionException- If there is a problem initializing the effigyNameDuplicationException- If there is a problem creating the attributes.
-
placeContainer
public void placeContainer(java.awt.Container container)
Remove the plot from the frame if the container is null.- Specified by:
placeContainerin interfaceImageDisplayInterface- Parameters:
container- The Container to be placed.
-
setBackground
public void setBackground(java.awt.Color background)
Set the background.- Specified by:
setBackgroundin interfaceImageDisplayInterface- Parameters:
background- The background color.- See Also:
getBackground()
-
setFrame
public void setFrame(java.lang.Object frame)
Set the frame of the image.- Specified by:
setFramein interfaceImageDisplayInterface- Parameters:
frame- The frame to set.- See Also:
getFrame()
-
setPicture
public void setPicture(java.lang.Object picture)
Set the platform dependent picture of the image. The container can be AWT container or Android view.- Specified by:
setPicturein interfaceImageDisplayInterface- Parameters:
picture- The picture- See Also:
getPicture()
-
setPlatformContainer
public void setPlatformContainer(java.lang.Object container)
Set the platform dependent container of the image. The container can be AWT container or Android view.- Specified by:
setPlatformContainerin interfaceImageDisplayInterface- Parameters:
container- the platform dependent container.- See Also:
getPlatformContainer()
-
-