Changeset 4065


Ignore:
Timestamp:
Dec 14, 2007, 2:34:36 PM (16 years ago)
Author:
Nicklas Nordborg
Message:

Fixes #870 and #883: Overview plots and correction factor plots should be loaded one by one

Location:
branches/2.5-stable/www
Files:
2 added
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.5-stable/www/views/experiments/bioassaysets/view_bioassayset.jsp

    r3679 r4065  
    174174      }
    175175    }
    176     function changeImage(imageId, url)
    177     {
     176    function runItemPlugin(cmd)
     177    {
     178      Main.openPopup('index.jsp?ID=<%=ID%>&cmd='+cmd+'&experiment_id=<%=experimentId%>&item_id=<%=itemId%>', 'RunPlugin'+cmd, 740, 540);
     179    }
     180    var imageQueue = new Array();
     181    var nextImage = 0;
     182    function addImage(imageId, url)
     183    {
     184      imageQueue[imageQueue.length] = imageId;
    178185      var img = document.getElementById(imageId);
    179       img.src = url;
    180     }
    181     function runItemPlugin(cmd)
    182     {
    183       Main.openPopup('index.jsp?ID=<%=ID%>&cmd='+cmd+'&experiment_id=<%=experimentId%>&item_id=<%=itemId%>', 'RunPlugin'+cmd, 740, 540);
     186      img.realSrc = url;
     187    }
     188    function imageLoaded()
     189    {
     190      nextImage++;
     191      prepareNextImage();
     192    }
     193    function prepareNextImage()
     194    {
     195      if (imageQueue.length > nextImage)
     196      {
     197        var imageId = imageQueue[nextImage];
     198        var img = document.getElementById(imageId);
     199        img.src = '../../../images/plot_generating_400x300.gif';
     200        setTimeout('loadNextImage()', 100);
     201      }
     202    }
     203    function loadNextImage()
     204    {
     205      if (imageQueue.length > nextImage)
     206      {
     207        var imageId = imageQueue[nextImage];
     208        var img = document.getElementById(imageId);
     209        img.onload = imageLoaded;
     210        img.src = img.realSrc;
     211      }
    184212    }
    185213    </script>
     214    <style>
     215    .plot {
     216      border: 1px solid #666666;
     217      background-image: url('../../../images/plot_empty_400x300.png');
     218    }
     219    </style>
    186220  </base:head>
    187   <base:body>
     221  <base:body onload="loadNextImage()">
    188222    <p>
    189223    <p:path>
     
    481515        ItemQuery<BioAssay> bioAssayQuery = bioAssaySet.getBioAssays();
    482516        bioAssayQuery.order(Orders.asc(Hql.property("name")));
     517        StringBuilder script = new StringBuilder();
    483518        for (BioAssay bioAssay : bioAssayQuery.list(dc))
    484519        {
     
    488523          url += "&filter="+filter;
    489524          url += "&title="+HTML.urlEncode(bioAssay.getName());
     525          script.append("addImage('MA").append(bioAssay.getId()).append("','").
     526              append(url).append("');\n");
    490527          %>
    491528          <img id="MA<%=bioAssay.getId()%>"
    492             src="../../../images/plot_generating_400x300.gif"
    493             width="400" height="300" 
     529            src="../../../images/transparent_pixel.gif"
     530            width="400" height="300"
    494531            alt="MA-plot for bioassay <%=HTML.encodeTags(bioAssay.getName())%>"
    495             style="border: 1px solid #666666;">
    496           <script language="JavaScript">
    497           setTimeout("changeImage('MA<%=bioAssay.getId()%>', '<%=url%>')", 100);
    498           </script>
     532            class="plot"
     533            >
    499534          <%
    500535        }
     536        %>
     537        <script language="JavaScript">
     538        <%=script%>
     539        </script>
     540        <%
    501541      }
    502542      %>
     
    513553        String xLabel = HTML.urlEncode("A, log10(ch1 * ch2) / 2");
    514554        String yLabel = HTML.urlEncode("M, log2(ch1 / ch2)");
     555        StringBuilder script = new StringBuilder();
    515556        for (BioAssay bioAssay : bioAssayQuery.list(dc))
    516557        {
     
    519560          url += "&xLabel="+xLabel+"&yLabel="+yLabel;
    520561          url += "&title="+HTML.urlEncode(bioAssay.getName());
     562          script.append("addImage('CF").append(bioAssay.getId()).append("','").
     563          append(url).append("');\n");
    521564          %>
    522565          <img id="CF<%=bioAssay.getId()%>"
    523             src="../../../images/plot_generating_400x300.gif"
    524             width="400" height="300" 
     566            src="../../../images/transparent_pixel.gif"
     567            width="400" height="300"
    525568            alt="Correction factor plot for bioassay <%=HTML.encodeTags(bioAssay.getName())%>"
    526             style="border: 1px solid #666666;">
    527           <script language="JavaScript">
    528           setTimeout("changeImage('CF<%=bioAssay.getId()%>', '<%=url%>')", 100);
    529           </script>
     569            class="plot"
     570            >
    530571          <%
    531572        }
     573        %>
     574        <script language="JavaScript">
     575        <%=script%>
     576        </script>
     577        <%
    532578      }
    533579      %>
Note: See TracChangeset for help on using the changeset viewer.