Author: mes
Date: 2011-11-15 13:33:23 -0800 (Tue, 15 Nov 2011)
New Revision: 27481

Modified:
   
core3/impl/trunk/table-browser-impl/src/main/java/org/cytoscape/browser/internal/MyTableHeaderRenderer.java
Log:
fixed a strange bug due to a missing column

Modified: 
core3/impl/trunk/table-browser-impl/src/main/java/org/cytoscape/browser/internal/MyTableHeaderRenderer.java
===================================================================
--- 
core3/impl/trunk/table-browser-impl/src/main/java/org/cytoscape/browser/internal/MyTableHeaderRenderer.java
 2011-11-15 21:29:01 UTC (rev 27480)
+++ 
core3/impl/trunk/table-browser-impl/src/main/java/org/cytoscape/browser/internal/MyTableHeaderRenderer.java
 2011-11-15 21:33:23 UTC (rev 27481)
@@ -51,12 +51,11 @@
        public Component getTableCellRendererComponent(final JTable table, 
final Object value,
                                                       boolean isSelected, 
boolean hasFocus, int rowIndex, int vColIndex)
        {
-               if (defaultBackground == null){
-                       defaultBackground = this.getBackground();
-               }
-               if (defaultForeground == null){
-                       defaultForeground = this.getForeground();
-               }
+               if (defaultBackground == null)
+                       defaultBackground = getBackground();
+
+               if (defaultForeground == null)
+                       defaultForeground = getForeground();
                
                // 'value' is column header value of column 'vColIndex'
                // rowIndex is always -1
@@ -65,30 +64,27 @@
 
                // Configure the component with the specified value
                setText(value.toString());
+               setForeground(defaultForeground);
+               setBackground(defaultBackground);
 
-               if (!(table.getModel() instanceof BrowserTableModel)) {
-                       this.setForeground(defaultForeground);
-                       this.setBackground(defaultBackground);
+               if (!(table.getModel() instanceof BrowserTableModel)) 
                        return this;
-               }
                
                BrowserTableModel model = (BrowserTableModel)table.getModel();
                CyColumn col = 
model.getAttributes().getColumn(value.toString());
+               if ( col == null ) 
+                       return this;
                
                String toolTip = col.getType().getName();
                if(col.getVirtualColumnInfo().isVirtual()){
-                       this.setForeground(defaultForeground);
-                       this.setBackground(Color.lightGray);
-                       this.setOpaque(true);
+                       setForeground(defaultForeground);
+                       setBackground(Color.lightGray);
+                       setOpaque(true);
                        toolTip = "<html>" + col.getType().getName()+ "<br 
/>Virtual Column</html>";
-               }
-               else {
-                       this.setForeground(defaultForeground);
-                       this.setBackground(defaultBackground);
-               }
+               } 
                
                // Set tool tip if desired
-        this.setToolTipText(toolTip);
+        setToolTipText(toolTip);
                
                // Since the renderer is a component, return itself
                return this;

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