Changeset 2130


Ignore:
Timestamp:
Nov 11, 2013, 11:36:33 AM (8 years ago)
Author:
Nicklas Nordborg
Message:

References #489: Histology scoring wizard

Adding links from HE and PB bioplates (list view and single item view) to the scoring wizard.

Location:
extensions/net.sf.basedb.reggie/branches/ticket-489
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • extensions/net.sf.basedb.reggie/branches/ticket-489/META-INF/extensions.xml

    r2113 r2130  
    151151      <ref index="1">net.sf.basedb.clients.web.listcolumn.sample</ref>
    152152      <ref index="1">net.sf.basedb.clients.web.listcolumn.extract</ref>
     153      <ref index="1">net.sf.basedb.clients.web.listcolumn.bioplate</ref>
    153154    </extends>
    154155    <index>2</index>
     
    156157      <name>Reggie column</name>
    157158      <description>
    158         Add a column to the list page of samples and extract for
    159         including some reggie-specific links.
     159        Add a column to the list page of samples, extract and bioplates
     160        for including some reggie-specific links.
    160161      </description>
    161162    </about>
     
    194195  </extension>
    195196 
     197  <extension
     198    id="net.sf.basedb.reggie.toolbar.histology-score"
     199    extends="net.sf.basedb.clients.web.toolbar.item.bioplate"
     200    >
     201    <about>
     202      <name>Histology score</name>
     203      <description>
     204        Adds a button to the toolbar of paraffin blocks and
     205        HE stain bioplates that start the 'histology scoring wizard'.
     206      </description>
     207    </about>
     208    <action-factory>
     209      <factory-class>
     210        net.sf.basedb.reggie.extensions.HistologyScoreButtonFactory
     211      </factory-class>
     212    </action-factory>
     213  </extension>
    196214 
    197215</extensions>
  • extensions/net.sf.basedb.reggie/branches/ticket-489/src/net/sf/basedb/reggie/extensions/ReggieListColumnsFactory.java

    r1915 r2130  
    66import net.sf.basedb.clients.web.extensions.list.ListColumnAction;
    77import net.sf.basedb.core.BioMaterial;
     8import net.sf.basedb.core.BioPlate;
    89import net.sf.basedb.core.DbControl;
     10import net.sf.basedb.core.Item;
    911import net.sf.basedb.reggie.Reggie;
    1012import net.sf.basedb.util.extensions.InvokationContext;
    1113
    1214/**
    13   Factory that add a "Reggie" column to the sample and extract list pages.
    14   In this column, we can add reggie-specific information, such as a link
    15   to the "Case summary" function for all items that
     15  Factory that add a "Reggie" column to the sample, extract and bioplate
     16  list pages. In this column, we can add reggie-specific information, such as a
     17  link to the "Case summary" function for all items that
    1618  can be matched to a case name, eg. it starts with 7 digits, optionally
    1719  followed by a dot.
     20 
     21  In 2.14: Added link to Histology scoring wizard for PB and HE plates.
    1822 
    1923  @author Nicklas
     
    3438    String ID = jspContext.getSessionControl().getId();
    3539    String reggieHome = jspContext.getHome(context.getExtension());
    36     ColumnAction action = new ColumnAction(ID, reggieHome);
     40    Item guiItem = jspContext.getGuiContext().getItem();
     41    ListColumnAction action = null;
     42    if (guiItem == Item.BIOPLATE)
     43    {
     44      action = new BioPlateColumnAction(ID, reggieHome);
     45    }
     46    else if (guiItem == Item.SAMPLE || guiItem == Item.EXTRACT)
     47    {
     48      action = new BioMaterialColumnAction(ID, reggieHome);
     49    }
    3750    return new ListColumnAction[] { action };
    3851  }
    3952
    40   static class ColumnAction
     53  static class BioMaterialColumnAction
    4154    extends AbstractListColumnBean<BioMaterial, String>
    4255  {
     
    4457    private final String reggieHome;
    4558   
    46     ColumnAction(String ID, String reggieHome)
     59    BioMaterialColumnAction(String ID, String reggieHome)
    4760    {
    4861      this.ID = ID;
     
    7083    }
    7184  }
     85 
     86  static class BioPlateColumnAction
     87    extends AbstractListColumnBean<BioPlate, String>
     88  {
     89    private final String ID;
     90    private final String reggieHome;
     91   
     92    BioPlateColumnAction(String ID, String reggieHome)
     93    {
     94      this.ID = ID;
     95      this.reggieHome = reggieHome;
     96      setId("reggie");
     97      setTitle("Reggie");
     98    }
     99 
     100    @Override
     101    public String getValue(DbControl dc, BioPlate plate)
     102    {
     103      String value = null;
     104      String name = plate.getName();
     105      if (name != null && HistologyScoreButtonFactory.HE_PLATE_PATTERN.matcher(name).matches())
     106      {
     107        String heName = "HE" + name.substring(2, 7);
     108        StringBuilder sb = new StringBuilder();
     109        sb.append("<a href=\"" + reggieHome + "/sampleproc/histology_score.jsp?ID="+ID+"&name="+heName+"\"");
     110        sb.append(" title=\"Goto HE glass scoring wizard\"");
     111        sb.append("><img src=\""+reggieHome+"/images/microscope.png\">");
     112        sb.append("</a>");
     113        value = sb.toString();
     114      }
     115      return value;
     116    }
     117  }
     118
    72119}
Note: See TracChangeset for help on using the changeset viewer.