コード例 #1
0
 @Override
 protected void initializeUI() {
   setTitle("Configure distributed model dialog");
   modelNameTextField.setText(distributedModelDefinition.getModelName());
   rmiModelNameTextField.setText(distributedModelDefinition.getRmiModelName());
   addressTextField.setText(distributedModelDefinition.getAddress());
   portTextField.setText(String.valueOf(distributedModelDefinition.getPort()));
   lookaheadCheckBox.setSelected(distributedModelDefinition.isLookahead());
 }
コード例 #2
0
  @Override
  protected boolean okButtonLogic() {
    try {
      Iterable<String> models = Application.global().getDistributedModels().keys();
      TypeInputValidator validator = new TypeInputValidator();
      String modelName = validator.validateString(modelNameTextField.getText(), "Model name");
      String rmiModelName =
          validator.validateString(rmiModelNameTextField.getText(), "RMI model name");
      rmiModelName =
          validator.validateSpecialCharacters(
              rmiModelName, "RMI model name (contains special characters)");
      if (editWindow)
        rmiModelName =
            validator.validateDuplicity(
                models,
                rmiModelName,
                "RMI model name (duplicity)",
                distributedModelDefinition.getRmiModelName());
      else
        rmiModelName =
            validator.validateDuplicity(models, rmiModelName, "RMI model name (duplicity)");

      String address = validator.validateString(addressTextField.getText(), "Remote address");
      int port = validator.validateInteger(portTextField.getText(), "Remote port");
      boolean lookahead = lookaheadCheckBox.isSelected();
      boolean receive = receiveCheckBox.isSelected();

      distributedModelDefinition.setModelName(modelName);
      distributedModelDefinition.setRmiModelName(rmiModelName);
      distributedModelDefinition.setAddress(address);
      distributedModelDefinition.setPort(port);
      distributedModelDefinition.setLookahead(lookahead);
      distributedModelDefinition.setReceive(receive);
      return true;
    } catch (Exception exception) {
      return false;
    }
  }