Changeset 2680 for molgenis_distro
- Timestamp:
- 03/08/10 13:32:16 (2 years ago)
- Location:
- molgenis_distro/3.3/handwritten/java/commands
- Files:
-
- 1 added
- 1 edited
-
MyCommand.java (modified) (2 diffs)
-
PubmedInput.java (added)
Legend:
- Unmodified
- Added
- Removed
-
molgenis_distro/3.3/handwritten/java/commands/MyCommand.java
r2416 r2680 1 1 package commands; 2 2 3 import java.util.ArrayList; 3 import java.io.IOException; 4 import java.io.PrintWriter; 5 import java.text.ParseException; 4 6 import java.util.List; 5 7 8 import org.molgenis.framework.db.Database; 6 9 import org.molgenis.framework.db.DatabaseException; 7 10 import org.molgenis.framework.ui.FormModel; 8 import org.molgenis.framework.ui.commands.SimpleCommand; 11 import org.molgenis.framework.ui.ScreenModel; 12 import org.molgenis.framework.ui.ScreenModel.Show; 13 import org.molgenis.framework.ui.commands.AddCommand; 9 14 import org.molgenis.framework.ui.html.ActionInput; 10 15 import org.molgenis.framework.ui.html.HtmlInput; 16 import org.molgenis.util.Tuple; 11 17 12 public class MyCommand extends SimpleCommand 18 import app.ui.ExperimentsForm; 19 20 /** 21 * Customized version of the 'Add' command. 22 */ 23 public class MyCommand extends AddCommand 13 24 { 14 @Override 15 public List<HtmlInput> getActions() 25 public MyCommand(FormModel s) 16 26 { 17 List<HtmlInput> actions = new ArrayList<HtmlInput>(); 18 19 //ActionInput close = new ActionInput("close"); 20 ///close.setIcon("path/to/image"); 21 //close.setLabel("My Command Example"); 22 23 return actions; 27 //override the standard add function 28 super("edit_new", s); 24 29 } 25 30 … … 27 32 public List<HtmlInput> getInputs() throws DatabaseException 28 33 { 29 //no inputs here 30 return null; 34 //reuse the inputs from Experiment 35 List<HtmlInput> inputs = new ExperimentsForm().getInputs(); 36 37 //you could now replace some of these inputs with your own 38 //e.g. create a custom 'PubmedInput' 39 inputs.add(new PubmedInput("pubmed")); 40 41 return inputs; 31 42 } 32 43 44 @Override 45 public List<HtmlInput> getActions() 46 { 47 //get the standard inputs 48 List<HtmlInput> actions = super.getActions(); 49 50 //add an extra button 51 // ActionInput close = new ActionInput("close"); 52 // close.setIcon("path/to/image"); 53 // close.setLabel("My Command Example"); 54 // actions.add(close); 55 56 return actions; 57 } 58 59 @Override 60 public ScreenModel.Show handleRequest(Database db, Tuple request, PrintWriter downloadStream) throws ParseException, DatabaseException, IOException 61 { 62 Show result = super.handleRequest(db, request, downloadStream); 63 64 //return SHOW_MAIN if this request should be handled in the main screen 65 //return SHOW_DIALOG if you want to keep the dialog open 66 return result; 67 } 33 68 }
Note: See TracChangeset
for help on using the changeset viewer.