Changeset 2090


Ignore:
Timestamp:
Oct 21, 2013, 11:47:03 AM (9 years ago)
Author:
Nicklas Nordborg
Message:

References #502: Design flow cells

Display library plate names in the pool list. Up to two plates are displayed, if the pool comes from more plates, the rest are displayed as a tooltip popup.

Location:
extensions/net.sf.basedb.reggie/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • extensions/net.sf.basedb.reggie/trunk/resources/libprep/create_flowcells.jsp

    r2087 r2090  
    5656    {
    5757      var pool = pools[poolNo];
    58       poolsList[poolsList.length] = new Option(pool.name, pool.id, poolNo < 4);
     58      var name = pool.name + ' - ';
     59     
     60      var numPlates = pool.libPlates.length;
     61      var title = '';
     62
     63      if (numPlates <= 2)
     64      {
     65        for (var plateNo=0; plateNo < numPlates; plateNo++)
     66        {
     67          var libPlate = pool.libPlates[plateNo];
     68          if (plateNo > 0) name += ', ';
     69          name += libPlate.name;
     70        }
     71      }
     72      else
     73      {
     74        name += pool.libPlates[0].name + ' + ' + (numPlates-1) + ' more...';
     75        for (var plateNo=0; plateNo < numPlates; plateNo++)
     76        {
     77          var libPlate = pool.libPlates[plateNo];
     78          if (plateNo > 0) title += ', ';
     79          title += libPlate.name;
     80        }
     81      }
     82     
     83      var option = new Option(name, pool.id, poolNo < 4);
     84      option.title = title;
     85     
     86      poolsList[poolsList.length] = option;
    5987    }
    6088  }
  • extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/dao/PooledLibrary.java

    r2077 r2090  
    55import java.util.List;
    66
     7import org.json.simple.JSONArray;
    78import org.json.simple.JSONObject;
    89
     
    212213
    213214  private JSONObject jsonWell;
     215  private JSONArray jsonLibPlates;
    214216 
    215217  private PooledLibrary(Extract extract)
     
    233235    super.initJSON(json);
    234236    if (jsonWell != null) json.put("bioWell", jsonWell);
     237    if (jsonLibPlates != null) json.put("libPlates", jsonLibPlates);
    235238  }
    236239
     
    265268  }
    266269 
     270  /**
     271    Load the library bioplates that the parent libraries that
     272    are part of this pool are coming from. The result is returned
     273    as a JSON array and is also included in the "libPlates" property
     274    when calling {@link #asJSONObject()} later.
     275  */
     276  @SuppressWarnings("unchecked")
     277  public JSONArray loadLibPlates(DbControl dc)
     278  {
     279    if (jsonLibPlates != null) return jsonLibPlates;
     280   
     281    Extract pool = getItem();
     282   
     283    ItemQuery<BioPlate> libPlateQuery = BioPlate.getQuery();
     284    libPlateQuery.setDistinct(true);
     285    libPlateQuery.include(Reggie.INCLUDE_IN_CURRENT_PROJECT);
     286    BioplateType.LIBRARY.addFilter(dc, libPlateQuery, false);
     287    libPlateQuery.join(Hql.innerJoin("bioWells", "bw"));
     288    libPlateQuery.join(Hql.innerJoin("bw", "bioMaterial", "lib"));
     289   
     290    libPlateQuery.join(Hql.innerJoin("lib", "childCreationEvents", "cce"));
     291    libPlateQuery.join(Hql.innerJoin("cce", "event", "evt"));
     292    libPlateQuery.join(Hql.innerJoin("evt", "bioMaterial", "pool"));
     293   
     294    libPlateQuery.restrict(Restrictions.eq(Hql.alias("pool"), Hql.entity(pool)));
     295   
     296    libPlateQuery.order(Orders.asc(Hql.property("name")));
     297    List<BioPlate> result = libPlateQuery.list(dc);
     298   
     299    jsonLibPlates = new JSONArray();
     300    for (BioPlate libPlate : result)
     301    {
     302      JSONObject jsonLibPlate = new JSONObject();
     303      jsonLibPlate.put("id", libPlate.getId());
     304      jsonLibPlate.put("name", libPlate.getName());
     305      jsonLibPlates.add(jsonLibPlate);
     306    }
     307    return jsonLibPlates;
     308  }
     309 
    267310}
  • extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/servlet/FlowCellServlet.java

    r2089 r2090  
    120120        for (PooledLibrary pool : pools)
    121121        {
     122          pool.loadLibPlates(dc);
    122123          pool.loadAnnotations(dc, "molarity", Annotationtype.POOL_MOLARITY, null);
    123124          pool.loadAnnotations(dc, "conc", Annotationtype.POOL_CONC, null);
Note: See TracChangeset for help on using the changeset viewer.