Changeset 6335
- Timestamp:
- Oct 21, 2013, 3:46:22 PM (9 years ago)
- Location:
- trunk
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/core/net/sf/basedb/core/Extract.java
r6127 r6335 27 27 import net.sf.basedb.core.data.ExtractData; 28 28 29 import java.util.HashSet; 29 30 import java.util.Set; 30 31 … … 355 356 } 356 357 358 /** 359 Get all parent extracts. 360 @return A query returning all parent extracts 361 @since 3.3 362 */ 363 public ItemQuery<Extract> getParents() 364 { 365 ItemQuery<Extract> query = Extract.getQuery(); 366 query.joinPermanent(Hql.innerJoin("children", "c")); 367 query.restrictPermanent( 368 Restrictions.eq( 369 Hql.alias("c"), 370 Hql.entity(this) 371 ) 372 ); 373 return query; 374 } 375 376 377 // ------------------------------------------- 378 /* 379 From the Annotatable interface 380 ------------------------------------------- 381 */ 382 /** 383 Get the tag and parent extracts. 384 */ 385 @Override 386 public Set<Annotatable> getAnnotatableParents() 387 throws BaseException 388 { 389 Set<Annotatable> annotatable = new HashSet<Annotatable>(); 390 try 391 { 392 ItemQuery<Extract> query = getParents(); 393 query.include(Include.ALL); 394 annotatable.addAll(query.list(getDbControl())); 395 if (getData().getTag() != null) annotatable.add(getTag()); 396 } 397 catch (PermissionDeniedException ex) 398 {} 399 return annotatable; 400 } 357 401 } 358 402 -
trunk/src/core/net/sf/basedb/core/Tag.java
r6127 r6335 36 36 */ 37 37 public class Tag 38 extends CommonItem<TagData>38 extends AnnotatedItem<TagData> 39 39 implements Registered, Subtypable 40 40 { … … 127 127 { 128 128 return DateUtil.copy(getData().getEntryDate()); 129 } 130 // ------------------------------------------- 131 /* 132 From the Annotatable interface 133 ------------------------------------------- 134 */ 135 /** 136 @return Always null 137 @since 3.3 138 */ 139 @Override 140 public Set<Annotatable> getAnnotatableParents() 141 { 142 return null; 129 143 } 130 144 // ------------------------------------------- -
trunk/src/core/net/sf/basedb/core/data/TagData.java
r6127 r6335 35 35 */ 36 36 public class TagData 37 extends CommonData37 extends AnnotatedData 38 38 implements RegisteredData, SubtypableData 39 39 { -
trunk/src/core/net/sf/basedb/util/overview/loader/TagLoader.java
r5651 r6335 84 84 85 85 NodeFactory<Tag> nf = getNodeFactory(dc, context); 86 Node hardwareNode = createItemNode(nf, tag, tag, denied,87 parentNode, ChildNodeDirection. NONE);88 return hardwareNode;86 Node tagNode = createItemNode(nf, tag, tag, denied, 87 parentNode, ChildNodeDirection.PROPERTY); 88 return tagNode; 89 89 } 90 90 // ----------------------------------- 91 91 /* 92 From the AbstractNodeLoader class 93 ---------------------------------- 94 */ 95 /** 96 Loads annotations and tag parameters for the given tag node. 97 @see RawBioAssayLoader#createForwardNode(DbControl, OverviewContext, Node) 98 */ 99 @Override 100 protected void loadPropertyChildNodes(DbControl dc, OverviewContext context, Node tagNode) 101 { 102 getNodeLoader(context, Item.ANNOTATION).createPropertyNode(dc, context, tagNode); 103 } 104 // ------------------------------------- 92 105 } -
trunk/www/biomaterials/extracts/extracts.js
r6312 r6335 272 272 } 273 273 } 274 var tagId = Math.abs(parseInt(frm.tag_id.value)); 275 if (tagId > 0) parents[parents.length] = 'TAG:'+tagId; 274 276 return parents; 275 277 } -
trunk/www/biomaterials/tags/edit_tag.jsp
r6306 r6335 26 26 --%> 27 27 <%@ page pageEncoding="UTF-8" session="false" 28 import="net.sf.basedb.core.AnnotationType" 28 29 import="net.sf.basedb.core.SessionControl" 29 30 import="net.sf.basedb.core.DbControl" … … 93 94 } 94 95 95 // Query to retrieve protocoltypes96 // Query to retrieve tag types 96 97 final ItemQuery<ItemSubtype> tagTypeQuery = ItemSubtype.getQuery(itemType); 97 98 tagTypeQuery.include(Include.ALL); … … 167 168 </table> 168 169 </t:tab> 170 <t:tab id="annotations" title="Annotations" helpid="annotations.edit"> 171 <jsp:include page="../../common/annotations/annotate_frameset.jsp"> 172 <jsp:param name="item_type" value="<%=itemType.name()%>" /> 173 <jsp:param name="item_id" value="<%=itemId%>" /> 174 <jsp:param name="ID" value="<%=ID%>" /> 175 </jsp:include> 176 </t:tab> 169 177 </t:tabcontrol> 170 178 </form> -
trunk/www/biomaterials/tags/index.jsp
r6192 r6335 163 163 } 164 164 165 Base.updateAnnotations(dc, tag, tag, request); 165 166 // OnSave extensions 166 167 invoker.render(OnSaveRenderer.ON_SAVE); … … 199 200 message = (numRemoved == 0 ? "No" : "Only "+numRemoved+" of "+numTotal) + " items could be deleted, because you have no DELETE permission"; 200 201 } 201 redirect = listPage ;202 redirect = listPage+(message != null ? "&popmessage="+HTML.urlEncode(message) : ""); 202 203 } 203 204 else if ("RestoreItem".equals(cmd)) … … 222 223 message = (numRemoved == 0 ? "No" : "Only "+numRemoved+" of "+numTotal) + " items could be restored, because you have no WRITE permission"; 223 224 } 224 redirect = listPage ;225 redirect = listPage+(message != null ? "&popmessage="+HTML.urlEncode(message) : ""); 225 226 } 226 227 else if ("ShareItem".equals(cmd)) -
trunk/www/biomaterials/tags/list_tags.jsp
r6260 r6335 30 30 import="net.sf.basedb.core.Tag" 31 31 import="net.sf.basedb.core.ItemSubtype" 32 import="net.sf.basedb.core.Annotation" 33 import="net.sf.basedb.core.AnnotationType" 34 import="net.sf.basedb.core.AnnotationSet" 32 35 import="net.sf.basedb.core.ItemQuery" 33 36 import="net.sf.basedb.core.ItemResultIterator" 37 import="net.sf.basedb.core.ItemResultList" 34 38 import="net.sf.basedb.core.ItemContext" 35 39 import="net.sf.basedb.core.Nameable" … … 78 82 final DbControl dc = sc.newDbControl(); 79 83 ItemResultIterator<Tag> tags = null; 84 ItemResultList<AnnotationType> annotationTypes = null; 80 85 try 81 86 { … … 85 90 typeQuery.order(Orders.asc(Hql.property("name"))); 86 91 typeQuery.setCacheResult(true); 92 final ItemQuery<AnnotationType> annotationTypeQuery = Base.getAnnotationTypesQuery(itemType); 93 annotationTypes = annotationTypeQuery.list(dc); 87 94 88 95 Map<Plugin.MainType, Integer> pluginCount = PluginDefinition.countPlugins(dc, guiContext); … … 196 203 exportable="true" 197 204 /> 205 <% 206 for (AnnotationType at : annotationTypes) 207 { 208 Enumeration<String, String> annotationEnum = null; 209 Formatter formatter = FormatterFactory.getTypeFormatter(sc, at.getValueType()); 210 if (at.isEnumeration()) 211 { 212 annotationEnum = new Enumeration<String, String>(); 213 List<?> values = at.getValues(); 214 for (Object value : values) 215 { 216 String encoded = formatter.format(value); 217 annotationEnum.add(encoded, encoded); 218 } 219 } 220 %> 221 <tbl:columndef 222 id="<%="at"+at.getId()%>" 223 title="<%=HTML.encodeTags(at.getName())+" [A]"%>" 224 property="<%="#"+at.getId()%>" 225 annotation="true" 226 datatype="<%=at.getValueType().getStringValue()%>" 227 enumeration="<%=annotationEnum%>" 228 smartenum="<%=at.getDisplayAsList() %>" 229 sortable="<%=at.getMultiplicity() == 1%>" 230 filterable="true" 231 exportable="true" 232 formatter="<%=formatter%>" 233 unit="<%=at.getDefaultUnit()%>" 234 /> 235 <% 236 } 237 %> 198 238 <tbl:columndef 199 239 id="permission" … … 415 455 /></tbl:cell> 416 456 <tbl:cell column="description"><%=HTML.encodeTags(item.getDescription())%></tbl:cell> 457 <% 458 AnnotationSet as = item.isAnnotated() ? item.getAnnotationSet() : null; 459 if (as != null) 460 { 461 for (AnnotationType at : annotationTypes) 462 { 463 if (as.hasAnnotation(at)) 464 { 465 Annotation a = as.getAnnotation(at); 466 String suffix = a.getUnitSymbol(null); 467 if (suffix != null) suffix = " " + suffix; 468 %> 469 <tbl:cell 470 column="<%="at"+at.getId()%>" 471 ><tbl:cellvalue 472 list="<%=a.getValues(null)%>" 473 suffix="<%=suffix%>" 474 /></tbl:cell> 475 <% 476 } 477 } 478 } 479 %> 417 480 <tbl:cell column="permission"><%=PermissionUtil.getShortPermissions(item)%></tbl:cell> 418 481 <tbl:cell column="sharedTo"> -
trunk/www/biomaterials/tags/tags.js
r6306 r6335 40 40 41 41 // Tab validation 42 TabControl.addTabActivateListener('settings.annotations', Annotations.autoLoadEditFrame); 42 43 TabControl.addTabValidator('settings.info', tags.validateTag); 43 44 } … … 56 57 Buttons.addClickHandler('btnImport', Buttons.runPlugin, attributes); 57 58 Buttons.addClickHandler('btnRunPlugin', Buttons.runPlugin, attributes); 59 60 TabControl.addTabActivateListener('main.annotations', AnnotationsList.loadOnce); 58 61 } 59 62 else if (pageId == 'list-page') … … 94 97 if (TabControl.validateActiveTab('settings')) 95 98 { 99 Annotations.saveModifiedAnnotationsToForm(frm); 96 100 frm.submit(); 97 101 } -
trunk/www/biomaterials/tags/view_tag.jsp
r6261 r6335 251 251 </jsp:include> 252 252 </t:tab> 253 <t:tab id="annotations" title="Annotations" 254 tooltip="View annotation values" clazz="white"> 255 <jsp:include page="../../common/annotations/list_frameset.jsp"> 256 <jsp:param name="item_type" value="<%=itemType.name()%>" /> 257 <jsp:param name="item_id" value="<%=itemId%>" /> 258 <jsp:param name="ID" value="<%=ID%>" /> 259 </jsp:include> 260 </t:tab> 253 261 </t:tabcontrol> 254 262 -
trunk/www/include/scripts/main.js
r6334 r6335 549 549 this.controllers['SESSION'] = { url:'views/sessions/index.jsp', width:450, height:300, popup:true, edit:false, noAnyToAny:true }; 550 550 this.controllers['SOFTWARE'] = { url:'admin/software/index.jsp', width:800, height:500 }; 551 this.controllers['TAG'] = { url:'biomaterials/tags/index.jsp', width: 450, height:300 };551 this.controllers['TAG'] = { url:'biomaterials/tags/index.jsp', width:800, height:500 }; 552 552 this.controllers['TRANSFORMATION'] = { url:'views/experiments/transformations/index.jsp', width:450, height:300, noAnyToAny:true }; 553 553 this.controllers['UNIT'] = { url:'admin/quantities/units/index.jsp', width:600, height:400, noAnyToAny:true };
Note: See TracChangeset
for help on using the changeset viewer.