import org.simantics.g2d.diagram.DiagramClass;
import org.simantics.g2d.diagram.IDiagram;
import org.simantics.g2d.diagram.handler.SubstituteElementClass;
+import org.simantics.g2d.diagram.handler.impl.LockingTransactionContext;
+import org.simantics.g2d.diagram.handler.impl.PickContextImpl;
import org.simantics.g2d.element.ElementClass;
import org.simantics.g2d.element.ElementHints;
import org.simantics.g2d.element.IElement;
import org.simantics.g2d.element.handler.ElementLayerListener;
+import org.simantics.g2d.elementclass.connection.ConnectionValidator;
import org.simantics.g2d.layers.ILayer;
public class DistrictDiagramClassAdapter extends DiagramClassAdapter {
- static final SubstituteElementClass DINSTANCE = new DistrictDiagramSubstituteElementClass();
+ static final DiagramClass INSTANCE = DiagramClass.compile(
+ new PickContextImpl(true),
+ LockingTransactionContext.INSTANCE,
+ ConnectionValidator.INSTANCE,
+ DistrictDiagramSubstituteElementClass.INSTANCE
+ );
@Override
public void adapt(AsyncReadGraph g, Resource source, Resource r, AsyncProcedure<DiagramClass> procedure) {
- procedure.execute(g, INSTANCE.newClassWith(DINSTANCE));
+ procedure.execute(g, INSTANCE);
}
static class DistrictDiagramElementLayerListenerImpl implements ElementLayerListener {
static class DistrictDiagramSubstituteElementClass implements SubstituteElementClass {
- static final ElementLayerListener LAYER_LISTENER = new DistrictDiagramElementLayerListenerImpl();
+ static final SubstituteElementClass INSTANCE = new DistrictDiagramSubstituteElementClass();
+
+ final ElementLayerListener LAYER_LISTENER = new DistrictDiagramElementLayerListenerImpl();
@Override
public ElementClass substitute(IDiagram d, ElementClass ec) {
- return ec.newClassWith(LAYER_LISTENER);
+ return ec.newClassWith(false, LAYER_LISTENER);
}
}