Package ca.cgjennings.apps.arkham.diy
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 aPortrait
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 andonRead
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 componenteditor
- 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 componentsheet
- 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 componentsheet
- 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 paintingdiy
- the componentsheet
- 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 paintingdiy
- the componentsheet
- 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 componentobjectInputStream
- theSEObjectInputStream
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 componentobjectOutputStream
- theSEObjectOutputStream
used to write the component
-
getPortraitCount
int getPortraitCount()
Description copied from interface:PortraitProvider
Returns the number of portraits available from this provider. The number of portraits should remain fixed over the lifetime of a provider.- Specified by:
getPortraitCount
in interfacePortraitProvider
- Returns:
- the number of portraits that can be obtained with
PortraitProvider.getPortrait(int)
(may be 0)
-
getPortrait
Portrait getPortrait(int index)
Description copied from interface:PortraitProvider
Returns aPortrait
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 ofindex
indicates which portrait is desired, and must be be between 0 andPortraitProvider.getPortraitCount()
-1 (inclusive).- Specified by:
getPortrait
in interfacePortraitProvider
- Parameters:
index
- the index of the desired portrait (0 for the primary portrait)- Returns:
- a portrait instance that controls the requested portrait
-
-