Changeset 3934


Ignore:
Timestamp:
Nov 2, 2010, 9:29:39 AM (13 years ago)
Author:
Gregory Vincic
Message:

Refs #698. Moved getSpectrumFileContactInputForm to action SpectrumFileContactDataAdderExtension?.

Location:
trunk/client/servlet/src/org/proteios
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/client/servlet/src/org/proteios/action/file/SpectrumFileContactDataAdderExtension.java

    • Property svn:keywords changed from Date Id to Id
    r3461 r3934  
    11/*
    2  $Id$
    3  
    4  Copyright (C) 2009 Gregory Vincic
    5 
    6  This file is part of Proteios.
    7  Available at http://www.proteios.org/
    8 
    9  Proteios is free software; you can redistribute it and/or modify it
    10  under the terms of the GNU General Public License as published by
    11  the Free Software Foundation; either version 2 of the License, or
    12  (at your option) any later version.
    13 
    14  Proteios is distributed in the hope that it will be useful, but
    15  WITHOUT ANY WARRANTY; without even the implied warranty of
    16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    17  General Public License for more details.
    18 
    19  You should have received a copy of the GNU General Public License
    20  along with this program; if not, write to the Free Software
    21  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
    22  02111-1307, USA.
    23  */
     2    $Id$
     3     
     4    Copyright (C) 2009 Olle Mansson
     5    Copyright (C) 2010 Gregory Vincic
     6   
     7    This file is part of Proteios.
     8    Available at http://www.proteios.org/
     9   
     10    Proteios is free software; you can redistribute it and/or modify it
     11    under the terms of the GNU General Public License as published by
     12    the Free Software Foundation; either version 2 of the License, or
     13    (at your option) any later version.
     14   
     15    Proteios is distributed in the hope that it will be useful, but
     16    WITHOUT ANY WARRANTY; without even the implied warranty of
     17    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     18    General Public License for more details.
     19   
     20    You should have received a copy of the GNU General Public License
     21    along with this program; if not, write to the Free Software
     22    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
     23    02111-1307, USA.
     24*/
    2425package org.proteios.action.file;
    2526
     27import java.util.ArrayList;
     28import java.util.Calendar;
     29import java.util.GregorianCalendar;
     30import java.util.List;
    2631import org.proteios.ActionLink;
    2732import org.proteios.Context;
     
    3540import org.proteios.gui.TitledWindow;
    3641import org.proteios.gui.Toolbar;
    37 import org.proteios.gui.form.Form;
    38 import org.proteios.gui.form.FormFactory;
     42import org.proteios.gui.form.*;
    3943import org.proteios.gui.layout.RowLayout;
    40 
    4144import se.lu.thep.waf.ActionException;
    42 import se.lu.thep.waf.constraints.InvalidParameterValue;
    43 
    44 import java.util.ArrayList;
    45 import java.util.Calendar;
    46 import java.util.GregorianCalendar;
    47 import java.util.List;
     45import se.lu.thep.waf.constraints.*;
    4846
    4947/**
    50  * This action allows contact data to be added to spectrum files.
    51  * Contact data are selected after the spectrum files have been selected.
    52  * One edit job per spectrum file is created.
    53  *
    54  * @author olle
    55  */
     48   This action allows contact data to be added to spectrum files.
     49   Contact data are selected after the spectrum files have been selected.
     50   One edit job per spectrum file is created.
     51  
     52   @author olle
     53*/
    5654public class SpectrumFileContactDataAdderExtension
    57     extends ProteiosAction<SpectrumFileContactDataAdderExtension>
    58     implements ContextEnabled
     55extends ProteiosAction<SpectrumFileContactDataAdderExtension>
     56implements ContextEnabled
    5957{
    60 
    61   @Override
    62   protected void runMe()
    63       throws ActionException, InvalidParameterValue
    64   {
    65     /***********************************************************************
    66      * Check input
    67      */
    68     /*
    69      * Get the id's of all selected files. FormFactory.VID is the valid
    70      * identifier used when rendering the list of files, thus we use it to
    71      * get the valid list of item ids.
    72      */
    73     List<Integer> spectrumFileIds = getValidIntegerList(FormFactory.VID);
    74     log.debug("spectrumFileIds = " + spectrumFileIds);
    75     /*
    76      * Make sure at least one file has been selected
    77      */
    78     if (spectrumFileIds == null || spectrumFileIds.size() == 0)
    79     {
    80       /*
    81        * If we return to this action after an error in a forward action,
    82        * the spectrum file id list is stored in SpectrumFileContactDataAdder.VSPECTRUMFILEID
    83        * instead of FormFactory.VID. Check this to determine if the current
    84        * action should set an error message, or continue to allow
    85        * an error message from the forward action to be displayed.
    86        */
    87       spectrumFileIds = getValidIntegerList(SpectrumFileContactDataAdder.VSPECTRUMFILEID);
    88       log.debug("spectrumFileIds from SpectrumFileContactDataAdder.VSPECTRUMFILEID = " + spectrumFileIds);
    89       if (spectrumFileIds == null || spectrumFileIds.size() == 0)
    90       {
    91         setError("Please select at least one spectrum file");
    92         return;
    93       }
    94     }
    95     /*
    96      * Create a form for selection of contact data parameters.
    97      */
    98     // Default filename prefix
    99     DbControl dc = newDbControl();
    100     Project project = isProjectActive(dc);
    101     String outputDirPrefixDefault = new String("OutputDir_");
    102     String outputDir;
    103     /*
    104      * Add time stamp to output directory prefix in this class,
    105      * instead of in job plugin class, as we want output files
    106      * for all jobs created in the same session to share the same
    107      * time stamp, even if the jobs are not executed simultaneously.
    108      */
    109     // Append time stamp in YYYYMMDD_HHMM format to output directory default
    110     outputDir = appendTimestampToString(outputDirPrefixDefault);
    111     log.debug("outputDir = \"" + outputDir + "\"");
    112     // Get logged-in user from whose profile default contact information should be taken.
    113     User user = getOwner();
    114     log.debug("user = \"" + user + "\"");
    115     // Get form
    116     Form form = getFormFactory().getSpectrumFileContactInputForm(
    117       project, outputDir, user);
    118     String contactDataTitle = new String("EnterContactData");
    119     Title title = new Title(contactDataTitle);
    120     // Instruction area
    121     TitledWindow instructionArea = new TitledWindow();
    122     String instruction = "Enter contact data to be added to spectrum file(s).";
    123     instruction += " One spectrum file edit job is created for each peak list file in mzData or mzML format.";
    124     instruction += " MzData uses name, institution, and contact info fields.";
    125     instruction += " MzML uses name, address, URL, and email fields.";
    126     instructionArea.setContent(instruction);
    127     instructionArea.setTitle("Description");
    128     // Toolbar
    129     Toolbar tb = new Toolbar();
    130     form.setToolbar(tb);
    131     // Add 'Next' button to create edit jobs
    132     ActionLink nextEdit = getActionFactory().getActionLink(
    133       SpectrumFileContactDataAdder.class, "NextCreateSpectrumFileContactAdderJobs");
    134     for (Integer spectrumFileId : spectrumFileIds)
    135     {
    136       getFormFactory().addHiddenField(form, SpectrumFileContactDataAdder.VSPECTRUMFILEID, spectrumFileId);
    137     }
    138     tb.add(nextEdit);
    139     /***********************************************************************
    140      * Layout
    141      */
    142     RowLayout layout = getLayoutFactory().getRowLayout();
    143     layout.add(title);
    144     layout.add(instructionArea);
    145     layout.add(form);
    146     setLayout(layout);
    147   }
    148 
    149 
    150   /**
    151    * Append time stamp to string
    152    *
    153    * @param origStr String Original string
    154    * @return String Original string with appended "YYYYMMDD_HHMM" times tamp and underscore.
    155    */
    156   private String appendTimestampToString(String origStr)
    157   {
    158     // Append time stamp in YYYYMMDD_HHMM format to string
    159     String outputStr = origStr;
    160     Calendar cal = GregorianCalendar.getInstance();
    161     boolean includeDatePart = true;
    162     boolean includeTimePart = true;
    163     boolean includeSeconds = false;
    164     String dateElementSeparator = new String("");
    165     String dateTimeSeparator = new String("_");
    166     String timeElementSeparator = new String("");
    167     String timestampStr = fetchTimestamp(cal, 0,
    168       includeDatePart, includeTimePart, includeSeconds,
    169       dateElementSeparator, dateTimeSeparator, timeElementSeparator);
    170     log.debug("timestampStr = \"" + timestampStr + "\"");
    171     if (timestampStr != null && !timestampStr.equals(""))
    172     {
    173       outputStr = outputStr + timestampStr;
    174     }
    175     //
    176     return outputStr;
    177   }
    178 
    179 
    180   /**
    181    * Fetches timestamp string.
    182    * If Calendar instance is null, null will be returned.
    183    *
    184    * @param inputCal Calendar Timestamp to use
    185    * @param secondsToAdd int Number of seconds to add (subtract if negative) to
    186    *        timestamp
    187    * @param includeDatePart Boolean Flag indicating that date part should be included (default = true).
    188    * @param includeTimePart Boolean Flag indicating that time part should be included (default = true).
    189    * @param includeSeconds Boolean Flag indicating that seconds should be included in time part (default = true).
    190    * @param dateElementSeparator String Separator between date elements  (default = "-").
    191    * @param dateTimeSeparator String Separator between date and time parts  (default = " ").
    192    * @param timeElementSeparator String Separator between time elements  (default = ":").
    193    * @return String Constructed timestamp string.
    194    */
    195   public String fetchTimestamp(Calendar inputCal, int secondsToAdd,
    196       Boolean includeDatePart, Boolean includeTimePart, Boolean includeSeconds,
    197       String dateElementSeparator, String dateTimeSeparator, String timeElementSeparator)
    198   {
    199     if (inputCal == null)
    200     {
    201       return null;
    202     }
    203     // Set defaults if needed
    204     if (includeDatePart == null)
    205     {
    206       includeDatePart = true;
    207     }
    208     if (includeTimePart == null)
    209     {
    210       includeTimePart = true;
    211     }
    212     if (includeSeconds == null)
    213     {
    214       includeSeconds = true;
    215     }
    216     if (dateElementSeparator == null)
    217     {
    218       dateElementSeparator = new String("-");
    219     }
    220     if (dateTimeSeparator == null)
    221     {
    222       dateTimeSeparator = new String(" ");
    223     }
    224     if (timeElementSeparator == null)
    225     {
    226       timeElementSeparator = new String(":");
    227     }
    228     //
    229     StringBuilder sb = new StringBuilder();
    230     //
    231     // Make a copy of the input Calendar object, as we don't want to change
    232     // the value of the latter
    233     Calendar cal = (Calendar) inputCal.clone();
    234     long timeInMilliSec = cal.getTimeInMillis();
    235     timeInMilliSec += secondsToAdd * 1000;
    236     cal.setTimeInMillis(timeInMilliSec);
    237     int year = cal.get(Calendar.YEAR);
    238     int month = cal.get(Calendar.MONTH) + 1;
    239     int day = cal.get(Calendar.DAY_OF_MONTH);
    240     int hour = cal.get(Calendar.HOUR_OF_DAY);
    241     int min = cal.get(Calendar.MINUTE);
    242     int sec = cal.get(Calendar.SECOND);
    243     String monthStr = leftPaddedString(Integer.toString(month), 2, '0');
    244     String dayStr = leftPaddedString(Integer.toString(day), 2, '0');
    245     String hourStr = leftPaddedString(Integer.toString(hour), 2, '0');
    246     String minStr = leftPaddedString(Integer.toString(min), 2, '0');
    247     String secStr = leftPaddedString(Integer.toString(sec), 2, '0');
    248     // Construct time stamp
    249     if (includeDatePart)
    250     {     
    251       sb.append(year);
    252       sb.append(dateElementSeparator);
    253       sb.append(monthStr);
    254       sb.append(dateElementSeparator);
    255       sb.append(dayStr);
    256     }
    257     if (includeDatePart && includeTimePart)
    258     {     
    259       sb.append(dateTimeSeparator);
    260     }
    261     if (includeTimePart)
    262     {
    263       sb.append(hourStr);
    264       sb.append(timeElementSeparator);
    265       sb.append(minStr);
    266       if (includeSeconds)
    267       {
    268         sb.append(timeElementSeparator);
    269         sb.append(secStr);
    270       }
    271     }
    272     String timestamp = sb.toString();
    273     //
    274     return timestamp;
    275   }
    276 
    277 
    278   /**
    279    * Returns a string padded from the left with a given character to have at
    280    * least a given length. If the input string length that is equal to or
    281    * larger than the minimum length, the string will be returned unchanged. If
    282    * the input string length is smaller than the minimum length, the string
    283    * will be padded from the left with the given character until the length is
    284    * exactly the given minimum length.
    285    *
    286    * @param inStr String Input string
    287    * @param minChars int The minimum number of characters in the resulting
    288    *        string
    289    * @param padChar char Character to use for optional padding
    290    * @return String A string optionally padded from the left to have at least
    291    *         'minChars' characters.
    292    */
    293   private String leftPaddedString(String inStr, int minChars, char padChar)
    294   {
    295     String startStr = null;
    296     if (inStr != null)
    297     {
    298       startStr = new String(inStr);
    299     }
    300     else
    301     {
    302       startStr = new String("");
    303     }
    304     int startLen = startStr.length();
    305     String resultStr = null;
    306     if (startLen >= minChars)
    307     {
    308       resultStr = startStr;
    309     }
    310     else
    311     {
    312       resultStr = startStr;
    313       for (int i = startLen; i < minChars; i++)
    314       {
    315         resultStr = padChar + resultStr;
    316       }
    317     }
    318     return resultStr;
    319   }
    320 
    321 
    322   /**
    323    * Tell the application in which context this action should be available
    324    */
    325   public List<Context> listContexts()
    326   {
    327     List<Context> contexts = new ArrayList<Context>(1);
    328     /*
    329      * We want our action to appear as an extension when viewing files. Do
    330      * this by adding a FileContext to the list of contexts.
    331      */
    332     FileContext files = new FileContext("SpectrumFileContactDataAdder", "Add contact data to spectrum file(s)",
    333       SpectrumFileContactDataAdderExtension.class);
    334     files.setDescription("First select spectrum files, then contact data");
    335     contexts.add(files);
    336     return contexts;
    337   }
     58   
     59    public static final VString VNONREQUIRED_FILENAME = new VString("fileName",0, 255, false);
     60    public static final VString VNONREQUIRED_NAME = new VString("name", 0, 255,false);
     61    public static final VString VNONREQUIRED_INSTITUTION = new VString("institution", 0, 255, false);
     62    public static final VString VNONREQUIRED_ADDRESS = new VString("address",0, 255, false);
     63    public static final VString VNONREQUIRED_URL = new VString("url", 0, 255,false);
     64    public static final VString VNONREQUIRED_EMAIL = new VString("email", 0,255, false);
     65    public static final VString VNONREQUIRED_CONTACT_INFO = new VString("contactInfo", 0, 255, false);
     66   
     67    @Override
     68    protected void runMe()
     69    throws ActionException, InvalidParameterValue
     70    {
     71        /*
     72            Get the id's of all selected files. FormFactory.VID is the valid
     73            identifier used when rendering the list of files, thus we use it to
     74            get the valid list of item ids.
     75        */
     76        List<Integer> spectrumFileIds = getValidIntegerList(FormFactory.VID);
     77        log.debug("spectrumFileIds = " + spectrumFileIds);
     78        /*
     79            Make sure at least one file has been selected
     80        */
     81        if (spectrumFileIds == null || spectrumFileIds.size() == 0)
     82        {
     83            /*
     84                If we return to this action after an error in a forward action,
     85                the spectrum file id list is stored in SpectrumFileContactDataAdder.VSPECTRUMFILEID
     86                instead of FormFactory.VID. Check this to determine if the current
     87                action should set an error message, or continue to allow
     88                an error message from the forward action to be displayed.
     89            */
     90            spectrumFileIds = getValidIntegerList(SpectrumFileContactDataAdder.VSPECTRUMFILEID);
     91            log.debug("spectrumFileIds from SpectrumFileContactDataAdder.VSPECTRUMFILEID = " + spectrumFileIds);
     92            if (spectrumFileIds == null || spectrumFileIds.size() == 0)
     93            {
     94                setError("Please select at least one spectrum file");
     95                return;
     96            }
     97        }
     98        /*
     99            Create a form for selection of contact data parameters.
     100        */
     101        // Default filename prefix
     102        DbControl dc = newDbControl();
     103        Project project = isProjectActive(dc);
     104        String outputDirPrefixDefault = new String("OutputDir_");
     105        String outputDir;
     106        /*
     107            Add time stamp to output directory prefix in this class,
     108            instead of in job plugin class, as we want output files
     109            for all jobs created in the same session to share the same
     110            time stamp, even if the jobs are not executed simultaneously.
     111        */
     112        // Append time stamp in YYYYMMDD_HHMM format to output directory default
     113        outputDir = appendTimestampToString(outputDirPrefixDefault);
     114        log.debug("outputDir = \"" + outputDir + "\"");
     115        // Get logged-in user from whose profile default contact information should be taken.
     116        User user = getOwner();
     117        log.debug("user = \"" + user + "\"");
     118        // Get form
     119        Form form = getSpectrumFileContactInputForm(project, outputDir, user);
     120        String contactDataTitle = new String("EnterContactData");
     121        Title title = new Title(contactDataTitle);
     122        // Instruction area
     123        TitledWindow instructionArea = new TitledWindow();
     124        String instruction = "Enter contact data to be added to spectrum file(s).";
     125        instruction += " One spectrum file edit job is created for each peak list file in mzData or mzML format.";
     126        instruction += " MzData uses name, institution, and contact info fields.";
     127        instruction += " MzML uses name, address, URL, and email fields.";
     128        instructionArea.setContent(instruction);
     129        instructionArea.setTitle("Description");
     130        // Toolbar
     131        Toolbar tb = new Toolbar();
     132        form.setToolbar(tb);
     133        // Add 'Next' button to create edit jobs
     134        ActionLink nextEdit = getActionFactory().getActionLink(
     135        SpectrumFileContactDataAdder.class, "NextCreateSpectrumFileContactAdderJobs");
     136        for (Integer spectrumFileId : spectrumFileIds)
     137        {
     138            getFormFactory().addHiddenField(form, SpectrumFileContactDataAdder.VSPECTRUMFILEID, spectrumFileId);
     139        }
     140        tb.add(nextEdit);
     141        // Layout
     142        RowLayout layout = getLayoutFactory().getRowLayout();
     143        layout.add(title);
     144        layout.add(instructionArea);
     145        layout.add(form);
     146        setLayout(layout);
     147    }
     148   
     149    /**
     150        Append time stamp to string
     151       
     152        @param origStr String Original string
     153        @return String Original string with appended "YYYYMMDD_HHMM" times tamp and underscore.
     154    */
     155    private String appendTimestampToString(String origStr)
     156    {
     157        // Append time stamp in YYYYMMDD_HHMM format to string
     158        String outputStr = origStr;
     159        Calendar cal = GregorianCalendar.getInstance();
     160        boolean includeDatePart = true;
     161        boolean includeTimePart = true;
     162        boolean includeSeconds = false;
     163        String dateElementSeparator = new String("");
     164        String dateTimeSeparator = new String("_");
     165        String timeElementSeparator = new String("");
     166        String timestampStr = fetchTimestamp(cal, 0,
     167        includeDatePart, includeTimePart, includeSeconds,
     168        dateElementSeparator, dateTimeSeparator, timeElementSeparator);
     169        log.debug("timestampStr = \"" + timestampStr + "\"");
     170        if (timestampStr != null && !timestampStr.equals(""))
     171        {
     172            outputStr = outputStr + timestampStr;
     173        }
     174        //
     175        return outputStr;
     176    }
     177   
     178    /**
     179        Fetches timestamp string.
     180        If Calendar instance is null, null will be returned.
     181       
     182        @param inputCal Calendar Timestamp to use
     183        @param secondsToAdd int Number of seconds to add (subtract if negative) to
     184               timestamp
     185        @param includeDatePart Boolean Flag indicating that date part should be included (default = true).
     186        @param includeTimePart Boolean Flag indicating that time part should be included (default = true).
     187        @param includeSeconds Boolean Flag indicating that seconds should be included in time part (default = true).
     188        @param dateElementSeparator String Separator between date elements  (default = "-").
     189        @param dateTimeSeparator String Separator between date and time parts  (default = " ").
     190        @param timeElementSeparator String Separator between time elements  (default = ":").
     191        @return String Constructed timestamp string.
     192    */
     193    public String fetchTimestamp(Calendar inputCal, int secondsToAdd,
     194    Boolean includeDatePart, Boolean includeTimePart, Boolean includeSeconds,
     195    String dateElementSeparator, String dateTimeSeparator, String timeElementSeparator)
     196    {
     197        if (inputCal == null)
     198        {
     199            return null;
     200        }
     201        // Set defaults if needed
     202        if (includeDatePart == null)
     203        {
     204            includeDatePart = true;
     205        }
     206        if (includeTimePart == null)
     207        {
     208            includeTimePart = true;
     209        }
     210        if (includeSeconds == null)
     211        {
     212            includeSeconds = true;
     213        }
     214        if (dateElementSeparator == null)
     215        {
     216            dateElementSeparator = new String("-");
     217        }
     218        if (dateTimeSeparator == null)
     219        {
     220            dateTimeSeparator = new String(" ");
     221        }
     222        if (timeElementSeparator == null)
     223        {
     224            timeElementSeparator = new String(":");
     225        }
     226        //
     227        StringBuilder sb = new StringBuilder();
     228        //
     229        // Make a copy of the input Calendar object, as we don't want to change
     230        // the value of the latter
     231        Calendar cal = (Calendar) inputCal.clone();
     232        long timeInMilliSec = cal.getTimeInMillis();
     233        timeInMilliSec += secondsToAdd * 1000;
     234        cal.setTimeInMillis(timeInMilliSec);
     235        int year = cal.get(Calendar.YEAR);
     236        int month = cal.get(Calendar.MONTH) + 1;
     237        int day = cal.get(Calendar.DAY_OF_MONTH);
     238        int hour = cal.get(Calendar.HOUR_OF_DAY);
     239        int min = cal.get(Calendar.MINUTE);
     240        int sec = cal.get(Calendar.SECOND);
     241        String monthStr = leftPaddedString(Integer.toString(month), 2, '0');
     242        String dayStr = leftPaddedString(Integer.toString(day), 2, '0');
     243        String hourStr = leftPaddedString(Integer.toString(hour), 2, '0');
     244        String minStr = leftPaddedString(Integer.toString(min), 2, '0');
     245        String secStr = leftPaddedString(Integer.toString(sec), 2, '0');
     246        // Construct time stamp
     247        if (includeDatePart)
     248        {
     249            sb.append(year);
     250            sb.append(dateElementSeparator);
     251            sb.append(monthStr);
     252            sb.append(dateElementSeparator);
     253            sb.append(dayStr);
     254        }
     255        if (includeDatePart && includeTimePart)
     256        {
     257            sb.append(dateTimeSeparator);
     258        }
     259        if (includeTimePart)
     260        {
     261            sb.append(hourStr);
     262            sb.append(timeElementSeparator);
     263            sb.append(minStr);
     264            if (includeSeconds)
     265            {
     266                sb.append(timeElementSeparator);
     267                sb.append(secStr);
     268            }
     269        }
     270        String timestamp = sb.toString();
     271        //
     272        return timestamp;
     273    }
     274   
     275    /**
     276        Returns a string padded from the left with a given character to have at
     277        least a given length. If the input string length that is equal to or
     278        larger than the minimum length, the string will be returned unchanged. If
     279        the input string length is smaller than the minimum length, the string
     280        will be padded from the left with the given character until the length is
     281        exactly the given minimum length.
     282       
     283        @param inStr String Input string
     284        @param minChars int The minimum number of characters in the resulting
     285               string
     286        @param padChar char Character to use for optional padding
     287        @return String A string optionally padded from the left to have at least
     288                'minChars' characters.
     289    */
     290    private String leftPaddedString(String inStr, int minChars, char padChar)
     291    {
     292        String startStr = null;
     293        if (inStr != null)
     294        {
     295            startStr = new String(inStr);
     296        }
     297        else
     298        {
     299            startStr = new String("");
     300        }
     301        int startLen = startStr.length();
     302        String resultStr = null;
     303        if (startLen >= minChars)
     304        {
     305            resultStr = startStr;
     306        }
     307        else
     308        {
     309            resultStr = startStr;
     310            for (int i = startLen; i < minChars; i++)
     311            {
     312                resultStr = padChar + resultStr;
     313            }
     314        }
     315        return resultStr;
     316    }
     317   
     318    /**
     319        Returns a form for adding spectrum file contact data for a spectrum file.
     320       
     321        @param project Project The project in whose directory a new output
     322               directory is created.
     323        @param outputDirNameDefault String The default name of the output
     324               directory.
     325        @param user User The user from whose profile default contact information
     326               should be taken.
     327        @return Form for displaying spectrum file contact data.
     328    */
     329    public Form getSpectrumFileContactInputForm(Project project,
     330    String outputDirNameDefault, User user)
     331    {
     332        Form form = new Form("spectrumFileContactInputForm");
     333        // Get potential default contact information from user profile
     334        String defaultName = new String("");
     335        String defaultInstitution = new String("");
     336        String defaultAddress = new String("");
     337        String defaultEmail = new String("");
     338        String defaultContactInfo = new String("");
     339        if (user != null)
     340        {
     341            // Default name
     342            if (user.getName() != null)
     343            {
     344                defaultName = user.getName();
     345            }
     346            // Default institution
     347            if (user.getOrganisation() != null)
     348            {
     349                defaultInstitution = user.getOrganisation();
     350            }
     351            // Default address
     352            if (user.getAddress() != null)
     353            {
     354                defaultAddress = user.getAddress();
     355            }
     356            // Default e-mail
     357            if (user.getEmail() != null)
     358            {
     359                defaultEmail = user.getEmail();
     360            }
     361            // Default contact info
     362            defaultContactInfo = addContactInfoElement(defaultContactInfo, "Name", defaultName);
     363            defaultContactInfo = addContactInfoElement(defaultContactInfo, "Institution", defaultInstitution);
     364            defaultContactInfo = addContactInfoElement(defaultContactInfo, "Address", defaultAddress);
     365            defaultContactInfo = addContactInfoElement(defaultContactInfo, "Phone", user.getPhone());
     366            defaultContactInfo = addContactInfoElement(defaultContactInfo, "Fax", user.getFax());
     367            defaultContactInfo = addContactInfoElement(defaultContactInfo, "e-mail", defaultEmail);
     368        }
     369        //
     370        Fieldset contactInputFS = new Fieldset();
     371        contactInputFS.setTitle("SpectrumFileContactInput");
     372        form.addFieldset(contactInputFS);
     373        //
     374        TextField<String> nameF = new TextField<String>(VNONREQUIRED_NAME);
     375        nameF.setValue(defaultName);
     376        nameF.setLabel("Name");
     377        contactInputFS.add(nameF);
     378        //
     379        TextField<String> institutionF = new TextField<String>(VNONREQUIRED_INSTITUTION);
     380        institutionF.setValue(defaultInstitution);
     381        institutionF.setLabel("Institution");
     382        contactInputFS.add(institutionF);
     383        //
     384        TextField<String> contactInfoF = new TextField<String>(VNONREQUIRED_CONTACT_INFO);
     385        contactInfoF.setValue(defaultContactInfo);
     386        contactInfoF.setLabel("ContactInfo");
     387        contactInputFS.add(contactInfoF);
     388        //
     389        TextField<String> addressF = new TextField<String>(VNONREQUIRED_ADDRESS);
     390        addressF.setValue(defaultAddress);
     391        addressF.setLabel("Address");
     392        contactInputFS.add(addressF);
     393        //
     394        TextField<String> urlF = new TextField<String>(VNONREQUIRED_URL);
     395        urlF.setValue("");
     396        urlF.setLabel("URL");
     397        contactInputFS.add(urlF);
     398        //
     399        TextField<String> emailF = new TextField<String>(VNONREQUIRED_EMAIL);
     400        emailF.setValue(defaultEmail);
     401        emailF.setLabel("email");
     402        contactInputFS.add(emailF);
     403        //
     404        Fieldset contactOutputFS = new Fieldset();
     405        contactOutputFS.setTitle("SpectrumFileContactOutput");
     406        form.addFieldset(contactOutputFS);
     407        //
     408        TextField<String> outputDirNameF = new TextField<String>(VNONREQUIRED_FILENAME);
     409        outputDirNameF.setValue(outputDirNameDefault);
     410        outputDirNameF.setLabel("OutputDirectoryName");
     411        contactOutputFS.add(outputDirNameF);
     412        //
     413        return form;
     414    }
     415       
     416    /**
     417        Adds an element of data to contact info string.
     418       
     419        @param contactInfo String Current contact info string.
     420        @param elementName String Name of contact info element.
     421        @param elementValue String Contents of contact info element.
     422        @return String Contact info string with the added info data.
     423    */
     424    private String addContactInfoElement(String contactInfo, String elementName, String elementValue)
     425    {
     426        if (elementValue != null && !elementValue.equals(""))
     427        {
     428            if (!contactInfo.equals(""))
     429            {
     430                contactInfo += ", ";
     431            }
     432            contactInfo += elementName + ": " + elementValue;
     433        }
     434        return contactInfo;
     435    }
     436   
     437    /**
     438        Tell the application in which context this action should be available
     439    */
     440    public List<Context> listContexts()
     441    {
     442        List<Context> contexts = new ArrayList<Context>(1);
     443        /*
     444            We want our action to appear as an extension when viewing files. Do
     445            this by adding a FileContext to the list of contexts.
     446        */
     447        FileContext files = new FileContext("SpectrumFileContactDataAdder", "Add contact data to spectrum file(s)",
     448        SpectrumFileContactDataAdderExtension.class);
     449        files.setDescription("First select spectrum files, then contact data");
     450        contexts.add(files);
     451        return contexts;
     452    }
    338453}
  • trunk/client/servlet/src/org/proteios/gui/form/FormFactory.java

    r3932 r3934  
    144144    public static final VDate VSTARTDATE = new VDate("startDate", true,Format.DATETIME, Format.DATE);
    145145    public static final VDate VENDDATE = new VDate("endDate", true,Format.DATETIME, Format.DATE);
    146    
    147146    public static final VInteger VBIOMATERIALID = new VInteger("bioMaterialId",1, false);
    148     // TODO what are valid values for the pistart parameter
    149    
    150147    public static final VString VSTAIN = new VString("stain", 0, 255, false);
    151148    public static final VInteger VLABELID = new VInteger("labelId", 0, true);
     
    172169    public static final VString VNONREQUIRED_SAMPLE_COMMENT = new VString("sampleComment", 0, 255, false);
    173170    /**
    174         * logger to use
     171        logger to use
    175172    */
    176173    private static final org.apache.log4j.Logger log = org.apache.log4j.LogManager
     
    178175   
    179176    /**
    180         * Default constructor. Initializes list excludedDeclMethods.
     177        Default constructor. Initializes list excludedDeclMethods.
    181178    */
    182179    public FormFactory()
    183180    {
    184181        /*
    185             * Initialize list excludedDeclMethods.
     182            Initialize list excludedDeclMethods.
    186183        */
    187184        initExcludedDeclMethods();
     
    189186   
    190187    /**
    191         * Get list of excluded getter methods declared in current class.
    192         *
    193         * @return List<String> of excluded getter methods.
     188        Get list of excluded getter methods declared in current class.
     189       
     190        @return List<String> of excluded getter methods.
    194191    */
    195192    public List<String> getExcludedDeclMethods()
     
    199196   
    200197    /**
    201         * Set list of excluded getter methods declared in current class.
    202         *
    203         * @param excludedDeclMethods List<String> of excluded getter methods to
    204         *        set.
     198        Set list of excluded getter methods declared in current class.
     199       
     200        @param excludedDeclMethods List<String> of excluded getter methods to
     201               set.
    205202    */
    206203    public void setExcludedDeclMethods(List<String> excludedDeclMethods)
     
    210207   
    211208    /**
    212         * Add list of excluded getter methods declared in current class.
    213         *
    214         * @param excludedDeclMethods List<String> of excluded getter methods to to
    215         *        add.
     209        Add list of excluded getter methods declared in current class.
     210       
     211        @param excludedDeclMethods List<String> of excluded getter methods to to
     212               add.
    216213    */
    217214    public void addExcludedDeclMethods(List<String> excludedDeclMethods)
     
    220217        {
    221218            /*
    222                 * Add excluded method if not already in list.
     219                Add excluded method if not already in list.
    223220            */
    224221            if (!getExcludedDeclMethods().contains(exclMethod))
     
    308305   
    309306    /**
    310         * Initializes list of excluded getter methods declared in current class.
     307        Initializes list of excluded getter methods declared in current class.
    311308    */
    312309    public void initExcludedDeclMethods()
    313310    {
    314311        /*
    315             * Initialize list of excluded declared methods.
     312            Initialize list of excluded declared methods.
    316313        */
    317314        getExcludedDeclMethods().add("getType");
     
    361358        {
    362359            /*
    363                 * Set valid parameter name to signature of single-argument setter
    364                 * method, if existing, in order to separate between arguments of
    365                 * primitive types like boolean, int, float, and double, from those
    366                 * of wrapper class types like Boolean, Integer, Float, and Double.
     360                Set valid parameter name to signature of single-argument setter
     361                method, if existing, in order to separate between arguments of
     362                primitive types like boolean, int, float, and double, from those
     363                of wrapper class types like Boolean, Integer, Float, and Double.
    367364            */
    368365            setValueMethodSignature = setValueMethodName + ":" + valueClass
     
    396393        {
    397394            /*
    398                 * Set valid parameter name to signature of single-argument setter
    399                 * method, if existing, in order to separate between arguments of
    400                 * primitive types like boolean, int, float, and double, from those
    401                 * of wrapper class types like Boolean, Integer, Float, and Double.
     395                Set valid parameter name to signature of single-argument setter
     396                method, if existing, in order to separate between arguments of
     397                primitive types like boolean, int, float, and double, from those
     398                of wrapper class types like Boolean, Integer, Float, and Double.
    402399            */
    403400            setValueMethodSignature = setValueMethodName + ":" + valueClass
     
    570567   
    571568    /**
    572         * @return Hidden
    573         *         <code>TextField<String> using the valid parameter {@link #VTYPE}.
     569        @return Hidden
     570                <code>TextField<String> using the valid parameter {@link #VTYPE}.
    574571    */
    575572    private TextField<String> newTypeField()
     
    585582   
    586583    /**
    587         * Form for user preferences configuration settings. Arguments
    588         * NotificationConfiguration and TablePreferencesConfiguration are place
    589         * holders for current values for the notification configuration and table
    590         * preferences configuration form fields.
    591         *
    592         * @param nc NotificationConfiguration object (need not be stored in
    593         *        database) with default field values.
    594         * @return Form A form for setting user preferences configuration values.
     584        Form for user preferences configuration settings. Arguments
     585        NotificationConfiguration and TablePreferencesConfiguration are place
     586        holders for current values for the notification configuration and table
     587        preferences configuration form fields.
     588       
     589        @param nc NotificationConfiguration object (need not be stored in
     590               database) with default field values.
     591        @return Form A form for setting user preferences configuration values.
    595592    */
    596593    public Form getUserPreferencesConfigurationForm(
     
    609606   
    610607    /**
    611         * Fieldset for notification configuration settings. Argument
    612         * NotificationConfiguration is place holder for current values for the
    613         * notification configuration form fields.
    614         *
    615         * @param nc NotificationConfiguration object (need not be stored in
    616         *        database) with default field values.
    617         * @return Fieldset A fieldset for setting NotificationConfiguration values.
     608        Fieldset for notification configuration settings. Argument
     609        NotificationConfiguration is place holder for current values for the
     610        notification configuration form fields.
     611       
     612        @param nc NotificationConfiguration object (need not be stored in
     613               database) with default field values.
     614        @return Fieldset A fieldset for setting NotificationConfiguration values.
    618615    */
    619616    public Fieldset getNotificationConfigurationFieldset(
     
    666663   
    667664    /**
    668         * Creates a select box for notification mode.
    669         *
    670         * @param modeValue int Mode value for default selection.
    671         * @return Select<VInteger> Select box for notification mode selection
     665        Creates a select box for notification mode.
     666       
     667        @param modeValue int Mode value for default selection.
     668        @return Select<VInteger> Select box for notification mode selection
    672669    */
    673670    private Select<VInteger> getNotificationModeSelectBox(int modeValue)
     
    694691   
    695692    /**
    696         * Fieldset for table preferences configuration settings. Argument
    697         * TablePreferencesConfiguration is place holder for current values for the
    698         * table preferences configuration form fields.
    699         *
    700         * @param tpc TablePreferencesConfiguration object (need not be stored in
    701         *        database) with default field values.
    702         * @return Fieldset A field set for setting TablePreferencesConfiguration
    703         *         values.
     693        Fieldset for table preferences configuration settings. Argument
     694        TablePreferencesConfiguration is place holder for current values for the
     695        table preferences configuration form fields.
     696       
     697        @param tpc TablePreferencesConfiguration object (need not be stored in
     698               database) with default field values.
     699        @return Fieldset A field set for setting TablePreferencesConfiguration
     700                values.
    704701    */
    705702    public Fieldset getTablePreferencesConfigurationFieldset(
     
    729726   
    730727    /**
    731         * Creates a select box for table preferences mode.
    732         *
    733         * @param modeValue int Mode value for default selection.
    734         * @return Select<VInteger> Select box for table preferences mode selection
     728        Creates a select box for table preferences mode.
     729       
     730        @param modeValue int Mode value for default selection.
     731        @return Select<VInteger> Select box for table preferences mode selection
    735732    */
    736733    private Select<VInteger> getTablePreferencesModeSelectBox(int modeValue)
     
    757754   
    758755    /**
    759         * This will probably be removed when fixint #691
    760         * @param peaklist to edit, or null if an empty form is needed
    761         * @return Form for editing a peaklist
     756        This will probably be removed when fixint #691
     757        @param peaklist to edit, or null if an empty form is needed
     758        @return Form for editing a peaklist
    762759    */
    763760    public Form getPeakListForm(PeakList peaklist)
     
    767764        Annotator anna = new Annotator(factory);
    768765        /***********************************************************************
    769             * Properties fieldset
     766            Properties fieldset
    770767        */
    771768        Fieldset propertiesFS = new Fieldset();
     
    776773        propertiesFS.add(spectrumIdF);
    777774        /***********************************************************************
    778             * Precursor
     775            Precursor
    779776        */
    780777        Fieldset precursorFS = new Fieldset();
    781778        precursorFS.setTitle("Precursor");
    782779        /***********************************************************************
    783             * Peaklistset fieldset
     780            Peaklistset fieldset
    784781        */
    785782        Fieldset peaklistsetFS = new Fieldset();
     
    800797        }
    801798        /***********************************************************************
    802             * Init fields
     799            Init fields
    803800        */
    804801        if (peaklist != null)
     
    811808            }
    812809            /*******************************************************************
    813                 * Precursors
     810                Precursors
    814811            */
    815812            for (Precursor pc : peaklist.getPrecursorsQuery().list(
     
    846843        }
    847844        /***********************************************************************
    848             * Form
     845            Form
    849846        */
    850847        Form form = new Form("Peaklist");
     
    856853   
    857854    /**
    858         * @param hit Current Hit
    859         * @param peakListFile Core file with peakList, or null
    860         * @param peaklist to display, or null
    861         * @return Form for displaying peaklist for hit
     855        @param hit Current Hit
     856        @param peakListFile Core file with peakList, or null
     857        @param peaklist to display, or null
     858        @return Form for displaying peaklist for hit
    862859    */
    863860    public Form getHitPeakListForm(Hit hit, File peakListFile,
     
    868865        Annotator anna = new Annotator(factory);
    869866        /***********************************************************************
    870             * Properties fieldset
     867            Properties fieldset
    871868        */
    872869        Fieldset propertiesFS = new Fieldset();
    873870        propertiesFS.setTitle("Properties");
    874871        /*
    875             * Hit id field.
     872            Hit id field.
    876873        */
    877874        TextField<String> hitDescription = new TextField<String>(new VString(
     
    895892        propertiesFS.add(hitId);
    896893        /*
    897             * If there is a SpectrumSearch in the DB we can find modifications etc.
     894            If there is a SpectrumSearch in the DB we can find modifications etc.
    898895        */
    899896        if (spectrumSearch != null)
     
    916913        }
    917914        /*
    918             * File name field.
     915            File name field.
    919916        */
    920917        TextField<String> fileNameF = new TextField<String>(new VString(
     
    930927        propertiesFS.add(fileNameF);
    931928        /*
    932             * SpectrumId field.
     929            SpectrumId field.
    933930        */
    934931        // TextField<Integer> spectrumIdF = new TextField<Integer>(new VInteger(
     
    947944        propertiesFS.add(spectrumIdF);
    948945        /*
    949             * Retention time in minutes
     946            Retention time in minutes
    950947        */
    951948        TextField<String> timeInMinutesF = new TextField<String>(new VString(
     
    967964        propertiesFS.add(timeInMinutesF);
    968965        /***********************************************************************
    969             * Optional PeakList fieldsets
     966            Optional PeakList fieldsets
    970967        */
    971968        Fieldset precursorFS = null;
     
    974971        {
    975972            /*******************************************************************
    976                 * Precursor
     973                Precursor
    977974            */
    978975            precursorFS = new Fieldset();
    979976            precursorFS.setTitle("Precursor");
    980977            /*******************************************************************
    981                 * Peaklistset fieldset
     978                Peaklistset fieldset
    982979            */
    983980            peaklistsetFS = new Fieldset();
     
    988985            peaklistsetFS.add(plsNameF);
    989986            /*******************************************************************
    990                 * Init fields
     987                Init fields
    991988            */
    992989            // spectrumIdF.setValue(peaklist.getSpectrumId());
     
    10091006            {
    10101007                /*
    1011                     * Do not display empty PeakListSet field set.
     1008                    Do not display empty PeakListSet field set.
    10121009                */
    10131010                peaklistsetFS = null;
    10141011            }
    10151012            /*******************************************************************
    1016                 * Precursors
     1013                Precursors
    10171014            */
    10181015            for (Precursor pc : peaklist.getPrecursorList())
     
    10501047            {
    10511048                /*
    1052                     * Do not display empty Precursor field set.
     1049                    Do not display empty Precursor field set.
    10531050                */
    10541051                precursorFS = null;
     
    10561053        }
    10571054        /***********************************************************************
    1058             * Form
     1055            Form
    10591056        */
    10601057        Form form = new Form("HitPeaklist");
     
    10721069   
    10731070    /**
    1074         * @param a annotation
    1075         * @return String
     1071        @param a annotation
     1072        @return String
    10761073    */
    10771074    private String joinAnnotationValues(Annotation a)
     
    10851082   
    10861083    /**
    1087         * Returns a form for selecting spectrum mass range limits.
    1088         *
    1089         * @param massCutoffLow String The lower cutoff mass value.
    1090         * @param massCutoffHigh String The upper cutoff mass value.
    1091         * @param spectrumId String The spectrum Id string.
    1092         * @return Form for selecting mass range limits.
     1084        Returns a form for selecting spectrum mass range limits.
     1085       
     1086        @param massCutoffLow String The lower cutoff mass value.
     1087        @param massCutoffHigh String The upper cutoff mass value.
     1088        @param spectrumId String The spectrum Id string.
     1089        @return Form for selecting mass range limits.
    10931090    */
    10941091    public Form getSpectrumMassRangeSelectionForm(String massCutoffLow,
     
    10961093    {
    10971094        /***********************************************************************
    1098             * Mass range fieldset
     1095            Mass range fieldset
    10991096        */
    11001097        Fieldset massRangeFS = new Fieldset();
     
    11251122        massRangeFS.add(spectrumIdF);
    11261123        /***********************************************************************
    1127             * Form
     1124            Form
    11281125        */
    11291126        Form form = new Form("MassRangeSelectionForm");
     
    11341131   
    11351132    /**
    1136         * Returns a form with spectrum properties for a spectrum obtained from a
    1137         * spectrum file.
    1138         *
    1139         * @param spectrumFile File Core file with spectrum.
    1140         * @param spectrumId String Spectrum id string.
    1141         * @param spectrum SpectrumInterface spectrum data.
    1142         * @return Form for displaying spectrum properties
     1133        Returns a form with spectrum properties for a spectrum obtained from a
     1134        spectrum file.
     1135       
     1136        @param spectrumFile File Core file with spectrum.
     1137        @param spectrumId String Spectrum id string.
     1138        @param spectrum SpectrumInterface spectrum data.
     1139        @return Form for displaying spectrum properties
    11431140    */
    11441141    public Form getSpectrumPropertiesForm(File spectrumFile, String spectrumId,
     
    11461143    {
    11471144        /***********************************************************************
    1148             * Properties fieldset
     1145            Properties fieldset
    11491146        */
    11501147        Fieldset propertiesFS = new Fieldset();
     
    11561153        propertiesFS.add(propertiesTable);
    11571154        /*
    1158             * File name
     1155            File name
    11591156        */
    11601157        String peakListFileName = null;
     
    11651162        addTableRow(propertiesTable, "Filename", peakListFileName, null, 0);
    11661163        /*
    1167             * File type
     1164            File type
    11681165        */
    11691166        String spectrumFileType = null;
     
    11771174        addTableRow(propertiesTable, "FileType", spectrumFileType, null, 0);
    11781175        /*
    1179             * SpectrumId
     1176            SpectrumId
    11801177        */
    11811178        String spectrumIdStr = null;
     
    11861183        addTableRow(propertiesTable, "SpectrumId", spectrumIdStr, null, 0);
    11871184        /*
    1188             * Retention time in minutes
     1185            Retention time in minutes
    11891186        */
    11901187        String timeInMinutesStr = null;
     
    12051202        timeInMinutesStr, null, 0);
    12061203        /***********************************************************************
    1207             * Optional spectrum fieldset
     1204            Optional spectrum fieldset
    12081205        */
    12091206        Table precursorTable = null;
     
    12131210            {
    12141211                /***************************************************************
    1215                     * Precursors
     1212                    Precursors
    12161213                */
    12171214                int precursorNo = 0;
     
    12731270                    }
    12741271                    /*
    1275                         * Precursor extra data
     1272                        Precursor extra data
    12761273                    */
    12771274                    List<StringPairInterface> dataList = pc.getExtraDataList();
     
    12941291                    }
    12951292                    /*
    1296                         * Precursor fragmentation type
     1293                        Precursor fragmentation type
    12971294                    */
    12981295                    SpectrumPrecursor.FragmentationType fragmentationType = pc
     
    13101307            {
    13111308                /*
    1312                     * Extra data.
     1309                    Extra data.
    13131310                */
    13141311                Table extraDataTable = new Table("AdditionalInformation");
     
    13391336        }
    13401337        /***********************************************************************
    1341             * Form
     1338            Form
    13421339        */
    13431340        Form form = new Form("SpectrumProperties");
     
    13471344   
    13481345    /**
    1349         * Returns a form with spectrum file instrument data for a spectrum file.
    1350         *
    1351         * @param spectrumFileInstrumentList List<SpectrumFileInstrumentInterface>
    1352         *        Spectrum file instrument list.
    1353         * @return Form for displaying spectrum file instrument data.
     1346        Returns a form with spectrum file instrument data for a spectrum file.
     1347       
     1348        @param spectrumFileInstrumentList List<SpectrumFileInstrumentInterface>
     1349               Spectrum file instrument list.
     1350        @return Form for displaying spectrum file instrument data.
    13541351    */
    13551352    public Form getSpectrumFileInstrumentForm(
     
    13621359        }
    13631360        /***********************************************************************
    1364             * Instrument fieldset
     1361            Instrument fieldset
    13651362        */
    13661363        Fieldset instrumentFS = new Fieldset();
     
    13711368            List<StringPairInterface> dataList;
    13721369            /*
    1373                 * Name field.
     1370                Name field.
    13741371            */
    13751372            Table instrumentGeneralTable = new Table(
     
    13921389            // instrumentFS.add(instrumentGeneralTable);
    13931390            /*
    1394                 * Serial No field.
     1391                Serial No field.
    13951392            */
    13961393            String instrumentSerialNo = null;
     
    14041401            instrumentFS.add(instrumentGeneralTable);
    14051402            /*
    1406                 * Source field.
     1403                Source field.
    14071404            */
    14081405            Table sourceTable = new Table("SourceInformation");
     
    14301427            instrumentFS.add(sourceTable);
    14311428            /*
    1432                 * AnalyzerList field.
     1429                AnalyzerList field.
    14331430            */
    14341431            List<SpectrumFileAnalyzerInterface> analyzerList = spectrumFileInstrument
     
    14401437                    Table analyzerTable = new Table("AnalyzerListInformation");
    14411438                    /*
    1442                         * // Only add table title header for first table if (j ==
    1443                         * 0) { analyzerTable.setTitle("AnalyzerListInformation"); }
     1439                        // Only add table title header for first table if (j ==
     1440                        0) { analyzerTable.setTitle("AnalyzerListInformation"); }
    14441441                    */
    14451442                    // analyzerTable.add(new Column<String>("Property"));
     
    14741471            }
    14751472            /*
    1476                 * Detector field.
     1473                Detector field.
    14771474            */
    14781475            Table detectorTable = new Table("DetectorInformation");
     
    15001497            instrumentFS.add(detectorTable);
    15011498            /*
    1502                 * Additional field.
     1499                Additional field.
    15031500            */
    15041501            Table additionalTable = new Table("AdditionalInformation");
     
    15271524        }
    15281525        /***********************************************************************
    1529             * Form
     1526            Form
    15301527        */
    15311528        Form form = new Form("InstrumentInformation");
     
    15351532   
    15361533    /**
    1537         * Adds a table row to a table. A "value" argument that is null will be
    1538         * represented as an empty string, otherwise by its toString() value.
    1539         *
    1540         * @param table Table The table to add a row to.
    1541         * @param nameKey String Property key string.
    1542         * @param value Object Property value object.
    1543         * @param actionClass Class<E extends ProteiosAction> Optional value cell
    1544         *        action.
    1545         * @param itemId int The item id to use for an optional action.
     1534        Adds a table row to a table. A "value" argument that is null will be
     1535        represented as an empty string, otherwise by its toString() value.
     1536       
     1537        @param table Table The table to add a row to.
     1538        @param nameKey String Property key string.
     1539        @param value Object Property value object.
     1540        @param actionClass Class<E extends ProteiosAction> Optional value cell
     1541               action.
     1542        @param itemId int The item id to use for an optional action.
    15461543    */
    15471544    private void addTableRow(Table table, String nameKey, Object value,
     
    15761573   
    15771574    /**
    1578         * Returns a form with spectrum file contact data for a spectrum file.
    1579         *
    1580         * @param spectrumContact Spectrum file contact
    1581         *        data.
    1582         * @return Form for displaying spectrum file contact data.
     1575        Returns a form with spectrum file contact data for a spectrum file.
     1576       
     1577        @param spectrumContact Spectrum file contact
     1578               data.
     1579        @return Form for displaying spectrum file contact data.
    15831580    */
    15841581    public Form getSpectrumFileContactForm(
     
    15901587        }
    15911588        /***********************************************************************
    1592             * Contact fieldset
     1589            Contact fieldset
    15931590        */
    15941591        Fieldset contactFS = new Fieldset();
     
    16001597        contactFS.add(contactTable);
    16011598        /*
    1602             * Name
     1599            Name
    16031600        */
    16041601        String name = null;
     
    16091606        addTableRow(contactTable, "Name", name, null, 0);
    16101607        /*
    1611             * Institution
     1608            Institution
    16121609        */
    16131610        String institution = null;
     
    16181615        addTableRow(contactTable, "Institution", institution, null, 0);
    16191616        /*
    1620             * ContactInfo
     1617            ContactInfo
    16211618        */
    16221619        String contactInfo = null;
     
    16271624        addTableRow(contactTable, "ContactInfo", contactInfo, null, 0);
    16281625        /*
    1629             * Address
     1626            Address
    16301627        */
    16311628        String address = null;
     
    16361633        addTableRow(contactTable, "Address", address, null, 0);
    16371634        /*
    1638             * URL
     1635            URL
    16391636        */
    16401637        String url = null;
     
    16451642        addTableRow(contactTable, "URL", url, null, 0);
    16461643        /*
    1647             * Email
     1644            Email
    16481645        */
    16491646        String email = null;
     
    16541651        addTableRow(contactTable, "Email", email, null, 0);
    16551652        /***********************************************************************
    1656             * Form
     1653            Form
    16571654        */
    16581655        Form form = new Form("ContactInformation");
     
    16601657        return form;
    16611658    }
    1662    
     1659       
    16631660    /**
    1664         * Returns a form for adding spectrum file contact data for a spectrum file.
    1665         *
    1666         * @param project Project The project in whose directory a new output
    1667         *        directory is created.
    1668         * @param outputDirNameDefault String The default name of the output
    1669         *        directory.
    1670         * @param user User The user from whose profile default contact information
    1671         *        should be taken.
    1672         * @return Form for displaying spectrum file contact data.
    1673     */
    1674     public Form getSpectrumFileContactInputForm(Project project,
    1675     String outputDirNameDefault, User user)
    1676     {
    1677         Form form = new Form("spectrumFileContactInputForm");
    1678         // Get potential default contact information from user profile
    1679         String defaultName = new String("");
    1680         String defaultInstitution = new String("");
    1681         String defaultAddress = new String("");
    1682         String defaultEmail = new String("");
    1683         String defaultContactInfo = new String("");
    1684         if (user != null)
    1685         {
    1686             // Default name
    1687             if (user.getName() != null)
    1688             {
    1689                 defaultName = user.getName();
    1690             }
    1691             // Default institution
    1692             if (user.getOrganisation() != null)
    1693             {
    1694                 defaultInstitution = user.getOrganisation();
    1695             }
    1696             // Default address
    1697             if (user.getAddress() != null)
    1698             {
    1699                 defaultAddress = user.getAddress();
    1700             }
    1701             // Default e-mail
    1702             if (user.getEmail() != null)
    1703             {
    1704                 defaultEmail = user.getEmail();
    1705             }
    1706             // Default contact info
    1707             defaultContactInfo = addContactInfoElement(defaultContactInfo,
    1708             "Name", defaultName);
    1709             defaultContactInfo = addContactInfoElement(defaultContactInfo,
    1710             "Institution", defaultInstitution);
    1711             defaultContactInfo = addContactInfoElement(defaultContactInfo,
    1712             "Address", defaultAddress);
    1713             defaultContactInfo = addContactInfoElement(defaultContactInfo,
    1714             "Phone", user.getPhone());
    1715             defaultContactInfo = addContactInfoElement(defaultContactInfo,
    1716             "Fax", user.getFax());
    1717             defaultContactInfo = addContactInfoElement(defaultContactInfo,
    1718             "e-mail", defaultEmail);
    1719         }
    1720         //
    1721         Fieldset contactInputFS = new Fieldset();
    1722         contactInputFS.setTitle("SpectrumFileContactInput");
    1723         form.addFieldset(contactInputFS);
    1724         //
    1725         TextField<String> nameF = new TextField<String>(VNONREQUIRED_NAME);
    1726         nameF.setValue(defaultName);
    1727         nameF.setLabel("Name");
    1728         contactInputFS.add(nameF);
    1729         //
    1730         TextField<String> institutionF = new TextField<String>(
    1731         VNONREQUIRED_INSTITUTION);
    1732         institutionF.setValue(defaultInstitution);
    1733         institutionF.setLabel("Institution");
    1734         contactInputFS.add(institutionF);
    1735         //
    1736         TextField<String> contactInfoF = new TextField<String>(
    1737         VNONREQUIRED_CONTACT_INFO);
    1738         contactInfoF.setValue(defaultContactInfo);
    1739         contactInfoF.setLabel("ContactInfo");
    1740         contactInputFS.add(contactInfoF);
    1741         //
    1742         TextField<String> addressF = new TextField<String>(VNONREQUIRED_ADDRESS);
    1743         addressF.setValue(defaultAddress);
    1744         addressF.setLabel("Address");
    1745         contactInputFS.add(addressF);
    1746         //
    1747         TextField<String> urlF = new TextField<String>(VNONREQUIRED_URL);
    1748         urlF.setValue("");
    1749         urlF.setLabel("URL");
    1750         contactInputFS.add(urlF);
    1751         //
    1752         TextField<String> emailF = new TextField<String>(VNONREQUIRED_EMAIL);
    1753         emailF.setValue(defaultEmail);
    1754         emailF.setLabel("email");
    1755         contactInputFS.add(emailF);
    1756         //
    1757         Fieldset contactOutputFS = new Fieldset();
    1758         contactOutputFS.setTitle("SpectrumFileContactOutput");
    1759         form.addFieldset(contactOutputFS);
    1760         //
    1761         TextField<String> outputDirNameF = new TextField<String>(
    1762         VNONREQUIRED_FILENAME);
    1763         outputDirNameF.setValue(outputDirNameDefault);
    1764         outputDirNameF.setLabel("OutputDirectoryName");
    1765         contactOutputFS.add(outputDirNameF);
    1766         //
    1767         /*
    1768             * Checkbox<VBoolean> overwriteExistingContactDataCB = new Checkbox<VBoolean>(
    1769             * SpectrumFileContactDataAdder.VOVERWRITEEXISTINGCONTACTDATAFLAG);
    1770             * overwriteExistingContactDataCB.setLabel("OverwriteExistingContactData");
    1771             * overwriteExistingContactDataCB.setValue("true");
    1772             * overwriteExistingContactDataCB.isChecked(true);
    1773             * contactOutputFS.add(overwriteExistingContactDataCB);
    1774         */
    1775         //
    1776         return form;
    1777     }
    1778    
    1779     /**
    1780         * Adds an element of data to contact info string.
    1781         *
    1782         * @param contactInfo String Current contact info string.
    1783         * @param elementName String Name of contact info element.
    1784         * @param elementValue String Contents of contact info element.
    1785         * @return String Contact info string with the added info data.
    1786     */
    1787     private String addContactInfoElement(String contactInfo,
    1788     String elementName, String elementValue)
    1789     {
    1790         if (elementValue != null && !elementValue.equals(""))
    1791         {
    1792             if (!contactInfo.equals(""))
    1793             {
    1794                 contactInfo += ", ";
    1795             }
    1796             contactInfo += elementName + ": " + elementValue;
    1797         }
    1798         return contactInfo;
    1799     }
    1800    
    1801     /**
    1802         * Returns a form for adding spectrum file sample data for a spectrum file.
    1803         *
    1804         * @param project Project The project in whose directory a new output
    1805         *        directory is created.
    1806         * @param outputDirNameDefault String The default name of the output
    1807         *        directory.
    1808         * @return Form for displaying spectrum file contact data.
     1661        Returns a form for adding spectrum file sample data for a spectrum file.
     1662       
     1663        @param project Project The project in whose directory a new output
     1664               directory is created.
     1665        @param outputDirNameDefault String The default name of the output
     1666               directory.
     1667        @return Form for displaying spectrum file contact data.
    18091668    */
    18101669    public Form getSpectrumFileSampleInputForm(Project project,
     
    18301689        //
    18311690        /*
    1832             * TextField<String> stateF = new TextField<String>(VNONREQUIRED_SAMPLE_STATE);
    1833             * stateF.setValue(""); stateF.setLabel("SampleState");
    1834             * sampleInputFS.add(stateF);
     1691            TextField<String> stateF = new TextField<String>(VNONREQUIRED_SAMPLE_STATE);
     1692            stateF.setValue(""); stateF.setLabel("SampleState");
     1693            sampleInputFS.add(stateF);
    18351694        */
    18361695        // Sample state select box
     
    18901749        //
    18911750        /*
    1892             * Checkbox<VBoolean> overwriteExistingSampleDataCB = new Checkbox<VBoolean>(
    1893             * SpectrumFileSampleDataAdder.VOVERWRITEEXISTINGSAMPLEDATAFLAG);
    1894             * overwriteExistingSampleDataCB.setLabel("OverwriteExistingSampleData");
    1895             * overwriteExistingSampleDataCB.setValue("true");
    1896             * overwriteExistingSampleDataCB.isChecked(true);
    1897             * sampleOutputFS.add(overwriteExistingSampleDataCB);
     1751            Checkbox<VBoolean> overwriteExistingSampleDataCB = new Checkbox<VBoolean>(
     1752            SpectrumFileSampleDataAdder.VOVERWRITEEXISTINGSAMPLEDATAFLAG);
     1753            overwriteExistingSampleDataCB.setLabel("OverwriteExistingSampleData");
     1754            overwriteExistingSampleDataCB.setValue("true");
     1755            overwriteExistingSampleDataCB.isChecked(true);
     1756            sampleOutputFS.add(overwriteExistingSampleDataCB);
    18981757        */
    18991758        //
     
    19131772    {
    19141773        /***********************************************************************
    1915             * Properties fieldset
     1774            Properties fieldset
    19161775        */
    19171776        Fieldset properties = new Fieldset();
     
    19271786        properties.add(descrF);
    19281787        /***********************************************************************
    1929             * Hardware configuration
     1788            Hardware configuration
    19301789        */
    19311790        Fieldset instrumentFS = new Fieldset();
    19321791        instrumentFS.setTitle("Instrument");
    19331792        /***********************************************************************
    1934             * Analyzers
     1793            Analyzers
    19351794        */
    19361795        Fieldset analyzersFS = new Fieldset();
    19371796        analyzersFS.setTitle("Analyzers");
    19381797        /***********************************************************************
    1939             * Set field values
     1798            Set field values
    19401799        */
    19411800        if (pls != null)
     
    19461805            instrumentFS.add(newTextField("Hardware", hw.getName()));
    19471806            /*******************************************************************
    1948                 * Analyzer annotation values
     1807                Analyzer annotation values
    19491808            */
    19501809            List<HardwareConfiguration> analyzerList = pls.getAnalyzers();
     
    19611820            }
    19621821            /*******************************************************************
    1963                 * PeakListSet values
     1822                PeakListSet values
    19641823            */
    19651824            itemIdF.setValue(pls.getId());
     
    19681827        }
    19691828        /***********************************************************************
    1970             * Form
     1829            Form
    19711830        */
    19721831        Form form = new Form("peakListSetForm");
     
    19811840    {
    19821841        /***********************************************************************
    1983             * Properties
     1842            Properties
    19841843        */
    19851844        Fieldset fs = new Fieldset();
     
    20181877        fs.add(nameF);
    20191878        /***********************************************************************
    2020             * Form
     1879            Form
    20211880        */
    20221881        Form form = new Form("exportPeakListSetForm");
     
    21251984   
    21261985    /**
    2127         * Creates and adds a hidden field with an Integer value to the given form.
    2128         * Introduced to solve problem in #623
     1986        Creates and adds a hidden field with an Integer value to the given form.
     1987        Introduced to solve problem in #623
    21291988    */
    21301989    public void addHiddenField(Form form, VInteger param, Integer value)
     
    21371996   
    21381997    /**
    2139         * Creates and adds a hidden field with an Integer value to the given table.
    2140         * Introduced to solve problem in #623
     1998        Creates and adds a hidden field with an Integer value to the given table.
     1999        Introduced to solve problem in #623
    21412000    */
    21422001    public void addHiddenField(Table table, VInteger param, Integer value)
     
    23352194        properties.add(filterValueF);
    23362195        /*
    2337             * The following section stores information on previous settings in
    2338             * hidden fields, to be retrieved when the form is verified.
     2196            The following section stores information on previous settings in
     2197            hidden fields, to be retrieved when the form is verified.
    23392198        */
    23402199        // Add forward action id
     
    23722231                String filterVal = null;
    23732232                /*
    2374                     * Note that the list and hash maps may be null here, even
    2375                     * though filter list size > 0. This happens after the form has
    2376                     * been displayed, and a following action verifies the form to
    2377                     * have the form fields filled in with data stored in the
    2378                     * request.
     2233                    Note that the list and hash maps may be null here, even
     2234                    though filter list size > 0. This happens after the form has
     2235                    been displayed, and a following action verifies the form to
     2236                    have the form fields filled in with data stored in the
     2237                    request.
    23792238                */
    23802239                if (getFilterKeyColumnList() != null)
     
    24422301
    24432302    /**
    2444         * Get generic form for object.
    2445         *
    2446         * @param template template for generic form
    2447         * @return Form for editing the object
     2303        Get generic form for object.
     2304       
     2305        @param template template for generic form
     2306        @return Form for editing the object
    24482307    */
    24492308    public Form getForm(Template template)
    24502309    {
    24512310        /***********************************************************************
    2452             * Analyze template
     2311            Analyze template
    24532312        */
    24542313        Form form = null;
     
    24622321   
    24632322    /**
    2464         * Get generic form for object.
    2465         *
    2466         * @param template template for generic form
    2467         * @return Form for editing the object
     2323        Get generic form for object.
     2324       
     2325        @param template template for generic form
     2326        @return Form for editing the object
    24682327    */
    24692328    private Form getFormImpl(FormTemplateInterface formTemplate)
    24702329    {
    24712330        /***********************************************************************
    2472             * Analyze object class
     2331            Analyze object class
    24732332        */
    24742333       
    24752334        /*
    2476             * Get class from formTemplate itemObject or itemClass.
     2335            Get class from formTemplate itemObject or itemClass.
    24772336        */
    24782337        Object itemObject = null;
     
    24882347        }
    24892348        /*
    2490             * Add optional extra formTemplate list of methods to be excluded.
     2349            Add optional extra formTemplate list of methods to be excluded.
    24912350        */
    24922351        if (formTemplate != null && formTemplate.getExcludedDeclMethods() != null)
     
    25012360       
    25022361        /***********************************************************************
    2503             * Main fieldset
     2362            Main fieldset
    25042363        */
    25052364        Fieldset mainFS = new Fieldset();
     
    25072366        mainFS.setTitle(mainFsName);
    25082367        /*
    2509             * Add forward actionId field as first field, for external use.
     2368            Add forward actionId field as first field, for external use.
    25102369        */
    25112370        TextField<String> fwdactionF = new ForwardField();
    25122371        mainFS.add(fwdactionF);
    25132372        /*
    2514             * Get item id, if any.
     2373            Get item id, if any.
    25152374        */
    25162375        int itemId = 0;
     
    25412400        }
    25422401        /*
    2543             * Add itemId field idF (hidden) if itemId value ok.
     2402            Add itemId field idF (hidden) if itemId value ok.
    25442403        */
    25452404        if (itemId > 0)
     
    25522411        }
    25532412        /*
    2554             * Add class name field cnF.
     2413            Add class name field cnF.
    25552414        */
    25562415        String classNameFull = new String("");
     
    25662425        cnF.setDisabled(true);
    25672426        /*
    2568             * Add readOnlyForm field rofF (hidden).
     2427            Add readOnlyForm field rofF (hidden).
    25692428        */
    25702429        TextField<Boolean> rofF = newHiddenReadOnlyFormField();
     
    25742433        rofF.setDisabled(true);
    25752434        /*
    2576             * Keep track on whether public setter methods exist, in order to know
    2577             * if a "Save" button should be added.
     2435            Keep track on whether public setter methods exist, in order to know
     2436            if a "Save" button should be added.
    25782437        */
    25792438        boolean hasSetterMethods = false;
    25802439        /*
    2581             * Methods, declared and inherited
     2440            Methods, declared and inherited
    25822441        */
    25832442        Method[] methodArr = new Method[0];
     
    25882447       
    25892448        /*
    2590             * Methods declared in object class (not inherited)
     2449            Methods declared in object class (not inherited)
    25912450        */
    25922451        Method[] declaredMethodArr = new Method[0];
     
    26022461            String methodReturnType = method.getReturnType().getName();
    26032462            /*
    2604                 * Only process declared methods not in exclude list.
     2463                Only process declared methods not in exclude list.
    26052464            */
    26062465            if (!getExcludedDeclMethods().contains(methodName))
     
    26122471                Class<?> returnTypeOfGetterMethod = null;
    26132472                /*
    2614                     * Check if getter access method.
     2473                    Check if getter access method.
    26152474                */
    26162475                if (methodName.startsWith("get"))
    26172476                {
    26182477                    /*
    2619                         * Assume that attribute name can optained by skipping "get"
    2620                         * in method name.
     2478                        Assume that attribute name can optained by skipping "get"
     2479                        in method name.
    26212480                    */
    26222481                    attrName = methodName.substring(3);
     
    26392498                {
    26402499                    /*
    2641                         * Assume that attribute name can optained by skipping "is"
    2642                         * in method name.
     2500                        Assume that attribute name can optained by skipping "is"
     2501                        in method name.
    26432502                    */
    26442503                    attrName = methodName.substring(2);
     
    26642523                            {
    26652524                                /*
    2666                                     * Return date values in "YYYY-MM-DD HH:mm:ss"
    2667                                     * 24-hour format.
     2525                                    Return date values in "YYYY-MM-DD HH:mm:ss"
     2526                                    24-hour format.
    26682527                                */
    26692528                                if (method.getReturnType().getName().equals(
     
    26952554                    }
    26962555                    /*
    2697                         * Check if public accessor method for setting value exists.
     2556                        Check if public accessor method for setting value exists.
    26982557                    */
    26992558                    boolean isSettable = false;
     
    27102569                    .debug("FormFactory::getFormImpl(): attrName = \"" + attrName + "\" publMethodName = \"" + publMethodName + "\" isSettable = " + isSettable);
    27112570                    /*
    2712                         * Use TextArea for Description, else TextField
     2571                        Use TextArea for Description, else TextField
    27132572                    */
    27142573                    if (attrName.equals("Description"))
    27152574                    {
    27162575                        /*
    2717                             * Value text area
     2576                            Value text area
    27182577                        */
    27192578                        TextArea valueF = null;
     
    27352594                    {
    27362595                        /*
    2737                             * Value field
     2596                            Value field
    27382597                        */
    27392598                        TextField<String> valueF = null;
     
    27572616       
    27582617        /*
    2759             * Check if object supports method getAnnotationSet().
     2618            Check if object supports method getAnnotationSet().
    27602619        */
    27612620        Fieldset annotationFS = null;
     
    27732632            {
    27742633                /***************************************************************
    2775                     * Annotation fieldset
     2634                    Annotation fieldset
    27762635                */
    27772636                annotationFS = new Fieldset();
    27782637                annotationFS.setTitle("Annotations");
    27792638                /*
    2780                     * Get DbControl
     2639                    Get DbControl
    27812640                */
    27822641                DbControl dc = getDbControlForObject(itemObject);
    27832642                /*
    2784                     * Fetch annotations
     2643                    Fetch annotations
    27852644                */
    27862645                if (itemObject != null)
     
    27942653                        {
    27952654                            /*
    2796                                 * Only add annotations that contain something.
     2655                                Only add annotations that contain something.
    27972656                            */
    27982657                            String value = joinAnnotationValues(a);
     
    28002659                            {
    28012660                                /*
    2802                                     * Value (description) field - optional scroll
    2803                                     * bar
     2661                                    Value (description) field - optional scroll
     2662                                    bar
    28042663                                */
    28052664                                TextArea descrF = new DescriptionField();
     
    28262685        }
    28272686        /***********************************************************************
    2828             * Form
     2687            Form
    28292688        */
    28302689        String formName = new String("newForm");
     
    28372696        form.setTitle(clsName);
    28382697        /***********************************************************************
    2839             * Add fieldsets to form
     2698            Add fieldsets to form
    28402699        */
    28412700        form.addFieldset(mainFS);
     
    28452704        }
    28462705        /*
    2847             * Return generated form.
     2706            Return generated form.
    28482707        */
    28492708        return form;
     
    28512710   
    28522711    /**
    2853         * Get DbControl for object.
    2854         *
    2855         * @return DbControl for the object
     2712        Get DbControl for object.
     2713       
     2714        @return DbControl for the object
    28562715    */
    28572716    public DbControl getDbControlForObject(Object itemObject)
    28582717    {
    28592718        /*
    2860             * Get class from itemObject.
     2719            Get class from itemObject.
    28612720        */
    28622721        Class<? extends Object> cls = null;
     
    28712730        String clsName = cls.getSimpleName();
    28722731        /*
    2873             * Check if object supports method getDbControl().
     2732            Check if object supports method getDbControl().
    28742733        */
    28752734        DbControl dc = null;
     
    28822741            {
    28832742                /*
    2884                     * Get DbControl for object
     2743                    Get DbControl for object
    28852744                */
    28862745                try
     
    29032762        }
    29042763        /*
    2905             * Return DbControl.
     2764            Return DbControl.
    29062765        */
    29072766        return dc;
     
    29092768   
    29102769    /**
    2911         * Fetch public method for object, or null if not found.
    2912         *
    2913         * @param publMethodName String Name of public method to search for.
    2914         * @return Method public method for object with desired name, or null if not
    2915         *         found.
     2770        Fetch public method for object, or null if not found.
     2771       
     2772        @param publMethodName String Name of public method to search for.
     2773        @return Method public method for object with desired name, or null if not
     2774                found.
    29162775    */
    29172776    private Method fetchPublicMethodForObject(String publMethodName,
     
    29242783        String clsName = cls.getSimpleName();
    29252784        /*
    2926             * Check if object supports public method with desired name.
     2785            Check if object supports public method with desired name.
    29272786        */
    29282787        Method publMethod = null;
     
    29352794            {
    29362795                /*
    2937                     * Check if method is public.
     2796                    Check if method is public.
    29382797                */
    29392798                int methodMod = method.getModifiers();
     
    29482807   
    29492808    /**
    2950         * Returns a String corresponding to the method modifier: "static",
    2951         * "public", "protected", or "private".
    2952         *
    2953         * @param method
    2954         * @return String for method modifier
     2809        Returns a String corresponding to the method modifier: "static",
     2810        "public", "protected", or "private".
     2811       
     2812        @param method
     2813        @return String for method modifier
    29552814    */
    29562815    private String methodModifierString(Method method)
     
    29902849
    29912850    /**
    2992         * Form for new Protocol item. The difference between calling
    2993         * getNewProtocolForm(protocol) and getForm(Protocol.class, protocol) when
    2994         * protocol != null, is that getForm(Protocol.class, protocol) assumes that
    2995         * the protocol argument is stored in the database, i.e. that
    2996         * protocol.getId() is a valid item id, that can be used as value for a
    2997         * newIdField(), without an exception being thrown. Method
    2998         * getNewProtocolForm() on the other hand only uses the protocol argument as
    2999         * a convenient place holder for default values for the Protocol form
    3000         * fields.
    3001         *
    3002         * @param protocol Protocol object (need not be stored in database) with
    3003         *        default field values.
    3004         * @return Form A form for setting protocol values.
     2851        Form for new Protocol item. The difference between calling
     2852        getNewProtocolForm(protocol) and getForm(Protocol.class, protocol) when
     2853        protocol != null, is that getForm(Protocol.class, protocol) assumes that
     2854        the protocol argument is stored in the database, i.e. that
     2855        protocol.getId() is a valid item id, that can be used as value for a
     2856        newIdField(), without an exception being thrown. Method
     2857        getNewProtocolForm() on the other hand only uses the protocol argument as
     2858        a convenient place holder for default values for the Protocol form
     2859        fields.
     2860       
     2861        @param protocol Protocol object (need not be stored in database) with
     2862               default field values.
     2863        @return Form A form for setting protocol values.
    30052864    */
    30062865    public Form getNewProtocolForm(Protocol protocol)
     
    32673126            // Forward field
    32683127            /*
    3269                 * This hidden forward field sets action id used by the directory
    3270                 * selection action called by MoveFile1.
     3128                This hidden forward field sets action id used by the directory
     3129                selection action called by MoveFile1.
    32713130            */
    32723131            TextField<String> forwardF = new ForwardField();
     
    35153374   
    35163375    /**
    3517         * Creates a select box for protocols. If the class for which the protocol
    3518         * is intended is supported by the method, only protocols with correct
    3519         * protocol type are included. If an input object with attached protocol
    3520         * exists, the latter protocol should appear in the list and be selected, if
    3521         * if the protocol is tagged to be removed. However, no other protocols
    3522         * tagged to be removed should be included in the list.
    3523         *
    3524         * @param cls Class Class for which a protocol should be selected.
    3525         * @param obj Object Optional object with attached protocol for setting
    3526         *        default protocol.
    3527         * @return Select<VInteger> Select box for protocol selection
     3376        Creates a select box for protocols. If the class for which the protocol
     3377        is intended is supported by the method, only protocols with correct
     3378        protocol type are included. If an input object with attached protocol
     3379        exists, the latter protocol should appear in the list and be selected, if
     3380        if the protocol is tagged to be removed. However, no other protocols
     3381        tagged to be removed should be included in the list.
     3382       
     3383        @param cls Class Class for which a protocol should be selected.
     3384        @param obj Object Optional object with attached protocol for setting
     3385               default protocol.
     3386        @return Select<VInteger> Select box for protocol selection
    35283387    */
    35293388    private Select<VInteger> getProtocolSelectBox(Class cls, Object obj)
Note: See TracChangeset for help on using the changeset viewer.