public Collection retrieveByName(String name) { return Collection.retrieveByName(name); }
private void saveButtonActionPerformed( java.awt.event.ActionEvent evt) { // GEN-FIRST:event_saveButtonActionPerformed String desc = _sv.getSequenceView().getOutputTextArea().getText(); if (desc == null) { desc = ""; } String name = nameTextField.getText(); String seq = null; System.out.println("saving: " + name); if (intervalRadioButton.isSelected()) { try { if (dataTextPane.getText() != null) { seq = dataTextPane .getText() .substring( Integer.parseInt(fromTextField.getText()), Integer.parseInt(toTextField.getText())); } } catch (NumberFormatException e) { System.out.println("tried to use invalid sequence interval to generate Clotho object"); return; } } else { seq = dataTextPane.getText(); } Format form = null; Collection coll = null; if (objectTypeComboBox.getSelectedIndex() != 1 && objectTypeComboBox.getSelectedIndex() != 0) { if (formatComboBox.getSelectedIndex() == -1) { statusLabel.setText("Warning: format not set"); return; } form = Collector.getFormat(((ObjLink) formatComboBox.getSelectedItem()).uuid); } if (collectionComboBox.getSelectedIndex() != -1) { coll = Collector.getCollection(((ObjLink) collectionComboBox.getSelectedItem()).uuid); } else { statusLabel.setText("Warning: collection not selected"); return; } if (objectTypeComboBox.getSelectedIndex() == -1) { statusLabel.setText("Warning: object Type not set"); return; } Boolean saved = false; ObjBase newObject = null; if (coll != null) { if (objectTypeComboBox.getSelectedIndex() == 0) { // feature if (seq.toUpperCase().indexOf("ATG") != -1) { newObject = Feature.generateFeature(name, seq, Collector.getCurrentUser(), true); } else { newObject = Feature.generateFeature(name, seq, Collector.getCurrentUser(), false); } } else if (objectTypeComboBox.getSelectedIndex() == 1) { newObject = new Oligo(name, desc, Collector.getCurrentUser(), seq); } else if (form != null && objectTypeComboBox.getSelectedIndex() == 2) { // part newObject = Part.generateBasic(name, desc, seq, form, Collector.getCurrentUser()); } else if (form != null && objectTypeComboBox.getSelectedIndex() == 3) { Vector.generateVector(name, desc, seq, form, Collector.getCurrentUser()); } else { statusLabel.setText("error saving new Clotho object, check selected fields"); return; } } else { statusLabel.setText("Not all fields are filled"); return; } if (newObject != null) { statusLabel.setText("saving: " + newObject.getName()); } saved = newObject.saveDefault(); coll.addObject(newObject); coll.saveDefault(); Collector.add(newObject); if (saved) { statusLabel.setText("Successful save!"); NucSeq.refreshFeatureTable(); this.dispose(); } } // GEN-LAST:event_saveButtonActionPerformed