fdda.dialog.java2d
Class Java2DControl

java.lang.Object
  |
  +--fdda.dialog.java2d.Java2DControl
All Implemented Interfaces:
GraphicHolder, GraphicsControl, SelectionModifier, SwingGraphicsControl

public class Java2DControl
extends Object
implements SwingGraphicsControl, GraphicHolder, SelectionModifier

Controls the graphics of the java2d component. That is, it performs the actions requested by the user through menus or mouse manipulation, partly by delegating them to a manipulator. Also controls the automatic painting of the graphical system and its zoom.

Author:
Jörg Rüdenauer

Nested Class Summary
(package private)  class Java2DControl.ZoomablePanel
          A panel that can be zoomed using an AffineTransform
 
Field Summary
static Color GREY
          the color grey
static double ZOOM_OUT_SCALE
          scale factor for one zoom out operation.
 
Fields inherited from interface fdda.dialog.GraphicsControl
DELETE, DIRECTED_LINE, LINE, NODE, POINTER, S_LOCKED, S_UNLOCKED
 
Constructor Summary
Java2DControl()
          Constructor.
 
Method Summary
 void attachToFrame(JInternalFrame frame, MainFrame mainFrame)
          Attaches the control instance to a frame.
 void deleteSelection()
          Deletes selected components
 int getEditingMode()
          Returns the current mode
 GraphicalSystem getGraphicalSystem()
          Returns the graphical system
 MessageControl getMessageControl()
          Returns the object that manages the graphical messages.
 int getSelectedAction()
          Returns the currently selected action
 void paint(Graphics g)
          Paints the graphics, using a specified Graphics object
 BufferedImage paintOnImage()
          Paints the graphics on an image.
 void redraw(Rectangle clippingRect, Painter painter)
          Repaints a part of the screen (that should contain the graphics).
 void selectMovables()
          Selects all movable components.
 void setEditingMode(int mode)
          Changes the mode
 void setGraphicalSystem(GraphicalSystem system)
          Sets the graphical system that is managed
 void setSelectedAction(int action)
          Selects an action for the user
 double stringHeight()
          Returns the height of a (any) string in the current graphics context.
 double stringWidth(String s)
          Returns the width of a string in the current graphics context.
 void zoomIn()
          Zooms in.
 void zoomOut()
          Zooms out.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

GREY

public static final Color GREY
the color grey


ZOOM_OUT_SCALE

public static final double ZOOM_OUT_SCALE
scale factor for one zoom out operation. Has to be smaller than 1.0

See Also:
Constant Field Values
Constructor Detail

Java2DControl

public Java2DControl()
Constructor.

Method Detail

attachToFrame

public void attachToFrame(JInternalFrame frame,
                          MainFrame mainFrame)
Attaches the control instance to a frame. Registers several listeners with the panel to react to user actions. The panel is added to the frame.

Specified by:
attachToFrame in interface SwingGraphicsControl
Parameters:
frame - the internal frame
mainFrame - the main frame of the application

getGraphicalSystem

public GraphicalSystem getGraphicalSystem()
Description copied from interface: GraphicHolder
Returns the graphical system

Specified by:
getGraphicalSystem in interface GraphicHolder
Returns:
the graphical system

setGraphicalSystem

public void setGraphicalSystem(GraphicalSystem system)
Description copied from interface: GraphicsControl
Sets the graphical system that is managed

Specified by:
setGraphicalSystem in interface GraphicsControl
Parameters:
system - the system

redraw

public void redraw(Rectangle clippingRect,
                   Painter painter)
Description copied from interface: GraphicHolder
Repaints a part of the screen (that should contain the graphics). Closely resembles repaint of Component

Specified by:
redraw in interface GraphicHolder
Parameters:
clippingRect - a rectangle defining the clipping area
painter - the painter instance used for drawing
See Also:
Component.repaint()

stringWidth

public double stringWidth(String s)
Description copied from interface: GraphicHolder
Returns the width of a string in the current graphics context.

Specified by:
stringWidth in interface GraphicHolder
Parameters:
s - the string
Returns:
the width of the string

stringHeight

public double stringHeight()
Description copied from interface: GraphicHolder
Returns the height of a (any) string in the current graphics context.

Specified by:
stringHeight in interface GraphicHolder
Returns:
the string height
See Also:
FontMetrics.getHeight()

zoomIn

public void zoomIn()
Description copied from interface: GraphicsControl
Zooms in. Needs not to be supported.

Specified by:
zoomIn in interface GraphicsControl

zoomOut

public void zoomOut()
Description copied from interface: GraphicsControl
Zooms out. Needs not to be supported.

Specified by:
zoomOut in interface GraphicsControl

selectMovables

public void selectMovables()
Description copied from interface: GraphicsControl
Selects all movable components.

Specified by:
selectMovables in interface GraphicsControl

deleteSelection

public void deleteSelection()
Description copied from interface: GraphicsControl
Deletes selected components

Specified by:
deleteSelection in interface GraphicsControl

paint

public void paint(Graphics g)
Description copied from interface: GraphicsControl
Paints the graphics, using a specified Graphics object

Specified by:
paint in interface GraphicsControl
Parameters:
g - the graphics object

paintOnImage

public BufferedImage paintOnImage()
Description copied from interface: GraphicsControl
Paints the graphics on an image.

Specified by:
paintOnImage in interface GraphicsControl
Returns:
the new image

setEditingMode

public void setEditingMode(int mode)
Description copied from interface: GraphicsControl
Changes the mode

Specified by:
setEditingMode in interface GraphicsControl
Parameters:
mode - the new mode (one of the constants)

getEditingMode

public int getEditingMode()
Description copied from interface: GraphicsControl
Returns the current mode

Specified by:
getEditingMode in interface GraphicsControl
Returns:
the current mode

setSelectedAction

public void setSelectedAction(int action)
Description copied from interface: GraphicsControl
Selects an action for the user

Specified by:
setSelectedAction in interface GraphicsControl
Parameters:
action - the new action (one of the constants)

getSelectedAction

public int getSelectedAction()
Description copied from interface: GraphicsControl
Returns the currently selected action

Specified by:
getSelectedAction in interface GraphicsControl
Returns:
the action

getMessageControl

public MessageControl getMessageControl()
Description copied from interface: GraphicsControl
Returns the object that manages the graphical messages.

Specified by:
getMessageControl in interface GraphicsControl
Returns:
the message control object


API documentation for FDDA version 0.9. Generated on 17/02/2004 14:12.