net.sf.genuine.resources
Class ResourceItem

java.lang.Object
  extended bynet.sf.genuine.resources.ResourceItem

public class ResourceItem
extends java.lang.Object

A resource item encapsulates all available information about a resource, i.e. its name, description, icon, tool tip, etc.

Author:
Tim Wellhausen

Constructor Summary
(package private) ResourceItem(java.lang.String name)
          Creates a new instance with all attributes set to default values
 
Method Summary
(package private)  void addProperty(java.lang.String propertyName, java.lang.String value)
          Sets a property for this resource item.
 java.util.List getChoices()
          Returns a list of String objects that define other resource items to be used, for example, as buttons in a message box.
 javax.swing.ImageIcon getImage()
          Returns an image if one is defined for this resource item, null otherwise.
 javax.swing.KeyStroke getKeyStroke()
          Returns the KeyStroke instance to be used as accelerator for this resource item if one is defined, null otherwise.
 javax.swing.ImageIcon getLargeImage()
          Returns a large image if one is defined for this resource item, null otherwise.
 int getMnemonic()
          Returns a character that is used as mnemonic.
 java.lang.String getName()
          Returns the name of the resource item with which it can be fetched.
 java.lang.String getText()
          Returns the text of this resource item if one is defined, an empty string otherwise.
 java.lang.String getTitle()
          Returns the title of this resource item that is used as title for the application window or for message boxes.
 java.lang.String getTooltip()
          Returns the tool tip for this resource item if one is defined, an empty string otherwise.
 java.lang.String getType()
          Returns the type of this resource item.
 java.lang.String toString()
          Prints its text.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ResourceItem

ResourceItem(java.lang.String name)
Creates a new instance with all attributes set to default values

Parameters:
name - The name of the resource item as defined in a property bundle
Method Detail

addProperty

void addProperty(java.lang.String propertyName,
                 java.lang.String value)
Sets a property for this resource item. Each property is defined by a property name and a value.

See ResourceManager for a list of valid properties.

If the text contains an ampersand character, the charactor following the ampersand is used as mnemonic.


getName

public java.lang.String getName()
Returns the name of the resource item with which it can be fetched. This is the resource's id.


getImage

public javax.swing.ImageIcon getImage()
Returns an image if one is defined for this resource item, null otherwise.


getLargeImage

public javax.swing.ImageIcon getLargeImage()
Returns a large image if one is defined for this resource item, null otherwise.


getKeyStroke

public javax.swing.KeyStroke getKeyStroke()
Returns the KeyStroke instance to be used as accelerator for this resource item if one is defined, null otherwise.


getText

public java.lang.String getText()
Returns the text of this resource item if one is defined, an empty string otherwise.


getMnemonic

public int getMnemonic()
Returns a character that is used as mnemonic. A mnemonic is set by adding an ampersand symbol (&) to the resource's text. The character following that symbol is the mnemonic. If no mnemonic is set, 0 is returned.


getTooltip

public java.lang.String getTooltip()
Returns the tool tip for this resource item if one is defined, an empty string otherwise.


getTitle

public java.lang.String getTitle()
Returns the title of this resource item that is used as title for the application window or for message boxes.


getType

public java.lang.String getType()
Returns the type of this resource item. If the resource item is used for a message in a message box, a type should be given to distinguish between information, warning, and error messages. Therefore, either "status", "info", "warning", and "error" are accepted values.

See Also:
MessageResourceItem

getChoices

public java.util.List getChoices()
Returns a list of String objects that define other resource items to be used, for example, as buttons in a message box.

See Also:
MessageResourceItem

toString

public java.lang.String toString()
Prints its text.