*/
public void setupKeyEvents() {
List<Object> keyEventHandlers = (List<Object>) ElementUtils.findHandlersInStackByType(executor.getExecutionContext(), KeyEventHandler.class);
for (Object handler : keyEventHandlers) {
final KeyEventHandler keyHandler = (KeyEventHandler) handler;
Action keyAction = new AbstractAction() {
private static final long serialVersionUID = 1L;
public void actionPerformed(ActionEvent e) {
if (executor != null) {
logger.info("Key event triggered with code: " + KeyEvent.getKeyText(keyHandler.getKeyEvent()));
keyHandler.triggerKeyEvent(keyHandler.getKeyEvent(), executor.getExecutionContext());
}
}
};
this.getRootPane().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(keyHandler.getKeyEvent(), 0),"keyEvent_" + keyHandler.getKeyEvent());
this.getRootPane().getActionMap().put("keyEvent_" + keyHandler.getKeyEvent(), keyAction);
}
}