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

Last change on this file since 7014 was 7014, checked in by Nicklas Nordborg, 7 years ago

Merged patch release 3.6.2 to the trunk

  • Property svn:eol-style set to native
  • Property svn:keywords set to Date Id
File size: 9.8 KB
Line 
1<%-- $Id: view_feature.jsp 7014 2015-11-12 08:43:25Z nicklas $
2  ------------------------------------------------------------------
3  Copyright (C) 2006 Johan Enell, Jari Häkkinen, 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 pageEncoding="UTF-8" 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  final boolean readReporter = !sc.hasPermission(Permission.DENIED, Item.REPORTER);
77  Formatter<Date> dateTimeFormatter = FormatterFactory.getDateTimeFormatter(sc);
78  Formatter<Date> dateFormatter = FormatterFactory.getDateFormatter(sc);
79  WellCoordinateFormatter rowFormatter = new WellCoordinateFormatter(true);
80  WellCoordinateFormatter columnFormatter = new WellCoordinateFormatter(false);
81  Map<Plugin.MainType, Integer> pluginCount = PluginDefinition.countPlugins(dc, guiContext);
82
83  final ArrayDesign design = ArrayDesign.getById(dc, arrayDesignId);
84  FeatureData feature = design.getFeatureById(itemId, true);
85  ReporterData reporter = readReporter ? feature.getReporter() : null;
86
87  ArrayDesignBlock block = Feature.getArrayDesignBlock(dc, feature);
88 
89  Well well = null;
90  boolean readWell = true;
91  try
92  {
93    well = Feature.getWell(dc, feature);
94  }
95  catch (PermissionDeniedException ex)
96  {
97    readWell = false;
98  }
99
100  String title = "Feature of "+HTML.encodeTags(design.getName()) + " at position " + feature.getPosition();
101  %>
102  <base:page title="<%=title%>" type="popup" id="view-page">
103  <base:head scripts="tabcontrol-2.js,~features.js" styles="tabcontrol.css">
104  </base:head>
105  <base:body data-read-only="1">
106    <h1><%=title%> <base:help helpid="feature.view.properties" /></h1>
107
108    <t:tabcontrol id="feature" 
109      subclass="content dialogtabcontrol"
110      position="bottom">
111    <t:tab id="feat" title="Feature">
112   
113      <table class="fullform outlined">
114      <tbody class="sectionheader">
115        <tr>
116          <th colspan="6">Array design</th>
117        </tr>
118      </tbody>
119      <tbody>
120      <tr>
121        <th>Name</th>
122        <td colspan="5"><%=HTML.encodeTags(design.getName())%></td>
123      </tr>
124      <tr>
125        <th>Platform / Variant</th>
126        <td colspan="5"><base:propertyvalue item="<%=design%>" property="platform" enablePropertyLink="false"/> / <base:propertyvalue item="<%=design%>" property="variant" enablePropertyLink="false"/></td>
127      </tr>
128      <tr>
129        <th>Feature identification method</th>
130        <td colspan="5"><%=design.getFeatureIdentificationMethod()%></td>
131      </tr>
132      </tbody>
133     
134      <tbody class="sectionheader">
135        <tr>
136          <th colspan="6">Feature / block</th>
137        </tr>
138      </tbody>
139     
140      <tbody>
141      <tr>
142        <th>Feature ID</th>
143        <td><%=HTML.encodeTags(feature.getExternalId())%></td>
144        <th class="leftborder">Reporter</th>
145        <td><%=reporter == null ? "<i>- none -</i>" : HTML.encodeTags(reporter.getName())%></td>
146        <th class="leftborder">Diameter</th>
147        <td><%=block.getFeatureDiameter()%></td>
148      </tr>
149      <tr>
150        <th>Position</th>
151        <td><%=feature.getPosition()%></td>
152        <th class="leftborder">Meta grid X</th>
153        <td><%=block.getMetaGridX()%></td>
154        <th class="leftborder">Meta grid Y</th>
155        <td><%=block.getMetaGridY()%></td>
156      </tr>
157      <tr>
158        <th>Block number</th>
159        <td><%=block.getBlockNumber()%></td>
160        <th class="leftborder">Block size X</th>
161        <td><%=block.getBlockSizeX()%></td>
162        <th class="leftborder">Block size Y</th>
163        <td><%=block.getBlockSizeY()%></td>
164      </tr>
165      <tr>
166        <th>Row</th>
167        <td><%=feature.getRow()%></td>
168        <th class="leftborder">Origin X</th>
169        <td><%=block.getOriginX()%></td>
170        <th class="leftborder">Origin Y</th>
171        <td><%=block.getOriginY()%></td>
172      </tr>
173      <tr>
174        <th>Column</th>
175        <td><%=feature.getColumn()%></td>
176        <th class="leftborder">Spacing X</th>
177        <td><%=block.getSpacingX()%></td>
178        <th class="leftborder">Spacing Y</th>
179        <td><%=block.getSpacingY()%></td>
180      </tr>
181      </tbody>
182     
183      <tbody class="sectionheader">
184        <tr>
185          <th colspan="6">Plage / well</th>
186        </tr>
187      </tbody>
188     
189      <tbody>
190        <%
191        if (!readWell)
192        {
193          %>
194          <tr>
195            <th>Plate</th>
196            <td colspan="5"><i>- denied -</i></td>
197          </tr>
198          <%
199        }
200        else if (well == null)
201        {
202          %>
203          <tr>
204            <th>Plate</th>
205            <td colspan="5"><i>- none -</i></td>
206          </tr>
207          <%
208        }
209        else
210        {
211          Plate plate = well.getPlate();
212          %>
213          <tr>
214            <th>Plate</th>
215            <td colspan="5"><%=HTML.encodeTags(plate.getName())%></td>
216          </tr>
217          <tr>
218            <th>Well</th>
219            <td colspan="5"><%=rowFormatter.format(well.getRow())%><%=columnFormatter.format(well.getColumn())%></td>
220          </tr>
221          <%
222        }
223        %>
224        <tr class="dynamic">
225          <th></th>
226          <td colspan="5"></td>
227        </tr>
228      </tbody>
229      </table>
230    </t:tab>
231    <t:tab id="reporter" title="Reporter" >
232      <%
233      if (reporter == null)
234      {
235        %>
236        <table class="fullcc bg-filled-50"><tr><td>
237        <b><%=readReporter ? "No reporter" : "Denied" %></b>
238        </td></tr></table>
239        <%
240      }
241      else
242      {
243        boolean readCurrentReporterType = true;
244        ReporterType currentReporterType = null;
245        try
246        {
247          currentReporterType = Reporter.getReporterType(dc, reporter);
248        }
249        catch (PermissionDeniedException ex)
250        {
251          readCurrentReporterType = false;
252        }
253        %>
254        <table class="fullform outlined">
255        <tbody class="sectionheader">
256          <tr>
257            <th colspan="4">Common reporter properties</th>
258          </tr>
259        </tbody>
260        <tbody>
261       
262        <tr>
263          <th>Name</th>
264          <td><%=HTML.encodeTags(reporter.getName())%></td>
265          <th class="leftborder">External ID</th>
266          <td><%=HTML.encodeTags(reporter.getExternalId())%></td>
267        </tr>
268        <tr>
269          <th>Gene symbol</th>
270          <td><%=HTML.encodeTags(reporter.getSymbol())%></td>
271          <th class="leftborder">Type</th>
272          <td><%=Base.getEncodedName(currentReporterType, !readCurrentReporterType)%></td>
273        </tr>
274        <tr>
275          <th>Last update</th>
276          <td><%=dateFormatter.format(reporter.getLastUpdate())%></td>
277          <th class="leftborder">from/by</th>
278          <td><%=reporter.getLastSource() %></td>
279        </tr>
280        <tr>
281          <th>Description</th>
282          <td colspan="3"><%=HTML.niceFormat(reporter.getDescription())%></td>
283        </tr>
284        </tbody>
285       
286        <tbody class="sectionheader">
287          <tr>
288            <th colspan="4">Extended reporter properties</th>
289          </tr>
290        </tbody>
291        <tbody>
292          <%
293            List<ExtendedProperty> reporterProperties = ExtendedProperties.getProperties("ReporterData");
294            if (reporterProperties != null)
295            {
296              boolean needsTr = true;
297              for (ExtendedProperty ep : reporterProperties)
298              {
299                String name = ep.getName();
300                Formatter f = FormatterFactory.getExtendedPropertyFormatter(sc, ep);
301                String value = f.format(reporter.getExtended(name));
302                %>
303                  <%=needsTr ? "<tr><th>" : "<th class=\"leftborder\">" %><%=HTML.encodeTags(ep.getTitle())%></th>
304                  <td><%=value%></td>
305                  <%=needsTr ? "" : "</tr>"%>
306                <%
307                needsTr = !needsTr;
308              }
309              %>
310              <%=needsTr ? "" : "<th class=\"leftborder\"></th><td></td></tr>"%>
311              <%
312            }
313            %>
314          <tr class="dynamic">
315            <th></th>
316            <td></td>
317            <th class="leftborder"></th>
318            <td></td>
319          </tr>
320        </tbody>
321        </table>
322        <%
323      }
324      %>
325    </t:tab>
326    </t:tabcontrol>
327
328    <base:buttongroup subclass="dialogbuttons">
329      <base:button id="close" title="Close" />
330    </base:buttongroup>
331   
332  </base:body>
333  </base:page>
334  <%
335}
336finally
337{
338  if (dc != null) dc.close();
339}
340
341%>
Note: See TracBrowser for help on using the repository browser.