Class JEuclidView

java.lang.Object
net.sourceforge.jeuclid.layout.JEuclidView
All Implemented Interfaces:
LayoutView, EventListener, AbstractView

public class JEuclidView extends Object implements AbstractView, LayoutView, EventListener
Version:
$Revision: 96bf1edada57 $
  • Constructor Details

    • JEuclidView

      public JEuclidView(Node node, LayoutContext layoutContext, Graphics2D layoutGraphics)
      Default Constructor.
      Parameters:
      node - document to layout.
      layoutContext - layoutContext to use.
      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.
  • Method Details

    • getDocument

      public DocumentView getDocument()
      Specified by:
      getDocument in interface AbstractView
    • draw

      public void draw(Graphics2D g, float x, float y)
      Draw this view onto a Graphics context.
      Parameters:
      g - Graphics context for painting. Should be compatible to the context used during construction, but does not have to be the same.
      x - x-offset for left edge
      y - y-offset for baseline
    • 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 Graphics2D getGraphics()
      Specified by:
      getGraphics in interface LayoutView
      Returns:
      the Layout Graphics Context.
    • handleEvent

      public void handleEvent(Event evt)
      Specified by:
      handleEvent in interface EventListener
    • getNodesAt

      public 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 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.