Interface View

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void changedUpdate​(DrawingEvent.EventType eventType)
      Give notification from the model that a change occured for an element this view is responsible for rendering.
      java.awt.geom.Rectangle2D getBounds()  
      PECanvas getContainer()
      Fetches the container hosting the view.
      Drawing getDrawing()
      Fetches the document associated with the view.
      Element getElement()  
      java.awt.Graphics getGraphics()
      Fetch a Graphics for rendering.
      Highlighter getHighlighter()
      Returns the Highlighter responsible for rendering the highlighted part of this view.
      View getParentView()
      Returns the parent of the view, as given by the tree-structure the associated graphic element belongs to.
      ViewFactory getViewFactory()
      Fetches the ViewFactory implementation that is feeding the view hierarchy.
      HitInfo hitTest​(PEMouseEvent e, boolean isHighlightVisible)  
      void paint​(java.awt.Graphics2D g, java.awt.geom.Rectangle2D allocation)
      Render the View of the underlying Element to the given graphic context.
      void paintHighlighter​(java.awt.Graphics2D g, java.awt.geom.Rectangle2D allocation, double scale)
      Render the Highlighter to the given graphic context.
      void repaint​(java.awt.geom.Rectangle2D clip)
      ask the hosting container to repaint itself
      void setElement​(Element e)
      set the element the View is responsible for rendering
      void setHighlighter​(Highlighter h)
      Sets the Highlighter responsible for rendering the highlighted part of this view.
    • Method Detail

      • getElement

        Element getElement()
        Returns:
        the element the View is responsible for rendering
      • setElement

        void setElement​(Element e)
        set the element the View is responsible for rendering
      • getParentView

        View getParentView()
        Returns the parent of the view, as given by the tree-structure the associated graphic element belongs to.
        Returns:
        the parent, null if none
      • getContainer

        PECanvas getContainer()
        Fetches the container hosting the view. This is useful for things like scheduling a repaint, finding out the host components font, etc.
        Returns:
        the container, null if none
      • getViewFactory

        ViewFactory getViewFactory()
        Fetches the ViewFactory implementation that is feeding the view hierarchy.
        Returns:
        the factory, null if none
      • getGraphics

        java.awt.Graphics getGraphics()
        Fetch a Graphics for rendering. This can be used to determine font characteristics, and will be different for a print view than a component view.
        Since:
        1.3
      • getDrawing

        Drawing getDrawing()
        Fetches the document associated with the view.
        Returns:
        the drawing, null if none
      • changedUpdate

        void changedUpdate​(DrawingEvent.EventType eventType)
        Give notification from the model that a change occured for an element this view is responsible for rendering.
      • repaint

        void repaint​(java.awt.geom.Rectangle2D clip)
        ask the hosting container to repaint itself
        Parameters:
        clip - the clip rectangle in model-coordinate
      • paint

        void paint​(java.awt.Graphics2D g,
                   java.awt.geom.Rectangle2D allocation)
        Render the View of the underlying Element to the given graphic context.
        Parameters:
        allocation - the graphic clip
      • getBounds

        java.awt.geom.Rectangle2D getBounds()
        Returns:
        the bounds of this View
        This will determine the clipping rectangle passed as a parameter to repaint.
      • getHighlighter

        Highlighter getHighlighter()
        Returns the Highlighter responsible for rendering the highlighted part of this view.
        Returns:
        null if this view cannot be highlighted
      • setHighlighter

        void setHighlighter​(Highlighter h)
        Sets the Highlighter responsible for rendering the highlighted part of this view.
        Parameters:
        h - the delegate ; null if this View mustn't support highlighting
      • paintHighlighter

        void paintHighlighter​(java.awt.Graphics2D g,
                              java.awt.geom.Rectangle2D allocation,
                              double scale)
        Render the Highlighter to the given graphic context.
        Parameters:
        allocation - current clipping
        scale - The current scale factor from model to screen for the Graphics2D context ; this may be used to scale down line thickess, etc... so that lines/rectangle/... appear with the same lenght on the screen whatever the scale factor that's set to the graphic context.
      • hitTest

        HitInfo hitTest​(PEMouseEvent e,
                        boolean isHighlightVisible)
        Parameters:
        isHighlightVisible - whether the receiver should include the highlighter shapes (e.g. end-points) in the click-sensitive area.
        Returns:
        a HitInfo corresponding to the given mouse-event