Class PropErrorItem

  • All Implemented Interfaces:
    IPropErrorItem, java.lang.Cloneable
    Direct Known Subclasses:
    PropErrorItemValue

    public class PropErrorItem
    extends java.lang.Object
    implements IPropErrorItem
    Class holding information about an error for the Property Editor in the Designer. Several errors can be set for a single property, e.g. when there are of multi-style.
    Author:
    Christopher Mindus
    • Constructor Summary

      Constructors 
      ConstructorDescription
      PropErrorItem()
      Constructs a new instance from an XML element.
      PropErrorItem​(java.lang.String id, java.lang.String message, int level)
      Constructs a new instance.
      PropErrorItem​(java.lang.String id, java.lang.String message, int level, java.lang.String... quickFixes)
      Constructs a new instance.
      PropErrorItem​(java.lang.String id, java.lang.String message, java.lang.String location, int level, java.lang.String... quickFixes)
      Constructs a new instance.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethodDescription
      PropErrorItemclone()
      Clones this instance.
      booleanequals​(java.lang.Object o)
      Checks if two items are equal.
      java.lang.StringgetID()
      Gets the ID.
      intgetIndex()
      Gets the index for a multi-property.
      java.lang.StringgetLocation()
      Gets the location of an error, for user info only.
      java.lang.StringgetLocationOrName()
      Gets the location or property name of an error, for user info only.
      java.lang.StringgetMessage()
      Gets the message.
      java.lang.String[]getQuickFixes()
      Gets the quick-fix ID's.
      intgetSeverity()
      Gets the severity.
      java.lang.StringgetText​(boolean includeID)
      Gets a textual error description as "LEVEL[{\t}id]{\t}text" (where {\t} is the tab character).
      voidload​(org.w3c.dom.Element element)
      Loads the error from XML.
      protected java.lang.StringparamString()
      The parameter string.
      voidsave​(org.w3c.dom.Element element)
      Called when the XML file for the error tree is serialized from properties.
      voidsetIndex​(int index)
      Sets the index for a multi-property.
      java.lang.StringtoString()
      Formats the error input to a string.
      • Methods inherited from class java.lang.Object

        finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • PropErrorItem

        public PropErrorItem()
        Constructs a new instance from an XML element.
      • PropErrorItem

        public PropErrorItem​(java.lang.String id,
                             java.lang.String message,
                             int level)
        Constructs a new instance.
        Parameters:
        id - The ID of the message, never null.
        message - The error message string, never null.
        level - The severity level: INFO, WARNING or ERROR.
        Throws:
        java.lang.IllegalArgumentException - If level is not INFO, WARNING or ERROR.
        java.lang.NullPointerException - If id or message is null.
      • PropErrorItem

        public PropErrorItem​(java.lang.String id,
                             java.lang.String message,
                             int level,
                             java.lang.String... quickFixes)
        Constructs a new instance.
        Parameters:
        id - The ID of the message, never null.
        message - The error message string, never null.
        level - The severity level: INFO, WARNING or ERROR.
        quickFixes - The quick-fix ID's.
        Throws:
        java.lang.IllegalArgumentException - If level is not INFO, WARNING or ERROR.
        java.lang.NullPointerException - If id or message is null.
      • PropErrorItem

        public PropErrorItem​(java.lang.String id,
                             java.lang.String message,
                             java.lang.String location,
                             int level,
                             java.lang.String... quickFixes)
        Constructs a new instance.
        Parameters:
        id - The ID of the message, never null.
        message - The error message string, never null.
        location - The location, null for none.
        level - The severity level: INFO, WARNING or ERROR.
        quickFixes - The quick-fix ID's.
        Throws:
        java.lang.IllegalArgumentException - If level is not INFO, WARNING or ERROR.
        java.lang.NullPointerException - If id or message is null.
    • Method Detail

      • load

        public void load​(org.w3c.dom.Element element)
                  throws java.lang.Exception
        Loads the error from XML.
        Specified by:
        load in interface IPropErrorItem
        Parameters:
        element - The errorItem element.
        Throws:
        java.lang.Exception - For errors in XML.
      • setIndex

        public void setIndex​(int index)
        Sets the index for a multi-property.
        Specified by:
        setIndex in interface IPropErrorItem
        Parameters:
        index - 0 for main part, otherwise one-based index for errored property value.
      • getID

        public java.lang.String getID()
        Gets the ID.
        Specified by:
        getID in interface IPropErrorItem
      • getMessage

        public java.lang.String getMessage()
        Gets the message.
        Specified by:
        getMessage in interface IPropErrorItem
        Returns:
        The error message.
      • getIndex

        public int getIndex()
        Gets the index for a multi-property.
        Specified by:
        getIndex in interface IPropErrorItem
        Returns:
        -1 for none, 0 for main part, otherwise one-based index for errored property value.
      • getLocation

        public java.lang.String getLocation()
        Gets the location of an error, for user info only.
        Specified by:
        getLocation in interface IPropErrorItem
        Returns:
        The location, or null for none.
      • getLocationOrName

        public java.lang.String getLocationOrName()
        Gets the location or property name of an error, for user info only.
        Specified by:
        getLocationOrName in interface IPropErrorItem
        Returns:
        The location, or the property name if none is defined, never null.
      • getQuickFixes

        public java.lang.String[] getQuickFixes()
        Gets the quick-fix ID's.
        Specified by:
        getQuickFixes in interface IPropErrorItem
        Returns:
        The list of quick-fix ID's or null for none.
      • getSeverity

        public int getSeverity()
        Gets the severity.
        Specified by:
        getSeverity in interface IPropErrorItem
        Returns:
        INFO, WARNING or ERROR.
      • equals

        public boolean equals​(java.lang.Object o)
        Checks if two items are equal.
        Specified by:
        equals in interface IPropErrorItem
        Overrides:
        equals in class java.lang.Object
      • toString

        public java.lang.String toString()
        Formats the error input to a string.
        Overrides:
        toString in class java.lang.Object
      • paramString

        protected java.lang.String paramString()
        The parameter string.
      • getText

        public java.lang.String getText​(boolean includeID)
        Gets a textual error description as "LEVEL[{\t}id]{\t}text" (where {\t} is the tab character).
        Specified by:
        getText in interface IPropErrorItem
        Parameters:
        includeID - Flag to include ID or not.
      • save

        public void save​(org.w3c.dom.Element element)
        Called when the XML file for the error tree is serialized from properties.
        Specified by:
        save in interface IPropErrorItem
        Parameters:
        element - The Element to initialize.
      • clone

        public PropErrorItem clone()
        Clones this instance.
        Specified by:
        clone in interface IPropErrorItem
        Overrides:
        clone in class java.lang.Object
        Returns:
        A clone.