Changeset 3805


Ignore:
Timestamp:
Sep 1, 2010, 9:17:58 AM (13 years ago)
Author:
Gregory Vincic
Message:

Refs #698. Removed methods getImportFileForm and selectImportPlugins from FormFactory. Also introduced classes ImportFileForm and ImportPluginSelect.

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

Legend:

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

    r2399 r3805  
    3535import org.proteios.gui.Title;
    3636import org.proteios.gui.Toolbar;
    37 import org.proteios.gui.form.Form;
     37import org.proteios.gui.form.*;
    3838import org.proteios.gui.layout.RowLayout;
    3939import se.lu.thep.waf.ActionException;
     
    6363    Integer fileId = getSessionAttribute(ViewActiveFile.VFILEID);
    6464    File file = factory.getById(File.class, fileId);
    65     Form form = getFormFactory().getImportFileForm(file);
     65    Form form = new ImportFileForm(file);
    6666    /***********************************************************************
    6767     * Toolbar
  • trunk/client/servlet/src/org/proteios/action/plugin/CreateFileImportJob.java

    r1916 r3805  
    3636import org.proteios.core.Job;
    3737import org.proteios.core.PluginDefinition;
    38 import org.proteios.gui.form.Form;
    39 import org.proteios.gui.form.FormFactory;
     38import org.proteios.gui.form.*;
    4039import se.lu.thep.waf.ActionException;
    4140import se.lu.thep.waf.constraints.InvalidParameterValue;
     
    5756     * Verify parameters
    5857     */
    59     Form form = getFormFactory().getImportFileForm(null);
    60     verifyParameters(form);
    61     Integer fileId = getValidInteger(FormFactory.VID);
    62     Integer pluginDefId = getValidInteger(FormFactory.VPLUGINDEFID);
     58    Integer fileId = getValidInteger(ItemIdField.VPARAM);
     59    Integer pluginDefId = getValidInteger(ImportPluginSelect.VPARAM);
    6360    /***********************************************************************
    6461     * Create job
  • trunk/client/servlet/src/org/proteios/gui/form/FileTypeForm.java

    r3804 r3805  
    22 $Id$
    33
    4  Copyright (C) 2006, 2007,2009 Gregory Vincic
     4 Copyright (C) 2010 Gregory Vincic
    55
    66 Files are copyright by their respective authors. The contributions to
     
    1111 Available at http://www.proteios.org/
    1212
    13  proteios-2.x is free software; you can redistribute it and/or
     13 Proteios is free software; you can redistribute it and/or
    1414 modify it under the terms of the GNU General Public License
    1515 as published by the Free Software Foundation; either version 2
  • trunk/client/servlet/src/org/proteios/gui/form/FormFactory.java

    r3804 r3805  
    179179/**
    180180 * Generates various forms used in the gui. It also populates forms from
    181  * requests.
     181 * requests. NOTE! this class will be deprecated shortly
    182182 *
    183183 * @author gregory
    184  * @deprecated Do not use this class. Create your own form classes in package org.proteios.gui.form or reuse the existing ones.
    185184 */
    186185public class FormFactory
     
    241240    1, 255, false);
    242241  public static final VInteger VPLUGINDEFID = new VInteger("definitionId", 1,
    243     true);
     242    true); // Remove
    244243  public static final VDate VCDATE = new VDate("created", false,
    245244    Format.DATETIME);
     
    11191118 // Cleaning up from here
    11201119
    1121   private Select<VInteger> selectImportPlugins(DbControl dc,
    1122       Plugin.MainType... types)
    1123   {
    1124     Select<VInteger> typeS = new Select<VInteger>(VPLUGINDEFID);
    1125     typeS.setLabel("Plugin");
    1126     if (dc != null && dc.isConnected())
    1127     {
    1128       ItemQuery<PluginDefinition> query = PluginDefinition.getQuery();
    1129       query.include(Include.SHARED);
    1130       Expression[] exp = new Expression[types.length];
    1131       int i = 0;
    1132       for (MainType type : types)
    1133       {
    1134         exp[i] = Expressions.integer(type.getValue());
    1135         i++;
    1136       }
    1137       query.restrict(Restrictions.in(Hql.property("mainType"), exp));
    1138       query.order(Orders.asc(Hql.property("mainType")));
    1139       for (PluginDefinition pd : query.list(dc))
    1140       {
    1141         Option o = new Option(pd.getId(), pd.getName());
    1142         typeS.addOption(o);
    1143       }
    1144     }
    1145     return typeS;
    1146   }
    1147 
    1148 
    1149   /**
    1150    * @param file the file to import
    1151    * @return Form representing the import plugins for a file
    1152    */
    1153   public Form getImportFileForm(File file)
    1154   {
    1155     Fieldset fs = new Fieldset();
    1156     fs.getLegendTitle().setTitle("ImportPlugins");
    1157     // id
    1158     TextField<Integer> itemIdF = newHiddenItemIdField();
    1159     fs.add(itemIdF);
    1160     // Select field
    1161     if (file != null)
    1162     {
    1163       itemIdF.setValue(file.getId());
    1164       Select<VInteger> typeS = selectImportPlugins(file.getDbControl(),
    1165         Plugin.MainType.IMPORT);
    1166       fs.add(typeS);
    1167     }
    1168     /***********************************************************************
    1169      * Form
    1170      */
    1171     Form form = new Form("importPluginsForm");
    1172     form.setTitle("File plugins");
    1173     form.addFieldset(fs);
    1174     return form;
    1175   }
    1176 
    1177 
    11781120  public Form getSelectPluginForm(DbControl dc, Plugin.MainType... types)
    11791121  {
     
    11821124    if (dc != null)
    11831125    {
    1184       Select<VInteger> typeS = selectImportPlugins(dc, types);
     1126      Select<VInteger> typeS = new ImportPluginSelect(dc, types);
    11851127      fs.add(typeS);
    11861128    }
     
    29012843      properties.add(getPlateExternalIdField());
    29022844      // Selector of plugins
    2903       properties.add(selectImportPlugins(dc, Plugin.MainType.IMPORT,
     2845      properties.add(new ImportPluginSelect(dc, Plugin.MainType.IMPORT,
    29042846        Plugin.MainType.OTHER));
    29052847      //
Note: See TracChangeset for help on using the changeset viewer.