package org.workcraft.plugins.stg.tools;

import java.util.Map;

import org.workcraft.dom.math.MathNode;
import org.workcraft.gui.graph.tools.DefaultModelConverter;
import org.workcraft.plugins.petri.Place;
import org.workcraft.plugins.petri.Transition;
import org.workcraft.plugins.petri.VisualPetriNet;
import org.workcraft.plugins.stg.DummyTransition;
import org.workcraft.plugins.stg.STGPlace;
import org.workcraft.plugins.stg.VisualSTG;

public class PetriNetToStgConverter extends DefaultModelConverter<VisualPetriNet, VisualSTG> {

	public PetriNetToStgConverter(VisualPetriNet srcModel, VisualSTG dstModel) {
		super(srcModel, dstModel);
	}

	@Override
	public Map<Class<? extends MathNode>, Class<? extends MathNode>> getComponentClassMap() {
		Map<Class<? extends MathNode>, Class<? extends MathNode>> result = super.getComponentClassMap();
		result.put(Place.class, STGPlace.class);
		result.put(Transition.class, DummyTransition.class);
		return result;
	}

}

@@ -98,16 +98,65 @@
 thNode;%0A
+import org.workcraft.dom.visual.VisualComponent;%0A
 import o
@@ -479,19 +479,132 @@
 g.Visual
-STG
+DummyTransition;%0Aimport org.workcraft.plugins.stg.VisualSTG;%0Aimport org.workcraft.plugins.stg.VisualSignalTransition
 ;%0A%0Apubli
@@ -1125,10 +1125,337 @@
 lt;%0A%09%7D%0A%0A
+%09@Override%0A%09public VisualComponent convertComponent(VisualComponent srcComponent) %7B%0A%09%09VisualComponent dstComponent = super.convertComponent(srcComponent);%0A%09%09if ( (dstComponent instanceof VisualDummyTransition) %7C%7C (dstComponent instanceof VisualSignalTransition) ) %7B%0A%09%09%09dstComponent.setLabel(%22%22);%0A%09%09%7D%0A%09%09return dstComponent;%0A%09%7D%0A%0A
 %7D%0A

Remove transition labels on converting PN to STG.