Screen screen = new Screen(nifty, id, screenController, timeProvider);
screen.setDefaultFocusElement(getAttributes().get("defaultFocusElement"));
String inputMappingClass = getAttributes().get("inputMapping");
if (inputMappingClass != null) {
NiftyInputMapping inputMapping = ClassHelper.getInstance(inputMappingClass, NiftyInputMapping.class);
if (!(screenController instanceof KeyInputHandler)) {
log.info("class [" + controller + "] tries to use inputMapping [" + inputMappingClass + "] but does not implement [" + KeyInputHandler.class.getName() + "]");
} else {
screen.addKeyboardInputHandler(inputMapping, KeyInputHandler.class.cast(screenController));
}
}
String inputMappingPreClass = getAttributes().get("inputMappingPre");
if (inputMappingPreClass != null) {
NiftyInputMapping inputMapping = ClassHelper.getInstance(inputMappingPreClass, NiftyInputMapping.class);
if (!(screenController instanceof KeyInputHandler)) {
log.info("class [" + controller + "] tries to use inputMapping [" + inputMappingPreClass + "] but does not implement [" + KeyInputHandler.class.getName() + "]");
} else {
screen.addPreKeyboardInputHandler(inputMapping, KeyInputHandler.class.cast(screenController));
}