Changeset 5145


Ignore:
Timestamp:
Oct 20, 2009, 8:50:49 AM (12 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.

Location:
trunk/www/common/overview
Files:
2 edited

Legend:

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

    r4864 r5145  
    2424  import="net.sf.basedb.core.SessionControl"
    2525  import="net.sf.basedb.core.DbControl"
     26  import="net.sf.basedb.core.Annotation"
     27  import="net.sf.basedb.core.AnnotationType"
    2628  import="net.sf.basedb.core.Item"
    2729  import="net.sf.basedb.util.overview.GenericOverview"
     
    5254      for (Node n : parent.getChildren())
    5355      {
    54         String title;
    5556        String folderIcon = n.getNodeType() == Node.Type.FOLDER ? "Folder" : "Item";
    56         if (n.getItemType() == Item.ANNOTATIONTYPE && parent.getItemType() == Item.PROTOCOL)
     57        if (n.getItemType() == Item.ANNOTATIONTYPE)
    5758        {
    58           folderIcon = "ProtocolParameter";
     59          if (parent.getItemType() == Item.PROTOCOL)
     60          {
     61            folderIcon = "ProtocolParameter";
     62          }
     63          else
     64          {
     65            try
     66            {
     67              AnnotationType at = (AnnotationType)n.getItem(dc);
     68              if (at.isProtocolParameter()) folderIcon = "ProtocolParameter";
     69            }
     70            catch (Throwable t)
     71            {}
     72          }
    5973        }
    6074        else if (n.getItemType() == Item.ANNOTATION)
    6175        {
    6276          folderIcon = "Annotation";
     77          try
     78          {
     79            AnnotationType at = ((Annotation)n.getItem(dc)).getAnnotationType();
     80            if (at.isProtocolParameter()) folderIcon = "ProtocolParameter";
     81          }
     82          catch (Throwable t)
     83          {}
    6384        }       
    6485        int numChildren = n.numChildren();
  • 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.