1 | <%-- $Id: view_feature.jsp 5917 2011-12-19 11:28:45Z 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 | <% |
---|
67 | final SessionControl sc = Base.getExistingSessionControl(pageContext, true); |
---|
68 | final String ID = sc.getId(); |
---|
69 | final ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, null, null); |
---|
70 | final int itemId = cc.getId(); |
---|
71 | final int arrayDesignId = Values.getInt(request.getParameter("arraydesign_id")); |
---|
72 | final float scale = Base.getScale(sc); |
---|
73 | final DbControl dc = sc.newDbControl(); |
---|
74 | try |
---|
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 | ReporterData reporter = feature.getReporter(); |
---|
85 | |
---|
86 | ArrayDesignBlock block = Feature.getArrayDesignBlock(dc, feature); |
---|
87 | |
---|
88 | Well well = null; |
---|
89 | boolean readWell = true; |
---|
90 | try |
---|
91 | { |
---|
92 | well = Feature.getWell(dc, feature); |
---|
93 | } |
---|
94 | catch (PermissionDeniedException ex) |
---|
95 | { |
---|
96 | readWell = false; |
---|
97 | } |
---|
98 | |
---|
99 | |
---|
100 | |
---|
101 | String title = "Feature of "+HTML.encodeTags(design.getName()) + " at position " + feature.getPosition(); |
---|
102 | %> |
---|
103 | |
---|
104 | <base:page title="<%=title%>" type="popup"> |
---|
105 | <base:head scripts="tabcontrol.js" styles="tabcontrol.css"> |
---|
106 | <script language="JavaScript"> |
---|
107 | function runPlugin(cmd) |
---|
108 | { |
---|
109 | Main.openPopup('index.jsp?ID=<%=ID%>&cmd='+cmd+'&item_id=<%=itemId%>', 'RunPlugin'+cmd, 540, 460); |
---|
110 | } |
---|
111 | </script> |
---|
112 | </base:head> |
---|
113 | <base:body> |
---|
114 | <h1><%=title%> <base:help helpid="feature.view.properties" /></h1> |
---|
115 | |
---|
116 | <t:tabcontrol id="feature" |
---|
117 | subclass="content dialogtabcontrol" |
---|
118 | position="bottom"> |
---|
119 | <t:tab id="feat" title="Feature"> |
---|
120 | |
---|
121 | <table class="fullform outlined"> |
---|
122 | <tbody class="section"> |
---|
123 | <tr> |
---|
124 | <th colspan="6">Array design</th> |
---|
125 | </tr> |
---|
126 | </tbody> |
---|
127 | <tbody> |
---|
128 | <tr> |
---|
129 | <th>Name</th> |
---|
130 | <td colspan="5"><%=HTML.encodeTags(design.getName())%></td> |
---|
131 | </tr> |
---|
132 | <tr> |
---|
133 | <th>Platform / Variant</th> |
---|
134 | <td colspan="5"><base:propertyvalue item="<%=design%>" property="platform" /> / <base:propertyvalue item="<%=design%>" property="variant" /></td> |
---|
135 | </tr> |
---|
136 | <tr> |
---|
137 | <th>Feature identification method</th> |
---|
138 | <td colspan="5"><%=design.getFeatureIdentificationMethod()%></td> |
---|
139 | </tr> |
---|
140 | </tbody> |
---|
141 | |
---|
142 | <tbody class="section"> |
---|
143 | <tr> |
---|
144 | <th colspan="6">Feature / block</th> |
---|
145 | </tr> |
---|
146 | </tbody> |
---|
147 | |
---|
148 | <tbody> |
---|
149 | <tr> |
---|
150 | <th>Feature ID</td> |
---|
151 | <td><%=HTML.encodeTags(feature.getExternalId())%></td> |
---|
152 | <th class="leftborder">Reporter</th> |
---|
153 | <td><%=reporter == null ? "<i>- none -</i>" : HTML.encodeTags(reporter.getName())%></td> |
---|
154 | <th class="leftborder">Diameter</th> |
---|
155 | <td><%=block.getFeatureDiameter()%></td> |
---|
156 | </tr> |
---|
157 | <tr> |
---|
158 | <th>Position</th> |
---|
159 | <td><%=feature.getPosition()%></td> |
---|
160 | <th class="leftborder">Meta grid X</th> |
---|
161 | <td><%=block.getMetaGridX()%></td> |
---|
162 | <th class="leftborder">Meta grid Y</th> |
---|
163 | <td><%=block.getMetaGridY()%></td> |
---|
164 | </tr> |
---|
165 | <tr> |
---|
166 | <th>Block number</th> |
---|
167 | <td><%=block.getBlockNumber()%></td> |
---|
168 | <th class="leftborder">Block size X</th> |
---|
169 | <td><%=block.getBlockSizeX()%></td> |
---|
170 | <th class="leftborder">Block size Y</th> |
---|
171 | <td><%=block.getBlockSizeY()%></td> |
---|
172 | </tr> |
---|
173 | <tr> |
---|
174 | <th>Row</th> |
---|
175 | <td><%=feature.getRow()%></td> |
---|
176 | <th class="leftborder">Origin X</th> |
---|
177 | <td><%=block.getOriginX()%></td> |
---|
178 | <th class="leftborder">Origin Y</th> |
---|
179 | <td><%=block.getOriginY()%></td> |
---|
180 | </tr> |
---|
181 | <tr> |
---|
182 | <th>Column</th> |
---|
183 | <td><%=feature.getColumn()%></td> |
---|
184 | <th class="leftborder">Spacing X</th> |
---|
185 | <td><%=block.getSpacingX()%></td> |
---|
186 | <th class="leftborder">Spacing Y</th> |
---|
187 | <td><%=block.getSpacingY()%></td> |
---|
188 | </tr> |
---|
189 | </tbody> |
---|
190 | |
---|
191 | <tbody class="section"> |
---|
192 | <tr> |
---|
193 | <th colspan="6">Plage / well</th> |
---|
194 | </tr> |
---|
195 | </tbody> |
---|
196 | |
---|
197 | <tbody> |
---|
198 | <% |
---|
199 | if (!readWell) |
---|
200 | { |
---|
201 | %> |
---|
202 | <tr> |
---|
203 | <th>Plate</th> |
---|
204 | <td colspan="5"><i>- denied -</i></td> |
---|
205 | </tr> |
---|
206 | <% |
---|
207 | } |
---|
208 | else if (well == null) |
---|
209 | { |
---|
210 | %> |
---|
211 | <tr> |
---|
212 | <th>Plate</th> |
---|
213 | <td colspan="5"><i>- none -</i></td> |
---|
214 | </tr> |
---|
215 | <% |
---|
216 | } |
---|
217 | else |
---|
218 | { |
---|
219 | Plate plate = well.getPlate(); |
---|
220 | %> |
---|
221 | <tr> |
---|
222 | <th>Plate</th> |
---|
223 | <td colspan="5"><%=HTML.encodeTags(plate.getName())%></td> |
---|
224 | </tr> |
---|
225 | <tr> |
---|
226 | <th>Well</th> |
---|
227 | <td colspan="5"><%=rowFormatter.format(well.getRow())%><%=columnFormatter.format(well.getColumn())%></td> |
---|
228 | </tr> |
---|
229 | <% |
---|
230 | } |
---|
231 | %> |
---|
232 | <tr class="dynamic"> |
---|
233 | <th></th> |
---|
234 | <td colspan="5"></td> |
---|
235 | </tr> |
---|
236 | </tbody> |
---|
237 | </table> |
---|
238 | |
---|
239 | </t:tab> |
---|
240 | |
---|
241 | <% |
---|
242 | if (reporter != null) |
---|
243 | { |
---|
244 | boolean readCurrentReporterType = true; |
---|
245 | ReporterType currentReporterType = null; |
---|
246 | try |
---|
247 | { |
---|
248 | currentReporterType = Reporter.getReporterType(dc, reporter); |
---|
249 | } |
---|
250 | catch (PermissionDeniedException ex) |
---|
251 | { |
---|
252 | readCurrentReporterType = false; |
---|
253 | } |
---|
254 | %> |
---|
255 | <t:tab id="reporter" title="Reporter" > |
---|
256 | <table class="fullform outlined"> |
---|
257 | <tbody class="section"> |
---|
258 | <tr> |
---|
259 | <th colspan="4">Common reporter properties</th> |
---|
260 | </tr> |
---|
261 | </tbody> |
---|
262 | <tbody> |
---|
263 | |
---|
264 | <tr> |
---|
265 | <th>Name</th> |
---|
266 | <td><%=HTML.encodeTags(reporter.getName())%></td> |
---|
267 | <th class="leftborder">External ID</th> |
---|
268 | <td><%=HTML.encodeTags(reporter.getExternalId())%></td> |
---|
269 | </tr> |
---|
270 | <tr> |
---|
271 | <th>Gene symbol</td> |
---|
272 | <td><%=HTML.encodeTags(reporter.getSymbol())%></td> |
---|
273 | <th class="leftborder">Type</th> |
---|
274 | <td><%=Base.getEncodedName(currentReporterType, !readCurrentReporterType)%></td> |
---|
275 | </tr> |
---|
276 | <tr> |
---|
277 | <th>Last update</th> |
---|
278 | <td><%=dateFormatter.format(reporter.getLastUpdate())%></td> |
---|
279 | <th class="leftborder">from/by</th> |
---|
280 | <td><%=reporter.getLastSource() %></td> |
---|
281 | </tr> |
---|
282 | <tr> |
---|
283 | <th>Description</th> |
---|
284 | <td colspan="3"><%=HTML.niceFormat(reporter.getDescription())%></td> |
---|
285 | </tr> |
---|
286 | </tbody> |
---|
287 | |
---|
288 | <tbody class="section"> |
---|
289 | <tr> |
---|
290 | <th colspan="4">Extended reporter properties</th> |
---|
291 | </tr> |
---|
292 | </tbody> |
---|
293 | <tbody> |
---|
294 | <% |
---|
295 | List<ExtendedProperty> reporterProperties = ExtendedProperties.getProperties("ReporterData"); |
---|
296 | if (reporterProperties != null) |
---|
297 | { |
---|
298 | boolean needsTr = true; |
---|
299 | for (ExtendedProperty ep : reporterProperties) |
---|
300 | { |
---|
301 | String name = ep.getName(); |
---|
302 | Formatter f = FormatterFactory.getExtendedPropertyFormatter(sc, ep); |
---|
303 | String value = f.format(reporter.getExtended(name)); |
---|
304 | %> |
---|
305 | <%=needsTr ? "<tr><th>" : "<th class=\"leftborder\">" %> |
---|
306 | <%=HTML.encodeTags(ep.getTitle())%></td> |
---|
307 | <td><%=value%></td> |
---|
308 | <%=needsTr ? "" : "</tr>"%> |
---|
309 | <% |
---|
310 | needsTr = !needsTr; |
---|
311 | } |
---|
312 | %> |
---|
313 | <%=needsTr ? "" : "<th class=\"leftborder\"></th><td></td></tr>"%> |
---|
314 | <% |
---|
315 | } |
---|
316 | %> |
---|
317 | <tr class="dynamic"> |
---|
318 | <th></th> |
---|
319 | <td></td> |
---|
320 | <th class="leftborder"></th> |
---|
321 | <td></td> |
---|
322 | </tr> |
---|
323 | </tbody> |
---|
324 | </table> |
---|
325 | </t:tab> |
---|
326 | <% |
---|
327 | } |
---|
328 | %> |
---|
329 | </t:tabcontrol> |
---|
330 | |
---|
331 | <base:buttongroup subclass="dialogbuttons"> |
---|
332 | <base:button onclick="window.close()" title="Close" /> |
---|
333 | </base:buttongroup> |
---|
334 | |
---|
335 | </base:body> |
---|
336 | </base:page> |
---|
337 | <% |
---|
338 | } |
---|
339 | finally |
---|
340 | { |
---|
341 | if (dc != null) dc.close(); |
---|
342 | } |
---|
343 | |
---|
344 | %> |
---|