/* * DataSetSelectorDemo.java * * Created on November 6, 2007, 11:29 AM */ package org.autoplot.datasource; import java.awt.event.KeyEvent; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import java.util.Arrays; /** * * @author jbf */ public class DataSetSelectorDemo extends javax.swing.JFrame { /** Creates new form DataSetSelectorDemo */ public DataSetSelectorDemo() { initComponents(); jMenu1.add( dataSetSelector1.getOpenLocalAction() ); jMenu1.add( dataSetSelector1.getRecentMenu() ); this.dataSetSelector1.addCompletionKeys(); this.dataSetSelector1.addPropertyChangeListener( new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent evt) { if ( evt.getPropertyName().equals(DataSetSelector.PROPERTY_MESSAGE ) ) { statusLabel.setText(dataSetSelector1.getMessage()); } } } ); this.dataSetSelector1.setRecent(Arrays.asList( new String[] { "x.dat", "y.dat", "z.dat" } ) ); this.dataSetSelector1.setValue("http://192.168.0.203/jeremy/1wire/data/2007/0B000800408DD710.20070213.d2s"); DataSetURI.init(); // discover factories } /** 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. */ // //GEN-BEGIN:initComponents private void initComponents() { dataSetSelector1 = new org.autoplot.datasource.DataSetSelector(); jLabel1 = new javax.swing.JLabel(); statusLabel = new javax.swing.JLabel(); jLabel2 = new javax.swing.JLabel(); modifiersLabel = new javax.swing.JLabel(); jMenuBar1 = new javax.swing.JMenuBar(); jMenu1 = new javax.swing.JMenu(); jMenu2 = new javax.swing.JMenu(); jMenuItem1 = new javax.swing.JMenuItem(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); dataSetSelector1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { dataSetSelector1ActionPerformed(evt); } }); jLabel1.setText("jLabel1"); statusLabel.setText("status here"); jLabel2.setText("Selection:"); modifiersLabel.setText("jLabel3"); jMenu1.setText("File"); jMenuBar1.add(jMenu1); jMenu2.setText("Edit"); jMenuItem1.setText("disable Data source"); jMenuItem1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jMenuItem1ActionPerformed(evt); } }); jMenu2.add(jMenuItem1); jMenuBar1.add(jMenu2); setJMenuBar(jMenuBar1); org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(layout.createSequentialGroup() .addContainerGap() .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(statusLabel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 615, Short.MAX_VALUE) .add(jLabel2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 365, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .add(layout.createSequentialGroup() .add(10, 10, 10) .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(modifiersLabel) .add(jLabel1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 605, Short.MAX_VALUE)))) .addContainerGap()) .add(layout.createSequentialGroup() .add(dataSetSelector1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 615, Short.MAX_VALUE) .add(24, 24, 24)) ); layout.setVerticalGroup( layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(layout.createSequentialGroup() .add(dataSetSelector1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .add(45, 45, 45) .add(jLabel2) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(jLabel1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 23, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(modifiersLabel) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 139, Short.MAX_VALUE) .add(statusLabel) .addContainerGap()) ); pack(); }// //GEN-END:initComponents private void dataSetSelector1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_dataSetSelector1ActionPerformed this.jLabel1.setText( dataSetSelector1.getValue() ); this.modifiersLabel.setText( ""+KeyEvent.getKeyModifiersText(evt.getModifiers()) ); }//GEN-LAST:event_dataSetSelector1ActionPerformed private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem1ActionPerformed dataSetSelector1.setDisableDataSources(true); }//GEN-LAST:event_jMenuItem1ActionPerformed /** * @param args the command line arguments */ public static void main(String args[]) { java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new DataSetSelectorDemo().setVisible(true); } }); } // Variables declaration - do not modify//GEN-BEGIN:variables private org.autoplot.datasource.DataSetSelector dataSetSelector1; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel2; private javax.swing.JMenu jMenu1; private javax.swing.JMenu jMenu2; private javax.swing.JMenuBar jMenuBar1; private javax.swing.JMenuItem jMenuItem1; private javax.swing.JLabel modifiersLabel; private javax.swing.JLabel statusLabel; // End of variables declaration//GEN-END:variables }