@Override
  public void fill(Document document) {
    table.setRedraw(false);

    createTableColumns(document.getCustomIdentifiers());

    for (Iterator iterator = document.getParseMessages().iterator(); iterator.hasNext(); ) {
      ParseMessage parseMessage = (ParseMessage) iterator.next();

      TableItem item = new TableItem(table, SWT.NONE);

      Map<CustomIdentifier, Object> values = parseMessage.getCustomValues();
      int i = 0;
      for (CustomIdentifier customIdentifier : document.getCustomIdentifiers()) {
        if (values.containsKey(customIdentifier)) {
          Object value = values.get(customIdentifier);
          item.setText(i, (value == null ? "" : value.toString()));
        }
        i++;
      }

      item.setText(i, parseMessage.getSeverity());
      item.setText(i + 1, new Integer(parseMessage.getLineNumber()).toString());
      item.setText(i + 2, new Integer(parseMessage.getColumnNumber()).toString());
      item.setText(i + 3, parseMessage.getMessage());
    }
    table.setRedraw(true);
  }
  public void fillChains(Table table) {
    table.removeAll();
    if (_chains != null) {

      List list = _chains.getChildren("job_chain");
      _chainNames = new String[list.size()];
      int index = 0;
      Iterator it = list.iterator();
      while (it.hasNext()) {
        Element chain = (Element) it.next();
        String name = Utils.getAttributeValue("name", chain);
        TableItem item = new TableItem(table, SWT.NONE);

        // item.setChecked(sos.scheduler.editor.conf.listeners.DetailsListener.existDetailsParameter(null, name, null, _dom, update, true));
        if (sos.scheduler.editor.conf.listeners.DetailsListener.existDetailsParameter(
            null, name, null, _dom, update, true, null))
          item.setBackground(Options.getLightBlueColor());
        else item.setBackground(null);
        item.setText(0, name);
        item.setText(1, Utils.isAttributeValue("orders_recoverable", chain) ? "Yes" : "No");
        item.setText(2, Utils.isAttributeValue("visible", chain) ? "Yes" : "No");

        /*item.setText(0, name);
        item.setText(1, Utils.isAttributeValue("orders_recoverable", chain) ? "Yes" : "No");
        item.setText(2, Utils.isAttributeValue("visible", chain) ? "Yes" : "No");
        */
        if (!Utils.isElementEnabled("job_chain", _dom, chain)) {
          item.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_GRAY));
        }
        _chainNames[index++] = name;
      }
    }
  }
 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);
 }
Beispiel #4
0
 @Test
 public void testGetItemMetricsImageCutOffInSecondColumn() throws IOException {
   Image image = createImage(display, Fixture.IMAGE1);
   shell.setBounds(0, 0, 200, 200);
   shell.setLayout(new FillLayout());
   table.setHeaderVisible(true);
   TableColumn column = new TableColumn(table, SWT.NONE);
   column.setText("column1");
   column.setWidth(400);
   TableColumn column2 = new TableColumn(table, SWT.NONE);
   column2.setText("column2");
   column2.setWidth(30);
   ITableAdapter adapter = table.getAdapter(ITableAdapter.class);
   adapter.setLeftOffset(5);
   TableItem item1 = new TableItem(table, SWT.NONE);
   item1.setText("item1");
   TableItem item2 = new TableItem(table, SWT.NONE);
   item2.setText("item2");
   TableItem item3 = new TableItem(table, SWT.NONE);
   item3.setText("item3");
   item2.setImage(1, image);
   ItemMetrics[] metrics = TableLCA.getItemMetrics(table);
   assertEquals(403, metrics[1].imageLeft);
   assertEquals(27, metrics[1].imageWidth);
 }
  /** Copy information from the meta-data input to the dialog fields. */
  public void getData() {
    int i;
    logDebug(
        BaseMessages.getString(PKG, "LucidDBBulkLoaderDialog.Log.GettingKeyInfo")); // $NON-NLS-1$

    wMaxErrors.setText("" + input.getMaxErrors()); // $NON-NLS-1$

    if (input.getFieldTable() != null) {
      for (i = 0; i < input.getFieldTable().length; i++) {
        TableItem item = wReturn.table.getItem(i);
        if (input.getFieldTable()[i] != null) item.setText(1, input.getFieldTable()[i]);
        if (input.getFieldStream()[i] != null) item.setText(2, input.getFieldStream()[i]);
        item.setText(3, input.getFieldFormatOk()[i] ? "Y" : "N");
      }
    }

    if (input.getDatabaseMeta() != null) wConnection.setText(input.getDatabaseMeta().getName());
    else {
      if (transMeta.nrDatabases() == 1) {
        wConnection.setText(transMeta.getDatabase(0).getName());
      }
    }
    if (input.getSchemaName() != null) wSchema.setText(input.getSchemaName());
    if (input.getTableName() != null) wTable.setText(input.getTableName());
    if (input.getFifoDirectory() != null) wFifoPath.setText(input.getFifoDirectory());
    if (input.getFifoServerName() != null) wFifoServer.setText(input.getFifoServerName());

    wStepname.selectAll();
    wReturn.setRowNums();
    wReturn.optWidth(true);
  }
  /** Copy information from the meta-data input to the dialog fields. */
  public void getData() {
    wStepname.setText(stepname);

    for (int i = 0; i < input.getFieldCCType().length; i++) {
      TableItem item = wFields.table.getItem(i);
      String type = input.getFieldCCType()[i];
      String len = input.getFieldCCLength()[i];
      String size = input.getFieldCCSize()[i];

      if (type != null) item.setText(1, type);
      if (len != null) item.setText(2, len);
      if (size != null) item.setText(3, size);
    }

    wFields.setRowNums();
    wFields.optWidth(true);

    if (input.getCardNumberFieldName() != null)
      wCCNumberField.setText(input.getCardNumberFieldName());
    if (input.getCardTypeFieldName() != null) wCCTypeField.setText(input.getCardTypeFieldName());
    if (input.getCardLengthFieldName() != null)
      wCCLengthField.setText(input.getCardLengthFieldName());

    wStepname.selectAll();
  }
  protected void reload() {
    table.removeAll();
    MapPack mp = ServerDataProxy.getThreadDetail(threadid, serverId);

    String[] names = scouter.util.SortUtil.sort_string(mp.keys(), mp.size());
    for (int i = 0, j = 0; i < names.length; i++) {
      String key = names[i];
      Value value = mp.get(key);
      if ("Stack Trace".equals(key)) {
        stacktrace.setText(CastUtil.cString(value));
        //				JavaColor.setJavaCode(stacktrace, new Cast(value).cString());
        continue;
      }
      String text = null;
      TableItem ti = new TableItem(table, SWT.NONE, j++);
      if (value instanceof TextValue) {
        text = CastUtil.cString(value);
        ti.setText(0, key);
        ti.setText(1, text);
      } else {
        if (value instanceof DecimalValue) {
          text = FormatUtil.print(value, "#,##0");
        } else if (value instanceof DoubleValue || value instanceof FloatValue) {
          text = FormatUtil.print(value, "#,##0.0##");
        }
        ti.setText(new String[] {key, text});
      }
    }
  }
  private TableItem bindPublishEventAttribute(PublishEventMediatorAttribute attribute) {
    TableItem item = new TableItem(publishEventAttributeTable, SWT.NONE);
    if (attribute
        .getAttributeValueType()
        .getLiteral()
        .equals(AttributeValueType.STRING.getLiteral())) {
      item.setText(
          new String[] {
            attribute.getAttributeName(),
            attribute.getAttributeValue(),
            attribute.getAttributeValueType().getLiteral()
          });
    }
    if (attribute
        .getAttributeValueType()
        .getLiteral()
        .equals(AttributeValueType.EXPRESSION.getLiteral())) {
      item.setText(
          new String[] {
            attribute.getAttributeName(),
            attribute.getAttributeExpression().getPropertyValue(),
            attribute.getAttributeValueType().getLiteral()
          });
      item.setData(
          EXPRESSION_DATA,
          EsbFactory.eINSTANCE.copyNamespacedProperty(attribute.getAttributeExpression()));
    }

    item.setData(attribute);
    return item;
  }
  private void refreshAutomaticSearchTable() {

    sourceTable.removeAll();

    for (Search s : selectedLiteratureReview.getSearches()) {

      if (s instanceof AutomatedSearch) {
        AutomatedSearch as = (AutomatedSearch) s;
        this.QueryLabel.setText(as.getQueryString());

        /*TableItem generalItem = new TableItem (sourceTable, SWT.NONE);
        generalItem.setText(0, "ALL");
        generalItem.setText(1, String.valueOf(selectedLiteratureReview.getTotalFound()));
        generalItem.setText(2, String.valueOf(selectedLiteratureReview.getTotalFetched()));*/

        for (QueryInfo qi : as.getQueryInfos()) {
          TableItem item = new TableItem(sourceTable, SWT.NONE);
          item.setText(0, qi.getSource());
          item.setText(1, String.valueOf(qi.getTotalFound()));
          item.setText(2, String.valueOf(qi.getTotalFound()));
        }

        for (int i = 0; i < sourceTable.getColumnCount(); i++) {
          sourceTable.getColumn(i).pack();
        }
      }
    }
  }
  /**
   * Method updateComponents.
   *
   * @param aParticipant - R4EParticipant
   */
  private void updateComponents(R4EParticipant aParticipant) {
    // Add item to the participants table
    final TableItem item = new TableItem(fAddedParticipantsTable, SWT.NONE);
    item.setText(0, aParticipant.getId());
    if (null != aParticipant.getEmail() && !("".equals(aParticipant.getEmail()))) {
      item.setFont(JFaceResources.getFontRegistry().get(JFaceResources.DEFAULT_FONT));
      item.setText(1, aParticipant.getEmail());
    } else {
      // Mark table item as not complete
      item.setFont(JFaceResources.getFontRegistry().getItalic(JFaceResources.DEFAULT_FONT));
    }
    fAddedParticipantsTable.showItem(item);

    if (fParticipants.size() > 0) {
      fClearParticipantsButton.setEnabled(true);
      fRemoveUserButton.setEnabled(true);
      if (fUserToAddCombo instanceof CCombo) {
        ((CCombo) fUserToAddCombo).setText("");
      } else {
        ((Text) fUserToAddCombo).setText("");
      }
      getButton(IDialogConstants.OK_ID).setEnabled(true);
      getButton(IDialogConstants.OK_ID).setSelection(false);
    } else {
      if (fReviewSource) {
        getButton(IDialogConstants.OK_ID).setEnabled(false);
      }
    }
  }
  /** Copy information from the meta-data input to the dialog fields. */
  public void getData() {
    List<StreamInterface> infoStreams = input.getStepIOMeta().getInfoStreams();

    wReference.setText(Const.NVL(infoStreams.get(0).getStepname(), ""));
    wCompare.setText(Const.NVL(infoStreams.get(1).getStepname(), ""));
    if (input.getFlagField() != null) {
      wFlagfield.setText(input.getFlagField());
    }

    for (int i = 0; i < input.getKeyFields().length; i++) {
      TableItem item = wKeys.table.getItem(i);
      if (input.getKeyFields()[i] != null) {
        item.setText(1, input.getKeyFields()[i]);
      }
    }
    for (int i = 0; i < input.getValueFields().length; i++) {
      TableItem item = wValues.table.getItem(i);
      if (input.getValueFields()[i] != null) {
        item.setText(1, input.getValueFields()[i]);
      }
    }

    wStepname.selectAll();
    wStepname.setFocus();
  }
  // Edit the properties of the specified actuator
  public void editActuatorProperties(Display display) {
    ActuatorsPropertiesShell edit =
        new ActuatorsPropertiesShell(table.getItem(table.getSelectionIndex()), display);

    if (edit.isConfirm()) {
      Device auxActuator = actuators.get(table.getSelectionIndex());

      TableItem aux = table.getItem(table.getSelectionIndex());
      aux.setText(1, edit.getActuator());
      aux.setText(2, edit.getProtocol());
      aux.setText(3, edit.getPriority());
      Button bt = (Button) aux.getData("periodic");
      bt.setSelection(edit.getPeriodic());
      aux.setText(5, edit.getPeriod());

      auxActuator.setName(edit.getActuator());
      auxActuator.setProtocol(edit.getProtocol());
      auxActuator.setPriority(Integer.valueOf(edit.getPriority()));
      auxActuator.setPeriodic(edit.getPeriodic());
      auxActuator.setPeriod(Integer.valueOf(edit.getPeriod()));
      auxActuator.inputs.set(0, edit.getSignal());

      actuators.set(table.getSelectionIndex(), auxActuator);

      checkSpecified();
    }
  }
  /** Copy information from the meta-data input to the dialog fields. */
  public void getData() {
    super.getData();

    hasOneTemporalField = ((LoadSatMeta) inputMeta).getFromDateColumn() != null;
    enableFields();

    if (inputMeta.getFields() != null) {
      for (int i = 0; i < inputMeta.getFields().length; i++) {
        TableItem item = wKey.table.getItem(i);
        if (inputMeta.getCols()[i] != null) {
          item.setText(1, inputMeta.getCols()[i]);
        }
        if (inputMeta.getFields()[i] != null) {
          item.setText(2, inputMeta.getFields()[i]);
        }
        if (inputMeta.getTypes()[i] != null) {
          item.setText(3, inputMeta.getTypes()[i]);
        }
      }
    }

    if (((LoadSatMeta) inputMeta).getToDateColumn() != null) {
      wcbToDateCol.setText(((LoadSatMeta) inputMeta).getToDateColumn());
    }
    if (((LoadSatMeta) inputMeta).getToDateMaxFlag() != null) {
      wToDateMax.setText(((LoadSatMeta) inputMeta).getToDateMaxFlag());
    }
    wbIsIdempotentSat.setSelection(((LoadSatMeta) inputMeta).isIdempotent());

    wKey.setRowNums();
    wKey.optWidth(true);

    wStepname.selectAll();
    wStepname.setFocus();
  }
Beispiel #14
0
  /** Copy information from the meta-data input to the dialog fields. */
  public void getData() {
    int i;
    logDebug(BaseMessages.getString(PKG, "DBProcDialog.Log.GettingKeyInfo")); // $NON-NLS-1$

    if (input.getArgument() != null)
      for (i = 0; i < input.getArgument().length; i++) {
        TableItem item = wFields.table.getItem(i);
        if (input.getArgument()[i] != null) item.setText(1, input.getArgument()[i]);
        if (input.getArgumentDirection()[i] != null)
          item.setText(2, input.getArgumentDirection()[i]);
        item.setText(3, ValueMeta.getTypeDesc(input.getArgumentType()[i]));
      }

    if (input.getDatabase() != null) wConnection.setText(input.getDatabase().getName());
    else if (transMeta.nrDatabases() == 1) {
      wConnection.setText(transMeta.getDatabase(0).getName());
    }
    if (input.getProcedure() != null) wProcName.setText(input.getProcedure());
    if (input.getResultName() != null) wResult.setText(input.getResultName());
    wResultType.setText(ValueMeta.getTypeDesc(input.getResultType()));

    wAutoCommit.setSelection(input.isAutoCommit());

    wFields.setRowNums();
    wFields.optWidth(true);
    wStepname.selectAll();
  }
 private void updateItem(TableItem item) {
   TeaVMProfile profile = (TeaVMProfile) item.getData();
   item.setText(0, profile.getName());
   item.setText(1, profile.getTargetDirectory());
   item.setText(2, profile.getTargetFileName());
   item.setChecked(profile.isEnabled());
 }
  /**
   * This helper method puts the step configuration stored in the meta object and puts it into the
   * dialog controls.
   */
  private void populateDialog() {
    wRemoveBlanks.setSelection(meta.isConsecutiveDelimsAsOne());
    if (meta.getSourceFields() != null) {
      for (int i = 0; i < meta.getSourceFields().length; i++) {
        TableItem item = wGroup.table.getItem(i);
        if (meta.getSourceFields()[i] != null) {
          item.setText(1, meta.getSourceFields()[i]);
        }
        if (meta.getSourceDelims()[i] != null) {
          item.setText(2, meta.getSourceDelims()[i]);
        }
        if (meta.getOutputFields()[i] != null) {
          item.setText(3, meta.getOutputFields()[i]);
        }
        if (meta.getOutputDelims()[i] != null) {
          item.setText(4, meta.getOutputDelims()[i]);
        }
      }
    }

    wGroup.setRowNums();
    wGroup.optWidth(true);

    wStepname.selectAll();
    wStepname.setFocus();
  }
  protected void getParamsData() {
    wParams.clearAll(false);
    ArrayList<String> paramNames = new ArrayList<String>(configuration.getParams().keySet());
    Collections.sort(paramNames);

    for (int i = 0; i < paramNames.size(); i++) {
      String paramName = paramNames.get(i);
      String paramValue = configuration.getParams().get(paramName);
      String defaultValue;
      try {
        defaultValue = abstractMeta.getParameterDefault(paramName);
      } catch (UnknownParamException e) {
        defaultValue = "";
      }

      String description;
      try {
        description = abstractMeta.getParameterDescription(paramName);
      } catch (UnknownParamException e) {
        description = "";
      }

      TableItem tableItem = new TableItem(wParams.table, SWT.NONE);
      tableItem.setText(1, paramName);
      tableItem.setText(2, Const.NVL(defaultValue, ""));
      tableItem.setText(3, Const.NVL(paramValue, ""));
      tableItem.setText(4, Const.NVL(description, ""));
    }
    wParams.removeEmptyRows();
    wParams.setRowNums();
    wParams.optWidth(true);
  }
  /**
   * Utility method for binding an argument into the UI. Note that this method does not record any
   * commands, it simply adds a new row into the table and associates the passed {@link
   * PayloadFactoryArgument} to it.
   *
   * @return {@link TableItem} which was introduced.
   */
  private TableItem bindArgument(PayloadFactoryArgument argument) {
    TableItem item = new TableItem(tblArguments, SWT.NONE);
    ArgumentWrapper wrapper = new ArgumentWrapper(argument);
    wrapper.setArgumentExpression(
        EsbFactory.eINSTANCE.copyNamespacedProperty(argument.getArgumentExpression()));
    wrapper.setArgumentValue(argument.getArgumentValue());

    if (argument.getArgumentType() == PayloadFactoryArgumentType.EXPRESSION) {
      item.setText(
          new String[] {
            LITERAL_EXPRESSION,
            wrapper.getArgumentExpression().getPropertyValue(),
            argument.getEvaluator().toString()
          });
      wrapper.setEvaluator(argument.getEvaluator());
      wrapper.setExpression(true);
    } else {
      item.setText(new String[] {LITERAL_VALUE, wrapper.getArgumentValue(), ""});
      wrapper.setEvaluator(null);
      wrapper.setExpression(false);
    }

    item.setData(wrapper);
    return item;
  }
 /**
  * Update the specified item with the new info from the resource descriptor. Create a new table
  * item if there is no item.
  *
  * @param index index of the resource descriptor
  * @param itemPos position of the existing item to update
  * @param itemCount number of items in the resources table widget
  */
 private void updateItem(int index, int itemPos, int itemCount) {
   ResourceDescriptor desc = descriptors[index];
   TableItem item;
   if (itemPos < itemCount) {
     item = resourceNames.getItem(itemPos);
     if (item.getData() != desc) {
       item.setText(desc.label);
       item.setData(desc);
       item.setImage(getImage(desc));
       if (itemPos == 0) {
         resourceNames.setSelection(0);
         updateFolders(desc);
       }
     }
   } else {
     item = new TableItem(resourceNames, SWT.NONE);
     item.setText(desc.label);
     item.setData(desc);
     item.setImage(getImage(desc));
     if (itemPos == 0) {
       resourceNames.setSelection(0);
       updateFolders(desc);
     }
   }
   updateOKState(true);
 }
 public void handleEvent(Event event) {
   TableItem item = (TableItem) event.item;
   int index = event.index;
   item.setText(
       0, app.hostManager.get(index).hostname + ":" + app.hostManager.get(index).port);
   item.setText(1, app.hostManager.get(index).credentials.getUsername());
   item.setText(2, app.hostManager.get(index).credentials.getPrivateKeyPath());
   event.detail &= ~SWT.FOCUSED;
 }
  /** Copy information from the meta-data input to the dialog fields. */
  public void getData() {
    wAccField.setText(Const.NVL(input.getAcceptingField(), ""));

    for (int i = 0; i < input.getOutputFields().size(); i++) {
      SasInputField field = input.getOutputFields().get(i);

      TableItem item = new TableItem(wFields.table, SWT.NONE);
      int colnr = 1;
      item.setText(colnr++, Const.NVL(field.getName(), ""));
      item.setText(colnr++, Const.NVL(field.getRename(), ""));
      item.setText(colnr++, ValueMeta.getTypeDesc(field.getType()));
      item.setText(colnr++, Const.NVL(field.getConversionMask(), ""));
      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.getDecimalSymbol(), ""));
      item.setText(colnr++, Const.NVL(field.getGroupingSymbol(), ""));
      item.setText(colnr++, Const.NVL(field.getTrimTypeDesc(), ""));
    }
    wFields.removeEmptyRows();
    wFields.setRowNums();
    wFields.optWidth(true);

    wStepname.selectAll();
    wStepname.setFocus();
  }
 private void initText(TableItem item, int column, Manifest manifest) {
   if (manifest == null
       || manifest.getTitle() == null
       || manifest.getTitle().trim().length() == 0) {
     item.setForeground(column, Colors.C_LIGHT_GRAY);
     item.setText(column, ResourceManager.instance().getLabel("mainpanel.nodesc.label"));
   } else {
     item.setForeground(column, Colors.C_BLACK);
     item.setText(column, manifest.getTitle());
   }
 }
Beispiel #23
0
 /**
  * TODO Write description of addFunction in FunctionGroup.
  *
  * @param name
  * @param arity
  * @param type
  * @param exported
  */
 void addFunction(final String name, final int arity, final int type, final boolean exported) {
   final TableItem item = fEditingItem != null ? fEditingItem : new TableItem(fTable, SWT.NULL, 0);
   item.setChecked(exported);
   item.setText(0, name + getPostfix(type));
   item.setText(1, "" + arity);
   fEditingItem = null;
   final TableItem lastItem = fTable.getItem(fTable.getItemCount() - 1);
   if ("".equals(lastItem.getText(0))) {
     fTable.remove(fTable.getItemCount() - 1);
   }
 }
  /** Copy information from the meta-data input to the dialog fields. */
  public void getData() {
    if (isDebug()) {
      logDebug(BaseMessages.getString(PKG, "FuzzyMatchDialog.Log.GettingKeyInfo"));
    }

    wAlgorithm.setText(FuzzyMatchMeta.getAlgorithmTypeDesc(input.getAlgorithmType()));

    if (input.getMainStreamField() != null) {
      wMainStreamField.setText(input.getMainStreamField());
    }
    if (input.getLookupField() != null) {
      wLookupField.setText(input.getLookupField());
    }
    wcaseSensitive.setSelection(input.isCaseSensitive());
    wgetCloserValue.setSelection(input.isGetCloserValue());
    if (input.getMinimalValue() != null) {
      wminValue.setText(input.getMinimalValue());
    }
    if (input.getMaximalValue() != null) {
      wmaxValue.setText(input.getMaximalValue());
    }
    if (input.getOutputMatchField() != null) {
      wmatchField.setText(input.getOutputMatchField());
    }
    if (input.getOutputValueField() != null) {
      wvalueField.setText(input.getOutputValueField());
    }
    if (input.getSeparator() != null) {
      wseparator.setText(input.getSeparator());
    }

    if (input.getValue() != null) {
      for (int i = 0; i < input.getValue().length; i++) {
        TableItem item = wReturn.table.getItem(i);
        if (input.getValue()[i] != null) {
          item.setText(1, input.getValue()[i]);
        }
        if (input.getValueName()[i] != null
            && !input.getValueName()[i].equals(input.getValue()[i])) {
          item.setText(2, input.getValueName()[i]);
        }
      }
    }

    StreamInterface infoStream = input.getStepIOMeta().getInfoStreams().get(0);
    wStep.setText(Const.NVL(infoStream.getStepname(), ""));

    wReturn.setRowNums();
    wReturn.optWidth(true);

    wStepname.selectAll();
    wStepname.setFocus();
  }
Beispiel #25
0
 private void addTableItem(File directory) {
   CodeLineService service = new CodeLineService(directory);
   AvgCounter c = service.getAvgCounter();
   TableItem item = new TableItem(table, SWT.NONE);
   item.setData(service);
   item.setText(0, directory.getAbsolutePath());
   item.setText(1, Formats.INT.get(c.getCount()));
   item.setText(2, Formats.INT.get(c.getSum()));
   item.setText(3, Formats.INT.get(c.getAvarage()));
   item.setText(4, Formats.INT.get(c.getMax()));
   item.setText(5, Formats.INT.get(c.getMin()));
 }
 private void updateTableInfo() {
   DBPConnectionType connectionType = getSelectedType();
   for (TableItem item : typeTable.getItems()) {
     if (item.getData() == connectionType) {
       item.setText(0, connectionType.getName());
       item.setText(1, connectionType.getDescription());
       Color connectionColor = UIUtils.getConnectionTypeColor(connectionType);
       item.setBackground(0, connectionColor);
       item.setBackground(1, connectionColor);
       break;
     }
   }
 }
 private void addTypeToTable(DBPConnectionType source, DBPConnectionType connectionType) {
   changedInfo.put(connectionType, source);
   TableItem item = new TableItem(typeTable, SWT.LEFT);
   item.setText(0, connectionType.getName());
   item.setText(1, CommonUtils.toString(connectionType.getDescription()));
   if (connectionType.getColor() != null) {
     Color connectionColor = UIUtils.getConnectionTypeColor(connectionType);
     item.setBackground(0, connectionColor);
     item.setBackground(1, connectionColor);
     colorPicker.add(null, COLOR_TEXT, connectionColor, connectionColor);
   }
   item.setData(connectionType);
 }
  private void initSize(
      TableItem item, int column, File archive, AbstractIncrementalFileSystemMedium medium)
      throws ApplicationException {
    long prp = medium.getArchiveSize(archive, false);

    if (prp >= 0) {
      item.setForeground(column, Colors.C_BLACK);
      item.setText(column, Utils.formatFileSize(prp));
    } else {
      item.setForeground(column, Colors.C_LIGHT_GRAY);
      item.setText(column, ResourceManager.instance().getLabel("mainpanel.nosize.label"));
    }
  }
Beispiel #29
0
  private void changeCurrentNode() {

    boolean hasMatchSelectedName = false;
    FileObject[] children = null;
    try {
      children = currentFileObject.getChildren();
    } catch (Exception e) {
      e.printStackTrace();
    }
    if (children == null) return;

    sortFiles(children);

    String selectedName = historyManager.getSelectedItem(currentFileObject.getName().getPath());
    table.removeAll();
    TableItem item;

    for (int i = 0; i < children.length; i++) {
      FileName fileName = children[i].getName();

      if (fileName.getBaseName().equals(selectedName)) {
        currentRow = i;
        hasMatchSelectedName = true;
      }

      item = new TableItem(table, SWT.NONE);
      item.setData("fileObject", children[i]);
      item.setText(fileName.getBaseName());

      try {
        FileType fileType = children[i].getType();
        FileContent fileContent = children[i].getContent();

        if (fileType.equals(FileType.FOLDER)) {
          item.setImage(folderImage);
          item.setText(1, "--");
          item.setText(2, StringUtil.formatDate(fileContent.getLastModifiedTime()));
        } else {
          item.setImage(fileImage);
          item.setText(1, StringUtil.formatSize(fileContent.getSize()));
          item.setText(2, StringUtil.formatDate(fileContent.getLastModifiedTime()));
        }
      } catch (Exception e) {
        e.printStackTrace();
      }
    }

    if (!hasMatchSelectedName) currentRow = 0;
    table.setSelection(currentRow);
    table.setFocus();
  }
 public static void main(String[] args) {
   Display display = new Display();
   Shell shell = new Shell(display);
   shell.setLayout(new FillLayout());
   final Table table = new Table(shell, SWT.BORDER);
   table.setHeaderVisible(true);
   final TableColumn column1 = new TableColumn(table, SWT.NONE);
   column1.setText("Column 1");
   final TableColumn column2 = new TableColumn(table, SWT.NONE);
   column2.setText("Column 2");
   TableItem item = new TableItem(table, SWT.NONE);
   item.setText(new String[] {"a", "3"});
   item = new TableItem(table, SWT.NONE);
   item.setText(new String[] {"b", "2"});
   item = new TableItem(table, SWT.NONE);
   item.setText(new String[] {"c", "1"});
   column1.setWidth(100);
   column2.setWidth(100);
   Listener sortListener =
       e -> {
         TableItem[] items = table.getItems();
         Collator collator = Collator.getInstance(Locale.getDefault());
         TableColumn column = (TableColumn) e.widget;
         int index = column == column1 ? 0 : 1;
         for (int i = 1; i < items.length; i++) {
           String value1 = items[i].getText(index);
           for (int j = 0; j < i; j++) {
             String value2 = items[j].getText(index);
             if (collator.compare(value1, value2) < 0) {
               String[] values = {items[i].getText(0), items[i].getText(1)};
               items[i].dispose();
               TableItem item1 = new TableItem(table, SWT.NONE, j);
               item1.setText(values);
               items = table.getItems();
               break;
             }
           }
         }
         table.setSortColumn(column);
       };
   column1.addListener(SWT.Selection, sortListener);
   column2.addListener(SWT.Selection, sortListener);
   table.setSortColumn(column1);
   table.setSortDirection(SWT.UP);
   shell.setSize(shell.computeSize(SWT.DEFAULT, SWT.DEFAULT).x, 300);
   shell.open();
   while (!shell.isDisposed()) {
     if (!display.readAndDispatch()) display.sleep();
   }
   display.dispose();
 }