Author: kono
Date: 2011-11-17 11:25:25 -0800 (Thu, 17 Nov 2011)
New Revision: 27513

Added:
   core3/impl/trunk/table-browser-impl/src/main/resources/images/primary_key.png
Modified:
   
core3/impl/trunk/table-browser-impl/src/main/java/org/cytoscape/browser/internal/AttributeBrowserToolBar.java
   
core3/impl/trunk/table-browser-impl/src/main/java/org/cytoscape/browser/internal/CustomHeaderRenderer.java
   core3/impl/trunk/table-browser-impl/src/main/resources/images/about_icon.txt
Log:
Primary key icon added.

Modified: 
core3/impl/trunk/table-browser-impl/src/main/java/org/cytoscape/browser/internal/AttributeBrowserToolBar.java
===================================================================
--- 
core3/impl/trunk/table-browser-impl/src/main/java/org/cytoscape/browser/internal/AttributeBrowserToolBar.java
       2011-11-17 19:04:28 UTC (rev 27512)
+++ 
core3/impl/trunk/table-browser-impl/src/main/java/org/cytoscape/browser/internal/AttributeBrowserToolBar.java
       2011-11-17 19:25:25 UTC (rev 27513)
@@ -60,6 +60,7 @@
 import javax.swing.event.PopupMenuEvent;
 import javax.swing.event.PopupMenuListener;
 
+import org.cytoscape.browser.internal.util.ColumnResizer;
 import org.cytoscape.equations.EquationCompiler;
 import org.cytoscape.model.CyColumn;
 import org.cytoscape.model.CyTable;
@@ -659,6 +660,9 @@
                                                        for (final CyColumn 
column : table.getColumns())
                                                                
allAttrNames.add(column.getName());
                                                        
browserTableModel.setVisibleAttributeNames(allAttrNames);
+                                                       
+                                                       // Resize column
+                                                       
ColumnResizer.adjustColumnPreferredWidths(browserTableModel.getTable());
                                                } catch (Exception ex) {
                                                        
attributeList.clearSelection();
                                                }

Modified: 
core3/impl/trunk/table-browser-impl/src/main/java/org/cytoscape/browser/internal/CustomHeaderRenderer.java
===================================================================
--- 
core3/impl/trunk/table-browser-impl/src/main/java/org/cytoscape/browser/internal/CustomHeaderRenderer.java
  2011-11-17 19:04:28 UTC (rev 27512)
+++ 
core3/impl/trunk/table-browser-impl/src/main/java/org/cytoscape/browser/internal/CustomHeaderRenderer.java
  2011-11-17 19:25:25 UTC (rev 27513)
@@ -60,7 +60,7 @@
        private static final Color COLUMN_TITLE_COLOR = new Color(0x10, 0x10, 
0x10);
 
        private static final Color BORDER_COLOR = new Color(0x10, 0x10, 0x10, 
120);
-       private static final Border BORDER_INSIDE = new EmptyBorder(4, 6, 4, 3);
+       private static final Border BORDER_INSIDE = new EmptyBorder(4, 3, 4, 3);
        private static final Border BORDER_OUTSIDE = new MatteBorder(0, 0, 1, 
1, BORDER_COLOR);
        private static final Border BORDER = new CompoundBorder(BORDER_OUTSIDE, 
BORDER_INSIDE);
 
@@ -74,6 +74,9 @@
                        .getResource("images/datatype_boolean_16.png"));
        private static final ImageIcon LIST_ICON = new 
ImageIcon(CustomHeaderRenderer.class.getClassLoader().getResource(
                        "images/datatype_list_16.png"));
+       
+       private static final ImageIcon PRIMARY_KEY_ICON = new 
ImageIcon(CustomHeaderRenderer.class.getClassLoader().getResource(
+                       "images/primary_key.png"));
 
        CustomHeaderRenderer() {
                setBorder(BORDER);
@@ -105,10 +108,12 @@
                if (col == null)
                        return this;
 
+               
                // Set datatype icon if available
-               this.setIcon(getIcon(col.getType()));
+               this.setIcon(getIcon(col.getType(), col));
                String toolTip = null;
                
+               
                if(col.getType() == List.class) {
                        toolTip = "<html>This is a List column<br />" +
                                        "The lists contain " + 
col.getListElementType() + "</html>";
@@ -138,7 +143,11 @@
                return this;
        }
        
-       private Icon getIcon(final Class<?> dataType) {
+       private Icon getIcon(final Class<?> dataType, final CyColumn col) {
+               
+               if(col.isPrimaryKey())
+                       return PRIMARY_KEY_ICON;
+               
                if(dataType == String.class)
                        return STRING_ICON;
                else if(dataType == Double.class || dataType == Float.class)
@@ -147,8 +156,9 @@
                        return BOOLEAN_ICON;
                else if(dataType == List.class)
                        return LIST_ICON;
-               else if (dataType == Integer.class)
+               else if (dataType == Integer.class || dataType == Long.class)
                        return INTEGER_ICON;
+               
                return null;
        }
 

Modified: 
core3/impl/trunk/table-browser-impl/src/main/resources/images/about_icon.txt
===================================================================
--- 
core3/impl/trunk/table-browser-impl/src/main/resources/images/about_icon.txt    
    2011-11-17 19:04:28 UTC (rev 27512)
+++ 
core3/impl/trunk/table-browser-impl/src/main/resources/images/about_icon.txt    
    2011-11-17 19:25:25 UTC (rev 27513)
@@ -2,4 +2,9 @@
 
 Icon Pack:Farm-Fresh Web
 Designer:FatCow Web Hosting
-License:Creative Commons Attribution (by)
\ No newline at end of file
+License:Creative Commons Attribution (by)
+
+<primary_key.png>
+Icon Pack:Wireframe Mono
+Designer:Gentleface.com
+License:Creative Commons Attribution Non-commercial (by-nc)
\ No newline at end of file

Added: 
core3/impl/trunk/table-browser-impl/src/main/resources/images/primary_key.png
===================================================================
(Binary files differ)


Property changes on: 
core3/impl/trunk/table-browser-impl/src/main/resources/images/primary_key.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

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