예제 #1
0
  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);
    }
  }
예제 #2
0
 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);
   }
 }
예제 #3
0
    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());
    }
예제 #4
0
 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));
   }
 }
예제 #5
0
 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;
 }