--- /dev/null 2018-01-03 13:55:23.000000000 -0800 +++ new/core/JemmyBrowser/src/org/jemmy/browser/SearchDialog.java 2018-01-03 13:55:22.000000000 -0800 @@ -0,0 +1,155 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +/* + * SearchDialog.java + * + * Created on Nov 16, 2010, 7:30:59 PM + */ + +package org.jemmy.browser; + +import javax.swing.JTextField; + +/** + * + * @author shura + */ +public class SearchDialog extends javax.swing.JDialog { + private boolean doSearch; + + /** Creates new form SearchDialog */ + public SearchDialog(java.awt.Frame parent) { + super(parent, true); + initComponents(); + getRootPane().setDefaultButton(searchBtn); + } + + public boolean isConfirmed() { + return doSearch; + } + + /** 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(); + searchTF = new javax.swing.JTextField(); + cancelBtn = new javax.swing.JButton(); + searchBtn = new javax.swing.JButton(); + useProp = new javax.swing.JCheckBox(); + propSearch = new javax.swing.JTextField(); + + setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); + setModal(true); + + jLabel1.setText("Class name"); + + cancelBtn.setText("Cancel"); + cancelBtn.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + cancelBtnActionPerformed(evt); + } + }); + + searchBtn.setText("Search"); + searchBtn.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + searchBtnActionPerformed(evt); + } + }); + + useProp.setText("Property value"); + useProp.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + usePropActionPerformed(evt); + } + }); + + propSearch.setEnabled(false); + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); + getContentPane().setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addContainerGap() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() + .addComponent(searchBtn) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(cancelBtn)) + .addGroup(layout.createSequentialGroup() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(useProp) + .addComponent(jLabel1)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(searchTF, javax.swing.GroupLayout.DEFAULT_SIZE, 263, Short.MAX_VALUE) + .addComponent(propSearch, javax.swing.GroupLayout.DEFAULT_SIZE, 263, Short.MAX_VALUE)))) + .addContainerGap()) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addContainerGap() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel1) + .addComponent(searchTF, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(useProp) + .addComponent(propSearch, 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) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(cancelBtn) + .addComponent(searchBtn)) + .addContainerGap()) + ); + + pack(); + }// //GEN-END:initComponents + + private void cancelBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cancelBtnActionPerformed + doSearch = false; + setVisible(false); + }//GEN-LAST:event_cancelBtnActionPerformed + + private void searchBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_searchBtnActionPerformed + doSearch = true; + setVisible(false); + }//GEN-LAST:event_searchBtnActionPerformed + + private void usePropActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_usePropActionPerformed + propSearch.setEnabled(useProp.isSelected()); + if(useProp.isSelected()) { + propSearch.requestFocus(); + } + }//GEN-LAST:event_usePropActionPerformed + + public String getClassNameFilter() { + return searchTF.getText(); + } + + public String getPropertyFilter() { + return useProp.isSelected() ? propSearch.getText() : null; + } + + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JButton cancelBtn; + private javax.swing.JLabel jLabel1; + private javax.swing.JTextField propSearch; + private javax.swing.JButton searchBtn; + private javax.swing.JTextField searchTF; + private javax.swing.JCheckBox useProp; + // End of variables declaration//GEN-END:variables + +}