Module imp
Package de.grogra.imp

Interface ViewComponent

All Superinterfaces:
ComponentWrapper, Disposable
All Known Implementing Classes:
AWTCanvas2D, CanvasAdapter, GLDisplay, GLDisplay, GLSLDisplay, ViewComponentAdapter, WireframeCanvas

public interface ViewComponent extends ComponentWrapper
A ViewComponent represents the actual visualization component of a View. A View typically contains menu components and a single ViewComponent.
Author:
Ole Kniemeyer
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    Bit mask combining SCENE, SELECTION, and TOOLS.
    static final int
    Bit mask for repaint(int) indicating that a repaint is requested due to a change of scene or display size.
    static final int
    Smallest bit mask for repaint(int) that can be used freely by implementations of ViewComponent.
    static final int
    Bit mask for repaint(int) indicating that the whole scene has to be repainted.
    static final int
    Bit mask for repaint(int) indicating that the selection state of objects has to be repainted.
    static final int
    Bit mask for repaint(int) indicating that the tools () have to be repainted.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
     
    int
    Determines the level of resolution which should currently be used in this view component.
    Returns the factory item which has been set by initFactory(Item), i.e., the item which created this component.
    int
    Determines the global level-of-detail which should currently be used in this view component.
    void
    initFactory(Item factory)
    Sets the factory item which created this view component.
    void
    initView(View view, EventListener listener)
    Initializes this component.
    void
    Instructs the view component to create a snapshot.
    void
    Initiates a rendering of the graph using the specified renderer.
    void
    render(Renderer r, int widht, int height)
     
    void
    repaint(int flags)
    Initiates a repaint of those parts of the view which are indicated by the flags, interpreted as a combination of bit masks.
    void
     

    Methods inherited from interface de.grogra.pf.ui.ComponentWrapper

    getComponent

    Methods inherited from interface de.grogra.util.Disposable

    dispose
  • Field Details

  • Method Details

    • initFactory

      void initFactory(Item factory)
      Sets the factory item which created this view component.
      Parameters:
      factory - factory item
    • getFactory

      Item getFactory()
      Returns the factory item which has been set by initFactory(Item), i.e., the item which created this component.
      Returns:
      factory item of this component
    • initView

      void initView(View view, EventListener listener)
      Initializes this component. This method sets the view within which this view component is used to display the graph. It also sets an event listener. this has to be informed of mouse and keys events within the view component by implementations of this method.
      Parameters:
      view - the containing view
      listener - mouse and key events will be reported to this listener
    • repaint

      void repaint(int flags)
      Initiates a repaint of those parts of the view which are indicated by the flags, interpreted as a combination of bit masks. This method may be invoked from arbitrary threads.
      Parameters:
      flags - the parts to be repainted
    • getGlobalLOD

      int getGlobalLOD()
      Determines the global level-of-detail which should currently be used in this view component. The value lies between View.LOD_MIN and View.LOD_MAX inclusively.
      Returns:
      global level-of-detail
    • getDisplayResolution

      int getDisplayResolution()
      Determines the level of resolution which should currently be used in this view component. The value lies between Node#MIN_RESOLUTION and Node#MAX_RESOLUTION inclusively.
      Returns:
      The resolution level used for the display
    • updateResolution

      void updateResolution(int r)
    • render

      void render(Renderer r)
      Initiates a rendering of the graph using the specified renderer.
      Parameters:
      r -
    • render

      void render(Renderer r, int widht, int height)
    • disposeRenderer

      void disposeRenderer(Renderer r)
    • makeSnapshot

      void makeSnapshot(ObjectConsumer<? super RenderedImage> callback)
      Instructs the view component to create a snapshot. The created snapshot has to be delivered to the provided callback as an instance of RenderedImage. This may happen asynchronously, i.e., in an arbitrary thread.
      Parameters:
      callback - callback which asynchronously receives the snapshot