package org.das2.qds.filters; import java.util.regex.Matcher; import java.util.regex.Pattern; /** * * @author jbfaden */ public class SmoothDimensionFilterEditorPanel extends AbstractFilterEditorPanel { /** * Creates new form SmoothFilterEditorPanel */ public SmoothDimensionFilterEditorPanel() { 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() { jCheckBox1 = new javax.swing.JCheckBox(); jLabel1 = new javax.swing.JLabel(); sizeTF = new javax.swing.JTextField(); jCheckBox1.setText("jCheckBox1"); jLabel1.setText("Smooth over index 1, Boxcar Size: "); sizeTF.setText("3"); sizeTF.setPreferredSize(new java.awt.Dimension(50, 27)); 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(jLabel1) .add(2, 2, 2) .add(sizeTF, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); layout.setVerticalGroup( layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(layout.createSequentialGroup() .addContainerGap() .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) .add(jLabel1) .add(sizeTF, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); }// //GEN-END:initComponents // Variables declaration - do not modify//GEN-BEGIN:variables public javax.swing.JCheckBox jCheckBox1; public javax.swing.JLabel jLabel1; public javax.swing.JTextField sizeTF; // End of variables declaration//GEN-END:variables @Override public void setFilter(String filter) { Pattern p= Pattern.compile("\\|smooth1\\((\\d+)\\)"); Matcher m= p.matcher(filter); if ( m.matches() ) { sizeTF.setText( m.group(1) ); } } @Override public String getFilter() { return "|smooth1(" + sizeTF.getText() + ")"; } }