Package net.sourceforge.jeuclid.layout
Class JEuclidView
- java.lang.Object
-
- net.sourceforge.jeuclid.layout.JEuclidView
-
- All Implemented Interfaces:
LayoutView,org.w3c.dom.events.EventListener,org.w3c.dom.views.AbstractView
public class JEuclidView extends java.lang.Object implements org.w3c.dom.views.AbstractView, LayoutView, org.w3c.dom.events.EventListener
- Version:
- $Revision: 96bf1edada57 $
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classJEuclidView.NodeRectData structure for storing aNodealong with its rendering boundary (Rectangle2D).
-
Constructor Summary
Constructors Constructor Description JEuclidView(org.w3c.dom.Node node, LayoutContext layoutContext, java.awt.Graphics2D layoutGraphics)Default Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddraw(java.awt.Graphics2D g, float x, float y)Draw this view onto a Graphics context.floatgetAscentHeight()floatgetDescentHeight()org.w3c.dom.views.DocumentViewgetDocument()java.awt.Graphics2DgetGraphics()LayoutInfogetInfo(LayoutableNode node)Retrieve the Info object for a given child.java.util.List<JEuclidView.NodeRect>getNodesAt(float x, float y, float offsetX, float offsetY)Get the node and rendering information from a mouse position.java.awt.geom.Rectangle2DgetRect(float offsetX, float offsetY, LayoutableNode node)Gets the absolute Bounds for a given node and offset.floatgetWidth()voidhandleEvent(org.w3c.dom.events.Event evt)
-
-
-
Constructor Detail
-
JEuclidView
public JEuclidView(org.w3c.dom.Node node, LayoutContext layoutContext, java.awt.Graphics2D layoutGraphics)Default Constructor.- Parameters:
node- document to layout.layoutGraphics- Graphics context to use for layout calculations. This should be compatible to the context used for painting, but does not have to be the same.layoutContext- layoutContext to use.
-
-
Method Detail
-
getDocument
public org.w3c.dom.views.DocumentView getDocument()
- Specified by:
getDocumentin interfaceorg.w3c.dom.views.AbstractView
-
draw
public void draw(java.awt.Graphics2D g, float x, float y)Draw this view onto a Graphics context.- Parameters:
x- x-offset for left edgey- y-offset for baselineg- Graphics context for painting. Should be compatible to the context used during construction, but does not have to be the same.
-
getInfo
public LayoutInfo getInfo(LayoutableNode node)
Retrieve the Info object for a given child.- Specified by:
getInfoin interfaceLayoutView- Parameters:
node- the node- Returns:
- an LayoutInfo object.
-
getWidth
public float getWidth()
- Returns:
- width of this view.
-
getAscentHeight
public float getAscentHeight()
- Returns:
- ascent height.
-
getDescentHeight
public float getDescentHeight()
- Returns:
- descent height.
-
getGraphics
public java.awt.Graphics2D getGraphics()
- Specified by:
getGraphicsin interfaceLayoutView- Returns:
- the Layout Graphics Context.
-
handleEvent
public void handleEvent(org.w3c.dom.events.Event evt)
- Specified by:
handleEventin interfaceorg.w3c.dom.events.EventListener
-
getNodesAt
public java.util.List<JEuclidView.NodeRect> getNodesAt(float x, float y, float offsetX, float offsetY)
Get the node and rendering information from a mouse position.- Parameters:
x- x-coordy- y-coordoffsetX- starting x position offsetoffsetY- starting y position offset- Returns:
- list of nodes with rendering information
-
getRect
public java.awt.geom.Rectangle2D getRect(float offsetX, float offsetY, LayoutableNode node)Gets the absolute Bounds for a given node and offset. May return null if the node could not be found.- Parameters:
offsetX- x position offset to nodeoffsetY- y position offset to nodenode- A layoutable node which was layouted in the current view.- Returns:
- the rectangle with the absolute bounds or null if the given node was not layouted in this view.
-
-