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 void setValues(Object device, Object action, double minValue, double maxValue) { ActionAttributes actionAttrs = getActionAttributes(device, action); if (actionAttrs == null) { String message = Logging.getMessage("nullValue.AttributesIsNull"); Logging.logger().severe(message); throw new IllegalArgumentException(message); } else { actionAttrs.setValues(minValue, maxValue); } }
public ActionAttributes(ActionAttributes attributes) { if (attributes == null) { String message = Logging.getMessage("nullValue.AttributesIsNull"); Logging.logger().severe(message); throw new IllegalArgumentException(message); } this.minValue = attributes.minValue; this.maxValue = attributes.maxValue; this.smoothingValue = attributes.smoothingValue; this.setActionListener(attributes.getActionListener()); this.setKeyActions(attributes.getKeyActions()); this.setActionTrigger(attributes.getActionTrigger()); }
public void setMouseActionAttributes( String actionName, int modifier, ActionAttributes.ActionTrigger trigger, ActionAttributes.MouseAction[] mouseActions, double minValue, double maxValue, boolean smoothingEnabled, double smoothingValue) { ActionAttributes actionAttrs = this.getActionAttributes(DEVICE_MOUSE, actionName); if (actionAttrs != null) { actionAttrs.setValues(minValue, maxValue); actionAttrs.setMouseActions(mouseActions); actionAttrs.setActionTrigger(trigger); actionAttrs.setEnableSmoothing(smoothingEnabled); actionAttrs.setSmoothingValue(smoothingValue); } else { this.addAction( DEVICE_MOUSE, modifier, actionName, new ActionAttributes( mouseActions, trigger, minValue, maxValue, smoothingEnabled, smoothingValue)); } }
protected ActionAttributes makeSlowActionAttributes( ActionAttributes attributes, double slowCoefficient) { ActionAttributes slowAttributes = new ActionAttributes(attributes); double[] values = attributes.getValues(); slowAttributes.setValues(values[0] * slowCoefficient, values[1] * slowCoefficient); slowAttributes.setEnableSmoothing(attributes.isEnableSmoothing()); slowAttributes.setSmoothingValue(attributes.getSmoothingValue()); slowAttributes.setKeyCodeModifier(attributes.getKeyCodeModifier()); slowAttributes.setKeyActions(attributes.getKeyActions()); return slowAttributes; }