org.apache.batik.apps.svgbrowser
Class ElementOverlayManager

java.lang.Object
  extended by org.apache.batik.apps.svgbrowser.ElementOverlayManager

public class ElementOverlayManager
extends Object

Manages element overlay on the canvas.


Nested Class Summary
 class ElementOverlayManager.ElementOverlay
          The element overlay.
 
Field Summary
protected  JSVGCanvas canvas
          The canvas.
protected  ElementOverlayController controller
          The controller for the element overlay.
protected  Overlay elementOverlay
          The element overlay.
protected  Color elementOverlayColor
          The color of the element overlay.
protected  Color elementOverlayStrokeColor
          The color of the outline of the element overlay.
protected  ArrayList elements
          Elements to paint.
protected  boolean isOverlayEnabled
          Whether the ElementOverlay is enabled.
protected  boolean xorMode
          The xor mode.
 
Constructor Summary
ElementOverlayManager(JSVGCanvas canvas)
          Constructor.
 
Method Summary
 void addElement(Element elem)
          Adds an element to the element selection.
protected  Rectangle getAllElementsBounds()
          Get the current selection bounds.
protected  Rectangle getElementBounds(Element elem)
          The bounds of a given element.
protected  Rectangle getElementBounds(GraphicsNode node)
          The bounds of a given graphics node.
 Overlay getElementOverlay()
          Gets the elementOverlay.
 Color getElementOverlayColor()
          Gets the elementOverlayColor.
 Color getElementOverlayStrokeColor()
          Gets the elementOverlayStrokeColor.
 boolean isOverlayEnabled()
          If the element overlay is enabled.
 boolean isXorMode()
          Gets the xorMode.
protected  Rectangle outset(Rectangle r, int amount)
          Increases the given rectangle area for a given amount of units in a rectangle increasement manner.
 void removeElement(Element elem)
          Removes the element from the element selection and adds its bound to the 'dirty' region.
 void removeElements()
          Removes all elements from the element selection list.
 void removeOverlay()
          Removes the elementOverlay.
 void repaint()
          Repaints the canvas.
 void setController(ElementOverlayController controller)
          Sets the element overlay controller.
 void setElementOverlayColor(Color selectionOverlayColor)
          Sets the color to use for the element overlay.
 void setElementOverlayStrokeColor(Color selectionOverlayStrokeColor)
          Sets the color to use for stroking the element overlay.
 void setOverlayEnabled(boolean isOverlayEnabled)
          Enables / disables the Element overlay.
 void setXorMode(boolean xorMode)
          Sets the xor mode.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

elementOverlayStrokeColor

protected Color elementOverlayStrokeColor
The color of the outline of the element overlay.


elementOverlayColor

protected Color elementOverlayColor
The color of the element overlay.


xorMode

protected boolean xorMode
The xor mode.


canvas

protected JSVGCanvas canvas
The canvas.


elementOverlay

protected Overlay elementOverlay
The element overlay.


elements

protected ArrayList elements
Elements to paint.


controller

protected ElementOverlayController controller
The controller for the element overlay.


isOverlayEnabled

protected boolean isOverlayEnabled
Whether the ElementOverlay is enabled.

Constructor Detail

ElementOverlayManager

public ElementOverlayManager(JSVGCanvas canvas)
Constructor.

Parameters:
canvas - The parent canvas
Method Detail

addElement

public void addElement(Element elem)
Adds an element to the element selection.

Parameters:
elem - The element to add

removeElement

public void removeElement(Element elem)
Removes the element from the element selection and adds its bound to the 'dirty' region.

Parameters:
elem - The element to remove

removeElements

public void removeElements()
Removes all elements from the element selection list.


getAllElementsBounds

protected Rectangle getAllElementsBounds()
Get the current selection bounds.

Returns:
the current selection bounds

getElementBounds

protected Rectangle getElementBounds(Element elem)
The bounds of a given element.

Parameters:
elem - The given element
Returns:
Rectangle bounds

getElementBounds

protected Rectangle getElementBounds(GraphicsNode node)
The bounds of a given graphics node.

Parameters:
node - The given graphics node
Returns:
the bounds

outset

protected Rectangle outset(Rectangle r,
                           int amount)
Increases the given rectangle area for a given amount of units in a rectangle increasement manner.

Parameters:
r - The given rectangle
amount - The given amount of units
Returns:
r

repaint

public void repaint()
Repaints the canvas.


getElementOverlayColor

public Color getElementOverlayColor()
Gets the elementOverlayColor.

Returns:
the elementOverlayColor

setElementOverlayColor

public void setElementOverlayColor(Color selectionOverlayColor)
Sets the color to use for the element overlay.

Parameters:
selectionOverlayColor - The new element overlay color.

getElementOverlayStrokeColor

public Color getElementOverlayStrokeColor()
Gets the elementOverlayStrokeColor.

Returns:
the elementOverlayStrokeColor

setElementOverlayStrokeColor

public void setElementOverlayStrokeColor(Color selectionOverlayStrokeColor)
Sets the color to use for stroking the element overlay.

Parameters:
selectionOverlayStrokeColor - The new element overlay stroking color.

isXorMode

public boolean isXorMode()
Gets the xorMode.

Returns:
the xorMode

setXorMode

public void setXorMode(boolean xorMode)
Sets the xor mode.

Parameters:
xorMode - the xorMode to set

getElementOverlay

public Overlay getElementOverlay()
Gets the elementOverlay.

Returns:
the elementOverlay

removeOverlay

public void removeOverlay()
Removes the elementOverlay.


setController

public void setController(ElementOverlayController controller)
Sets the element overlay controller.

Parameters:
controller - The element overlay controller

isOverlayEnabled

public boolean isOverlayEnabled()
If the element overlay is enabled.

Returns:
isOverlayEnabled

setOverlayEnabled

public void setOverlayEnabled(boolean isOverlayEnabled)
Enables / disables the Element overlay.



Copyright © 2008 Apache Software Foundation. All Rights Reserved.