use of com.cas.circuit.event.TransducersAdapter in project TeachingInSimulation by ScOrPiOzzy.
the class ConnectionHandler method bindSaveTransEvent.
private Cable bindSaveTransEvent(String elecCompKey, Cable cable, boolean modifiable) {
ElecComp elecComp = eleCompMap.get(elecCompKey);
if (elecComp == null) {
System.err.println("找不到elecCompKey : " + elecCompKey);
return null;
// throw new RuntimeException("找不到elecCompKey : " + elecCompKey);
}
ElecCompDef def = elecComp.getDef();
def.buildCompLogic();
Node elecCompMdl = (Node) parent.getChild(elecComp.getPO().getMdlName());
JmeUtil.setSpatialHighLight(elecCompMdl, ColorRGBA.BlackNoAlpha);
// MouseEventState.cleanEvent(elecCompMdl);
elecCompMdl.setUserData("MouseEvent", null);
Jack jack = def.getJackMap().values().iterator().next();
TransducersHandler handler = new TransducersHandler(this, elecComp, jack, modifiable);
cable.bind(jack);
cable.setElecComp(true);
cable.getModels().put(elecCompMdl, jack);
if (modifiable) {
linkerData.addLinker(cable, jack, null);
}
handler.setCable(cable);
addMouseEvent(elecCompMdl, new TransducersAdapter(handler));
return cable;
}
Aggregations