Java Reference
In-Depth Information
modeltype
mindmap 'strict'
uses
'http://www.eclipse.org/2008/mindmap';
modeltype
xhtml 'strict'
uses
'http://www.w3.org/1999/xhtml';
transformation
mindmap2xhtml(
in
inModel : mindmap,
out
outModel : xhtml);
property
relations :
Set
(mindmap::Relationship) =
null
;
main
() {
inModel.rootObjects()[Map]->
map
toXHTML();
}
mapping
mindmap::Map::toXHTML() : xhtml::DocumentRoot {
init {
this
.relations :=
self
.elements[mindmap::Relationship];
}
html +=
object
HtmlType {
head :=
object
HeadType {
title :=
object
TitleType {
text +=
self
.title + ' Report';
};
};
_body :=
object
BodyType {
h1 +=
object
H1Type {
text +=
self
.title + ' Report';
};
h2 +=
object
H2Type {
text += 'Contents';
};
ul +=
object
UlType {
li +=
self
.rootTopics.
map
toIndexItem();
};
hr +=
object
HrType {};
div +=
self
.elements[mindmap::Topic].
map
toContentItem();
};
};
}
query
mindmap::Topic::getRelations() :
Set
(mindmap::Relationship) {
return
relations->
select
(r | r.source =
self
)->asSet();
}
mapping
mindmap::Topic::toIndexItem() : xhtml::LiType {
init {
result
:=
object
LiType {
a +=
object
AType {
href := '#' +
self
.name;
text +=
self
.name;
};
};
if not self
.subtopics->isEmpty()
then
{
result
.ul +=
object
UlType {
li +=
self
.subtopics.
map
toIndexItem();
};
Search WWH ::
Custom Search