{
context( SapphireDiagramEditorPagePart.class ).setGridVisible(this.architecture.isShowGrid().content());
context( SapphireDiagramEditorPagePart.class ).setShowGuides(this.architecture.isShowGuides().content());
ElementList<Component> components = this.architecture.getComponents();
ConnectionService connService = context( SapphireDiagramEditorPagePart.class ).service(ConnectionService.class);
for (Component component : components)
{
DiagramNodePart nodePart = context( SapphireDiagramEditorPagePart.class ).getDiagramNodePart(component);
if (nodePart != null)
{
DiagramNodeBounds bounds = null;
bounds = new DiagramNodeBounds(component.getPosition().getX().content(),
component.getPosition().getY().content(), -1, -1,
false, false);
nodePart.setNodeBounds(bounds);
// load the embedded connection layout
ElementList<ComponentDependency> dependencies = component.getDependencies();
for (ComponentDependency dependency : dependencies)
{
DiagramConnectionPart connPart = getConnectionPart(connService, dependency);
if (connPart != null)
{
ElementList<ConnectionBendpoint> bendpoints = dependency.getConnectionBendpoints();
if (bendpoints.size() > 0)
{
int index = 0;
for (ConnectionBendpoint bendpoint : bendpoints)
{
connPart.addBendpoint(index++, bendpoint.getX().content(),
bendpoint.getY().content());
}
}
}
}
}
}
// Listen on existing connection parts
for (DiagramConnectionPart connPart : connService.list())
{
connPart.attach(this.connectionPartListener);
}
}