TracNav
Table of Contents
Introduction
MOLGENIS application overview
- Browsing and editing
- CSV file loading
- Connecting to R
- Connecting to SOAP web services
- Connecting to REST web services using CURL
- Molgenis as a datasource for Galaxy
Toolkit Installation
- Preperation on Windows
- Preperation on Ubuntu/Linux
- Installation of Eclipse/Galileo
- Installation of Eclipse/Helios
- Download MOLGENIS
Generating your own applications
- MOLGENIS workspace basics
- Running the generator
- Modeling a new MOLGENIS
- Modeling an existing database
- molgenis.properties file
Adding plug-ins
Building on the MOLGENIS framework
MOLGENIS Data Modeling Language Reference
MOLGENIS User Interface Modeling Language Reference
MOLGENIS framework API
Frequently asked questions
- How to change molgenis url from /molgenis_distro to xyz
- How to change the MolgenisServlet, e.g. to add more services
- How to extend an existing database model
- Case sensitivity and issues between windows, linux and mac
- How to create a hyperlink from plugin to another form
- How to create a hyperlink from plugin to another form
- How to create a hyperlink from plugin to another form
Adding Custom buttons to the generated code
Each button in the auto-generated MOLGENIS user interface is actually an implementation of the ScreenCommand. Examples of these commands can be found here. Note how each command defines its behavior.
MOLGENIS users can customize the generated user interface by adding more commands or even replacing the standard commands. Below is described how.
1. Define the custom commands in your *ui.xml
To add custom buttons one needs to define references to the ScreenCommand subclasses you implemented as button. That is done as follows:
<form name="Experiments" entity="Experiment" commands="commands.MyCommand">
Multiple commands can be added using ',' seperation, e.g.
<form name="Experiments" entity="Experiment" commands="commands.MyCommand,commands.MyCommand2">
2. Implement the button
Secondly the referenced classes need to be implemented. This can be done by subclassing an existing command and overriding its main methods. Users interested to create a command from scratch can extends from the generic SimpleCommand.
Example of extending the 'AddCommand':
package commands; import java.io.IOException; import java.io.PrintWriter; import java.text.ParseException; import java.util.List; import org.molgenis.framework.db.Database; import org.molgenis.framework.db.DatabaseException; import org.molgenis.framework.ui.FormModel; import org.molgenis.framework.ui.ScreenModel; import org.molgenis.framework.ui.ScreenModel.Show; import org.molgenis.framework.ui.commands.AddCommand; import org.molgenis.framework.ui.html.ActionInput; import org.molgenis.framework.ui.html.HtmlInput; import org.molgenis.util.Tuple; import app.ui.ExperimentsForm; /** * Customized version of the 'Add' command. */ public class MyCommand extends AddCommand { public MyCommand(FormModel s) { //override the standard add function super("edit_new", s); } @Override public List<HtmlInput> getInputs() throws DatabaseException { //reuse the inputs from Experiment List<HtmlInput> inputs = new ExperimentsForm().getInputs(); //you could now replace some of these inputs with your own //e.g. create a custom 'PubmedInput' inputs.add(new PubmedInput("pubmed")); return inputs; } @Override public List<HtmlInput> getActions() { //get the standard inputs List<HtmlInput> actions = super.getActions(); //add an extra button // ActionInput close = new ActionInput("close"); // close.setIcon("path/to/image"); // close.setLabel("My Command Example"); // actions.add(close); return actions; } @Override public ScreenModel.Show handleRequest(Database db, Tuple request, PrintWriter downloadStream) throws ParseException, DatabaseException, IOException { Show result = super.handleRequest(db, request, downloadStream); //return SHOW_MAIN if this request should be handled in the main screen //return SHOW_DIALOG if you want to keep the dialog open return result; } }