Changeset 4856


Ignore:
Timestamp:
Mar 27, 2009, 11:14:41 AM (13 years ago)
Author:
Nicklas Nordborg
Message:

References #1266, #1272: Bioplate coordinates are numbers but it would be better to have character-number pairs

A test of #1272. Fixes the export of wells from the Biomaterial LIMS -> Bioplates -> Biowell tab.

Location:
trunk
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/core/net/sf/basedb/util/Coordinate.java

    r4515 r4856  
    8787  public static String numericToAlpha(int i)
    8888  {
    89     String result = "";
     89    StringBuilder result = new StringBuilder();
    9090    while(i > 0)
    9191    {
    9292      i--;
    93       result = (char)((i%26)+97) + result;
     93      result = result.insert(0, (char)((i%26)+97));
    9494      i = i / 26;
    9595    }
    96     return result;
     96    return result.toString().toUpperCase();
    9797  }
    9898 
  • trunk/www/biomaterials/bioplates/wells/index.jsp

    r4731 r4856  
    3737  import="net.sf.basedb.core.PermissionDeniedException"
    3838  import="net.sf.basedb.core.data.ReporterData"
     39  import="net.sf.basedb.core.query.Orders"
     40  import="net.sf.basedb.core.query.Hql"
    3941  import="net.sf.basedb.util.RemovableUtil"
    4042  import="net.sf.basedb.clients.web.Base"
     
    4244  import="net.sf.basedb.clients.web.util.HTML"
    4345  import="net.sf.basedb.util.Values"
     46  import="net.sf.basedb.util.formatter.WellCoordinateFormatter"
    4447  import="java.util.List"
    4548  import="java.util.Collections"
     
    5053  private static final ItemContext defaultContext = Base.createDefaultContext("row", "row,column,bioMaterial.name");
    5154  private static final Item itemType = Item.BIOWELL;
     55 
     56  private static void registerExportFormatters(ItemContext cc)
     57  {
     58    cc.setObject("export.formatter.row", new WellCoordinateFormatter(true));
     59    cc.setObject("export.formatter.column", new WellCoordinateFormatter(false));
     60  }
    5261%>
    5362<%
     
    148157    final ItemQuery<BioWell> query = bioplate.getBioWells();
    149158    cc.configureQuery(query, true);
     159    if (!"row".equals(cc.getSortProperty())) query.order(Orders.asc(Hql.property("row")));
     160    if (!"column".equals(cc.getSortProperty())) query.order(Orders.asc(Hql.property("column")));
    150161    cc.setQuery(query);
    151     redirect = "../../common/export/index.jsp?ID="+ID+"&cmd=SelectPlugin&item_type="+itemType.name()+"&context_type=LIST&title=Export+biowells";
     162    registerExportFormatters(cc);
     163    redirect = "../../../common/export/index.jsp?ID="+ID+"&cmd=SelectPlugin&item_type="+itemType.name()+"&context_type=LIST&title=Export+biowells";
    152164  }
    153165  else if ("ExportItem".equals(cmd))
     
    155167    // Run an export plugin in single-item context
    156168    ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
     169    registerExportFormatters(cc);
    157170    redirect = "../../common/export/index.jsp?ID="+ID+"&cmd=SelectPlugin&item_type="+itemType.name()+"&context_type=ITEM&title=Export+biowell";
    158171  }
Note: See TracChangeset for help on using the changeset viewer.