Author: ruschein
Date: 2010-12-06 16:32:48 -0800 (Mon, 06 Dec 2010)
New Revision: 23103

Modified:
   
core3/table-browser-impl/trunk/src/main/java/org/cytoscape/browser/internal/AttributeBrowser.java
   
core3/table-browser-impl/trunk/src/main/java/org/cytoscape/browser/internal/DataTableModel.java
Log:
Work in progress.

Modified: 
core3/table-browser-impl/trunk/src/main/java/org/cytoscape/browser/internal/AttributeBrowser.java
===================================================================
--- 
core3/table-browser-impl/trunk/src/main/java/org/cytoscape/browser/internal/AttributeBrowser.java
   2010-12-07 00:14:47 UTC (rev 23102)
+++ 
core3/table-browser-impl/trunk/src/main/java/org/cytoscape/browser/internal/AttributeBrowser.java
   2010-12-07 00:32:48 UTC (rev 23103)
@@ -38,7 +38,9 @@
 import java.awt.event.MouseEvent;
 import java.beans.PropertyChangeEvent;
 import java.beans.PropertyChangeSupport;
+
 import java.util.ArrayList;
+import java.util.Collection;
 import java.util.List;
 import java.util.Set;
 
@@ -53,13 +55,12 @@
 import javax.swing.event.TableColumnModelListener;
 import javax.swing.table.TableColumnModel;
 
-import browser.ui.AttributeBrowserToolBar;
-import browser.ui.CyAttributeBrowserTable;
-import cytoscape.Cytoscape;
-import cytoscape.data.CyAttributes;
-import cytoscape.data.CyAttributesUtils;
-import cytoscape.view.cytopanels.CytoPanelListener;
-import cytoscape.view.cytopanels.CytoPanelState;
+import org.cytoscape.browser.internal.ui.AttributeBrowserToolBar;
+import org.cytoscape.browser.internal.ui.CyAttributeBrowserTable;
+import org.cytoscape.model.CyTable;
+import org.cytoscape.model.CyTableUtil;
+import org.cytoscape.application.swing.CytoPanelState;
+import 
org.cytoscape.application.swing.events.CytoPanelComponentSelectedListener;
 
 
 /**
@@ -109,7 +110,7 @@
 
        // Each Attribute Browser operates on one CytoscapeData object, and on
        // either Nodes or Edges.
-       private final CyAttributes attributes;
+       private final CyTable attributes;
 
        // Main panel for put everything
        private JPanel mainPanel;
@@ -218,7 +219,7 @@
                return attributeTable;
        }
 
-       static class Listener implements CytoPanelListener {
+       static class Listener implements CytoPanelComponentSelectedListener {
                int WEST;
                int SOUTH;
                int EAST;
@@ -231,35 +232,23 @@
                        myIndex = my;
                }
 
-               public void onComponentAdded(int count) {
-               }
-
-               public void onComponentRemoved(int count) {
-               }
-
-               public void onComponentSelected(int componentIndex) {
-                       if (componentIndex == myIndex) {
-                               if (WEST != -1) {
+               public void handleEvent(CytoPanelComponentSelectedEvent e) {
+                       if (e.getSelectedIndex() == myIndex) {
+                               if (WEST != -1)
                                        
Cytoscape.getDesktop().getCytoPanel(SwingConstants.WEST).setSelectedIndex(WEST);
-                               }
 
-                               if (SOUTH != -1) {
+                               if (SOUTH != -1)
                                        
Cytoscape.getDesktop().getCytoPanel(SwingConstants.SOUTH).setSelectedIndex(SOUTH);
-                               }
 
-                               if (EAST != -1) {
+                               if (EAST != -1)
                                        
Cytoscape.getDesktop().getCytoPanel(SwingConstants.EAST).setSelectedIndex(EAST);
-                               }
                        }
                }
-
-               public void onStateChange(CytoPanelState newState) {
-               }
        }
 
        
        private DataTableModel makeModel() {
-               final List<String> attributeNames = 
CyAttributesUtils.getVisibleAttributeNames(attributes);
+               final Collection<String> attributeNames = 
attributes.getColumnTypeMap().values();
                final List<CyTableEntry> graphObjects = 
getSelectedTableEntries();
                final DataTableModel model = new DataTableModel(graphObjects, 
attributeNames, panelType);
 

Modified: 
core3/table-browser-impl/trunk/src/main/java/org/cytoscape/browser/internal/DataTableModel.java
===================================================================
--- 
core3/table-browser-impl/trunk/src/main/java/org/cytoscape/browser/internal/DataTableModel.java
     2010-12-07 00:14:47 UTC (rev 23102)
+++ 
core3/table-browser-impl/trunk/src/main/java/org/cytoscape/browser/internal/DataTableModel.java
     2010-12-07 00:32:48 UTC (rev 23103)
@@ -152,7 +152,7 @@
 
                if (Cytoscape.getCurrentNetworkView() != 
Cytoscape.getNullNetworkView()) {
                        for (CyTableEntry obj : graphObjects) {
-                               internalSelection.put(obj.getIdentifier(), 
DEFAULT_FLAG);
+                               internalSelection.put(obj.getSUID(), 
DEFAULT_FLAG);
                        }
                }
 
@@ -175,7 +175,7 @@
                        column_names[0] = SUID_COLUMN_NAME;
 
                        for (int j = 0; j < go_length; ++j)
-                               data_vector[j][0] = new 
ValidatedObjectAndEditString(graphObjects.get(j).getIdentifier());
+                               data_vector[j][0] = new 
ValidatedObjectAndEditString(graphObjects.get(j).getSUID());
 
                        setDataVector(data_vector, column_names);
                        AttributeBrowser.getPropertyChangeSupport()
@@ -190,16 +190,16 @@
                        column_names[0] = SUID_COLUMN_NAME;
 
                        for (int j = 0; j < go_length; ++j)
-                               data_vector[j][0] = new 
ValidatedObjectAndEditString(graphObjects.get(j).getIdentifier());
+                               data_vector[j][0] = new 
ValidatedObjectAndEditString(graphObjects.get(j).getSUID());
 
                        for (int i1 = 0; i1 < att_length; ++i1) {
                                column_names[i1 + 1] = attributeNames.get(i1);
                                attributeName = attributeNames.get(i1);
-                               type = data.getType(attributeName);
+                               type = table.getType(attributeName);
 
                                for (int j = 0; j < go_length; ++j) {
                                        data_vector[j][i1 + 1] = 
getValidatedObjectAndEditString(type,
-                                                                               
                 graphObjects.get(j).getIdentifier(),
+                                                                               
                 graphObjects.get(j).getSUID(),
                                                                                
                 attributeName);
                                }
                        }
@@ -210,13 +210,13 @@
                        for (int i1 = 0; i1 < att_length; ++i1) {
                                column_names[i1] = attributeNames.get(i1);
                                attributeName = (String) attributeNames.get(i1);
-                               type = data.getType(attributeName);
+                               type = table.getType(attributeName);
                                for (int j = 0; j < go_length; ++j) {
                                        if 
(attributeName.equals(SUID_COLUMN_NAME))
-                                               data_vector[j][i1] = new 
ValidatedObjectAndEditString(graphObjects.get(j).getIdentifier());
+                                               data_vector[j][i1] = new 
ValidatedObjectAndEditString(graphObjects.get(j).getSUID());
                                        else
                                                data_vector[j][i1] =
-                                                       
getValidatedObjectAndEditString(type, graphObjects.get(j).getIdentifier(),
+                                                       
getValidatedObjectAndEditString(type, graphObjects.get(j).getSUID(),
                                                                                
        attributeName);
                                }
                        }
@@ -232,20 +232,19 @@
         *  Returns a validated object and edit string which is a data 
structure used to display values or error messages in a
         *  browser cell.
         *
-        * @param type      the expected data type for the attribute
-        * @param id        the key representing the particular  
node/edge/network
-        * @param attrName  which attribute we're dealing with
+        * @param type        the expected data type for the attribute
+        * @param id          the key representing the particular  
node/edge/network
+        * @param columnName  which attribute we're dealing with
         *
         * @return  DOCUMENT ME!
         */
-       public ValidatedObjectAndEditString 
getValidatedObjectAndEditString(final Class type, final String id, final String 
attrName) {
-               final Object attribValue = data.getAttribute(id, attrName);
-               final Equation equation = data.getEquation(id, attrName);
-               if (attribValue == null && equation == null)
+       public ValidatedObjectAndEditString 
getValidatedObjectAndEditString(final Class<?> type, final String id, final 
String columnName) {
+               final Object value = table.getRow(id).getRaw(columnName);
+               if (value == null)
                        return null;
 
-               final String equationFormula = equation == null ? null : 
equation.toString();
-               String errorMessage = data.getLastEquationError();
+               final String equationFormula = value instanceof Equation ? 
value.toString() : null;
+               String errorMessage = table.getLastEquationError();
                if (errorMessage != null)
                        errorMessage = "#ERROR(" + errorMessage + ")";
 
@@ -270,7 +269,7 @@
         * @return  DOCUMENT ME!
         */
        public Class getObjectTypeAt(String colName) {
-               return CyAttributesUtils.getClass(colName, data);
+               return CyAttributesUtils.getClass(colName, table);
        }
 
        /**
@@ -422,7 +421,7 @@
        void setDataTableRow(final int rowIdx, final int skipIdx) {
                final Vector rowVector = (Vector) dataVector.elementAt(rowIdx);
                final int noOfColumns = 
attributeNames.contains(SUID_COLUMN_NAME) ? attributeNames.size() : 
attributeNames.size() + 1;
-               final String id = graphObjects.get(rowIdx).getIdentifier();
+               final String id = graphObjects.get(rowIdx).getSUID();
                for (int colIdx = 0; colIdx < noOfColumns; ++colIdx) {
                        if (colIdx == skipIdx)
                                continue;

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