Exemplo n.º 1
0
  public java.util.LinkedList<String> getList() {
    String text = getText().trim();
    java.util.LinkedList<String> result = new java.util.LinkedList<String>();

    while (text.length() > 0) {
      if (text.startsWith("\"")) {
        int last = text.indexOf("\"", 1);
        if (last == -1) {
          result.add(text.substring(1));
          text = "";
        } else {
          result.add(text.substring(1, last));
          text = text.substring(last + 1).trim();
        }
      } else {
        String[] strings = text.split("\\s", 2);
        if (strings.length == 1) {
          result.add(strings[0]);
          text = "";
        } else {
          result.add(strings[0]);
          text = strings[1].trim();
        }
      }
    }
    return result;
  }
Exemplo n.º 2
0
  public java.util.LinkedList<PropertyDescriptor> getProperties() {
    assert _editable;

    if (isEditing()) {
      getCellEditor().stopCellEditing();
    }
    @SuppressWarnings("unchecked")
    java.util.Vector<java.util.Vector<String>> vector = _model.getDataVector();

    java.util.LinkedList<PropertyDescriptor> result =
        new java.util.LinkedList<PropertyDescriptor>(_hiddenProperties);

    for (java.util.Vector<String> row : vector) {
      //
      // Eliminate rows with null or empty keys
      //
      String key = row.elementAt(0);
      if (key != null) {
        key = key.trim();
        if (!key.equals("")) {
          String val = row.elementAt(1);
          if (val == null) {
            val = "";
          }

          result.add(new PropertyDescriptor(key, val));
        }
      }
    }
    return result;
  }
Exemplo n.º 3
0
  static java.util.LinkedList<String[]> parameterValuesToAttributes(
      java.util.Map<String, String> parameterValues, java.util.List<String> parameters) {
    java.util.LinkedList<String[]> result = new java.util.LinkedList<String[]>();

    //
    // We use a LinkedHashSet to maintain order while eliminating duplicates
    //
    for (String p : new java.util.LinkedHashSet<String>(parameters)) {
      String val = parameterValues.get(p);
      if (val != null) {
        result.add(createAttribute(p, val));
      }
    }
    return result;
  }