Author: pwang
Date: 2010-06-28 13:30:18 -0700 (Mon, 28 Jun 2010)
New Revision: 20691

Modified:
   coreplugins/trunk/filters/src/cytoscape/filters/view/FilterMainPanel.java
Log:
Moved a util method to core

Modified: 
coreplugins/trunk/filters/src/cytoscape/filters/view/FilterMainPanel.java
===================================================================
--- coreplugins/trunk/filters/src/cytoscape/filters/view/FilterMainPanel.java   
2010-06-28 20:24:15 UTC (rev 20690)
+++ coreplugins/trunk/filters/src/cytoscape/filters/view/FilterMainPanel.java   
2010-06-28 20:30:18 UTC (rev 20691)
@@ -91,6 +91,7 @@
 import javax.swing.ComboBoxModel;
 import javax.swing.table.DefaultTableModel;
 import javax.swing.tree.DefaultMutableTreeNode;
+import cytoscape.data.CyAttributesUtils;
 
 /**
  * 
@@ -927,7 +928,10 @@
                                        }
                                }
                                
-                               
if(isNullAttribute(cmbAttributes.getSelectedItem().toString())){
+                               String attributeType = 
cmbAttributes.getSelectedItem().toString().substring(0,4);// "node" or "edge"
+                               String attributeName = 
cmbAttributes.getSelectedItem().toString().substring(5);
+
+                               
if(CyAttributesUtils.isNullAttribute(attributeType, attributeName)){
                                        JOptionPane.showMessageDialog(this, 
"All the values for this attribute are NULL!", "Can not create filter", 
JOptionPane.ERROR_MESSAGE); 
                                }
                                else {
@@ -1067,43 +1071,6 @@
                
                updateInteractionMenuItemStatus();
        }
-
-       // Check if all the values for an attribute are NULL
-       private boolean isNullAttribute(String selectedItem){
-               
-               boolean retValue = true;
-               
-               String attributeType = selectedItem.substring(0,4);// "node" or 
"edge"
-               String attributeName = selectedItem.substring(5);
-                               
-               CyAttributes attributes = null;
-               if (attributeType.equalsIgnoreCase("node")){
-                       attributes = Cytoscape.getNodeAttributes();
-                       int[] nodeIndices = 
Cytoscape.getCurrentNetwork().getNodeIndicesArray();
-                       for (int i=0; i<nodeIndices.length; i++){
-                               String nodeID = 
Cytoscape.getRootGraph().getNode(nodeIndices[i]).getIdentifier();
-                               Object valueObj = 
attributes.getAttribute(nodeID, attributeName);
-                               if (valueObj != null){
-                                       retValue = false;
-                                       break;
-                               }
-                       }
-               }
-               else {// edge
-                       attributes = Cytoscape.getEdgeAttributes();             
        
-                       int[] edgeIndices = 
Cytoscape.getCurrentNetwork().getEdgeIndicesArray();
-                       for (int i=0; i<edgeIndices.length; i++){
-                               String edgeID = 
Cytoscape.getRootGraph().getEdge(edgeIndices[i]).getIdentifier();
-                               Object valueObj = 
attributes.getAttribute(edgeID, attributeName);
-                               if (valueObj != null){
-                                       retValue = false;
-                                       break;
-                               }
-                       }
-               }
-
-               return retValue;
-       }
        
        private void updateInteractionMenuItemStatus() {
                //Disable interactionMenuItem if there is no other filters to 
depend on

-- 
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