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

Show
Ignore:
Timestamp:
10/09/08 14:56:18 (6 weeks ago)
Author:
jburel
Message:

Fixed minor bugs

Location:
branches/Beta3.1/SRC/org/openmicroscopy/shoola/agents
Files:
3 modified

  • dataBrowser/view/DataBrowserUI.java (modified) (1 diff)
  • treeviewer/TreeViewerTranslator.java (modified) (11 diffs)
  • treeviewer/browser/BrowserControl.java (modified) (1 diff)

Legend:

Unmodified
Added
Removed
  • branches/Beta3.1/SRC/org/openmicroscopy/shoola/agents/dataBrowser/view/DataBrowserUI.java

    r5606 r5669  
    294294                                ImageTableView existed = model.getTableView(); 
    295295                                ImageTableView v = model.createImageTableView(); 
     296                                if (existed != null && v != null) v.refreshTable(); 
    296297                                //if (existed == null) { 
    297                                         Collection nodes = model.getBrowser().getSelectedDisplays(); 
    298                                         if (nodes != null) { 
    299                                                 Iterator i = nodes.iterator(); 
    300                                                 List<DataObject> objects = new ArrayList<DataObject>(); 
    301                                                 ImageDisplay display; 
    302                                                 Object ho; 
    303                                                 while (i.hasNext()) { 
    304                                                         display = (ImageDisplay) i.next(); 
    305                                                         ho = display.getHierarchyObject(); 
    306                                                         if (ho instanceof DataObject) 
    307                                                                 objects.add((DataObject) ho); 
    308                                                 } 
    309                                                 v.setSelectedNodes(objects); 
     298                                Collection nodes = model.getBrowser().getSelectedDisplays(); 
     299                                if (nodes != null) { 
     300                                        Iterator i = nodes.iterator(); 
     301                                        List<DataObject> objects = new ArrayList<DataObject>(); 
     302                                        ImageDisplay display; 
     303                                        Object ho; 
     304                                        while (i.hasNext()) { 
     305                                                display = (ImageDisplay) i.next(); 
     306                                                ho = display.getHierarchyObject(); 
     307                                                if (ho instanceof DataObject) 
     308                                                        objects.add((DataObject) ho); 
    310309                                        } 
     310                                        v.setSelectedNodes(objects); 
     311                                } 
    311312                                //} 
    312313                                if (existed == null) v.addPropertyChangeListener(controller); 
  • branches/Beta3.1/SRC/org/openmicroscopy/shoola/agents/treeviewer/TreeViewerTranslator.java

    r5538 r5669  
    4646import org.openmicroscopy.shoola.util.ui.UIUtilities; 
    4747import org.openmicroscopy.shoola.util.ui.clsf.TreeCheckNode; 
    48 import pojos.CategoryData; 
    49 import pojos.CategoryGroupData; 
    5048import pojos.DataObject; 
    5149import pojos.DatasetData; 
    … …  
    111109     
    112110    /** 
    113      * Transforms a {@link CategoryData} into a visualisation object i.e. 
    114      * a {@link TreeCheckNode}. 
    115      *  
    116      * @param data  The {@link CategoryData} to transform. 
    117      *              Mustn't be <code>null</code>. 
    118      * @return See above. 
    119      */ 
    120     private static TreeCheckNode transformCategoryCheckNode(CategoryData data) 
    121     { 
    122         if (data == null) 
    123             throw new IllegalArgumentException("Cannot be null"); 
    124         IconManager im = IconManager.getInstance();       
    125         TreeCheckNode category =  new TreeCheckNode(data,  
    126                                     im.getIcon(IconManager.CATEGORY), 
    127                                     data.getName(), true); 
    128         return category; 
    129     } 
    130      
    131     /** 
    132111     * Transforms a {@link DatasetData} into a visualisation object i.e. 
    133112     * a {@link TreeCheckNode}. 
    … …  
    166145        return node; 
    167146    } 
    168      
    169     /** 
    170      * Transforms a {@link CategoryGroupData} into a visualisation object i.e. 
    171      * a {@link TreeCheckNode}. The {@link CategoryData categories} are also 
    172      * transformed and linked to the newly created {@link TreeCheckNode}. 
    173      *  
    174      * @param data      The {@link CategoryGroupData} to transform. 
    175      *                  Mustn't be <code>null</code>. 
    176      * @param userID    The id of the current user. 
    177      * @param groupID   The id of the group the current user selects when  
    178      *                      retrieving the data.              
    179      * @return See above. 
    180      */ 
    181     private static TreeCheckNode transformCategoryGroupCheckNode( 
    182                                 CategoryGroupData data, long userID,  
    183                                 long groupID) 
    184     { 
    185         if (data == null) 
    186             throw new IllegalArgumentException("Cannot be null"); 
    187         IconManager im = IconManager.getInstance(); 
    188         TreeCheckNode group = new TreeCheckNode(data,  
    189                                 im.getIcon(IconManager.CATEGORY_GROUP),  
    190                                 data.getName(), false); 
    191         Set categories = data.getCategories(); 
    192         Iterator i = categories.iterator(); 
    193         CategoryData child; 
    194         while (i.hasNext()) { 
    195             child = (CategoryData) i.next(); 
    196             if (EditorUtil.isWritable(child, userID, groupID)) 
    197                 group.addChildDisplay(transformCategoryCheckNode(child)); 
    198         } 
    199              
    200         return group; 
    201     }   
    202147     
    203148    /** 
    … …  
    449394        return screen; 
    450395    } 
    451      
    452     /** 
    453      * Transforms a {@link CategoryData} into a visualisation object i.e. 
    454      * a {@link TreeImageSet}. 
    455      *  
    456      * @param data      The {@link CategoryData} to transform. 
    457      *                  Mustn't be <code>null</code>. 
    458      * @param userID    The id of the current user. 
    459      * @param groupID   The id of the group the current user selects when  
    460      *                      retrieving the data.                 
    461      * @return See above. 
    462      */ 
    463     private static TreeImageDisplay transformCategory(CategoryData data,  
    464                                                 long userID, long groupID) 
    465     { 
    466         if (data == null) 
    467             throw new IllegalArgumentException("Cannot be null"); 
    468         TreeImageSet category =  new TreeImageSet(data); 
    469         Set images = data.getImages(); 
    470         if (images == null) category.setNumberItems(-1); 
    471         else { 
    472             category.setChildrenLoaded(Boolean.TRUE); 
    473             category.setNumberItems(images.size()); 
    474             Iterator i = images.iterator(); 
    475             ImageData child; 
    476             while (i.hasNext()) { 
    477                 child = (ImageData) i.next(); 
    478                 if (EditorUtil.isReadable(child, userID, groupID)) 
    479                     category.addChildDisplay(transformImage(child)); 
    480             } 
    481         } 
    482         return category; 
    483     }  
    484      
    485     /** 
    486      * Transforms a {@link CategoryGroupData} into a visualisation object i.e. 
    487      * a {@link TreeImageSet}. The {@link CategoryData categories} are also 
    488      * transformed and linked to the newly created {@link TreeImageSet}. 
    489      *  
    490      * @param data          The {@link CategoryGroupData} to transform. 
    491      *                      Mustn't be <code>null</code>. 
    492      * @param categories    The categories to add. 
    493      * @param userID        The id of the current user. 
    494      * @param groupID       The id of the group the current user selects when  
    495      *                      retrieving the data.                     
    496      * @return See above. 
    497      */ 
    498     private static TreeImageDisplay transformCategoryGroup( 
    499             CategoryGroupData data, Set categories, long userID, long groupID) 
    500     { 
    501         if (data == null) 
    502             throw new IllegalArgumentException("Cannot be null"); 
    503         TreeImageSet group = new TreeImageSet(data); 
    504         if (categories != null) { 
    505             group.setChildrenLoaded(Boolean.TRUE); 
    506             Iterator i = categories.iterator(); 
    507             CategoryData child; 
    508             while (i.hasNext())  { 
    509                 child = (CategoryData) i.next(); 
    510                 if (EditorUtil.isReadable(child, userID, groupID)) 
    511                     group.addChildDisplay(transformCategory(child, userID,  
    512                                                             groupID)); 
    513             }    
    514             group.setNumberItems(categories.size()); 
    515         } else { 
    516             //categories not loaded. 
    517             group.setChildrenLoaded(Boolean.TRUE); 
    518             group.setNumberItems(0); 
    519         } 
    520         return group; 
    521     } 
    522      
     396 
    523397    /** 
    524398     * Transforms a {@link ImageData} into a visualisation object i.e. 
    … …  
    567441                            ((ProjectData) ho).getDatasets(), userID,  
    568442                                                groupID)); 
    569                 else if (ho instanceof CategoryGroupData) 
    570                     results.add(transformCategoryGroup((CategoryGroupData) ho,  
    571                             ((CategoryGroupData) ho).getCategories(), 
    572                             userID, groupID)); 
    573443                else if (ho instanceof ImageData)  
    574444                    results.add(transformImage((ImageData) ho));         
    … …  
    585455                        child = transformDataset((DatasetData) ho, userID, groupID); 
    586456                        results.add(child); 
    587                 } else if (ho instanceof CategoryData) { 
    588                         if (orphan == null) { 
    589                                 orphan = new TreeImageSet(ORPHANED_CATEGORIES); 
    590                                 orphan.setChildrenLoaded(Boolean.TRUE); 
    591                                 results.add(orphan); 
    592                         } 
    593                         child = transformCategory((CategoryData) ho, userID,  
    594                                                                                 groupID); 
    595                         orphan.addChildDisplay(child); 
    596                 } else if (ho instanceof TagAnnotationData) { 
     457                }else if (ho instanceof TagAnnotationData) { 
    597458                        child = transformTag((TagAnnotationData) ho, userID,  
    598459                                                    groupID); 
    … …  
    651512                                        expanded.contains(new Long(ho.getId()))); 
    652513                    results.add(display); 
    653                 } else if (ho instanceof CategoryGroupData) { 
    654                         if (expandedTopNodes != null) 
    655                                 expanded = (List)  
    656                                                 expandedTopNodes.get(CategoryGroupData.class); 
    657                     display = transformCategoryGroup((CategoryGroupData) ho,  
    658                                                     (Set) nodes.get(ho),  
    659                                                     userID, groupID); 
    660                     if (expanded != null) 
    661                             display.setExpanded( 
    662                                         expanded.contains(new Long(ho.getId()))); 
    663                     results.add(display);  
    664514                } else if (ho instanceof DatasetData) { 
    665515                        /* 
    … …  
    701551                                results.add(display);  
    702552                        } 
    703                 } else if (ho instanceof CategoryData) { 
    704                         if (orphan == null) { 
    705                                 orphan = new TreeImageSet(ORPHANED_CATEGORIES); 
    706                                 orphan.setChildrenLoaded(true); 
    707                                 results.add(orphan);  
    708                         } 
    709                         if (expandedTopNodes != null) 
    710                                 expanded =  
    711                                                 (List) expandedTopNodes.get(CategoryData.class); 
    712                         Set r = (Set) nodes.get(ho); //should only have one element 
    713                         if (r != null) {  //shouldn't happen 
    714                                 Iterator k = r.iterator(); 
    715                         while (k.hasNext()) { 
    716                                 CategoryData element = (CategoryData) k.next(); 
    717                                                 display = transformCategory(element, userID,  
    718                                                                                                         groupID); 
    719                                                 if (expanded != null) 
    720                                     display.setExpanded( 
    721                                         expanded.contains(new Long(ho.getId()))); 
    722                                                 orphan.addChildDisplay(display); 
    723                                         } 
    724                         } 
    725553                } else if (ho instanceof ScreenData) { 
    726554                        if (expandedTopNodes != null) 
    … …  
    770598        else if (object instanceof DatasetData) 
    771599            return transformDataset((DatasetData) object, userID, groupID); 
    772         else if (object instanceof CategoryData) 
    773             return transformCategory((CategoryData) object, userID, groupID); 
    774         else if (object instanceof CategoryGroupData) 
    775             return transformCategoryGroup((CategoryGroupData) object,  
    776                     ((CategoryGroupData) object).getCategories(), 
    777                                         userID, groupID); 
    778600        else if (object instanceof ImageData) 
    779601            return transformImage((ImageData) object); 
    … …  
    811633            ho = (DataObject) i.next(); 
    812634            if (EditorUtil.isWritable(ho, userID, groupID)) { 
    813                 if (ho instanceof CategoryGroupData) { 
    814                     Set categories = ((CategoryGroupData) ho).getCategories(); 
    815                     if (categories != null && categories.size() != 0) 
    816                         results.add(transformCategoryGroupCheckNode( 
    817                                 (CategoryGroupData) ho, userID, groupID)); 
    818                 } else if (ho instanceof CategoryData) 
    819                     results.add(transformCategoryCheckNode((CategoryData) ho)); 
    820                 else if (ho instanceof DatasetData)  
     635                if (ho instanceof DatasetData)  
    821636                    results.add(transformDatasetCheckNode((DatasetData) ho)); 
    822637            }   
    … …  
    849664                if (ho instanceof DatasetData) 
    850665                    results.add(transformDatasetCheckNode((DatasetData) ho)); 
    851                 else if (ho instanceof CategoryData) 
    852                     results.add(transformCategoryCheckNode((CategoryData) ho)); 
    853666                else if (ho instanceof ImageData) 
    854667                    results.add(transformImageCheckNode((ImageData) ho)); 
  • branches/Beta3.1/SRC/org/openmicroscopy/shoola/agents/treeviewer/browser/BrowserControl.java

    r5538 r5669  
    4646import org.openmicroscopy.shoola.agents.treeviewer.actions.SortByDateAction; 
    4747import org.openmicroscopy.shoola.env.ui.UserNotifier; 
    48 import org.openmicroscopy.shoola.util.ui.UIUtilities; 
    49  
    5048import pojos.CategoryData; 
    5149import pojos.DatasetData; 

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/