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 PropErrorItem
clone()
Clones this instance.boolean
equals(java.lang.Object o)
Checks if two items are equal.java.lang.String
getID()
Gets the ID.int
getIndex()
Gets the index for a multi-property.java.lang.String
getLocation()
Gets the location of an error, for user info only.java.lang.String
getLocationOrName()
Gets the location or property name of an error, for user info only.java.lang.String
getMessage()
Gets the message.java.lang.String[]
getQuickFixes()
Gets the quick-fix ID's.int
getSeverity()
Gets the severity.java.lang.String
getText(boolean includeID)
Gets a textual error description as "LEVEL[{\t}id]{\t}text" (where {\t} is the tab character).void
load(org.w3c.dom.Element element)
Loads the error from XML.protected java.lang.String
paramString()
The parameter string.void
save(org.w3c.dom.Element element)
Called when the XML file for the error tree is serialized from properties.void
setIndex(int index)
Sets the index for a multi-property.java.lang.String
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 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 interfaceIPropErrorItem
- Parameters:
element
- TheerrorItem
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 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:
getID
in interfaceIPropErrorItem
getMessage
public java.lang.String 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
public java.lang.String getLocation()
Gets the location of an error, for user info only.- Specified by:
getLocation
in 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:
getLocationOrName
in 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:
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
public boolean equals(java.lang.Object o)
Checks if two items are equal.- Specified by:
equals
in interfaceIPropErrorItem
- Overrides:
equals
in classjava.lang.Object
toString
public java.lang.String toString()
Formats the error input to a string.- Overrides:
toString
in 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:
getText
in 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:
save
in interfaceIPropErrorItem
- Parameters:
element
- TheElement
to initialize.
clone
public PropErrorItem clone()
Clones this instance.- Specified by:
clone
in interfaceIPropErrorItem
- Overrides:
clone
in classjava.lang.Object
- Returns:
- A clone.