Package com.iizix.prop
Class PropErrorItem
java.lang.Object
com.iizix.prop.PropErrorItem
- All Implemented Interfaces:
IPropErrorItem
,Cloneable
- Direct Known Subclasses:
PropErrorItemValue
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
Field Summary
Fields inherited from interface com.iizix.prop.IPropErrorItem
CHILD_PROP_ERROR_PREFIX, ERROR, INFO, VERIFY_ERROR_CHILD_PREFIX, WARNING
Constructor Summary
ConstructorDescriptionConstructs a new instance from an XML element.PropErrorItem
(String id, String message, int level) Constructs a new instance.PropErrorItem
(String id, String message, int level, String... quickFixes) Constructs a new instance.PropErrorItem
(String id, String message, String location, int level, String... quickFixes) Constructs a new instance.Method Summary
Modifier and TypeMethodDescriptionclone()
Clones this instance.boolean
Checks if two items are equal.getID()
Gets the ID.int
getIndex()
Gets the index for a multi-property.Gets the location of an error, for user info only.Gets the location or property name of an error, for user info only.Gets the message.String[]
Gets the quick-fix ID's.int
Gets the severity.getText
(boolean includeID) Gets a textual error description as "LEVEL[{\t}id]{\t}text" (where {\t} is the tab character).void
Loads the error from XML.protected String
The parameter string.void
Called when the XML file for the error tree is serialized from properties.void
setIndex
(int index) Sets the index for a multi-property.toString()
Formats the error input to a string.Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.iizix.prop.IPropErrorItem
getChildPropName, isChildPropError
Constructor Details
PropErrorItem
public PropErrorItem()Constructs a new instance from an XML element.PropErrorItem
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:
IllegalArgumentException
- If level is not INFO, WARNING or ERROR.NullPointerException
- If id or message is null.
PropErrorItem
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:
IllegalArgumentException
- If level is not INFO, WARNING or ERROR.NullPointerException
- If id or message is null.
PropErrorItem
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:
IllegalArgumentException
- If level is not INFO, WARNING or ERROR.NullPointerException
- If id or message is null.
Method Details
load
Loads the error from XML.- Specified by:
load
in interfaceIPropErrorItem
- Parameters:
element
- TheerrorItem
element.- Throws:
Exception
- For errors in XML.
setIndex
public void setIndex(int index) Sets the index for a multi-property.- Specified by:
setIndex
in interfaceIPropErrorItem
- Parameters:
index
- 0 for main part, otherwise one-based index for errored property value.
getID
Gets the ID.- Specified by:
getID
in interfaceIPropErrorItem
getMessage
Gets the message.- Specified by:
getMessage
in interfaceIPropErrorItem
- Returns:
- The error message.
getIndex
public int getIndex()Gets the index for a multi-property.- Specified by:
getIndex
in interfaceIPropErrorItem
- Returns:
- -1 for none, 0 for main part, otherwise one-based index for errored property value.
getLocation
Gets the location of an error, for user info only.- Specified by:
getLocation
in interfaceIPropErrorItem
- Returns:
- The location, or null for none.
getLocationOrName
Gets the location or property name of an error, for user info only.- Specified by:
getLocationOrName
in interfaceIPropErrorItem
- Returns:
- The location, or the property name if none is defined, never null.
getQuickFixes
Gets the quick-fix ID's.- Specified by:
getQuickFixes
in interfaceIPropErrorItem
- Returns:
- The list of quick-fix ID's or
null
for none.
getSeverity
public int getSeverity()Gets the severity.- Specified by:
getSeverity
in interfaceIPropErrorItem
- Returns:
- INFO, WARNING or ERROR.
equals
Checks if two items are equal.- Specified by:
equals
in interfaceIPropErrorItem
- Overrides:
equals
in classObject
toString
Formats the error input to a string.paramString
The parameter string.getText
Gets a textual error description as "LEVEL[{\t}id]{\t}text" (where {\t} is the tab character).- Specified by:
getText
in interfaceIPropErrorItem
- Parameters:
includeID
- Flag to include ID or not.
save
Called when the XML file for the error tree is serialized from properties.- Specified by:
save
in interfaceIPropErrorItem
- Parameters:
element
- TheElement
to initialize.
clone
Clones this instance.- Specified by:
clone
in interfaceIPropErrorItem
- Overrides:
clone
in classObject
- Returns:
- A clone.