Author: pwang
Date: 2012-02-09 16:41:52 -0800 (Thu, 09 Feb 2012)
New Revision: 28227

Added:
   
csplugins/trunk/ucsd/pwang/subnetworkByCategory/src/main/java/org/cytoscape/subnetwork/ChooseCategoryAttributeDialog.java
Log:
Original creation

Added: 
csplugins/trunk/ucsd/pwang/subnetworkByCategory/src/main/java/org/cytoscape/subnetwork/ChooseCategoryAttributeDialog.java
===================================================================
--- 
csplugins/trunk/ucsd/pwang/subnetworkByCategory/src/main/java/org/cytoscape/subnetwork/ChooseCategoryAttributeDialog.java
                           (rev 0)
+++ 
csplugins/trunk/ucsd/pwang/subnetworkByCategory/src/main/java/org/cytoscape/subnetwork/ChooseCategoryAttributeDialog.java
   2012-02-10 00:41:52 UTC (rev 28227)
@@ -0,0 +1,136 @@
+package org.cytoscape.subnetwork;
+
+import javax.swing.DefaultComboBoxModel;
+
+import cytoscape.Cytoscape;
+
+public class ChooseCategoryAttributeDialog extends javax.swing.JDialog {
+
+
+    /** Creates new form ChooseCategoryAttributeDialog */
+    public ChooseCategoryAttributeDialog(java.awt.Frame parent, boolean modal, 
String[] attributeNames) {
+        super(parent, modal);
+        initComponents();
+        
+        DefaultComboBoxModel model = new DefaultComboBoxModel(attributeNames);
+        
+        this.cmbAttributes.setModel(model);
+               this.setTitle("Choose a category attribute");
+               this.setLocationRelativeTo(parent);
+    }
+
+    
+    /** 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">
+    private void initComponents() {
+        java.awt.GridBagConstraints gridBagConstraints;
+
+        cmbAttributes = new javax.swing.JComboBox();
+        jLabel1 = new javax.swing.JLabel();
+        pnlButton = new javax.swing.JPanel();
+        btnOK = new javax.swing.JButton();
+        btnCancel = new javax.swing.JButton();
+
+        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
+        setName("Form"); // NOI18N
+        getContentPane().setLayout(new java.awt.GridBagLayout());
+
+        cmbAttributes.setName("cmbAttributes"); // NOI18N
+        gridBagConstraints = new java.awt.GridBagConstraints();
+        gridBagConstraints.gridx = 0;
+        gridBagConstraints.gridy = 1;
+        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
+        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
+        gridBagConstraints.weightx = 1.0;
+        gridBagConstraints.insets = new java.awt.Insets(10, 10, 0, 10);
+        getContentPane().add(cmbAttributes, gridBagConstraints);
+
+//        org.jdesktop.application.ResourceMap resourceMap = 
org.jdesktop.application.Application.getInstance(cytoscape3gui.Cytoscape3GUIApp.class).getContext().getResourceMap(CategoryAttribueDialog.class);
+        jLabel1.setText("Please choose the category attribute"); // NOI18N
+//        jLabel1.setName("jLabel1"); // NOI18N
+        gridBagConstraints = new java.awt.GridBagConstraints();
+        gridBagConstraints.gridx = 0;
+        gridBagConstraints.gridy = 0;
+        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
+        gridBagConstraints.insets = new java.awt.Insets(10, 10, 0, 0);
+        getContentPane().add(jLabel1, gridBagConstraints);
+
+        pnlButton.setName("pnlButton"); // NOI18N
+
+        btnOK.setText("OK"); // NOI18N
+        btnOK.setName("btnOK"); // NOI18N
+        btnOK.addActionListener(new java.awt.event.ActionListener() {
+            public void actionPerformed(java.awt.event.ActionEvent evt) {
+                btnOKActionPerformed(evt);
+            }
+        });
+        pnlButton.add(btnOK);
+
+        btnCancel.setText("Cancel"); // NOI18N
+        btnCancel.setName("btnCancel"); // NOI18N
+        btnCancel.addActionListener(new java.awt.event.ActionListener() {
+            public void actionPerformed(java.awt.event.ActionEvent evt) {
+                btnCancelActionPerformed(evt);
+            }
+        });
+        pnlButton.add(btnCancel);
+
+        gridBagConstraints = new java.awt.GridBagConstraints();
+        gridBagConstraints.gridx = 0;
+        gridBagConstraints.gridy = 2;
+        gridBagConstraints.insets = new java.awt.Insets(20, 0, 0, 0);
+        getContentPane().add(pnlButton, gridBagConstraints);
+
+        pack();
+    }// </editor-fold>
+
+    private void btnOKActionPerformed(java.awt.event.ActionEvent evt) {
+        // TODO add your handling code here:
+       
+       System.out.println("The selected atrribute is "+ 
this.cmbAttributes.getSelectedItem());
+       
+       this.dispose();
+    }
+
+    private void btnCancelActionPerformed(java.awt.event.ActionEvent evt) {
+       this.dispose();
+    }
+
+    
+    public String getSelectedAttribute(){
+       return this.cmbAttributes.getSelectedItem().toString();
+    }
+    
+    /**
+    * @param args the command line arguments
+    */
+    public static void main(String args[]) {
+        java.awt.EventQueue.invokeLater(new Runnable() {
+            public void run() {
+               String[] attrNames = {"AAA","BBB","CCC"};
+               ChooseCategoryAttributeDialog dialog = new 
ChooseCategoryAttributeDialog(new javax.swing.JFrame(), true, attrNames);
+                dialog.addWindowListener(new java.awt.event.WindowAdapter() {
+                    public void windowClosing(java.awt.event.WindowEvent e) {
+                        System.exit(0);
+                    }
+                });
+                dialog.setVisible(true);
+            }
+        });
+    }
+
+    // Variables declaration - do not modify
+    private javax.swing.JButton btnCancel;
+    private javax.swing.JButton btnOK;
+    private javax.swing.JComboBox cmbAttributes;
+    private javax.swing.JLabel jLabel1;
+    private javax.swing.JPanel pnlButton;
+    // End of variables declaration
+
+
+}

-- 
You received this message because you are subscribed to the Google Groups 
"cytoscape-cvs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/cytoscape-cvs?hl=en.

Reply via email to