Ignore:
Timestamp:
Oct 20, 2009, 8:50:49 AM (13 years ago)
Author:
Nicklas Nordborg
Message:

Fixes #1404: Use cached annotations in "item overview"

The tests in #1406 were successful. Also fixed an issue with icons in the outline for protocol parameters.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/www/common/overview/tree.jsp

    r4864 r5145  
    2626  import="net.sf.basedb.core.Item"
    2727  import="net.sf.basedb.core.BasicItem"
     28  import="net.sf.basedb.core.Annotation"
     29  import="net.sf.basedb.core.AnnotationType"
    2830  import="net.sf.basedb.core.Nameable"
    2931  import="net.sf.basedb.core.ItemContext"
     
    4042<%@ taglib prefix="base" uri="/WEB-INF/base.tld" %>
    4143<%!
    42 String generateSubTree(Node startNode, String ID, boolean showFailures)
     44String generateSubTree(DbControl dc, Node startNode, String ID, boolean showFailures)
    4345{
    4446  StringBuilder sb = new StringBuilder();
     
    5456    String folderIcon = child.getNodeType() == Node.Type.FOLDER ? "Folder" : "Item";
    5557    String tooltip = "";
    56     if (child.getItemType() == Item.ANNOTATIONTYPE && startNode.getItemType() == Item.PROTOCOL)
    57     {
    58       folderIcon = "ProtocolParameter";
     58    if (child.getItemType() == Item.ANNOTATIONTYPE)
     59    {
     60      if (startNode.getItemType() == Item.PROTOCOL)
     61      {
     62        folderIcon = "ProtocolParameter";
     63      }
     64      else
     65      {
     66        try
     67        {
     68          AnnotationType at = (AnnotationType)child.getItem(dc);
     69          if (at.isProtocolParameter()) folderIcon = "ProtocolParameter";
     70        }
     71        catch (Throwable t)
     72        {}
     73      }
    5974    }
    6075    else if (child.getItemType() == Item.ANNOTATION)
    6176    {
    6277      folderIcon = "Annotation";
     78      try
     79      {
     80        AnnotationType at = ((Annotation)child.getItem(dc)).getAnnotationType();
     81        if (at.isProtocolParameter()) folderIcon = "ProtocolParameter";
     82      }
     83      catch (Throwable t)
     84      {}
    6385    }
    6486   
     
    128150             sb.append("'showInfo(\"").append(child.getId()).append("\")','").append(HTML.javaScriptEncode(tooltip)).append("', '").append(child.getId()).append("')\n");
    129151    }
    130     sb.append(generateSubTree(child, ID, showFailures));
     152    sb.append(generateSubTree(dc, child, ID, showFailures));
    131153  }
    132154  return sb.toString();
     
    137159final String ID = sc.getId();
    138160final float scale = Base.getScale(sc);
    139 final DbControl dc = null;
     161final DbControl dc = sc.newDbControl();
    140162try
    141163{
     
    208230    IconStore.addIcon('AnnotatioChildnErrorSelected', path + 'annotationchilderrorselected.gif', 18, 16);
    209231    var node<%=rootNode.hashCode()%> = JoustMenu.addMenuItem(-1, '<%=rootIcon%>', '<%=HTML.javaScriptEncode(rootItem.getName())%>', 'showInfo("<%=rootNode.getId()%>")', '', '<%=rootNode.getId()%>');
    210     <%=generateSubTree(rootNode, ID, showFailures)%>
     232    <%=generateSubTree(dc, rootNode, ID, showFailures)%>
    211233    JoustMenu.menuItems[node<%=rootNode.hashCode()%>].isOpen = true;
    212234    JoustMenu.draw('joust');
Note: See TracChangeset for help on using the changeset viewer.