/* This Java package, org.autoplot.das2Stream is part of the Autoplot application * * Copyright (C) 2011 Jeremy Faden * * Autoplot is free software; you can redistribute it and/or modify it under the * terms of the GNU General Public License version 2 as published by the Free * Software Foundation, with the Classpath exception below. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A * PARTICULAR PURPOSE. See the GNU General Public License for more details. * * You should have received a copy of the GNU General Public License version 2 * containing the Classpath exception clause along with this library; if not, write * to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA * 02111-1307 USA * * Classpath Exception * ------------------- * The copyright holders designate this particular java package as subject to the * "Classpath" exception as provided here. * * Linking this package statically or dynamically with other modules is making a * combined work based on this package. Thus, the terms and conditions of the GNU * General Public License cover the whole combination. * * As a special exception, the copyright holders of this package give you * permission to link this package with independent modules to produce an * application, regardless of the license terms of these independent modules, and * to copy and distribute the resulting application under terms of your choice, * provided that you also meet, for each independent module, the terms and * conditions of the license of that module. An independent module is a module * which is not derived from or based on this package. If you modify this package, * you may extend this exception to your version of the package, but you are not * obligated to do so. If you do not wish to do so, delete this exception * statement from your version. */ package org.autoplot.das2Stream; import java.util.Map; import javax.swing.JPanel; import org.autoplot.datasource.DataSourceFormatEditorPanel; import org.autoplot.datasource.URISplit; /** * * @author jbf */ public class QStreamDataSourceFormatEditorPanel extends javax.swing.JPanel implements DataSourceFormatEditorPanel { URISplit split; /** Creates new form Das2StreamDataSourceFormatEditorPanel */ public QStreamDataSourceFormatEditorPanel() { initComponents(); } /** 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") // //GEN-BEGIN:initComponents private void initComponents() { jLabel1 = new javax.swing.JLabel(); typeComboBox = new javax.swing.JComboBox(); jLabel2 = new javax.swing.JLabel(); jLabel1.setText("Type:"); typeComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "ascii", "binary" })); jLabel2.setText("QStream options"); org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this); this.setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(layout.createSequentialGroup() .addContainerGap() .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(layout.createSequentialGroup() .add(jLabel1) .add(18, 18, 18) .add(typeComboBox, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 124, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) .add(jLabel2)) .addContainerGap(204, Short.MAX_VALUE)) ); layout.setVerticalGroup( layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(layout.createSequentialGroup() .addContainerGap() .add(jLabel2) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) .add(jLabel1) .add(typeComboBox, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) .addContainerGap(246, Short.MAX_VALUE)) ); }// //GEN-END:initComponents public JPanel getPanel() { return this; } public void setURI(String uri) { URISplit lsplit= URISplit.parse(uri); String type= URISplit.getParam( uri, "type", "ascii" ); typeComboBox.setSelectedItem( type ); this.split= lsplit; } public String getURI() { Map args= URISplit.parseParams(split.params); if ( !typeComboBox.getSelectedItem().equals("ascii" ) ) { args.put( "type", (String)typeComboBox.getSelectedItem() ); } else { args.remove( "type" ); } split.params= URISplit.formatParams(args); return URISplit.format( split ); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel2; private javax.swing.JComboBox typeComboBox; // End of variables declaration//GEN-END:variables }