Пример #1
0
  /**
   * Get the latest (edited) literature/dbxref qualifiers
   *
   * @return
   */
  public QualifierVector getQualifiers() {
    QualifierVector referenceQualifier = null;
    String literatureTxt = literatureTextArea.getText().trim();

    if (!literatureTxt.equals("")) {
      referenceQualifier = new QualifierVector();
      String[] lits = getValues(literatureTxt);
      StringVector litValues = new StringVector(lits);
      Qualifier literature = new Qualifier("literature", litValues);
      referenceQualifier.setQualifier(literature);
    }

    String dbxrefTxt = dbxrefTextArea.getText().trim();
    if (!dbxrefTxt.equals("")) {
      if (referenceQualifier == null) referenceQualifier = new QualifierVector();
      String[] dbxrefs = getValues(dbxrefTxt);
      StringVector dbxrefsValues = new StringVector(dbxrefs);
      Qualifier dbxrefsQualifier = new Qualifier("Dbxref", dbxrefsValues);
      referenceQualifier.setQualifier(dbxrefsQualifier);
    }

    return referenceQualifier;
  }
Пример #2
0
  private void updateFromFeature(Feature feature) {
    GridBagConstraints c = new GridBagConstraints();
    JPanel gridPanel = new JPanel(new GridBagLayout());
    gridPanel.setBackground(Color.white);

    //
    // literature & dbxref
    literatureTextArea = new QualifierTextArea();
    literatureTextArea.setBorder(BorderFactory.createLineBorder(Color.gray));
    dbxrefTextArea = new QualifierTextArea();
    dbxrefTextArea.setBorder(BorderFactory.createLineBorder(Color.gray));

    literatureTextArea
        .getDocument()
        .addDocumentListener(new TextAreaDocumentListener(literatureTextArea));

    dbxrefTextArea.getDocument().addDocumentListener(new TextAreaDocumentListener(dbxrefTextArea));

    final QualifierVector qualifiers = feature.getQualifiers().copy();
    final StringBuffer litBuffer = new StringBuffer();
    final StringBuffer dbxrefBuffer = new StringBuffer();

    for (int i = 0; i < qualifiers.size(); ++i) {
      Qualifier this_qualifier = (Qualifier) qualifiers.elementAt(i);
      if (this_qualifier.getName().equals("literature"))
        appendToBuffer(this_qualifier.getValues(), litBuffer);
      else if (this_qualifier.getName().equalsIgnoreCase("Dbxref"))
        appendToBuffer(this_qualifier.getValues(), dbxrefBuffer);
    }

    c.gridx = 0;
    c.gridy = 0;
    c.ipadx = 5;
    c.ipady = 5;
    c.anchor = GridBagConstraints.NORTHWEST;
    c.fill = GridBagConstraints.NONE;
    gridPanel.add(new JLabel("Literature"), c);
    c.gridx = 1;
    gridPanel.add(literatureTextArea, c);

    c.gridx = 0;
    c.gridy = 1;
    gridPanel.add(new JLabel("Dbxref"), c);
    c.gridx = 1;
    gridPanel.add(dbxrefTextArea, c);

    add(gridPanel);

    literatureTextArea.setText(litBuffer.toString() + "\n");
    dbxrefTextArea.setText(dbxrefBuffer.toString() + "\n");
  }