예제 #1
0
  private void getInfo(FixedInputMeta fixedInputMeta) {

    fixedInputMeta.setFilename(wFilename.getText());
    fixedInputMeta.setLineWidth(wLineWidth.getText());
    fixedInputMeta.setBufferSize(wBufferSize.getText());
    fixedInputMeta.setLazyConversionActive(wLazyConversion.getSelection());
    fixedInputMeta.setHeaderPresent(wHeaderPresent.getSelection());
    fixedInputMeta.setLineFeedPresent(wLineFeedPresent.getSelection());
    fixedInputMeta.setRunningInParallel(wRunningInParallel.getSelection());
    fixedInputMeta.setFileType(FixedInputMeta.getFileType(wFileType.getText()));
    fixedInputMeta.setEncoding(wEncoding.getText());
    fixedInputMeta.setAddResultFile(wAddResult.getSelection());

    int nrNonEmptyFields = wFields.nrNonEmpty();
    fixedInputMeta.allocate(nrNonEmptyFields);

    for (int i = 0; i < nrNonEmptyFields; i++) {
      TableItem item = wFields.getNonEmpty(i);
      int colnr = 1;

      FixedFileInputField field = new FixedFileInputField();

      field.setName(item.getText(colnr++));
      field.setType(ValueMetaFactory.getIdForValueMeta(item.getText(colnr++)));
      field.setFormat(item.getText(colnr++));
      field.setWidth(Const.toInt(item.getText(colnr++), -1));
      field.setLength(Const.toInt(item.getText(colnr++), -1));
      field.setPrecision(Const.toInt(item.getText(colnr++), -1));
      field.setCurrency(item.getText(colnr++));
      field.setDecimal(item.getText(colnr++));
      field.setGrouping(item.getText(colnr++));
      field.setTrimType(ValueMetaString.getTrimTypeByDesc(item.getText(colnr++)));

      // CHECKSTYLE:Indentation:OFF
      fixedInputMeta.getFieldDefinition()[i] = field;
    }
    wFields.removeEmptyRows();
    wFields.setRowNums();
    wFields.optWidth(true);

    fixedInputMeta.setChanged();
  }
예제 #2
0
  /** Copy information from the meta-data input to the dialog fields. */
  public void getData() {
    wStepname.setText(stepname);
    wFilename.setText(Const.NVL(inputMeta.getFilename(), ""));
    wLineWidth.setText(Const.NVL(inputMeta.getLineWidth(), ""));
    wLineFeedPresent.setSelection(inputMeta.isLineFeedPresent());
    wBufferSize.setText(Const.NVL(inputMeta.getBufferSize(), ""));
    wLazyConversion.setSelection(inputMeta.isLazyConversionActive());
    wHeaderPresent.setSelection(inputMeta.isHeaderPresent());
    wRunningInParallel.setSelection(inputMeta.isRunningInParallel());
    wFileType.setText(inputMeta.getFileTypeDesc());
    wEncoding.setText(Const.NVL(inputMeta.getEncoding(), ""));
    wAddResult.setSelection(inputMeta.isAddResultFile());

    for (int i = 0; i < inputMeta.getFieldDefinition().length; i++) {
      TableItem item = new TableItem(wFields.table, SWT.NONE);
      int colnr = 1;
      FixedFileInputField field = inputMeta.getFieldDefinition()[i];

      item.setText(colnr++, Const.NVL(field.getName(), ""));
      item.setText(colnr++, ValueMetaFactory.getValueMetaName(field.getType()));
      item.setText(colnr++, Const.NVL(field.getFormat(), ""));
      item.setText(colnr++, field.getWidth() >= 0 ? Integer.toString(field.getWidth()) : "");
      item.setText(colnr++, field.getLength() >= 0 ? Integer.toString(field.getLength()) : "");
      item.setText(
          colnr++, field.getPrecision() >= 0 ? Integer.toString(field.getPrecision()) : "");
      item.setText(colnr++, Const.NVL(field.getCurrency(), ""));
      item.setText(colnr++, Const.NVL(field.getDecimal(), ""));
      item.setText(colnr++, Const.NVL(field.getGrouping(), ""));
      item.setText(colnr++, ValueMetaString.getTrimTypeCode(field.getTrimType()));
    }
    wFields.removeEmptyRows();
    wFields.setRowNums();
    wFields.optWidth(true);

    enableFields();

    wStepname.selectAll();
    wStepname.setFocus();
  }