Package net.sf.gridarta.model.face
Class FaceObjectProviders
- java.lang.Object
-
- net.sf.gridarta.model.face.FaceObjectProviders
-
public class FaceObjectProviders extends java.lang.ObjectProvider for faces ofGameObjectsandArchetypes. The face can be the "normal" (default) face or a filtered variant such as (semi-)transparent and/or double height.
-
-
Constructor Summary
Constructors Constructor Description FaceObjectProviders(int doubleFaceOffset, @NotNull FaceObjects faceObjects, @NotNull ResourceIcons resourceIcons)Creates a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddFaceObjectProvidersListener(@NotNull FaceObjectProvidersListener listener)Adds aFaceObjectProvidersListenerto be notified about changes.@Nullable javax.swing.ImageIcongetDisplayIcon(@NotNull NamedObject namedObject)Returns the display icon for aNamedObject.@NotNull javax.swing.ImageIcongetDouble(@NotNull GameObject<?,?,?> gameObject)Returns the double face for aGameObjectas anImageIcon.<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>>
@NotNull javax.swing.ImageIcongetFace(@NotNull BaseObject<G,A,R,?> baseObject)Returns the face of aBaseObjectas anImageIcon.@Nullable javax.swing.ImageIcongetImageIconForFacename(@NotNull java.lang.String faceObjName)Returns theImageIconfor a given face object name.@NotNull javax.swing.ImageIcongetStretched(@NotNull GameObject<?,?,?> gameObject, long stretch)Returns the stretched face for aGameObjectas anImageIcon.@NotNull javax.swing.ImageIcongetTrans(@NotNull GameObject<?,?,?> gameObject)Returns the transparent face for aGameObjectas anImageIcon.@NotNull javax.swing.ImageIcongetTransDouble(@NotNull GameObject<?,?,?> gameObject)Returns the transparent double face for aGameObjectas anImageIcon.voidreloadAll()Reloads all providers provided by this FaceObjects.voidremoveFaceObjectProvidersListener(@NotNull FaceObjectProvidersListener listener)Removes aFaceObjectProvidersListenerto be notified about changes.voidsetNormal(@NotNull FaceProvider normalFaceProvider)Sets the normalFaceProvider.
-
-
-
Constructor Detail
-
FaceObjectProviders
public FaceObjectProviders(int doubleFaceOffset, @NotNull @NotNull FaceObjects faceObjects, @NotNull @NotNull ResourceIcons resourceIcons)Creates a new instance.- Parameters:
doubleFaceOffset- the offset for shifting double facesfaceObjects- the face objects instanceresourceIcons- the resource icons for creating icons
-
-
Method Detail
-
addFaceObjectProvidersListener
public void addFaceObjectProvidersListener(@NotNull @NotNull FaceObjectProvidersListener listener)Adds aFaceObjectProvidersListenerto be notified about changes.- Parameters:
listener- the listener
-
removeFaceObjectProvidersListener
public void removeFaceObjectProvidersListener(@NotNull @NotNull FaceObjectProvidersListener listener)Removes aFaceObjectProvidersListenerto be notified about changes.- Parameters:
listener- the listener
-
reloadAll
public void reloadAll()
Reloads all providers provided by this FaceObjects.
-
setNormal
public void setNormal(@NotNull @NotNull FaceProvider normalFaceProvider)Sets the normalFaceProvider. The normal face provider also serves as parent for all other face providers.- Parameters:
normalFaceProvider- face the provider that provides normal images
-
getFace
@NotNull public <G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>> @NotNull javax.swing.ImageIcon getFace(@NotNull @NotNull BaseObject<G,A,R,?> baseObject)
Returns the face of aBaseObjectas anImageIcon.- Parameters:
baseObject- the base object to get the face for- Returns:
- the face of the base object as an icon or
nullif no face could be found
-
getTrans
@NotNull public @NotNull javax.swing.ImageIcon getTrans(@NotNull @NotNull GameObject<?,?,?> gameObject)Returns the transparent face for aGameObjectas anImageIcon.- Parameters:
gameObject- the game object- Returns:
- the image icon
-
getDouble
@NotNull public @NotNull javax.swing.ImageIcon getDouble(@NotNull @NotNull GameObject<?,?,?> gameObject)Returns the double face for aGameObjectas anImageIcon.- Parameters:
gameObject- the game object- Returns:
- the image icon
-
getTransDouble
@NotNull public @NotNull javax.swing.ImageIcon getTransDouble(@NotNull @NotNull GameObject<?,?,?> gameObject)Returns the transparent double face for aGameObjectas anImageIcon.- Parameters:
gameObject- the game object- Returns:
- the image icon
-
getStretched
@NotNull public @NotNull javax.swing.ImageIcon getStretched(@NotNull @NotNull GameObject<?,?,?> gameObject, long stretch)Returns the stretched face for aGameObjectas anImageIcon.- Parameters:
gameObject- the game object- Returns:
- the image icon
-
getImageIconForFacename
@Nullable public @Nullable javax.swing.ImageIcon getImageIconForFacename(@NotNull @NotNull java.lang.String faceObjName)Returns theImageIconfor a given face object name.- Parameters:
faceObjName- the face object name- Returns:
- the image icon or
nullif not found
-
getDisplayIcon
@Nullable public @Nullable javax.swing.ImageIcon getDisplayIcon(@NotNull @NotNull NamedObject namedObject)Returns the display icon for aNamedObject.- Parameters:
namedObject- the named object- Returns:
- display icon of this AbstractNamedObject
-
-