Changeset 6689
- Timestamp:
- Jan 21, 2015, 11:35:06 AM (8 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/clients/web/net/sf/basedb/clients/web/Base.java
r6282 r6689 1014 1014 1015 1015 /** 1016 Get a query returning all annotation types that are needed to display 1017 inherited annotations for the given columns. The columns is a string with 1018 comma-separated values that define the visible columns in a table. 1019 Columns for inherited annotations are defined by 'ia'+<id>. 1020 @since 3.5 1021 */ 1022 public static ItemQuery<AnnotationType> getInheritedAnnotationColumns(String columns) 1023 { 1024 ItemQuery<AnnotationType> q = AnnotationType.getQuery(null); 1025 q.order(Orders.asc(Hql.property("name"))); 1026 q.include(Include.ALL); 1027 q.restrict(Restrictions.in(Hql.property("id"), Expressions.parameter("ids"))); 1028 List<Integer> ids = new ArrayList<Integer>(); 1029 ids.add(0); 1030 if (columns != null) 1031 { 1032 for (String c : columns.split(",")) 1033 { 1034 if (c.startsWith("ia")) ids.add(Integer.parseInt(c.substring(2))); 1035 } 1036 } 1037 q.setParameter("ids", ids, Type.INT); 1038 q.setCacheResult(true); 1039 return q; 1040 } 1041 1042 /** 1016 1043 Get a query that returns all subtypes for the given main item type. 1017 1044 @param itemType The main item type -
trunk/www/common/columns/configure.js
r6684 r6689 49 49 Buttons.addClickHandler('btnSavePreset', configure.savePresetAs); 50 50 Events.addEventHandler('presets', 'change', configure.presetOnChange); 51 if (Doc.element('selectAnnotationTypes')) 52 { 53 Buttons.addClickHandler('selectAnnotationTypes', configure.selectAnnotationTypes); 54 Events.addEventHandler('selectAnnotationTypes', 'base-selected', configure.annotationTypeSelected); 55 } 51 56 52 57 Buttons.addClickHandler('moveUp', configure.moveVisibleUpOrDown); … … 146 151 { 147 152 var temp = []; 148 for (var i = 0; i < columnDefs.length; i++) // >153 for (var i = 0; i < columnDefs.length; i++) 149 154 { 150 155 var col = columnDefs[i]; … … 171 176 } 172 177 178 179 configure.selectAnnotationTypes = function(event) 180 { 181 var frm = document.forms['columns']; 182 var exclude = []; 183 for (var i = 0; i < frm.visible.length; i++) 184 { 185 if (frm.visible[i].value.indexOf('ia')==0) 186 { 187 exclude[exclude.length] = frm.visible[i].value.substring(2); 188 } 189 } 190 var url = '&exclude='+exclude.join(','); 191 Dialogs.selectItem('ANNOTATIONTYPE', event.currentTarget.id, 1, url); 192 } 193 194 configure.annotationTypeSelected = function(event) 195 { 196 var frm = document.forms['columns']; 197 var item = event.detail; 198 var colId = 'ia'+item.id; 199 // Do not add duplicates 200 for (var i = 0; i < frm.visible.length; i++) 201 { 202 if (frm.visible[i].value == colId) return; 203 } 204 // Remove from 'hidden' list 205 for (var i = frm.hidden.length-1; i >= 0; i--) 206 { 207 if (frm.hidden[i].value == colId) frm.hidden[i] = null; 208 } 209 frm.visible[frm.visible.length] = new Option(item.name + ' [I]', colId); 210 } 211 173 212 /** 174 213 Save the current selection and close the dialog. -
trunk/www/common/columns/configure.jsp
r6608 r6689 46 46 <%@ taglib prefix="base" uri="/WEB-INF/base.tld" %> 47 47 <%@ taglib prefix="t" uri="/WEB-INF/tab.tld" %> 48 48 <%@ taglib prefix="tbl" uri="/WEB-INF/table.tld" %> 49 49 <% 50 50 final SessionControl sc = Base.getExistingSessionControl(pageContext, true); … … 53 53 final String subContext = Values.getString(request.getParameter("subcontext"), ""); 54 54 final String tableId = request.getParameter("table_id"); 55 final boolean enableInheritedAnnotations = Values.getBoolean(request.getParameter("enableInheritedAnnotations")); 55 56 final ItemContext cc = sc.getCurrentContext(itemType, subContext); 56 57 … … 59 60 %> 60 61 <base:page type="popup" title="Set column order and visibility"> 61 <base:head scripts="~configure.js" />62 <base:head scripts="~configure.js" styles="toolbar.css" /> 62 63 <base:body> 63 64 <h1>Set column order and visiblity <base:help helpid="columns.configure" /></h1> … … 74 75 <div class="content bg-filled-50 bottomborder"> 75 76 <table style="width: 100%; height: 100%;"> 77 <% 78 if (enableInheritedAnnotations) 79 { 80 %> 81 <tr> 82 <td colspan="4" style="vertical-align: top;"> 83 <tbl:toolbar subclass="bottomborder"> 84 <tbl:button 85 id="selectAnnotationTypes" 86 image="add.png" 87 title="Add inherited annotations…" 88 tooltip="Add columns for inherited annotations" 89 /> 90 </tbl:toolbar> 91 </td> 92 </tr> 93 <% 94 } 95 %> 76 96 <tr> 77 97 <td style="padding: 5px;"> … … 121 141 </select> 122 142 </td> 123 </tr> 143 </tr> 124 144 <tr> 125 145 <td colspan="4" > -
trunk/www/include/scripts/table.js
r6576 r6689 418 418 var itemType = Data.get(tableDiv, 'item-type'); 419 419 var subContext = Data.get(tableDiv, 'subcontext', ''); 420 var enableInheritedAnnotations = Data.get(tableDiv, 'inherited-annotations'); 420 421 421 422 var url = App.getRoot()+'common/columns/configure.jsp?ID='+App.getSessionId(); 422 423 url += '&table_id='+tableDiv.id+'&item_type='+itemType+'&subcontext='+subContext; 424 if (enableInheritedAnnotations) 425 { 426 url += '&enableInheritedAnnotations='+encodeURIComponent(enableInheritedAnnotations); 427 } 423 428 if (settingName) url += '&settingName='+settingName; 424 429 Dialogs.openPopup(url, 'ConfigureColumns', 750, 450); -
trunk/www/views/rawbioassays/list_rawbioassays.jsp
r6604 r6689 109 109 try 110 110 { 111 finalItemQuery<AnnotationType> annotationTypeQuery = Base.getAnnotationTypesQuery(itemType);111 ItemQuery<AnnotationType> annotationTypeQuery = Base.getAnnotationTypesQuery(itemType); 112 112 SnapshotManager manager = new SnapshotManager(); 113 113 for (AnnotationType at : annotationTypeQuery.list(dc)) 114 114 { 115 115 annotationLoaders.add(new AnnotationLoaderUtil(dc, manager, at)); 116 } 117 annotationTypeQuery = Base.getInheritedAnnotationColumns(cc.getSetting("columns")); 118 for (AnnotationType at : annotationTypeQuery.list(dc)) 119 { 120 annotationLoaders.add(new AnnotationLoaderUtil(dc, manager, at, false, true)); 116 121 } 117 122 … … 171 176 item="<%=itemType%>" 172 177 subclass="fulltable" 178 data-inherited-annotations="true" 173 179 > 174 180 <tbl:hidden … … 414 420 %> 415 421 <tbl:columndef 416 id="<%= "at"+at.getId()%>"417 title="<%=HTML.encodeTags(at.getName())+ " [A]"%>"418 property="<%= "#"+at.getId()%>"422 id="<%=(loader.isSearchingInheritedAnnotations() ? "ia" : "at")+at.getId()%>" 423 title="<%=HTML.encodeTags(at.getName())+(loader.isSearchingInheritedAnnotations() ? " [I]" : " [A]")%>" 424 property="<%=(loader.isSearchingInheritedAnnotations() ? "##" : "#")+at.getId()%>" 419 425 annotation="true" 420 426 datatype="<%=at.getValueType().getStringValue()%>" 421 427 enumeration="<%=annotationEnum%>" 422 428 smartenum="<%=at.getDisplayAsList() %>" 423 sortable="<%=at.getMultiplicity() == 1 %>"429 sortable="<%=at.getMultiplicity() == 1 && !loader.isSearchingInheritedAnnotations()%>" 424 430 filterable="true" 425 431 exportable="true" … … 790 796 %> 791 797 <tbl:cell 792 column="<%= "at"+loader.getId()%>"798 column="<%=(loader.isSearchingInheritedAnnotations() ? "ia" : "at")+loader.getId()%>" 793 799 ><tbl:cellvalue 794 800 list="<%=loader.getValues()%>"
Note: See TracChangeset
for help on using the changeset viewer.