Class TLspAWTView

All Implemented Interfaces:
ILcdPropertyChangeSource, ILcdLayered, ILcdTreeLayered, ILcdView, ILspAWTView, ILspView, Serializable

public class TLspAWTView extends ALspAWTView
An ILspView which is represented by an AWT component. The component can be accessed via the getHostComponent() method. This implementation uses a heavyweight component for drawing into. Lightweight components overlaid on this view may hence not be drawn correctly. The getOverlayComponent() method returns a component which is specially treated by the view to avoid these issues. Any lightweight overlays should therefore be added to this overlay component.

Note that the host component is the one that should be added to the application's GUI. The overlay component is owned by the view and should only be used to add additional child components to.

See Also:
  • Constructor Details

    • TLspAWTView

      public TLspAWTView() throws UnsatisfiedLinkError
      Creates a new AWT view with a default configuration. Note that TLspViewBuilder provides a convenient way of configuring views if you wish to deviate from the default settings for any reason.
  • Method Details

    • getOverlayComponent

      public JComponent getOverlayComponent()
      Returns the Swing component that will be painted on top of the view. You can add other Swing components to it to paint them on top of the view. Components added to the overlay component will be visible over the view and can be interacted with as expected. By default, the overlay component uses TLcdOverlayLayout, which is a useful layout manager for overlays. However, other layouts may be used. Typical uses of the overlay component include on-map controls (see the navigation controls package) or map legends.

      Note that this method may return null if the view was created without overlay component support (see TLspViewBuilder.overlayComponents(boolean).

      a container to which overlay components can be added
    • createGLDrawable

      protected TLcdGLDrawableHolder createGLDrawable(ILcdGLCapabilities aCapabilities, GraphicsDevice aGraphicsDevice, ILcdGLDrawable aShareWith) throws UnsatisfiedLinkError
      Creates an ILcdGLDrawable for this view canvas. This method is called during construction of the TLspAWTView. The arguments of this method are also those passed in via the constructors.
      aCapabilities - an ILcdGLCapabilities
      aGraphicsDevice - a GraphicsDevice
      aShareWith - an ILcdGLDrawable
      a TLcdGLDrawableHolder
      UnsatisfiedLinkError - when the OpenGL binding native libraries could not be loaded
      See Also:
    • invalidate

      public void invalidate(boolean aRepaint, Object aSource, String aMessage)
      Description copied from interface: ILcdView
      Invalidate the content of this ILcdView.
      Specified by:
      invalidate in interface ILcdView
      invalidate in class ALspAWTView
      aRepaint - if true, this ILcdView shall be repainted immediately.
      aSource - the class instance that calls this method. Used for tracing.
      aMessage - a message associated with this call. Used for tracing.
    • getHostComponent

      public Component getHostComponent()
      Returns the AWT component that represents this ILspView. This component can be used as the view's on-screen representation and is also the channel through which the view can receive user input events.

      It is not allowed to change any sub-components of this component or their layout. You can use the overlay component to paint components on top of the view.

      The host component can also be used to print the contents of the view (e.g. using TLcdPrintComponentAction).

      an AWT component