Class DefaultTextModel

  • All Implemented Interfaces:
    com.globalmentor.beans.PropertyBindable, com.globalmentor.beans.PropertyConstrainable, Model, TextModel

    public class DefaultTextModel
    extends AbstractModel
    implements TextModel
    The default implementation of a model for text and an associated label.
    Author:
    Garret Wilson
    • Field Summary

      • Fields inherited from class com.globalmentor.beans.BoundPropertyObject

        NO_PROPERTY_CHANGE_LISTENERS, NO_VETOABLE_CHANGE_LISTENERS
    • Constructor Summary

      Constructors 
      Constructor Description
      DefaultTextModel()
      Default constructor.
      DefaultTextModel​(java.lang.String text)
      Text constructor with a default Text.PLAIN_CONTENT_TYPE content type.
      DefaultTextModel​(java.lang.String text, com.globalmentor.net.ContentType textContentType)
      Text and content type constructor
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String getText()  
      com.globalmentor.net.ContentType getTextContentType()  
      void setText​(java.lang.String newText)
      Sets the text.
      void setTextContentType​(com.globalmentor.net.ContentType newTextContentType)
      Sets the content type of the text.
      • Methods inherited from class com.globalmentor.beans.BoundPropertyObject

        addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, addVetoableChangeListener, createPostponedPropertyChangeEvent, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, fireVetoableChange, fireVetoableChange, fireVetoableChange, getForwardPropertyChangeListener, getPropertyChangeListeners, getPropertyChangeListeners, getPropertyChangeSupport, getRepeatPropertyChangeListener, getRepeatVetoableChangeListener, getVetoableChangeListeners, getVetoableChangeListeners, getVetoableChangeSupport, hasPropertyChangeListeners, hasVetoableChangeListeners, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, removeVetoableChangeListener
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface com.globalmentor.beans.PropertyBindable

        addPropertyChangeListener, addPropertyChangeListener, getPropertyChangeListeners, getPropertyChangeListeners, hasPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListener
      • Methods inherited from interface com.globalmentor.beans.PropertyConstrainable

        addVetoableChangeListener, addVetoableChangeListener, getVetoableChangeListeners, getVetoableChangeListeners, hasVetoableChangeListeners, removeVetoableChangeListener, removeVetoableChangeListener
    • Constructor Detail

      • DefaultTextModel

        public DefaultTextModel()
        Default constructor.
      • DefaultTextModel

        public DefaultTextModel​(java.lang.String text)
        Text constructor with a default Text.PLAIN_CONTENT_TYPE content type.
        Parameters:
        text - The text, which may include a resource reference, or null if there is no text.
      • DefaultTextModel

        public DefaultTextModel​(java.lang.String text,
                                com.globalmentor.net.ContentType textContentType)
        Text and content type constructor
        Parameters:
        text - The text, which may include a resource reference, or null if there is no text.
        textContentType - The content type of the text.
        Throws:
        java.lang.NullPointerException - if the given content type is null.
        java.lang.IllegalArgumentException - if the given content type is not a text content type.
    • Method Detail

      • getText

        public java.lang.String getText()
        Specified by:
        getText in interface TextModel
        Returns:
        The text, which may include a resource reference, or null if there is no text.
      • setText

        public void setText​(java.lang.String newText)
        Description copied from interface: TextModel
        Sets the text. This is a bound property.
        Specified by:
        setText in interface TextModel
        Parameters:
        newText - The new text, which may include a resource reference.
        See Also:
        TextModel.TEXT_PROPERTY
      • getTextContentType

        public com.globalmentor.net.ContentType getTextContentType()
        Specified by:
        getTextContentType in interface TextModel
        Returns:
        The content type of the text.
      • setTextContentType

        public void setTextContentType​(com.globalmentor.net.ContentType newTextContentType)
        Description copied from interface: TextModel
        Sets the content type of the text. This is a bound property.
        Specified by:
        setTextContentType in interface TextModel
        Parameters:
        newTextContentType - The new text content type.
        See Also:
        TextModel.TEXT_CONTENT_TYPE_PROPERTY