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

Last change on this file since 5905 was 5905, checked in by Nicklas Nordborg, 10 years ago

References #1655: GUI improvements

  • Use relative font sizes (em and %) instead of pixel values. This should make it possible to use relative values for everything and we don't have to split up into size_*.css


  • Removed "valign" attribute from lots of tables.


  • Removed "wrap" attribute from lots of texarea fields.


  • 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 5905 2011-12-12 08:42:09Z 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  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  FeatureData feature = design.getFeatureById(itemId, true);
84 
85  ArrayDesignBlock block = Feature.getArrayDesignBlock(dc, feature);
86 
87  String title = "Feature of "+HTML.encodeTags(design.getName()) + " at position " + feature.getPosition();
88  %>
89
90  <base:page title="<%=title%>" type="popup">
91  <base:head styles="toolbar.css">
92    <script language="JavaScript">
93    function runPlugin(cmd)
94    {
95      Main.openPopup('index.jsp?ID=<%=ID%>&cmd='+cmd+'&item_id=<%=itemId%>', 'RunPlugin'+cmd, 540, 460);
96    }
97    </script>
98  </base:head>
99  <base:body>
100    <p>
101    <h3 class="docked"><%=title%> <base:help helpid="feature.view.properties" /></h3>
102    <div class="boxed" style="height: <%=(int)(scale*440)%>px; overflow: auto;">
103      <h4>Array design</h4>
104      <table class="form" cellspacing=0>
105      <tr>
106        <td class="prompt">Name</td>
107        <td><%=HTML.encodeTags(design.getName())%></td>
108      </tr>
109      <tr>
110        <td class="prompt">Platform / Variant</td>
111        <td><base:propertyvalue item="<%=design%>" property="platform" /> / <base:propertyvalue item="<%=design%>" property="variant" /></td>
112      </tr>
113      <tr>
114        <td class="prompt">Feature identification method</td>
115        <td><%=design.getFeatureIdentificationMethod()%></td>
116      </tr>
117      </table>
118     
119      <h4>Feature / block</h4>
120      <table class="form" cellspacing=0>
121      <tr>
122        <td class="prompt">Feature ID</td>
123        <td colspan="7"><%=HTML.encodeTags(feature.getExternalId())%></td>
124      </tr>
125      <tr>
126        <td class="prompt">Position</td>
127        <td><%=feature.getPosition()%></td>
128        <td>&nbsp;&nbsp;</td>
129        <td class="prompt">Meta grid X</td>
130        <td><%=block.getMetaGridX()%></td>
131        <td>&nbsp;&nbsp;</td>
132        <td class="prompt">Meta grid Y</td>
133        <td><%=block.getMetaGridY()%></td>
134      </tr>
135      <tr>
136        <td class="prompt">Row</td>
137        <td><%=feature.getRow()%></td>
138        <td>&nbsp;&nbsp;</td>
139        <td class="prompt">Block size X</td>
140        <td><%=block.getBlockSizeX()%></td>
141        <td>&nbsp;&nbsp;</td>
142        <td class="prompt">Block size Y</td>
143        <td><%=block.getBlockSizeY()%></td>
144      </tr>
145      <tr>
146        <td class="prompt">Column</td>
147        <td><%=feature.getColumn()%></td>
148        <td>&nbsp;&nbsp;</td>
149        <td class="prompt">Origin X</td>
150        <td><%=block.getOriginX()%></td>
151        <td>&nbsp;&nbsp;</td>
152        <td class="prompt">Origin Y</td>
153        <td><%=block.getOriginY()%></td>
154      </tr>
155      <tr>
156        <td class="prompt">Block number</td>
157        <td><%=block.getBlockNumber()%></td>
158        <td>&nbsp;&nbsp;</td>
159        <td class="prompt">Spacing X</td>
160        <td><%=block.getSpacingX()%></td>
161        <td>&nbsp;&nbsp;</td>
162        <td class="prompt">Spacing Y</td>
163        <td><%=block.getSpacingY()%></td>
164      </tr>
165      <tr>
166        <td class="prompt">Diameter</td>
167        <td><%=block.getFeatureDiameter()%></td>
168      </tr>
169      </table>
170     
171      <h4>Plate / well</h4>
172      <%
173      Well well = null;
174      boolean readWell = true;
175      try
176      {
177        well = Feature.getWell(dc, feature);
178      }
179      catch (PermissionDeniedException ex)
180      {
181        readWell = false;
182      }
183      if (!readWell)
184      {
185        %>
186        <i>- denied -</i>
187        <%
188      }
189      else if (well == null)
190      {
191        %>
192        <i>- none -</i>
193        <%
194      }
195      else
196      {
197        Plate plate = well.getPlate();
198        %>
199        <table  class="form" cellspacing=0>
200        <tr>
201          <td class="prompt">Plate</td>
202          <td><%=HTML.encodeTags(plate.getName())%></td>
203        </tr>
204        <tr>
205          <td class="prompt">Row</td>
206          <td><%=rowFormatter.format(well.getRow())%></td>
207        </tr>
208        <tr>
209          <td class="prompt">Column</td>
210          <td><%=columnFormatter.format(well.getColumn())%></td>
211        </tr>
212        </table>
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 >
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 >
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>" : "" %>
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.