source: trunk/grails-app/domain/dbnp/studycapturing/TemplateField.groovy @ 349

Last change on this file since 349 was 349, checked in by duh, 13 years ago
  • added more templates to bootstrap
  • added a 300ms delay to ontology-chooser
  • refactored wizard subject page's "add subjects" dialogue (not working yet!) to incorporate an ontology field instead of a term select... this has to change though...
  • added template elements to tag library (ajaxButtonField and ontologyField)
  • minified ontology-chooser javascript
  • minified wizard.css
  • Property svn:keywords set to Date Rev Author
File size: 1.3 KB
Line 
1package dbnp.studycapturing
2
3import dbnp.data.Ontology
4
5/**
6 * This is the class for template fields. These should be part of one or more templates via Template.fields
7 *
8 * Revision information:
9 * $Rev: 349 $
10 * $Author: duh $
11 * $Date: 2010-04-19 11:05:48 +0000 (ma, 19 apr 2010) $
12 */
13class TemplateField implements Serializable {
14        String name
15        TemplateFieldType type
16        String unit
17        String comment // help string for the user interface
18        List listEntries
19
20    static hasMany = [listEntries : TemplateFieldListItem,
21                // to store the entries to choose from when the type is 'item from predefined list'
22                ontologies : Ontology // to store the ontologies to choose from when the type is 'ontology term'
23        ]
24       
25        static constraints = {
26                name(unique: true)
27                unit(nullable: true, blank: true)
28                comment(nullable:true, blank: true)
29        }
30
31        static mapping = {
32                comment type: 'text'
33        }
34
35        String toString() {
36                return name
37        }
38
39
40        /**
41         * return an escaped name which can be used in business logic
42         * @return String
43         */
44        def String escapedName() {
45                return name.toLowerCase().replaceAll("([^a-z0-9])","_")
46        }
47
48        //TODO: make a convenience setter for a string array
49        /*def setListEntries(ArrayList entries) {
50                list=[]
51                entries.each {
52                        list.add(new TemplateFieldListItem(name: it))
53                }
54                this
55        }*/
56
57}
Note: See TracBrowser for help on using the repository browser.