org.argouml.uml.generator
Class GeneratorDisplay

java.lang.Object
  extended byorg.argouml.uml.generator.Generator
      extended byorg.argouml.uml.generator.GeneratorDisplay
All Implemented Interfaces:
ArgoModule, NotationProvider, Pluggable, PluggableNotation

public class GeneratorDisplay
extends Generator

Generator subclass to generate text for display in diagrams in in text fields in the Argo/UML user interface. The generated code looks a lot like (invalid) Java. The idea is that other generators could be written for outher languages. This code is just a placeholder for future development, I expect it to be totally replaced.


Nested Class Summary
(package private)  class GeneratorDisplay.MsgPtr
           
 
Field Summary
static java.lang.String ANY_RANGE
           
private static GeneratorDisplay SINGLETON
           
 
Fields inherited from class org.argouml.uml.generator.Generator
INDENT, TEST_SUFFIX
 
Fields inherited from interface org.argouml.application.api.Pluggable
PLUGIN_PREFIX, PLUGIN_TITLE, PLUGIN_VENDOR
 
Fields inherited from interface org.argouml.application.api.ArgoModule
cat, MODULEFILENAME, MODULEFILENAME_ALTERNATE
 
Constructor Summary
private GeneratorDisplay()
           
 
Method Summary
 boolean canParse()
          Can the notation be parsed at all?
 boolean canParse(java.lang.Object o)
          Can the notation be parsed for this object?
(package private)  int countSuccessors(java.lang.Object m)
           
static java.lang.String Generate(java.lang.Object o)
           
 java.lang.String generateAction(java.lang.Object m)
           
 java.lang.String generateAssociation(ru.novosoft.uml.foundation.core.MAssociation a)
           
 java.lang.String generateAssociationEnd(ru.novosoft.uml.foundation.core.MAssociationEnd ae)
           
 java.lang.String generateAssociationFrom(java.lang.Object a, ru.novosoft.uml.foundation.core.MAssociationEnd ae)
           
 java.lang.String generateAssociationRole(ru.novosoft.uml.behavior.collaborations.MAssociationRole assocRole)
          generate the name of an association role of the form: / name : name of the base association
 java.lang.String generateAttribute(ru.novosoft.uml.foundation.core.MAttribute attr, boolean documented)
          Generates a string representation for the provided attribute.
 java.lang.String generateChangability(ru.novosoft.uml.foundation.core.MStructuralFeature sf)
           
 java.lang.String generateClassifier(ru.novosoft.uml.foundation.core.MClassifier cls)
           
 java.lang.String generateClassList(java.util.Collection classifiers)
           
 java.lang.String generateConstraint(ru.novosoft.uml.foundation.core.MConstraint c)
           
 java.lang.String generateConstraints(ru.novosoft.uml.foundation.core.MModelElement me)
           
 java.lang.String generateExtensionPoint(ru.novosoft.uml.behavior.use_cases.MExtensionPoint ep)
          Generate the display for an extension point.
 java.lang.String generateGeneralization(java.util.Collection generalizations, boolean impl)
           
 java.lang.String generateGuard(ru.novosoft.uml.behavior.state_machines.MGuard m)
           
 java.lang.String generateMessage(ru.novosoft.uml.behavior.collaborations.MMessage m)
          Generates a textual description for a MMessage m.
 java.lang.String generateMessageNumber(java.lang.Object message)
          Generates the textual number of MMessage m.
private  java.lang.String generateMessageNumber(java.lang.Object m, java.lang.Object pre, int position)
           
 java.lang.String generateMultiplicity(ru.novosoft.uml.foundation.data_types.MMultiplicity m)
           
protected  java.lang.String generateMultiplicityRange(ru.novosoft.uml.foundation.data_types.MMultiplicityRange mr)
          Generates a multiplicity range.
 java.lang.String generateOperation(ru.novosoft.uml.foundation.core.MOperation op, boolean documented)
          Generates an operation accordin to the UML 1.3 notation: stereotype visibility name (parameter-list) : return-type-expression {property-string} For the return-type-expression: only the types of the return parameters are shown.
 java.lang.String generatePackage(ru.novosoft.uml.model_management.MPackage p)
           
 java.lang.String generateParameter(ru.novosoft.uml.foundation.core.MParameter parameter)
           
 java.lang.String generateRecurrence(java.lang.Object expr)
          Generates a textual description of a MIterationExpression.
 java.lang.String generateScope(ru.novosoft.uml.foundation.core.MFeature f)
           
 java.lang.String generateState(ru.novosoft.uml.behavior.state_machines.MState m)
           
 java.lang.String generateStateBody(ru.novosoft.uml.behavior.state_machines.MState m)
           
 java.lang.String generateTaggedValue(ru.novosoft.uml.foundation.extension_mechanisms.MTaggedValue tv)
           
 java.lang.String generateTransition(ru.novosoft.uml.behavior.state_machines.MTransition m)
           
 java.lang.String generateVisibility(ru.novosoft.uml.foundation.core.MFeature f)
           
 java.lang.String generateVisibility(ru.novosoft.uml.foundation.data_types.MVisibilityKind vis)
           
static GeneratorDisplay getInstance()
           
 java.lang.String getModuleAuthor()
          The module author.
 java.lang.String getModuleDescription()
          Textual description of the module.
 java.lang.String getModuleKey()
          The module identifying key
 java.lang.String getModuleName()
          Display name of the module.
 java.lang.String getModuleVersion()
          The module version.
 boolean inContext(java.lang.Object[] o)
          A function which allows a plug-in to decide if it is available under a specific context.
 boolean isModuleEnabled()
          The default for any Generator is to be enabled.
(package private)  int recCountPredecessors(java.lang.Object message, GeneratorDisplay.MsgPtr ptr)
           
 
Methods inherited from class org.argouml.uml.generator.Generator
generate, generateClassifierRef, generateExpression, generateExpression, generateName, generateStereotype, generateUninterpreted, getCodePath, getGenerator, getModulePopUpActions, getNotation, initializeModule, isTestModus, setModuleEnabled, setTestModus, shutdownModule
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SINGLETON

private static GeneratorDisplay SINGLETON

ANY_RANGE

public static final java.lang.String ANY_RANGE
See Also:
Constant Field Values
Constructor Detail

GeneratorDisplay

private GeneratorDisplay()
Method Detail

getInstance

public static GeneratorDisplay getInstance()

Generate

public static java.lang.String Generate(java.lang.Object o)

generateExtensionPoint

public java.lang.String generateExtensionPoint(ru.novosoft.uml.behavior.use_cases.MExtensionPoint ep)

Generate the display for an extension point.

The representation is "name: location". "name :" is omitted if there is no name given.

Specified by:
generateExtensionPoint in interface NotationProvider
Specified by:
generateExtensionPoint in class Generator
Parameters:
ep - The extension point.
Returns:
The string representing the extension point.

generateOperation

public java.lang.String generateOperation(ru.novosoft.uml.foundation.core.MOperation op,
                                          boolean documented)
Generates an operation accordin to the UML 1.3 notation: stereotype visibility name (parameter-list) : return-type-expression {property-string} For the return-type-expression: only the types of the return parameters are shown. Depending on settings in Notation visibility and properties are shown/not shown.

Specified by:
generateOperation in interface NotationProvider
Specified by:
generateOperation in class Generator
See Also:
NotationProvider.generateOperation( MOperation, boolean)

generateAttribute

public java.lang.String generateAttribute(ru.novosoft.uml.foundation.core.MAttribute attr,
                                          boolean documented)
Generates a string representation for the provided attribute. The string representation will be of the form: visibility name [multiplicity] : type-expression = initial-value {property-string} Depending on settings in Notation visibility, multiplicity, initial value and properties are shown/not shown.

Specified by:
generateAttribute in interface NotationProvider
Specified by:
generateAttribute in class Generator
See Also:
NotationProvider.generateAttribute( MAttribute, boolean)

generateParameter

public java.lang.String generateParameter(ru.novosoft.uml.foundation.core.MParameter parameter)
Specified by:
generateParameter in interface NotationProvider
Specified by:
generateParameter in class Generator

generatePackage

public java.lang.String generatePackage(ru.novosoft.uml.model_management.MPackage p)
Specified by:
generatePackage in interface NotationProvider
Specified by:
generatePackage in class Generator

generateClassifier

public java.lang.String generateClassifier(ru.novosoft.uml.foundation.core.MClassifier cls)
Specified by:
generateClassifier in interface NotationProvider
Specified by:
generateClassifier in class Generator

generateTaggedValue

public java.lang.String generateTaggedValue(ru.novosoft.uml.foundation.extension_mechanisms.MTaggedValue tv)
Specified by:
generateTaggedValue in interface NotationProvider
Specified by:
generateTaggedValue in class Generator

generateMessageNumber

public java.lang.String generateMessageNumber(java.lang.Object message)
Generates the textual number of MMessage m. The number is a string of numbers separated by points which describes the message's order and level in a collaboration.

If you plan to modify this number, make sure that ParserDisplay.parseMessage is adapted to the change.

Parameters:
message - A MMessage to generate the number for.
Returns:
A String with the message number of m.

generateMessageNumber

private java.lang.String generateMessageNumber(java.lang.Object m,
                                               java.lang.Object pre,
                                               int position)

recCountPredecessors

int recCountPredecessors(java.lang.Object message,
                         GeneratorDisplay.MsgPtr ptr)

countSuccessors

int countSuccessors(java.lang.Object m)

generateRecurrence

public java.lang.String generateRecurrence(java.lang.Object expr)
Generates a textual description of a MIterationExpression.


generateMessage

public java.lang.String generateMessage(ru.novosoft.uml.behavior.collaborations.MMessage m)
Generates a textual description for a MMessage m.

Specified by:
generateMessage in interface NotationProvider
Specified by:
generateMessage in class Generator
Parameters:
m - A MMessage to generate a description for.
Returns:
A String suitable to show in a collaboration diagram.

generateAssociationFrom

public java.lang.String generateAssociationFrom(java.lang.Object a,
                                                ru.novosoft.uml.foundation.core.MAssociationEnd ae)

generateAssociation

public java.lang.String generateAssociation(ru.novosoft.uml.foundation.core.MAssociation a)
Specified by:
generateAssociation in interface NotationProvider
Specified by:
generateAssociation in class Generator

generateAssociationEnd

public java.lang.String generateAssociationEnd(ru.novosoft.uml.foundation.core.MAssociationEnd ae)
Specified by:
generateAssociationEnd in interface NotationProvider
Specified by:
generateAssociationEnd in class Generator

generateConstraints

public java.lang.String generateConstraints(ru.novosoft.uml.foundation.core.MModelElement me)

generateConstraint

public java.lang.String generateConstraint(ru.novosoft.uml.foundation.core.MConstraint c)

generateAssociationRole

public java.lang.String generateAssociationRole(ru.novosoft.uml.behavior.collaborations.MAssociationRole assocRole)
generate the name of an association role of the form: / name : name of the base association

Returns:
the generated name

generateGeneralization

public java.lang.String generateGeneralization(java.util.Collection generalizations,
                                               boolean impl)

generateClassList

public java.lang.String generateClassList(java.util.Collection classifiers)

generateVisibility

public java.lang.String generateVisibility(ru.novosoft.uml.foundation.data_types.MVisibilityKind vis)
Specified by:
generateVisibility in interface NotationProvider
Specified by:
generateVisibility in class Generator

generateVisibility

public java.lang.String generateVisibility(ru.novosoft.uml.foundation.core.MFeature f)

generateScope

public java.lang.String generateScope(ru.novosoft.uml.foundation.core.MFeature f)

generateChangability

public java.lang.String generateChangability(ru.novosoft.uml.foundation.core.MStructuralFeature sf)

generateMultiplicity

public java.lang.String generateMultiplicity(ru.novosoft.uml.foundation.data_types.MMultiplicity m)
Specified by:
generateMultiplicity in interface NotationProvider
Specified by:
generateMultiplicity in class Generator
See Also:
NotationProvider.generateMultiplicity( MMultiplicity)

generateMultiplicityRange

protected java.lang.String generateMultiplicityRange(ru.novosoft.uml.foundation.data_types.MMultiplicityRange mr)
Generates a multiplicity range. The standard getLower and getUpper defined on MMultiplicityRange give a -1 if the multiplicity is n or *. This method circumvents that behaviour.

Parameters:
mr -
Returns:
String

generateState

public java.lang.String generateState(ru.novosoft.uml.behavior.state_machines.MState m)
Specified by:
generateState in interface NotationProvider
Specified by:
generateState in class Generator

generateStateBody

public java.lang.String generateStateBody(ru.novosoft.uml.behavior.state_machines.MState m)

generateTransition

public java.lang.String generateTransition(ru.novosoft.uml.behavior.state_machines.MTransition m)
Specified by:
generateTransition in interface NotationProvider
Specified by:
generateTransition in class Generator

generateAction

public java.lang.String generateAction(java.lang.Object m)
Specified by:
generateAction in interface NotationProvider
Specified by:
generateAction in class Generator

generateGuard

public java.lang.String generateGuard(ru.novosoft.uml.behavior.state_machines.MGuard m)
Specified by:
generateGuard in interface NotationProvider
Specified by:
generateGuard in class Generator

canParse

public boolean canParse()
Description copied from interface: NotationProvider
Can the notation be parsed at all?


canParse

public boolean canParse(java.lang.Object o)
Description copied from interface: NotationProvider
Can the notation be parsed for this object?


getModuleName

public java.lang.String getModuleName()
Description copied from interface: ArgoModule
Display name of the module.

Returns:
the module name

getModuleDescription

public java.lang.String getModuleDescription()
Description copied from interface: ArgoModule
Textual description of the module.

Returns:
the module description

getModuleAuthor

public java.lang.String getModuleAuthor()
Description copied from interface: ArgoModule
The module author.

Returns:
a string containing the module author

getModuleVersion

public java.lang.String getModuleVersion()
Description copied from interface: ArgoModule
The module version. There is no specified format.

Returns:
a string containing the module version

getModuleKey

public java.lang.String getModuleKey()
Description copied from interface: ArgoModule
The module identifying key

Returns:
the string key the module uses to identify itself

inContext

public boolean inContext(java.lang.Object[] o)
Description copied from interface: Pluggable
A function which allows a plug-in to decide if it is available under a specific context. One example of a plugin with multiple criteria is the PluggableMenu. PluggableMenu requires the first context to be a JMenuItem which wants the PluggableMenu attached to as the context, so that it can determine that it would attach to a menu. The second context is an internal (non-localized) description of the menu such as "File" or "View" so that the plugin can further decide.

Specified by:
inContext in interface Pluggable
Overrides:
inContext in class Generator
See Also:
Pluggable.inContext(java.lang.Object[])

isModuleEnabled

public boolean isModuleEnabled()
Description copied from class: Generator
The default for any Generator is to be enabled.

Specified by:
isModuleEnabled in interface ArgoModule
Overrides:
isModuleEnabled in class Generator
Returns:
that this module is enabled.
See Also:
ArgoModule.isModuleEnabled()


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