Class DialogAttribute<G extends GameObject<G,​A,​R>,​A extends MapArchObject<A>,​R extends Archetype<G,​A,​R>,​T extends ArchetypeAttribute>

    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected DialogAttribute​(T ref)
      Creates a new instance.
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      protected void addLine​(@NotNull javax.swing.text.Document doc, @NotNull javax.swing.text.AttributeSet style, @NotNull java.lang.String prefix, @NotNull java.lang.String postfix)
      Appends a line to a Document.
      abstract void appendSummary​(@NotNull javax.swing.text.Document doc, @NotNull javax.swing.text.Style style)
      Appends a summary line for this attribute to a Document.
      abstract @NotNull java.lang.String getObjectText​(G gameObject, @NotNull Archetype<G,​A,​R> archetype, @NotNull java.lang.String @NotNull [] newMsg, @NotNull ArchetypeType archetypeType)
      Returns the attribute text for this attribute.
      T getRef()
      Returns the attribute data.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • DialogAttribute

        protected DialogAttribute​(@NotNull
                                  T ref)
        Creates a new instance.
        Parameters:
        ref - reference to the attribute data
    • Method Detail

      • getRef

        @NotNull
        public T getRef()
        Returns the attribute data.
        Returns:
        the attribute data
      • getObjectText

        @NotNull
        public abstract @NotNull java.lang.String getObjectText​(@NotNull
                                                                G gameObject,
                                                                @NotNull
                                                                @NotNull Archetype<G,​A,​R> archetype,
                                                                @NotNull
                                                                @NotNull java.lang.String @NotNull [] newMsg,
                                                                @NotNull
                                                                @NotNull ArchetypeType archetypeType)
                                                         throws InvalidAttributeException
        Returns the attribute text for this attribute. The returned string is inserted into the owner's game object text.
        Parameters:
        gameObject - the owner
        archetype - the owner's new archetype; it might differ from gameObject's current archetype
        newMsg - the new "msg" value for the owner
        archetypeType - the owner's archetype type
        Returns:
        the game object text or an empty string
        Throws:
        InvalidAttributeException - if the attribute cannot be encoded
      • appendSummary

        public abstract void appendSummary​(@NotNull
                                           @NotNull javax.swing.text.Document doc,
                                           @NotNull
                                           @NotNull javax.swing.text.Style style)
        Appends a summary line for this attribute to a Document.
        Parameters:
        doc - the document to append to
        style - the style for the new text
      • addLine

        protected void addLine​(@NotNull
                               @NotNull javax.swing.text.Document doc,
                               @NotNull
                               @NotNull javax.swing.text.AttributeSet style,
                               @NotNull
                               @NotNull java.lang.String prefix,
                               @NotNull
                               @NotNull java.lang.String postfix)
        Appends a line to a Document. The line consists of the name of this attribute, possibly with some text prepended and/or appended.
        Parameters:
        doc - the document to add to
        style - the style for the new text
        prefix - the text to prepend; may be empty
        postfix - the text to append; may be empty