com.u2apple.rt.ui.RecognitionToolJFrame.java Source code

Java tutorial

Introduction

Here is the source code for com.u2apple.rt.ui.RecognitionToolJFrame.java

Source

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.u2apple.rt.ui;

import com.u2apple.rt.ui.worker.FilterWorker;
import com.u2apple.rt.ui.worker.ErrorDeviceWorker;
import com.u2apple.rt.ui.worker.WhiteListDeviceRankingWorker;
import com.u2apple.rt.ui.worker.DeviceRankingWorker;
import com.u2apple.rt.ui.worker.DeviceWorker;
import com.u2apple.rt.ui.worker.RootRankingWorker;
import com.u2apple.rt.ui.worker.ModelWorker;
import com.u2apple.rt.ui.worker.DeviceQueryWorker;
import com.u2apple.rt.constant.Constants;
import com.u2apple.rt.db.dao.DeviceDao;
import com.u2apple.rt.db.dao.DeviceDetailsDao;
import com.u2apple.rt.db.dao.DeviceLogDao;
import com.u2apple.rt.filter.DevicePatternFilter;
import com.u2apple.rt.model.AndroidDevice;
import com.u2apple.rt.model.AndroidDeviceRanking;
import com.u2apple.rt.model.Model;
import com.u2apple.rt.model.ProductId;
import com.u2apple.rt.table.DeviceDetailTableModel;
import com.u2apple.rt.table.DeviceTableModel;
import com.u2apple.rt.tool.KnockOffTool;
import com.u2apple.rt.tool.RecognitionTool;
import com.u2apple.rt.tool.TestCaseTool;
import com.u2apple.rt.ui.worker.ExcludeFilterWorker;
import com.u2apple.rt.ui.worker.NewDeviceFilterWorker;
import com.u2apple.rt.ui.worker.QueryFilterWorker;
import com.u2apple.rt.util.AndroidDeviceUtils;
import com.u2apple.rt.util.QueryPattern;
import java.io.IOException;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JOptionPane;
import javax.swing.SwingWorker;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import javax.swing.event.ListSelectionEvent;
import javax.swing.table.DefaultTableModel;
import org.apache.commons.lang3.StringUtils;
import org.dom4j.DocumentException;

/**
 *
 * @author Adam
 */
public class RecognitionToolJFrame extends javax.swing.JFrame {

    /**
     * Creates new form RecognitionToolJFrame
     */
    public RecognitionToolJFrame() {
        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")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        buttonGroup1 = new javax.swing.ButtonGroup();
        jTabbedPane1 = new javax.swing.JTabbedPane();
        jPanel1 = new javax.swing.JPanel();
        jPanel4 = new javax.swing.JPanel();
        jPanel5 = new javax.swing.JPanel();
        productIdLabel = new javax.swing.JLabel();
        productIdTextField = new javax.swing.JTextField();
        brandLabel = new javax.swing.JLabel();
        brandTextField = new javax.swing.JTextField();
        productLabel = new javax.swing.JLabel();
        productTextField = new javax.swing.JTextField();
        aliasLabel = new javax.swing.JLabel();
        aliasTextField = new javax.swing.JTextField();
        typeComboBox = new javax.swing.JComboBox();
        jLabel2 = new javax.swing.JLabel();
        productIdExistCheckBox = new javax.swing.JCheckBox();
        jPanel12 = new javax.swing.JPanel();
        jScrollPane4 = new javax.swing.JScrollPane();
        resultTextArea = new javax.swing.JTextArea();
        jPanel13 = new javax.swing.JPanel();
        connectButton = new javax.swing.JButton();
        deviceButton = new javax.swing.JButton();
        modelButton = new javax.swing.JButton();
        testCaseButton = new javax.swing.JButton();
        knockOffButton = new javax.swing.JButton();
        knockOffCheckBox = new javax.swing.JCheckBox();
        productIdButton = new javax.swing.JButton();
        updateModelButton = new javax.swing.JButton();
        conditionCheckBox = new javax.swing.JCheckBox();
        detailButton = new javax.swing.JButton();
        queryLimitSpinner = new javax.swing.JSpinner();
        allCheckBox = new javax.swing.JCheckBox();
        googleButton = new javax.swing.JButton();
        baiduButton = new javax.swing.JButton();
        sortButton = new javax.swing.JButton();
        updateTestCaseButton = new javax.swing.JButton();
        deviceCountButton = new javax.swing.JButton();
        addButton = new javax.swing.JButton();
        updateButton = new javax.swing.JButton();
        jPanel14 = new javax.swing.JPanel();
        resolutionLabel = new javax.swing.JLabel();
        resolutionComboBox = new javax.swing.JComboBox();
        partitionLabel = new javax.swing.JLabel();
        partitionTextField = new javax.swing.JTextField();
        jPanel6 = new javax.swing.JPanel();
        modelLabel = new javax.swing.JLabel();
        modelTextField = new javax.swing.JTextField();
        vidLabel = new javax.swing.JLabel();
        vidTextField = new javax.swing.JTextField();
        existCheckBox = new javax.swing.JCheckBox();
        existInVidCheckBox = new javax.swing.JCheckBox();
        conditionComboBox = new javax.swing.JComboBox();
        conditionTextField = new javax.swing.JTextField();
        jLabel3 = new javax.swing.JLabel();
        vid2TextField = new javax.swing.JTextField();
        condition2ComboBox = new javax.swing.JComboBox();
        condition2TextField = new javax.swing.JTextField();
        jScrollPane1 = new javax.swing.JScrollPane();
        deviceTable = new javax.swing.JTable();
        queryPanel = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        daysSpinner = new javax.swing.JSpinner();
        deviceRankingButton = new javax.swing.JButton();
        detailCheckBox = new javax.swing.JCheckBox();
        errorRecognitionButton = new javax.swing.JButton();
        queryTextField = new javax.swing.JTextField();
        queryButton = new javax.swing.JButton();
        whiteListButton = new javax.swing.JButton();
        rootSpritButton = new javax.swing.JButton();
        filterButton = new javax.swing.JButton();
        matchButton = new javax.swing.JButton();
        existenceFilterButton = new javax.swing.JButton();
        excludeFilterButton = new javax.swing.JButton();
        queryFilterButton = new javax.swing.JButton();
        removeDeviceButton = new javax.swing.JButton();
        othersDevicesButton = new javax.swing.JButton();
        jPanel2 = new javax.swing.JPanel();
        jScrollPane2 = new javax.swing.JScrollPane();
        deviceDetailTable = new javax.swing.JTable();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("Recognition Tool");

        jPanel5.setBorder(javax.swing.BorderFactory.createTitledBorder("Device"));

        productIdLabel.setFont(new java.awt.Font("", 0, 12)); // NOI18N
        productIdLabel.setText("Product ID:");

        productIdTextField.setFont(new java.awt.Font("", 0, 12)); // NOI18N
        productIdTextField.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                productIdTextFieldActionPerformed(evt);
            }
        });
        productIdTextField.addPropertyChangeListener(new java.beans.PropertyChangeListener() {
            public void propertyChange(java.beans.PropertyChangeEvent evt) {
                productIdTextFieldPropertyChange(evt);
            }
        });
        productIdTextField.getDocument().addDocumentListener(new DocumentListener() {
            public void changedUpdate(DocumentEvent e) {
            }

            public void removeUpdate(DocumentEvent e) {
                String productId = productIdTextField.getText();
                productIdExistCheckBox.setSelected(RecognitionTool.isProductIdExist(productId));
            }

            public void insertUpdate(DocumentEvent e) {
                String productId = productIdTextField.getText();
                productIdExistCheckBox.setSelected(RecognitionTool.isProductIdExist(productId));
            }
        });

        brandLabel.setFont(new java.awt.Font("", 0, 12)); // NOI18N
        brandLabel.setText("Brand:");

        brandTextField.setFont(new java.awt.Font("", 0, 12)); // NOI18N

        productLabel.setFont(new java.awt.Font("", 0, 12)); // NOI18N
        productLabel.setText("Product:");

        productTextField.setFont(new java.awt.Font("", 0, 12)); // NOI18N

        aliasLabel.setFont(new java.awt.Font("", 0, 12)); // NOI18N
        aliasLabel.setText("Alias:");

        aliasTextField.setFont(new java.awt.Font("", 0, 12)); // NOI18N

        typeComboBox.setFont(new java.awt.Font("", 0, 12)); // NOI18N
        typeComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Phone&Pad", "Box", "Watch" }));

        jLabel2.setFont(new java.awt.Font("", 0, 12)); // NOI18N
        jLabel2.setText("Type:");

        productIdExistCheckBox.setFont(new java.awt.Font("", 0, 12)); // NOI18N
        productIdExistCheckBox.setText("Product ID");
        productIdExistCheckBox.setEnabled(false);

        javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5);
        jPanel5.setLayout(jPanel5Layout);
        jPanel5Layout.setHorizontalGroup(jPanel5Layout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel5Layout.createSequentialGroup()
                        .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                .addComponent(productIdLabel).addComponent(brandLabel).addComponent(jLabel2))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(jPanel5Layout.createSequentialGroup().addGroup(jPanel5Layout
                                        .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                        .addComponent(brandTextField, javax.swing.GroupLayout.DEFAULT_SIZE, 208,
                                                Short.MAX_VALUE)
                                        .addComponent(productIdTextField)).addGap(37, 37, 37)
                                        .addGroup(jPanel5Layout
                                                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                                .addGroup(jPanel5Layout.createSequentialGroup()
                                                        .addComponent(productLabel)
                                                        .addPreferredGap(
                                                                javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                                        .addComponent(productTextField,
                                                                javax.swing.GroupLayout.PREFERRED_SIZE, 209,
                                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                                        .addGap(44, 44, 44).addComponent(aliasLabel)
                                                        .addGap(18, 18, 18).addComponent(aliasTextField,
                                                                javax.swing.GroupLayout.PREFERRED_SIZE, 208,
                                                                javax.swing.GroupLayout.PREFERRED_SIZE))
                                                .addComponent(productIdExistCheckBox)))
                                .addComponent(typeComboBox, javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));
        jPanel5Layout.setVerticalGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel5Layout.createSequentialGroup().addContainerGap().addGroup(jPanel5Layout
                        .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(productIdLabel)
                        .addComponent(productIdTextField, javax.swing.GroupLayout.PREFERRED_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(productIdExistCheckBox)).addGap(9, 9, 9)
                        .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(productLabel)
                                .addComponent(productTextField, javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(brandLabel)
                                .addComponent(brandTextField, javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(aliasLabel).addComponent(aliasTextField,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 16, Short.MAX_VALUE)
                        .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(jLabel2).addComponent(typeComboBox,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addContainerGap()));

        jPanel12.setBorder(javax.swing.BorderFactory.createTitledBorder("Result"));

        resultTextArea.setColumns(20);
        resultTextArea.setFont(new java.awt.Font("", 0, 13)); // NOI18N
        resultTextArea.setRows(5);
        jScrollPane4.setViewportView(resultTextArea);

        javax.swing.GroupLayout jPanel12Layout = new javax.swing.GroupLayout(jPanel12);
        jPanel12.setLayout(jPanel12Layout);
        jPanel12Layout
                .setHorizontalGroup(jPanel12Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel12Layout.createSequentialGroup()
                                .addContainerGap().addComponent(jScrollPane4).addContainerGap()));
        jPanel12Layout
                .setVerticalGroup(
                        jPanel12Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel12Layout
                                        .createSequentialGroup().addContainerGap().addComponent(jScrollPane4,
                                                javax.swing.GroupLayout.DEFAULT_SIZE, 122, Short.MAX_VALUE)
                                        .addContainerGap()));

        jPanel13.setBorder(javax.swing.BorderFactory.createTitledBorder("Action"));

        connectButton.setFont(new java.awt.Font("", 0, 12)); // NOI18N
        connectButton
                .setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/u2apple/rt/icon/calendar.png"))); // NOI18N
        connectButton.setToolTipText("Get the latest device information.");
        connectButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                connectButtonActionPerformed(evt);
            }
        });

        deviceButton.setFont(new java.awt.Font("", 0, 12)); // NOI18N
        deviceButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/u2apple/rt/icon/device.png"))); // NOI18N
        deviceButton.setToolTipText("Add device");
        deviceButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                deviceButtonActionPerformed(evt);
            }
        });

        modelButton.setFont(new java.awt.Font("", 0, 12)); // NOI18N
        modelButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/u2apple/rt/icon/add.png"))); // NOI18N
        modelButton.setToolTipText("Add model to system mode and recovery mode");
        modelButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                modelButtonActionPerformed(evt);
            }
        });

        testCaseButton.setFont(new java.awt.Font("", 0, 12)); // NOI18N
        testCaseButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/u2apple/rt/icon/test.png"))); // NOI18N
        testCaseButton.setToolTipText("Add test case");
        testCaseButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                testCaseButtonActionPerformed(evt);
            }
        });

        knockOffButton.setFont(new java.awt.Font("", 0, 12)); // NOI18N
        knockOffButton
                .setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/u2apple/rt/icon/knockoff.png"))); // NOI18N
        knockOffButton.setToolTipText("Generate Knock-Off configuration");
        knockOffButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                knockOffButtonActionPerformed(evt);
            }
        });

        knockOffCheckBox.setFont(new java.awt.Font("", 0, 12)); // NOI18N
        knockOffCheckBox.setText("Knock-Off");

        productIdButton.setFont(new java.awt.Font("", 0, 12)); // NOI18N
        productIdButton
                .setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/u2apple/rt/icon/robot.png"))); // NOI18N
        productIdButton.setToolTipText("Fullfill device information");
        productIdButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                productIdButtonActionPerformed(evt);
            }
        });

        updateModelButton.setFont(new java.awt.Font("", 0, 12)); // NOI18N
        updateModelButton
                .setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/u2apple/rt/icon/fix.png"))); // NOI18N
        updateModelButton.setToolTipText("Add model to current vid");
        updateModelButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                updateModelButtonActionPerformed(evt);
            }
        });

        conditionCheckBox.setFont(new java.awt.Font("", 0, 12)); // NOI18N
        conditionCheckBox.setText("Condition");

        detailButton.setFont(new java.awt.Font("", 0, 12)); // NOI18N
        detailButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/u2apple/rt/icon/info.png"))); // NOI18N
        detailButton.setToolTipText("Device detail");
        detailButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                detailButtonActionPerformed(evt);
            }
        });

        queryLimitSpinner.setFont(new java.awt.Font("", 0, 12)); // NOI18N
        queryLimitSpinner.setModel(new javax.swing.SpinnerNumberModel(10, 1, 100, 10));

        allCheckBox.setFont(new java.awt.Font("", 0, 12)); // NOI18N
        allCheckBox.setText("All");

        googleButton.setFont(new java.awt.Font("", 0, 12)); // NOI18N
        googleButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/u2apple/rt/icon/google.png"))); // NOI18N
        googleButton.setToolTipText("Google");
        googleButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                googleButtonActionPerformed(evt);
            }
        });

        baiduButton.setFont(new java.awt.Font("", 0, 12)); // NOI18N
        baiduButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/u2apple/rt/icon/baidu.png"))); // NOI18N
        baiduButton.setToolTipText("Baidu");
        baiduButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                baiduButtonActionPerformed(evt);
            }
        });

        sortButton.setFont(new java.awt.Font("", 0, 12)); // NOI18N
        sortButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/u2apple/rt/icon/sort.png"))); // NOI18N
        sortButton.setToolTipText("Sort models under a vid");
        sortButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                sortButtonActionPerformed(evt);
            }
        });

        updateTestCaseButton.setFont(new java.awt.Font("", 0, 12)); // NOI18N
        updateTestCaseButton.setIcon(
                new javax.swing.ImageIcon(getClass().getResource("/com/u2apple/rt/icon/updateTestCase.png"))); // NOI18N
        updateTestCaseButton.setToolTipText("Update test case");
        updateTestCaseButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                updateTestCaseButtonActionPerformed(evt);
            }
        });

        deviceCountButton.setFont(new java.awt.Font("", 0, 12)); // NOI18N
        deviceCountButton
                .setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/u2apple/rt/icon/calculator.png"))); // NOI18N
        deviceCountButton.setToolTipText("Device Count");
        deviceCountButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                deviceCountButtonActionPerformed(evt);
            }
        });

        addButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/u2apple/rt/icon/new.png"))); // NOI18N
        addButton.setToolTipText("Add new device and model");
        addButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                addButtonActionPerformed(evt);
            }
        });

        updateButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/u2apple/rt/icon/update.png"))); // NOI18N
        updateButton.setToolTipText("Update");
        updateButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                updateButtonActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel13Layout = new javax.swing.GroupLayout(jPanel13);
        jPanel13.setLayout(jPanel13Layout);
        jPanel13Layout
                .setHorizontalGroup(jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(jPanel13Layout.createSequentialGroup().addContainerGap()
                                .addGroup(jPanel13Layout
                                        .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                        .addComponent(productIdButton, javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                        .addComponent(deviceButton, javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                        .addComponent(knockOffButton, javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                                .addGap(77, 77, 77)
                                .addGroup(jPanel13Layout
                                        .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                        .addComponent(testCaseButton, javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                        .addComponent(modelButton, javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                        .addComponent(detailButton, javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                                .addGap(76, 76, 76)
                                .addGroup(jPanel13Layout
                                        .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                        .addComponent(updateTestCaseButton, javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                        .addComponent(updateModelButton, javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                        .addComponent(queryLimitSpinner))
                                .addGap(61, 61, 61)
                                .addGroup(jPanel13Layout
                                        .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                        .addGroup(jPanel13Layout
                                                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                                .addComponent(conditionCheckBox).addComponent(knockOffCheckBox,
                                                        javax.swing.GroupLayout.Alignment.TRAILING))
                                        .addComponent(allCheckBox, javax.swing.GroupLayout.PREFERRED_SIZE, 81,
                                                javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addGap(20, 20, 20)
                                .addGroup(jPanel13Layout
                                        .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                        .addGroup(jPanel13Layout
                                                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING,
                                                        false)
                                                .addComponent(sortButton, javax.swing.GroupLayout.DEFAULT_SIZE,
                                                        javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                                .addComponent(connectButton, javax.swing.GroupLayout.DEFAULT_SIZE,
                                                        javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                                        .addComponent(addButton, javax.swing.GroupLayout.Alignment.TRAILING))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED,
                                        javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addGroup(jPanel13Layout
                                        .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                        .addComponent(updateButton)
                                        .addGroup(jPanel13Layout.createSequentialGroup()
                                                .addComponent(deviceCountButton).addGap(47, 47, 47)
                                                .addComponent(googleButton).addGap(35, 35, 35)
                                                .addComponent(baiduButton)))
                                .addGap(69, 69, 69)));
        jPanel13Layout.setVerticalGroup(jPanel13Layout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel13Layout.createSequentialGroup().addGap(28, 28, 28).addGroup(jPanel13Layout
                        .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(jPanel13Layout
                                        .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                        .addComponent(detailButton).addComponent(connectButton)
                                        .addComponent(queryLimitSpinner, javax.swing.GroupLayout.PREFERRED_SIZE, 41,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addComponent(allCheckBox, javax.swing.GroupLayout.PREFERRED_SIZE, 41,
                                                javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addComponent(productIdButton, javax.swing.GroupLayout.Alignment.TRAILING)
                                .addComponent(deviceCountButton).addComponent(googleButton))
                        .addComponent(baiduButton)).addGap(18, 18, 18)
                        .addGroup(jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(jPanel13Layout.createSequentialGroup().addGroup(jPanel13Layout
                                        .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                        .addComponent(deviceButton, javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                        .addComponent(modelButton, javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                        .addComponent(updateModelButton, javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                        .addComponent(addButton).addComponent(conditionCheckBox)).addGap(18, 18, 18)
                                        .addGroup(jPanel13Layout
                                                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                                .addGroup(jPanel13Layout
                                                        .createParallelGroup(
                                                                javax.swing.GroupLayout.Alignment.BASELINE)
                                                        .addComponent(testCaseButton).addComponent(knockOffButton)
                                                        .addComponent(knockOffCheckBox))
                                                .addComponent(updateTestCaseButton).addComponent(sortButton)))
                                .addComponent(updateButton))
                        .addGap(0, 0, Short.MAX_VALUE)));

        jPanel14.setBorder(javax.swing.BorderFactory.createTitledBorder("Knock-Off"));

        resolutionLabel.setFont(new java.awt.Font("", 0, 12)); // NOI18N
        resolutionLabel.setText("Resolution:");

        resolutionComboBox.setFont(new java.awt.Font("", 0, 12)); // NOI18N
        resolutionComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "320x480", "480x800",
                "480x854", "540x960", "720x1184", "720x1280", "800x1280", "1080x1776", "1080x1920", "1440x2392" }));
        resolutionComboBox.setSelectedIndex(5);

        partitionLabel.setFont(new java.awt.Font("", 0, 12)); // NOI18N
        partitionLabel.setText("Partition:");

        partitionTextField.setFont(new java.awt.Font("", 0, 12)); // NOI18N

        javax.swing.GroupLayout jPanel14Layout = new javax.swing.GroupLayout(jPanel14);
        jPanel14.setLayout(jPanel14Layout);
        jPanel14Layout.setHorizontalGroup(jPanel14Layout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel14Layout.createSequentialGroup().addContainerGap()
                        .addGroup(jPanel14Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(resolutionLabel).addComponent(partitionLabel))
                        .addGap(18, 18, 18)
                        .addGroup(jPanel14Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(jPanel14Layout.createSequentialGroup()
                                        .addComponent(resolutionComboBox, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addGap(0, 0, Short.MAX_VALUE))
                                .addComponent(partitionTextField))
                        .addContainerGap()));
        jPanel14Layout.setVerticalGroup(jPanel14Layout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel14Layout.createSequentialGroup()
                        .addGroup(jPanel14Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(resolutionLabel).addComponent(resolutionComboBox,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel14Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(partitionLabel).addComponent(partitionTextField,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE))));

        jPanel6.setBorder(javax.swing.BorderFactory.createTitledBorder("Model"));

        modelLabel.setFont(new java.awt.Font("", 0, 12)); // NOI18N
        modelLabel.setText("Model:");

        modelTextField.setFont(new java.awt.Font("", 0, 12)); // NOI18N
        modelTextField.getDocument().addDocumentListener(new DocumentListener() {
            public void changedUpdate(DocumentEvent e) {
                checkModelExistence();
            }

            public void removeUpdate(DocumentEvent e) {
                checkModelExistence();
            }

            public void insertUpdate(DocumentEvent e) {
                checkModelExistence();
            }
        });

        vidLabel.setFont(new java.awt.Font("", 0, 12)); // NOI18N
        vidLabel.setText("VID:");

        vidTextField.setFont(new java.awt.Font("", 0, 12)); // NOI18N
        vidTextField.getDocument().addDocumentListener(new DocumentListener() {
            public void changedUpdate(DocumentEvent e) {
                checkModelExistence();
            }

            public void removeUpdate(DocumentEvent e) {
                checkModelExistence();
            }

            public void insertUpdate(DocumentEvent e) {
                checkModelExistence();
            }
        });

        existCheckBox.setFont(new java.awt.Font("", 0, 12)); // NOI18N
        existCheckBox.setText("Global");
        existCheckBox.setToolTipText("Model exist?");
        existCheckBox.setEnabled(false);
        existCheckBox.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                existCheckBoxActionPerformed(evt);
            }
        });

        existInVidCheckBox.setFont(new java.awt.Font("", 0, 12)); // NOI18N
        existInVidCheckBox.setText("VID");
        existInVidCheckBox.setEnabled(false);
        existInVidCheckBox.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                existInVidCheckBoxActionPerformed(evt);
            }
        });

        conditionComboBox.setFont(new java.awt.Font("", 0, 12)); // NOI18N
        conditionComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Board", "Brand", "Cpu",
                "Device", "Hardware", "Manufacturer", "Adb_Device", "Display_ID" }));
        conditionComboBox.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                conditionComboBoxActionPerformed(evt);
            }
        });

        conditionTextField.setFont(new java.awt.Font("", 0, 12)); // NOI18N
        conditionTextField.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusGained(java.awt.event.FocusEvent evt) {
                conditionTextFieldFocusGained(evt);
            }
        });

        jLabel3.setFont(new java.awt.Font("", 0, 12)); // NOI18N
        jLabel3.setText("VID2:");

        vid2TextField.setFont(new java.awt.Font("", 0, 12)); // NOI18N

        condition2ComboBox.setFont(new java.awt.Font("", 0, 12)); // NOI18N
        condition2ComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Board", "Brand", "Cpu",
                "Device", "Hardware", "Manufacturer", "Adb_Device", "Display_ID" }));
        condition2ComboBox.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                condition2ComboBoxActionPerformed(evt);
            }
        });

        condition2TextField.setFont(new java.awt.Font("", 0, 12)); // NOI18N

        javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(jPanel6);
        jPanel6.setLayout(jPanel6Layout);
        jPanel6Layout.setHorizontalGroup(jPanel6Layout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel6Layout.createSequentialGroup().addContainerGap().addComponent(vidLabel)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(vidTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 50,
                                javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED).addComponent(jLabel3)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(vid2TextField, javax.swing.GroupLayout.PREFERRED_SIZE, 50,
                                javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18).addComponent(modelLabel)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(modelTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 160,
                                javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(existCheckBox).addComponent(existInVidCheckBox))
                        .addGap(18, 18, 18)
                        .addComponent(conditionComboBox, javax.swing.GroupLayout.PREFERRED_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(conditionTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 124,
                                javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(condition2ComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, 94,
                                javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(condition2TextField, javax.swing.GroupLayout.PREFERRED_SIZE, 128,
                                javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addContainerGap()));
        jPanel6Layout.setVerticalGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel6Layout.createSequentialGroup().addComponent(existCheckBox)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED,
                                javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(existInVidCheckBox))
                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel6Layout.createSequentialGroup()
                        .addContainerGap(18, Short.MAX_VALUE)
                        .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel6Layout
                                        .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                        .addComponent(vidLabel)
                                        .addComponent(vidTextField, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addComponent(modelLabel)
                                        .addComponent(modelTextField, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addComponent(jLabel3).addComponent(vid2TextField,
                                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel6Layout
                                        .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                        .addComponent(conditionTextField, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addComponent(conditionComboBox, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addComponent(condition2ComboBox, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addComponent(condition2TextField, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addContainerGap()));

        javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
        jPanel4.setLayout(jPanel4Layout);
        jPanel4Layout.setHorizontalGroup(jPanel4Layout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel4Layout.createSequentialGroup().addContainerGap()
                        .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(jPanel12, javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addComponent(jPanel13, javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addComponent(jPanel5, javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addComponent(jPanel14, javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addComponent(jPanel6, javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))));
        jPanel4Layout.setVerticalGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel4Layout.createSequentialGroup().addContainerGap(19, Short.MAX_VALUE)
                        .addComponent(jPanel5, javax.swing.GroupLayout.PREFERRED_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jPanel6, javax.swing.GroupLayout.PREFERRED_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jPanel14, javax.swing.GroupLayout.PREFERRED_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jPanel13, javax.swing.GroupLayout.PREFERRED_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jPanel12, javax.swing.GroupLayout.PREFERRED_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addContainerGap()));

        deviceTable.setFont(new java.awt.Font("", 0, 12)); // NOI18N
        deviceTable.setModel(new DeviceTableModel(new ArrayList<AndroidDeviceRanking>()));
        initRowSelectionEvent();
        jScrollPane1.setViewportView(deviceTable);

        jLabel1.setFont(new java.awt.Font("", 0, 12)); // NOI18N
        jLabel1.setText("Days:");

        daysSpinner.setFont(new java.awt.Font("", 0, 12)); // NOI18N
        daysSpinner.setModel(new javax.swing.SpinnerNumberModel(1, 1, 10, 1));

        deviceRankingButton.setFont(new java.awt.Font("", 0, 12)); // NOI18N
        deviceRankingButton
                .setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/u2apple/rt/icon/trend.png"))); // NOI18N
        deviceRankingButton.setToolTipText("Unrecognized devices trend");
        deviceRankingButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                deviceRankingButtonActionPerformed(evt);
            }
        });

        detailCheckBox.setFont(new java.awt.Font("", 0, 12)); // NOI18N
        detailCheckBox.setText("Detail");
        detailCheckBox.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                detailCheckBoxActionPerformed(evt);
            }
        });

        errorRecognitionButton.setFont(new java.awt.Font("", 0, 12)); // NOI18N
        errorRecognitionButton
                .setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/u2apple/rt/icon/error.png"))); // NOI18N
        errorRecognitionButton.setToolTipText("Query incorrect recognized devices");
        errorRecognitionButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                errorRecognitionButtonActionPerformed(evt);
            }
        });

        queryTextField.setFont(new java.awt.Font("", 0, 14)); // NOI18N
        queryTextField.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                queryTextFieldActionPerformed(evt);
            }
        });

        queryButton.setFont(new java.awt.Font("", 0, 12)); // NOI18N
        queryButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/u2apple/rt/icon/search.png"))); // NOI18N
        queryButton.setToolTipText("Query by model");
        queryButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                queryButtonActionPerformed(evt);
            }
        });

        whiteListButton.setFont(new java.awt.Font("", 0, 12)); // NOI18N
        whiteListButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/u2apple/rt/icon/list.png"))); // NOI18N
        whiteListButton.setToolTipText("White List");
        whiteListButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                whiteListButtonActionPerformed(evt);
            }
        });

        rootSpritButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/u2apple/rt/icon/root.png"))); // NOI18N
        rootSpritButton.setToolTipText("Mobile root spirit device ranking list");
        rootSpritButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                rootSpritButtonActionPerformed(evt);
            }
        });

        filterButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/u2apple/rt/icon/filter.png"))); // NOI18N
        filterButton.setToolTipText("Pattern Filter");
        filterButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                filterButtonActionPerformed(evt);
            }
        });

        matchButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/u2apple/rt/icon/match.png"))); // NOI18N
        matchButton.setToolTipText("Check if model pattern matches");
        matchButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                matchButtonActionPerformed(evt);
            }
        });

        existenceFilterButton
                .setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/u2apple/rt/icon/brand-new.png"))); // NOI18N
        existenceFilterButton.setToolTipText("Brand new devices filter");
        existenceFilterButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                existenceFilterButtonActionPerformed(evt);
            }
        });

        excludeFilterButton
                .setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/u2apple/rt/icon/exclude.png"))); // NOI18N
        excludeFilterButton.setToolTipText("Exclude filter");
        excludeFilterButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                excludeFilterButtonActionPerformed(evt);
            }
        });

        queryFilterButton
                .setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/u2apple/rt/icon/query.png"))); // NOI18N
        queryFilterButton.setToolTipText("Query filter");
        queryFilterButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                queryFilterButtonActionPerformed(evt);
            }
        });

        removeDeviceButton
                .setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/u2apple/rt/icon/remove.png"))); // NOI18N
        removeDeviceButton.setToolTipText("Remove row");
        removeDeviceButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                removeDeviceButtonActionPerformed(evt);
            }
        });

        othersDevicesButton
                .setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/u2apple/rt/icon/others.png"))); // NOI18N
        othersDevicesButton.setToolTipText("Others");
        othersDevicesButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                othersDevicesButtonActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout queryPanelLayout = new javax.swing.GroupLayout(queryPanel);
        queryPanel.setLayout(queryPanelLayout);
        queryPanelLayout.setHorizontalGroup(queryPanelLayout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(queryPanelLayout.createSequentialGroup().addGroup(queryPanelLayout
                        .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(queryPanelLayout.createSequentialGroup().addComponent(filterButton)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED,
                                        javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addComponent(othersDevicesButton)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(matchButton)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(existenceFilterButton)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(excludeFilterButton)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(queryFilterButton).addGap(112, 112, 112)
                                .addGroup(queryPanelLayout
                                        .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                        .addGroup(queryPanelLayout.createSequentialGroup().addComponent(jLabel1)
                                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                .addComponent(daysSpinner, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                                        .addComponent(detailCheckBox))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(deviceRankingButton, javax.swing.GroupLayout.PREFERRED_SIZE, 68,
                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addComponent(queryTextField))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(queryPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(queryPanelLayout.createSequentialGroup().addComponent(rootSpritButton)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED,
                                                javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                        .addComponent(whiteListButton)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(errorRecognitionButton))
                                .addGroup(queryPanelLayout.createSequentialGroup().addComponent(queryButton)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED,
                                                javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                        .addComponent(removeDeviceButton)))
                        .addGap(20, 20, 20)));
        queryPanelLayout.setVerticalGroup(queryPanelLayout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(queryPanelLayout.createSequentialGroup().addContainerGap().addGroup(queryPanelLayout
                        .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(queryPanelLayout.createSequentialGroup().addGroup(queryPanelLayout
                                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(errorRecognitionButton, javax.swing.GroupLayout.Alignment.TRAILING)
                                .addComponent(whiteListButton, javax.swing.GroupLayout.Alignment.TRAILING)
                                .addComponent(rootSpritButton, javax.swing.GroupLayout.Alignment.TRAILING)
                                .addComponent(deviceRankingButton, javax.swing.GroupLayout.Alignment.TRAILING,
                                        javax.swing.GroupLayout.PREFERRED_SIZE, 41,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(queryFilterButton, javax.swing.GroupLayout.Alignment.TRAILING)
                                .addComponent(excludeFilterButton, javax.swing.GroupLayout.Alignment.TRAILING)
                                .addComponent(existenceFilterButton, javax.swing.GroupLayout.Alignment.TRAILING))
                                .addGap(0, 0, Short.MAX_VALUE))
                        .addGroup(queryPanelLayout.createSequentialGroup().addGroup(queryPanelLayout
                                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(filterButton)
                                .addGroup(queryPanelLayout.createSequentialGroup().addGroup(queryPanelLayout
                                        .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                        .addComponent(daysSpinner, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addComponent(jLabel1))
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(detailCheckBox))
                                .addComponent(othersDevicesButton).addComponent(matchButton))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED,
                                        javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
                        .addGroup(queryPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(queryButton)
                                .addGroup(queryPanelLayout
                                        .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                        .addComponent(queryTextField, javax.swing.GroupLayout.Alignment.TRAILING,
                                                javax.swing.GroupLayout.PREFERRED_SIZE, 41,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addComponent(removeDeviceButton)))
                        .addContainerGap()));

        deviceDetailTable.setFont(new java.awt.Font("", 0, 12)); // NOI18N
        deviceDetailTable.setModel(new DeviceDetailTableModel(new ArrayList<AndroidDevice>()));
        deviceDetailTable.setCellSelectionEnabled(true);
        jScrollPane2.setViewportView(deviceDetailTable);

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout
                .setHorizontalGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addComponent(jScrollPane2, javax.swing.GroupLayout.Alignment.TRAILING));
        jPanel2Layout.setVerticalGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
                        jPanel2Layout.createSequentialGroup()
                                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 218,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(29, 29, 29)));

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(jPanel1Layout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel1Layout.createSequentialGroup().addContainerGap().addGroup(jPanel1Layout
                        .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addGroup(jPanel1Layout.createSequentialGroup()
                                .addGroup(jPanel1Layout
                                        .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                        .addComponent(queryPanel, javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                        .addGroup(jPanel1Layout.createSequentialGroup()
                                                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                        903, javax.swing.GroupLayout.PREFERRED_SIZE)
                                                .addGap(0, 0, Short.MAX_VALUE)))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jPanel4, javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
                        .addContainerGap()));
        jPanel1Layout
                .setVerticalGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(jPanel1Layout.createSequentialGroup().addGroup(jPanel1Layout
                                .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                .addGroup(jPanel1Layout.createSequentialGroup().addContainerGap()
                                        .addComponent(queryPanel, javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                        .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 580,
                                                javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, 229,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));

        jTabbedPane1.addTab("Recognition Tool", jPanel1);

        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().addComponent(jTabbedPane1).addContainerGap()));
        layout.setVerticalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addComponent(jTabbedPane1));

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void initRowSelectionEvent() {
        deviceTable.getSelectionModel().addListSelectionListener(new javax.swing.event.ListSelectionListener() {
            @Override
            public void valueChanged(ListSelectionEvent e) {
                int row = deviceTable.getSelectedRow();
                //When refresh table model data, row will be -1.
                if (row >= 0) {
                    String vid = (String) deviceTable.getValueAt(row, 0);
                    String model = (String) deviceTable.getValueAt(row, 1);
                    String brand = (String) deviceTable.getValueAt(row, 2);
                    vidTextField.setText(vid);
                    modelTextField.setText(model);
                    brandTextField.setText(brand);
                    //check if model exist
                    // existCheckBox.setSelected(RecognitionTool.isTextExist(model));
                    //  existInVidCheckBox.setSelected(RecognitionTool.isTextExist(vid, model));
                    //Details.
                    if (detailCheckBox.isSelected()) {
                        DeviceDetailsDao dao = new DeviceDetailsDao();
                        if (StringUtils.isNotBlank(vid) && StringUtils.isNotBlank(brand)
                                && StringUtils.isNotBlank(model)) {

                            AndroidDevice device = dao.getDevice(vid, brand, model);
                            if (device != null) {
                                resolutionComboBox.setSelectedItem(device.getResolution());
                                partitionTextField.setText(device.getPartitions());
                            }
                        }
                    }
                }
                //Auto fullfil device information.
                initDevice();
            }
        });
    }

    private void deviceButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_deviceButtonActionPerformed
        addDevice();
    }//GEN-LAST:event_deviceButtonActionPerformed

    private void addDevice() {
        String productId = productIdTextField.getText();
        String brand = brandTextField.getText();
        String product = productTextField.getText();
        String alias = aliasTextField.getText();
        int type = typeComboBox.getSelectedIndex();
        if (StringUtils.isBlank(productId)) {
            JOptionPane.showMessageDialog(jPanel13, "Product ID should not be blank.");
        } else if (StringUtils.isBlank(brand)) {
            JOptionPane.showMessageDialog(jPanel13, "Brand should not be blank.");
        } else if (StringUtils.isBlank(product)) {
            JOptionPane.showMessageDialog(jPanel13, "Product should not be blank.");
        } else {
            //Disable.
            RecognitionTool.addDevice(productId, brand, product, alias, type);
            resultTextArea.setText("Add device " + productId);
            //            String xml = RecognitionTool.getDevice(productId, brand, product, alias);
            //            resultTextArea.setText(xml);
        }
    }

    private void productIdTextFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_productIdTextFieldActionPerformed

    }//GEN-LAST:event_productIdTextFieldActionPerformed

    private void knockOffButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_knockOffButtonActionPerformed
        String productId = StringUtils.trim(productIdTextField.getText());
        String resolution = StringUtils.trim((String) resolutionComboBox.getSelectedItem());
        String partition = StringUtils.trim(partitionTextField.getText());

        if (StringUtils.isBlank(productId)) {
            JOptionPane.showMessageDialog(jPanel13, "Product ID should not be blank.");
        } else if (StringUtils.isBlank(resolution)) {
            JOptionPane.showMessageDialog(jPanel13, "Resolution should not be blank.");
        } else if (StringUtils.isBlank(partition)) {
            JOptionPane.showMessageDialog(jPanel13, "Partition should not be blank.");
        } else {
            String config = KnockOffTool.getKnockOffConfig(productId, resolution, partition);
            resultTextArea.setText(config);
        }
    }//GEN-LAST:event_knockOffButtonActionPerformed

    private void testCaseButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_testCaseButtonActionPerformed
        addTestCase();
    }//GEN-LAST:event_testCaseButtonActionPerformed

    private void addTestCase() {
        final String productId = StringUtils.trim(productIdTextField.getText());
        final String vid = StringUtils.trim(vidTextField.getText());
        final String roProductModel = StringUtils.trim(modelTextField.getText());
        final String vid2 = StringUtils.trim(vid2TextField.getText());
        //Validation.
        if (StringUtils.isBlank(productId)) {
            JOptionPane.showMessageDialog(jPanel13, "Product ID should not be blank.");
        } else if (StringUtils.isBlank(vid)) {
            JOptionPane.showMessageDialog(jPanel13, "Vid should not be blank.");
        } else if (StringUtils.isBlank(roProductModel)) {
            JOptionPane.showMessageDialog(jPanel13, "ro.product.model should not be blank.");
        } else {
            //Generate test case.
            Set<String> vidSet = new HashSet<>();
            vidSet.add(vid);
            if (!StringUtils.equalsIgnoreCase(vid, Constants.RECOVERY_VID)) {
                vidSet.add(Constants.RECOVERY_VID);
            }
            if (StringUtils.isNotBlank(vid2)) {
                vidSet.add(vid2);
            }
            generateTestCase(vidSet.toArray(new String[vidSet.size()]), roProductModel, productId);
        }
    }

    private void generateTestCase(String[] vids, String roProductModel, String productId) {
        //Generate test case.
        String text;
        text = "Add test case for " + Arrays.toString(vids) + " model " + roProductModel;
        //Setting required properties.
        AndroidDevice androidDevice = new AndroidDevice();
        //            androidDevice.setVid(vid);
        androidDevice.setRoProductModel(roProductModel);
        androidDevice.setProductId(productId);
        androidDevice.setVids(vids);

        if (knockOffCheckBox.isSelected()) {
            //TODO: knock off case.
            String partitions = StringUtils.trim(partitionTextField.getText());
            String resolution = StringUtils.trim((String) resolutionComboBox.getSelectedItem());
            text = TestCaseTool.generateDeviceTestCase(productId, vids[0], roProductModel, resolution, partitions);
        }

        if (conditionCheckBox.isSelected()) {
            //1st condition.
            String condition = (String) conditionComboBox.getSelectedItem();
            String conditionValue = conditionTextField.getText();
            if (StringUtils.isNotBlank(conditionValue)) {
                switch (condition) {
                case "Board":
                    androidDevice.setRoProductBoard(conditionValue);
                    break;
                case "Brand":
                    //                        String roProductBrand = AndroidDeviceUtils.getBrandByProductId(productId);
                    androidDevice.setRoProductBrand(conditionValue);
                    break;
                case "Cpu":
                    androidDevice.setCpuHardware(conditionValue);
                    break;
                case "Device":
                    androidDevice.setRoProductDevice(conditionValue);
                    break;
                case "Hardware":
                    androidDevice.setRoHardware(conditionValue);
                    break;
                case "Manufacturer":
                    androidDevice.setRoProductManufacturer(conditionValue);
                    break;
                case "Adb_Device":
                    androidDevice.setAdbDevice(conditionValue);
                    break;
                case "Display_ID":
                    androidDevice.setRoBuildDisplayId(conditionValue);
                }
            }

            //2nd condition.
            String condition2 = (String) condition2ComboBox.getSelectedItem();
            String condition2Value = condition2TextField.getText();
            if (StringUtils.isNotBlank(condition2Value) && !condition.equalsIgnoreCase(condition2)) {
                switch (condition2) {
                case "Board":
                    androidDevice.setRoProductBoard(condition2Value);
                    break;
                case "Brand":
                    androidDevice.setRoProductBrand(condition2Value);
                    break;
                case "Cpu":
                    androidDevice.setCpuHardware(condition2Value);
                    break;
                case "Device":
                    androidDevice.setRoProductDevice(condition2Value);
                    break;
                case "Hardware":
                    androidDevice.setRoHardware(condition2Value);
                    break;
                case "Manufacturer":
                    androidDevice.setRoProductManufacturer(condition2Value);
                    break;
                case "Adb_Device":
                    androidDevice.setAdbDevice(condition2Value);
                    break;
                case "Display_ID":
                    androidDevice.setRoBuildDisplayId(conditionValue);
                }
            }

        }
        TestCaseTool.generateTestCase(androidDevice);
        resultTextArea.append(System.getProperty("line.separator"));
        resultTextArea.append(text);
    }

    private void connectButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_connectButtonActionPerformed
        AndroidDevice device = new DeviceDao().getLatestDevice();
        if (device != null) {
            productIdTextField.setText(device.getProductId());
            brandTextField.setText(device.getRoProductBrand());
            vidTextField.setText(device.getVid());
            modelTextField.setText(device.getRoProductModel());
            partitionTextField.setText(device.getPartitions());
            resolutionComboBox.setSelectedItem(device.getResolution());
        }
    }//GEN-LAST:event_connectButtonActionPerformed

    private void deviceRankingButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_deviceRankingButtonActionPerformed
        int days = (int) daysSpinner.getValue();
        new DeviceRankingWorker(days, this.deviceTable).execute();
    }//GEN-LAST:event_deviceRankingButtonActionPerformed

    private void detailCheckBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_detailCheckBoxActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_detailCheckBoxActionPerformed

    private void productIdButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_productIdButtonActionPerformed
        initDevice();
    }//GEN-LAST:event_productIdButtonActionPerformed

    private void initDevice() {
        String brand = brandTextField.getText();
        String model = modelTextField.getText();
        String productId = AndroidDeviceUtils.getProductId(brand, model);
        String productName = AndroidDeviceUtils.getProductName(brand, model);
        productIdTextField.setText(productId);
        brandTextField.setText(AndroidDeviceUtils.formatBrand(brand));
        productTextField.setText(productName);
        aliasTextField.setText("");
        //Update condition checkbox.
        if (StringUtils.containsIgnoreCase(model, brand)) {
            conditionCheckBox.setSelected(false);
        }
        //Initialize conditon text field.
        String brandOfProductId = AndroidDeviceUtils.getBrandByProductId(productId);
        if (conditionComboBox.getSelectedIndex() != 1) {
            conditionComboBox.setSelectedIndex(1);
        }
        //ConditionComboBox must be set before conditionTextField.
        conditionTextField.setText(brandOfProductId);
        condition2TextField.setText("");
        typeComboBox.setSelectedIndex(0);
        vid2TextField.setText("");
    }

    private void checkModelExistence() {
        String vid = vidTextField.getText();
        String model = modelTextField.getText();
        if (StringUtils.isNotBlank(vid) && StringUtils.isNotBlank(model)) {
            new ModelWorker(vid, model, existCheckBox, existInVidCheckBox).execute();
        }
    }

    private void modelButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_modelButtonActionPerformed
        addModel();
    }//GEN-LAST:event_modelButtonActionPerformed

    private void addModel() {
        String productId = productIdTextField.getText();
        String model = modelTextField.getText();
        String vid = vidTextField.getText();
        String vid2 = vid2TextField.getText();

        if (StringUtils.isBlank(productId)) {
            JOptionPane.showMessageDialog(jPanel13, "Product ID should not be blank.");
        } else if (StringUtils.isBlank(model)) {
            JOptionPane.showMessageDialog(jPanel13, "Model should not be blank.");
        } else if (StringUtils.isBlank(vid)) {
            JOptionPane.showMessageDialog(jPanel13, "vid should not be blank.");
        } else {
            Set<String> vidSet = new HashSet<>();
            vidSet.add(vid);
            if (!StringUtils.equalsIgnoreCase(Constants.RECOVERY_VID, vid)) {
                vidSet.add(Constants.RECOVERY_VID);
            }

            if (StringUtils.isNotBlank(vid2)) {
                vidSet.add(vid2);
            }
            String[] vids = vidSet.toArray(new String[vidSet.size()]);

            Map<String, String> conditions = new LinkedHashMap<>();
            if (conditionCheckBox.isSelected()) {
                //1st conditon.
                String condition = (String) conditionComboBox.getSelectedItem();
                String conditionValue = conditionTextField.getText();
                if (StringUtils.isNotBlank(conditionValue)) {
                    conditions.put(condition.toLowerCase(), conditionValue);
                }

                //2nd condition value.
                String condition2 = (String) condition2ComboBox.getSelectedItem();
                String condition2Value = condition2TextField.getText();
                if (StringUtils.isNotBlank(condition2Value) && !condition2.equalsIgnoreCase(condition)) {
                    conditions.put(condition2.toLowerCase(), condition2Value);
                }
            }

            ProductId aProductId = new ProductId(productId, conditions);
            Model aModel = new Model(model, aProductId);
            RecognitionTool.addModel(vids, aModel);

            //Update log
            DeviceLogDao dao = new DeviceLogDao();
            dao.updateDeviceLog(productId, vids, aModel);

            resultTextArea.append(System.getProperty("line.separator"));
            resultTextArea.append("Add model " + model + " to " + Arrays.toString(vids));
        }
    }

    private void errorRecognitionButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_errorRecognitionButtonActionPerformed
        new ErrorDeviceWorker(this.deviceTable).execute();
    }//GEN-LAST:event_errorRecognitionButtonActionPerformed

    private void updateModelButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_updateModelButtonActionPerformed
        updateModel();
    }//GEN-LAST:event_updateModelButtonActionPerformed

    private void updateModel() {
        String productId = productIdTextField.getText();
        String model = modelTextField.getText();
        String vid = vidTextField.getText();
        if (StringUtils.isBlank(productId)) {
            JOptionPane.showMessageDialog(jPanel13, "Product ID should not be blank.");
        } else if (StringUtils.isBlank(model)) {
            JOptionPane.showMessageDialog(jPanel13, "Model should not be blank.");
        } else if (StringUtils.isBlank(vid)) {
            JOptionPane.showMessageDialog(jPanel13, "vid should not be blank.");
        } else {
            String[] vids = { vid };
            Map<String, String> conditions = new LinkedHashMap<>();
            if (conditionCheckBox.isSelected()) {
                //1st conditon.
                String condition = (String) conditionComboBox.getSelectedItem();
                String conditionValue = conditionTextField.getText();
                if (StringUtils.isNotBlank(conditionValue)) {
                    conditions.put(condition.toLowerCase(), conditionValue);
                }

                //2nd condition value.
                String condition2 = (String) condition2ComboBox.getSelectedItem();
                String condition2Value = condition2TextField.getText();
                if (StringUtils.isNotBlank(condition2Value) && !condition2.equalsIgnoreCase(condition)) {
                    conditions.put(condition2.toLowerCase(), condition2Value);
                }
            }
            ProductId aProductId = new ProductId(productId, conditions);
            Model aModel = new Model(model, aProductId);
            RecognitionTool.addModel(vids, aModel);
            //Update log
            DeviceLogDao dao = new DeviceLogDao();
            dao.updateDeviceLog(productId, vids, aModel);
            resultTextArea.append(System.getProperty("line.separator"));
            resultTextArea.append("Add model " + model + " to " + Arrays.toString(vids));
        }
    }

    private void queryButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_queryButtonActionPerformed
        String query = queryTextField.getText();
        int limit = (int) queryLimitSpinner.getValue();
        if (StringUtils.isNotBlank(query)) {
            if (QueryPattern.isMacAddress(query) || QueryPattern.isQQ(query)) {
                new DeviceWorker(query, limit, this.deviceDetailTable).execute();
            } else {
                new DeviceQueryWorker(query, this.deviceTable).execute();
            }
        } else {
            JOptionPane.showMessageDialog(jTabbedPane1, "Query should not be blank.");
        }
    }//GEN-LAST:event_queryButtonActionPerformed

    private void existInVidCheckBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_existInVidCheckBoxActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_existInVidCheckBoxActionPerformed

    private void whiteListButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_whiteListButtonActionPerformed
        int days = (int) daysSpinner.getValue();
        new WhiteListDeviceRankingWorker(days, this.deviceTable).execute();
    }//GEN-LAST:event_whiteListButtonActionPerformed

    private void detailButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_detailButtonActionPerformed
        String vid = vidTextField.getText();
        String model = modelTextField.getText();
        int limit = (int) queryLimitSpinner.getValue();
        boolean isAll = allCheckBox.isSelected();
        if (StringUtils.isBlank(vid)) {
            JOptionPane.showMessageDialog(jPanel13, "Vid should not be blank.");
        } else if (StringUtils.isBlank(model)) {
            JOptionPane.showMessageDialog(jPanel13, "Model should not be blank.");
        } else {
            SwingWorker<List<AndroidDevice>, Void> deviceWorker = new DeviceWorker(vid, model, limit, isAll,
                    this.deviceDetailTable);
            deviceWorker.execute();
        }

    }//GEN-LAST:event_detailButtonActionPerformed

    private void productIdTextFieldPropertyChange(java.beans.PropertyChangeEvent evt) {//GEN-FIRST:event_productIdTextFieldPropertyChange

    }//GEN-LAST:event_productIdTextFieldPropertyChange

    private void googleButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_googleButtonActionPerformed
        String model = modelTextField.getText();
        String brand = brandTextField.getText();
        if (StringUtils.isNotBlank(brand) || StringUtils.isNotBlank(model)) {

            StringBuilder commandBuilder = new StringBuilder();
            commandBuilder.append("explorer \"https://www.google.com.hk/#safe=strict&q=");
            //Append query.
            if (StringUtils.equalsIgnoreCase(model, brand) || StringUtils.containsIgnoreCase(model, brand)) {
                commandBuilder.append(model);
            } else {
                commandBuilder.append(brand);
                commandBuilder.append(" ");
                commandBuilder.append(model);
            }
            commandBuilder.append(" \"");
            try {
                Runtime.getRuntime().exec(commandBuilder.toString());
            } catch (IOException ex) {
                Logger.getLogger(RecognitionToolJFrame.class.getName()).log(Level.SEVERE, null, ex);
            }
        } else {
            JOptionPane.showMessageDialog(jPanel13, "Brand and Model both are blank.");
        }
    }//GEN-LAST:event_googleButtonActionPerformed

    private void baiduButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_baiduButtonActionPerformed
        String model = modelTextField.getText();
        String brand = brandTextField.getText();
        if (StringUtils.isNotBlank(brand) || StringUtils.isNotBlank(model)) {

            StringBuilder commandBuilder = new StringBuilder();
            commandBuilder.append("explorer \"http://www.baidu.com/s?wd=");
            //Append query.
            if (StringUtils.equalsIgnoreCase(model, brand) || StringUtils.containsIgnoreCase(model, brand)) {
                commandBuilder.append(model);
            } else {
                commandBuilder.append(brand);
                commandBuilder.append(" ");
                commandBuilder.append(model);
            }
            commandBuilder.append(" \"");
            try {
                Runtime.getRuntime().exec(commandBuilder.toString());
            } catch (IOException ex) {
                Logger.getLogger(RecognitionToolJFrame.class.getName()).log(Level.SEVERE, null, ex);
            }
        } else {
            JOptionPane.showMessageDialog(jPanel13, "Brand and Model both are blank.");
        }
    }//GEN-LAST:event_baiduButtonActionPerformed

    private void existCheckBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_existCheckBoxActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_existCheckBoxActionPerformed

    private void sortButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_sortButtonActionPerformed
        String vid = vidTextField.getText();
        if (StringUtils.isNotBlank(vid) && vid.length() == 4) {
            RecognitionTool.sortModel(vid);
            resultTextArea.setText("Sorting  " + vid + " is done.");
        } else {
            JOptionPane.showMessageDialog(jPanel13, "Vid is blank or invalid.");
        }
    }//GEN-LAST:event_sortButtonActionPerformed

    private void rootSpritButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_rootSpritButtonActionPerformed
        int days = (int) daysSpinner.getValue();
        new RootRankingWorker(days, this.deviceTable).execute();
    }//GEN-LAST:event_rootSpritButtonActionPerformed

    private void conditionComboBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_conditionComboBoxActionPerformed
        String condition = (String) conditionComboBox.getSelectedItem();
        DeviceDetailTableModel tableModel = (DeviceDetailTableModel) deviceDetailTable.getModel();
        if (tableModel != null) {
            List<AndroidDevice> devices = tableModel.getAndroidDevices();
            if (devices != null && !devices.isEmpty()) {
                AndroidDevice device = devices.get(0);
                switch (condition) {
                case "Board":
                    conditionTextField.setText(device.getRoProductBoard());
                    break;
                case "Brand":
                    conditionTextField.setText(device.getRoProductBrand());
                    break;
                case "Cpu":
                    conditionTextField.setText(device.getCpuHardware());
                    break;
                case "Device":
                    conditionTextField.setText(device.getRoProductDevice());
                    break;
                case "Hardware":
                    conditionTextField.setText(device.getRoHardware());
                    break;
                case "Manufacturer":
                    conditionTextField.setText(device.getRoProductManufacturer());
                    break;
                case "Adb_Device":
                    conditionTextField.setText(device.getAdbDevice());
                    break;
                case "Display_ID":
                    conditionTextField.setText(device.getRoBuildDisplayId());
                    break;
                }
            }
        }
    }//GEN-LAST:event_conditionComboBoxActionPerformed

    private void updateTestCaseButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_updateTestCaseButtonActionPerformed
        updateTestCase();
    }//GEN-LAST:event_updateTestCaseButtonActionPerformed

    private void updateTestCase() {
        final String productId = StringUtils.trim(productIdTextField.getText());
        final String vid = StringUtils.trim((String) vidTextField.getText());
        final String roProductModel = StringUtils.trim(modelTextField.getText());
        //Validation.
        if (StringUtils.isBlank(productId)) {
            JOptionPane.showMessageDialog(jPanel13, "Product ID should not be blank.");
        } else if (StringUtils.isBlank(vid)) {
            JOptionPane.showMessageDialog(jPanel13, "Vid should not be blank.");
        } else if (StringUtils.isBlank(roProductModel)) {
            JOptionPane.showMessageDialog(jPanel13, "ro.product.model should not be blank.");
        } else {
            //Generate test case.
            Set<String> vidSet = new HashSet<>();
            vidSet.add(vid);
            generateTestCase(vidSet.toArray(new String[vidSet.size()]), roProductModel, productId);
        }
    }

    private void conditionTextFieldFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_conditionTextFieldFocusGained
        conditionCheckBox.setSelected(true);
    }//GEN-LAST:event_conditionTextFieldFocusGained

    private void deviceCountButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_deviceCountButtonActionPerformed
        try {
            int deviceCount = RecognitionTool.getDeviceCount();
            resultTextArea.setText("Device count: " + deviceCount);
        } catch (DocumentException ex) {
            JOptionPane.showMessageDialog(jPanel13, ex.getMessage());
        }
    }//GEN-LAST:event_deviceCountButtonActionPerformed

    private void condition2ComboBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_condition2ComboBoxActionPerformed
        String condition = (String) condition2ComboBox.getSelectedItem();
        DeviceDetailTableModel tableModel = (DeviceDetailTableModel) deviceDetailTable.getModel();
        if (tableModel != null) {
            List<AndroidDevice> devices = tableModel.getAndroidDevices();
            if (devices != null && !devices.isEmpty()) {
                AndroidDevice device = devices.get(0);
                switch (condition) {
                case "Board":
                    condition2TextField.setText(device.getRoProductBoard());
                    break;
                case "Brand":
                    condition2TextField.setText(device.getRoProductBrand());
                    break;
                case "Cpu":
                    condition2TextField.setText(device.getCpuHardware());
                    break;
                case "Device":
                    condition2TextField.setText(device.getRoProductDevice());
                    break;
                case "Hardware":
                    condition2TextField.setText(device.getRoHardware());
                    break;
                case "Manufacturer":
                    condition2TextField.setText(device.getRoProductManufacturer());
                    break;
                case "Adb_Device":
                    condition2TextField.setText(device.getAdbDevice());
                    break;
                case "Display_ID":
                    condition2TextField.setText(device.getRoBuildDisplayId());
                    break;
                }
            }
        }
    }//GEN-LAST:event_condition2ComboBoxActionPerformed

    private void filterButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_filterButtonActionPerformed
        DeviceTableModel deviceTableModel = (DeviceTableModel) deviceTable.getModel();
        List<AndroidDeviceRanking> androidDevices = deviceTableModel.getAndroidDevices();
        if (androidDevices != null && androidDevices.size() > 0) {
            new FilterWorker(androidDevices, deviceTable).execute();
        }
    }//GEN-LAST:event_filterButtonActionPerformed

    private void matchButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_matchButtonActionPerformed
        String vid = vidTextField.getText();
        String model = modelTextField.getText();
        String brand = conditionTextField.getText();
        AndroidDevice androidDevice = new AndroidDevice();
        androidDevice.setVid(vid);
        androidDevice.setRoProductModel(model);
        androidDevice.setRoProductBrand(brand);
        DevicePatternFilter filter = new DevicePatternFilter();
        boolean matches = filter.matches(androidDevice);
        if (matches) {
            resultTextArea.setText(model + " Match");
        } else {
            resultTextArea.setText(model + " Not match");
        }
    }//GEN-LAST:event_matchButtonActionPerformed

    private void addButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addButtonActionPerformed
        addDevice();
        addModel();
        addTestCase();
    }//GEN-LAST:event_addButtonActionPerformed

    private void updateButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_updateButtonActionPerformed
        updateModel();
        updateTestCase();
    }//GEN-LAST:event_updateButtonActionPerformed

    private void existenceFilterButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_existenceFilterButtonActionPerformed
        DeviceTableModel deviceTableModel = (DeviceTableModel) deviceTable.getModel();
        List<AndroidDeviceRanking> androidDevices = deviceTableModel.getAndroidDevices();
        if (androidDevices != null && androidDevices.size() > 0) {
            new NewDeviceFilterWorker(androidDevices, deviceTable).execute();
        }
    }//GEN-LAST:event_existenceFilterButtonActionPerformed

    private void excludeFilterButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_excludeFilterButtonActionPerformed
        DeviceTableModel deviceTableModel = (DeviceTableModel) deviceTable.getModel();
        List<AndroidDeviceRanking> androidDevices = deviceTableModel.getAndroidDevices();
        if (androidDevices != null && androidDevices.size() > 0) {
            new ExcludeFilterWorker(androidDevices, deviceTable).execute();
        }
    }//GEN-LAST:event_excludeFilterButtonActionPerformed

    private void queryFilterButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_queryFilterButtonActionPerformed
        DeviceTableModel deviceTableModel = (DeviceTableModel) deviceTable.getModel();
        String query = queryTextField.getText();
        List<AndroidDeviceRanking> androidDevices = deviceTableModel.getAndroidDevices();
        if (androidDevices != null && androidDevices.size() > 0 && StringUtils.isNotBlank(query)) {
            new QueryFilterWorker(androidDevices, deviceTable, query).execute();
        }
    }//GEN-LAST:event_queryFilterButtonActionPerformed

    private void queryTextFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_queryTextFieldActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_queryTextFieldActionPerformed

    private void removeDeviceButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_removeDeviceButtonActionPerformed
        DeviceTableModel tableModel = (DeviceTableModel) deviceTable.getModel();
        int[] rows = deviceTable.getSelectedRows();
        for (int row : rows) {
            tableModel.removeRow(row);
        }
    }//GEN-LAST:event_removeDeviceButtonActionPerformed

    private void othersDevicesButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_othersDevicesButtonActionPerformed
        DeviceTableModel deviceTableModel = (DeviceTableModel) deviceTable.getModel();
        List<AndroidDeviceRanking> androidDevices = deviceTableModel.getAndroidDevices();
        if (androidDevices != null && !androidDevices.isEmpty()) {
            new FilterWorker(androidDevices, deviceTable, true).execute();
        }
    }//GEN-LAST:event_othersDevicesButtonActionPerformed

    /**
     * @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 | InstantiationException | IllegalAccessException
                | javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(RecognitionToolJFrame.class.getName())
                    .log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>
        //</editor-fold>

        //</editor-fold>
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            @Override
            public void run() {
                new RecognitionToolJFrame().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton addButton;
    private javax.swing.JLabel aliasLabel;
    private javax.swing.JTextField aliasTextField;
    private javax.swing.JCheckBox allCheckBox;
    private javax.swing.JButton baiduButton;
    private javax.swing.JLabel brandLabel;
    private javax.swing.JTextField brandTextField;
    private javax.swing.ButtonGroup buttonGroup1;
    private javax.swing.JComboBox condition2ComboBox;
    private javax.swing.JTextField condition2TextField;
    private javax.swing.JCheckBox conditionCheckBox;
    private javax.swing.JComboBox conditionComboBox;
    private javax.swing.JTextField conditionTextField;
    private javax.swing.JButton connectButton;
    private javax.swing.JSpinner daysSpinner;
    private javax.swing.JButton detailButton;
    private javax.swing.JCheckBox detailCheckBox;
    private javax.swing.JButton deviceButton;
    private javax.swing.JButton deviceCountButton;
    private javax.swing.JTable deviceDetailTable;
    private javax.swing.JButton deviceRankingButton;
    private javax.swing.JTable deviceTable;
    private javax.swing.JButton errorRecognitionButton;
    private javax.swing.JButton excludeFilterButton;
    private javax.swing.JCheckBox existCheckBox;
    private javax.swing.JCheckBox existInVidCheckBox;
    private javax.swing.JButton existenceFilterButton;
    private javax.swing.JButton filterButton;
    private javax.swing.JButton googleButton;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel12;
    private javax.swing.JPanel jPanel13;
    private javax.swing.JPanel jPanel14;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JPanel jPanel5;
    private javax.swing.JPanel jPanel6;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JScrollPane jScrollPane4;
    private javax.swing.JTabbedPane jTabbedPane1;
    private javax.swing.JButton knockOffButton;
    private javax.swing.JCheckBox knockOffCheckBox;
    private javax.swing.JButton matchButton;
    private javax.swing.JButton modelButton;
    private javax.swing.JLabel modelLabel;
    private javax.swing.JTextField modelTextField;
    private javax.swing.JButton othersDevicesButton;
    private javax.swing.JLabel partitionLabel;
    private javax.swing.JTextField partitionTextField;
    private javax.swing.JButton productIdButton;
    private javax.swing.JCheckBox productIdExistCheckBox;
    private javax.swing.JLabel productIdLabel;
    private javax.swing.JTextField productIdTextField;
    private javax.swing.JLabel productLabel;
    private javax.swing.JTextField productTextField;
    private javax.swing.JButton queryButton;
    private javax.swing.JButton queryFilterButton;
    private javax.swing.JSpinner queryLimitSpinner;
    private javax.swing.JPanel queryPanel;
    private javax.swing.JTextField queryTextField;
    private javax.swing.JButton removeDeviceButton;
    private javax.swing.JComboBox resolutionComboBox;
    private javax.swing.JLabel resolutionLabel;
    private javax.swing.JTextArea resultTextArea;
    private javax.swing.JButton rootSpritButton;
    private javax.swing.JButton sortButton;
    private javax.swing.JButton testCaseButton;
    private javax.swing.JComboBox typeComboBox;
    private javax.swing.JButton updateButton;
    private javax.swing.JButton updateModelButton;
    private javax.swing.JButton updateTestCaseButton;
    private javax.swing.JTextField vid2TextField;
    private javax.swing.JLabel vidLabel;
    private javax.swing.JTextField vidTextField;
    private javax.swing.JButton whiteListButton;
    // End of variables declaration//GEN-END:variables
}