Package com.iizix.prop
Class PropErrorItem
- java.lang.Object
- com.iizix.prop.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
Field Summary
Fields inherited from interface com.iizix.prop.IPropErrorItem
CHILD_PROP_ERROR_PREFIX, ERROR, INFO, VERIFY_ERROR_CHILD_PREFIX, WARNING
Constructor Summary
Constructors Constructor Description 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 Type Method Description 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
Methods inherited from interface com.iizix.prop.IPropErrorItem
getChildPropName, isChildPropError
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.ExceptionLoads the error from XML.- Specified by:
loadin interfaceIPropErrorItem- Parameters:
element- TheerrorItemelement.- Throws:
java.lang.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
public java.lang.String getID()
Gets the ID.- Specified by:
getIDin interfaceIPropErrorItem
getMessage
public java.lang.String 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
public java.lang.String getLocation()
Gets the location of an error, for user info only.- Specified by:
getLocationin interfaceIPropErrorItem- 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:
getLocationOrNamein interfaceIPropErrorItem- 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:
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
public boolean equals(java.lang.Object o)
Checks if two items are equal.- Specified by:
equalsin interfaceIPropErrorItem- Overrides:
equalsin classjava.lang.Object
toString
public java.lang.String toString()
Formats the error input to a string.- Overrides:
toStringin classjava.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:
getTextin interfaceIPropErrorItem- 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:
savein interfaceIPropErrorItem- Parameters:
element- TheElementto initialize.
clone
public PropErrorItem clone()
Clones this instance.- Specified by:
clonein interfaceIPropErrorItem- Overrides:
clonein classjava.lang.Object- Returns:
- A clone.