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

Show
Ignore:
Timestamp:
04/11/08 08:21:31 (7 months ago)
Author:
jburel
Message:

Add various options e.g. number of images per row

Location:
trunk/SRC/org/openmicroscopy/shoola/agents/dataBrowser
Files:
4 added
1 removed
20 modified

  • DataFilter.java (modified) (1 diff)
  • DataObjectCreator.java (added)
  • IconManager.java (modified) (2 diffs)
  • browser/Browser.java (modified) (3 diffs)
  • browser/BrowserComponent.java (deleted)
  • browser/BrowserModel.java (modified) (5 diffs)
  • graphx/eclipse_external_tools16.png (added)
  • graphx/nuvola_filenew16.png (added)
  • graphx/roll_over_image16.png (added)
  • layout/FlatLayout.java (modified) (2 diffs)
  • layout/Layout.java (modified) (1 diff)
  • layout/LayoutFactory.java (modified) (3 diffs)
  • layout/LayoutUtils.java (modified) (4 diffs)
  • layout/SquaryLayout.java (modified) (5 diffs)
  • view/DataBrowser.java (modified) (2 diffs)
  • view/DataBrowserComponent.java (modified) (4 diffs)
  • view/DataBrowserControl.java (modified) (2 diffs)
  • view/DataBrowserFactory.java (modified) (1 diff)
  • view/DataBrowserModel.java (modified) (5 diffs)
  • view/DataBrowserToolBar.java (modified) (9 diffs)
  • view/DataBrowserUI.java (modified) (2 diffs)
  • view/ImageTable.java (modified) (4 diffs)
  • view/ImageTableNode.java (modified) (1 diff)
  • view/ImageTableView.java (modified) (1 diff)
  • view/ImagesModel.java (modified) (2 diffs)

Legend:

Unmodified
Added
Removed
  • trunk/SRC/org/openmicroscopy/shoola/agents/dataBrowser/DataFilter.java

    r5342 r5345  
    138138                viewer.setFilteredNodes(filteredNodes); 
    139139        } 
    140          
    141140    } 
    142141     
  • trunk/SRC/org/openmicroscopy/shoola/agents/dataBrowser/IconManager.java

    r5342 r5345  
    109109    public static int                   ANNOTATION_8 = 19; 
    110110     
     111    /** The <code>Manager</code> icon. */ 
     112    public static int                   MANAGER = 20; 
     113     
     114    /** The <code>Manager</code> icon. */ 
     115    public static int                   ROLL_OVER = 21; 
     116     
     117    /** The <code>Create</code> icon. */ 
     118    public static int           CREATE = 22; 
     119     
    111120    /**  
    112121     * The maximum ID used for the icon IDs. 
    113122     * Allows to correctly build arrays for direct indexing.  
    114123     */ 
    115     private static int          MAX_ID = 19; 
     124    private static int          MAX_ID = 22; 
    116125     
    117126    /** Paths of the icon files. */ 
    … …  
    140149        relPaths[TRANSPARENT] = "eclipse_transparent16.png"; 
    141150        relPaths[ANNOTATION_8] = "nuvola_knotes8.png"; 
     151        relPaths[MANAGER] = "eclipse_external_tools16.png"; 
     152        relPaths[ROLL_OVER] = "roll_over_image16.png"; 
     153        relPaths[CREATE] = "nuvola_filenew16.png";  
    142154    } 
    143155     
  • trunk/SRC/org/openmicroscopy/shoola/agents/dataBrowser/browser/Browser.java

    r5332 r5345  
    3636 
    3737//Application-internal dependencies 
     38import org.openmicroscopy.shoola.agents.dataBrowser.layout.Layout; 
    3839import org.openmicroscopy.shoola.util.ui.component.ObservableComponent; 
    3940import pojos.DataObject; 
    … …  
    207208         
    208209        /** 
    209          * Sets the layout index. 
    210          *  
    211          * @param index The index of the layout. 
    212          */ 
    213         public void setSelectedLayout(int index); 
    214          
    215         /** 
    216          * Returns the index of the selected layout. 
    217          *  
    218          * @return See above. 
    219          */ 
    220         public int getSelectedLayout(); 
     210         * Sets the selected layout. 
     211         *  
     212         * @param layout The layout. 
     213         */ 
     214        public void setSelectedLayout(Layout layout); 
    221215         
    222216        /** 
    … …  
    349343        public List<ImageNode> getVisibleImageNodes(); 
    350344         
     345        public Layout getSelectedLayout(); 
     346         
    351347} 
  • trunk/SRC/org/openmicroscopy/shoola/agents/dataBrowser/browser/BrowserModel.java

    r5332 r5345  
    3838//Application-internal dependencies 
    3939import org.openmicroscopy.shoola.agents.dataBrowser.Colors; 
     40import org.openmicroscopy.shoola.agents.dataBrowser.layout.Layout; 
    4041import org.openmicroscopy.shoola.agents.dataBrowser.layout.LayoutFactory; 
    4142import org.openmicroscopy.shoola.agents.dataBrowser.visitor.NodesFinder; 
    … …  
    8788        private RootDisplay             rootDisplay; 
    8889         
    89         /** The index of the selected layout. */ 
    90         private int                     selectedLayout; 
     90        /** The selected layout. */ 
     91        private Layout                  selectedLayout; 
    9192         
    9293        /** 
    … …  
    389390        /** 
    390391         * Implemented as specified by the {@link Browser} interface. 
    391          * @see Browser#setSelectedLayout(int) 
    392          */ 
    393         public void setSelectedLayout(int index) 
    394         { 
    395             int oldIndex = selectedLayout; 
    396             switch (index) { 
     392         * @see Browser#setSelectedLayout(Layout) 
     393         */ 
     394        public void setSelectedLayout(Layout layout) 
     395        { 
     396                if (layout == null) return; 
     397                Layout oldLayout = selectedLayout; 
     398            switch (layout.getIndex()) { 
    397399                case LayoutFactory.SQUARY_LAYOUT: 
    398400                case LayoutFactory.FLAT_LAYOUT:   
    399                     selectedLayout = index; 
     401                    selectedLayout = layout; 
    400402                    break; 
    401                 default: 
    402                     selectedLayout = LayoutFactory.SQUARY_LAYOUT; 
    403403            } 
    404             firePropertyChange(LAYOUT_PROPERTY, new Integer(oldIndex),  
    405                             new Integer(selectedLayout)); 
     404            firePropertyChange(LAYOUT_PROPERTY, oldLayout, selectedLayout); 
    406405        } 
    407406         
    … …  
    410409         * @see Browser#getSelectedLayout() 
    411410         */ 
    412         public int getSelectedLayout() { return selectedLayout; } 
     411        public Layout getSelectedLayout() { return selectedLayout; } 
    413412         
    414413        /** 
    … …  
    469468            desktop.removeAll(); 
    470469            Iterator i; 
    471             if (selectedLayout == LayoutFactory.SQUARY_LAYOUT) { 
    472                 i = rootChildren.iterator(); 
    473                 ImageDisplay child; 
    474                 while (i.hasNext()) { 
    475                     child = (ImageDisplay) i.next(); 
    476                     desktop.add(child); 
    477                     addToDesktop(child); 
    478                 } 
    479             } else if (selectedLayout == LayoutFactory.FLAT_LAYOUT) { 
    480                 i = getImageNodes().iterator(); 
    481                 while (i.hasNext())  
    482                     desktop.add((ImageDisplay) i.next());     
    483             } 
     470            switch (selectedLayout.getIndex()) { 
     471                        case LayoutFactory.SQUARY_LAYOUT: 
     472                                 i = rootChildren.iterator(); 
     473                                ImageDisplay child; 
     474                                while (i.hasNext()) { 
     475                                    child = (ImageDisplay) i.next(); 
     476                                    desktop.add(child); 
     477                                    addToDesktop(child); 
     478                                } 
     479                                break; 
     480         
     481                        case LayoutFactory.FLAT_LAYOUT: 
     482                                 i = getImageNodes().iterator(); 
     483                                while (i.hasNext())  
     484                                    desktop.add((ImageDisplay) i.next());    
     485                } 
    484486            rootDisplay.setCursor( 
    485487                    Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); 
  • trunk/SRC/org/openmicroscopy/shoola/agents/dataBrowser/layout/FlatLayout.java

    r5317 r5345  
    7777    private Set                         oldNodes; 
    7878     
     79    /** The number of items per row. */ 
     80    private int                         itemsPerRow; 
     81     
    7982    /** 
    8083     * Package constructor so that objects can only be created by the 
    … …  
    137140     */ 
    138141        public void setOldNodes(Set oldNodes) { this.oldNodes = oldNodes; } 
     142 
     143    /** 
     144     * Implemented as specified by the {@link Layout} interface. 
     145     * @see Layout#setImagesPerRow(int) 
     146     */ 
     147        public void setImagesPerRow(int number) { itemsPerRow = number; } 
    139148    
    140149} 
  • trunk/SRC/org/openmicroscopy/shoola/agents/dataBrowser/layout/Layout.java

    r5317 r5345  
    7474     */ 
    7575    public void setOldNodes(Set oldNodes); 
     76     
     77    /** 
     78     * Sets the number of images per row. 
     79     *  
     80     * @param number The value to set. 
     81     */ 
     82    public void setImagesPerRow(int number); 
     83     
    7684} 
  • trunk/SRC/org/openmicroscopy/shoola/agents/dataBrowser/layout/LayoutFactory.java

    r5342 r5345  
    5656     * Creates the specified layout. 
    5757     *  
    58      * @param type      One of the constants defined by this class. 
    59      * @param sorter    Class used to sort the nodes by date or alphabetically.  
     58     * @param type              One of the constants defined by this class. 
     59     * @param sorter            Class used to sort the nodes by date or  
     60     *                                          alphabetically.  
     61     * @param itemsPerRow       The number of items oer row. 
    6062     * @return          A layout object for the given layout <code>type</code>. 
    6163     * @throws IllegalArgumentException If <code>type</code> is not one of 
    6264     *          the constants defined by this class. 
    6365     */ 
    64     public static Layout createLayout(int type, ViewerSorter sorter) 
     66    public static Layout createLayout(int type, ViewerSorter sorter, int 
     67                itemsPerRow) 
    6568    { 
    6669        if (sorter == null) 
    … …  
    6871        switch (type) { 
    6972            case SQUARY_LAYOUT: 
    70                 return new SquaryLayout(sorter); 
     73                return new SquaryLayout(sorter, itemsPerRow); 
    7174            case FLAT_LAYOUT: 
    7275                return new FlatLayout(sorter); 
    … …  
    8083     * Returns the default layout. 
    8184     *  
    82      * @param sorter Class used to sort the nodes by date or alphabetically.  
     85     * @param sorter            Class used to sort the nodes by date or  
     86     *                                          alphabetically. 
     87     * @param itemsPerRow       The number of images per row.  
    8388     * @return See above. 
    8489     */ 
    85     public static Layout getDefaultLayout(ViewerSorter sorter) 
     90    public static Layout getDefaultLayout(ViewerSorter sorter, int itemsPerRow) 
    8691    {  
    87         return createLayout(getDefaultLayoutIndex(), sorter);  
     92        return createLayout(getDefaultLayoutIndex(), sorter, itemsPerRow);  
    8893    } 
    8994     
  • trunk/SRC/org/openmicroscopy/shoola/agents/dataBrowser/layout/LayoutUtils.java

    r5342 r5345  
    162162        n = (int) Math.floor(Math.sqrt(n))+1; 
    163163        Dimension d; 
     164         
    164165        try { 
    165166            for (int i = 0; i < n; ++i) { 
    … …  
    187188     * in the parent <code>node</code>. 
    188189     *  
    189      * @param node The parent node. Mustn't be <code>null</code>. 
    190      * @param sorter The sorter. 
    191      */ 
    192     static void doSquareGridLayout(ImageDisplay node, ViewerSorter sorter) 
     190     * @param node                      The parent node. Mustn't be <code>null</code>. 
     191     * @param sorter            The sorter. 
     192     * @param itemsPerRow       The number of items per row. 
     193     */ 
     194    static void doSquareGridLayout(ImageDisplay node, ViewerSorter sorter, int 
     195                                                                itemsPerRow) 
    193196    { 
    194197        //First find out the max dim among children. 
    … …  
    209212        List l = new ArrayList(); 
    210213        for (int i = 0; i < comps.length; i++) { 
    211                         if (comps[i] instanceof ImageDisplay) { 
     214                        if (comps[i] instanceof ImageDisplay) 
    212215                                l.add(comps[i]); 
    213                         } 
    214216                } 
    215         n = l.size(); 
    216         n = (int) Math.floor(Math.sqrt(n))+1;  //See note. 
     217        //l = sorter.sort(l); 
     218        if (itemsPerRow > 1) { 
     219                n = itemsPerRow; 
     220        } else { 
     221                n = l.size(); 
     222                n = (int) Math.floor(Math.sqrt(n))+1;  //See note. 
     223        } 
     224        
    217225         
    218226        //Finally do layout. 
    … …  
    222230         
    223231        ImageDisplay child; 
    224          
    225          
    226          
    227          
    228232        Iterator children = l.iterator(); 
    229233        try { 
  • trunk/SRC/org/openmicroscopy/shoola/agents/dataBrowser/layout/SquaryLayout.java

    r5342 r5345  
    8282    /** Collection of nodes previously layed out. */ 
    8383    private Set                         oldNodes; 
     84     
     85    /** The number of items per row. */ 
     86    private int                         itemsPerRow; 
    8487     
    8588    /** Maximum width of the BrowserView.*/ 
    … …  
    221224     * {@link LayoutFactory}. 
    222225     *  
    223      * @param sorter A {@link ViewerSorter sorter} to order nodes. 
    224      */ 
    225     SquaryLayout(ViewerSorter sorter) 
     226     * @param sorter            A {@link ViewerSorter sorter} to order nodes. 
     227     * @param itemsPerRow       The number of items per row. 
     228     */ 
     229    SquaryLayout(ViewerSorter sorter, int itemsPerRow) 
    226230    { 
    227231        setBrowserSize(); 
    228232        this.sorter = sorter; 
     233        this.itemsPerRow = itemsPerRow; 
    229234    } 
    230235 
    … …  
    243248            } 
    244249                if (node.containsImages())  
    245                         LayoutUtils.doSquareGridLayout(node, sorter); 
     250                        LayoutUtils.doSquareGridLayout(node, sorter, itemsPerRow); 
    246251                else visitContainerNode(node); 
    247252        } else { 
    … …  
    274279                } 
    275280                if (node.containsImages())  
    276                         LayoutUtils.doSquareGridLayout(node, sorter); 
     281                        LayoutUtils.doSquareGridLayout(node, sorter, itemsPerRow); 
    277282                else visitContainerNode(node); 
    278283                } 
    … …  
    310315     */ 
    311316        public void setOldNodes(Set oldNodes) { this.oldNodes = oldNodes; } 
     317         
     318    /** 
     319     * Implemented as specified by the {@link Layout} interface. 
     320     * @see Layout#setImagesPerRow(int) 
     321     */ 
     322        public void setImagesPerRow(int number) { itemsPerRow = number; } 
    312323 
    313324} 
  • trunk/SRC/org/openmicroscopy/shoola/agents/dataBrowser/view/DataBrowser.java

    r5342 r5345  
    5858 
    5959        /** Loads the thumbnails when we have <code>100</code> or less values. */ 
    60         public static final int                 MAX_ENTRIES = 1; 
    61          
    62          
    63         public static final int                 ANNOTATE_SELECTION = 100; 
    64          
    65         public static final int                 ANNOTATE_IMAGES = 101; 
    66          
    67         public static final int                 ANNOTATE_CHILDREN = 102; 
     60        public static final int                 MAX_ENTRIES = 100; 
    6861         
    6962        /** Indicates to lay out the nodes as thumbnails. */ 
    … …  
    231224        public void setFilteredNodes(List<DataObject> objects); 
    232225 
     226        /** 
     227         * Filters the images. 
     228         *  
     229         * @param context The filtering context. 
     230         */ 
    233231        public void filterByContext(FilterContext context); 
    234232         
    235         public void annotate(int index); 
    236  
     233        /** Loads the existing tags. */ 
    237234        public void loadExistingTags(); 
    238235 
     236        /** 
     237         * Sets the existing tags. 
     238         *  
     239         * @param collection The collection to set. 
     240         */ 
    239241        public void setExistingTags(Collection collection); 
    240242         
  • trunk/SRC/org/openmicroscopy/shoola/agents/dataBrowser/view/DataBrowserComponent.java

    r5342 r5345  
    2828import java.util.ArrayList; 
    2929import java.util.Collection; 
    30 import java.util.HashSet; 
    3130import java.util.Iterator; 
    3231import java.util.List; 
    33 import java.util.Set; 
    3432import javax.swing.JComponent; 
    3533 
    … …  
    4442import org.openmicroscopy.shoola.agents.dataBrowser.visitor.NodesFinder; 
    4543import org.openmicroscopy.shoola.agents.dataBrowser.visitor.RegexFinder; 
    46 import org.openmicroscopy.shoola.agents.metadata.MetadataViewerAgent; 
    4744import org.openmicroscopy.shoola.env.data.util.FilterContext; 
    48 import org.openmicroscopy.shoola.env.event.EventBus; 
    4945import org.openmicroscopy.shoola.env.ui.UserNotifier; 
    5046import org.openmicroscopy.shoola.util.ui.RegExFactory; 
    5147import org.openmicroscopy.shoola.util.ui.component.AbstractComponent; 
    5248import pojos.DataObject; 
    53 import pojos.ImageData; 
    5449 
    5550/**  
    … …  
    159154        { 
    160155                Object object = node.getHierarchyObject(); 
    161                 if (object instanceof DataObject)  
    162                         firePropertyChange(SELECTED_NODE_DISPLAY_PROPERTY, null, object); 
     156                List<Object> objects = new ArrayList<Object>(); 
     157                 objects.add(object); 
     158                if (object instanceof DataObject) { 
     159                        ImageDisplay p = node.getParentDisplay(); 
     160                        Object parent = p.getHierarchyObject(); 
     161                        if (!(parent instanceof DataObject)) 
     162                                parent = model.getParent(); 
     163                        objects.add(parent); 
     164                } 
     165                firePropertyChange(SELECTED_NODE_DISPLAY_PROPERTY, null, objects); 
    163166        } 
    164167 
    … …  
    321324                fireStateChange(); 
    322325        } 
    323          
    324         /** 
    325          * Implemented as specified by the {@link DataBrowser} interface. 
    326          * @see DataBrowser#annotate(int) 
    327          */ 
    328         public void annotate(int index) 
    329         { 
    330                 Browser browser = model.getBrowser(); 
    331                 Collection nodes = null; 
    332                 switch (index) { 
    333                         case ANNOTATE_CHILDREN: 
    334                                  
    335                                 //TODO 
    336                         case ANNOTATE_IMAGES: 
    337                                 nodes = browser.getVisibleImages(); 
    338                         case ANNOTATE_SELECTION: 
    339                                 Set display = browser.getSelectedDisplays(); 
    340                                 if (display != null) { 
    341                                         Iterator i = display.iterator(); 
    342                                         ImageDisplay node; 
    343                                         nodes = new HashSet(); 
    344                                         Object ho; 
    345                                         while (i.hasNext()) { 
    346                                                 node = (ImageDisplay) i.next(); 
    347                                                 ho = node.getHierarchyObject(); 
    348                                                 if (ho instanceof ImageData) { 
    349                                                         nodes.add(ho); 
    350                                                 } 
    351                                         } 
    352                                 } 
    353                                 break; 
    354          
    355                         default: 
    356                                 throw new IllegalArgumentException("Annotation index " + 
    357                                                                                                 "not supported."); 
    358                 } 
    359                 EventBus bus = MetadataViewerAgent.getRegistry().getEventBus(); 
    360                 System.err.println(nodes); 
    361                 //if (nodes != null) 
    362                 //      bus.post(new ViewMetadata(nodes)); 
    363         } 
    364326 
    365327        /** 
  • trunk/SRC/org/openmicroscopy/shoola/agents/dataBrowser/view/DataBrowserControl.java

    r5337 r5345  
    136136        } 
    137137         
    138         /**  
    139          * Forwards call the {@link DataBrowser model}. 
    140          *  
    141          *  @param index One the annotation contants defined by {@link DataBrowser}. 
    142          */ 
    143         void annotate(int index) { model.annotate(index); } 
    144          
    145138        /** 
    146139         * Loads data, filters nodes or sets the selected node. 
    … …  
    162155                        model.loadExistingTags(); 
    163156                } else if (Browser.ROLL_OVER_PROPERTY.equals(name)) { 
    164                          
    165157            if (view.isRollOver()) { 
    166