Changeset 2657
- Timestamp:
- 02/25/10 14:05:07 (2 years ago)
- Location:
- molgenis4animaldb/handwritten/java
- Files:
-
- 3 edited
-
plugin/listplugin/ListPlugin.ftl (modified) (2 diffs)
-
plugin/listplugin/ListPlugin.java (modified) (2 diffs)
-
servlets/AddEventMenuServlet.java (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
molgenis4animaldb/handwritten/java/plugin/listplugin/ListPlugin.ftl
r2656 r2657 27 27 28 28 <div style="float:left"> 29 <input type="hidden" name="ColumnToRemove" /> 29 30 <table class='listtable'> 30 31 <tr> … … 56 57 <#assign i = i + 1> 57 58 </#list> 59 <tr> 60 <td></td> 61 <#assign i = 0> 62 <#list screen.featureList as fl> 63 <#if screen.featureVisibilityList[i] == 1> 64 <td><div align="center"> 65 <input type="submit" value="-" class="minusbutton" onclick="ColumnToRemove.value='${i}'; __action.value='remColumn';" /> 66 </div></td> 67 </#if> 68 <#assign i = i + 1> 69 </#list> 70 </tr> 58 71 </table> 59 72 </div> -
molgenis4animaldb/handwritten/java/plugin/listplugin/ListPlugin.java
r2656 r2657 104 104 valueToAdd = ""; 105 105 try { 106 Value tmpValue = (Value) q.find().get(0); 107 valueToAdd = tmpValue.getValuestring(); 106 Value currentValue = (Value) q.find().get(0); 107 // Get the real value: 108 valueToAdd = currentValue.getValuestring(); 109 // Find out what the unit is: 110 int unitId = currentFeature.getUnit(); 111 // Check in Ontology if it is a DatabaseLink: 112 List<Ontology> ontList = db 113 .find(Ontology.class, new QueryRule("id", 114 Operator.EQUALS, unitId)); 115 Ontology currentOntTerm = ontList.get(0); 116 String termType = currentOntTerm.getTermtype(); 117 // If so, find the corresponding target: 118 if (termType.equals("DatabaseLink")) { 119 int targetId = Integer 120 .parseInt(valueToAdd); 121 List<Target> targetList = db.find(Target.class, 122 new QueryRule("id", Operator.EQUALS, 123 targetId)); 124 Target currentTarget = targetList.get(0); 125 valueToAdd = currentTarget.getName(); 126 } 108 127 } catch (Exception e) { 109 128 e.printStackTrace(); … … 122 141 int selectedFeatureId = request.getInt("feature"); 123 142 featureVisibilityList.set(selectedFeatureId, 1); 143 } 144 145 if (action.equals("remColumn")) { 146 int selectedFeatureId = request.getInt("ColumnToRemove"); 147 featureVisibilityList.set(selectedFeatureId, 0); 124 148 } 125 149 -
molgenis4animaldb/handwritten/java/servlets/AddEventMenuServlet.java
r2656 r2657 22 22 import animaldb.EventType_features; 23 23 import animaldb.Feature; 24 import animaldb.Ontology; 25 import animaldb.Target; 24 26 25 27 public class AddEventMenuServlet extends app.servlet.MolgenisServlet … … 61 63 dummyValue = " value='Dummy'"; 62 64 } 65 boolean DbLink = false; 66 List<Target> targetList = new ArrayList<Target>(); 67 // Find out what the unit is: 68 int unitId = currentFeature.getUnit(); 69 // Check in Ontology if it is a DatabaseLink: 70 List<Ontology> ontList = db.find(Ontology.class, new QueryRule("id", Operator.EQUALS, unitId)); 71 Ontology currentOntTerm = ontList.get(0); 72 String termType = currentOntTerm.getTermtype(); 73 // If so, find the corresponding target: 74 if (termType.equals("DatabaseLink")) { 75 DbLink = true; 76 String tmpString = currentOntTerm.getName(); 77 String metaType = tmpString.substring(0, tmpString.length() - 4); // Remove Link-part; TO DO: solve in a nicer way! 78 List<Ontology> ontList2 = db.find(Ontology.class, new QueryRule("name", Operator.EQUALS, metaType)); 79 Ontology metaOntTerm = ontList2.get(0); 80 targetList = db.find(Target.class, new QueryRule("targettype", Operator.EQUALS, metaOntTerm.getId())); 81 } 82 63 83 out.print("<div id='featurevalue_part' class='row'" + hideDiv + ">"); 64 84 out.print("<label for='value"+valueNr+"'>"+currentFeature.getName()+" value: </label>"); 65 out.print("<input type='text' class='textbox' name='value" + valueNr + "' id='value" + valueNr + "' " + dummyValue + "/>"); 85 if (DbLink) { 86 out.print("<select name='value" + valueNr + "' id='value" + valueNr + "'>"); 87 for (Target t : targetList) { 88 out.print("<option value='" + t.getId() + "'>" + t.getName() + "</option>"); 89 } 90 out.print("</select>"); 91 } else { 92 out.print("<input type='text' class='textbox' name='value" + valueNr + "' id='value" + valueNr + "' " + dummyValue + "/>"); 93 } 66 94 out.print("<em>(unit: "+currentFeature.getUnitLabel()+")</em>"); 67 95 out.print("<input type='hidden' name='feature"+valueNr+"' value='"+currentFeature.getId()+"' />");
Note: See TracChangeset
for help on using the changeset viewer.