Changeset 2442


Ignore:
Timestamp:
11/30/09 22:51:56 (2 years ago)
Author:
mswertz
Message:

Refactored UI to make it easier to extend. E.g. to add a command or action to a generated MOLGENIS. Also a first step was made to add an alternative UI style base on YUI. When this refactoring is finished it will be possible to omit the *ui.xml and instead assemble the UI by a manual program.

Location:
molgenis/3.3/src/org/molgenis/framework/ui
Files:
3 added
26 edited

Legend:

Unmodified
Added
Removed
  • molgenis/3.3/src/org/molgenis/framework/ui/FormController.java

    r2314 r2442  
    294294        public void reload(Database db) 
    295295        { 
    296                 logger.debug("reloading..."); 
     296                logger.info("reloading..."); 
    297297 
    298298                // FIXME 
  • molgenis/3.3/src/org/molgenis/framework/ui/FormModel.java

    r2369 r2442  
    1515// jdk 
    1616import java.io.File; 
     17import java.text.ParseException; 
    1718import java.util.ArrayList; 
    1819import java.util.Arrays; 
     
    5657public abstract class FormModel<E extends Entity> extends SimpleModel 
    5758{ 
     59        /** 
     60         * Parameters to enable links between parent forms and subforms using 
     61         * foreign key relationships (aka master-detail views) 
     62         *  
     63         * @author Morris Swertz 
     64         */ 
     65        public static class ParentFilter 
     66        { 
     67                /** for filtering based on parentform */ 
     68                private String parentForm; 
     69                private String parentId; 
     70                private String parentLabel; 
     71                private String xrefToParent; 
     72 
     73                public ParentFilter(String parentForm, String parentId, String parentLabel, String xrefToParent) 
     74                { 
     75                        this.parentForm = parentForm; 
     76                        this.parentId = parentId; 
     77                        this.parentLabel = parentLabel; 
     78                        this.xrefToParent = xrefToParent; 
     79                } 
     80 
     81                public String getParentForm() 
     82                { 
     83                        return parentForm; 
     84                } 
     85 
     86                public String getParentId() 
     87                { 
     88                        return parentId; 
     89                } 
     90 
     91                public String getXrefToParent() 
     92                { 
     93                        return xrefToParent; 
     94                } 
     95 
     96                public void setParentForm(String parentForm) 
     97                { 
     98                        this.parentForm = parentForm; 
     99                } 
     100 
     101                public void setParentId(String parentId) 
     102                { 
     103                        this.parentId = parentId; 
     104                } 
     105 
     106                public void setXrefToParent(String xrefToParent) 
     107                { 
     108                        this.xrefToParent = xrefToParent; 
     109                } 
     110 
     111                public String getParentLabel() 
     112                { 
     113                        return parentLabel; 
     114                } 
     115 
     116                public void setParentLabel(String parentLabel) 
     117                { 
     118                        this.parentLabel = parentLabel; 
     119                } 
     120        } 
     121 
    58122        // ABSTRACT METHODS, varied per entity 
    59123        /** 
     
    63127         * @param entity 
    64128         * @param newrecord 
     129         * @throws ParseException 
    65130         */ 
    66131        public abstract HtmlForm<E> getInputs(E entity, boolean newrecord); 
     
    87152        { 
    88153                LIST_VIEW("listview"), EDIT_VIEW("editview"); 
    89                 //RECORD_VIEW("recordview") 
    90                 //, EMBEDDED_VIEW("embeddedview"),; 
     154                // RECORD_VIEW("recordview") 
     155                // , EMBEDDED_VIEW("embeddedview"),; 
    91156 
    92157                private Mode(String tag) 
     
    104169 
    105170        // CONSTANTS 
     171        public static final String INPUT_SHOW = "__show"; 
    106172        public static final String INPUT_OFFSET = "__offset"; 
    107173        public static final String INPUT_DOWNLOADFILENAME = "__filename"; 
     
    161227        /** Helper object that takes care of database paging */ 
    162228        private DatabasePager<E> pager; 
    163          
    164         /** Here the currently selected is are stored*/ 
     229 
     230        /** Here the currently selected is are stored */ 
    165231        private List<Object> selectedIds; 
     232        /** Filter of parent form filtering */ 
     233        // TODO make this infer automatically 
     234        private List<ParentFilter> parentFilters = new ArrayList<ParentFilter>(); 
    166235 
    167236        /** */ 
     
    198267 
    199268                setController(new FormController<E>(this)); 
    200                  
    201                 //add all actions 
     269 
     270                // add all actions 
    202271                // menu FILE 
    203272 
     
    232301 
    233302                // menu VIEW 
    234                 //SimpleCommand<E> v2 = new ViewRecordViewCommand<E>("recordview", this); 
    235                 //v2.setToolbar(true); 
    236                 //super.addCommand("View", v2); 
     303                // SimpleCommand<E> v2 = new ViewRecordViewCommand<E>("recordview", 
     304                // this); 
     305                // v2.setToolbar(true); 
     306                // super.addCommand("View", v2); 
    237307 
    238308                SimpleCommand<E> v3 = new ViewEditViewCommand<E>("editview", this); 
    239                 //v3.setToolbar(true); 
     309                // v3.setToolbar(true); 
    240310                super.addCommand("View", v3); 
    241311 
    242312                SimpleCommand<E> v4 = new ViewListViewCommand<E>("listview", this); 
    243                 v4.setToolbar(true);             
     313                v4.setToolbar(true); 
    244314                super.addCommand("View", v4); 
    245315 
     
    274344                } 
    275345        } 
    276          
     346 
    277347        @Override 
    278348        public boolean isVisible() 
     
    289359        { 
    290360                Vector<ScreenCommand> toolbar = new Vector<ScreenCommand>(); 
    291                  
    292                 for(CommandMenu<E> menu: this.getMenus()) 
    293                 { 
    294                         for(ScreenCommand<E> c: menu.getCommands()) 
     361 
     362                for (CommandMenu<E> menu : this.getMenus()) 
     363                { 
     364                        for (ScreenCommand<E> c : menu.getCommands()) 
    295365                        { 
    296                                 if(c.isToolbar() && c.isVisible()) 
     366                                if (c.isToolbar() && c.isVisible()) 
    297367                                { 
    298368                                        toolbar.add(c); 
     
    300370                        } 
    301371                } 
    302                  
     372 
    303373                return toolbar; 
    304374        } 
     
    315385 
    316386        /** 
    317          * A convenience method that merges system and user rules, excluding limit and offset 
    318          * (i.e., if you want 'all'). 
     387         * A convenience method that merges system and user rules, excluding limit 
     388         * and offset (i.e., if you want 'all'). 
    319389         *  
    320390         * @return an array of all rules 
     
    353423                try 
    354424                { 
    355                         return getEntityClass().newInstance(); 
     425                        E entity = getEntityClass().newInstance(); 
     426 
     427                        // set defaults for xrefs 
     428                        for (ParentFilter pf : this.getParentFilters()) 
     429                        { 
     430                                FormModel parent = (FormModel) this.get(pf.getParentForm()); 
     431                                List<Entity> records = parent.getRecords(); 
     432                                if (records.size() > 0) 
     433                                { 
     434                                        // xref only 
     435                                        Object value = records.get(0).get(pf.getParentId()); 
     436                                        Object label = records.get(0).get(pf.getParentLabel()); 
     437                                        if (!(value instanceof List) && value != null) 
     438                                        { 
     439                                                entity.set(pf.getXrefToParent(), value); 
     440                                                entity.set(pf.getXrefToParent()+"_"+pf.getParentLabel(), label); 
     441                                        } 
     442                                } 
     443                        } 
     444 
     445                        return entity; 
    356446                } 
    357447                catch (Exception e) 
    358448                { 
    359                         //should never happen 
     449                        // should never happen 
    360450                        logger.error("failed to create class " + getEntityClass() + ": " + e); 
    361451                        e.printStackTrace(); 
     
    602692         * field of a related record. 
    603693         */ 
    604         public abstract List<QueryRule> getSystemRules(); 
     694        public List<QueryRule> getSystemRules() 
     695        { 
     696                List<QueryRule> rules = new ArrayList<QueryRule>(); 
     697 
     698                // parent filters 
     699                if (this.getParentFilters() != null && this.getParentFilters().size() > 0) 
     700                { 
     701                        List<QueryRule> xref_filters = new ArrayList<QueryRule>(); 
     702 
     703                        for (ParentFilter pf : this.getParentFilters()) 
     704                        { 
     705                                FormModel parent = (FormModel) this.get(pf.getParentForm()); 
     706                                List<Entity> records = parent.getRecords(); 
     707 
     708                                // add filters for xref or mref relationships (if any) 
     709                                // if multiple xrefs apply then the filters are union (so xref1 
     710                                // OR 
     711                                // xref2 OR etc) 
     712                                if (records.size() > 0) 
     713                                { 
     714 
     715                                        Object parentValue = records.get(0).get(pf.getParentId()); 
     716                                        // mref? 
     717                                        if (parentValue instanceof List) 
     718                                        { 
     719                                                List values = (List) parentValue; 
     720                                                if (values.size() > 0) for (Object val : values) 
     721                                                { 
     722                                                        QueryRule rule = new QueryRule(pf.getXrefToParent(), QueryRule.Operator.EQUALS, val); 
     723                                                        rule.setOr(true); 
     724                                                        xref_filters.add(rule); 
     725                                                } 
     726                                                // if no filters then prohibit to get ALL data by adding 
     727                                                // impossible condition 
     728                                                else 
     729                                                { 
     730                                                        QueryRule rule = new QueryRule(pf.getXrefToParent(), QueryRule.Operator.EQUALS, 
     731                                                                        Integer.MIN_VALUE); 
     732                                                        rule.setOr(true); 
     733                                                        xref_filters.add(rule); 
     734                                                } 
     735                                        } 
     736                                        // xref 
     737                                        else if (parentValue != null) 
     738                                        { 
     739                                                QueryRule rule = new QueryRule(pf.getXrefToParent(), QueryRule.Operator.EQUALS, parentValue); 
     740                                                rule.setOr(true); 
     741                                                xref_filters.add(rule); 
     742                                        } 
     743                                        else 
     744                                        { 
     745                                                QueryRule rule = new QueryRule(pf.getXrefToParent(), QueryRule.Operator.EQUALS, 
     746                                                                Integer.MIN_VALUE); 
     747                                                rule.setOr(true); 
     748                                                xref_filters.add(rule); 
     749                                        } 
     750                                } 
     751                        } 
     752                        // put it all in one clause, e.g. (xref1 = 0 OR xref1 = 1 OR xref2=3 
     753                        // ....) 
     754                        rules.add(new QueryRule(xref_filters)); 
     755                } 
     756 
     757                // security filters 
     758                { 
     759                        QueryRule rule = super.getRootScreen().getLogin().getRowlevelSecurityFilters(this.create()); 
     760                        if (rule != null /* && !rule.equals(new QueryRule()) */) rules.add(rule); 
     761                } 
     762                return rules; 
     763 
     764        } 
    605765 
    606766        /** 
     
    623783        } 
    624784 
    625         public void setMessages(ScreenMessage<E> ... messages) 
     785        public void setMessages(ScreenMessage<E>... messages) 
    626786        { 
    627787                this.messages = new Vector<ScreenMessage<E>>(Arrays.asList(messages)); 
    628788        } 
    629          
    630          
     789 
    631790        /** 
    632791         * @return Messages to inform the user of state changes and succes. 
     
    745904                return ((FormController) getController()).getPager(); 
    746905        } 
    747          
     906 
    748907        public List<Object> getSelectedIds() 
    749908        { 
     
    755914                this.selectedIds = selected; 
    756915        } 
     916 
     917        public void setParentFilters(List<ParentFilter> parentFilters) 
     918        { 
     919                this.parentFilters = parentFilters; 
     920        } 
     921 
     922        public List<ParentFilter> getParentFilters() 
     923        { 
     924                return parentFilters; 
     925        } 
     926 
    757927} 
  • molgenis/3.3/src/org/molgenis/framework/ui/FormView.ftl

    r2308 r2442  
    2727                <#list menu.getCommands() as command> 
    2828                        <#if command.isVisible()> 
    29                                                                                 <tr><td class="submenuitem" onclick="${command.getJavaScriptAction()}"><img src="${command.icon}" align="left" />${command.label}</td></tr> 
     29                                                                                <tr><td class="submenuitem" onclick="${command.getJavaScriptAction()}"><#if command.icon?exists><img src="${command.icon}" align="left" /><#else>&nbsp; </#if>${command.label}</td></tr> 
    3030                        </#if> 
    3131                </#list> 
  • molgenis/3.3/src/org/molgenis/framework/ui/MenuController.java

    r2308 r2442  
    4949        public void reload(Database db) 
    5050        { 
     51                logger.debug("reloading Menu("+view.getName()+")"); 
    5152                ScreenModel selected = view.getSelected(); 
    5253                if (selected == null) 
  • molgenis/3.3/src/org/molgenis/framework/ui/MenuModel.java

    r2308 r2442  
    5959                super(name, parent); 
    6060                setController(new MenuController(this)); 
     61                //macro has exact name as class, but then ending with 'view'. 
    6162                setViewMacro(MenuModel.class.getSimpleName().replace("Model", "View")); 
    6263        } 
  • molgenis/3.3/src/org/molgenis/framework/ui/ScreenModel.java

    r2314 r2442  
    1818import org.molgenis.util.EmailService; 
    1919import org.molgenis.util.Tree; 
    20 import org.molgenis.util.SimpleEmailService.EmailException; 
    2120 
    2221// jdk 
     
    4746        /** Bind parameter name for screen action (to be used by layout renderer) */ 
    4847        public static final String INPUT_ACTION = "__action"; 
     48         
    4949        /** 
    5050         * Parameter to indicate how the results should be shown (as download, as 
    5151         * popup, inline with the rest of the GUI (Default) 
    5252         */ 
    53         public static final String INPUT_SHOW = "__show"; 
    54  
    55         /** The default of 'input_show' */ 
    56         public static final String SHOW_INLINE = "inline"; 
    57  
    58         /** Show current screen in a popup */ 
    59         public static final String SHOW_DIALOG = "popup"; 
    60  
    61         /** 
    62          * Pass current screen in handlerequest the outputstream so it can be 
    63          * downloaded 
    64          */ 
    65         public static final String SHOW_DOWNLOAD = "download"; 
     53        public enum Show 
     54        { 
     55                /** 
     56                 * Show the current screen as part of its parent. This means the layout template is called on the root of the user interface. 
     57                 */ 
     58                SHOW_MAIN("inline"),  
     59                /** 
     60                 * Show the current screen or command as popup. This means the layout template is applied on this element. 
     61                 */ 
     62                SHOW_DIALOG("popup"),  
     63                /** 
     64                 * Pass current screen in handlerequest the outputstream so it can be 
     65                 * downloaded. This result in a download file. 
     66                 */ 
     67                SHOW_DOWNLOAD("download"); 
     68                 
     69                private String TAG; 
     70                Show(String name) 
     71                { 
     72                        this.TAG = name; 
     73                } 
     74                 
     75                public String toString() 
     76                { 
     77                        return this.TAG; 
     78                } 
     79                 
     80                public boolean equals(String str) 
     81                { 
     82                        if(str != null && str.equals(this.TAG)) return true; 
     83                        return false; 
     84                } 
     85        } 
    6686 
    6787        /** 
  • molgenis/3.3/src/org/molgenis/framework/ui/SimpleModel.java

    r2314 r2442  
    194194        { 
    195195                // link the command to the screen 
     196                command.setScreen(this); 
    196197                command.setTarget(this.getName()); 
    197198 
  • molgenis/3.3/src/org/molgenis/framework/ui/UserInterface-EBI.ftl

    r2308 r2442  
    66                <meta http-equiv="Window-target" content="_top" /> 
    77                <meta name="no-email-collection" content="http://www.unspam.com/noemailcollection/" />           
     8<script type="text/javascript"> 
     9var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); 
     10document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E")); 
     11</script> 
     12<script type="text/javascript"> 
     13try { 
     14var pageTracker = _gat._getTracker("UA-11526343-1"); 
     15pageTracker._trackPageview(); 
     16} catch(err) {} 
     17</script>                
    818                <!--link rel="shortcut icon" href="generated-res/img/molgenis.ico"--> 
    919                <link rel="stylesheet"  href="http://www.ebi.ac.uk/inc/css/contents.css"     type="text/css" /> 
  • molgenis/3.3/src/org/molgenis/framework/ui/UserInterface.ftl

    r2369 r2442  
    3030<@molgenis_header/> 
    3131<div id="container"> 
    32         <div id="header">        
    33                 <div><p><a href="http://www.molgenis.org"><img src="generated-res/img/logo_molgenis.gif" height="70px" align="right"/></a>&nbsp;${application.getLabel()}</p></div> 
    34                         <!--div align="right" style="color: maroon; font: 12px Arial;margin-right: 10px;">| <a href="about.html">About</a>  | <a href="doc/objectmodel.html">Object model</a>  | <a href="api/R">R-project API</a> | <a href="api/find">HTTP API</a> | <a href="api/soap?wsdl">Web Services API</a></div--> 
    35         </div> 
     32         
    3633<#list screen.getVisibleChildren() as subscreen> 
    3734        <@layout subscreen /> 
    3835</#list> 
     36 
    3937        <div id="push"> 
    4038        </div> 
  • molgenis/3.3/src/org/molgenis/framework/ui/UserInterface.java

    r2314 r2442  
    145145        public void reload(Database db) 
    146146        { 
    147                 if(this.getController() != this) 
     147                for(ScreenModel s: this.getChildren()) 
    148148                { 
    149                         this.getController().reload(db); 
     149                        s.getController().reload(db); 
    150150                } 
    151                 else 
    152                 { 
    153                         if(this.getSelected() != null) 
    154                                 this.getSelected().getController().reload(db); 
    155                 } 
     151                 
     152//              if(this.getController() != this) 
     153//              { 
     154//                      this.getController().reload(db); 
     155//              } 
     156//              else 
     157//              { 
     158//                      //refresh whole selected subtree 
     159//                      if(this.getSelected() != null) 
     160//                              this.getSelected().getController().reload(db); 
     161//              } 
    156162        } 
    157163 
  • molgenis/3.3/src/org/molgenis/framework/ui/commands/AddBatchCommand.java

    r2369 r2442  
    1313import org.molgenis.framework.ui.FormModel; 
    1414import org.molgenis.framework.ui.ScreenMessage; 
     15import org.molgenis.framework.ui.ScreenModel; 
     16import org.molgenis.framework.ui.ScreenModel.Show; 
    1517import org.molgenis.framework.ui.html.ActionInput; 
    1618import org.molgenis.framework.ui.html.HtmlInput; 
     
    5355        public List<HtmlInput> getInputs() throws DatabaseException 
    5456        { 
    55                 // todo add help/subheadings 
    56  
    5757                // delegate to the formscreen 
    58                 List<HtmlInput> inputs = this.getScreen().getNewRecordForm().getInputs(); 
     58                List<HtmlInput> inputs = this.getFormScreen().getNewRecordForm().getInputs(); 
    5959 
    6060                // remove not-null constraints 
     
    7272 
    7373        @Override 
    74         public boolean handleRequest(Database db, Tuple request, PrintWriter downloadStream) throws ParseException, DatabaseException, 
     74        public ScreenModel.Show handleRequest(Database db, Tuple request, PrintWriter downloadStream) throws ParseException, DatabaseException, 
    7575                        IOException 
    7676        { 
     
    8383                        try 
    8484                        { 
    85                                 CsvToDatabase<E> csvReader = this.getScreen().getCsvReader(); 
     85                                CsvToDatabase<E> csvReader = this.getFormScreen().getCsvReader(); 
    8686 
    8787                                int updatedRows = csvReader.importCsv(db, new CsvStringReader(request 
     
    9292                                msg = new ScreenMessage<E>("CSV UPLOAD SUCCESS: added " + updatedRows + " rows", null, true); 
    9393                                logger.debug("CSV UPLOAD SUCCESS: added " + updatedRows + " rows"); 
    94                                 getScreen().getPager().resetFilters(); 
    95                                 getScreen().getPager().last(db); 
     94                                getFormScreen().getPager().resetFilters(); 
     95                                getFormScreen().getPager().last(db); 
    9696                        } 
    9797                        catch (Exception e) 
     
    101101                                logger.error("CSV UPLOAD FAILED: " + e.getMessage()); 
    102102                        } 
    103                         getScreen().getMessages().add(msg); 
     103                        getFormScreen().getMessages().add(msg); 
    104104                } 
    105105 
    106                 return true; 
     106                //show result in the main screen 
     107                return ScreenModel.Show.SHOW_MAIN; 
    107108        } 
    108109 
  • molgenis/3.3/src/org/molgenis/framework/ui/commands/AddCommand.java

    r2308 r2442  
    1111import org.molgenis.framework.ui.FormController; 
    1212import org.molgenis.framework.ui.FormModel; 
     13import org.molgenis.framework.ui.ScreenModel; 
    1314import org.molgenis.framework.ui.html.ActionInput; 
    1415import org.molgenis.framework.ui.html.HtmlInput; 
     
    3435        { 
    3536                // delegate to the formscreen 
    36                 return this.getScreen().getNewRecordForm().getInputs(); 
     37                return this.getFormScreen().getNewRecordForm().getInputs(); 
    3738        } 
    3839 
     
    6061        { 
    6162                //hide add button if the screen is readonly 
    62                 return !this.getScreen().isReadonly();  
     63                return !this.getFormScreen().isReadonly();  
    6364        } 
    6465 
    6566        @Override 
    66         public boolean handleRequest(Database db, Tuple request, PrintWriter downloadStream) throws ParseException, 
     67        public ScreenModel.Show handleRequest(Database db, Tuple request, PrintWriter downloadStream) throws ParseException, 
    6768                        DatabaseException, IOException 
    6869        {                
     
    7273                        ((FormController) this.getScreen().getController()).doAdd(db, request); 
    7374                } 
    74                 return true; 
     75                return ScreenModel.Show.SHOW_MAIN; 
    7576        } 
    7677} 
  • molgenis/3.3/src/org/molgenis/framework/ui/commands/AddCommand2.java

    r2314 r2442  
    1313import org.molgenis.framework.ui.FormModel; 
    1414import org.molgenis.framework.ui.ScreenMessage; 
     15import org.molgenis.framework.ui.ScreenModel; 
    1516import org.molgenis.framework.ui.html.ActionInput; 
    1617import org.molgenis.framework.ui.html.Form; 
     
    4243        { 
    4344                Form f = new Form(); 
    44                 f.addAll(this.getScreen().getNewRecordForm().getInputs());               
     45                f.addAll(this.getFormScreen().getNewRecordForm().getInputs());           
    4546                f.setAll(previousRequest); 
    4647                return f.getInputs(); 
     
    7071        { 
    7172                // hide add button from the menu/toolbar if the screen is readonly 
    72                 return !this.getScreen().isReadonly(); 
     73                return !this.getFormScreen().isReadonly(); 
    7374        } 
    7475 
    7576        @Override 
    76         public boolean handleRequest(Database db, Tuple request, PrintWriter downloadStream) throws ParseException, DatabaseException, 
     77        public ScreenModel.Show handleRequest(Database db, Tuple request, PrintWriter downloadStream) throws ParseException, DatabaseException, 
    7778                        IOException 
    7879        { 
     
    8182                        // delegate to the form controller 
    8283                        boolean success = ((FormController<E>) this.getScreen().getController()).doAdd(db, request); 
    83                         this.messages = this.getScreen().getMessages();  
     84                        this.messages = this.getFormScreen().getMessages();  
    8485                } 
    85                 return true; 
     86                return ScreenModel.Show.SHOW_MAIN; 
    8687        } 
    8788         
  • molgenis/3.3/src/org/molgenis/framework/ui/commands/ChangeListLimitCommand.java

    r2308 r2442  
    55 
    66import java.io.PrintWriter; 
     7import java.util.List; 
    78 
    89import org.molgenis.framework.db.Database; 
     10import org.molgenis.framework.db.DatabaseException; 
    911import org.molgenis.framework.ui.FormModel; 
     12import org.molgenis.framework.ui.ScreenModel; 
    1013import org.molgenis.framework.ui.FormModel.Mode; 
     14import org.molgenis.framework.ui.html.HtmlInput; 
    1115import org.molgenis.util.Entity; 
    1216import org.molgenis.util.Tuple; 
     
    3337        { 
    3438                // only show in list view 
    35                 return getScreen().getMode().equals(Mode.LIST_VIEW); 
     39                return getFormScreen().getMode().equals(Mode.LIST_VIEW); 
    3640        } 
    3741         
     
    4347 
    4448        @Override 
    45         public boolean handleRequest(Database db, Tuple request, PrintWriter downloadStream) 
     49        public ScreenModel.Show handleRequest(Database db, Tuple request, PrintWriter downloadStream) 
    4650        { 
    4751 
    48                 getScreen().setLimit(getLimit()); 
    49                 return true; 
     52                getFormScreen().setLimit(getLimit()); 
     53                return ScreenModel.Show.SHOW_MAIN; 
    5054        } 
    5155 
     
    5963                this.limit = limit; 
    6064        } 
     65 
     66        @Override 
     67        public List<HtmlInput> getActions() 
     68        { 
     69                // TODO Auto-generated method stub 
     70                return null; 
     71        } 
     72 
     73        @Override 
     74        public List<HtmlInput> getInputs() throws DatabaseException 
     75        { 
     76                // TODO Auto-generated method stub 
     77                return null; 
     78        } 
    6179} 
  • molgenis/3.3/src/org/molgenis/framework/ui/commands/CommandMenu.java

    r2308 r2442  
    33import java.util.Collection; 
    44import java.util.LinkedHashMap; 
     5import java.util.List; 
    56import java.util.Map; 
    67 
    78import org.apache.log4j.Logger; 
     9import org.molgenis.framework.db.DatabaseException; 
    810import org.molgenis.framework.ui.FormModel; 
    911import org.molgenis.framework.ui.Templateable; 
     12import org.molgenis.framework.ui.html.HtmlInput; 
    1013import org.molgenis.util.Entity; 
    1114 
     
    6568        } 
    6669 
     70        @Override 
     71        public List<HtmlInput> getActions() 
     72        { 
     73                // TODO Auto-generated method stub 
     74                return null; 
     75        } 
     76 
     77        @Override 
     78        public List<HtmlInput> getInputs() throws DatabaseException 
     79        { 
     80                // TODO Auto-generated method stub 
     81                return null; 
     82        } 
     83 
    6784} 
  • molgenis/3.3/src/org/molgenis/framework/ui/commands/DownloadAllCommand.java

    r2314 r2442  
    55 
    66import java.io.PrintWriter; 
     7import java.util.List; 
    78 
    89import org.molgenis.framework.db.Database; 
    910import org.molgenis.framework.db.DatabaseException; 
    1011import org.molgenis.framework.ui.FormModel; 
     12import org.molgenis.framework.ui.ScreenModel; 
     13import org.molgenis.framework.ui.html.HtmlInput; 
    1114import org.molgenis.util.CsvWriter; 
    1215import org.molgenis.util.Entity; 
     
    2932 
    3033        @Override 
    31         public boolean handleRequest(Database db, Tuple request, PrintWriter csvDownload) throws DatabaseException 
     34        public ScreenModel.Show handleRequest(Database db, Tuple request, PrintWriter csvDownload) throws DatabaseException 
    3235        { 
    3336                logger.debug(this.getName()); 
    3437 
    35                 FormModel<E> view = this.getScreen(); 
     38                FormModel<E> view = this.getFormScreen(); 
    3639                db.find(view.getEntityClass(), new CsvWriter(csvDownload), view.getRulesExclLimitOffset()); 
    3740 
    38                 return true; 
     41                return ScreenModel.Show.SHOW_MAIN; 
     42        } 
     43 
     44        @Override 
     45        public List<HtmlInput> getActions() 
     46        { 
     47                // TODO Auto-generated method stub 
     48                return null; 
     49        } 
     50 
     51        @Override 
     52        public List<HtmlInput> getInputs() throws DatabaseException 
     53        { 
     54                // TODO Auto-generated method stub 
     55                return null; 
    3956        } 
    4057} 
  • molgenis/3.3/src/org/molgenis/framework/ui/commands/DownloadSelectedCommand.java

    r2314 r2442  
    1616import org.molgenis.framework.db.QueryRule.Operator; 
    1717import org.molgenis.framework.ui.FormModel; 
     18import org.molgenis.framework.ui.ScreenModel; 
    1819import org.molgenis.framework.ui.FormModel.Mode; 
     20import org.molgenis.framework.ui.html.HtmlInput; 
    1921import org.molgenis.util.CsvWriter; 
    2022import org.molgenis.util.Entity; 
     
    4042        { 
    4143                // only show in listview 
    42                 return this.getScreen().getMode().equals(Mode.LIST_VIEW); 
     44                return this.getFormScreen().getMode().equals(Mode.LIST_VIEW); 
    4345        } 
    4446 
    4547        @Override 
    46         public boolean handleRequest(Database db, Tuple request, PrintWriter csvDownload) throws ParseException, DatabaseException, 
     48        public ScreenModel.Show handleRequest(Database db, Tuple request, PrintWriter csvDownload) throws ParseException, DatabaseException, 
    4749                        IOException 
    4850        { 
    4951                logger.debug(this.getName()); 
    5052                 
    51                 FormModel<E> view = this.getScreen(); 
     53                FormModel<E> view = this.getFormScreen(); 
    5254 
    5355                Object ids = request.getObject(FormModel.INPUT_SELECTED); 
     
    6466                { 
    6567                        csvDownload.println("No records selected."); 
    66                         return true; 
     68                        return ScreenModel.Show.SHOW_MAIN; 
    6769                } 
    6870 
     
    7072                db.find(view.getEntityClass(), new CsvWriter(csvDownload), 
    7173                                new QueryRule("id", Operator.IN, records)); 
    72                 return true; 
     74                return ScreenModel.Show.SHOW_MAIN; 
     75        } 
     76 
     77        @Override 
     78        public List<HtmlInput> getActions() 
     79        { 
     80                // TODO Auto-generated method stub 
     81                return null; 
     82        } 
     83 
     84        @Override 
     85        public List<HtmlInput> getInputs() throws DatabaseException 
     86        { 
     87                // TODO Auto-generated method stub 
     88                return null; 
    7389        } 
    7490} 
  • molgenis/3.3/src/org/molgenis/framework/ui/commands/DownloadVisibleCommand.java

    r2330 r2442  
    1212import org.molgenis.framework.db.DatabaseException; 
    1313import org.molgenis.framework.ui.FormModel; 
     14import org.molgenis.framework.ui.ScreenModel; 
     15import org.molgenis.framework.ui.html.HtmlInput; 
    1416import org.molgenis.util.CsvWriter; 
    1517import org.molgenis.util.Entity; 
     
    3335 
    3436        @Override 
    35         public boolean handleRequest(Database db, Tuple request, PrintWriter csvDownload) throws ParseException, DatabaseException, 
     37        public ScreenModel.Show handleRequest(Database db, Tuple request, PrintWriter csvDownload) throws ParseException, DatabaseException, 
    3638                        IOException 
    3739        { 
    3840                logger.debug(this.getName()); 
    3941 
    40                 FormModel<E> view = this.getScreen(); 
     42                FormModel<E> view = this.getFormScreen(); 
    4143                List<E> records = view.getRecords(); 
    4244                CsvWriter writer = new CsvWriter(csvDownload, view.create().getFields()); 
     
    4446                for (E e : records) 
    4547                        writer.writeRow(e); 
    46                 return true; 
     48                 
     49                return ScreenModel.Show.SHOW_MAIN;               
     50        } 
     51 
     52        @Override 
     53        public List<HtmlInput> getActions() 
     54        { 
     55                // TODO Auto-generated method stub 
     56                return null; 
     57        } 
     58 
     59        @Override 
     60        public List<HtmlInput> getInputs() throws DatabaseException 
     61        { 
     62                // TODO Auto-generated method stub 
     63                return null; 
    4764        } 
    4865} 
  • molgenis/3.3/src/org/molgenis/framework/ui/commands/EditSelectedCommand.java

    r2308 r2442  
    99import org.molgenis.framework.ui.FormModel; 
    1010import org.molgenis.framework.ui.ScreenMessage; 
     11import org.molgenis.framework.ui.ScreenModel; 
    1112import org.molgenis.framework.ui.FormModel.Mode; 
     13import org.molgenis.framework.ui.html.HtmlInput; 
    1214import org.molgenis.util.Entity; 
    1315import org.molgenis.util.Tuple; 
     
    3638        public boolean isVisible() 
    3739        { 
    38                 FormModel<E> view = this.getScreen(); 
     40                FormModel<E> view = this.getFormScreen(); 
    3941                return !view.isReadonly() && view.getMode().equals(Mode.LIST_VIEW); 
    4042        } 
    4143 
    4244        @Override 
    43         public boolean handleRequest(Database db, Tuple request, PrintWriter out) throws DatabaseException 
     45        public ScreenModel.Show handleRequest(Database db, Tuple request, PrintWriter out) throws DatabaseException 
    4446        { 
    4547                logger.debug(this.getName()); 
     
    4850                if (request.getString(FormModel.INPUT_SHOW) == null) 
    4951                { 
    50                         FormModel<E> view = this.getScreen(); 
     52                        FormModel<E> view = this.getFormScreen(); 
    5153                        List<Object> idList = request.getList(FormModel.INPUT_SELECTED); 
    5254                        for (Object id : idList) 
     
    9092                        view.getMessages().add(msg); 
    9193                } 
    92                 return true; 
     94                return ScreenModel.Show.SHOW_MAIN; 
     95        } 
     96 
     97        @Override 
     98        public List<HtmlInput> getActions() 
     99        { 
     100                // TODO Auto-generated method stub 
     101                return null; 
     102        } 
     103 
     104        @Override 
     105        public List<HtmlInput> getInputs() throws DatabaseException 
     106        { 
     107                // TODO Auto-generated method stub 
     108                return null; 
    93109        } 
    94110} 
  • molgenis/3.3/src/org/molgenis/framework/ui/commands/RemoveSelectedCommand.java

    r2308 r2442  
    1414import org.molgenis.framework.ui.FormModel; 
    1515import org.molgenis.framework.ui.ScreenMessage; 
     16import org.molgenis.framework.ui.ScreenModel; 
    1617import org.molgenis.framework.ui.FormModel.Mode; 
     18import org.molgenis.framework.ui.html.HtmlInput; 
    1719import org.molgenis.util.Entity; 
    1820import org.molgenis.util.Tuple; 
     
    3133        { 
    3234                //only in listview 
    33                 return getScreen().getMode().equals(Mode.LIST_VIEW); 
     35                return getFormScreen().getMode().equals(Mode.LIST_VIEW); 
    3436        } 
    3537 
    3638        @Override 
    37         public boolean handleRequest(Database db, Tuple request, PrintWriter downloadStream) throws DatabaseException, ParseException, IOException 
     39        public ScreenModel.Show handleRequest(Database db, Tuple request, PrintWriter downloadStream) throws DatabaseException, ParseException, IOException 
    3840        { 
    3941                logger.debug(this.getName()); 
    4042                 
    41                 FormModel<E> view = getScreen(); 
     43                FormModel<E> view = getFormScreen(); 
    4244 
    4345                ScreenMessage<E> msg = null; 
     
    7375                } 
    7476                 
    75                 return true; 
     77                return ScreenModel.Show.SHOW_MAIN; 
     78        } 
     79 
     80        @Override 
     81        public List<HtmlInput> getActions() 
     82        { 
     83                // TODO Auto-generated method stub 
     84                return null; 
     85        } 
     86 
     87        @Override 
     88        public List<HtmlInput> getInputs() throws DatabaseException 
     89        { 
     90                // TODO Auto-generated method stub 
     91                return null; 
    7692        } 
    7793} 
  • molgenis/3.3/src/org/molgenis/framework/ui/commands/ScreenCommand.java

    r2308 r2442  
    99import org.molgenis.framework.db.DatabaseException; 
    1010import org.molgenis.framework.ui.FormModel; 
     11import org.molgenis.framework.ui.ScreenModel; 
    1112import org.molgenis.framework.ui.Templateable; 
    1213import org.molgenis.framework.ui.html.HtmlInput; 
     
    9293         * @return The screen this command is a child of 
    9394         */ 
    94         public FormModel<E> getScreen(); 
     95        public ScreenModel getScreen(); 
     96         
     97        /** 
     98         * Helper method to reduce casting 
     99         */ 
     100        public FormModel getFormScreen(); 
    95101 
    96102        /** 
     
    98104         *            The screen this command belongs to 
    99105         */ 
    100         public void setScreen(FormModel<E> screen); 
     106        public void setScreen(ScreenModel screen); 
    101107 
    102108        /** @return true if this command should show a dialog */ 
     
    142148         * @param downloadStream 
    143149         *            this the request can use to write results as download 
    144          * @return true if the request was handled succesfully 
     150         * @return if their should still be a popup, inline or download 
    145151         * @throws IOException 
    146152         * @throws DatabaseException 
    147153         * @throws ParseException 
    148154         */ 
    149         public boolean handleRequest(Database db, Tuple request, PrintWriter downloadStream) throws ParseException, 
     155        public ScreenModel.Show handleRequest(Database db, Tuple request, PrintWriter downloadStream) throws ParseException, 
    150156                        DatabaseException, IOException; 
    151157 
  • molgenis/3.3/src/org/molgenis/framework/ui/commands/SimpleCommand.java

    r2308 r2442  
    1111import org.molgenis.framework.ui.FormModel; 
    1212import org.molgenis.framework.ui.ScreenModel; 
     13import org.molgenis.framework.ui.ScreenModel.Show; 
    1314import org.molgenis.framework.ui.html.HtmlInput; 
    1415import org.molgenis.util.Entity; 
    15 import org.molgenis.util.SimpleTree; 
    1616import org.molgenis.util.Tuple; 
    1717 
     
    2020 * TODO: this may be very useful for other screens also. 
    2121 */ 
    22 public class SimpleCommand<E extends Entity> implements ScreenCommand<E>  
     22public abstract class SimpleCommand<E extends Entity> implements ScreenCommand<E> 
    2323{ 
    2424        /** Logger */ 
    2525        public Logger logger = Logger.getLogger(this.getClass().getSimpleName()); 
    26          
     26 
    2727        /** Internal name of this command (unique within the screen( */ 
    2828        private String name; 
     
    4646        private boolean download = false; 
    4747 
    48         /** The FormScreen this command is linked to */ 
    49         private FormModel<E> screen; 
     48        /** The Screen this command is linked to */ 
     49        private ScreenModel screen; 
    5050 
    5151        /** The name of the menu this command should be shown on */ 
    5252        private String menu; 
    53          
     53 
    5454        /** Indicates to the screen to show this command on the toolbar */ 
    5555        private boolean toolbar; 
     
    6262 
    6363        /** 
     64         * Default constructure. Note that this.setScreen needs to be called 
     65         * elsewhere. 
     66         */ 
     67        public SimpleCommand() 
     68        { 
     69                this.setName(this.getClass().getSimpleName()); 
     70                // note that this.setScreen needs to be called elsewhere. 
     71        } 
     72 
     73        /** 
    6474         * Constructor 
    65          * @param name unique name of the command (within the screen) 
     75         *  
     76         * @param name 
     77         *            unique name of the command (within the screen) 
    6678         * @param parentScreen 
    6779         */ 
     
    7385 
    7486        /** 
    75          * Get the javascript needed. 
    76          * If not provided it will be auto-generated. 
     87         * Get the javascript needed. If not provided it will be auto-generated. 
    7788         */ 
    7889        public String getJavaScriptAction() 
     
    8091                if (action == null) 
    8192                { 
     93                        if (this.getScreen() == null) throw new NullPointerException("setScreen() has not been set on command '" 
     94                                        + getName() + "'"); 
     95 
    8296                        StringBuffer jScript = new StringBuffer(); 
    8397 
    84                         //make sure the current window has a name (so popup can call back if necessary) 
     98                        // make sure the current window has a name (so popup can call back 
     99                        // if necessary) 
    85100                        jScript.append("if( window.name == '' ){ window.name = 'molgenis'+Math.random();}"); 
    86                          
     101 
    87102                        // default target screen is 'self' 
    88103                        jScript.append("document.forms." + this.getScreen().getName() + "_form." + FormModel.INPUT_TARGET 
    89104                                        + ".value='" + this.getScreen().getName() + "';"); 
    90                          
    91                         //default action handler is also 'self' 
     105 
     106                        // default action handler is also 'self' 
    92107                        jScript.append("document.forms." + this.getScreen().getName() + "_form." + FormModel.INPUT_ACTION 
    93108                                        + ".value='" + getName() + "';"); 
    94                          
     109 
    95110                        // in case of dialog make a popup 
    96111                        if (this.isDialog()) 
     
    98113                                // open a new screen named 'popup' 
    99114                                jScript 
    100                                                 .append("molgenis_window = window.open('','"+"molgenis_"+this.getName()+"','height=800,width=600,location=no,status=no,menubar=no,directories=no,toolbar=no,resizable=yes,scrollbars=yes');"); 
    101                                  
     115                                                .append("molgenis_window = window.open('','" 
     116                                                                + "molgenis_" 
     117                                                                + this.getName() 
     118                                                                + "','height=800,width=600,location=no,status=no,menubar=no,directories=no,toolbar=no,resizable=yes,scrollbars=yes');"); 
     119 
    102120                                // make this new screen the target of this form 
    103                                 jScript.append("document.forms." + this.getScreen().getName() + "_form.target='"+"molgenis_"+this.getName()+"';"); 
     121                                jScript.append("document.forms." + this.getScreen().getName() + "_form.target='" + "molgenis_" 
     122                                                + this.getName() + "';"); 
    104123 
    105124                                // set the 'show' parameter to 'popup' so the server knows to 
    106125                                // show only this dialog 
    107126                                jScript.append("document.forms." + this.getScreen().getName() + "_form." + FormModel.INPUT_SHOW 
    108                                                 + ".value='" + ScreenModel.SHOW_DIALOG + "';"); 
     127                                                + ".value='" + ScreenModel.Show.SHOW_DIALOG + "';"); 
    109128                        } 
    110129 
     
    112131                        else if (this.isDownload()) 
    113132                        { 
    114                                 //tell molgenis to download 
     133                                // tell molgenis to download 
    115134                                jScript.append("document.forms." + this.getScreen().getName() + "_form." + FormModel.INPUT_SHOW 
    116                                                 + ".value='" + ScreenModel.SHOW_DOWNLOAD + "';"); 
     135                                                + ".value='" + ScreenModel.Show.SHOW_DOWNLOAD + "';"); 
    117136                        } 
    118                          
    119                         //default show inline 
     137 
     138                        // default show inline 
    120139                        else 
    121140                        { 
    122141                                // make this this action target current window 
    123142                                jScript.append("document.forms." + this.getScreen().getName() + "_form.target=window.name;"); 
    124                                  
     143 
    125144                                jScript.append("document.forms." + this.getScreen().getName() + "_form." + FormModel.INPUT_SHOW 
    126                                                 + ".value='" + ScreenModel.SHOW_INLINE + "';"); 
     145                                                + ".value='" + ScreenModel.Show.SHOW_MAIN + "';"); 
    127146                        } 
    128                          
     147 
    129148                        jScript.append("document.forms." + this.getScreen().getName() + "_form.submit();"); 
    130                          
    131149 
    132150                        // make popup on front 
     
    146164         * @throws DatabaseException 
    147165         */ 
    148         public List<HtmlInput> getInputs() throws DatabaseException 
    149         { 
    150                 return null; 
    151         } 
     166        public abstract List<HtmlInput> getInputs() throws DatabaseException; 
    152167 
    153168        // GETTERS AND SETTERS BELOW 
     
    167182        public String getLabel() 
    168183        { 
    169                 return label; 
     184                if (label != null) return label; 
     185                return this.getName(); 
    170186        } 
    171187 
     
    213229 
    214230        @Override 
    215         public FormModel<E> getScreen() 
     231        public ScreenModel getScreen() 
    216232        { 
    217233                return this.screen; 
     
    219235 
    220236        @Override 
    221         public void setScreen(FormModel<E> screen) 
     237        public FormModel<E> getFormScreen() 
     238        { 
     239                return (FormModel) this.screen; 
     240        } 
     241 
     242        @Override 
     243        public void setScreen(ScreenModel screen) 
    222244        { 
    223245                this.screen = screen; 
     
    250272 
    251273        @Override 
    252         public List<HtmlInput> getActions() 
     274        public abstract List<HtmlInput> getActions(); 
     275 
     276        @Override 
     277        public Show handleRequest(Database db, Tuple request, PrintWriter downloadStream) throws ParseException, 
     278                        DatabaseException, IOException 
    253279        { 
    254280                // TODO Auto-generated method stub 
     281                return ScreenModel.Show.SHOW_MAIN; 
     282        } 
     283 
     284        @Override 
     285        public boolean isDownload() 
     286        { 
     287                return download; 
     288        } 
     289 
     290        @Override 
     291        public void setDownload(boolean download) 
     292        { 
     293                this.download = download; 
     294        } 
     295 
     296        @Override 
     297        public boolean isToolbar() 
     298        { 
     299                return toolbar; 
     300        } 
     301 
     302        @Override 
     303        public void setToolbar(boolean toolbar) 
     304        { 
     305                this.toolbar = toolbar; 
     306        } 
     307 
     308        /** 
     309         * Default view name = 'SimpleCommand' 
     310         */ 
     311        public String getViewName() 
     312        { 
     313                return ScreenCommand.class.getSimpleName(); 
     314        } 
     315 
     316        public String getViewTemplate() 
     317        { 
    255318                return null; 
    256319        } 
    257320 
    258321        @Override 
    259         public boolean handleRequest(Database db, Tuple request, PrintWriter downloadStream) throws ParseException, DatabaseException, 
    260                         IOException 
    261         { 
    262                 // TODO Auto-generated method stub 
    263                 return false; 
    264         } 
    265  
    266         @Override 
    267         public boolean isDownload() 
    268         { 
    269                 return download; 
    270         } 
    271  
    272         @Override 
    273         public void setDownload(boolean download) 
    274         { 
    275                 this.download = download; 
    276         } 
    277          
    278         @Override 
    279         public boolean isToolbar() 
    280         { 
    281                 return toolbar; 
    282         } 
    283  
    284         @Override 
    285         public void setToolbar(boolean toolbar) 
    286         { 
    287                 this.toolbar = toolbar; 
    288         } 
    289  
    290         /** 
    291          * Default view name = 'SimpleCommand' 
    292          */ 
    293         public String getViewName() 
    294         { 
    295                 return ScreenCommand.class.getSimpleName(); 
    296         } 
    297  
    298         public String getViewTemplate() 
    299         { 
    300                 return null; 
    301         } 
    302  
    303         @Override 
    304         public String getCustomHtmlHeaders() { 
     322        public String getCustomHtmlHeaders() 
     323        { 
    305324                return ""; 
    306325        } 
  • molgenis/3.3/src/org/molgenis/framework/ui/commands/ViewEditViewCommand.java

    r2308 r2442  
    55 
    66import java.io.PrintWriter; 
     7import java.util.List; 
    78 
    89import org.molgenis.framework.db.Database; 
     10import org.molgenis.framework.db.DatabaseException; 
    911import org.molgenis.framework.ui.FormModel; 
     12import org.molgenis.framework.ui.ScreenModel; 
    1013import org.molgenis.framework.ui.FormModel.Mode; 
     14import org.molgenis.framework.ui.html.HtmlInput; 
    1115import org.molgenis.util.Entity; 
    1216import org.molgenis.util.Tuple; 
     
    2226 
    2327        @Override 
    24         public boolean handleRequest(Database db, Tuple request, PrintWriter out) 
     28        public ScreenModel.Show handleRequest(Database db, Tuple request, PrintWriter out) 
    2529        { 
    26                 getScreen().setMode(Mode.EDIT_VIEW); 
     30                getFormScreen().setMode(Mode.EDIT_VIEW); 
    2731                Integer offset = request.getInt(FormModel.INPUT_OFFSET); 
    28                 if (offset != null) getScreen().getPager().setOffset(offset - 1); 
    29                 return true; 
     32                if (offset != null) getFormScreen().getPager().setOffset(offset - 1); 
     33                return ScreenModel.Show.SHOW_MAIN; 
    3034        } 
    3135 
     
    3539                //show add button when not in recordview 
    3640                //show add button if the screen is not readonly 
    37                 return !this.getScreen().getMode().equals(Mode.EDIT_VIEW)  
    38                 && !this.getScreen().isReadonly()  
    39                 && this.getScreen().getRecordInputs().size() != 0 
    40                 && !this.getScreen().getRecordInputs().get(0).isReadonly(); 
     41                return !this.getFormScreen().getMode().equals(Mode.EDIT_VIEW)  
     42                && !this.getFormScreen().isReadonly()  
     43                && this.getFormScreen().getRecordInputs().size() != 0 
     44                && !this.getFormScreen().getRecordInputs().get(0).isReadonly(); 
     45        } 
     46 
     47        @Override 
     48        public List<HtmlInput> getActions() 
     49        { 
     50                // TODO Auto-generated method stub 
     51                return null; 
     52        } 
     53 
     54        @Override 
     55        public List<HtmlInput> getInputs() throws DatabaseException 
     56        { 
     57                // TODO Auto-generated method stub 
     58                return null; 
    4159        } 
    4260} 
  • molgenis/3.3/src/org/molgenis/framework/ui/commands/ViewListViewCommand.java

    r2308 r2442  
    77import java.io.PrintWriter; 
    88import java.text.ParseException; 
     9import java.util.List; 
    910 
    1011import org.molgenis.framework.db.Database; 
    1112import org.molgenis.framework.db.DatabaseException; 
    1213import org.molgenis.framework.ui.FormModel; 
     14import org.molgenis.framework.ui.ScreenModel; 
    1315import org.molgenis.framework.ui.FormModel.Mode; 
     16import org.molgenis.framework.ui.html.HtmlInput; 
    1417import org.molgenis.util.Entity; 
    1518import org.molgenis.util.Tuple; 
     
    2528 
    2629        @Override 
    27         public boolean handleRequest(Database db, Tuple request, PrintWriter downloadStream) throws DatabaseException, ParseException, 
     30        public ScreenModel.Show handleRequest(Database db, Tuple request, PrintWriter downloadStream) throws DatabaseException, ParseException, 
    2831                        IOException 
    2932        { 
    3033                logger.debug(this.getName()); 
    3134 
    32                 getScreen().setMode(Mode.LIST_VIEW); 
     35                getFormScreen().setMode(Mode.LIST_VIEW); 
    3336                Integer offset = request.getInt(FormModel.INPUT_OFFSET); 
    3437                if (offset != null) 
    3538                { 
    36                         getScreen().getPager().setOffset(offset - 1); 
     39                        getFormScreen().getPager().setOffset(offset - 1); 
    3740                } 
    3841                else 
    3942                { 
    40                         getScreen().getPager().setOffset(getScreen().getOffset()); 
     43                        getFormScreen().getPager().setOffset(getFormScreen().getOffset()); 
    4144                } 
    42                 return true; 
     45                return ScreenModel.Show.SHOW_MAIN; 
    4346        } 
    4447 
     
    4750        { 
    4851                // hide when already in list view 
    49                 return !getScreen().getMode().equals(Mode.LIST_VIEW); 
     52                return !getFormScreen().getMode().equals(Mode.LIST_VIEW); 
     53        } 
     54 
     55        @Override 
     56        public List<HtmlInput> getActions() 
     57        { 
     58                // TODO Auto-generated method stub 
     59                return null; 
     60        } 
     61 
     62        @Override 
     63        public List<HtmlInput> getInputs() throws DatabaseException 
     64        { 
     65                // TODO Auto-generated method stub 
     66                return null; 
    5067        } 
    5168} 
  • molgenis/3.3/src/org/molgenis/framework/ui/html/Form.java

    r2308 r2442  
    1717        } 
    1818         
    19         public void addAll(List<Input> inputs) 
     19        public void addAll(List<HtmlInput> inputs) 
    2020        { 
    2121                for(Input i: inputs) this.add(i); 
  • molgenis/3.3/src/org/molgenis/framework/ui/html/HtmlForm.java

    r2314 r2442  
    1010import org.molgenis.util.Tuple; 
    1111 
    12 public abstract class HtmlForm<E extends Entity> 
     12public class HtmlForm<E extends Entity> 
    1313{ 
    1414        /** The entity to be shown in this form*/ 
     
    2020        /** A form may be used to add a new record. This may result in readonly fields, e.g. for autoid.*/ 
    2121        private boolean newRecord = false; 
     22        /** Inputs */ 
     23        private List<HtmlInput> inputs = new ArrayList<HtmlInput>(); 
     24         
     25        public HtmlForm() 
     26        { 
     27                 
     28        } 
    2229         
    2330        public boolean isNewRecord() 
     
    4855         
    4956        /**Create the inputs to be shown*/ 
    50         public abstract Vector<HtmlInput> getInputs(); 
     57        public List<HtmlInput> getInputs() 
     58        { 
     59                return this.inputs; 
     60        } 
     61         
     62        public void setInputs(List<HtmlInput> inputs) 
     63        { 
     64                this.inputs = inputs; 
     65        } 
    5166 
    5267        public E getEntity() 
Note: See TracChangeset for help on using the changeset viewer.