public EventListener(final IDisplaySurface display, final String event, final String action) { listenedEvent = getListeningEvent(event); IAgent a = display.getDisplayScope().getSimulationScope(); if (a == null) { a = display.getDisplayScope().getExperiment(); } executer = a.getSpecies().getAction(action); surface = display; }
@Override public void firstLaunchOn(final IDisplaySurface surface) { super.firstLaunchOn(surface); final IExpression eventType = definition.getFacet(IKeyword.NAME); final IExpression actionName = definition.getFacet(IKeyword.ACTION); IScope scope = surface.getDisplayScope(); String currentMouseEvent = Cast.asString(scope, eventType.value(scope)); String currentAction = Cast.asString(scope, actionName.value(scope)); listener = new EventListener(surface, currentMouseEvent, currentAction); surface.addMouseListener(listener); }