Interface FxSpriteFactory<S>

  • Type Parameters:
    S - the generic type of the identifier for which the sprite is to be created.
    All Superinterfaces:
    org.refcodes.factory.ContextLookupFactory<IMG,S,CBV>, org.refcodes.checkerboard.SpriteFactory<javafx.scene.Node,S,FxCheckerboardViewer<?,S>>
    All Known Implementing Classes:

    public interface FxSpriteFactory<S>
    extends org.refcodes.checkerboard.SpriteFactory<javafx.scene.Node,S,FxCheckerboardViewer<?,S>>
    A factory for creating sprites for the FxCheckerboardViewer.
    • Method Detail

      • createInstance

        javafx.scene.Node createInstance​(S aIdentifier,
                                         FxCheckerboardViewer<?,S> aContext)
        Some words when using the FxCheckerboardViewerImpl implementation of the FxCheckerboardViewer: In case you return a Node for the provided identifier being the same instance as a previously created Node for the same previously provided identifier, then the Node is just redrawn by the FxCheckerboardViewerImpl (preventing fading out / fading in when updating the Node). If another instance is returned, then the previously set Node is removed (fade out) before the newly created Node is added (fade in) by the FxCheckerboardViewerImpl. You may use a Map (WeakHashMap) for relating the identifier to the according Node in order to identify whether to create a new Node or update an existing one.
        Specified by:
        createInstance in interface org.refcodes.factory.ContextLookupFactory<IMG extends java.lang.Object,S extends java.lang.Object,CBV extends org.refcodes.checkerboard.CheckerboardViewer<?,S,? extends CBV>>