private void fillStoredData() {

    if (stepname != null) textStepName.setText(stepname);

    int index =
        addConnectionLine.indexOf(
            meta.getDatabaseMeta() != null ? meta.getDatabaseMeta().getName() : "");
    if (index >= 0) addConnectionLine.select(index);

    if (meta.getDimension() != null) {
      comboDimension.add(meta.getDimension());
      comboDimension.select(0);
    }

    buttonBaseElementsOnly.setSelection(meta.getBaseElementsOnly());

    tableViewFields.table.removeAll();
    if (meta.getLevels().size() > 0) {
      for (PaloDimensionLevel level : meta.getLevels()) {
        tableViewFields.add(
            level.getLevelName(),
            String.valueOf(level.getLevelNumber()),
            level.getFieldName(),
            level.getFieldType());
      }
      tableViewFields.setRowNums();
      tableViewFields.optWidth(true);
    }
  }
 private void doGetLevels() {
   if (buttonBaseElementsOnly.getSelection()) {
     tableViewFields.table.removeAll();
     tableViewFields.add(
         BaseMessages.getString(PKG, "PaloDimInputDialog.BaseElementName"),
         "0",
         comboDimension.getText(),
         "String");
   } else if (comboDimension.getText() != null && comboDimension.getText() != "") {
     try {
       if (addConnectionLine.getText() != null) {
         DatabaseMeta dbMeta = transMeta.findDatabase(addConnectionLine.getText());
         if (dbMeta != null) {
           PaloDimInputData data = new PaloDimInputData(dbMeta);
           tableViewFields.table.removeAll();
           data.helper.connect();
           List<PaloDimensionLevel> levels =
               data.helper.getDimensionLevels(comboDimension.getText());
           for (int i = 0; i < levels.size(); i++) {
             PaloDimensionLevel level = levels.get(i);
             tableViewFields.add(
                 level.getLevelName(),
                 String.valueOf(level.getLevelNumber()),
                 level.getFieldName());
           }
           tableViewFields.setRowNums();
           tableViewFields.optWidth(true);
           data.helper.disconnect();
         }
       }
     } catch (Exception ex) {
       new ErrorDialog(
           shell,
           BaseMessages.getString("System.Dialog.GetFieldsFailed.Title"),
           BaseMessages.getString("System.Dialog.GetFieldsFailed.Message"),
           ex);
     }
   } else {
     new ErrorDialog(
         shell,
         BaseMessages.getString("System.Dialog.GetFieldsFailed.Title"),
         BaseMessages.getString("System.Dialog.GetFieldsFailed.Message"),
         new Exception(
             BaseMessages.getString(PKG, "PaloDimInputDialog.SelectDimensionFirstError")));
   }
 }
 public void getDatabases() {
   wFields.removeAll();
   for (int i = 0; i < jobMeta.nrDatabases(); i++) {
     DatabaseMeta ci = jobMeta.getDatabase(i);
     if (ci != null) {
       wFields.add(new String[] {ci.getName(), "0", JobEntryCheckDbConnections.unitTimeDesc[0]});
     }
   }
   wFields.removeEmptyRows();
   wFields.setRowNums();
   wFields.optWidth(true);
 }
  /**
   * Read the data from the GetFilesRowsCountMeta object and show it in this dialog.
   *
   * @param in The GetFilesRowsCountMeta object to obtain the data from.
   */
  public void getData(GetFilesRowsCountMeta in) {
    if (in.getFileName() != null) {
      wFilenameList.removeAll();
      for (int i = 0; i < in.getFileName().length; i++) {
        wFilenameList.add(
            new String[] {
              in.getFileName()[i],
              in.getFileMask()[i],
              in.getExludeFileMask()[i],
              in.getRequiredFilesDesc(in.getFileRequired()[i]),
              in.getRequiredFilesDesc(in.getIncludeSubFolders()[i])
            });
      }
      wFilenameList.removeEmptyRows();
      wFilenameList.setRowNums();
      wFilenameList.optWidth(true);
    }
    wInclFilesCount.setSelection(in.includeCountFiles());

    if (in.getFilesCountFieldName() != null) {
      wInclFilesCountField.setText(in.getFilesCountFieldName());
    } else {
      wInclFilesCountField.setText("filescount");
    }

    if (in.getRowsCountFieldName() != null) {
      wRowsCountField.setText(in.getRowsCountFieldName());
    } else {
      wRowsCountField.setText(GetFilesRowsCountMeta.DEFAULT_ROWSCOUNT_FIELDNAME);
    }

    if (in.getRowSeparatorFormat() != null) {
      // Checking for 'CR' for backwards compatibility
      if (in.getRowSeparatorFormat().equals("CARRIAGERETURN")
          || in.getRowSeparatorFormat().equals("CR")) {
        wRowSeparatorFormat.select(0);
      } else if (in.getRowSeparatorFormat().equals("LINEFEED")
          || in.getRowSeparatorFormat().equals("LF")) {
        // Checking for 'LF' for backwards compatibility
        wRowSeparatorFormat.select(1);
      } else if (in.getRowSeparatorFormat().equals("CRLF")) {
        wRowSeparatorFormat.select(2);
      } else if (in.getRowSeparatorFormat().equals("TAB")) {
        wRowSeparatorFormat.select(3);
      } else {
        wRowSeparatorFormat.select(4);
      }
    } else {
      wRowSeparatorFormat.select(0);
    }

    if (in.getRowSeparator() != null) {
      wRowSeparator.setText(in.getRowSeparator());
    }

    wAddResult.setSelection(in.isAddResultFile());
    wFileField.setSelection(in.isFileField());
    if (in.setOutputFilenameField() != null) {
      wFilenameField.setText(in.setOutputFilenameField());
    }

    logDebug(BaseMessages.getString(PKG, "GetFilesRowsCountDialog.Log.GettingFieldsInfo"));

    setIncludeRownum();

    wStepname.selectAll();
    wStepname.setFocus();
  }
  private void fillStoredData() {
    if (stepname != null) {
      textStepName.setText(stepname);
    }

    int index =
        addConnectionLine.indexOf(
            meta.getDatabaseMeta() != null ? meta.getDatabaseMeta().getName() : "");
    if (index >= 0) {
      addConnectionLine.select(index);
    }

    if (meta.getCube() != null) {
      comboCube.add(meta.getCube());
      comboCube.select(0);
    }

    for (PaloOption option : updateOptions) {
      comboUpdateMode.add(option.getDescription());
    }
    comboUpdateMode.select(
        comboUpdateMode.indexOf(this.updateOptions.getDescription(meta.getUpdateMode())));

    for (PaloOption option : splashOptions) {
      comboSplashMode.add(option.getDescription());
    }
    comboSplashMode.select(
        comboSplashMode.indexOf(this.splashOptions.getDescription(meta.getSplashMode())));

    textCommitSize.setText(String.valueOf(meta.getCommitSize()));
    buttonEnableDimensionCache.setSelection(meta.getEnableDimensionCache());
    buttonPreloadDimensionCache.setSelection(meta.getPreloadDimensionCache());
    buttonPreloadDimensionCache.setEnabled(buttonEnableDimensionCache.getSelection());

    comboMeasureType.setItems(new String[] {"Numeric", "String"});
    comboMeasureType.select(0);
    if (meta.getMeasureType() != null) {
      int indexType = comboMeasureType.indexOf(meta.getMeasureType());
      if (indexType >= 0) {
        comboMeasureType.select(indexType);
      }
    }

    tableViewFields.table.removeAll();

    if (meta.getFields().size() > 0) {
      for (DimensionField level : meta.getFields()) {
        tableViewFields.add(level.getDimensionName(), level.getFieldName());
      }
    }

    List<String> fieldNameList = null;
    try {
      RowMetaInterface r = transMeta.getPrevStepFields(stepname);
      fieldNameList = Arrays.asList(r.getFieldNames());
      Collections.sort(fieldNameList);
    } catch (Exception e) {
      // ignore
    }
    tableViewFields.setColumnInfo(
        1,
        new ColumnInfo(
            "Field",
            ColumnInfo.COLUMN_TYPE_CCOMBO,
            (fieldNameList == null ? null : fieldNameList.toArray(new String[0])),
            true));

    if (meta.getMeasure() != null) {
      final TableItem item = new TableItem(tableViewFields.table, SWT.NONE);
      item.setText(1, meta.getMeasure().getDimensionName());
      item.setText(2, meta.getMeasure().getFieldName());
      // item.setText(3,meta.getMeasure().getFieldType());
      item.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_DARK_GREEN));
    }
    tableViewFields.setRowNums();
    tableViewFields.optWidth(true);

    buttonClearCube.setSelection(meta.getClearCube());
  }