Ignore:
Timestamp:
Aug 9, 2011, 1:39:40 PM (11 years ago)
Author:
Nicklas Nordborg
Message:

References #1597: Subtypes of items

Smarter selection of default subtypes and related items (protocols, etc) have now been implemented in the other important edit dialogs.

Added support for also loading and displaying project default items dynamically based on the selected subtype.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/www/views/rawbioassays/edit_rawbioassay.jsp

    r5685 r5687  
    8585  boolean deniedPlatform = false;
    8686  Platform currentPlatform = null;
    87   Platform defaultPlatform = null;
     87  List<Platform> defaultPlatforms = null;
    8888  PlatformVariant currentVariant = null;
    89   PlatformVariant defaultVariant = null;
     89  List<PlatformVariant> defaultVariants = null;
    9090 
    9191  boolean readCurrentBioAssay = true;
     
    9595  boolean readCurrentProtocol = true;
    9696  Protocol currentProtocol = null;
    97   Protocol defaultProtocol = null;
     97  List<Protocol> defaultProtocols = null;
    9898  boolean readCurrentSoftware = true;
    9999  Software currentSoftware = null;
    100   Software defaultSoftware = null;
     100  List<Software> defaultSoftware = null;
    101101  boolean readCurrentArrayDesign = true;
    102102  ArrayDesign currentArrayDesign = null;
    103   ArrayDesign defaultArrayDesign = null;
     103  List<ArrayDesign> defaultArrayDesigns = null;
    104104  RawDataType currentRawDataType = null;
    105105  RawDataType defaultRawDataType = null;
     
    119119    try
    120120    {
    121       defaultProtocol = (Protocol)activeProject.findDefaultItem(dc,
     121      defaultProtocols = (List<Protocol>)activeProject.findDefaultItems(dc,
    122122          ItemSubtype.getById(dc, SystemItems.getId(Protocol.FEATURE_EXTRACTION)), false);
    123     }
    124     catch (PermissionDeniedException pdex)
    125     {
    126       defaultProtocol = null;
    127     }
    128     try
    129     {
    130       defaultSoftware = (Software)activeProject.findDefaultItem(dc,
    131           ItemSubtype.getById(dc, SystemItems.getId(Software.FEATURE_EXTRACTION)), false);
    132     }
    133     catch (PermissionDeniedException pdex)
    134     {
    135       defaultSoftware = null;
    136     }
    137     try
    138     {
    139       defaultArrayDesign = (ArrayDesign)activeProject.findDefaultItem(dc, Item.ARRAYDESIGN);
    140     }
    141     catch (PermissionDeniedException pdex)
    142     {
    143       defaultArrayDesign = null;
    144     }
    145     try
    146     {
    147       defaultPlatform = (Platform)activeProject.findDefaultItem(dc, Item.PLATFORM);
    148123    }
    149124    catch (PermissionDeniedException pdex)
     
    151126    try
    152127    {
    153       defaultVariant = (PlatformVariant)activeProject.findDefaultItem(dc, Item.PLATFORMVARIANT);
     128      defaultSoftware = (List<Software>)activeProject.findDefaultItems(dc,
     129          ItemSubtype.getById(dc, SystemItems.getId(Software.FEATURE_EXTRACTION)), false);
     130    }
     131    catch (PermissionDeniedException pdex)
     132    {}
     133    try
     134    {
     135      defaultArrayDesigns = (List<ArrayDesign>)activeProject.findDefaultItems(dc, Item.ARRAYDESIGN, true);
     136    }
     137    catch (PermissionDeniedException pdex)
     138    {}
     139    try
     140    {
     141      defaultPlatforms = (List<Platform>)activeProject.findDefaultItems(dc, Item.PLATFORM, true);
     142    }
     143    catch (PermissionDeniedException pdex)
     144    {}
     145    try
     146    {
     147      defaultVariants = (List<PlatformVariant>)activeProject.findDefaultItems(dc, Item.PLATFORMVARIANT, true);
    154148    }
    155149    catch (PermissionDeniedException pdex)
     
    176170    catch (Throwable t)
    177171    {}
    178     if (currentPlatform == null) currentPlatform = defaultPlatform;
    179     if (currentVariant == null) currentVariant = defaultVariant;
     172    if (currentPlatform == null && defaultPlatforms.size() > 0)
     173    {
     174      currentPlatform = defaultPlatforms.get(0);
     175    }
     176    if (currentVariant == null && defaultVariants.size() > 0)
     177    {
     178      currentVariant = defaultVariants.get(0);
     179    }
    180180   
    181181    currentRawDataType = RawDataTypes.getRawDataType(cc.getPropertyValue("rawDataType"));
     
    772772            denied="<%=!readCurrentArrayDesign%>"
    773773            recent="<%=recentArrayDesigns%>"
    774             defaultitem="<%=defaultArrayDesign%>"
     774            defaultitems="<%=defaultArrayDesigns%>"
    775775            newitem="<%=rawBioAssay == null%>"
    776776            onselect="selectArrayDesignOnClick()"
     
    804804            denied="<%=!readCurrentProtocol%>"
    805805            recent="<%=recentProtocols%>"
    806             defaultitem="<%=defaultProtocol%>"
     806            defaultitems="<%=defaultProtocols%>"
    807807            newitem="<%=rawBioAssay == null%>"
    808808            onselect="selectProtocolOnClick()"
     
    821821            denied="<%=!readCurrentSoftware%>"
    822822            recent="<%=recentSoftware%>"
    823             defaultitem="<%=defaultSoftware%>"
     823            defaultitems="<%=defaultSoftware%>"
    824824            newitem="<%=rawBioAssay == null%>"
    825825            onselect="selectSoftwareOnClick()"
Note: See TracChangeset for help on using the changeset viewer.