Package gamedata
Class ClassMap.Entry
- java.lang.Object
-
- gamedata.ClassMap.Entry
-
- All Implemented Interfaces:
IconProvider
,java.lang.Comparable<ClassMap.Entry>
- Enclosing class:
- ClassMap
public static final class ClassMap.Entry extends java.lang.Object implements java.lang.Comparable<ClassMap.Entry>, IconProvider
An entry in a class map file.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(ClassMap.Entry rhs)
Compares this entry to another entry.StrangeEonsEditor
createEditor()
Creates an editor for this entry, adding it to the application window.StrangeEonsEditor
createEditor(boolean debug)
Creates an editor for this entry, adding it to the application window.boolean
equals(java.lang.Object rhs)
Returnstrue
if the specified object is an entry with the same mapping.javax.swing.Icon
getBanner()
Returns the custom category banner to display for this item, ornull
if the category should use the default banner.ClassMap.Entry
getCategory()
Returns the category that this entry belongs to.Game
getGame()
Returns the game that this entry is associated with.javax.swing.Icon
getIcon()
Returns this entry's icon.java.lang.String
getKey()
Returns the original entry name.java.lang.String
getMapping()
Returns the class name or script resource description that this entry maps to.java.lang.String
getName()
Returns the localized entry name.ClassMap.EntryType
getType()
Returns the type of entry that this represents.int
hashCode()
java.lang.String
toString()
-
-
-
Method Detail
-
getName
public java.lang.String getName()
Returns the localized entry name. This is the key from the original entry, or the localized string obtained from the key if the key starts with '@'.- Returns:
- the localized entry name
- See Also:
getKey()
-
getKey
public java.lang.String getKey()
Returns the original entry name. This is the unlocalized key that defined the entry.- Returns:
- the original entry key
- See Also:
getName()
-
getIcon
public javax.swing.Icon getIcon()
Returns this entry's icon. This method never returnsnull
.- Specified by:
getIcon
in interfaceIconProvider
- Returns:
- the icon for the entry
-
getBanner
public javax.swing.Icon getBanner()
Returns the custom category banner to display for this item, ornull
if the category should use the default banner.- Returns:
- the custom category banner, or
null
-
getMapping
public java.lang.String getMapping()
Returns the class name or script resource description that this entry maps to. If the entry represents a category, the mapping will benull
.- Returns:
- the class mapped to by this entry, or
null
-
getCategory
public ClassMap.Entry getCategory()
Returns the category that this entry belongs to.- Returns:
- this entry's category, or
null
if this entry is a category
-
getType
public ClassMap.EntryType getType()
Returns the type of entry that this represents.- Returns:
- the type of the entry
-
getGame
public Game getGame()
Returns the game that this entry is associated with. Class map files designed for older versions of the application do not define the game for an entry. Entries created from such class maps will returnnull
.- Returns:
- the game associated with this entry, or
null
-
compareTo
public int compareTo(ClassMap.Entry rhs)
Compares this entry to another entry. Returns an integer less than, equal to or greater than zero depending on whether this entry should fall before, in the same position as, or after the other entry in a sorted list.- Specified by:
compareTo
in interfacejava.lang.Comparable<ClassMap.Entry>
- Parameters:
rhs
- the target entry to compare this with- Returns:
- returns a negative, zero, or positive value as this entry is less than, equal to, or greater than the target entry
-
equals
public boolean equals(java.lang.Object rhs)
Returnstrue
if the specified object is an entry with the same mapping.- Overrides:
equals
in classjava.lang.Object
- Parameters:
rhs
- the object to compare this with- Returns:
true
if the target object has the same class map value
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
createEditor
public StrangeEonsEditor createEditor()
Creates an editor for this entry, adding it to the application window.- Returns:
- the new editor, or
null
if creation failed
-
createEditor
public StrangeEonsEditor createEditor(boolean debug)
Creates an editor for this entry, adding it to the application window.This version of the method allows you to create scripted components in debug mode. In debug mode, a script breakpoint will be triggered at the start of the component creation. Note that this will effectively freeze the application until execution is resumed from an attached script debugging client. Creating a component in debug mode has no effect is script debugging is not enabled, or if the component is created from compiled code rather than a script.
- Parameters:
debug
- iftrue
, component types that use scripts will be created in debug mode- Returns:
- the new editor, or
null
if creation failed - Throws:
java.lang.UnsupportedOperationException
- if called on a category entry
-
-