This transformation accepts a UML state in a state machine as its source and generates a Web page in the form of a JSP file using Java Emitter Templates (JET). If you choose a state machine or a region as the source, the transformation generates a JSP file for each state in the state machine or the region that has a stereotype from the ScreenFlow profile applied to it.
To prepare the source state machine for the transformation, you must
apply the ScreenFlow profile to the UML model that contains the state machine
and mark up the state machine by applying the stereotypes in ScrrenFlow
profile to its states.
The ScreenFlow profile contains four
stereotypes: form
, editform
,
selectlist
, and display
.
These stereotypes determine the display style of the dynamic contents of
the generated page. The sample uses the stereotypes to determine whether the
display style is an editable form or a selectable list, and so on. If you
apply more than one stereotype to a state, the transformation only considers
the first stereotype.
The sample also uses the properties of the stereotypes to determine the
data that is exchanged through the JSP pages.
The transformation generates a JSP page that corresponds to a state only
if one of the four stereotypes is applied to the state.
If the JSP files already exist, the transformation does not overwrite
them when it runs. You can change whether the transformation
overwrites files by setting the value of the transformation property,
Overwrite Output Files, to true
.
The following table shows the stereotypes in the ScreenFlow profile and their properties. The values in the table are for illustration purposes only.
Stereotype |
Base Class |
Properties:Values |
Description |
display <<display>> |
State | entity:Contact fields:name, address |
Indicates that the generated JSP page displays the contact details: name and address |
editform <<editform>> |
State | entity:Contact fields:name, address |
Indicates that the generated JSP page contains an editable form in which a user can enter or edit contact details: name and address |
form <<form>> |
State | fields:userName | Indicates that the generated JSP page contains a form to enter the user's name |
selectlist <<selectlist>> |
State | entity:Contact fields:name, address selectfield:id |
Indicates that the generated JSP page contains a list of contacts that can be used to select a contact with a specific ID |
To run the transformation:
The transformation generates the JSP files and places them in the
specified project in a folder named web
. Open a Navigator view
to view the generated JSP files.
The State to JSP transformation does not overwrite the JSP files that
already exist. To overwrite existing JSP files, in the Run Transform
window click the Properties tab. On the Properties
page, set the Overwrite Output Files property to
true
.
This transformation accepts an UML state machine or an UML region or one or more UML states as the source.
This transformation accepts a project as its target.