Пример #1
0
  public ToolExecutionForm(
      AppContext appContext,
      ToolAdapterOperatorDescriptor descriptor,
      PropertySet propertySet,
      TargetProductSelector targetProductSelector) {
    this.appContext = appContext;
    this.operatorDescriptor = descriptor;
    this.propertySet = propertySet;
    this.targetProductSelector = targetProductSelector;

    // before executing, the sourceProduct and sourceProductFile must be removed from the list,
    // since they cannot be edited
    Property sourceProperty =
        this.propertySet.getProperty(ToolAdapterConstants.TOOL_SOURCE_PRODUCT_FILE);
    if (sourceProperty != null) {
      this.propertySet.removeProperty(sourceProperty);
    }
    sourceProperty = this.propertySet.getProperty(ToolAdapterConstants.TOOL_SOURCE_PRODUCT_ID);
    if (sourceProperty != null) {
      this.propertySet.removeProperty(sourceProperty);
    }
    // if the tool is handling by itself the output product name, then remove targetProductFile from
    // the list,
    // since it may bring only confusion in this case
    if (operatorDescriptor.isHandlingOutputName()) {
      sourceProperty = this.propertySet.getProperty(ToolAdapterConstants.TOOL_TARGET_PRODUCT_FILE);
      if (sourceProperty != null) {
        this.propertySet.removeProperty(sourceProperty);
      }
    }

    // initialise the target product's directory to the working directory
    final TargetProductSelectorModel targetProductSelectorModel = targetProductSelector.getModel();
    targetProductSelectorModel.setProductDir(
        operatorDescriptor.resolveVariables(operatorDescriptor.getWorkingDir()));

    ioParamPanel = createIOParamTab();
    addTab("I/O Parameters", ioParamPanel);
    JPanel processingParamPanel = new JPanel(new SpringLayout());
    checkDisplayOutput = new JCheckBox("Display execution output");
    processingParamPanel.add(checkDisplayOutput);
    processingParamPanel.add(createProcessingParamTab());
    SpringUtilities.makeCompactGrid(processingParamPanel, 2, 1, 2, 2, 2, 2);
    addTab("Processing Parameters", processingParamPanel);
    updateTargetProductFields();
  }