Class 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 class  JEuclidView.NodeRect
      Data structure for storing a Node along with its rendering boundary (Rectangle2D).
    • Constructor Summary

      Constructors 
      Constructor Description
      JEuclidView​(org.w3c.dom.Node node, LayoutContext layoutContext, java.awt.Graphics2D layoutGraphics)
      Default Constructor.
    • 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:
        getDocument in interface org.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 edge
        y - y-offset for baseline
        g - 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:
        getInfo in interface LayoutView
        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:
        getGraphics in interface LayoutView
        Returns:
        the Layout Graphics Context.
      • handleEvent

        public void handleEvent​(org.w3c.dom.events.Event evt)
        Specified by:
        handleEvent in interface org.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-coord
        y - y-coord
        offsetX - starting x position offset
        offsetY - 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 node
        offsetY - y position offset to node
        node - 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.