Changeset 2487


Ignore:
Timestamp:
Aug 4, 2006, 2:33:50 PM (16 years ago)
Author:
Nicklas Nordborg
Message:

References #127: Experiment explorer

First version. A lot of the code is still suboptimal. Need to add annotations to the view.

Location:
trunk
Files:
9 added
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/clients/web/net/sf/basedb/clients/web/Base.java

    r2476 r2487  
    338338      ServletRequest request = pageContext.getRequest();
    339339     
     340      // If the filter has changed we must return to the first page
     341      boolean filterHasChanged = false;
     342     
    340343      // Current item
    341344      cc.setId(Values.getInt(request.getParameter("item_id"), cc.getId()));
     
    369372      // Include options
    370373      Set<Include> includes = cc.getInclude();
    371       if (Values.getBoolean(request.getParameter("removed")) != includes.contains(Include.REMOVED) ||
    372           Values.getBoolean(request.getParameter("owned")) != includes.contains(Include.MINE) ||
    373           Values.getBoolean(request.getParameter("others")) != includes.contains(Include.OTHERS) ||
    374           Values.getBoolean(request.getParameter("shared")) != includes.contains(Include.SHARED) ||
    375           Values.getBoolean(request.getParameter("inproject")) != includes.contains(Include.IN_PROJECT))
    376       {
    377         cc.setPage(0);
    378       }
    379374      includes.add(Include.NOT_REMOVED);
    380       setInclude(includes, request.getParameter("removed"), Include.REMOVED);
    381       setInclude(includes, request.getParameter("owned"), Include.MINE);
    382       setInclude(includes, request.getParameter("others"), Include.OTHERS);
    383       setInclude(includes, request.getParameter("shared"), Include.SHARED);
    384       setInclude(includes, request.getParameter("inproject"), Include.IN_PROJECT);
     375      filterHasChanged = setInclude(includes, request.getParameter("removed"), Include.REMOVED);
     376      filterHasChanged |= setInclude(includes, request.getParameter("owned"), Include.MINE);
     377      filterHasChanged |= setInclude(includes, request.getParameter("others"), Include.OTHERS);
     378      filterHasChanged |= setInclude(includes, request.getParameter("shared"), Include.SHARED);
     379      filterHasChanged |= setInclude(includes, request.getParameter("inproject"), Include.IN_PROJECT);
    385380     
    386381      // Item permission
     
    388383      if (permission != null)
    389384      {
    390         if ("".equals(permission))
     385        Permission currentPermission = cc.getItemPermission();
     386        Permission newPermission = "".equals(permission) ? null : Permission.valueOf(permission);
     387        if (newPermission != currentPermission)
    391388        {
    392           cc.setItemPermission(null);
    393         }
    394         else
    395         {
    396           cc.setItemPermission(Permission.valueOf(permission));
     389          cc.setItemPermission(newPermission);
     390          filterHasChanged = true;
    397391        }
    398392      }
     
    412406      {
    413407        cc.removeAllPropertyFilters();
    414         cc.setPage(0);
     408        filterHasChanged = true;
    415409      }
    416410      else
     
    490484                  (filter.getOperator() != null && !filter.getOperator().equals(op)))
    491485              {
    492                 cc.setPage(0);
     486                filterHasChanged = true;
    493487              }             
    494488              filter.setOperator(op);
     
    522516        }
    523517      }
     518      // Return to first page if filter has changed
     519      if (filterHasChanged) cc.setPage(0);
    524520    }
    525521    return cc;
     
    581577  /**
    582578    Set include option if option parameter isn't null.
    583   */
    584   private static void setInclude(Set<Include> includes, String option, Include i)
    585   {
     579    @return TRUE if the option was changed, FALSE if not
     580  */
     581  private static boolean setInclude(Set<Include> includes, String option, Include i)
     582  {
     583    boolean changed = false;
    586584    if (option != null)
    587585    {
    588586      if (Values.getBoolean(option))
    589587      {
    590         includes.add(i);
     588        changed = includes.add(i);
    591589      }
    592590      else
    593591      {
    594         includes.remove(i);
    595       }
    596     }
     592        changed = includes.remove(i);
     593      }
     594    }
     595    return changed;
    597596  }
    598597 
  • trunk/src/clients/web/net/sf/basedb/clients/web/DynamicUtil.java

    r2392 r2487  
    136136   
    137137    String visibleColumns = cc.getSetting("columns");
     138    if (visibleColumns == null) visibleColumns = "all";
    138139    boolean allVisible = "all".equals(visibleColumns);
    139140    Set<String> visible = new HashSet<String>(Arrays.asList(visibleColumns.split(",")));
  • trunk/src/core/net/sf/basedb/core/AbstractQuery.java

    r2397 r2487  
    623623    StringBuilder ql = new StringBuilder();
    624624    setCounting(true);
    625     ql.append(isDistinct() ? "SELECT DISTINCT COUNT(*) " : "SELECT COUNT(*) ");
     625   
     626    if (isDistinct())
     627    {
     628      ql.append("SELECT COUNT(DISTINCT ");
     629      int appended = 0;
     630      // Append SELECT elements
     631      appended = appendSelects(ql, dc, temporarySelects, 0);
     632      appended += appendSelects(ql,dc, permanentSelects, appended);
     633      appended += appendSelects(ql,dc, selects, appended);
     634      ql.append(") ");
     635    }
     636    else
     637    {
     638      ql.append("SELECT COUNT(*) ");
     639    }
     640   
    626641    querySection = QuerySection.FROM;
    627642    ql.append(" FROM ").append(rootEntity).append(" ").append(getRootAlias());
  • trunk/src/core/net/sf/basedb/core/ItemContext.java

    r2343 r2487  
    825825   
    826826    // Add selection elements
    827     for (String selectProperty : selectionList)
    828     {
    829       Select select = getDynamicSelect(selectProperty, joins);
    830       if (select != null)
    831       {
    832         query.select(select);
     827    if (selectionList != null)
     828    {
     829      for (String selectProperty : selectionList)
     830      {
     831        Select select = getDynamicSelect(selectProperty, joins);
     832        if (select != null)
     833        {
     834          query.select(select);
     835        }
    833836      }
    834837    }
     
    913916    @return An expression object
    914917  */
    915   static Expression getDynamicExpression(String propertyDef, DynamicJoins joins)
     918  public static Expression getDynamicExpression(String propertyDef, DynamicJoins joins)
    916919  {
    917920    Expression e = null;
     
    964967    a select object instead.
    965968  */
    966   static Select getDynamicSelect(String propertyDef, DynamicJoins joins)
     969  public static Select getDynamicSelect(String propertyDef, DynamicJoins joins)
    967970  {
    968971    Select s = null;
     
    10151018    should be joined or not.
    10161019  */
    1017   static class DynamicJoins
    1018   {
    1019     boolean joinRawData = false;
    1020     boolean joinReporters = false;
     1020  public static class DynamicJoins
     1021  {
     1022    public boolean joinRawData = false;
     1023    public boolean joinReporters = false;
    10211024  }
    10221025 
  • trunk/src/core/net/sf/basedb/core/query/ExpressionSelect.java

    r2304 r2487  
    6565      quotedAlias = HibernateUtil.quote(alias);
    6666    }
    67     return e1.toQl(query, dc) + (alias == null ? "" : " AS "+quotedAlias);
     67    return e1.toQl(query, dc) + (alias == null || query.isCounting() ? "" : " AS "+quotedAlias);
    6868  }
    6969  // -------------------------------------------
  • trunk/www/include/styles/main.css

    r2445 r2487  
    7474  color: #555577;
    7575  font-weight: bold;
    76   margin-bottom: 4px;
     76  margin-bottom: 3px;
    7777  border-bottom: 1px solid #999999;
    7878  padding-left: 2px;
     79  padding-bottom: 1px;
    7980}
    8081
  • trunk/www/views/experiments/bioassaysets/analysis_tree.jsp

    r2433 r2487  
    289289    {
    290290      Main.openPopup('../plotter/index.jsp?ID=<%=ID%>&bioassayset_id='+itemId, 'Plotter', 1000, 700);
     291    }
     292    function openExperimentExplorer(itemId)
     293    {
     294      location.href = '../explorer/view/index.jsp?ID=<%=ID%>&bioassayset_id='+itemId;
    291295    }
    292296    function runPlugin(itemId, cmd)
     
    701705                        title="A simple plot tool"><img
    702706                        src="../../../images/plotter.gif" border="0"></a>
     707                      <a href="javascript:openExperimentExplorer(<%=itemId%>)"
     708                        title="Experiment explorer"><img
     709                        src="../../../images/explorer.png" border="0"></a>
    703710                      <%
    704711                      if (createPermission)
  • trunk/www/views/experiments/bioassaysets/view_bioassayset.jsp

    r2456 r2487  
    228228        title="Plot tool&hellip;"
    229229        tooltip="A simple tool for generating plots"
     230      />
     231      <tbl:button
     232        image="explorer.png"
     233        onclick="<%="openExperimentExplorer(" + itemId + ")"%>"
     234        title="Experiment explorer&hellip;"
     235        tooltip="View the data reporter by reporter"
    230236      />
    231237      <tbl:button
Note: See TracChangeset for help on using the changeset viewer.