Changeset 2949
- Timestamp:
- Nov 24, 2006, 4:53:37 PM (16 years ago)
- Location:
- trunk
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/clients/web/net/sf/basedb/clients/web/taglib/Select.java
r2597 r2949 65 65 recent=... 66 66 selectrecent=true|false 67 defaultitem=... 68 selectdefault=true|false 67 69 onselect=... 68 70 onchange=... … … 154 156 </tr> 155 157 <tr> 158 <td>defaultitem</td> 159 <td></td> 160 <td>no</td> 161 <td> 162 Default value set e.g. for a project. 163 </td> 164 </tr> 165 <tr> 166 <td>selectdefault</td> 167 <td>true</td> 168 <td>no</td> 169 <td> 170 If no current or recent has been specified and it is a new item then, if this 171 parameter is TRUE the default value is selected. If this 172 parameter is FALSE, no item is selected. 173 </td> 174 </tr> 175 <tr> 156 176 <td>onchange</td> 157 177 <td></td> … … 245 265 246 266 /** 267 The project default value 268 */ 269 private BasicItem defaultitem; 270 271 /** 272 If the default item should be selected for new items with 273 no current or recently used items. 274 */ 275 private boolean selectdefault = true; 276 277 /** 247 278 JavaScript statement. 248 279 */ … … 336 367 } 337 368 369 public void setDefaultitem(BasicItem defaultitem) 370 { 371 this.defaultitem = defaultitem; 372 } 373 public BasicItem getDefaultitem() 374 { 375 return defaultitem; 376 } 377 378 public void setSelectdefault(boolean selectdefault) 379 { 380 this.selectdefault = selectdefault; 381 } 382 public boolean getSelectdefault() 383 { 384 return selectdefault; 385 } 338 386 339 387 public void setOnchange(String onChange) … … 423 471 if (recent != null && recent.size() > 0) 424 472 { 425 sb.append("<option value=\"0\" class=\"recentheader\">- recently used -\n");473 sb.append("<option value=\"0\" disabled=\"true\" class=\"recentheader\">- recently used -\n"); 426 474 int i = 1; 427 475 for (BasicItem item : recent) … … 444 492 } 445 493 } 494 if (defaultitem != null) 495 { 496 sb.append("<option value=\"0\" disabled=\"true\" class=\"defaultheader\">- default -\n"); 497 String name = getName(defaultitem); 498 String clazz = "default"; 499 500 sb.append("<option value=\"").append(defaultitem.getId()).append("\""); 501 sb.append(" class=\"").append(clazz).append("\""); 502 if ( current == null && 503 (recent != null && recent.isEmpty()) && 504 isNewitem() && 505 getSelectdefault() ) 506 { 507 sb.append(" selected"); 508 } 509 sb.append(">").append(name).append("\n"); 510 } 446 511 } 447 512 sb.append("</select> \n"); -
trunk/www/WEB-INF/base.tld
r2597 r2949 403 403 </attribute> 404 404 <attribute> 405 <name>defaultitem</name> 406 <required>false</required> 407 <rtexprvalue>true</rtexprvalue> 408 </attribute> 409 <attribute> 410 <name>selectdefault</name> 411 <required>false</required> 412 <rtexprvalue>true</rtexprvalue> 413 </attribute> 414 <attribute> 405 415 <name>onchange</name> 406 416 <required>false</required> -
trunk/www/biomaterials/extracts/edit_extract.jsp
r2942 r2949 38 38 import="net.sf.basedb.core.Protocol" 39 39 import="net.sf.basedb.core.ProtocolType" 40 import="net.sf.basedb.core.Project" 40 41 import="net.sf.basedb.core.PermissionDeniedException" 41 42 import="net.sf.basedb.core.BaseException" … … 76 77 boolean readCurrentProtocol = true; 77 78 Protocol currentProtocol = null; 79 Protocol defaultProtocol = null; 78 80 boolean readCurrentSample = true; 79 81 Sample currentSample = null; … … 85 87 List<Protocol> recentProtocols = (List<Protocol>)cc.getRecent(dc, Item.PROTOCOL); 86 88 List<Sample> recentSamples = (List<Sample>)cc.getRecent(dc, Item.SAMPLE); 87 89 90 int activeProjectId = sc.getActiveProjectId(); 91 if (activeProjectId > 0) 92 { 93 Project activeProject = Project.getById(dc, activeProjectId); 94 try 95 { 96 defaultProtocol = (Protocol)activeProject.getDefaultItem(dc, Project.Default.EXTRACTING_PROTOCOL); 97 } 98 catch(PermissionDeniedException pdex) 99 { 100 defaultProtocol = null; 101 } 102 } 88 103 if (itemId == 0) 89 104 { … … 111 126 name = Values.getString(cc.getPropertyValue("name"), "New extract"); 112 127 } 113 eventDate = (Date)cc.getPropertyObject("creationEvent.eventDate"); 128 eventDate = (Date)cc.getPropertyObject("creationEvent.eventDate"); 114 129 } 115 130 else … … 502 517 denied="<%=!readCurrentProtocol%>" 503 518 recent="<%=recentProtocols%>" 519 defaultitem="<%=defaultProtocol%>" 504 520 newitem="<%=extract == null%>" 505 521 onselect="selectProtocolOnClick()" -
trunk/www/biomaterials/labeledextracts/edit_labeledextract.jsp
r2942 r2949 39 39 import="net.sf.basedb.core.Protocol" 40 40 import="net.sf.basedb.core.ProtocolType" 41 import="net.sf.basedb.core.Project" 41 42 import="net.sf.basedb.core.PermissionDeniedException" 42 43 import="net.sf.basedb.core.BaseException" … … 77 78 boolean readCurrentProtocol = true; 78 79 Protocol currentProtocol = null; 80 Protocol defaultProtocol = null; 79 81 boolean readCurrentLabel = true; 80 82 Label currentLabel = null; … … 89 91 List<Extract> recentExtracts = (List<Extract>)cc.getRecent(dc, Item.EXTRACT); 90 92 List<Label> recentLabels = (List<Label>)cc.getRecent(dc, Item.LABEL); 93 94 int activeProjectId = sc.getActiveProjectId(); 95 if (activeProjectId > 0) 96 { 97 Project activeProject = Project.getById(dc, activeProjectId); 98 try 99 { 100 defaultProtocol = (Protocol)activeProject.getDefaultItem(dc, Project.Default.LABELING_PROTOCOL); 101 } 102 catch(PermissionDeniedException pdex) 103 { 104 defaultProtocol = null; 105 } 106 } 91 107 92 108 if (itemId == 0) … … 558 574 denied="<%=!readCurrentProtocol%>" 559 575 recent="<%=recentProtocols%>" 576 defaultitem="<%=defaultProtocol%>" 560 577 newitem="<%=extract == null%>" 561 578 onselect="selectProtocolOnClick()" -
trunk/www/biomaterials/samples/edit_sample.jsp
r2942 r2949 38 38 import="net.sf.basedb.core.Protocol" 39 39 import="net.sf.basedb.core.ProtocolType" 40 import="net.sf.basedb.core.Project" 40 41 import="net.sf.basedb.core.PermissionDeniedException" 41 42 import="net.sf.basedb.core.BaseException" … … 77 78 boolean readCurrentProtocol = true; 78 79 Protocol currentProtocol = null; 80 Protocol defaultProtocol = null; 79 81 boolean readCurrentBioSource = true; 80 82 BioSource currentBioSource = null; … … 84 86 List<Protocol> recentProtocols = (List<Protocol>)cc.getRecent(dc, Item.PROTOCOL); 85 87 List<BioSource> recentBioSources = (List<BioSource>)cc.getRecent(dc, Item.BIOSOURCE); 88 89 int activeProjectId = sc.getActiveProjectId(); 90 if (activeProjectId > 0) 91 { 92 Project activeProject = Project.getById(dc, activeProjectId); 93 try 94 { 95 defaultProtocol = (Protocol)activeProject.getDefaultItem(dc, Project.Default.SAMPLING_PROTOCOL); 96 } 97 catch(PermissionDeniedException pdex) 98 { 99 defaultProtocol = null; 100 } 101 } 102 86 103 87 104 if (itemId == 0) … … 486 503 denied="<%=!readCurrentProtocol%>" 487 504 recent="<%=recentProtocols%>" 505 defaultitem="<%=defaultProtocol%>" 488 506 newitem="<%=sample == null%>" 489 507 onselect="selectProtocolOnClick()" -
trunk/www/include/styles/main.css
r2733 r2949 201 201 } 202 202 203 .selectoptionheader, .defaultheader { 204 font-weight: bold; 205 } 206 207 .selectionlist .default { 208 } 209 203 210 .selectionlist .removed { 204 211 font-style: italic; -
trunk/www/lims/arraybatches/edit_batch.jsp
r2875 r2949 38 38 import="net.sf.basedb.core.Protocol" 39 39 import="net.sf.basedb.core.ProtocolType" 40 import="net.sf.basedb.core.Project" 40 41 import="net.sf.basedb.core.Hardware" 41 42 import="net.sf.basedb.core.HardwareType" … … 71 72 boolean readCurrentArrayDesign = true; 72 73 ArrayDesign currentArrayDesign = null; 74 ArrayDesign defaultArrayDesign = null; 73 75 boolean readCurrentProtocol = true; 74 76 Protocol currentProtocol = null; 77 Protocol defaultProtocol = null; 75 78 boolean readCurrentPrintRobot = true; 76 79 Hardware currentPrintRobot = null; 80 Hardware defaultPrintRobot = null; 77 81 78 82 // Load recently used items … … 81 85 List<Hardware> recentPrintRobots = (List<Hardware>)cc.getRecent(dc, Item.HARDWARE); 82 86 87 int activeProjectId = sc.getActiveProjectId(); 88 if (activeProjectId > 0) 89 { 90 Project activeProject = Project.getById(dc, activeProjectId); 91 try 92 { 93 defaultArrayDesign = (ArrayDesign)activeProject.getDefaultItem(dc, Project.Default.ARRAYDESIGN); 94 } 95 catch (PermissionDeniedException pdex) 96 { 97 defaultArrayDesign = null; 98 } 99 try 100 { 101 defaultProtocol = (Protocol)activeProject.getDefaultItem(dc, Project.Default.PRINTING_PROTOCOL); 102 } 103 catch (PermissionDeniedException pdex) 104 { 105 defaultProtocol = null; 106 } 107 try 108 { 109 defaultPrintRobot = (Hardware)activeProject.getDefaultItem(dc, Project.Default.PRINTROBOT_HARDWARE); 110 } 111 catch (PermissionDeniedException pdex) 112 { 113 defaultPrintRobot = null; 114 } 115 } 83 116 if (itemId == 0) 84 117 { … … 118 151 try 119 152 { 120 currentPrintRobot = batch.getPrintRobot(); 153 currentPrintRobot = batch.getPrintRobot(); 121 154 } 122 155 catch (PermissionDeniedException ex) … … 126 159 try 127 160 { 128 currentProtocol = batch.getProtocol(); 161 currentProtocol = batch.getProtocol(); 129 162 } 130 163 catch (PermissionDeniedException ex) … … 363 396 denied="<%=!readCurrentArrayDesign%>" 364 397 recent="<%=recentArrayDesigns%>" 398 defaultitem="<%=defaultArrayDesign%>" 365 399 newitem="true" 366 400 onselect="selectArrayDesignOnClick()" … … 382 416 denied="<%=!readCurrentPrintRobot%>" 383 417 recent="<%=recentPrintRobots%>" 418 defaultitem="<%=defaultPrintRobot%>" 384 419 newitem="<%=batch == null%>" 385 420 onselect="selectPrintRobotOnClick()" … … 397 432 denied="<%=!readCurrentProtocol%>" 398 433 recent="<%=recentProtocols%>" 434 defaultitem="<%=defaultProtocol%>" 399 435 newitem="<%=batch == null%>" 400 436 onselect="selectProtocolOnClick()" -
trunk/www/views/experiments/edit_experiment.jsp
r2942 r2949 48 48 import="net.sf.basedb.core.PermissionDeniedException" 49 49 import="net.sf.basedb.core.BaseException" 50 import="net.sf.basedb.core.Project" 50 51 import="net.sf.basedb.clients.web.Base" 51 52 import="net.sf.basedb.clients.web.WebException" … … 74 75 Experiment experiment = null; 75 76 RawDataType currentRawDataType = null; 77 RawDataType defaultRawDataType = null; 76 78 ItemQuery<RawBioAssay> rbaQuery = null; 77 79 ItemQuery<AnnotationType> efQuery = null; … … 82 84 List<Directory> recentDirectories = (List<Directory>)cc.getRecent(dc, Item.DIRECTORY); 83 85 86 int activeProjectId = sc.getActiveProjectId(); 87 if (activeProjectId > 0) 88 { 89 Project activeProject = Project.getById(dc, activeProjectId); 90 defaultRawDataType = activeProject.getDefaultRawDataType(); 91 } 84 92 if (itemId == 0) 85 93 { … … 101 109 rbaQuery.restrict(Restrictions.in(Hql.property("id"), Expressions.parameter("selected"))); 102 110 rbaQuery.setParameter("selected", Arrays.asList(Values.getInt(selected)), Type.INT); 103 } 111 } 104 112 } 105 113 else … … 328 336 <select name="rawdatatype" class="required"> 329 337 <% 338 currentRawDataType = currentRawDataType != null ? currentRawDataType : defaultRawDataType; 330 339 for (RawDataType rdt : RawDataTypes.getRawDataTypes()) 331 340 { -
trunk/www/views/formulas/edit_formula.jsp
r2733 r2949 37 37 import="net.sf.basedb.core.RawDataTypes" 38 38 import="net.sf.basedb.core.RawDataProperty" 39 import="net.sf.basedb.core.Project" 39 40 import="net.sf.basedb.core.PermissionDeniedException" 40 41 import="net.sf.basedb.util.Values" … … 60 61 Formula.Parser currentParser = null; 61 62 RawDataType currentRawDataType = null; 63 RawDataType defaultRawDataType = null; 62 64 List<String> expressions = null; 63 65 Coloring coloring = null; 64 66 67 int activeProjectId = sc.getActiveProjectId(); 68 if (activeProjectId > 0) 69 { 70 Project activeProject = Project.getById(dc, activeProjectId); 71 defaultRawDataType = activeProject.getDefaultRawDataType(); 72 } 65 73 if (itemId == 0) 66 74 { … … 85 93 coloring.setMidValue(Values.getFloat(cc.getPropertyValue("coloring.midValue"), null)); 86 94 coloring.setMaxValue(Values.getFloat(cc.getPropertyValue("coloring.maxValue"), null)); 95 96 currentRawDataType = currentRawDataType != null ? currentRawDataType : defaultRawDataType; 87 97 } 88 98 else -
trunk/www/views/hybridizations/edit_hybridization.jsp
r2942 r2949 41 41 import="net.sf.basedb.core.Protocol" 42 42 import="net.sf.basedb.core.ProtocolType" 43 import="net.sf.basedb.core.Project" 43 44 import="net.sf.basedb.core.LabeledExtract" 44 45 import="net.sf.basedb.core.ItemQuery" … … 83 84 boolean readCurrentProtocol = true; 84 85 Protocol currentProtocol = null; 86 Protocol defaultProtocol = null; 85 87 86 88 boolean readCurrentHybStation = true; 87 89 Hardware currentHybStation = null; 90 Hardware defaultHybStation = null; 88 91 89 92 // Load recently used items … … 91 94 List<Hardware> recentStations = (List<Hardware>)cc.getRecent(dc, Item.HARDWARE); 92 95 96 int activeProjectId = sc.getActiveProjectId(); 97 if (activeProjectId > 0) 98 { 99 Project activeProject = Project.getById(dc, activeProjectId); 100 try 101 { 102 defaultProtocol = (Protocol)activeProject.getDefaultItem(dc, Project.Default.HYBRIDIZATION_PROTOCOL); 103 } 104 catch (PermissionDeniedException pdex) 105 { 106 defaultProtocol = null; 107 } 108 try 109 { 110 defaultHybStation = (Hardware)activeProject.getDefaultItem(dc, Project.Default.HYBRIDIZATION_HARDWARE); 111 } 112 catch (PermissionDeniedException pdex) 113 { 114 defaultHybStation = null; 115 } 116 } 93 117 if (itemId == 0) 94 118 { … … 477 501 denied="<%=!readCurrentProtocol%>" 478 502 recent="<%=recentProtocols%>" 503 defaultitem="<%=defaultProtocol%>" 479 504 newitem="<%=hyb == null%>" 480 505 onselect="selectProtocolOnClick()" … … 493 518 denied="<%=!readCurrentHybStation%>" 494 519 recent="<%=recentStations%>" 520 defaultitem="<%=defaultHybStation%>" 495 521 newitem="<%=hyb == null%>" 496 522 onselect="selectHybStationOnClick()" -
trunk/www/views/rawbioassays/edit_rawbioassay.jsp
r2875 r2949 38 38 import="net.sf.basedb.core.Protocol" 39 39 import="net.sf.basedb.core.ProtocolType" 40 import="net.sf.basedb.core.Project" 40 41 import="net.sf.basedb.core.Software" 41 42 import="net.sf.basedb.core.SoftwareType" … … 77 78 boolean readCurrentProtocol = true; 78 79 Protocol currentProtocol = null; 80 Protocol defaultProtocol = null; 79 81 boolean readCurrentSoftware = true; 80 82 Software currentSoftware = null; 83 Software defaultSoftware = null; 81 84 boolean readCurrentArrayDesign = true; 82 85 ArrayDesign currentArrayDesign = null; 86 ArrayDesign defaultArrayDesign = null; 83 87 RawDataType currentRawDataType = null; 88 RawDataType defaultRawDataType = null; 84 89 85 90 // Load recently used items … … 90 95 List<File> recentFiles = (List<File>)cc.getRecent(dc, Item.FILE); 91 96 97 int activeProjectId = sc.getActiveProjectId(); 98 if (activeProjectId > 0) 99 { 100 Project activeProject = Project.getById(dc, activeProjectId); 101 try 102 { 103 defaultProtocol = (Protocol)activeProject.getDefaultItem(dc, Project.Default.FEATURE_EXTRACTION_PROTOCOL); 104 } 105 catch (PermissionDeniedException pdex) 106 { 107 defaultProtocol = null; 108 } 109 try 110 { 111 defaultSoftware = (Software)activeProject.getDefaultItem(dc, Project.Default.SOFTWARE); 112 } 113 catch (PermissionDeniedException pdex) 114 { 115 defaultSoftware = null; 116 } 117 try 118 { 119 defaultArrayDesign = (ArrayDesign)activeProject.getDefaultItem(dc, Project.Default.ARRAYDESIGN); 120 } 121 catch (PermissionDeniedException pdex) 122 { 123 defaultArrayDesign = null; 124 } 125 defaultRawDataType = activeProject.getDefaultRawDataType(); 126 } 92 127 if (itemId == 0) 93 128 { … … 139 174 { 140 175 currentArrayDesign = Base.getFirstMatching(dc, ArrayDesign.getQuery(), "name", cc.getPropertyFilter("arrayDesign.name")); 141 } 176 } 177 currentRawDataType = currentRawDataType != null ? currentRawDataType : defaultRawDataType; 142 178 } 143 179 else … … 550 586 denied="<%=!readCurrentArrayDesign%>" 551 587 recent="<%=recentArrayDesigns%>" 588 defaultitem="<%=defaultArrayDesign%>" 552 589 newitem="<%=rawBioAssay == null%>" 553 590 onselect="selectArrayDesignOnClick()" … … 600 637 denied="<%=!readCurrentProtocol%>" 601 638 recent="<%=recentProtocols%>" 639 defaultitem="<%=defaultProtocol%>" 602 640 newitem="<%=rawBioAssay == null%>" 603 641 onselect="selectProtocolOnClick()" … … 631 669 denied="<%=!readCurrentSoftware%>" 632 670 recent="<%=recentSoftware%>" 671 defaultitem="<%=defaultSoftware%>" 633 672 newitem="<%=rawBioAssay == null%>" 634 673 onselect="selectSoftwareOnClick()" -
trunk/www/views/scans/edit_scan.jsp
r2875 r2949 37 37 import="net.sf.basedb.core.Protocol" 38 38 import="net.sf.basedb.core.ProtocolType" 39 import="net.sf.basedb.core.Project" 39 40 import="net.sf.basedb.core.Hardware" 40 41 import="net.sf.basedb.core.HardwareType" … … 69 70 Hybridization currentHybridization = null; 70 71 boolean readCurrentProtocol = true; 71 Protocol currentProtocol = null; 72 Protocol currentProtocol = null; 73 Protocol defaultProtocol = null; 72 74 boolean readCurrentScanner = true; 73 75 Hardware currentScanner = null; 76 Hardware defaultScanner = null; 74 77 75 78 // Load recently used items … … 78 81 List<Hybridization> recentHybridizations = (List<Hybridization>)cc.getRecent(dc, Item.HYBRIDIZATION); 79 82 83 int activeProjectId = sc.getActiveProjectId(); 84 if (activeProjectId > 0) 85 { 86 Project activeProject = Project.getById(dc, activeProjectId); 87 try 88 { 89 defaultProtocol = (Protocol)activeProject.getDefaultItem(dc, Project.Default.SCANNING_PROTOCOL); 90 } 91 catch (PermissionDeniedException pdex) 92 { 93 defaultProtocol = null; 94 } 95 try 96 { 97 defaultScanner = (Hardware)activeProject.getDefaultItem(dc, Project.Default.SCANNER_HARDWARE); 98 } 99 catch (PermissionDeniedException pdex) 100 { 101 defaultScanner = null; 102 } 103 } 80 104 if (itemId == 0) 81 105 { … … 373 397 denied="<%=!readCurrentScanner%>" 374 398 recent="<%=recentScanners%>" 399 defaultitem="<%=defaultScanner%>" 375 400 newitem="<%=scan == null%>" 376 401 onselect="selectScannerOnClick()" … … 388 413 denied="<%=!readCurrentProtocol%>" 389 414 recent="<%=recentProtocols%>" 415 defaultitem="<%=defaultProtocol%>" 390 416 newitem="<%=scan == null%>" 391 417 onselect="selectProtocolOnClick()"
Note: See TracChangeset
for help on using the changeset viewer.