X-Git-Url: https://mograsim.net/gitweb/?a=blobdiff_plain;f=net.mograsim.logic.model%2Fsrc%2Fnet%2Fmograsim%2Flogic%2Fmodel%2Fmodeladapter%2FViewLogicModelAdapter.java;h=6e722a0cd8a7d7da6d8a639ca089059817dec755;hb=95a225aed8eae0fc080440dba779abfdf867ff3d;hp=f41c407f08f7495268799c61bac93a13b2300832;hpb=a86976434d00dce2652d93256cc12b6e3a0f324a;p=Mograsim.git diff --git a/net.mograsim.logic.model/src/net/mograsim/logic/model/modeladapter/ViewLogicModelAdapter.java b/net.mograsim.logic.model/src/net/mograsim/logic/model/modeladapter/ViewLogicModelAdapter.java index f41c407f..6e722a0c 100644 --- a/net.mograsim.logic.model/src/net/mograsim/logic/model/modeladapter/ViewLogicModelAdapter.java +++ b/net.mograsim.logic.model/src/net/mograsim/logic/model/modeladapter/ViewLogicModelAdapter.java @@ -61,7 +61,7 @@ public class ViewLogicModelAdapter WireCrossPoint guiCompCasted = (WireCrossPoint) guiComp; guiCompCasted.setLogicModelBinding(logicWiresPerPin.get(guiCompCasted.getPin()).createReadOnlyEnd()); } else if (!(guiComp instanceof SubmodelInterface))// nothing to do for SubmodelInterfaces - createAndLinkComponent(timeline, params, guiComp, logicWiresPerPinUnmodifiable, componentAdapters.get(guiComp.getClass())); + createAndLinkComponent(timeline, params, guiComp, logicWiresPerPinUnmodifiable); } } @@ -95,7 +95,7 @@ public class ViewLogicModelAdapter if (externalWireCandidate != null) if (externalWire == null) externalWire = externalWireCandidate; - else if (externalWire.length == externalWireCandidate.length) + else if (externalWire.width == externalWireCandidate.width) Wire.fuse(externalWire, externalWireCandidate); else throw new IllegalArgumentException( @@ -144,8 +144,15 @@ public class ViewLogicModelAdapter @SuppressWarnings("unchecked") private static void createAndLinkComponent(Timeline timeline, LogicModelParameters params, - GUIComponent guiComponent, Map logicWiresPerPin, ComponentAdapter adapter) + GUIComponent guiComponent, Map logicWiresPerPin) { + Class cls = guiComponent.getClass(); + ComponentAdapter adapter = null; + while (cls != GUIComponent.class && adapter == null) + { + adapter = (ComponentAdapter) componentAdapters.get(cls); + cls = cls.getSuperclass(); + } if (adapter == null) throw new IllegalArgumentException("Unknown component class: " + guiComponent.getClass()); adapter.createAndLinkComponent(timeline, params, (G) guiComponent, logicWiresPerPin);