Class AnnotatedTextFieldElement

  • All Implemented Interfaces:
    FieldElement

    public final class AnnotatedTextFieldElement
    extends AbstractTextFieldElement
    A subclass of FieldElement that allows for mouse handling callbacks via the #handleMouseClicked(ProgramLocation, ServiceProvider) method. This class is based upon Annotation objects, which are elements that perform actions when the use clicks an instance of this class in the display.
    • Constructor Detail

      • AnnotatedTextFieldElement

        public AnnotatedTextFieldElement​(Annotation annotation,
                                         int row,
                                         int column)
        Constructor that initializes this text field element with the given annotation and row and column information. The text of this element is the text returned from Annotation.getDisplayString().
        Parameters:
        annotation - The Annotation that this element is describing.
        row - The row that this element is on
        column - The column value of this element (the column index where this element starts)
    • Method Detail

      • getRawText

        public java.lang.String getRawText()
        Returns the original annotation text in the data model, which will differ from the display text.
        Returns:
        the original annotation text in the data model.
      • handleMouseClicked

        public boolean handleMouseClicked​(Navigatable sourceNavigatable,
                                          ServiceProvider serviceProvider)
        This method is designed to be called when a mouse click has occurred for a given ProgramLocation.
        Parameters:
        sourceNavigatable - The source Navigatable
        serviceProvider - A service provider from which system resources can be retrieved
        Returns:
        true if this string handles the mouse click.
      • substring

        public FieldElement substring​(int start,
                                      int end)
        Description copied from interface: FieldElement
        Returns a new FieldElement containing just the characters beginning at the given start index (inclusive) and ending at the given end index (exclusive).
        Parameters:
        start - The starting index (inclusive) from which to substring this element.
        end - The end index (exclusive) to which the substring will be performed.
        Returns:
        a new FieldElement containing just the characters beginning at the given index.
      • replaceAll

        public FieldElement replaceAll​(char[] targets,
                                       char replacement)
        Description copied from interface: FieldElement
        Returns a new FieldElement with all occurrences of the target characters replaced with the given replacement character.
        Parameters:
        targets - The array of characters to replace.
        replacement - The replacement character.
        Returns:
        a new FieldElement with all occurrences of the target characters replaced with the given replacement character.