Exemplo n.º 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);
    }
  }
Exemplo n.º 2
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;
 }
Exemplo n.º 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());
    }