• Views
  • Iteration Report
  • My Iteration Report
  •  
OMERO.clients
  • Login
  • Help/Guide
  • About Trac
  • Preferences
  • Wiki
  • Timeline
  • Roadmap
  • Browse Source
  • View Tickets
  • Search

Context Navigation

  • ← Previous Changeset
  • Next Changeset →

Changeset 5618

Show
Ignore:
Timestamp:
09/18/08 14:50:31 (2 months ago)
Author:
jburel
Message:

Added safety net when info not in container.xml.
Moved code

Location:
trunk/SRC/org/openmicroscopy/shoola
Files:
1 added
1 removed
2 modified

  • agents/measurement/util/ui/ColourIcon.java (deleted)
  • agents/measurement/util/ui/ColourListRenderer.java (modified) (4 diffs)
  • env/data/views/calls/ThumbnailSetLoader.java (modified) (2 diffs)
  • util/ui/ColourIcon.java (added)

Legend:

Unmodified
Added
Removed
  • trunk/SRC/org/openmicroscopy/shoola/agents/measurement/util/ui/ColourListRenderer.java

    r5032 r5618  
    3737 
    3838//Application-internal dependencies 
     39import org.openmicroscopy.shoola.util.ui.ColourIcon; 
    3940 
    4041/**  
    … …  
    5859{ 
    5960         
    60         /** Create the colouricon which will hold the colours. */ 
    61         private static ColourIcon icon = new ColourIcon(15, 15); 
     61        /** The gap between the icon and the text. */ 
     62        private static final int  GAP = 20; 
     63         
     64        /** Create the icon which will hold the colours. */ 
     65        private static ColourIcon icon;// = new ColourIcon(15, 15); 
    6266         
    6367        /** Border colour of the cell when the icon is selected. */ 
    64         private Border lineBorder = BorderFactory.createLineBorder(Color.gray, 1); 
     68        private Border lineBorder; 
    6569         
    6670        /** Border colour of the cell when the icon is not selected. */ 
    67         private Border emptyBorder = BorderFactory.createEmptyBorder(2, 2, 2, 2); 
     71        private Border emptyBorder; 
    6872                 
     73         
     74         
    6975        /** 
    7076         * Creates a new instance. 
    … …  
    7682        setHorizontalAlignment(CENTER); 
    7783        setVerticalAlignment(CENTER); 
     84        icon = new ColourIcon(12, 12); 
     85        lineBorder = BorderFactory.createLineBorder(Color.gray, 1); 
     86        emptyBorder = BorderFactory.createEmptyBorder(2, 2, 2, 2); 
    7887    } 
    7988         
    8089        /**  
    81      * Overridden method 
     90     * Overridden method to set the color icon. 
    8291         * @see ListCellRenderer#getListCellRendererComponent(JList, Object, int,  
    8392     *                                                  boolean, boolean) 
    8493         */ 
    85         public Component getListCellRendererComponent(JList list, 
    86             Object value, 
    87             int index, 
    88             boolean isSelected, 
    89             boolean hasFocus)  
     94        public Component getListCellRendererComponent(JList list, Object value, 
     95            int index, boolean isSelected, boolean hasFocus)  
    9096        { 
    9197                Object [] array = (Object[]) value; 
    … …  
    95101                 
    96102                setIcon(icon); 
    97                 this.setVerticalAlignment(SwingConstants.CENTER); 
    98                 this.setIconTextGap(40); 
     103                setVerticalAlignment(SwingConstants.CENTER); 
     104                setIconTextGap(GAP); 
    99105                setText((String) array[1]); 
    100106                if (isSelected) 
  • trunk/SRC/org/openmicroscopy/shoola/env/data/views/calls/ThumbnailSetLoader.java

    r5615 r5618  
    117117        if (pxd == null) 
    118118                return Factory.createDefaultImageThumbnail(); 
    119         /* 
    120         int sizeX = maxLength, sizeY = maxLength; 
    121          
    122          
    123         double pixSizeX = pxd.getSizeX(); 
    124         double pixSizeY = pxd.getSizeY(); 
    125         double ratio = pixSizeX/pixSizeY; 
    126         if (ratio < 1) sizeX *= ratio; 
    127         else if (ratio > 1 && ratio != 0) sizeY *= 1/ratio; 
    128         Dimension d = Factory.computeThumbnailSize(maxLength, maxLength,  
    129                         pxd.getSizeX(), pxd.getSizeY()); 
    130          
    131          
    132                 return Factory.createDefaultImageThumbnail(sizeX, sizeY); 
    133                 */ 
    134119        Dimension d = Factory.computeThumbnailSize(maxLength, maxLength,  
    135120                        pxd.getSizeX(), pxd.getSizeY()); 
    … …  
    143128    private void computeFetchSize() 
    144129    { 
    145         int value = (Integer) context.lookup(LookupNames.THUMBNAIL_FETCH_SZ); 
     130        int value = -1; 
     131        Object fSize = context.lookup(LookupNames.THUMBNAIL_FETCH_SZ); 
     132        if (fSize == null || !(fSize instanceof Integer)) { 
     133                context.getLogger().warn(this, "Thumbnail fetching size not set"); 
     134                value = (Integer) fSize; 
     135        } 
    146136        if (value <= 0) value = FETCH_SIZE; 
    147137        UserCredentials uc =  
    148138                        (UserCredentials) context.lookup(LookupNames.USER_CREDENTIALS); 
    149139        double f = 0; 
     140        Object fSpeed = null; 
    150141        switch (uc.getSpeedLevel()) { 
    151142                        case UserCredentials.MEDIUM: 
    152                                 f = (Double) context.lookup( 
     143                                fSpeed = context.lookup( 
    153144                                                LookupNames.THUMBNAIL_FETCH_MEDIUM_SPEED); 
    154                                  
     145                                if (fSpeed == null || !(fSpeed instanceof Double)) { 
     146                                context.getLogger().warn(this, "Thumbnail " + 
     147                                                "fetching factor not set"); 
     148                                f = (Double) fSpeed; 
     149                        } 
    155150                                if (f <= 0 || f > 1) f = FETCH_MEDIUM_SPEED; 
    156151                                fetchSize = (int) (value*f); 
    157152                                break; 
    158153                        case UserCredentials.LOW: 
    159                                 f = (Double) context.lookup( 
     154                                fSpeed = context.lookup( 
    160155                                                LookupNames.THUMBNAIL_FETCH_LOW_SPEED); 
     156                                if (fSpeed == null || !(fSpeed instanceof Double)) { 
     157                                context.getLogger().warn(this, "Thumbnail " + 
     158                                                "fetching factor not set"); 
     159                                f = (Double) fSpeed; 
     160                        } 
    161161                                if (f <= 0 || f > 1) f = FETCH_LOW_SPEED; 
    162162                                fetchSize = (int) (value*f); 

Download in other formats:

  • Unified Diff
  • Zip Archive

Trac Powered

Powered by Trac 0.11
By Edgewall Software.

Visit the Trac open source project at
http://trac.edgewall.org/