4 PLATFORM INDEPENDENT ANALYSIS AND DESIGN
4.6 Presentation
4.6.2 Transformation NavigationAndProcess2Presentation
Model Driven Software Engineering for Web Applications
Notation
The appropriate notation for the presentation model is a stereotyped composite structure diagram for each presentation class with the user interface elements as parts with the corre-sponding multiplicities. Equally, regular class diagrams can be used. For a definition of the corresponding UML profile see A.5.
The presentation classes corresponding to the process data classes of the add project proc-ess are depicted in Figure 67. Text input elements are used for capturing textual data that is needed by the process for the creation of a new project. An enumeration input element is required for the user selection of the desired project type. Finally, a selection element is used for the selection of a validation project out of a collection of validation projects.
<<prese ntation class>>
: ProjectManagerMenu
<<anchor>>
: AddProject
<<anchor>>
: RemoveProject
<<prese ntation class>>
: ProjectIndex
<<anchor>>
: Project [*]
<<pr esen tation cla ss>>
ProjectMana ger
Figure 65. Automatically derived presentation classes for the navigation class ProjectManager, menu ProjectManagerMenu and index ProjectIndex
Model Driven Software Engineering for Web Applications
<<presenta tion class>>
: UserProjectMenu
<<anch or>>
: ValidationProjec t
<<anch or>>
: E ditUserProject
<<anch or>>
: ProjectMana ger
<<text> >
: Description
<<te xt>>
: Id
<<te xt>>
: Na me
<<prese ntation class>>
UserProject
Figure 66. Automatically derived presentation classes for the navigation class UserProject and for the menu UserProjectMenu
<<presentation class>>
P roje ctKindInput
<<enumeration input>>
: ProjectKind
< <pre sen tation cla ss>>
AddV alidationProjectInput
<<text input>>
: Name
<<text input>>
: De scription
<<text input>>
: Name
<<text input>>
: De scription
<<se lection>>
: ValidationP rojec t
<<presenta tion class>>
AddUse rProject Input
Figure 67. Automatically derived presentation classes for the process classes
ProjectKindInput, AddValidationProjectInput and AddUserProjectInput of process AddProject
Rule NavigationClass2PresentationClass
For each navigation class (exact type) a presentation class is generated by this rule. Fur-ther, for each attribute of the navigation class (including inherited attributes) with a datatype type, i.e. either a primitive type or an enumeration type, a text user interface ele-ment is generated. For each outgoing link an anchor user interface eleele-ment is generated. In comparison to the rule implementation in B.3.9 the following details have been omitted below: target bindings that are not relevant for understanding the rule, and targets for the
147
presentation properties that correspond to the composition relationship between the gener-ated presentation class and the genergener-ated user interface elements.
rule NavigationClass2PresentationClass {
from nn : UWE!NavigationClass (
not nn.isAbstract and nn.oclIsTypeOf( UWE!NavigationClass ) ) to tnn : UWE!NavigationClass ( … ), -- target for copying source element pc : UWE!PresentationClass
( … ),
textUis : distinct UWE!Text foreach ( p in nn.allOwnedAttribute()->select( p | p.type.oclIsKindOf( UWE!DataType ) ) )
(
name <- p.name.firstToUpper(), …
),
anchorUis : distinct UWE!Anchor foreach ( p in nn.allOwnedAttribute()->select( p | p.association.oclIsKindOf( UWE!Link ) ) )
(
name <- p.type.name, …
), … }
Rule Menu2PresentationClass
For each menu a presentation class is generated by this rule. For each outgoing link an an-chor user interface element is generated. In comparison to the rule implementation in B.3.9 the following details have been omitted below: target bindings that are not relevant for un-derstanding the rule, and targets for the presentation properties that correspond to the com-position relationship between the generated presentation class and the generated user inter-face elements.
rule Menu2PresentationClass {
from nn : UWE!Menu ( not nn.isAbstract )
to tnn : UWE!Menu ( … ), -- target for copying source element pc : UWE!PresentationClass
(
Model Driven Software Engineering for Web Applications
),
anchorUis : distinct UWE!Anchor foreach ( p in nn.allOwnedAttribute()->select( p | p.association.oclIsKindOf( UWE!Link ) ) )
(
name <- p.type.name, …
), … }
Rule Index2PresentationClass
For each index a presentation class is generated by this rule. Additionally, an anchor user interface element is generated for the outgoing link. In comparison to the rule implementa-tion in B.3.9 the following details have been omitted below: target bindings that are not relevant for understanding the rule, and the target for the presentation property that corre-spond to the composition relationship between the generated presentation class and the an-chor.
rule Index2PresentationClass {
from nn : UWE!Index
to tnn : UWE!Index ( … ), -- target for copying source element pc : UWE!PresentationClass
( … ),
anchorUi : UWE!Anchor (
name <- nn.outLinks->first().target.name, …
), … }
Rule ProcessClass2PresentationClass
For each process class that represents process data a presentation class is generated by this rule. Further, for all attributes of the process class with a primitive type a text input ele-ment is generated. Attributes with an enumeration type are mapped to an enumeration in-put element and all other attributes are mapped to a selection inin-put element. In comparison to the rule implementation in B.3.9 the following details have been omitted below: target
149
bindings that are not relevant for understanding the rule, and targets for the presentation properties that correspond to the composition relationship between the generated presenta-tion class and the generated user interface elements.
rule ProcessClass2PresentationClass {
from nn : UWE!ProcessClass ( nn.inLinks->isEmpty() )
to tnn : UWE!ProcessClass ( … ), -- target for copying source element pc : UWE!PresentationClass
( … ),
textInputUis : distinct UWE!TextInput foreach ( p in nn.allOwnedAttribute()->select( p | p.type.oclIsKindOf( UWE!PrimitiveType ) ) )
(
name <- p.name.firstToUpper(), …
),
enumerationInputUis : distinct UWE!EnumerationInput foreach (
p in nn.allOwnedAttribute()->select( p | p.type.oclIsKindOf( UWE!Enumeration ) ) ) (
name <- p.name.firstToUpper(), …
),
selectionUis : distinct UWE!Selection foreach ( p in nn.allOwnedAttribute()->select( p | p.type.oclIsTypeOf( UWE!Class ) ) )
(
name <- p.name.firstToUpper(), format <- p.type.name,
… ), … }