Class ContentProposal

  • All Implemented Interfaces:
    IContentProposal

    public class ContentProposal
    extends java.lang.Object
    implements IContentProposal
    A default implementation of IContentProposal that allows clients to specify a content proposal using simple constructors.
    Since:
    3.6
    • Constructor Summary

      Constructors 
      Constructor Description
      ContentProposal​(java.lang.String content)
      Create a content proposal whose label and content are the specified String.
      ContentProposal​(java.lang.String content, java.lang.String description)
      Create a content proposal whose content and description are as specified in the parameters.
      ContentProposal​(java.lang.String content, java.lang.String label, java.lang.String description)
      Create a content proposal whose content, label, and description are as specified in the parameters.
      ContentProposal​(java.lang.String content, java.lang.String label, java.lang.String description, int cursorPosition)
      Create a content proposal whose content, label, description, and cursor position are as specified in the parameters.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String getContent()
      Return the content represented by this proposal.
      int getCursorPosition()
      Return the integer position within the contents that the cursor should be placed after the proposal is accepted.
      java.lang.String getDescription()
      Return a description that describes this proposal.
      java.lang.String getLabel()
      Return the label used to describe this proposal.
      • Methods inherited from class java.lang.Object

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

      • ContentProposal

        public ContentProposal​(java.lang.String content)
        Create a content proposal whose label and content are the specified String. The cursor position will be located at the end of the content.
        Parameters:
        content - the String representing the content. Should not be null.
      • ContentProposal

        public ContentProposal​(java.lang.String content,
                               java.lang.String description)
        Create a content proposal whose content and description are as specified in the parameters. The cursor position will be located at the end of the content.
        Parameters:
        content - the String representing the content. Should not be null. This string will also be used as the label.
        description - the String representing the description, or null if there should be no description.
      • ContentProposal

        public ContentProposal​(java.lang.String content,
                               java.lang.String label,
                               java.lang.String description)
        Create a content proposal whose content, label, and description are as specified in the parameters. The cursor position will be located at the end of the content.
        Parameters:
        content - the String representing the content. Should not be null.
        label - the String representing the label. Should not be null.
        description - the String representing the description, or null if there should be no description.
      • ContentProposal

        public ContentProposal​(java.lang.String content,
                               java.lang.String label,
                               java.lang.String description,
                               int cursorPosition)
        Create a content proposal whose content, label, description, and cursor position are as specified in the parameters.
        Parameters:
        content - the String representing the content. Should not be null.
        label - the String representing the label. Should not be null.
        description - the String representing the description, or null if there should be no description.
        cursorPosition - the zero-based index position within the contents where the cursor should be placed after the proposal is accepted. The range of the cursor position is from 0..N where N is the number of characters in the content.
        Throws:
        java.lang.IllegalArgumentException - if the index is not between 0 and the number of characters in the content.
    • Method Detail

      • getContent

        public java.lang.String getContent()
        Description copied from interface: IContentProposal
        Return the content represented by this proposal.
        Specified by:
        getContent in interface IContentProposal
        Returns:
        the String content represented by this proposal.
      • getCursorPosition

        public int getCursorPosition()
        Description copied from interface: IContentProposal
        Return the integer position within the contents that the cursor should be placed after the proposal is accepted.
        Specified by:
        getCursorPosition in interface IContentProposal
        Returns:
        the zero-based index position within the contents where the cursor should be placed after the proposal is accepted. The range of the cursor position is from 0..N where N is the number of characters in the contents.
      • getDescription

        public java.lang.String getDescription()
        Description copied from interface: IContentProposal
        Return a description that describes this proposal.
        Specified by:
        getDescription in interface IContentProposal
        Returns:
        the String label used to further the proposal. If null, then no description will be displayed.
      • getLabel

        public java.lang.String getLabel()
        Description copied from interface: IContentProposal
        Return the label used to describe this proposal.
        Specified by:
        getLabel in interface IContentProposal
        Returns:
        the String label used to display the proposal. If null, then the content will be displayed as the label.