/* * FBPwn * * http://code.google.com/p/fbpwn * * Copyright (C) 2011 - FBPwn * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package fbpwn.plugins.ui; import fbpwn.plugins.core.CloseCircleFriendsTask; import java.awt.Dimension; import java.awt.Toolkit; import javax.swing.SpinnerNumberModel; public class CloseCircleFriendsDialog extends javax.swing.JDialog { private CloseCircleFriendsTask friendsTask; /** * Creates new form CloseCircleFriendsDialog */ public CloseCircleFriendsDialog(java.awt.Frame parent, boolean modal, CloseCircleFriendsTask mainTask) { super(parent, modal); initComponents(); this.setTitle("Select where to search and search parameters"); Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); setLocation((int) (dim.getWidth() / 2 - getWidth() / 2), (int) (dim.getHeight() / 2 - getHeight() / 2)); friendsTask = mainTask; jCheckBox1.setSelected(true); jCheckBox2.setSelected(true); jRadioButton2.setSelected(true); SpinnerNumberModel s1 = new SpinnerNumberModel(1, 1, null, 1); SpinnerNumberModel s2 = new SpinnerNumberModel(1, 1, null, 1); SpinnerNumberModel s3 = new SpinnerNumberModel(1, 1, null, 1); jSpinner2.setModel(s1); jSpinner3.setModel(s2); jSpinner4.setModel(s3); } public int ShowCloseCircleFriendsSelectionDialog() { setModal(true); setVisible(true); friendsTask.setCommentPoint((Integer) jSpinner2.getValue()); friendsTask.setLikePoint((Integer) jSpinner3.getValue()); friendsTask.setTagPoint((Integer) jSpinner4.getValue()); if (jCheckBox1.isSelected()) { friendsTask.setSearchPhotos(true); } else { friendsTask.setSearchPhotos(false); } if (jCheckBox2.isSelected()) { friendsTask.setSearchWallPosts(true); if (jRadioButton1.isSelected()) { return -1; } else { return Integer.parseInt(jSpinner1.getValue().toString()); } } else { friendsTask.setSearchWallPosts(false); return -1; } } /** * 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() { jCheckBox1 = new javax.swing.JCheckBox(); jRadioButton2 = new javax.swing.JRadioButton(); jRadioButton1 = new javax.swing.JRadioButton(); jCheckBox2 = new javax.swing.JCheckBox(); jSeparator1 = new javax.swing.JSeparator(); jSpinner1 = new javax.swing.JSpinner(); jLabel1 = new javax.swing.JLabel(); jSeparator2 = new javax.swing.JSeparator(); jLabel2 = new javax.swing.JLabel(); jLabel3 = new javax.swing.JLabel(); jLabel4 = new javax.swing.JLabel(); jSeparator3 = new javax.swing.JSeparator(); jButton1 = new javax.swing.JButton(); jSpinner2 = new javax.swing.JSpinner(); jSpinner3 = new javax.swing.JSpinner(); jSpinner4 = new javax.swing.JSpinner(); setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); jCheckBox1.setText("Search under Photos"); jRadioButton2.setText("Finite Pages"); jRadioButton2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jRadioButton2ActionPerformed(evt); } }); jRadioButton1.setText("Infinite Pages"); jRadioButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jRadioButton1ActionPerformed(evt); } }); jCheckBox2.setText("Search in Wall Posts"); jCheckBox2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jCheckBox2ActionPerformed(evt); } }); jSpinner1.setModel(new javax.swing.SpinnerNumberModel(Integer.valueOf(1), Integer.valueOf(1), null, Integer.valueOf(1))); jLabel1.setText("Wall Pages"); jLabel2.setText("Points for each Comment"); jLabel3.setText("Points for each Like"); jLabel4.setText("Points for each Tag"); jButton1.setText("Submit"); jButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton1ActionPerformed(evt); } }); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(21, 21, 21) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jRadioButton2) .addComponent(jRadioButton1) .addGroup(layout.createSequentialGroup() .addGap(21, 21, 21) .addComponent(jLabel1) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jSpinner1, javax.swing.GroupLayout.PREFERRED_SIZE, 41, javax.swing.GroupLayout.PREFERRED_SIZE)))) .addComponent(jCheckBox1) .addComponent(jCheckBox2) .addGroup(layout.createSequentialGroup() .addComponent(jLabel2) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 27, Short.MAX_VALUE) .addComponent(jSpinner2, javax.swing.GroupLayout.PREFERRED_SIZE, 52, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(layout.createSequentialGroup() .addComponent(jLabel3) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 54, Short.MAX_VALUE) .addComponent(jSpinner3, javax.swing.GroupLayout.PREFERRED_SIZE, 52, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(layout.createSequentialGroup() .addComponent(jLabel4) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 54, Short.MAX_VALUE) .addComponent(jSpinner4, javax.swing.GroupLayout.PREFERRED_SIZE, 52, javax.swing.GroupLayout.PREFERRED_SIZE)) .addComponent(jSeparator2, javax.swing.GroupLayout.DEFAULT_SIZE, 199, Short.MAX_VALUE) .addComponent(jSeparator1, javax.swing.GroupLayout.DEFAULT_SIZE, 199, Short.MAX_VALUE) .addComponent(jSeparator3, javax.swing.GroupLayout.DEFAULT_SIZE, 199, Short.MAX_VALUE))) .addGroup(layout.createSequentialGroup() .addGap(39, 39, 39) .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 141, javax.swing.GroupLayout.PREFERRED_SIZE))) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap() .addComponent(jCheckBox1) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jCheckBox2) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jRadioButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jRadioButton2) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel1) .addComponent(jSpinner1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jSeparator2, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel2) .addComponent(jSpinner2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel3) .addComponent(jSpinner3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel4) .addComponent(jSpinner4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jSeparator3, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 18, Short.MAX_VALUE) .addComponent(jButton1) .addContainerGap()) ); pack(); }// </editor-fold>//GEN-END:initComponents private void jRadioButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButton2ActionPerformed jRadioButton1.setSelected(false); jLabel1.setEnabled(true); jSpinner1.setEnabled(true); }//GEN-LAST:event_jRadioButton2ActionPerformed private void jRadioButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButton1ActionPerformed jRadioButton2.setSelected(false); jLabel1.setEnabled(false); jSpinner1.setEnabled(false); }//GEN-LAST:event_jRadioButton1ActionPerformed private void jCheckBox2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jCheckBox2ActionPerformed if (jCheckBox2.isSelected()) { jRadioButton1.setEnabled(true); jRadioButton2.setEnabled(true); if (jRadioButton2.isSelected()) { jLabel1.setEnabled(true); jSpinner1.setEnabled(true); } } else { jRadioButton1.setEnabled(false); jRadioButton2.setEnabled(false); jLabel1.setEnabled(false); jSpinner1.setEnabled(false); } }//GEN-LAST:event_jCheckBox2ActionPerformed private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed dispose(); }//GEN-LAST:event_jButton1ActionPerformed /** * @param args the command line arguments */ // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton jButton1; private javax.swing.JCheckBox jCheckBox1; private javax.swing.JCheckBox jCheckBox2; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel3; private javax.swing.JLabel jLabel4; private javax.swing.JRadioButton jRadioButton1; private javax.swing.JRadioButton jRadioButton2; private javax.swing.JSeparator jSeparator1; private javax.swing.JSeparator jSeparator2; private javax.swing.JSeparator jSeparator3; private javax.swing.JSpinner jSpinner1; private javax.swing.JSpinner jSpinner2; private javax.swing.JSpinner jSpinner3; private javax.swing.JSpinner jSpinner4; // End of variables declaration//GEN-END:variables }