org.argouml.application.notation
Class NotationNameImpl

java.lang.Object
  extended byorg.argouml.application.notation.NotationNameImpl
All Implemented Interfaces:
ArgoEventListener, ArgoModuleEventListener, EventListener, NotationName

public class NotationNameImpl
extends Object
implements NotationName, ArgoModuleEventListener

This class provides definition and manipulation of notation names. All notation names will be accessed using the NotationName wrapper. Not mutable!

Since:
0.9.4

Field Summary
private  Icon icon
           
private static Logger LOG
          Logger.
private  String name
           
private static ArrayList notations
           
private  String version
           
 
Constructor Summary
protected NotationNameImpl(String theName)
          A notation without a version or icon.
protected NotationNameImpl(String theName, Icon theIcon)
          A notation without a version and with an icon.
protected NotationNameImpl(String theName, String theVersion)
          A notation with a version and no icon.
protected NotationNameImpl(String myName, String myVersion, Icon myIcon)
          A notation with a version and an icon.
 
Method Summary
static NotationName findNotation(String s)
          Finds a NotationName matching the configuration string.
private static void fireEvent(int eventType, NotationName nn)
           
static ArrayList getAvailableNotations()
          Get all of the registered notations.
 String getConfigurationValue()
          Returns the text string stored in the configuration for this notation.
 Icon getIcon()
          Returns an icon for the notation, or null if no icon is available.
 String getName()
          Accessor for the language name.
static NotationName getNotation(String k1)
          Finds a NotationName matching the language with no version.
static NotationName getNotation(String k1, String k2)
          Finds a NotationName matching the language and version.
static String getNotationNameString(String k1, String k2)
           
 String getTitle()
          Gets a textual title for the notation suitable for use in a combo box or other such visual location.
 String getVersion()
          Accessor for the language version.
static NotationName makeNotation(String k1, String k2, Icon icon)
          Create a NotationName with or without a version.
 void moduleDisabled(ArgoModuleEvent event)
          Invoked when a module has been disabled.
 void moduleEnabled(ArgoModuleEvent event)
          Invoked when a module has been enabled.
 void moduleLoaded(ArgoModuleEvent event)
          Invoked when a module has been loaded.
 void moduleUnloaded(ArgoModuleEvent event)
          Invoked when a module has been unloaded.
 boolean sameNotationAs(NotationName nn)
          Ease-of-use helper to determine if this notation is the same as another.
 String toString()
          Ease-of-use helper for usage in swing.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

LOG

private static final Logger LOG
Logger.


name

private String name

version

private String version

icon

private Icon icon

notations

private static ArrayList notations
Constructor Detail

NotationNameImpl

protected NotationNameImpl(String theName)
A notation without a version or icon.

Parameters:
theName - the name of the notation

NotationNameImpl

protected NotationNameImpl(String theName,
                           Icon theIcon)
A notation without a version and with an icon.

Parameters:
theName - the name of the notation
theIcon - the icon for of the notation

NotationNameImpl

protected NotationNameImpl(String theName,
                           String theVersion)
A notation with a version and no icon.

Parameters:
theName - the name of the notation
theVersion - the version of the notation

NotationNameImpl

protected NotationNameImpl(String myName,
                           String myVersion,
                           Icon myIcon)
A notation with a version and an icon.

Parameters:
myName - the name of the notation
myVersion - the version of the notation
myIcon - the icon of the notation
Method Detail

getName

public String getName()
Accessor for the language name.

Specified by:
getName in interface NotationName
Returns:
the language name.
See Also:
NotationName.getName()

getVersion

public String getVersion()
Accessor for the language version.

Specified by:
getVersion in interface NotationName
Returns:
The language version or null.
See Also:
NotationName.getVersion()

getTitle

public String getTitle()
Gets a textual title for the notation suitable for use in a combo box or other such visual location.

Specified by:
getTitle in interface NotationName
Returns:
a title for the language.
See Also:
NotationName.getTitle()

getIcon

public Icon getIcon()
Returns an icon for the notation, or null if no icon is available.

Specified by:
getIcon in interface NotationName
Returns:
An Icon for the language or null.
See Also:
NotationName.getIcon()

getConfigurationValue

public String getConfigurationValue()
Description copied from interface: NotationName
Returns the text string stored in the configuration for this notation. This string is used to determine notation equality in NotationName.sameNotationAs(NotationName).

This should incorporate both the name and the version if one exists.

Specified by:
getConfigurationValue in interface NotationName
Returns:
the value for this notation to be stored in the configuration.
See Also:
NotationName.getConfigurationValue()

toString

public String toString()
Description copied from interface: NotationName
Ease-of-use helper for usage in swing. Usually, it is equal to getConfigurationValue().

Specified by:
toString in interface NotationName
See Also:
Object.toString()

getNotationNameString

public static String getNotationNameString(String k1,
                                           String k2)
Parameters:
k1 - first part of the given name
k2 - 2nd part of the given name
Returns:
the notation name string

fireEvent

private static void fireEvent(int eventType,
                              NotationName nn)

makeNotation

public static NotationName makeNotation(String k1,
                                        String k2,
                                        Icon icon)
Create a NotationName with or without a version. The NotationName is only created if there is no such notation before.

Parameters:
k1 - the 1st part of the notation name
k2 - the 2nd part of the notation name
icon - the icon for the notation
Returns:
the newly created or the old NotationName

getAvailableNotations

public static ArrayList getAvailableNotations()
Get all of the registered notations.

Returns:
an ArrayList with all notations

findNotation

public static NotationName findNotation(String s)
Finds a NotationName matching the configuration string. Returns null if no match.

Parameters:
s - the configuration string
Returns:
the name of the notation or null

sameNotationAs

public boolean sameNotationAs(NotationName nn)
Description copied from interface: NotationName
Ease-of-use helper to determine if this notation is the same as another. This must be equivalent to getConfigurationValue().equals(nn.getConfigurationValue())

Specified by:
sameNotationAs in interface NotationName
Parameters:
nn - to compare
Returns:
boolean indicating equality or inequality.
See Also:
NotationName.sameNotationAs(org.argouml.application.api.NotationName)

getNotation

public static NotationName getNotation(String k1)
Finds a NotationName matching the language with no version. Returns null if no match.

Parameters:
k1 - the notation name string
Returns:
the notation name

getNotation

public static NotationName getNotation(String k1,
                                       String k2)
Finds a NotationName matching the language and version. Returns null if no match.

Parameters:
k1 - the 1st part of the notation name
k2 - the 2nd part of the notation name
Returns:
the notation name

moduleLoaded

public void moduleLoaded(ArgoModuleEvent event)
Description copied from interface: ArgoModuleEventListener
Invoked when a module has been loaded.

Specified by:
moduleLoaded in interface ArgoModuleEventListener
Parameters:
event - the event
See Also:
ArgoModuleEventListener.moduleLoaded(org.argouml.application.events.ArgoModuleEvent)

moduleUnloaded

public void moduleUnloaded(ArgoModuleEvent event)
Description copied from interface: ArgoModuleEventListener
Invoked when a module has been unloaded.

Specified by:
moduleUnloaded in interface ArgoModuleEventListener
Parameters:
event - the event
See Also:
ArgoModuleEventListener.moduleUnloaded(org.argouml.application.events.ArgoModuleEvent)

moduleEnabled

public void moduleEnabled(ArgoModuleEvent event)
Description copied from interface: ArgoModuleEventListener
Invoked when a module has been enabled.

Specified by:
moduleEnabled in interface ArgoModuleEventListener
Parameters:
event - the event
See Also:
ArgoModuleEventListener.moduleEnabled(org.argouml.application.events.ArgoModuleEvent)

moduleDisabled

public void moduleDisabled(ArgoModuleEvent event)
Description copied from interface: ArgoModuleEventListener
Invoked when a module has been disabled.

Specified by:
moduleDisabled in interface ArgoModuleEventListener
Parameters:
event - the event
See Also:
ArgoModuleEventListener.moduleDisabled(org.argouml.application.events.ArgoModuleEvent)


ArgoUML © 1996-2004 (20050222)ArgoUML HomepageArgoUML Developers' pageArgoUML Cookbook