Пример #1
0
 @Override
 public Status getStatus() {
   Status status = new Status();
   status.put("id", this.getUUID());
   status.put("continue", "");
   return status;
 }
Пример #2
0
  @Override
  public Status getStatus() {
    Status status = new Status();

    status.put("id", this.getUUID());
    if (variable != null) {
      status.put("variable", variable.getStatus());
    }

    if (leftVariable != null) {
      status.put("left", leftVariable.getStatus());
    } else if (arg1 != null) {
      status.put("left", arg1.getStatus());
    } else {
      status.put("left", tf1.getText());
    }

    status.put("op", cb.getValue());

    if (arg2 != null) {
      status.put("right", arg2.getStatus());
    } else {
      status.put("right", tf2.getText());
    }

    return status;
  }
Пример #3
0
  @Override
  public void setStatus(Status status) {
    changeable = false; // 一時的にリスナーを無効化

    this.setUUID((String) status.get("id"));

    for (Object key : status.keySet()) {
      if (key.equals("variable")) {
        // 変数ブロック
        Variable val = (Variable) BlockUtil.create("Variable");
        val.setSprite(getSprite());
        val.setStatus(BlockUtil.convertMapToStatus(status.get(key)));

        setVariable(val);
      } else if (key.equals("left")) {
        Object value = status.get(key);

        if (value instanceof String) {
          tf1.setText((String) value); // テキスト
        } else {
          // 変数ブロック
          Variable val = (Variable) BlockUtil.create("Variable");
          val.setSprite(getSprite());
          val.setStatus(BlockUtil.convertMapToStatus(status.get(key)));

          setLeftVariable(val);
        }
      } else if (key.equals("op")) {
        cb.setValue(status.get(key));
      } else if (key.equals("right")) {
        Object value = status.get(key);

        if (value instanceof String) {
          tf2.setText((String) status.get(key)); // テキスト
        } else {
          // 変数ブロック
          arg2 = (Variable) BlockUtil.create("Variable");
          arg2.setSprite(getSprite());
          arg2.setStatus(BlockUtil.convertMapToStatus(status.get(key)));
        }
      }
    }

    changeable = true;
  }
Пример #4
0
 @Override
 public void setStatus(Status status) {
   changeable = false; // 一時的にリスナーを無効化
   this.setUUID((String) status.get("id"));
   changeable = true;
 }