org.apache.batik.apps.svgbrowser

Class ElementOverlayManager

public class ElementOverlayManager extends Object

Manages element overlay on the canvas.
Nested Class Summary
classElementOverlayManager.ElementOverlay
The element overlay.
Field Summary
protected JSVGCanvascanvas
The canvas.
protected ElementOverlayControllercontroller
The controller for the element overlay.
protected OverlayelementOverlay
The element overlay.
protected ColorelementOverlayColor
The color of the element overlay.
protected ColorelementOverlayStrokeColor
The color of the outline of the element overlay.
protected ArrayListelements
Elements to paint.
protected booleanisOverlayEnabled
Whether the ElementOverlay is enabled.
protected booleanxorMode
The xor mode.
Constructor Summary
ElementOverlayManager(JSVGCanvas canvas)
Constructor.
Method Summary
voidaddElement(Element elem)
Adds an element to the element selection.
protected RectanglegetAllElementsBounds()
Get the current selection bounds.
protected RectanglegetElementBounds(Element elem)
The bounds of a given element.
protected RectanglegetElementBounds(GraphicsNode node)
The bounds of a given graphics node.
OverlaygetElementOverlay()
Gets the elementOverlay.
ColorgetElementOverlayColor()
Gets the elementOverlayColor.
ColorgetElementOverlayStrokeColor()
Gets the elementOverlayStrokeColor.
booleanisOverlayEnabled()
If the element overlay is enabled.
booleanisXorMode()
Gets the xorMode.
protected Rectangleoutset(Rectangle r, int amount)
Increases the given rectangle area for a given amount of units in a rectangle increasement manner.
voidremoveElement(Element elem)
Removes the element from the element selection and adds its bound to the 'dirty' region.
voidremoveElements()
Removes all elements from the element selection list.
voidremoveOverlay()
Removes the elementOverlay.
voidrepaint()
Repaints the canvas.
voidsetController(ElementOverlayController controller)
Sets the element overlay controller.
voidsetElementOverlayColor(Color selectionOverlayColor)
Sets the color to use for the element overlay.
voidsetElementOverlayStrokeColor(Color selectionOverlayStrokeColor)
Sets the color to use for stroking the element overlay.
voidsetOverlayEnabled(boolean isOverlayEnabled)
Enables / disables the Element overlay.
voidsetXorMode(boolean xorMode)
Sets the xor mode.

Field Detail

canvas

protected JSVGCanvas canvas
The canvas.

controller

protected ElementOverlayController controller
The controller for the element overlay.

elementOverlay

protected Overlay elementOverlay
The element overlay.

elementOverlayColor

protected Color elementOverlayColor
The color of the element overlay.

elementOverlayStrokeColor

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

elements

protected ArrayList elements
Elements to paint.

isOverlayEnabled

protected boolean isOverlayEnabled
Whether the ElementOverlay is enabled.

xorMode

protected boolean xorMode
The xor mode.

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

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

getElementOverlay

public Overlay getElementOverlay()
Gets the elementOverlay.

Returns: the elementOverlay

getElementOverlayColor

public Color getElementOverlayColor()
Gets the elementOverlayColor.

Returns: the elementOverlayColor

getElementOverlayStrokeColor

public Color getElementOverlayStrokeColor()
Gets the elementOverlayStrokeColor.

Returns: the elementOverlayStrokeColor

isOverlayEnabled

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

Returns: isOverlayEnabled

isXorMode

public boolean isXorMode()
Gets the xorMode.

Returns: the xorMode

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

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.

removeOverlay

public void removeOverlay()
Removes the elementOverlay.

repaint

public void repaint()
Repaints the canvas.

setController

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

Parameters: controller The element overlay controller

setElementOverlayColor

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

Parameters: selectionOverlayColor The new element overlay color.

setElementOverlayStrokeColor

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

Parameters: selectionOverlayStrokeColor The new element overlay stroking color.

setOverlayEnabled

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

setXorMode

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

Parameters: xorMode the xorMode to set

Copyright B) 2008 Apache Software Foundation. All Rights Reserved.