Changeset 2449
- Timestamp:
- 11/30/09 23:00:58 (2 years ago)
- Location:
- molgenis_distro/3.3
- Files:
-
- 8 added
- 9 deleted
- 30 edited
- 6 copied
- 3 moved
-
WebContent/WEB-INF/web.xml (modified) (2 diffs)
-
handwritten/java/MolgenisUpdateDatabase.java (modified) (1 diff)
-
handwritten/java/log4j.properties (added)
-
handwritten/java/plugin/examples/dbquery/ExperimentQueryModel.java (deleted)
-
handwritten/java/plugin/examples/dbquery/ExperimentQueryPlugin.ftl (modified) (2 diffs)
-
handwritten/java/plugin/examples/dbquery/ExperimentQueryPlugin.java (modified) (4 diffs)
-
handwritten/java/plugin/examples/file/FileServingPlugin.ftl (modified) (1 diff)
-
handwritten/java/plugin/examples/file/FileServingPlugin.java (modified) (3 diffs)
-
handwritten/java/plugin/examples/helloworld/HelloWorldModel.java (deleted)
-
handwritten/java/plugin/examples/helloworld/HelloWorldPlugin.ftl (modified) (2 diffs)
-
handwritten/java/plugin/examples/helloworld/HelloWorldPlugin.java (modified) (4 diffs)
-
handwritten/java/plugin/examples/portal/PortalIntegrationPlugin.ftl (modified) (1 diff)
-
handwritten/java/plugin/examples/portal/PortalIntegrationPlugin.java (modified) (5 diffs)
-
handwritten/java/plugin/examples/wizard/WizardPlugin.ftl (modified) (3 diffs)
-
handwritten/java/plugin/examples/wizard/WizardPlugin.java (modified) (5 diffs)
-
handwritten/java/plugin/query/view/MartView.ftl (modified) (3 diffs)
-
handwritten/java/plugin/query/view/MartView.java (modified) (4 diffs)
-
handwritten/java/plugin/query/view/test.html (deleted)
-
handwritten/java/plugin/topmenu/ApiScreen.ftl (deleted)
-
handwritten/java/plugin/topmenu/ApiScreen.java (deleted)
-
handwritten/java/plugin/topmenu/DocumentationScreen.ftl (deleted)
-
handwritten/java/plugin/topmenu/DocumentationScreen.java (deleted)
-
handwritten/java/plugin/topmenu/LoginScreen.ftl (deleted)
-
handwritten/java/plugin/topmenu/LoginScreen.java (deleted)
-
handwritten/java/plugins (added)
-
handwritten/java/plugins/examples (added)
-
handwritten/java/plugins/examples/dbquery (copied) (copied from molgenis_distro/3.3/handwritten/java/plugin/examples/dbquery)
-
handwritten/java/plugins/examples/dbquery/ExperimentQueryModel.java (modified) (1 diff)
-
handwritten/java/plugins/examples/dbquery/ExperimentQueryPlugin.java (modified) (2 diffs)
-
handwritten/java/plugins/examples/file (copied) (copied from molgenis_distro/3.3/handwritten/java/plugin/examples/file)
-
handwritten/java/plugins/examples/file/FileServingPlugin.java (modified) (2 diffs)
-
handwritten/java/plugins/examples/helloworld (copied) (copied from molgenis_distro/3.3/handwritten/java/plugin/examples/helloworld)
-
handwritten/java/plugins/examples/helloworld/HelloWorldModel.java (modified) (1 diff)
-
handwritten/java/plugins/examples/helloworld/HelloWorldPlugin.java (modified) (2 diffs)
-
handwritten/java/plugins/examples/portal (copied) (copied from molgenis_distro/3.3/handwritten/java/plugin/examples/portal)
-
handwritten/java/plugins/examples/portal/PortalIntegrationPlugin.java (modified) (2 diffs)
-
handwritten/java/plugins/examples/switchmacro (moved) (moved from molgenis_distro/3.3/handwritten/java/plugin/examples/switchmacro)
-
handwritten/java/plugins/examples/switchmacro/SwitchPlugin.java (modified) (2 diffs)
-
handwritten/java/plugins/examples/wizard (copied) (copied from molgenis_distro/3.3/handwritten/java/plugin/examples/wizard)
-
handwritten/java/plugins/examples/wizard/WizardPlugin.java (modified) (2 diffs)
-
handwritten/java/plugins/header (added)
-
handwritten/java/plugins/header/MolgenisHeader.ftl (added)
-
handwritten/java/plugins/header/MolgenisHeader.java (added)
-
handwritten/java/plugins/login (moved) (moved from molgenis_distro/3.3/handwritten/java/plugin/login)
-
handwritten/java/plugins/login/DatabaseLogin.java (modified) (1 diff)
-
handwritten/java/plugins/query (added)
-
handwritten/java/plugins/query/meta (moved) (moved from molgenis_distro/3.3/handwritten/java/plugin/query/meta)
-
handwritten/java/plugins/query/meta/EntityMetaData.java (modified) (1 diff)
-
handwritten/java/plugins/query/meta/FieldMetaData.java (modified) (1 diff)
-
handwritten/java/plugins/query/meta/MetaDataException.java (modified) (1 diff)
-
handwritten/java/plugins/query/meta/MolgenisMetaData.java (modified) (1 diff)
-
handwritten/java/plugins/query/view (copied) (copied from molgenis_distro/3.3/handwritten/java/plugin/query/view)
-
handwritten/java/plugins/query/view/MartView.java (modified) (2 diffs)
-
handwritten/java/test/StaticMethods.java (added)
-
molgenis_db.xml (modified) (1 diff)
-
molgenis_ui.xml (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
molgenis_distro/3.3/WebContent/WEB-INF/web.xml
r2263 r2449 21 21 <servlet-name>MolgenisServlet</servlet-name> 22 22 <servlet-class>app.servlet.MolgenisServlet</servlet-class> 23 </servlet> 24 <servlet> 25 <description> 26 </description> 27 <display-name> 28 StaticMethods</display-name> 29 <servlet-name>StaticMethods</servlet-name> 30 <servlet-class> 31 test.StaticMethods</servlet-class> 23 32 </servlet> 24 33 … … 54 63 <servlet-name>MolgenisServlet</servlet-name> 55 64 <url-pattern>/download/*</url-pattern> 65 </servlet-mapping> 66 <servlet-mapping> 67 <servlet-name>StaticMethods</servlet-name> 68 <url-pattern>/StaticMethods</url-pattern> 56 69 </servlet-mapping> 57 70 </web-app> -
molgenis_distro/3.3/handwritten/java/MolgenisUpdateDatabase.java
r2349 r2449 6 6 import org.molgenis.MolgenisOptions; 7 7 8 import cmdline.CmdLineException;8 import org.molgenis.util.cmdline.CmdLineException; 9 9 10 10 public class MolgenisUpdateDatabase -
molgenis_distro/3.3/handwritten/java/plugin/examples/dbquery/ExperimentQueryPlugin.ftl
r2080 r2449 1 <#--this you need in every plugin. 2 Make sure the macro name is changed to match your plugin.--> 3 <#macro ExperimentQuery screen> 4 <#assign model = screen.model> 1 <#macro plugin_examples_dbquery_ExperimentQueryPlugin screen> 5 2 <!-- normally you make one big form for the whole plugin--> 6 3 <form method="post" enctype="multipart/form-data" name="${screen.name}"> … … 9 6 <!--needed in every form: to define the action. This can be set by the submit button--> 10 7 <input type="hidden" name="__action" /> 11 12 <#--begin your plugin--> 8 9 <!-- this shows a title and border --> 10 <div class="formscreen"> 11 <div class="form_header" id="${screen.getName()}"> 12 ${screen.label} 13 </div> 14 15 <#--optional: mechanism to show messages--> 16 <#list screen.getMessages() as message> 17 <#if message.success> 18 <p class="successmessage">${message.text}</p> 19 <#else> 20 <p class="errormessage">${message.text}</p> 21 </#if> 22 </#list> 23 24 <div class="screenbody"> 25 <div class="screenpadding"> 26 <#--begin your plugin--> 13 27 14 <!--show error message if needed--> 15 <#if model.errorMessage != ""><span style="color:red">Error: ${model.getErrorMessage()}!</span></#if> 16 <br/> 17 18 <!-- list of experiments--> 19 Below the list of known experiments: 20 <br/> 21 22 <!-- this plugin has a search option --> 23 <label>Search:</label><input name="search_terms" value="${model.searchTerms}"/> 24 <input type="submit" value="Search" onclick="__action.value='do_update_search';return true;"/> 25 <br/> 26 27 <!-- the list of experiments found--> 28 <ul> 29 <#list model.experiments as experiment> 30 <li>${experiment.name}</li> 31 </#list> 32 </ul> 33 <br/> 28 Create your plugin layout code here. 29 <#--<input name="myinput" value="${screen.getMyValue()}"> 30 <input type="submit" value="Change name" onclick="__action.value='do_myaction';return true;"/--> 34 31 35 36 32 <#--end of your plugin--> 37 33 </div> 34 </div> 35 </div> 38 36 </form> 39 37 </#macro> -
molgenis_distro/3.3/handwritten/java/plugin/examples/dbquery/ExperimentQueryPlugin.java
r2326 r2449 1 /* Date: November 15, 2009 2 * Template: PluginScreenJavaTemplateGen.java.ftl 3 * generator: org.molgenis.generators.ui.PluginScreenJavaTemplateGen 3.3.2-testing 4 * 5 * THIS FILE IS A TEMPLATE. PLEASE EDIT :-) 6 */ 7 1 8 package plugin.examples.dbquery; 2 9 3 import java.util.ArrayList;4 import java.util.List;5 6 10 import org.molgenis.framework.db.Database; 7 import org.molgenis.framework. db.Query;11 import org.molgenis.framework.ui.ScreenModel; 8 12 import org.molgenis.framework.ui.PluginModel; 9 import org.molgenis.framework.ui.ScreenModel;10 13 import org.molgenis.util.Tuple; 11 14 12 import example.Experiment; 13 14 public class ExperimentQueryPlugin extends PluginModel 15 public class ExperimentQueryPlugin extends PluginModel 15 16 { 16 private ExperimentQueryModel screenModel = new ExperimentQueryModel();17 18 17 public ExperimentQueryPlugin(String name, ScreenModel parent) 19 18 { … … 21 20 } 22 21 23 public ExperimentQueryModel getModel()24 {25 return screenModel;26 }27 28 22 @Override 29 23 public String getViewName() 30 24 { 31 return " ExperimentQuery";25 return "plugin_examples_dbquery_ExperimentQueryPlugin"; 32 26 } 33 27 … … 41 35 public void handleRequest(Database db, Tuple request) 42 36 { 43 logger.debug("handeling request in the ExperimentQueryPlugin"); 44 45 String action = request.getString(INPUT_ACTION); 46 if ("do_update_search".equals(action)) 47 { 48 logger.debug("handeling do_update_search request"); 49 if(request.getObject("search_terms") != null) 50 { 51 //search terms separated by " " 52 String[] filter_array = request.getString("search_terms").split(" "); 53 List<String> filters = new ArrayList<String>(); 54 for(String filter: filter_array) 55 { 56 //remove spaces using trim 57 filters.add(filter.trim()); 58 } 59 getModel().setFilters(filters); 60 } 61 else 62 { 63 //empty string 64 getModel().setFilters(new ArrayList<String>()); 65 } 66 } 67 37 //replace example below with yours 38 // try 39 // { 40 // Database db = this.getDatabase(); 41 // String action = request.getString("__action"); 42 // 43 // if( action.equals("do_add") ) 44 // { 45 // Experiment e = new Experiment(); 46 // e.set(request); 47 // db.add(e); 48 // } 49 // } catch(Exception e) 50 // { 51 // //e.g. show a message in your form 52 // } 68 53 } 69 54 … … 71 56 public void reload(Database db) 72 57 { 73 logger.debug("reloading the ExperimentQueryPlugin"); 74 75 //refresh query results, using filters if available 76 try 77 { 78 Query<Experiment> q = db.query(Experiment.class); 79 80 81 for(String filter: this.getModel().getFilters()) 82 { 83 q.like("Name",filter); 84 } 85 List<Experiment> experiments = q.find(); 86 87 this.getModel().setExperiments(experiments); 88 } 89 catch (Exception e) 90 { 91 getModel().setErrorMessage(e.getMessage()); 92 } 58 // try 59 // { 60 // Database db = this.getDatabase(); 61 // Query q = db.query(Experiment.class); 62 // q.like("name", "test"); 63 // List<Experiment> recentExperiments = q.find(); 64 // 65 // //do something 66 // } 67 // catch(Exception e) 68 // { 69 // //... 70 // } 93 71 } 94 72 73 @Override 74 public boolean isVisible() 75 { 76 //you can use this to hide this plugin, e.g. based on user rights. 77 //e.g. 78 //if(!this.getLogin().hasEditPermission(myEntity)) return false; 79 return true; 80 } 95 81 } -
molgenis_distro/3.3/handwritten/java/plugin/examples/file/FileServingPlugin.ftl
r2103 r2449 26 26 <#--begin your plugin--> 27 27 28 This plugin generated a local temp file at ${screen.localfile}.<br/> 29 You can download it at <a href="${screen.hyperlink}">${screen.hyperlink}</a>. 28 Create your plugin layout code here. 30 29 <#--<input name="myinput" value="${screen.getMyValue()}"> 31 30 <input type="submit" value="Change name" onclick="__action.value='do_myaction';return true;"/--> -
molgenis_distro/3.3/handwritten/java/plugin/examples/file/FileServingPlugin.java
r2326 r2449 1 /* Date: August 6, 20091 /* Date: November 15, 2009 2 2 * Template: PluginScreenJavaTemplateGen.java.ftl 3 * generator: org.molgenis.generators. screen.PluginScreenJavaTemplateGen 3.3.0-testing3 * generator: org.molgenis.generators.ui.PluginScreenJavaTemplateGen 3.3.2-testing 4 4 * 5 5 * THIS FILE IS A TEMPLATE. PLEASE EDIT :-) … … 8 8 package plugin.examples.file; 9 9 10 import java.io.BufferedWriter;11 import java.io.FileWriter;12 import java.io.IOException;13 14 10 import org.molgenis.framework.db.Database; 11 import org.molgenis.framework.ui.ScreenModel; 15 12 import org.molgenis.framework.ui.PluginModel; 16 import org.molgenis.framework.ui.ScreenMessage;17 import org.molgenis.framework.ui.ScreenModel;18 import org.molgenis.util.FileLink;19 13 import org.molgenis.util.Tuple; 20 14 21 15 public class FileServingPlugin extends PluginModel 22 16 { 23 String hyperlink;24 String localfile;25 26 public String getLocalfile()27 {28 return localfile;29 }30 31 public void setLocalfile(String localfile)32 {33 this.localfile = localfile;34 }35 36 public String getHyperlink()37 {38 return hyperlink;39 }40 41 public void setHyperlink(String hyperlink)42 {43 this.hyperlink = hyperlink;44 }45 46 17 public FileServingPlugin(String name, ScreenModel parent) 47 18 { … … 85 56 public void reload(Database db) 86 57 { 87 //generate a random file88 try89 {90 //todo: enable setting of extension.91 FileLink link = this.getTempFile();92 93 BufferedWriter out = new BufferedWriter(new FileWriter(link.getLocalpath()+".html"));94 out.write("This");95 out.newLine();96 out.write("is a");97 out.newLine();98 out.write("test");99 out.close();100 101 //set the link.102 this.setLocalfile(link.getLocalpath()+".html");103 this.setHyperlink(link.getLink()+".html");104 }105 catch (IOException e)106 {107 // TODO Auto-generated catch block108 this.setMessages(new ScreenMessage(e.getMessage(),false));109 e.printStackTrace();110 }111 112 113 114 58 // try 115 59 // { -
molgenis_distro/3.3/handwritten/java/plugin/examples/helloworld/HelloWorldPlugin.ftl
r2103 r2449 1 <!--Date: August 1, 20092 * Template: PluginScreenFTLTemplateGen.ftl.ftl3 * generator: org.molgenis.generators.screen.PluginScreenFTLTemplateGen 3.3.0-testing4 *5 * THIS FILE IS A TEMPLATE. PLEASE EDIT :-)6 -->7 1 <#macro plugin_examples_helloworld_HelloWorldPlugin screen> 8 2 <!-- normally you make one big form for the whole plugin--> … … 32 26 <#--begin your plugin--> 33 27 34 Hello World! 35 28 Create your plugin layout code here. 29 <#--<input name="myinput" value="${screen.getMyValue()}"> 30 <input type="submit" value="Change name" onclick="__action.value='do_myaction';return true;"/--> 31 36 32 <#--end of your plugin--> 37 33 </div> -
molgenis_distro/3.3/handwritten/java/plugin/examples/helloworld/HelloWorldPlugin.java
r2326 r2449 1 /* Date: November 15, 2009 2 * Template: PluginScreenJavaTemplateGen.java.ftl 3 * generator: org.molgenis.generators.ui.PluginScreenJavaTemplateGen 3.3.2-testing 4 * 5 * THIS FILE IS A TEMPLATE. PLEASE EDIT :-) 6 */ 7 1 8 package plugin.examples.helloworld; 2 9 3 10 import org.molgenis.framework.db.Database; 11 import org.molgenis.framework.ui.ScreenModel; 4 12 import org.molgenis.framework.ui.PluginModel; 5 import org.molgenis.framework.ui.ScreenModel; 6 import org.molgenis.util.Tuple; 13 import org.molgenis.util.Tuple; 7 14 8 15 public class HelloWorldPlugin extends PluginModel 9 16 { 10 private static final long serialVersionUID = 5944394444180239960L;11 private HelloWorldModel screenModel = new HelloWorldModel();12 13 17 public HelloWorldPlugin(String name, ScreenModel parent) 14 18 { … … 25 29 public String getViewTemplate() 26 30 { 27 // TODO Auto-generated method stub28 31 return "plugin/examples/helloworld/HelloWorldPlugin.ftl"; 29 32 } … … 32 35 public void handleRequest(Database db, Tuple request) 33 36 { 34 this.logger.debug("handeling request in the plugin"); 35 36 String action = request.getString(INPUT_ACTION); 37 if ("do_update_name".equals(action)) 38 { 39 this.logger.debug("handeling update_name request"); 40 getModel().setName(request.getString("new_name")); 41 } 37 //replace example below with yours 38 // try 39 // { 40 // Database db = this.getDatabase(); 41 // String action = request.getString("__action"); 42 // 43 // if( action.equals("do_add") ) 44 // { 45 // Experiment e = new Experiment(); 46 // e.set(request); 47 // db.add(e); 48 // } 49 // } catch(Exception e) 50 // { 51 // //e.g. show a message in your form 52 // } 42 53 } 43 54 … … 45 56 public void reload(Database db) 46 57 { 47 //nothing to do here, see ExperimentPlugin for example on database interaction. 58 // try 59 // { 60 // Database db = this.getDatabase(); 61 // Query q = db.query(Experiment.class); 62 // q.like("name", "test"); 63 // List<Experiment> recentExperiments = q.find(); 64 // 65 // //do something 66 // } 67 // catch(Exception e) 68 // { 69 // //... 70 // } 48 71 } 49 50 /** 51 * Although not required, it is good practice to put the 'state' of the 52 * application in separate object. This separation between controller (in 53 * 'this') and the model (in the 'model') makes the code easier to 54 * understand. The third component of this M(odel)V(iew)C(ontroller) is in 55 * the template that holds the 'view', that is the layout of the model. 56 */ 57 public HelloWorldModel getModel() 72 73 @Override 74 public boolean isVisible() 58 75 { 59 return this.screenModel; 76 //you can use this to hide this plugin, e.g. based on user rights. 77 //e.g. 78 //if(!this.getLogin().hasEditPermission(myEntity)) return false; 79 return true; 60 80 } 61 62 81 } -
molgenis_distro/3.3/handwritten/java/plugin/examples/portal/PortalIntegrationPlugin.ftl
r2103 r2449 26 26 <#--begin your plugin--> 27 27 28 <iframe src="${screen.getUrl()}" width="${screen.getWidth()}" height="${screen.getHeight()}" frameborder="0">\ 29 </iframe> 30 28 Create your plugin layout code here. 29 <#--<input name="myinput" value="${screen.getMyValue()}"> 30 <input type="submit" value="Change name" onclick="__action.value='do_myaction';return true;"/--> 31 31 32 <#--end of your plugin--> 32 33 </div> -
molgenis_distro/3.3/handwritten/java/plugin/examples/portal/PortalIntegrationPlugin.java
r2326 r2449 1 /* Date: November 15, 2009 2 * Template: PluginScreenJavaTemplateGen.java.ftl 3 * generator: org.molgenis.generators.ui.PluginScreenJavaTemplateGen 3.3.2-testing 4 * 5 * THIS FILE IS A TEMPLATE. PLEASE EDIT :-) 6 */ 7 1 8 package plugin.examples.portal; 2 9 3 10 import org.molgenis.framework.db.Database; 11 import org.molgenis.framework.ui.ScreenModel; 4 12 import org.molgenis.framework.ui.PluginModel; 5 import org.molgenis.framework.ui.ScreenModel;6 13 import org.molgenis.util.Tuple; 7 14 8 public class PortalIntegrationPlugin extends PluginModel 15 public class PortalIntegrationPlugin extends PluginModel 9 16 { 10 //edit this to accomodate the desired iframe portal11 private String url = "http://www.google.com";12 13 private String width = "100%";14 private String height = "400px";15 16 private static final long serialVersionUID = 5944394444180239960L;17 18 17 public PortalIntegrationPlugin(String name, ScreenModel parent) 19 18 { … … 24 23 public String getViewName() 25 24 { 26 //this will call the macro in the template, see below27 25 return "plugin_examples_portal_PortalIntegrationPlugin"; 28 26 } … … 31 29 public String getViewTemplate() 32 30 { 33 //you need to edit this if your plugin path changes...34 31 return "plugin/examples/portal/PortalIntegrationPlugin.ftl"; 35 32 } … … 38 35 public void handleRequest(Database db, Tuple request) 39 36 { 40 //nothing to do here. 37 //replace example below with yours 38 // try 39 // { 40 // Database db = this.getDatabase(); 41 // String action = request.getString("__action"); 42 // 43 // if( action.equals("do_add") ) 44 // { 45 // Experiment e = new Experiment(); 46 // e.set(request); 47 // db.add(e); 48 // } 49 // } catch(Exception e) 50 // { 51 // //e.g. show a message in your form 52 // } 41 53 } 42 54 … … 44 56 public void reload(Database db) 45 57 { 46 //nothing to do here 47 //could ask parent form for parameter, e.g. 48 49 //this is the path to the parent form you want to link from: 50 //FormScreen<Experiment> parentForm = ((FormScreen<Experiment>)this.get(height) 51 52 //this is the visible record: 53 //Experiment e = parentForm.getRecords().get(0); 54 55 //create an url from it: 56 //this.url = "http://pathtomyscript?parameter="+e.getId(); 57 58 this.url = "http://www.google.com"; 59 58 // try 59 // { 60 // Database db = this.getDatabase(); 61 // Query q = db.query(Experiment.class); 62 // q.like("name", "test"); 63 // List<Experiment> recentExperiments = q.find(); 64 // 65 // //do something 66 // } 67 // catch(Exception e) 68 // { 69 // //... 70 // } 60 71 } 61 72 62 //BORING GETTERS BELOW 63 public String getUrl()73 @Override 74 public boolean isVisible() 64 75 { 65 return url; 76 //you can use this to hide this plugin, e.g. based on user rights. 77 //e.g. 78 //if(!this.getLogin().hasEditPermission(myEntity)) return false; 79 return true; 66 80 } 67 68 public String getWidth()69 {70 return width;71 }72 73 public String getHeight()74 {75 return height;76 }77 78 79 81 } -
molgenis_distro/3.3/handwritten/java/plugin/examples/wizard/WizardPlugin.ftl
r2080 r2449 1 <!--Date: July 24, 20092 * Template: PluginScreenFTLTemplateGen.ftl.ftl3 * generator: org.molgenis.generators.screen.PluginScreenFTLTemplateGen 3.3.0-testing4 *5 * THIS FILE IS A TEMPLATE. PLEASE EDIT :-)6 -->7 1 <#macro plugin_examples_wizard_WizardPlugin screen> 8 2 <!-- normally you make one big form for the whole plugin--> … … 12 6 <!--needed in every form: to define the action. This can be set by the submit button--> 13 7 <input type="hidden" name="__action" /> 14 8 15 9 <!-- this shows a title and border --> 16 10 <div class="formscreen"> … … 32 26 <#--begin your plugin--> 33 27 34 <table> 35 <#list screen.inputs as input> 36 <tr><td><label>${input.label}</label></td><td>${input.html}</td></tr> 37 </#list> 38 </table> 39 40 <#list screen.actions as action> 41 ${action.html} 42 </#list> 28 Create your plugin layout code here. 29 <#--<input name="myinput" value="${screen.getMyValue()}"> 30 <input type="submit" value="Change name" onclick="__action.value='do_myaction';return true;"/--> 43 31 44 32 <#--end of your plugin--> -
molgenis_distro/3.3/handwritten/java/plugin/examples/wizard/WizardPlugin.java
r2326 r2449 1 /* Date: July 24, 20091 /* Date: November 15, 2009 2 2 * Template: PluginScreenJavaTemplateGen.java.ftl 3 * generator: org.molgenis.generators. screen.PluginScreenJavaTemplateGen 3.3.0-testing3 * generator: org.molgenis.generators.ui.PluginScreenJavaTemplateGen 3.3.2-testing 4 4 * 5 5 * THIS FILE IS A TEMPLATE. PLEASE EDIT :-) … … 8 8 package plugin.examples.wizard; 9 9 10 import java.util.ArrayList;11 import java.util.List;12 13 10 import org.molgenis.framework.db.Database; 14 import org.molgenis.framework.db.QueryRule; 15 import org.molgenis.framework.db.QueryRule.Operator; 11 import org.molgenis.framework.ui.ScreenModel; 16 12 import org.molgenis.framework.ui.PluginModel; 17 import org.molgenis.framework.ui.ScreenModel;18 import org.molgenis.framework.ui.html.ActionInput;19 import org.molgenis.framework.ui.html.HtmlInput;20 import org.molgenis.framework.ui.html.MrefInput;21 import org.molgenis.framework.ui.html.XrefInput;22 13 import org.molgenis.util.Tuple; 23 14 24 import example.Experiment;25 import example.Sample;26 27 15 public class WizardPlugin extends PluginModel 28 { 29 //remember current step of this wizard 30 private int step = 1; 31 //form currently to be shown 32 private List<HtmlInput> inputs = new ArrayList<HtmlInput>(); 33 //actions to be shown 34 private List<HtmlInput> actions = new ArrayList<HtmlInput>(); 35 36 //values to be collected 37 Integer experimentId = null; 38 39 16 { 40 17 public WizardPlugin(String name, ScreenModel parent) 41 18 { … … 58 35 public void handleRequest(Database db, Tuple request) 59 36 { 60 String action = request.getAction(); 61 if("goto_step2".equals(action)) 62 { 63 //validate the input 64 //... 65 experimentId = request.getInt("experiment_id"); 66 67 //goto step 2 68 step = 2; 69 } 70 else if("back".equals(action)) 71 { 72 if(step > 1) step--; 73 } 74 else if("reset".equals(action)) 75 { 76 experimentId = null; 77 step = 1; 78 } 37 //replace example below with yours 38 // try 39 // { 40 // Database db = this.getDatabase(); 41 // String action = request.getString("__action"); 42 // 43 // if( action.equals("do_add") ) 44 // { 45 // Experiment e = new Experiment(); 46 // e.set(request); 47 // db.add(e); 48 // } 49 // } catch(Exception e) 50 // { 51 // //e.g. show a message in your form 52 // } 79 53 } 80 54 … … 82 56 public void reload(Database db) 83 57 { 84 //clear wizard 85 inputs.clear(); 86 actions.clear(); 87 88 //step 1: choose experiment 89 if(step == 1) 90 { 91 //add chooser for experiments 92 XrefInput selectExperiment = new XrefInput("experiment_id",experimentId); 93 selectExperiment.setXrefEntity(Experiment.class); 94 selectExperiment.setXrefLabel("name"); 95 selectExperiment.setXrefField("id"); 96 selectExperiment.setTooltip("choose one experiment and click next"); 97 98 inputs.add(selectExperiment); 99 100 //add action to go next 101 ActionInput next = new ActionInput("goto_step2"); 102 next.setLabel("next"); 103 104 actions.add(next); 105 } 106 107 //step 2: choose samples from this experiment 108 else if(step == 2) 109 { 110 MrefInput selectSample = new MrefInput("sample_ids",null); 111 selectSample.setXrefEntity(Sample.class); 112 //todo: automate the filling in of label and field 113 //add therefore default xref_label to <entity xref_label = ... 114 selectSample.setXrefLabel("name"); 115 selectSample.setXrefField("id"); 116 selectSample.setXrefFilters(new QueryRule("experiment",Operator.EQUALS, experimentId)); 117 selectSample.setTooltip("choose one or more samples and click next"); 118 119 inputs.add(selectSample); 120 121 //add action to go next, and back 122 ActionInput next = new ActionInput("goto_step2"); 123 next.setLabel("next"); 124 ActionInput back = new ActionInput("back"); 125 back.setLabel("back"); 126 127 actions.add(next); 128 actions.add(back); 129 } 130 131 //step 3: generate a datase 132 58 // try 59 // { 60 // Database db = this.getDatabase(); 61 // Query q = db.query(Experiment.class); 62 // q.like("name", "test"); 63 // List<Experiment> recentExperiments = q.find(); 64 // 65 // //do something 66 // } 67 // catch(Exception e) 68 // { 69 // //... 70 // } 133 71 } 134 72 … … 141 79 return true; 142 80 } 143 144 public List<HtmlInput> getInputs()145 {146 return inputs;147 }148 149 public void setInputs(List<HtmlInput> inputs)150 {151 this.inputs = inputs;152 }153 154 public List<HtmlInput> getActions()155 {156 return actions;157 }158 159 public void setActions(List<HtmlInput> actions)160 {161 this.actions = actions;162 }163 81 } -
molgenis_distro/3.3/handwritten/java/plugin/query/view/MartView.ftl
r2103 r2449 1 <!--Date: May 10, 20092 * Template: PluginScreenFTLTemplateGen.ftl.ftl3 * generator: org.molgenis.generators.screen.PluginScreenFTLTemplateGen 3.3.0-testing4 *5 * THIS FILE IS A TEMPLATE. PLEASE EDIT :-)6 -->7 1 <#macro plugin_query_view_MartView screen> 8 2 <!-- normally you make one big form for the whole plugin--> … … 18 12 ${screen.label} 19 13 </div> 20 14 21 15 <#--optional: mechanism to show messages--> 22 16 <#list screen.getMessages() as message> … … 30 24 <div class="screenbody"> 31 25 <div class="screenpadding"> 32 < script>26 <#--begin your plugin--> 33 27 34 35 36 </script> 37 38 39 <#--begin your plugin--> 40 Current query: 41 <#if screen.sql?exists>${screen.sql}<#else>NONE</#if> 42 <br/> 43 <#list screen.entities as entity> 44 ${entity.name}<br/> 45 <#list entity.fields as field> 46 <input type="checkbox" name="select_field" VALUE="${entity.name}.${field.name}">${field.name}<br/> 47 </#list> 48 </#list> 49 <input type="submit" onclick="__action.value='update_selection';return true;" value="update_selection"/> 50 51 <#--<table> 52 <#list screen.inputs as input> 53 <tr><td><label>${input.label}</label></td><td>${input.html}</td></tr> 54 </#list> 55 <table> 56 <#list screen.actions as action>${action.html}</#list--> 28 Create your plugin layout code here. 29 <#--<input name="myinput" value="${screen.getMyValue()}"> 30 <input type="submit" value="Change name" onclick="__action.value='do_myaction';return true;"/--> 57 31 58 32 <#--end of your plugin--> -
molgenis_distro/3.3/handwritten/java/plugin/query/view/MartView.java
r2349 r2449 1 /* Date: May 10, 20091 /* Date: November 15, 2009 2 2 * Template: PluginScreenJavaTemplateGen.java.ftl 3 * generator: org.molgenis.generators. screen.PluginScreenJavaTemplateGen 3.3.0-testing3 * generator: org.molgenis.generators.ui.PluginScreenJavaTemplateGen 3.3.2-testing 4 4 * 5 5 * THIS FILE IS A TEMPLATE. PLEASE EDIT :-) … … 8 8 package plugin.query.view; 9 9 10 import java.util.ArrayList;11 import java.util.List;12 13 import org.molgenis.framework.db.JoinQuery;14 10 import org.molgenis.framework.db.Database; 11 import org.molgenis.framework.ui.ScreenModel; 15 12 import org.molgenis.framework.ui.PluginModel; 16 import org.molgenis.framework.ui.ScreenMessage;17 import org.molgenis.framework.ui.ScreenModel;18 import org.molgenis.model.elements.Entity;19 import org.molgenis.model.elements.Model;20 13 import org.molgenis.util.Tuple; 21 14 22 15 public class MartView extends PluginModel 23 16 { 24 //layout:25 //left a 'data model browser' with all entities and fields26 //right 'count/list preview' of the selected result27 //initially refresh action executes this as it may take some time28 29 //data model browser dialog:30 //selection to show all or selected only31 //all fields are shown in a tree with entities as nodes32 //mouse over or [?] shows annotation33 //a field can be ticked to be selected34 //a field can be ticked to create a filter rule35 //left join is assumed -> otherwise a rule can be set?36 37 //count/list preview:38 //headers show selected fields including joinpath in small39 //columns can be moved in the resultset to change column ordering40 //columns can be set to be sorted (asc/desc)41 //pagination is assumed and suitable limits set (e.g. 100)42 43 //filters dialog:44 //a ticked field can be enhanced with a filter45 //future: each filter has a name A or B and C46 //filter depends on the type47 //-> enum/xrefs are listed with appropriate dialogs48 //-> equals filters can have multiple values seperated by spaces or ','49 //-> date shows date dialogue50 //inverse xrefs are shown as optional related elements (subnodes of tree)51 52 53 //step one: show a set of main nodes to choose from54 //only one root node can be opened at one time55 //from each node there can be an endless path (except circular references)56 57 58 //from one selected node, show a tree of related entities (nodes) and fields (leafs)59 //each entity is shown closed but can be opened up for adding its fields60 //this depends whether the61 //each action should send to server which nodes are opened62 63 //a query is a variant of this tree with selected fields64 65 private List<String> selectedFields = new ArrayList<String>();66 private List<Entity> entities = new ArrayList<Entity>();67 private String sql = "NONE";68 69 70 public List<Entity> getEntities()71 {72 return entities;73 }74 75 public void setEntities(List<Entity> entities)76 {77 this.entities = entities;78 }79 80 17 public MartView(String name, ScreenModel parent) 81 18 { 82 19 super(name, parent); 83 } 20 } 84 21 85 22 @Override … … 98 35 public void handleRequest(Database db, Tuple request) 99 36 { 100 logger.debug("Handle request "+request); 101 // set field selection 102 if ("update_selection".equals(request.getAction())) 103 { 104 logger.debug("update selection"); 105 selectedFields.clear(); 106 if (request.getObject("select_field") != null) 107 { 108 logger.debug("add field"); 109 for (Object f : request.getList("select_field")) 110 selectedFields.add((String) f); 111 } 112 } 113 else if ("clear_selection".equals(request.getAction())) 114 { 115 selectedFields.clear(); 116 } 117 118 // replace example below with yours 119 // try 120 // { 121 // Database db = this.getDatabase(); 122 // String action = request.getString("__action"); 123 // 124 // if( action.equals("do_add") ) 125 // { 126 // Experiment e = new Experiment(); 127 // e.set(request); 128 // db.add(e); 129 // } 130 // } catch(Exception e) 131 // { 132 // //e.g. show a message in your form 133 // } 37 //replace example below with yours 38 // try 39 // { 40 // Database db = this.getDatabase(); 41 // String action = request.getString("__action"); 42 // 43 // if( action.equals("do_add") ) 44 // { 45 // Experiment e = new Experiment(); 46 // e.set(request); 47 // db.add(e); 48 // } 49 // } catch(Exception e) 50 // { 51 // //e.g. show a message in your form 52 // } 134 53 } 135 54 … … 137 56 public void reload(Database db) 138 57 { 139 try 140 { 141 Model m = db.getMetaData(); 142 entities = m.getEntities(); 143 144 JoinQuery q = new JoinQuery(db,selectedFields); 145 this.sql = q.toFindSql(); 146 147 } 148 catch (Exception e) 149 { 150 this.setMessages(new ScreenMessage(e.getMessage(),false)); 151 this.sql="NONE"; 152 e.printStackTrace(); 153 } 154 155 // try 156 // { 157 // Database db = this.getDatabase(); 158 // Query q = db.query(Experiment.class); 159 // q.like("name", "test"); 160 // List<Experiment> recentExperiments = q.find(); 161 // 162 // //do something 163 // } 164 // catch(Exception e) 165 // { 166 // //... 167 // } 58 // try 59 // { 60 // Database db = this.getDatabase(); 61 // Query q = db.query(Experiment.class); 62 // q.like("name", "test"); 63 // List<Experiment> recentExperiments = q.find(); 64 // 65 // //do something 66 // } 67 // catch(Exception e) 68 // { 69 // //... 70 // } 168 71 } 169 170 public String getSql() 171 { 172 return sql; 173 } 174 175 public void setSql(String sql) 176 { 177 this.sql = sql; 178 } 179 72 180 73 @Override 181 74 public boolean isVisible() 182 75 { 183 // you can use this to hide this plugin, e.g. based on user rights.184 // e.g.185 // if(!this.getLogin().hasEditPermission(myEntity)) return false;76 //you can use this to hide this plugin, e.g. based on user rights. 77 //e.g. 78 //if(!this.getLogin().hasEditPermission(myEntity)) return false; 186 79 return true; 187 80 } 188 189 // public List<HtmlInput> getInputs()190 // {191 // List<HtmlInput> inputs = new ArrayList<HtmlInput>();192 // for (EntityMetaData em : model.getEntities())193 // {194 // for (FieldMetaData fm : em.getAllFields())195 // {196 // String field = em.getName() + "." + fm.getName();197 // OnoffInput bi = new OnoffInput("field", selectedFields.contains(field));198 // bi.setOnValue(field);199 // bi.setLabel(field);200 // inputs.add(bi);201 // }202 // }203 //204 // return inputs;205 // }206 //207 // public List<HtmlInput> getActions()208 // {209 // List<HtmlInput> inputs = new ArrayList<HtmlInput>();210 // inputs.add(new ActionInput("add fields"));211 // inputs.add(new ActionInput("clear fields"));212 // return inputs;213 // }214 //215 // public MolgenisMetaData getModel()216 // {217 // // load the metadata218 // Model m;219 // try220 // {221 // URL u = MartView.class.getResource("molgenis.properties");222 // // File f = new File(u.getFile());223 // // Properties p = new Properties();224 // // p.load(new FileInputStream(f));225 // m = MolgenisLanguage.parse(new MolgenisOptions(u.getFile()));226 // return new MolgenisMetaDataImp(m);227 // }228 // catch (Exception e)229 // {230 // // TODO Auto-generated catch block231 // e.printStackTrace();232 // }233 // return null;234 // }235 //236 // public String getSql()237 // {238 // try239 // {240 // CustomQuery q = new CustomQuery(model);241 // q.setFields(selectedFields.toArray(new String[selectedFields.size()]));242 // return q.toFindSql();243 // }244 // catch (Exception e)245 // {246 // //e.printStackTrace();247 // return e.getMessage();248 // }249 // }250 81 } -
molgenis_distro/3.3/handwritten/java/plugins/examples/dbquery/ExperimentQueryModel.java
r2263 r2449 1 package plugin .examples.dbquery;1 package plugins.examples.dbquery; 2 2 3 3 import java.util.ArrayList; -
molgenis_distro/3.3/handwritten/java/plugins/examples/dbquery/ExperimentQueryPlugin.java
r2326 r2449 1 package plugin .examples.dbquery;1 package plugins.examples.dbquery; 2 2 3 3 import java.util.ArrayList; … … 35 35 public String getViewTemplate() 36 36 { 37 return "plugin /examples/dbquery/ExperimentQueryPlugin.ftl";37 return "plugins/examples/dbquery/ExperimentQueryPlugin.ftl"; 38 38 } 39 39 -
molgenis_distro/3.3/handwritten/java/plugins/examples/file/FileServingPlugin.java
r2326 r2449 6 6 */ 7 7 8 package plugin .examples.file;8 package plugins.examples.file; 9 9 10 10 import java.io.BufferedWriter; … … 58 58 public String getViewTemplate() 59 59 { 60 return "plugin /examples/file/FileServingPlugin.ftl";60 return "plugins/examples/file/FileServingPlugin.ftl"; 61 61 } 62 62 -
molgenis_distro/3.3/handwritten/java/plugins/examples/helloworld/HelloWorldModel.java
r2079 r2449 1 package plugin .examples.helloworld;1 package plugins.examples.helloworld; 2 2 3 3 public class HelloWorldModel -
molgenis_distro/3.3/handwritten/java/plugins/examples/helloworld/HelloWorldPlugin.java
r2326 r2449 1 package plugin .examples.helloworld;1 package plugins.examples.helloworld; 2 2 3 3 import org.molgenis.framework.db.Database; … … 26 26 { 27 27 // TODO Auto-generated method stub 28 return "plugin /examples/helloworld/HelloWorldPlugin.ftl";28 return "plugins/examples/helloworld/HelloWorldPlugin.ftl"; 29 29 } 30 30 -
molgenis_distro/3.3/handwritten/java/plugins/examples/portal/PortalIntegrationPlugin.java
r2326 r2449 1 package plugin .examples.portal;1 package plugins.examples.portal; 2 2 3 3 import org.molgenis.framework.db.Database; … … 32 32 { 33 33 //you need to edit this if your plugin path changes... 34 return "plugin /examples/portal/PortalIntegrationPlugin.ftl";34 return "plugins/examples/portal/PortalIntegrationPlugin.ftl"; 35 35 } 36 36 -
molgenis_distro/3.3/handwritten/java/plugins/examples/switchmacro/SwitchPlugin.java
r2326 r2449 6 6 */ 7 7 8 package plugin .examples.switchmacro;8 package plugins.examples.switchmacro; 9 9 10 10 import org.molgenis.framework.db.Database; … … 37 37 public String getViewTemplate() 38 38 { 39 return "plugin /examples/test/SwitchPlugin.ftl";39 return "plugins/examples/test/SwitchPlugin.ftl"; 40 40 } 41 41 -
molgenis_distro/3.3/handwritten/java/plugins/examples/wizard/WizardPlugin.java
r2326 r2449 6 6 */ 7 7 8 package plugin .examples.wizard;8 package plugins.examples.wizard; 9 9 10 10 import java.util.ArrayList; … … 52 52 public String getViewTemplate() 53 53 { 54 return "plugin /examples/wizard/WizardPlugin.ftl";54 return "plugins/examples/wizard/WizardPlugin.ftl"; 55 55 } 56 56 -
molgenis_distro/3.3/handwritten/java/plugins/login/DatabaseLogin.java
r2303 r2449 1 package plugin .login;1 package plugins.login; 2 2 3 3 import java.text.ParseException; -
molgenis_distro/3.3/handwritten/java/plugins/query/meta/EntityMetaData.java
r2067 r2449 1 package plugin .query.meta;1 package plugins.query.meta; 2 2 3 3 import java.util.List; -
molgenis_distro/3.3/handwritten/java/plugins/query/meta/FieldMetaData.java
r2067 r2449 1 package plugin .query.meta;1 package plugins.query.meta; 2 2 3 3 -
molgenis_distro/3.3/handwritten/java/plugins/query/meta/MetaDataException.java
r2067 r2449 1 package plugin .query.meta;1 package plugins.query.meta; 2 2 3 3 public class MetaDataException extends Exception { -
molgenis_distro/3.3/handwritten/java/plugins/query/meta/MolgenisMetaData.java
r2067 r2449 1 package plugin .query.meta;1 package plugins.query.meta; 2 2 3 3 import java.util.List; -
molgenis_distro/3.3/handwritten/java/plugins/query/view/MartView.java
r2349 r2449 6 6 */ 7 7 8 package plugin .query.view;8 package plugins.query.view; 9 9 10 10 import java.util.ArrayList; … … 92 92 public String getViewTemplate() 93 93 { 94 return "plugin /query/view/MartView.ftl";94 return "plugins/query/view/MartView.ftl"; 95 95 } 96 96 -
molgenis_distro/3.3/molgenis_db.xml
r2415 r2449 33 33 <field name="Sex" type="enum" enum_options="[male,female,unknown]" 34 34 description="Fixed choice on Sex" /> 35 <field name="Experiment" type="xref" xref_field="Experiment.Id" 35 <field name="Experiment" type="xref" xref_field="Experiment.Id" xref_label="Name" 36 36 description="Samples are part-of one experiment (by cross reference to Experiment.id)" /> 37 37 <field name="SampleTime" type="datetime"/> -
molgenis_distro/3.3/molgenis_ui.xml
r2134 r2449 5 5 --> 6 6 <molgenis name="example"> 7 <menu name="topmenu" position="top_right" startwith="Login"> 8 <menu name="Main" position="left"> 9 <form name="Experiment" entity="Experiment"> 10 <menu name="ExperimentMenu" position="top_left"> 11 <form name="Samples" entity="Sample" view="list" /> 12 <form name="Traits" entity="Trait" view="list" /> 13 <form name="Measurements" entity="Measurement"> 14 <form name="Data" entity="Data" /> 15 </form> 16 </menu> 17 </form> 18 <menu name="pluginexamples" label="Plugin examples"> 19 <plugin name="Google" type="plugin.examples.portal.PortalIntegrationPlugin" /> 20 <plugin name="HelloWorld" type="plugin.examples.helloworld.HelloWorldPlugin" /> 21 <plugin name="ExperimentQuery" type="plugin.examples.dbquery.ExperimentQueryPlugin" /> 22 <plugin name="WizardPlugin" type="plugin.examples.wizard.WizardPlugin" /> 23 <plugin name="FileServingPlugin" type="plugin.examples.file.FileServingPlugin"/> 7 <plugin name="molgenis_header" type="plugins.header.MolgenisHeader" /> 8 <menu name="Main" position="left"> 9 <form name="Experiments" entity="Experiment"> 10 <menu name="ExperimentMenu" position="top_left"> 11 <form name="Samples" entity="Sample" view="list" /> 12 <form name="Traits" entity="Trait" view="list" /> 13 <form name="Measurements" entity="Measurement"> 14 <form name="Data" entity="Data" /> 15 </form> 24 16 </menu> 25 <plugin name="MartView" type="plugin.query.view.MartView"/> 26 <!-- 27 <report name="alldata" 28 fields="sample.name,trait.name,measurement.value" 29 labels="sample,trait,value" /> <report name="bigvalues"> <output 30 name="sample.name" /> <output name="trait.name" /> <output 31 name="measurement.value" /> <fiter>measurement.value > 10</fiter> 32 </report> <report name="countsamples" 33 fields="investigation.name,count(sample.id)"/> 34 --> 35 <!-- plugin name="martview" type="plugin.query.view.MartView"/--> 17 </form> 18 <menu name="pluginexamples" label="Plugin examples"> 19 <plugin name="Google" type="plugin.examples.portal.PortalIntegrationPlugin" /> 20 <plugin name="HelloWorld" type="plugin.examples.helloworld.HelloWorldPlugin" /> 21 <plugin name="ExperimentQuery" type="plugin.examples.dbquery.ExperimentQueryPlugin" /> 22 <plugin name="WizardPlugin" type="plugin.examples.wizard.WizardPlugin" /> 23 <plugin name="FileServingPlugin" type="plugin.examples.file.FileServingPlugin" /> 36 24 </menu> 37 <plugin name="model_documentation" label="Documentation" type="plugin.topmenu.DocumentationScreen"/> 38 <plugin name="APIs" label="Programming Interfaces" type="plugin.topmenu.ApiScreen"/> 39 <plugin name="Login" label="Login" type="plugin.topmenu.LoginScreen"/> 25 <plugin name="MartView" type="plugin.query.view.MartView" /> 26 <!-- 27 <report name="alldata" fields="sample.name,trait.name,measurement.value" 28 labels="sample,trait,value" /> <report name="bigvalues"> <output 29 name="sample.name" /> <output name="trait.name" /> <output 30 name="measurement.value" /> <fiter>measurement.value > 10</fiter> 31 </report> <report name="countsamples" 32 fields="investigation.name,count(sample.id)"/> 33 --> 34 <!-- plugin name="martview" type="plugin.query.view.MartView"/--> 40 35 </menu> 41 36 </molgenis>
Note: See TracChangeset
for help on using the changeset viewer.