Author: ruschein
Date: 2010-10-21 13:38:54 -0700 (Thu, 21 Oct 2010)
New Revision: 22334

Modified:
   
cytoscape/trunk/coreplugins/TableImport/src/main/java/edu/ucsd/bioeng/coreplugin/tableImport/ui/ImportAttributeTableTask.java
   
cytoscape/trunk/coreplugins/browser/src/main/java/browser/AttributeBrowser.java
   
cytoscape/trunk/coreplugins/browser/src/main/java/browser/ui/AttributeBrowserToolBar.java
Log:
Fixed a problem w/ the loading of attributes and dialogs being inaccessible.

Modified: 
cytoscape/trunk/coreplugins/TableImport/src/main/java/edu/ucsd/bioeng/coreplugin/tableImport/ui/ImportAttributeTableTask.java
===================================================================
--- 
cytoscape/trunk/coreplugins/TableImport/src/main/java/edu/ucsd/bioeng/coreplugin/tableImport/ui/ImportAttributeTableTask.java
       2010-10-21 20:13:25 UTC (rev 22333)
+++ 
cytoscape/trunk/coreplugins/TableImport/src/main/java/edu/ucsd/bioeng/coreplugin/tableImport/ui/ImportAttributeTableTask.java
       2010-10-21 20:38:54 UTC (rev 22334)
@@ -63,8 +63,8 @@
                        reader.readTable();
                        taskMonitor.setPercentCompleted(100);
                        
Cytoscape.firePropertyChange(Cytoscape.ATTRIBUTES_CHANGED, null, null);
+                       informUserOfAnnotationStats();
                        
Cytoscape.firePropertyChange(Cytoscape.NEW_ATTRS_LOADED, null, null);
-                       informUserOfAnnotationStats();
                } catch (Exception e) {
                        e.printStackTrace();
                        taskMonitor.setException(e, "Unable to import 
annotation data.");

Modified: 
cytoscape/trunk/coreplugins/browser/src/main/java/browser/AttributeBrowser.java
===================================================================
--- 
cytoscape/trunk/coreplugins/browser/src/main/java/browser/AttributeBrowser.java 
    2010-10-21 20:13:25 UTC (rev 22333)
+++ 
cytoscape/trunk/coreplugins/browser/src/main/java/browser/AttributeBrowser.java 
    2010-10-21 20:38:54 UTC (rev 22334)
@@ -37,14 +37,12 @@
 import java.awt.event.MouseAdapter;
 import java.awt.event.MouseEvent;
 import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
 import java.beans.PropertyChangeSupport;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Set;
 
 import javax.swing.JPanel;
-import javax.swing.JOptionPane;
 import javax.swing.JScrollPane;
 import javax.swing.JTable;
 import javax.swing.SwingConstants;
@@ -65,7 +63,6 @@
 
 
 /**
- *
  * DataTable class constructs all Panels for the browser.<br>
  * One DataTable contains the table of values and the toolbar above the table
  * within a jpanel. This panel is then added to CytoPanel2. Tabbed browsing
@@ -77,7 +74,7 @@
  * panel to AttrMod Dialog Peng-Liang wang 9/28/2006
  *
  */
-public class AttributeBrowser implements TableColumnModelListener, 
PropertyChangeListener {
+public class AttributeBrowser implements TableColumnModelListener {
        private static final Dimension PANEL_SIZE = new Dimension(400, 300);
        
        protected static Object pcsO = new Object();
@@ -209,27 +206,8 @@
                Cytoscape.getDesktop().getCytoPanel(SwingConstants.SOUTH)
                         .add(panelType.getDisplayName() + " Attribute 
Browser", mainPanel);
                
Cytoscape.getDesktop().getCytoPanel(SwingConstants.SOUTH).setState(CytoPanelState.DOCK);
-
-               
Cytoscape.getPropertyChangeSupport().addPropertyChangeListener(Cytoscape.NEW_ATTRS_LOADED,
 this);
        }
 
-       public void propertyChange(PropertyChangeEvent e) {
-               // This will handle the case for the change of attribute 
userVisibility
-               if (e.getPropertyName() == Cytoscape.NEW_ATTRS_LOADED && 
e.getOldValue() == attributes) {
-                       final Set<String> newAttrNames = 
(Set<String>)e.getNewValue();
-                       if (JOptionPane.showConfirmDialog(
-                               null,
-                               "Display " + newAttrNames.size() + " newly 
loaded attributes in the attribute browser?",
-                               "Confirmation", JOptionPane.YES_NO_OPTION)
-                           == JOptionPane.YES_OPTION)
-                       {
-                               for (final String newAttrName : newAttrNames)
-                                       orderedColumn.add(newAttrName);
-                               tableModel.setTableData(null, orderedColumn);
-                       }
-               }
-       }
-
        void refresh() {
                tableModel.setTableData(null, null);
        }

Modified: 
cytoscape/trunk/coreplugins/browser/src/main/java/browser/ui/AttributeBrowserToolBar.java
===================================================================
--- 
cytoscape/trunk/coreplugins/browser/src/main/java/browser/ui/AttributeBrowserToolBar.java
   2010-10-21 20:13:25 UTC (rev 22333)
+++ 
cytoscape/trunk/coreplugins/browser/src/main/java/browser/ui/AttributeBrowserToolBar.java
   2010-10-21 20:38:54 UTC (rev 22334)
@@ -27,18 +27,42 @@
 */
 package browser.ui;
 
+
 import static browser.DataObjectType.EDGES;
 import static browser.DataObjectType.NETWORK;
 import static browser.DataObjectType.NODES;
 
+import browser.AttributeBrowser;
+import browser.AttributeModel;
+import browser.DataObjectType;
+import browser.DataTableModel;
+import browser.ValidatedObjectAndEditString;
+
+import cytoscape.Cytoscape;
+import cytoscape.actions.ImportEdgeAttributesAction;
+import cytoscape.actions.ImportExpressionMatrixAction;
+import cytoscape.actions.ImportNodeAttributesAction;
+import cytoscape.data.CyAttributes;
+import cytoscape.data.CyAttributesUtils;
+import cytoscape.dialogs.NetworkMetaDataDialog;
+import cytoscape.logger.CyLogger;
+import cytoscape.util.swing.CheckBoxJList;
+
 import java.awt.BorderLayout;
 import java.awt.Dimension;
+import java.awt.Frame;
 import java.awt.event.MouseAdapter;
 import java.awt.event.MouseEvent;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+
 import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.Set;
 
 import javax.swing.ImageIcon;
 import javax.swing.JButton;
@@ -58,29 +82,11 @@
 import org.jdesktop.layout.GroupLayout;
 import org.jdesktop.layout.LayoutStyle;
 
-import browser.AttributeBrowser;
-import browser.AttributeModel;
-import browser.DataObjectType;
-import browser.DataTableModel;
-import browser.ValidatedObjectAndEditString;
 
-import cytoscape.Cytoscape;
-import cytoscape.actions.ImportEdgeAttributesAction;
-import cytoscape.actions.ImportExpressionMatrixAction;
-import cytoscape.actions.ImportNodeAttributesAction;
-import cytoscape.data.CyAttributes;
-import cytoscape.data.CyAttributesUtils;
-import cytoscape.dialogs.NetworkMetaDataDialog;
-import cytoscape.logger.CyLogger;
-import cytoscape.util.swing.CheckBoxJList;
-import java.util.HashMap;
-
-
 /**
  *  Define toolbar for Attribute Browser.
  */
-public class AttributeBrowserToolBar extends JPanel implements 
PopupMenuListener {
-       
+public class AttributeBrowserToolBar extends JPanel implements 
PopupMenuListener, PropertyChangeListener {
        private static final long serialVersionUID = -508393701912596399L;
        
        private final CyAttributes attributes;
@@ -126,7 +132,8 @@
 
        public AttributeBrowserToolBar(final DataTableModel tableModel, final 
CyAttributeBrowserTable table,
                                       final AttributeModel a_model, final 
List<String> orderedCol,
-                                      final DataObjectType graphObjectType) {
+                                      final DataObjectType graphObjectType)
+       {
                super();
 
                this.tableModel = tableModel;
@@ -139,6 +146,8 @@
                logger = CyLogger.getLogger(AttributeBrowserToolBar.class);
 
                initializeGUI();
+
+               
Cytoscape.getPropertyChangeSupport().addPropertyChangeListener(Cytoscape.NEW_ATTRS_LOADED,
 this);
        }
 
        private void initializeGUI() {
@@ -154,6 +163,33 @@
                attrModButton.setVisible(objectType != NETWORK);
        }
 
+       public void propertyChange(PropertyChangeEvent e) {
+               // This will handle the case for the change of attribute 
userVisibility
+               if (e.getPropertyName() == Cytoscape.NEW_ATTRS_LOADED && 
e.getOldValue() == attributes) {
+                       final Set<String> newAttrNames = 
(Set<String>)e.getNewValue();
+                       if (JOptionPane.showConfirmDialog(
+                               getActiveFrame(),
+                               "Display " + newAttrNames.size() + " newly 
loaded attribute(s) in the attribute browser?",
+                               "Confirmation", JOptionPane.YES_NO_OPTION)
+                           == JOptionPane.YES_OPTION)
+                       {
+                               for (final String newAttrName : newAttrNames)
+                                       orderedCol.add(newAttrName);
+                               tableModel.setTableData(null, orderedCol);
+                       }
+               }
+       }
+
+       private Frame getActiveFrame() {
+               final Frame[] frames = Frame.getFrames();
+               for (final Frame frame : frames) {
+                       if (frame.isActive())
+                               return frame;
+               }
+
+               return null;
+       }
+
        /**
         *  DOCUMENT ME!
         *

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