/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
/*
* MakeObjectFrame.java
*
* Created on Aug 28, 2011, 8:55:31 AM
*/
package org.clothocore.widget.fabdash;
import java.util.ArrayList;
import org.clothocore.api.core.Collector;
import org.clothocore.api.data.Collection;
import org.clothocore.api.data.Feature;
import org.clothocore.api.data.Format;
import org.clothocore.api.data.ObjLink;
import org.clothocore.api.data.ObjType;
import org.clothocore.api.data.Oligo;
import org.clothocore.api.data.Part;
import org.clothocore.api.data.Sample;
import org.clothocore.api.data.Sample.SampleType;
import org.clothocore.api.data.Vector;
import org.openide.awt.StatusDisplayer;
/**
*
* @author Henry
*/
public class MakeObjectFrame extends javax.swing.JFrame {
/** Creates new form MakeObjectFrame */
public MakeObjectFrame() {
initComponents();
}
public MakeObjectFrame(ObjType o) {
initComponents();
this.setTitle("Create new " + o);
collectionComboBox.removeAllItems();
ArrayList<ObjLink> allLinksOf = Collector.getAllLinksOf(ObjType.COLLECTION);
for (ObjLink oj : allLinksOf) {
collectionComboBox.addItem(oj.name);
}
saveType = o;
if (saveType.equals(ObjType.PART)) {
swapPanel.remove(volumeLabel);
swapPanel.remove(volumeField);
swapPanel.remove(cdsCheckBox);
formatComboBox.removeAllItems();
ArrayList<ObjLink> formatLinks = Collector.getAllLinksOf(ObjType.FORMAT);
for (ObjLink ol : formatLinks) {
formatComboBox.addItem(ol.name);
}
} else if (saveType.equals(ObjType.OLIGO)) {
swapPanel.remove(volumeLabel);
swapPanel.remove(volumeField);
swapPanel.remove(cdsCheckBox);
swapPanel.remove(formatLabel);
swapPanel.remove(formatComboBox);
} else if (saveType.equals(ObjType.VECTOR)) {
swapPanel.remove(volumeLabel);
swapPanel.remove(volumeField);
swapPanel.remove(cdsCheckBox);
formatComboBox.removeAllItems();
ArrayList<ObjLink> formatLinks = Collector.getAllLinksOf(ObjType.FORMAT);
for (ObjLink ol : formatLinks) {
formatComboBox.addItem(ol.name);
}
} else if (saveType.equals(ObjType.FEATURE)) {
swapPanel.remove(volumeLabel);
swapPanel.remove(volumeField);
swapPanel.remove(formatLabel);
swapPanel.remove(formatComboBox);
// } else if (saveType.equals(ObjType.SAMPLE)) {
// swapPanel.remove(cdsCheckBox);
// swapPanel.remove(sequenceLabel);
// swapPanel.remove(jScrollPane2);
// formatComboBox.removeAllItems();
// for (SampleType st : SampleType.values()) {
// formatComboBox.addItem(st.toString());
// }
formatLabel.setText("Type");
} else if (saveType.equals(ObjType.COLLECTION)) {
swapPanel.remove(volumeLabel);
swapPanel.remove(volumeField);
swapPanel.remove(cdsCheckBox);
swapPanel.remove(sequenceLabel);
swapPanel.remove(jScrollPane2);
swapPanel.remove(formatLabel);
swapPanel.remove(formatComboBox);
}
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jLabel2 = new javax.swing.JLabel();
backgroundPanel = new javax.swing.JPanel();
jLabel1 = new javax.swing.JLabel();
nameField = new javax.swing.JTextField();
saveButton = new javax.swing.JButton();
cancelButton = new javax.swing.JButton();
swapPanel = new javax.swing.JPanel();
sequenceLabel = new javax.swing.JLabel();
jScrollPane2 = new javax.swing.JScrollPane();
seqTextArea = new javax.swing.JTextArea();
formatComboBox = new javax.swing.JComboBox();
formatLabel = new javax.swing.JLabel();
volumeLabel = new javax.swing.JLabel();
volumeField = new javax.swing.JTextField();
cdsCheckBox = new javax.swing.JCheckBox();
jLabel3 = new javax.swing.JLabel();
collectionComboBox = new javax.swing.JComboBox();
statusLabel = new javax.swing.JLabel();
jLabel2.setText(org.openide.util.NbBundle.getMessage(MakeObjectFrame.class, "MakeObjectFrame.jLabel2.text")); // NOI18N
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
backgroundPanel.setMaximumSize(new java.awt.Dimension(260, 300));
backgroundPanel.setMinimumSize(new java.awt.Dimension(260, 300));
jLabel1.setText(org.openide.util.NbBundle.getMessage(MakeObjectFrame.class, "MakeObjectFrame.jLabel1.text")); // NOI18N
nameField.setText(org.openide.util.NbBundle.getMessage(MakeObjectFrame.class, "MakeObjectFrame.nameField.text")); // NOI18N
nameField.setToolTipText(org.openide.util.NbBundle.getMessage(MakeObjectFrame.class, "MakeObjectFrame.nameField.toolTipText")); // NOI18N
saveButton.setText(org.openide.util.NbBundle.getMessage(MakeObjectFrame.class, "MakeObjectFrame.saveButton.text")); // NOI18N
saveButton.setMaximumSize(new java.awt.Dimension(65, 23));
saveButton.setMinimumSize(new java.awt.Dimension(65, 23));
saveButton.setPreferredSize(new java.awt.Dimension(65, 23));
saveButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
saveButtonActionPerformed(evt);
}
});
cancelButton.setText(org.openide.util.NbBundle.getMessage(MakeObjectFrame.class, "MakeObjectFrame.cancelButton.text")); // NOI18N
cancelButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
cancelButtonActionPerformed(evt);
}
});
swapPanel.setBorder(javax.swing.BorderFactory.createEtchedBorder());
sequenceLabel.setText(org.openide.util.NbBundle.getMessage(MakeObjectFrame.class, "MakeObjectFrame.sequenceLabel.text")); // NOI18N
seqTextArea.setColumns(20);
seqTextArea.setLineWrap(true);
seqTextArea.setRows(5);
jScrollPane2.setViewportView(seqTextArea);
formatComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
formatLabel.setText(org.openide.util.NbBundle.getMessage(MakeObjectFrame.class, "MakeObjectFrame.formatLabel.text")); // NOI18N
volumeLabel.setText(org.openide.util.NbBundle.getMessage(MakeObjectFrame.class, "MakeObjectFrame.volumeLabel.text")); // NOI18N
volumeField.setText(org.openide.util.NbBundle.getMessage(MakeObjectFrame.class, "MakeObjectFrame.volumeField.text")); // NOI18N
cdsCheckBox.setText(org.openide.util.NbBundle.getMessage(MakeObjectFrame.class, "MakeObjectFrame.cdsCheckBox.text")); // NOI18N
javax.swing.GroupLayout swapPanelLayout = new javax.swing.GroupLayout(swapPanel);
swapPanel.setLayout(swapPanelLayout);
swapPanelLayout.setHorizontalGroup(
swapPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(swapPanelLayout.createSequentialGroup()
.addGroup(swapPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(cdsCheckBox)
.addGroup(swapPanelLayout.createSequentialGroup()
.addGroup(swapPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(sequenceLabel)
.addComponent(formatLabel)
.addComponent(volumeLabel))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(swapPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(volumeField, javax.swing.GroupLayout.DEFAULT_SIZE, 188, Short.MAX_VALUE)
.addComponent(formatComboBox, 0, 188, Short.MAX_VALUE)
.addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 188, Short.MAX_VALUE))))
.addContainerGap())
);
swapPanelLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {formatLabel, sequenceLabel, volumeLabel});
swapPanelLayout.setVerticalGroup(
swapPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(swapPanelLayout.createSequentialGroup()
.addGroup(swapPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(sequenceLabel)
.addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(6, 6, 6)
.addGroup(swapPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(formatLabel)
.addComponent(formatComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(swapPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(volumeLabel)
.addComponent(volumeField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(cdsCheckBox))
);
jLabel3.setText(org.openide.util.NbBundle.getMessage(MakeObjectFrame.class, "MakeObjectFrame.jLabel3.text")); // NOI18N
collectionComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
collectionComboBox.setToolTipText(org.openide.util.NbBundle.getMessage(MakeObjectFrame.class, "MakeObjectFrame.collectionComboBox.toolTipText")); // NOI18N
collectionComboBox.setMaximumSize(new java.awt.Dimension(186, 20));
collectionComboBox.setMinimumSize(new java.awt.Dimension(186, 20));
collectionComboBox.setPreferredSize(new java.awt.Dimension(186, 20));
statusLabel.setText(org.openide.util.NbBundle.getMessage(MakeObjectFrame.class, "MakeObjectFrame.statusLabel.text")); // NOI18N
statusLabel.setBorder(javax.swing.BorderFactory.createEtchedBorder());
statusLabel.setMaximumSize(new java.awt.Dimension(240, 18));
statusLabel.setMinimumSize(new java.awt.Dimension(240, 18));
statusLabel.setPreferredSize(new java.awt.Dimension(240, 18));
javax.swing.GroupLayout backgroundPanelLayout = new javax.swing.GroupLayout(backgroundPanel);
backgroundPanel.setLayout(backgroundPanelLayout);
backgroundPanelLayout.setHorizontalGroup(
backgroundPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(backgroundPanelLayout.createSequentialGroup()
.addContainerGap()
.addGroup(backgroundPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(statusLabel, javax.swing.GroupLayout.DEFAULT_SIZE, 253, Short.MAX_VALUE)
.addGroup(backgroundPanelLayout.createSequentialGroup()
.addComponent(saveButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(cancelButton))
.addGroup(backgroundPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addComponent(swapPanel, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, backgroundPanelLayout.createSequentialGroup()
.addGroup(backgroundPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel3)
.addComponent(jLabel1))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(backgroundPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(nameField)
.addComponent(collectionComboBox, 0, 186, Short.MAX_VALUE)))))
.addContainerGap())
);
backgroundPanelLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {cancelButton, saveButton});
backgroundPanelLayout.setVerticalGroup(
backgroundPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(backgroundPanelLayout.createSequentialGroup()
.addContainerGap()
.addGroup(backgroundPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel1)
.addComponent(nameField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(backgroundPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel3)
.addComponent(collectionComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(swapPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(statusLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(backgroundPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(saveButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(cancelButton))
.addContainerGap())
);
backgroundPanelLayout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {cancelButton, saveButton});
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(backgroundPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(backgroundPanel, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void cancelButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cancelButtonActionPerformed
this.dispose();
}//GEN-LAST:event_cancelButtonActionPerformed
private void saveButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_saveButtonActionPerformed
if (saveType.equals(ObjType.PART)) {
String name = nameField.getText();
if (name == null) {
StatusDisplayer.getDefault().setStatusText("Error: can't create new part because name is invalid");
return;
}
Collection collection = Collection.retrieveByName((String) collectionComboBox.getSelectedItem());
if (collection == null) {
StatusDisplayer.getDefault().setStatusText("Error: select a collection to save new part in");
return;
}
String sequence = seqTextArea.getText();
if (sequence == null || !sequence.matches("[agtcAGTC\\s]*")) {
StatusDisplayer.getDefault().setStatusText("Error: can't create new part because sequence invalid");
return;
}
Format format = Format.retrieveByName((String) formatComboBox.getSelectedItem());
if (format == null) {
StatusDisplayer.getDefault().setStatusText("Error: can't create new part because format is invalid");
return;
}
try {
Part apart = Part.generateBasic(name, "", sequence, format, Collector.getCurrentUser());
StatusDisplayer.getDefault().setStatusText("Created new part: " + apart.getName() + ". Saving...");
collection.addObject(apart);
apart.saveDefault();
collection.saveDefault();
StatusDisplayer.getDefault().setStatusText("Successfully saved: " + apart.getName());
this.dispose();
} catch (Exception e) {
StatusDisplayer.getDefault().setStatusText("Error saving part, please check entered fields");
return;
}
} else if (saveType.equals(ObjType.OLIGO)) {
String name = nameField.getText();
if (name == null) {
StatusDisplayer.getDefault().setStatusText("Error: can't create new oligo because name is invalid");
return;
}
Collection collection = Collection.retrieveByName((String) collectionComboBox.getSelectedItem());
if (collection == null) {
StatusDisplayer.getDefault().setStatusText("Error: select a collection to save new oligo in");
return;
}
String sequence = seqTextArea.getText();
if (sequence == null || !sequence.matches("[agtcAGTC\\s]*")) {
StatusDisplayer.getDefault().setStatusText("Error: can't create new oligo because sequence invalid");
return;
}
try {
Oligo aol = new Oligo(name, "", Collector.getCurrentUser(), sequence);
StatusDisplayer.getDefault().setStatusText("Created new oligo: " + aol.getName() + ". Saving...");
collection.addObject(aol);
aol.saveDefault();
collection.saveDefault();
StatusDisplayer.getDefault().setStatusText("Successfully saved: " + aol.getName());
this.dispose();
} catch (Exception e) {
StatusDisplayer.getDefault().setStatusText("Error saving part, please check entered fields");
return;
}
} else if (saveType.equals(ObjType.VECTOR)) {
String name = nameField.getText();
if (name == null) {
StatusDisplayer.getDefault().setStatusText("Error: can't create new vector because name is invalid");
return;
}
Collection collection = Collection.retrieveByName((String) collectionComboBox.getSelectedItem());
if (collection == null) {
StatusDisplayer.getDefault().setStatusText("Error: select a collection to save new vector in");
return;
}
String sequence = seqTextArea.getText();
if (sequence == null || !sequence.matches("[agtcAGTC\\s]*")) {
StatusDisplayer.getDefault().setStatusText("Error: can't create new vector because sequence invalid");
return;
}
Format format = Format.retrieveByName((String) formatComboBox.getSelectedItem());
if (format == null) {
StatusDisplayer.getDefault().setStatusText("Error: can't create new vector because format is invalid");
return;
}
try {
Vector avec = Vector.generateVector(name, "", sequence, format, Collector.getCurrentUser());
StatusDisplayer.getDefault().setStatusText("Created new vector: " + avec.getName() + ". Saving...");
collection.addObject(avec);
avec.saveDefault();
collection.saveDefault();
StatusDisplayer.getDefault().setStatusText("Successfully saved: " + avec.getName());
this.dispose();
} catch (Exception e) {
StatusDisplayer.getDefault().setStatusText("Error saving vector, please check entered fields");
return;
}
} else if (saveType.equals(ObjType.FEATURE)) {
String name = nameField.getText();
if (name == null) {
StatusDisplayer.getDefault().setStatusText("Error: can't create new feature because name is invalid");
return;
}
Collection collection = Collection.retrieveByName((String) collectionComboBox.getSelectedItem());
if (collection == null) {
StatusDisplayer.getDefault().setStatusText("Error: select a collection to save new feature in");
return;
}
String sequence = seqTextArea.getText();
if (sequence == null || !sequence.matches("[agtcAGTC\\s]*")) {
StatusDisplayer.getDefault().setStatusText("Error: can't create new feature because sequence invalid");
return;
}
boolean iscds = cdsCheckBox.isSelected();
try {
Feature afea = Feature.generateFeature(name, sequence, Collector.getCurrentUser(), iscds);
StatusDisplayer.getDefault().setStatusText("Created new feature: " + afea.getName() + ". Saving...");
collection.addObject(afea);
afea.saveDefault();
collection.saveDefault();
StatusDisplayer.getDefault().setStatusText("Successfully saved: " + afea.getName());
this.dispose();
} catch (Exception e) {
StatusDisplayer.getDefault().setStatusText("Error saving feature, please check entered fields");
return;
}
} else if (saveType.equals(ObjType.COLLECTION)) {
String name = nameField.getText();
if (name == null) {
StatusDisplayer.getDefault().setStatusText("Error: can't create new collection because name is invalid");
return;
}
Collection collection = Collection.retrieveByName((String) collectionComboBox.getSelectedItem());
if (collection == null) {
StatusDisplayer.getDefault().setStatusText("Error: select a collection to save new collection in");
return;
}
try {
Collection acol = new Collection(name, "", Collector.getCurrentUser());
StatusDisplayer.getDefault().setStatusText("Created new collection: " + acol.getName() + ". Saving...");
collection.addObject(acol);
acol.saveDefault();
collection.saveDefault();
StatusDisplayer.getDefault().setStatusText("Successfully saved: " + acol.getName());
this.dispose();
} catch (Exception e) {
StatusDisplayer.getDefault().setStatusText("Error saving collection, please check entered fields");
return;
}
// } else if (saveType.equals(ObjType.SAMPLE)) {
// String name = nameField.getText();
// if (name == null) {
// StatusDisplayer.getDefault().setStatusText("Error: can't create new sample because name is invalid");
// return;
// }
// Collection collection = Collection.retrieveByName((String) collectionComboBox.getSelectedItem());
// if (collection == null) {
// StatusDisplayer.getDefault().setStatusText("Error: select a collection to save new sample in");
// return;
// }
// Double volume;
// try {
// volume = Double.parseDouble(volumeField.getText());
// } catch (Exception ex) {
// StatusDisplayer.getDefault().setStatusText("Error: input a proper double value for volume");
// return;
// }
// SampleType sampletype = (SampleType) formatComboBox.getSelectedItem();
// if (sampletype == null) {
// StatusDisplayer.getDefault().setStatusText("Error: select a sample type");
// return;
// }
// try {
// if (sampletype.equals(SampleType.CELL_SAMPLE)) {
//
// } else if (sampletype.equals(SampleType.OLIGO_SAMPLE)) {
//
// } else if (sampletype.equals(SampleType.PLASMID_SAMPLE)) {
//
// } else if (sampletype.equals(SampleType.STRAIN_SAMPLE)) {
//
// }
//
//Sample asamp = new Sample(name, volume, Collector.getCurrentUser(), sampletype );
// StatusDisplayer.getDefault().setStatusText("Created new feature: " + asamp.getName() + ". Saving...");
// collection.addObject(asamp);
// asamp.saveDefault();
// collection.saveDefault();
// StatusDisplayer.getDefault().setStatusText("Successfully saved: " + asamp.getName());
// this.dispose();
//
// } catch (Exception e) {
// StatusDisplayer.getDefault().setStatusText("Error saving sample, please check entered fields");
//
// }
}
}//GEN-LAST:event_saveButtonActionPerformed
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(MakeObjectFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(MakeObjectFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(MakeObjectFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(MakeObjectFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new MakeObjectFrame().setVisible(true);
}
});
}
private ObjType saveType;
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JPanel backgroundPanel;
private javax.swing.JButton cancelButton;
private javax.swing.JCheckBox cdsCheckBox;
private javax.swing.JComboBox collectionComboBox;
private javax.swing.JComboBox formatComboBox;
private javax.swing.JLabel formatLabel;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JScrollPane jScrollPane2;
private javax.swing.JTextField nameField;
private javax.swing.JButton saveButton;
private javax.swing.JTextArea seqTextArea;
private javax.swing.JLabel sequenceLabel;
private javax.swing.JLabel statusLabel;
private javax.swing.JPanel swapPanel;
private javax.swing.JTextField volumeField;
private javax.swing.JLabel volumeLabel;
// End of variables declaration//GEN-END:variables
}