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, WARNINGConstructor Summary
ConstructorsConstructorDescriptionConstructs 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.booleanChecks if two items are equal.getID()Gets the ID.intgetIndex()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.intGets the severity.getText(boolean includeID) Gets a textual error description as "LEVEL[{\t}id]{\t}text" (where {\t} is the tab character).voidLoads the error from XML.protected StringThe parameter string.voidCalled when the XML file for the error tree is serialized from properties.voidsetIndex(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, waitMethods 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:
loadin interfaceIPropErrorItem- Parameters:
element- TheerrorItemelement.- Throws:
Exception- For errors in XML.
setIndex
public void setIndex(int index) Sets the index for a multi-property.- Specified by:
setIndexin interfaceIPropErrorItem- Parameters:
index- 0 for main part, otherwise one-based index for errored property value.
getID
Gets the ID.- Specified by:
getIDin interfaceIPropErrorItem
getMessage
Gets the message.- Specified by:
getMessagein interfaceIPropErrorItem- Returns:
- The error message.
getIndex
public int getIndex()Gets the index for a multi-property.- Specified by:
getIndexin 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:
getLocationin interfaceIPropErrorItem- Returns:
- The location, or null for none.
getLocationOrName
Gets the location or property name of an error, for user info only.- Specified by:
getLocationOrNamein interfaceIPropErrorItem- Returns:
- The location, or the property name if none is defined, never null.
getQuickFixes
Gets the quick-fix ID's.- Specified by:
getQuickFixesin interfaceIPropErrorItem- Returns:
- The list of quick-fix ID's or
nullfor none.
getSeverity
public int getSeverity()Gets the severity.- Specified by:
getSeverityin interfaceIPropErrorItem- Returns:
- INFO, WARNING or ERROR.
equals
Checks if two items are equal.- Specified by:
equalsin interfaceIPropErrorItem- Overrides:
equalsin 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:
getTextin 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:
savein interfaceIPropErrorItem- Parameters:
element- TheElementto initialize.
clone
Clones this instance.- Specified by:
clonein interfaceIPropErrorItem- Overrides:
clonein classObject- Returns:
- A clone.