1 /*******************************************************************************
\r
2 * Copyright (c) 2010 Association for Decentralized Information Management in
\r
4 * All rights reserved. This program and the accompanying materials
\r
5 * are made available under the terms of the Eclipse Public License v1.0
\r
6 * which accompanies this distribution, and is available at
\r
7 * http://www.eclipse.org/legal/epl-v10.html
\r
10 * VTT Technical Research Centre of Finland - initial API and implementation
\r
11 *******************************************************************************/
\r
12 package org.simantics.sysdyn.ui.elements;
\r
14 import org.simantics.db.AsyncReadGraph;
\r
15 import org.simantics.db.Resource;
\r
16 import org.simantics.db.common.adaption.ResourceAdapter;
\r
17 import org.simantics.db.procedure.AsyncProcedure;
\r
18 import org.simantics.diagram.adapter.DiagramClassAdapter;
\r
19 import org.simantics.g2d.diagram.DiagramClass;
\r
20 import org.simantics.g2d.diagram.DiagramHints;
\r
21 import org.simantics.g2d.diagram.IDiagram;
\r
22 import org.simantics.g2d.diagram.handler.LifeCycle;
\r
23 import org.simantics.g2d.routing.RouterFactory;
\r
26 * @author Tuukka Lehtonen
\r
28 public class ConfigurationDiagramClassAdapter implements ResourceAdapter<DiagramClass> {
\r
31 public void adapt(AsyncReadGraph g, Resource source, Resource r, AsyncProcedure<DiagramClass> procedure) {
\r
32 procedure.execute(g, DiagramClassAdapter.INSTANCE.newClassWith(
\r
33 Initializer.INSTANCE
\r
37 static class Initializer extends LifeCycle.Stub {
\r
38 public static final Initializer INSTANCE = new Initializer();
\r
41 public void onDiagramCreated(IDiagram diagram) {
\r
42 diagram.setHint(DiagramHints.ROUTE_ALGORITHM, RouterFactory.create(false, false));
\r