private void ok() {
    stepname = wStepname.getText(); // return value

    input.setXslFilename(wXSLFilename.getText());
    input.setResultfieldname(wResultField.getText());
    input.setFieldname(wField.getText());
    input.setXSLFileField(wXSLField.getText());
    input.setXSLFactory(wXSLTFactory.getText());

    input.setXSLField(wXSLFileField.getSelection());
    input.setXSLFieldIsAFile(wXSLFieldIsAFile.getSelection());
    int nrparams = wFields.nrNonEmpty();
    int nroutputprops = wOutputProperties.nrNonEmpty();
    input.allocate(nrparams, nroutputprops);

    if (isDebug()) {
      logDebug(
          BaseMessages.getString(PKG, "HTTPDialog.Log.FoundArguments", String.valueOf(nrparams)));
    }
    // CHECKSTYLE:Indentation:OFF
    for (int i = 0; i < nrparams; i++) {
      TableItem item = wFields.getNonEmpty(i);
      input.getParameterField()[i] = item.getText(1);
      input.getParameterName()[i] = item.getText(2);
    }
    // CHECKSTYLE:Indentation:OFF
    for (int i = 0; i < nroutputprops; i++) {
      TableItem item = wOutputProperties.getNonEmpty(i);
      input.getOutputPropertyName()[i] = item.getText(1);
      input.getOutputPropertyValue()[i] = item.getText(2);
    }
    dispose();
  }
  private void ok() {

    stepname = wStepname.getText();

    String formatKey = getFormatKey(wInputFormat.getText());
    input.setInputFormat(formatKey);

    List<GisInputFormatParameter> inputFormatParameters = new ArrayList<GisInputFormatParameter>();
    for (int i = 0; i < wParams.nrNonEmpty(); i++) {

      TableItem tableItem = wParams.getNonEmpty(i);

      String paramKey = getParamKey(formatKey, tableItem.getText(1));

      if (tableItem.getText(3) != null && !tableItem.getText(3).isEmpty()) {
        String value = getParamValueKey(formatKey, paramKey, tableItem.getText(3));
        inputFormatParameters.add(new GisInputFormatParameter(paramKey, value));
      } else {
        inputFormatParameters.add(new GisInputFormatParameter(paramKey, ""));
      }
    }

    input.setInputFormatParameters(inputFormatParameters);
    input.setInputFileName(wFileName.getText());
    input.setGeometryFieldName(wGeometryField.getText());
    input.setEncoding(wEncoding.getText());
    input.setRowLimit(Long.valueOf(wRowLimit.getText()));
    dispose();
  }
  private void getInfo(StepsMetricsMeta in) {
    stepname = wStepname.getText(); // return value
    int nrsteps = wFields.nrNonEmpty();
    in.allocate(nrsteps);
    for (int i = 0; i < nrsteps; i++) {
      TableItem ti = wFields.getNonEmpty(i);
      StepMeta tm = transMeta.findStep(ti.getText(1));
      // CHECKSTYLE:Indentation:OFF
      if (tm != null) {
        in.getStepName()[i] = tm.getName();
        in.getStepCopyNr()[i] = "" + Const.toInt(ti.getText(2), 0);
        in.getStepRequired()[i] = in.getRequiredStepsCode(ti.getText(3));
      }
    }

    in.setStepNameFieldName(wStepnameField.getText());
    in.setStepIdFieldName(wStepidField.getText());
    in.setStepLinesInputFieldName(wLinesinputField.getText());
    in.setStepLinesOutputFieldName(wLinesoutputField.getText());
    in.setStepLinesReadFieldName(wLinesreadField.getText());
    in.setStepLinesWrittenFieldName(wLineswrittenField.getText());
    in.setStepLinesUpdatedFieldName(wLinesupdatedField.getText());
    in.setStepLinesErrorsFieldName(wLineserrorsField.getText());
    in.setStepSecondsFieldName(wSecondsField.getText());
  }
  private void getInfo(LucidDBBulkLoaderMeta inf) {
    int nrfields = wReturn.nrNonEmpty();

    inf.allocate(nrfields);

    inf.setMaxErrors(Const.toInt(wMaxErrors.getText(), 0));

    logDebug(
        BaseMessages.getString(
            PKG,
            "LucidDBBulkLoaderDialog.Log.FoundFields",
            "" + nrfields)); // $NON-NLS-1$ //$NON-NLS-2$
    for (int i = 0; i < nrfields; i++) {
      TableItem item = wReturn.getNonEmpty(i);
      inf.getFieldTable()[i] = item.getText(1);
      inf.getFieldStream()[i] = item.getText(2);
      inf.getFieldFormatOk()[i] = "Y".equalsIgnoreCase(item.getText(3));
    }

    inf.setSchemaName(wSchema.getText());
    inf.setTableName(wTable.getText());
    inf.setDatabaseMeta(transMeta.findDatabase(wConnection.getText()));
    inf.setFifoDirectory(wFifoPath.getText());
    inf.setFifoServerName(wFifoServer.getText());

    stepname = wStepname.getText(); // return value
  }
  private void ok() {
    if (Const.isEmpty(wStepname.getText())) {
      return;
    }

    List<StreamInterface> infoStreams = input.getStepIOMeta().getInfoStreams();
    infoStreams.get(0).setStepMeta(transMeta.findStep(wReference.getText()));
    infoStreams.get(1).setStepMeta(transMeta.findStep(wCompare.getText()));
    input.setFlagField(wFlagfield.getText());

    int nrKeys = wKeys.nrNonEmpty();
    int nrValues = wValues.nrNonEmpty();

    input.allocate(nrKeys, nrValues);

    // CHECKSTYLE:Indentation:OFF
    for (int i = 0; i < nrKeys; i++) {
      TableItem item = wKeys.getNonEmpty(i);
      input.getKeyFields()[i] = item.getText(1);
    }

    // CHECKSTYLE:Indentation:OFF
    for (int i = 0; i < nrValues; i++) {
      TableItem item = wValues.getNonEmpty(i);
      input.getValueFields()[i] = item.getText(1);
    }

    stepname = wStepname.getText(); // return value

    dispose();
  }
  private void getInfo(IngresVectorwiseLoaderMeta input) {
    input.setDatabaseMeta(transMeta.findDatabase(serverConnection.getText()));
    input.setTablename(wTable.getText());
    input.setFifoFileName(wFifoFile.getText());
    input.setSqlPath(wSqlPath.getText());
    input.setUseSSV(wUseSSV.getSelection());
    input.setEscapingSpecialCharacters(wEscapeSpecialChars.getSelection());
    input.setUsingVwload(wUseVwload.getSelection());
    input.setUseAuthentication(wUseAuthentication.getSelection());
    input.setTruncatingTable(wTruncateTable.getSelection());
    input.setDelimiter(wDelimiter.getText());
    input.setEncoding(wCharSet.getText());
    input.setBufferSize(wBufferSize.getText());
    input.setUseStandardConversion(wUseStandardConversion.getSelection());
    input.setContinueOnError(wContinueOnError.getSelection());
    input.setErrorFileName(wErrorFile.getText());
    input.setUseDynamicVNode(wUseDynamicVNode.getSelection());
    input.setMaxNrErrors(wMaxErrors.getText());

    int nrRows = wFields.nrNonEmpty();
    input.allocate(nrRows);
    // CHECKSTYLE:Indentation:OFF
    for (int i = 0; i < nrRows; i++) {
      TableItem item = wFields.getNonEmpty(i);
      input.getFieldDatabase()[i] = Const.NVL(item.getText(1), "");
      input.getFieldStream()[i] = Const.NVL(item.getText(2), "");
    }
  }
示例#7
0
  /*
   * (non-Javadoc)
   *
   * @see
   * org.eclipse.swt.events.SelectionListener#widgetSelected(org.eclipse.swt
   * .events.SelectionEvent)
   */
  public void widgetSelected(final SelectionEvent e) {
    ErlLogger.debug("widgetSelected: e.item = " + e.item);
    ErlLogger.debug("widgetSelected: e.widget = " + e.widget);

    if (e.widget == removeFunctionBtn) {
      final TableItem itemsToRemove[] = fTable.getSelection();
      for (final TableItem element : itemsToRemove) {
        fTable.remove(fTable.indexOf(element));
        if (element == fEditingItem) {
          fEditingItem = null;
        }
      }

    } else if (e.widget == editFunctionBtn) {
      if (fEditingItem != null) {
        removeEdit();
      }
      final int selectedIndex = fTable.getSelectionIndex();
      final TableItem selectedItem = fTable.getItem(selectedIndex);
      if (!"".equals(selectedItem.getText(0))) {
        fEditingItem = selectedItem;
        functionNameText.setText(selectedItem.getText(0));
        arityText.setText(selectedItem.getText(1));
        exportButtonBtn.setSelection(selectedItem.getChecked());
        fEditingItem.setText(0, selectedItem.getText(0) + "<<Being Edited>>");
      }
      // } else if (e.widget == addState) {

    }
    dialogChanged();
  }
示例#8
0
 /** TODO Write description of dialogChanged in FunctionGroup. */
 void dialogChanged() {
   if (functionNameText.getText().length() != 0) {
     final TableItem allTableItems[] = fTable.getItems();
     for (final TableItem element : allTableItems) {
       if (element.getText(0).equals(functionNameText.getText())
           && element.getText(1).equals(arityText.getText())) {
         updateStatus("Function already exists!");
         return;
       }
     }
     // check to see if this is a valid function name
     final int functionNameASCII = functionNameText.getText().charAt(0);
     if (!(functionNameASCII >= 'a' && functionNameASCII <= 'z') && functionNameASCII != '\'') {
       updateStatus("Function name has to be a valid erlang atom.");
       return;
     }
     try {
       Integer.parseInt(arityText.getText());
     } catch (final NumberFormatException e) {
       updateStatus("The arity has to be an integer number.");
       return;
     }
     updateStatus(null);
   } else {
     updateStatus(null);
     addFunctionBtn.setEnabled(false);
   }
 }
  private void ok() {
    if (Const.isEmpty(wStepname.getText())) {
      return;
    }

    int sizegroup = wGroup.nrNonEmpty();
    int nrfields = wAgg.nrNonEmpty();

    input.setAlwaysGivingBackOneRow(wAlwaysAddResult.getSelection());

    input.allocate(sizegroup, nrfields);

    // CHECKSTYLE:Indentation:OFF
    for (int i = 0; i < sizegroup; i++) {
      TableItem item = wGroup.getNonEmpty(i);
      input.getGroupField()[i] = item.getText(1);
    }

    // CHECKSTYLE:Indentation:OFF
    for (int i = 0; i < nrfields; i++) {
      TableItem item = wAgg.getNonEmpty(i);
      input.getAggregateField()[i] = item.getText(1);
      input.getSubjectField()[i] = item.getText(2);
      input.getAggregateType()[i] = MemoryGroupByMeta.getType(item.getText(3));
      input.getValueField()[i] = item.getText(4);
    }

    stepname = wStepname.getText();

    dispose();
  }
示例#10
0
  /** Export the selected values from the table to a csv file */
  private void export() {

    FileDialog dialog = new FileDialog(shell, SWT.SAVE);
    String[] filterNames = new String[] {"CSV Files", "All Files (*)"};
    String[] filterExtensions = new String[] {"*.csv;", "*"};
    String filterPath = "/";
    String platform = SWT.getPlatform();
    if (platform.equals("win32") || platform.equals("wpf")) {
      filterNames = new String[] {"CSV Files", "All Files (*.*)"};
      filterExtensions = new String[] {"*.csv", "*.*"};
      filterPath = "c:\\";
    }
    dialog.setFilterNames(filterNames);
    dialog.setFilterExtensions(filterExtensions);
    dialog.setFilterPath(filterPath);
    try {
      dialog.setFileName(this.getCurrentKey() + ".csv");
    } catch (Exception e) {
      dialog.setFileName("export.csv");
    }
    String fileName = dialog.open();

    FileOutputStream fos;
    OutputStreamWriter out;
    try {
      fos = new FileOutputStream(fileName);
      out = new OutputStreamWriter(fos, "UTF-8");
    } catch (Exception e) {
      MessageBox messageBox = new MessageBox(shell, SWT.OK | SWT.ICON_ERROR);
      messageBox.setMessage("Error creating export file " + fileName + " : " + e.getMessage());
      messageBox.open();
      return;
    }

    Vector<TableItem> sel = new Vector<TableItem>(this.dataTable.getSelection().length);

    sel.addAll(Arrays.asList(this.dataTable.getSelection()));
    Collections.reverse(sel);

    for (TableItem item : sel) {
      String date = item.getText(0);
      String value = item.getText(1);
      try {
        out.write(date + ";" + value + "\n");
      } catch (IOException e) {
        continue;
      }
    }

    try {
      out.close();
      fos.close();
    } catch (IOException e) {
      MessageBox messageBox = new MessageBox(shell, SWT.OK | SWT.ICON_ERROR);
      messageBox.setMessage("Error writing export file " + fileName + " : " + e.getMessage());
      messageBox.open();
      e.printStackTrace();
    }
  }
  private void ok() {
    if (Utils.isEmpty(wStepname.getText())) {
      return;
    }

    input.setMainStreamField(wMainStreamField.getText());
    input.setLookupField(wLookupField.getText());

    input.setAlgorithmType(FuzzyMatchMeta.getAlgorithmTypeByDesc(wAlgorithm.getText()));
    input.setCaseSensitive(wcaseSensitive.getSelection());
    input.setGetCloserValue(wgetCloserValue.getSelection());
    input.setMaximalValue(wmaxValue.getText());
    input.setMinimalValue(wminValue.getText());

    input.setOutputMatchField(wmatchField.getText());
    input.setOutputValueField(wvalueField.getText());
    input.setSeparator(wseparator.getText());

    int nrvalues = wReturn.nrNonEmpty();
    input.allocate(nrvalues);
    if (isDebug()) {
      logDebug(BaseMessages.getString(PKG, "FuzzyMatchDialog.Log.FoundFields", nrvalues + ""));
    }
    // CHECKSTYLE:Indentation:OFF
    for (int i = 0; i < nrvalues; i++) {
      TableItem item = wReturn.getNonEmpty(i);
      input.getValue()[i] = item.getText(1);
      input.getValueName()[i] = item.getText(2);
      if (input.getValueName()[i] == null || input.getValueName()[i].length() == 0) {
        input.getValueName()[i] = input.getValue()[i];
      }
    }

    StreamInterface infoStream = input.getStepIOMeta().getInfoStreams().get(0);
    infoStream.setStepMeta(transMeta.findStep(wStep.getText()));
    if (infoStream.getStepMeta() == null) {
      MessageBox mb = new MessageBox(shell, SWT.OK | SWT.ICON_ERROR);
      if (Utils.isEmpty(wStep.getText())) {
        mb.setMessage(
            BaseMessages.getString(
                PKG, "FuzzyMatchDialog.NotStepSpecified.DialogMessage", wStep.getText()));
      } else {
        mb.setMessage(
            BaseMessages.getString(
                PKG, "FuzzyMatchDialog.StepCanNotFound.DialogMessage", wStep.getText()));
      }

      mb.setText(BaseMessages.getString(PKG, "FuzzyMatchDialog.StepCanNotFound.DialogTitle"));
      mb.open();
    }

    stepname = wStepname.getText(); // return value

    dispose();
  }
  public void getInfo(SasInputMeta meta) throws KettleStepException {
    // copy info to Meta class (input)
    meta.setAcceptingField(wAccField.getText());

    int nrNonEmptyFields = wFields.nrNonEmpty();
    meta.getOutputFields().clear();

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

      int colnr = 1;
      SasInputField field = new SasInputField();
      field.setName(item.getText(colnr++));
      field.setRename(item.getText(colnr++));
      if (Const.isEmpty(field.getRename())) {
        field.setRename(field.getName());
      }
      field.setType(ValueMeta.getType(item.getText(colnr++)));
      field.setConversionMask(item.getText(colnr++));
      field.setLength(Const.toInt(item.getText(colnr++), -1));
      field.setPrecision(Const.toInt(item.getText(colnr++), -1));
      field.setDecimalSymbol(item.getText(colnr++));
      field.setGroupingSymbol(item.getText(colnr++));
      field.setTrimType(ValueMeta.getTrimTypeByDesc(item.getText(colnr++)));

      meta.getOutputFields().add(field);
    }
    wFields.removeEmptyRows();
    wFields.setRowNums();
    wFields.optWidth(true);
  }
 private void updateSelectedRolesFromServer(Event event) {
   syncInlineRolesWithSelectedRoles();
   if (event.detail == SWT.CHECK) {
     TableItem selectedRole = (TableItem) event.item;
     if (selectedRole.getChecked() && !selectedRoles.contains(selectedRole.getText(0).trim())) {
       selectedRoles.add(selectedRole.getText(0).trim());
     } else if (!selectedRole.getChecked()
         && selectedRoles.contains(selectedRole.getText(0).trim())) {
       selectedRoles.remove(selectedRole.getText(0).trim());
     }
     updateUserRolesInLine();
   }
 }
  protected void getInfoVariables() {
    Map<String, String> map = new HashMap<String, String>();
    int nrNonEmptyVariables = wVariables.nrNonEmpty();
    for (int i = 0; i < nrNonEmptyVariables; i++) {
      TableItem tableItem = wVariables.getNonEmpty(i);
      String varName = tableItem.getText(1);
      String varValue = tableItem.getText(2);

      if (!Const.isEmpty(varName)) {
        map.put(varName, varValue);
      }
    }
    configuration.setVariables(map);
  }
    public void applyChanges() {

      int nrLines = wMappingParameters.nrNonEmpty();
      String variables[] = new String[nrLines];
      String inputFields[] = new String[nrLines];
      parameters.setVariable(variables);
      parameters.setInputField(inputFields);
      for (int i = 0; i < nrLines; i++) {
        TableItem item = wMappingParameters.getNonEmpty(i);
        parameters.getVariable()[i] = item.getText(1);
        parameters.getInputField()[i] = item.getText(2);
      }
      parameters.setInheritingAllVariables(wInheritAll.getSelection());
    }
  private void getInfoArguments() {
    Map<String, String> map = new HashMap<String, String>();
    int nrNonEmptyArguments = wArguments.nrNonEmpty();
    for (int i = 0; i < nrNonEmptyArguments; i++) {
      TableItem tableItem = wArguments.getNonEmpty(i);
      String varName = tableItem.getText(1);
      String varValue = tableItem.getText(2);

      if (!Const.isEmpty(varName)) {
        map.put(varName, varValue);
      }
    }
    configuration.setArguments(map);
  }
 /** Move the selected column up or down of a position */
 @Override
 public void widgetSelected(SelectionEvent e) {
   int index = orderTable.getSelectionIndex();
   int substitutionIndex = 0;
   if (actionUp) substitutionIndex = index - 1;
   else substitutionIndex = index + 1;
   TableItem substitutionItem = orderTable.getItem(substitutionIndex);
   String temp = substitutionItem.getText();
   TableItem originalItem = orderTable.getItem(index);
   substitutionItem.setText(originalItem.getText());
   originalItem.setText(temp);
   orderTable.setSelection(substitutionIndex);
   changeButtonSelectionState(substitutionIndex);
 }
  private void ok() {
    if (Const.isEmpty(wStepname.getText())) return;

    int nrheaders = wFields.nrNonEmpty();
    int nrparams = wParameters.nrNonEmpty();
    input.allocate(nrheaders, nrparams);

    if (isDebug())
      logDebug(
          BaseMessages.getString(
              PKG,
              "RestDialog.Log.FoundArguments",
              String.valueOf(nrheaders))); // $NON-NLS-1$ //$NON-NLS-2$
    for (int i = 0; i < nrheaders; i++) {
      TableItem item = wFields.getNonEmpty(i);
      input.getHeaderField()[i] = item.getText(1);
      input.getHeaderName()[i] = item.getText(2);
    }
    for (int i = 0; i < nrparams; i++) {
      TableItem item = wParameters.getNonEmpty(i);
      input.getParameterField()[i] = item.getText(1);
      input.getParameterName()[i] = item.getText(2);
    }

    input.setDynamicMethod(wMethodInField.getSelection());
    input.setMethodFieldName(wMethodField.getText());
    input.setMethod(wMethod.getText());
    input.setUrl(wUrl.getText());
    input.setUrlField(wUrlField.getText());
    input.setUrlInField(wUrlInField.getSelection());
    input.setBodyField(wBody.getText());
    input.setFieldName(wResult.getText());
    input.setResultCodeFieldName(wResultCode.getText());
    input.setResponseTimeFieldName(wResponseTime.getText());

    input.setHttpLogin(wHttpLogin.getText());
    input.setHttpPassword(wHttpPassword.getText());
    input.setProxyHost(wProxyHost.getText());
    input.setProxyPort(wProxyPort.getText());
    input.setPreemptive(wPreemptive.getSelection());

    input.setTrustStoreFile(wTrustStoreFile.getText());
    input.setTrustStorePassword(wTrustStorePassword.getText());
    input.setApplicationType(wApplicationType.getText());
    stepname = wStepname.getText(); // return value

    dispose();
  }
示例#19
0
  private void ok() {
    if (Const.isEmpty(wStepname.getText())) return;

    stepname = wStepname.getText(); // return value
    // Table table = wFields.table;

    int count = wFields.nrNonEmpty();
    input.allocate(count);

    for (int i = 0; i < count; i++) {
      TableItem item = wFields.getNonEmpty(i);
      input.getFieldName()[i] = item.getText(1);
      input.getFieldValue()[i] = item.getText(2);
    }
    dispose();
  }
 private void initTreeNavigatorNodes() {
   List<String> selectedNames = new ArrayList<String>();
   EList<SalesforceModuleUnit> modules = temConnection.getModules();
   // EList<SalesforceModuleUnit> modules = getConnection().getModules();
   for (int i = 0; i < modules.size(); i++) {
     if (modules.get(i).getModuleName().equals(moduleName)) {
       for (int j = 0; j < modules.get(i).getTables().size(); j++) {
         selectedNames.add(modules.get(i).getTables().get(j).getLabel());
       }
       break;
     }
   }
   tableNavigator.removeAll();
   TableItem subItem = null;
   String lastSelectName = null;
   if (selectedNames != null && selectedNames.size() >= 1) {
     for (int i = 0; i < selectedNames.size(); i++) {
       subItem = new TableItem(tableNavigator, SWT.NULL);
       subItem.setText(selectedNames.get(i));
       lastSelectName = selectedNames.get(i);
     }
     metadataNameText.setText(subItem.getText());
     tableNavigator.setSelection(subItem);
     metadataTable = getTableByLabel(lastSelectName);
   } else {
     subItem = new TableItem(tableNavigator, SWT.NULL);
     subItem.setText(moduleName);
   }
   metadataEditor.setMetadataTable(metadataTable);
 }
示例#21
0
  public static void sortTable(Table table, Comparator<TableItem> comparator) {
    int columnCount = table.getColumnCount();
    String[] values = new String[columnCount];
    TableItem[] items = table.getItems();
    for (int i = 1; i < items.length; i++) {
      for (int j = 0; j < i; j++) {
        TableItem item = items[i];
        if (comparator.compare(item, items[j]) < 0) {
          for (int k = 0; k < columnCount; k++) {
            values[k] = item.getText(k);
          }
          Object data = item.getData();
          boolean checked = item.getChecked();
          item.dispose();

          item = new TableItem(table, SWT.NONE, j);
          item.setText(values);
          item.setData(data);
          item.setChecked(checked);
          items = table.getItems();
          break;
        }
      }
    }
  }
示例#22
0
  private void ok() {
    if (Const.isEmpty(wStepname.getText())) return;

    stepname = wStepname.getText(); // return value
    // copy info to TextFileInputMeta class (input)
    input.setSql(wSQL.getText());
    input.setDatabaseMeta(transMeta.findDatabase(wConnection.getText()));
    input.setExecutedEachInputRow(wEachRow.getSelection());
    input.setSingleStatement(wSingleStatement.getSelection());
    input.setVariableReplacementActive(wVariables.getSelection());
    input.setQuoteString(wQuoteString.getSelection());
    input.setParams(wSetParams.getSelection());
    input.setInsertField(wInsertField.getText());
    input.setUpdateField(wUpdateField.getText());
    input.setDeleteField(wDeleteField.getText());
    input.setReadField(wReadField.getText());

    int nrargs = wFields.nrNonEmpty();
    input.allocate(nrargs);
    if (log.isDebug())
      logDebug(BaseMessages.getString(PKG, "ExecSQLDialog.Log.FoundArguments", +nrargs + ""));
    for (int i = 0; i < nrargs; i++) {
      TableItem item = wFields.getNonEmpty(i);
      input.getArguments()[i] = item.getText(1);
    }

    if (input.getDatabaseMeta() == null) {
      MessageBox mb = new MessageBox(shell, SWT.OK | SWT.ICON_ERROR);
      mb.setMessage(BaseMessages.getString(PKG, "ExecSQLDialog.InvalidConnection.DialogMessage"));
      mb.setText(BaseMessages.getString(PKG, "ExecSQLDialog.InvalidConnection.DialogTitle"));
      mb.open();
    }

    dispose();
  }
示例#23
0
 public String[] getValues(TableItem item) {
   String[] result = new String[values];
   for (int i = 0; i < values; i++) {
     result[i] = item.getText(i);
   }
   return result;
 }
示例#24
0
 public String getText(TableItem item, int column) {
   if (column == 2) {
     return ((CCombo) combosTable.get(item)).getText();
   } else {
     return item.getText(column);
   }
 }
  private void getInfo(RandomCCNumberGeneratorMeta in) throws KettleException {

    stepname = wStepname.getText(); // return value
    int count = wFields.nrNonEmpty();
    in.allocate(count);

    for (int i = 0; i < count; i++) {
      TableItem item = wFields.getNonEmpty(i);
      in.getFieldCCType()[i] = item.getText(1);
      in.getFieldCCLength()[i] = item.getText(2);
      in.getFieldCCSize()[i] = item.getText(3);
    }
    in.setCardNumberFieldName(wCCNumberField.getText());
    in.setCardTypeFieldName(wCCTypeField.getText());
    in.setCardLengthFieldName(wCCLengthField.getText());
  }
示例#26
0
  private void populateTableWithTupleTemplate() {
    Table table = m_fieldsView.table;

    Set<String> existingRowAliases = new HashSet<String>();
    for (int i = 0; i < table.getItemCount(); i++) {
      TableItem tableItem = table.getItem(i);
      String alias = tableItem.getText(1);
      if (!Const.isEmpty(alias)) {
        existingRowAliases.add(alias);
      }
    }

    int choice = 0;
    if (existingRowAliases.size() > 0) {
      // Ask what we should do with existing mapping data
      MessageDialog md =
          new MessageDialog(
              m_shell,
              Messages.getString("MappingDialog.GetFieldsChoice.Title"),
              null,
              Messages.getString(
                  "MappingDialog.GetFieldsChoice.Message", "" + existingRowAliases.size(), "" + 5),
              MessageDialog.WARNING,
              new String[] {
                Messages.getString("MappingOutputDialog.ClearAndAdd"),
                Messages.getString("MappingOutputDialog.Cancel"),
              },
              0);
      MessageDialog.setDefaultImage(GUIResource.getInstance().getImageSpoon());
      int idx = md.open();
      choice = idx & 0xFF;
    }

    if (choice == 1 || choice == 255 /* 255 = escape pressed */) {
      return; // Cancel
    }

    m_fieldsView.clearAll();
    TableItem item = new TableItem(table, SWT.NONE);
    item.setText(1, "KEY");
    item.setText(2, "Y");
    item = new TableItem(table, SWT.NONE);
    item.setText(1, "Family");
    item.setText(2, "N");
    item.setText(5, "String");
    item = new TableItem(table, SWT.NONE);
    item.setText(1, "Column");
    item.setText(2, "N");
    item = new TableItem(table, SWT.NONE);
    item.setText(1, "Value");
    item.setText(2, "N");
    item = new TableItem(table, SWT.NONE);
    item.setText(1, "Timestamp");
    item.setText(2, "N");
    item.setText(5, "Long");

    m_fieldsView.removeEmptyRows();
    m_fieldsView.setRowNums();
    m_fieldsView.optWidth(true);
  }
示例#27
0
  private boolean findMatch(
      String searchString, TableItem item, int column, boolean matchWord, boolean matchCase) {

    String tableText = matchCase ? item.getText(column) : item.getText(column).toLowerCase();
    if (matchWord) {
      if (tableText != null && tableText.equals(searchString)) {
        return true;
      }

    } else {
      if (tableText != null && tableText.indexOf(searchString) != -1) {
        return true;
      }
    }
    return false;
  }
示例#28
0
  private void ok() {
    if (Const.isEmpty(wStepname.getText())) {
      return;
    }

    stepname = wStepname.getText(); // return value

    if (transMeta.findDatabase(wConnection.getText()) == null) {
      int answer = showDatabaseWarning(true);
      if (answer == SWT.CANCEL) {
        return;
      }
    }

    // check tablecount
    Set<String> tables = new HashSet<String>();
    int nrParameters = wOutput.nrNonEmpty();
    for (int i = 0; i < nrParameters; i++) {
      TableItem item = wOutput.getNonEmpty(i);
      String tableName = item.getText(3);
      tables.add(tableName);
    }
    if (tables.size() > 1) {
      int answer = showMultipleOutputTablesWarning(true);
      if (answer == SWT.CANCEL) {
        return;
      }
    }

    getInfo(input);

    dispose();
  }
示例#29
0
 /**
  * Method launchReport.
  *
  * @param item TableItem
  */
 private void launchReport(TableItem item) {
   try {
     GenericReportGui g = reportGUIs.get(item.getText());
     g.openShell();
   } catch (Exception e) {
     getLog().error(e.getMessage(), e);
   }
 }
  /** Get the parameters from the dialog. */
  protected void getInfoParameters() {
    Map<String, String> map = new HashMap<String, String>();
    int nrNonEmptyVariables = wParams.nrNonEmpty();
    for (int i = 0; i < nrNonEmptyVariables; i++) {
      TableItem tableItem = wParams.getNonEmpty(i);
      String paramName = tableItem.getText(1);
      String defaultValue = tableItem.getText(2);
      String paramValue = tableItem.getText(3);

      if (Const.isEmpty(paramValue)) {
        paramValue = Const.NVL(defaultValue, "");
      }

      map.put(paramName, paramValue);
    }
    configuration.setParams(map);
  }