Class RMXStringRun

java.lang.Object
com.inductiveautomation.rm.text.RMXStringRun
All Implemented Interfaces:
RMTypes, RMTextTypes, CharSequence, Cloneable

public class RMXStringRun extends Object implements RMTextTypes, Cloneable, CharSequence
The Run class represents a range of characters in an xstring that share common attributes.

This class makes a point to treat its attributes map as read-only so they can be shared among multiple runs.

  • Constructor Details

    • RMXStringRun

      public RMXStringRun(RMXString anXString)
      Creates a new run.
  • Method Details

    • start

      public int start()
      Returns the start character index for this run.
    • end

      public int end()
      Returns the end character index for this run.
    • length

      public int length()
      Returns the length in characters for this run.
      Specified by:
      length in interface CharSequence
    • charAt

      public char charAt(int anIndex)
      CharSequence method returning character at given index.
      Specified by:
      charAt in interface CharSequence
    • subSequence

      public CharSequence subSequence(int aStart, int anEnd)
      CharSequence method return character sequence for range.
      Specified by:
      subSequence in interface CharSequence
    • getStyle

      public RMTextStyle getStyle()
      Returns the text style.
    • setStyle

      protected void setStyle(RMTextStyle aStyle)
      Sets the text style.
    • getAttribute

      public Object getAttribute(String aKey)
      Returns a specific attribute for the given key.
    • getFont

      public RMFont getFont()
      Returns the font for this run.
    • getColor

      public RMColor getColor()
      Returns the color for this run.
    • getParagraph

      public RMParagraph getParagraph()
      Returns the paragraph for this run.
    • isUnderlined

      public boolean isUnderlined()
      Returns whether this run is underlined.
    • getUnderlineStyle

      public int getUnderlineStyle()
      Returns the underline style of this run.
    • getOutline

      public RMXString.Outline getOutline()
      Returns the outline info for this run (null for none).
    • getOutline

      public static RMXString.Outline getOutline(Map attrs)
      Returns the Outline record for the given attributes map (or null for none).
    • getFormat

      public RMFormat getFormat()
      Returns the format for this run.
    • getNumberFormat

      @Nonnull public RMNumberFormat getNumberFormat()
    • getDateFormat

      @Nonnull public RMDateFormat getDateFormat()
    • getScripting

      public int getScripting()
      Returns the scripting for this run (1=SuperScripting, -1=Subscripting, 0=none).
    • getCharSpacing

      public float getCharSpacing()
      Returns the char spacing.
    • getNext

      public RMXStringRun getNext()
      Return next run.
    • getRunCount

      public int getRunCount()
      Returns the run count.
    • getRun

      public RMXStringRun getRun(int anIndex)
      Returns the run at given index.
    • getRunLast

      public RMXStringRun getRunLast()
      Returns the last run.
    • getRunAt

      public RMXStringRun getRunAt(int anIndex, boolean isInclusive)
      Returns the XString run that contains or ends (if given option is true) at given index.
    • addLength

      public void addLength(int aLength, int anIndex)
      Adds length to run for char index.
    • removeLength

      public void removeLength(int aLength, int anIndex)
      Removes a length from run(s) for char index.
    • shift

      public void shift(int anAmount)
      Shifts run by given amound.
    • split

      public RMXStringRun split(int anIndex)
      Splits the run at the given index and returns a run containing the remaining characters (and identical attributes).
    • equals

      public boolean equals(Object anObj)
      Returns whether this run is equal to the given object.
      Overrides:
      equals in class Object
    • clone

      @Nullable public RMXStringRun clone()
      Returns a basic clone of this object.
      Overrides:
      clone in class Object
    • cloneDeep

      public RMXStringRun cloneDeep(RMXString anXString)
      Returns a clone of this run, including a clone of the next run(s) if present.
    • toString

      public String toString()
      Returns a string representation of this run.
      Specified by:
      toString in interface CharSequence
      Overrides:
      toString in class Object