Interface Handler

  • All Superinterfaces:
    PortraitProvider
    All Known Implementing Classes:
    DIY

    public interface Handler
    extends PortraitProvider
    This adapter interface acts as the bridge between a Strange Eons game component and a DIY script. The DIY script is expected to implement these functions.

    Note: As of Strange Eons 3.0, this interface extends the PortraitProvider interface. However, scripts do not have to implement functions for that interface unless they perform their own portrait handling.

    Author:
    Chris Jennings
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void create​(DIY diy)
      Called when the DIY component is first created.
      void createBackPainter​(DIY diy, DIYSheet sheet)
      Called to set up any objects needed to paint the component's back face(s).
      void createFrontPainter​(DIY diy, DIYSheet sheet)
      Called to set up any objects needed to paint the component's front face(s).
      void createInterface​(DIY diy, DIYEditor editor)
      Called to create a user interface that can edit the component.
      Portrait getPortrait​(int index)
      Returns a Portrait that can be used to manipulate one of the portrait images used by a component.
      int getPortraitCount()
      Returns the number of portraits available from this provider.
      void onClear​(DIY diy)
      Called when the user wants to reset the component to a blank state.
      void onRead​(DIY diy, java.io.ObjectInputStream objectInputStream)
      Called when the component is being read from a file, after all regular content has been loaded.
      void onWrite​(DIY diy, java.io.ObjectOutputStream objectOutputStream)
      Called when the component is being written to a file, after all regular content has been saved.
      void paintBack​(java.awt.Graphics2D g, DIY diy, DIYSheet sheet)
      Called to paint content on the component's back face(s).
      void paintFront​(java.awt.Graphics2D g, DIY diy, DIYSheet sheet)
      Called to paint content on the component's front face(s).
    • Method Detail

      • create

        void create​(DIY diy)
        Called when the DIY component is first created. This is used to set up the component's basic features (face style, base key, etc.). This method and onRead are the only places where these values can be changed without throwing an exception.
        Parameters:
        diy - the component
      • createInterface

        void createInterface​(DIY diy,
                             DIYEditor editor)
        Called to create a user interface that can edit the component.
        Parameters:
        diy - the component
        editor - the editor that will display the component editing controls
      • createFrontPainter

        void createFrontPainter​(DIY diy,
                                DIYSheet sheet)
        Called to set up any objects needed to paint the component's front face(s).
        Parameters:
        diy - the component
        sheet - the sheet representing the face in question
      • createBackPainter

        void createBackPainter​(DIY diy,
                               DIYSheet sheet)
        Called to set up any objects needed to paint the component's back face(s).
        Parameters:
        diy - the component
        sheet - the sheet representing the face in question
      • paintFront

        void paintFront​(java.awt.Graphics2D g,
                        DIY diy,
                        DIYSheet sheet)
        Called to paint content on the component's front face(s).
        Parameters:
        g - the graphics context to use for painting
        diy - the component
        sheet - the sheet representing the face in question
      • paintBack

        void paintBack​(java.awt.Graphics2D g,
                       DIY diy,
                       DIYSheet sheet)
        Called to paint content on the component's back face(s).
        Parameters:
        g - the graphics context to use for painting
        diy - the component
        sheet - the sheet representing the face in question
      • onClear

        void onClear​(DIY diy)
        Called when the user wants to reset the component to a blank state.
        Parameters:
        diy - the component
      • onRead

        void onRead​(DIY diy,
                    java.io.ObjectInputStream objectInputStream)
        Called when the component is being read from a file, after all regular content has been loaded.
        Parameters:
        diy - the component
        objectInputStream - the SEObjectInputStream used to read the component
      • onWrite

        void onWrite​(DIY diy,
                     java.io.ObjectOutputStream objectOutputStream)
        Called when the component is being written to a file, after all regular content has been saved.
        Parameters:
        diy - the component
        objectOutputStream - the SEObjectOutputStream used to write the component
      • getPortrait

        Portrait getPortrait​(int index)
        Description copied from interface: PortraitProvider
        Returns a Portrait that can be used to manipulate one of the portrait images used by a component. A component may use more than one portrait. The value of index indicates which portrait is desired, and must be be between 0 and PortraitProvider.getPortraitCount()-1 (inclusive).
        Specified by:
        getPortrait in interface PortraitProvider
        Parameters:
        index - the index of the desired portrait (0 for the primary portrait)
        Returns:
        a portrait instance that controls the requested portrait