source: trunk/www/lims/arraydesigns/features/view_feature.jsp @ 4860

Last change on this file since 4860 was 4860, checked in by Martin Svensson, 13 years ago

References #1282 Use WellCoordinateFormatter? to view row as a character and column as a number. The filters are not updated yet.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Date Id
File size: 9.3 KB
Line 
1<%-- $Id: view_feature.jsp 4860 2009-03-27 14:45:27Z martin $
2  ------------------------------------------------------------------
3  Copyright (C) 2006 Johan Enell, Jari Hakkinen, Nicklas Nordborg
4  Copyright (C) 2007 Nicklas Nordborg
5
6  This file is part of BASE - BioArray Software Environment.
7  Available at http://base.thep.lu.se/
8
9  BASE is free software; you can redistribute it and/or
10  modify it under the terms of the GNU General Public License
11  as published by the Free Software Foundation; either version 3
12  of the License, or (at your option) any later version.
13
14  BASE is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  GNU General Public License for more details.
18
19  You should have received a copy of the GNU General Public License
20  along with BASE. If not, see <http://www.gnu.org/licenses/>.
21  ------------------------------------------------------------------
22
23  @author Nicklas
24  @version 2.0
25--%>
26<%@ page session="false"
27  import="net.sf.basedb.core.SessionControl"
28  import="net.sf.basedb.core.DbControl"
29  import="net.sf.basedb.core.SystemItems"
30  import="net.sf.basedb.core.Item"
31  import="net.sf.basedb.core.ItemContext"
32  import="net.sf.basedb.core.Permission"
33  import="net.sf.basedb.core.ExtendedProperties"
34  import="net.sf.basedb.core.ExtendedProperty"
35  import="net.sf.basedb.core.ArrayDesign"
36  import="net.sf.basedb.core.ArrayDesignBlock"
37  import="net.sf.basedb.core.Feature"
38  import="net.sf.basedb.core.ReporterType"
39  import="net.sf.basedb.core.Reporter"
40  import="net.sf.basedb.core.Plate"
41  import="net.sf.basedb.core.Well"
42  import="net.sf.basedb.core.PermissionDeniedException"
43  import="net.sf.basedb.core.PluginDefinition"
44  import="net.sf.basedb.core.data.FeatureData"
45  import="net.sf.basedb.core.data.ReporterData"
46  import="net.sf.basedb.core.plugin.GuiContext"
47  import="net.sf.basedb.core.plugin.Plugin"
48  import="net.sf.basedb.clients.web.Base"
49  import="net.sf.basedb.clients.web.util.HTML"
50  import="net.sf.basedb.util.Values"
51  import="net.sf.basedb.util.formatter.Formatter"
52  import="net.sf.basedb.util.formatter.WellCoordinateFormatter"
53  import="net.sf.basedb.clients.web.formatter.FormatterFactory"
54  import="java.util.Date"
55  import="java.util.Map"
56  import="java.util.Set"
57  import="java.util.List"
58%>
59<%@ taglib prefix="base" uri="/WEB-INF/base.tld" %>
60<%@ taglib prefix="t" uri="/WEB-INF/tab.tld" %>
61<%@ taglib prefix="tbl" uri="/WEB-INF/table.tld" %>
62<%!
63  private static final Item itemType = Item.FEATURE;
64  private static final GuiContext guiContext = new GuiContext(itemType, GuiContext.Type.ITEM);
65%>
66<%
67final SessionControl sc = Base.getExistingSessionControl(pageContext, true);
68final String ID = sc.getId();
69final ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, null, null);
70final int itemId = cc.getId();
71final int arrayDesignId = Values.getInt(request.getParameter("arraydesign_id"));
72final float scale = Base.getScale(sc);
73final DbControl dc = sc.newDbControl();
74try
75{
76  Formatter<Date> dateTimeFormatter = FormatterFactory.getDateTimeFormatter(sc);
77  Formatter<Date> dateFormatter = FormatterFactory.getDateFormatter(sc);
78  WellCoordinateFormatter rowFormatter = new WellCoordinateFormatter(true);
79  WellCoordinateFormatter columnFormatter = new WellCoordinateFormatter(false);
80  Map<Plugin.MainType, Integer> pluginCount = PluginDefinition.countPlugins(dc, guiContext);
81
82  final ArrayDesign design = ArrayDesign.getById(dc, arrayDesignId);
83 
84  final boolean isAffy = design.isAffyChip();
85  FeatureData feature = design.getFeatureById(itemId);
86 
87  ArrayDesignBlock block = Feature.getArrayDesignBlock(dc, feature);
88 
89  String title = "Feature of "+HTML.encodeTags(design.getName()) + " at position " + feature.getPosition();
90  %>
91
92  <base:page title="<%=title%>" type="popup">
93  <base:head styles="toolbar.css">
94    <script language="JavaScript">
95    function runPlugin(cmd)
96    {
97      Main.openPopup('index.jsp?ID=<%=ID%>&cmd='+cmd+'&item_id=<%=itemId%>', 'RunPlugin'+cmd, 540, 460);
98    }
99    </script>
100  </base:head>
101  <base:body>
102    <p>
103    <h3 class="docked"><%=title%> <base:help helpid="feature.view.properties" /></h3>
104    <div class="boxed" style="height: <%=(int)(scale*440)%>px; overflow: auto;">
105      <h4>Array design</h4>
106      <table class="form" cellspacing=0>
107      <tr>
108        <td class="prompt">Name</td>
109        <td><%=HTML.encodeTags(design.getName())%></td>
110      </tr>
111      <tr>
112        <td class="prompt">Platform / Variant</td>
113        <td><base:propertyvalue item="<%=design%>" property="platform" /> / <base:propertyvalue item="<%=design%>" property="variant" /></td>
114      </tr>
115      <tr>
116        <td class="prompt">Feature identification method</td>
117        <td><%=design.getFeatureIdentificationMethod()%></td>
118      </tr>
119      </table>
120     
121      <h4>Feature / block</h4>
122      <table class="form" cellspacing=0>
123      <tr>
124        <td class="prompt">Feature ID</td>
125        <td colspan="7"><%=HTML.encodeTags(feature.getExternalId())%></td>
126      </tr>
127      <tr>
128        <td class="prompt">Position</td>
129        <td><%=feature.getPosition()%></td>
130        <td>&nbsp;&nbsp;</td>
131        <td class="prompt">Meta grid X</td>
132        <td><%=block.getMetaGridX()%></td>
133        <td>&nbsp;&nbsp;</td>
134        <td class="prompt">Meta grid Y</td>
135        <td><%=block.getMetaGridY()%></td>
136      </tr>
137      <tr>
138        <td class="prompt">Row</td>
139        <td><%=rowFormatter.format(feature.getRow())%></td>
140        <td>&nbsp;&nbsp;</td>
141        <td class="prompt">Block size X</td>
142        <td><%=block.getBlockSizeX()%></td>
143        <td>&nbsp;&nbsp;</td>
144        <td class="prompt">Block size Y</td>
145        <td><%=block.getBlockSizeY()%></td>
146      </tr>
147      <tr>
148        <td class="prompt">Column</td>
149        <td><%=columnFormatter.format(feature.getColumn())%></td>
150        <td>&nbsp;&nbsp;</td>
151        <td class="prompt">Origin X</td>
152        <td><%=block.getOriginX()%></td>
153        <td>&nbsp;&nbsp;</td>
154        <td class="prompt">Origin Y</td>
155        <td><%=block.getOriginY()%></td>
156      </tr>
157      <tr>
158        <td class="prompt">Block number</td>
159        <td><%=block.getBlockNumber()%></td>
160        <td>&nbsp;&nbsp;</td>
161        <td class="prompt">Spacing X</td>
162        <td><%=block.getSpacingX()%></td>
163        <td>&nbsp;&nbsp;</td>
164        <td class="prompt">Spacing Y</td>
165        <td><%=block.getSpacingY()%></td>
166      </tr>
167      <tr>
168        <td class="prompt">Diameter</td>
169        <td><%=block.getFeatureDiameter()%></td>
170      </tr>
171      </table>
172     
173      <h4>Plate / well</h4>
174      <%
175      Well well = null;
176      boolean readWell = true;
177      try
178      {
179        well = Feature.getWell(dc, feature);
180      }
181      catch (PermissionDeniedException ex)
182      {
183        readWell = false;
184      }
185      if (!readWell)
186      {
187        %>
188        <i>- denied -</i>
189        <%
190      }
191      else if (well == null)
192      {
193        %>
194        <i>- none -</i>
195        <%
196      }
197      else
198      {
199        Plate plate = well.getPlate();
200        %>
201        <tr>
202          <td class="prompt">Plate</td>
203          <td><%=HTML.encodeTags(plate.getName())%></td>
204        </tr>
205        <tr>
206          <td class="prompt">Row</td>
207          <td><%=well.getRow()%></td>
208        </tr>
209        <tr>
210          <td class="prompt">Column</td>
211          <td><%=well.getColumn()%></td>
212        </tr>
213        <%
214      }
215      %>
216
217      <h4>Reporter</h4>
218      <%
219      ReporterData reporter = feature.getReporter();
220      if (reporter == null)
221      {
222        %>
223        <i>- none -</i>
224        <%
225      }
226      else
227      {
228        boolean readCurrentReporterType = true;
229        ReporterType currentReporterType = null;
230        try
231        {
232          currentReporterType = Reporter.getReporterType(dc, reporter);
233        }
234        catch (PermissionDeniedException ex)
235        {
236          readCurrentReporterType = false;
237        }
238        %>
239        <table border="0" cellspacing="0" cellpadding="0">
240        <tr valign="top">
241        <td>
242          <table class="form" cellspacing=0>
243          <tr>
244            <td class="prompt">Name</td>
245            <td><%=HTML.encodeTags(reporter.getName())%></td>
246          </tr>
247          <tr>
248            <td class="prompt">External ID</td>
249            <td><%=HTML.encodeTags(reporter.getExternalId())%></td>
250          </tr>
251          <tr>
252            <td class="prompt">Type</td>
253            <td><%=Base.getEncodedName(currentReporterType, !readCurrentReporterType)%></td>
254          </tr>
255          <tr>
256            <td class="prompt">Gene symbol</td>
257            <td><%=HTML.encodeTags(reporter.getSymbol())%></td>
258          </tr>
259          <tr valign="top">
260            <td class="prompt">Description</td>
261            <td><%=HTML.niceFormat(reporter.getDescription())%></td>
262          </tr>
263          <tr>
264            <td class="prompt">Registered</td>
265            <td><%=dateFormatter.format(reporter.getEntryDate())%></td>
266          </tr>
267          <tr>
268            <td class="prompt">Last update</td>
269            <td><%=dateTimeFormatter.format(reporter.getLastUpdate())%></td>
270          </tr>
271          </table>
272        </td>
273        <td>&nbsp;&nbsp;</td>
274        <td>
275          <table class="form" cellspacing=0>
276          <%
277          List<ExtendedProperty> reporterProperties = ExtendedProperties.getProperties("ReporterData");
278          if (reporterProperties != null)
279          {
280            boolean needsTr = true;
281            for (ExtendedProperty ep : reporterProperties)
282            {
283              String name = ep.getName();
284              Formatter f = FormatterFactory.getExtendedPropertyFormatter(sc, ep);
285              String value = f.format(reporter.getExtended(name));
286              %>
287                <%=needsTr ? "<tr valign=\"top\">" : "" %>
288                <td class="prompt"><%=HTML.encodeTags(ep.getTitle())%></td>
289                <td><%=value%></td>
290                <td>&nbsp;&nbsp;</td>
291                <%=needsTr ? "" : "</tr>"%>
292              <%
293              needsTr = !needsTr;
294            }
295            %>
296            <%=needsTr ? "" : "</tr>"%>
297            <%
298          }
299          %>
300          </table>
301        </td>
302        </tr>
303        </table>
304        <%
305      }
306      %>
307    </div>
308
309    <div align="center">
310      <table>
311      <tr>
312      <td><base:button onclick="window.close()" title="Close" /></td>
313      </tr>
314      </table>
315    </div>
316   
317  </base:body>
318  </base:page>
319  <%
320}
321finally
322{
323  if (dc != null) dc.close();
324}
325
326%>
Note: See TracBrowser for help on using the repository browser.