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 class
ImageDisplayJavaSE.ImageWindow
Version 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
_container
The container for the image display, set by calling place().protected ImageTokenEffigy
_effigy
The effigy for the image data.protected ImageDisplayJavaSE.ImageWindow
_imageWindowFrame
The frame, if one is used.protected int
_oldXSize
The horizontal size of the previous image.protected int
_oldYSize
The vertical size of the previous image.protected Picture
_picture
The 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 void
cleanUp()
Free up memory when closing.void
display(Token in)
Display the specified token.java.awt.Color
getBackground()
Get the background.java.lang.Object
getFrame()
Get the image's frame.java.lang.Object
getPicture()
Get the platform dependent picture that contains the image.java.lang.Object
getPlatformContainer()
Get the platform dependent container that contains the image.java.lang.Object
getTableau()
Get the image tableau.void
init(ImageDisplay imageDisplayActor)
Initialize an object.void
initializeEffigy()
Initialize the effigy of the image.void
initWindowAndSizeProperties()
Initialize the effigy of the plotter.void
placeContainer(java.awt.Container container)
Remove the plot from the frame if the container is null.void
setBackground(java.awt.Color background)
Set the background.void
setFrame(java.lang.Object frame)
Set the frame of the image.void
setPicture(java.lang.Object picture)
Set the platform dependent picture of the image.void
setPlatformContainer(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:
cleanUp
in interfaceImageDisplayInterface
- Overrides:
cleanUp
in classAbstractPlaceableJavaSE
-
display
public void display(Token in) throws IllegalActionException
Display the specified token. This must be called in the Swing event thread.- Specified by:
display
in 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:
getBackground
in interfaceImageDisplayInterface
- Returns:
- The background color.
- See Also:
setBackground(Color)
-
getFrame
public java.lang.Object getFrame()
Get the image's frame.- Specified by:
getFrame
in 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:
getPicture
in 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:
getPlatformContainer
in interfaceImageDisplayInterface
- Returns:
- the platform dependent container.
- See Also:
setPlatformContainer(Object)
-
getTableau
public java.lang.Object getTableau()
Get the image tableau.- Specified by:
getTableau
in interfaceImageDisplayInterface
- Returns:
- the image tableau.
-
init
public void init(ImageDisplay imageDisplayActor) throws IllegalActionException, NameDuplicationException
Initialize an object.- Specified by:
init
in 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 IllegalActionException
Initialize the effigy of the image.- Specified by:
initializeEffigy
in interfaceImageDisplayInterface
- Throws:
IllegalActionException
- If there is a problem initializing the effigy
-
initWindowAndSizeProperties
public void initWindowAndSizeProperties() throws IllegalActionException, NameDuplicationException
Initialize the effigy of the plotter.- Specified by:
initWindowAndSizeProperties
in 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:
placeContainer
in interfaceImageDisplayInterface
- Parameters:
container
- The Container to be placed.
-
setBackground
public void setBackground(java.awt.Color background)
Set the background.- Specified by:
setBackground
in 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:
setFrame
in 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:
setPicture
in 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:
setPlatformContainer
in interfaceImageDisplayInterface
- Parameters:
container
- the platform dependent container.- See Also:
getPlatformContainer()
-
-