public void setActionListener( Object deviceKey, Object actionKey, ViewInputActionHandler listener) { if (deviceKey == null) { String message = Logging.getMessage("nullValue.DeviceKeyIsNull"); Logging.logger().severe(message); throw new IllegalArgumentException(message); } if (actionKey == null) { String message = Logging.getMessage("nullValue.ActionKeyIsNull"); Logging.logger().severe(message); throw new IllegalArgumentException(message); } ActionAttributesMap deviceActionMap = this.getActionMap(deviceKey); if (deviceActionMap == null) { String message = Logging.getMessage("nullValue.DeviceNotDefined"); Logging.logger().severe(message); throw new IllegalArgumentException(message); } ActionAttributes actions = deviceActionMap.getActionAttributes(actionKey); if (actions == null) { String message = Logging.getMessage("nullValue.DeviceActionNotDefined"); Logging.logger().severe(message); throw new IllegalArgumentException(message); } if (actions.getMouseActions() != null) { actions.setMouseActionListener(listener); } else if (actions.getKeyActions() != null) { actions.setActionListener(listener); } }
public ActionAttributes getActionAttributes(Object deviceKey, Object actionKey) { if (deviceKey == null) { String message = Logging.getMessage("nullValue.DeviceKeyIsNull"); Logging.logger().severe(message); throw new IllegalArgumentException(message); } if (actionKey == null) { String message = Logging.getMessage("nullValue.ActionKeyIsNull"); Logging.logger().severe(message); throw new IllegalArgumentException(message); } ActionAttributesMap map = this.getActionMap(deviceKey); if (map == null) return null; return map.getActionAttributes(actionKey); }
public void addAction( Object deviceKey, Integer modifier, Object actionKey, ActionAttributes actionAttrs) { if (deviceKey == null) { String message = Logging.getMessage("nullValue.DeviceKeyIsNull"); Logging.logger().severe(message); throw new IllegalArgumentException(message); } if (actionKey == null) { String message = Logging.getMessage("nullValue.ActionKeyIsNull"); Logging.logger().severe(message); throw new IllegalArgumentException(message); } // Add this action to the Device -> Modifier -> Action map addModifierAction(deviceKey, modifier, actionAttrs); // Get the Device -> Action map ActionAttributesMap deviceActionMap = this.getActionMap(deviceKey); if (deviceActionMap == null) { deviceActionMap = new ActionAttributesMap(); this.setActionMap(deviceKey, deviceActionMap); } deviceActionMap.setActionAttributes(actionKey, actionAttrs); }