Class ContentPart

  • All Implemented Interfaces:
    java.lang.AutoCloseable

    public class ContentPart
    extends java.lang.Object
    implements java.lang.AutoCloseable
    A part stores one content item. It is structured into several blocks that consist of semantically meaningful sub sections of content. A part can be interpreted as a hierarchy of blocks.
    See Also:
    ContentPackage
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()  
      protected void finalize()  
      @Nullable java.lang.String getId()
      Returns the identifier of this part.
      @NotNull java.lang.String getLanguage()
      Returns the language of this part.
      @NotNull ParameterSet getMetadata()
      Returns the part's metadata as a parameter set.
      @NotNull ContentPackage getPackage()
      Returns the package that contains this part.
      @Nullable java.lang.String getType()
      Returns the type of this part.
      @Nullable Rectangle getViewBox()
      Returns the view box, the smallest axis align rectangle containing this part content.
      boolean isClosed()
      Tells whether the close() method has been called.
      void setMetadata​(@NotNull ParameterSet parameters)
      Set the part's metadata with the given parameter set.
      • Methods inherited from class java.lang.Object

        clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • finalize

        protected void finalize()
                         throws java.lang.Throwable
        Overrides:
        finalize in class java.lang.Object
        Throws:
        java.lang.Throwable
      • close

        public final void close()
        Specified by:
        close in interface java.lang.AutoCloseable
      • isClosed

        public final boolean isClosed()
        Tells whether the close() method has been called. Once an object is closed any method will throw IllegalStateException.
        Returns:
        true if this object is closed.
      • getPackage

        @NotNull
        public final @NotNull ContentPackage getPackage()
        Returns the package that contains this part.
        Returns:
        the package.
        Throws:
        java.lang.IllegalStateException - when this part is closed.
      • getId

        @Nullable
        public final @Nullable java.lang.String getId()
        Returns the identifier of this part.
        Returns:
        the part identifier.
        Throws:
        java.lang.IllegalStateException - when this part is closed.
      • getType

        @Nullable
        public final @Nullable java.lang.String getType()
        Returns the type of this part.
        Returns:
        the part type.
        Throws:
        java.lang.IllegalStateException - when this part is closed.
      • getViewBox

        @Nullable
        public @Nullable Rectangle getViewBox()
        Returns the view box, the smallest axis align rectangle containing this part content.
        Returns:
        the view box (document coordinates in mm).
        Throws:
        java.lang.IllegalStateException - when this part is closed.
      • getLanguage

        @NotNull
        public final @NotNull java.lang.String getLanguage()
        Returns the language of this part.
        Returns:
        the part language locale identifier, empty if not set yet (will be set by Editor.setPart(com.myscript.iink.ContentPart)).
        Throws:
        java.lang.IllegalStateException - when this part is closed.
        java.lang.IllegalStateException - when part does not support text recognition (i.e. for types Math and Drawing).
        Since:
        2.0
      • getMetadata

        @NotNull
        public final @NotNull ParameterSet getMetadata()
        Returns the part's metadata as a parameter set.
        Returns:
        the parameter set.
        Throws:
        java.lang.IllegalStateException - when this part is closed.
      • setMetadata

        public final void setMetadata​(@NotNull
                                      @NotNull ParameterSet parameters)
        Set the part's metadata with the given parameter set.
        Parameters:
        parameters - the parameters to set.
        Throws:
        java.lang.IllegalStateException - when this part is closed.
        java.lang.IllegalStateException - when parameters is closed.