Main Page   Packages   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members  

CanvasViewer Class Reference

The root of the viewer class hierarchy (still under construction). More...

Inheritance diagram for CanvasViewer::

CanvasInspectionUser CanvasEditUser BasicViewer Histogram3dViewer ScribbleViewer ThumbnailViewer List of all members.

Public Methods

 CanvasViewer ()
 Constructor. More...

int getViewerID ()
 Get the ID of this viewer. More...

int getMode ()
 Get the viewer mode (see class ViewerMode). More...

int getSubMode ()
 Get the viewer sub-mode (see class ViewerMode). More...

void setMode (int mode, int subMode)
 Set the viewer mode (see class ViewerMode). More...

boolean isEnabledMode (int mode)
 Check whether the given viewer mode (see class ViewerMode) is enabled. More...

void setEnableMode (int mode, boolean b)
 Set whether the given viewer mode (see class ViewerMode) is enabled. More...

Color getDefaultDrawColor ()
 Get the default drawing color of this viewer. More...

void setDefaultDrawColor (Color c)
 Set the default drawing color of this viewer. More...

Color getBackgroundColor ()
 Get the background color of this viewer. More...

void setBackgroundColor (Color c)
 Set the background color of this viewer. More...

void addViewerInspectionListener (ViewerInspectionListener l)
 Add a viewer inspection listener. More...

void removeViewerInspectionListener (ViewerInspectionListener l)
 Remove a viewer inspection listener. More...

void addViewerEditListener (ViewerEditListener l)
 Add a viewer edit listener. More...

void removeViewerEditListener (ViewerEditListener l)
 Remove a viewer edit listener. More...

void doRefresh ()
 Repaint the viewer by repainting its canvas. More...

void doClear ()
 Clear the canvas. More...

void doPan (double relX, double relY)
 Pan to the given position, coordinates between 0 and 1. More...

void doZoom (double zoomVal)
 Zoom to the given factor. More...

double getZoomFactor ()
 Get zoom factor. More...

BufferedImage toImage ()
 Render the canvas of the viewer in an image. More...

BufferedImage toImage (int width, int height)
 Render the canvas of the viewer in an image. More...

int addObject (CanvasObject obj)
 Add a CanvasObject to the viewer. More...

CanvasObject getObject (int objID)
 Get the CanvasObject with the given ID from the editor. More...

CanvasObject getObjectCopy (int objID, boolean ics)
 Get a copy of the CanvasObject with the given ID from the editor. More...

CanvasObject getObject (String objName)
 Get the CanvasObject with the given name from the visualizer. More...

void removeObject (int objID)
 Remove given object from the editor. More...

void removeObject (String objName)
 Remove given object from the visualizer. More...

void removeAllObjects ()
 Remove all objects. More...

void canvasEntered (Object canvas, double x, double y)
 Implementation of CanvasInspectionUser. More...

void canvasExited (Object canvas)
 Implementation of CanvasInspectionUser. More...

void canvasSelected (Object canvas, double x, double y)
 Implementation of CanvasInspectionUser. More...

void objectEntered (Object canvas, CanvasObject cObj, int objID, double x, double y)
 Implementation of CanvasInspectionUser. More...

void objectProbed (Object canvas, CanvasObject cObj, int objID, double x, double y)
 Implementation of CanvasInspectionUser. More...

void objectSelected (Object canvas, CanvasObject cObj, int objID, double x, double y)
 Implementation of CanvasInspectionUser. More...

void objectCreated (Object canvas, CanvasObject cObj, int objID)
 Implementation of CanvasEditUser. More...

void objectDeleted (Object canvas, CanvasObject cObj, int objID)
 Implementation of CanvasEditUser. More...

void objectMoved (Object canvas, CanvasObject cObj, int objID)
 Implementation of CanvasEditUser. More...

void objectResized (Object canvas, CanvasObject cObj, int objID)
 Implementation of CanvasEditUser. More...

void objectReshaped (Object canvas, CanvasObject cObj, int objID, int point)
 Implementation of CanvasEditUser. More...

void objectChangedVisually (Object canvas, CanvasObject cObj, int objID, String prop)
 Implementation of CanvasEditUser. More...


Static Public Attributes

final Color STD_BCOLOR = IcsCanvas.STD_BCOLOR
 The standard background color. More...

final Color STD_DCOLOR = IcsCanvas.STD_DCOLOR
 The standard drawing color. More...

final int SCROLL_NEVER = 0
 Never use scrollbars. More...

final int SCROLL_ALWAYS = 1
 Always use scrollbars. More...

final int SCROLL_AS_NEEDED = 2
 Use scrollbars when needed. More...


Protected Methods

void initScrollPane (int scrollers)
 Will initialize the ScrollPane with a single canvas (\_editor) or a LayeredCanvasPane with \_editor, etc. More...


Protected Attributes

int _viewerID = 0
JScrollPane _scrollPane = null
boolean _singleCanvas = false
ActiveCanvas _editor = null
VisCanvas _visualizer = null
Vector _inspListeners = new Vector()
Vector _editListeners = new Vector()

Detailed Description

The root of the viewer class hierarchy (still under construction).

The basic CanvasViewer contains two IcsCanvas's put on top of eachother. The upper canvas is called the editor and allows the user to "scribble" in the viewer. The lower canvas is called the visualizer and allows for visualization of C++ objects that are known to the mediator, i.e. they are StringAddressable. These object are not editable. Each canvas puts instances of CanvasFigure on top of instances of CanvasImage as they would otherwise not be visisble. This results in the following layered structure (with the highest number on top): 4) CanvasFigure (s) : getInputSource() == INP\_USER 3) CanvasImage (s) : getInputSource() == INP\_USER 2) CanvasFigure (s) : getInputSource() == INP\_SASYSTEM 1) CanvasImage (s) : getInputSource() == INP\_SASYSTEM


Constructor & Destructor Documentation

CanvasViewer::CanvasViewer   [inline]
 

Constructor.


Member Function Documentation

int CanvasViewer::getViewerID   [inline]
 

Get the ID of this viewer.

int CanvasViewer::getMode   [inline]
 

Get the viewer mode (see class ViewerMode).

Not all viewers actually respond to this.

int CanvasViewer::getSubMode   [inline]
 

Get the viewer sub-mode (see class ViewerMode).

Not all viewers actually respond to this.

void CanvasViewer::setMode int    mode,
int    subMode
[inline]
 

Set the viewer mode (see class ViewerMode).

Not all viewers actually respond to this.

Reimplemented in ScribbleViewer.

boolean CanvasViewer::isEnabledMode int    mode [inline]
 

Check whether the given viewer mode (see class ViewerMode) is enabled.

Not all viewers actually respond to this.

Reimplemented in ScribbleViewer.

void CanvasViewer::setEnableMode int    mode,
boolean    b
[inline]
 

Set whether the given viewer mode (see class ViewerMode) is enabled.

Not all viewers actually respond to this.

Reimplemented in ScribbleViewer.

Color CanvasViewer::getDefaultDrawColor   [inline]
 

Get the default drawing color of this viewer.

void CanvasViewer::setDefaultDrawColor Color    c [inline]
 

Set the default drawing color of this viewer.

Color CanvasViewer::getBackgroundColor   [inline]
 

Get the background color of this viewer.

void CanvasViewer::setBackgroundColor Color    c [inline]
 

Set the background color of this viewer.

Will also repaint the viewer.

void CanvasViewer::addViewerInspectionListener ViewerInspectionListener    l [inline]
 

Add a viewer inspection listener.

void CanvasViewer::removeViewerInspectionListener ViewerInspectionListener    l [inline]
 

Remove a viewer inspection listener.

void CanvasViewer::addViewerEditListener ViewerEditListener    l [inline]
 

Add a viewer edit listener.

void CanvasViewer::removeViewerEditListener ViewerEditListener    l [inline]
 

Remove a viewer edit listener.

void CanvasViewer::doRefresh   [inline]
 

Repaint the viewer by repainting its canvas.

void CanvasViewer::doClear   [inline]
 

Clear the canvas.

Sets the zoom factor to 1.0 and removes all objects from the canvas, Clearing will fit the canvas to the size of the viewport.

Reimplemented in ScribbleViewer.

void CanvasViewer::doPan double    relX,
double    relY
[inline]
 

Pan to the given position, coordinates between 0 and 1.

void CanvasViewer::doZoom double    zoomVal [inline]
 

Zoom to the given factor.

Reimplemented in ScribbleViewer.

double CanvasViewer::getZoomFactor   [inline]
 

Get zoom factor.

BufferedImage CanvasViewer::toImage   [inline]
 

Render the canvas of the viewer in an image.

The size of the image will match the extent of the ICS. The rendering is done at the current zoom.

BufferedImage CanvasViewer::toImage int    width,
int    height
[inline]
 

Render the canvas of the viewer in an image.

The size of the image will be width x height. The rendering is done at the current zoom.

int CanvasViewer::addObject CanvasObject    obj [inline]
 

Add a CanvasObject to the viewer.

If the input source of the object equals INP\_SASYSTEM the object will be put on the visualizer. Otherwise, it will be put on the editor. Returns the id of the object. The id is the preferred way to access objects in an editor as direct references to objects may become invalid due to internal activities of the editor. As the visualizer does not change the CanvasObject it is save to keep references to objects in a visualizer.

Reimplemented in Histogram3dViewer, and ThumbnailViewer.

CanvasObject CanvasViewer::getObject int    objID [inline]
 

Get the CanvasObject with the given ID from the editor.

CanvasObject CanvasViewer::getObjectCopy int    objID,
boolean    ics
[inline]
 

Get a copy of the CanvasObject with the given ID from the editor.

CanvasObject CanvasViewer::getObject String    objName [inline]
 

Get the CanvasObject with the given name from the visualizer.

void CanvasViewer::removeObject int    objID [inline]
 

Remove given object from the editor.

void CanvasViewer::removeObject String    objName [inline]
 

Remove given object from the visualizer.

void CanvasViewer::removeAllObjects   [inline]
 

Remove all objects.

void CanvasViewer::canvasEntered Object    canvas,
double    x,
double    y
[inline]
 

Implementation of CanvasInspectionUser.

Reimplemented from CanvasInspectionUser.

void CanvasViewer::canvasExited Object    canvas [inline]
 

Implementation of CanvasInspectionUser.

Reimplemented from CanvasInspectionUser.

void CanvasViewer::canvasSelected Object    canvas,
double    x,
double    y
[inline]
 

Implementation of CanvasInspectionUser.

Reimplemented from CanvasInspectionUser.

void CanvasViewer::objectEntered Object    canvas,
CanvasObject    cObj,
int    objID,
double    x,
double    y
[inline]
 

Implementation of CanvasInspectionUser.

Reimplemented from CanvasInspectionUser.

void CanvasViewer::objectProbed Object    canvas,
CanvasObject    cObj,
int    objID,
double    x,
double    y
[inline]
 

Implementation of CanvasInspectionUser.

Reimplemented from CanvasInspectionUser.

void CanvasViewer::objectSelected Object    canvas,
CanvasObject    cObj,
int    objID,
double    x,
double    y
[inline]
 

Implementation of CanvasInspectionUser.

Reimplemented from CanvasInspectionUser.

void CanvasViewer::objectCreated Object    canvas,
CanvasObject    cObj,
int    objID
[inline]
 

Implementation of CanvasEditUser.

Reimplemented from CanvasEditUser.

void CanvasViewer::objectDeleted Object    canvas,
CanvasObject    cObj,
int    objID
[inline]
 

Implementation of CanvasEditUser.

Reimplemented from CanvasEditUser.

void CanvasViewer::objectMoved Object    canvas,
CanvasObject    cObj,
int    objID
[inline]
 

Implementation of CanvasEditUser.

Reimplemented from CanvasEditUser.

void CanvasViewer::objectResized Object    canvas,
CanvasObject    cObj,
int    objID
[inline]
 

Implementation of CanvasEditUser.

Reimplemented from CanvasEditUser.

void CanvasViewer::objectReshaped Object    canvas,
CanvasObject    cObj,
int    objID,
int    point
[inline]
 

Implementation of CanvasEditUser.

Reimplemented from CanvasEditUser.

void CanvasViewer::objectChangedVisually Object    canvas,
CanvasObject    cObj,
int    objID,
String    prop
[inline]
 

Implementation of CanvasEditUser.

Reimplemented from CanvasEditUser.

void CanvasViewer::initScrollPane int    scrollers [inline, protected]
 

Will initialize the ScrollPane with a single canvas (\_editor) or a LayeredCanvasPane with \_editor, etc.


Member Data Documentation

final Color CanvasViewer::STD_BCOLOR = IcsCanvas.STD_BCOLOR [static]
 

The standard background color.

final Color CanvasViewer::STD_DCOLOR = IcsCanvas.STD_DCOLOR [static]
 

The standard drawing color.

final int CanvasViewer::SCROLL_NEVER = 0 [static]
 

Never use scrollbars.

final int CanvasViewer::SCROLL_ALWAYS = 1 [static]
 

Always use scrollbars.

final int CanvasViewer::SCROLL_AS_NEEDED = 2 [static]
 

Use scrollbars when needed.

int CanvasViewer::_viewerID = 0 [protected]
 

JScrollPane CanvasViewer::_scrollPane = null [protected]
 

boolean CanvasViewer::_singleCanvas = false [protected]
 

ActiveCanvas CanvasViewer::_editor = null [protected]
 

VisCanvas CanvasViewer::_visualizer = null [protected]
 

Vector CanvasViewer::_inspListeners = new Vector() [protected]
 

Vector CanvasViewer::_editListeners = new Vector() [protected]
 


The documentation for this class was generated from the following file:
Generated on Tue Jan 8 14:14:24 2002 for JavaReference by doxygen1.2.12 written by Dimitri van Heesch, © 1997-2001