Changeset 3802


Ignore:
Timestamp:
Aug 31, 2010, 9:34:41 AM (13 years ago)
Author:
Gregory Vincic
Message:

Refs #698. Removed getNewFileForm, getFileForm and selectFileType methods from FormFactory.

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

Legend:

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

    r2511 r3802  
    3232import org.proteios.gui.Toolbar;
    3333import org.proteios.gui.form.Form;
     34import org.proteios.gui.form.NewFileForm;
    3435import org.proteios.gui.layout.RowLayout;
    3536import se.lu.thep.waf.ActionException;
     
    4950  {
    5051    DbControl dc = newDbControl();
    51     Form form = getFormFactory().getNewFileForm(dc);
     52    Form form = new NewFileForm(dc);
    5253    // Toolbar
    5354    Toolbar tb = new Toolbar();
  • trunk/client/servlet/src/org/proteios/gui/form/FileField.java

    r2093 r3802  
    2828package org.proteios.gui.form;
    2929
    30 import se.lu.thep.waf.constraints.VParameter;
     30import se.lu.thep.waf.constraints.*;
    3131
    3232/**
     
    3737{
    3838  private String value = null;
    39 
     39 public static final VString VPARAM = new VString("file", 1, 512); // Default
    4040
    4141  public String getValue()
     
    5555    super(param);
    5656  }
     57
     58 public FileField()
     59 {
     60  super(FileField.VPARAM);
     61  setLabel("File");
     62 }
    5763}
  • trunk/client/servlet/src/org/proteios/gui/form/FormFactory.java

    r3801 r3802  
    936936  }
    937937
    938  // Cleaning up from here
    939938
    940939  /**
     
    11171116
    11181117
    1119   public Form getNewFileForm(DbControl dc)
    1120   {
    1121     log.debug("Start");
    1122     Fieldset fs = new Fieldset();
    1123     fs.getLegendTitle().setTitle("Properties");
    1124     // id
    1125     TextField<Integer> itemIdF = newHiddenItemIdField();
    1126     fs.add(itemIdF);
    1127     // Name field
    1128     FileField fileF = newFileField();
    1129     fs.add(fileF);
    1130     // File type selector
    1131     Select<VInteger> fileTypeS = selectFileType(dc, null);
    1132     fs.add(fileTypeS);
    1133     // File compression flag
    1134     Checkbox<VBoolean> storedCompressedCB = new Checkbox<VBoolean>(
    1135       SaveFile.VSTOREDINCOMPRESSEDFORMAT);
    1136     storedCompressedCB.setLabel("StoredInCompressedFormat");
    1137     storedCompressedCB.setValue("true");
    1138     storedCompressedCB.isChecked(false);
    1139     fs.add(storedCompressedCB);
    1140     //
    1141     /***********************************************************************
    1142      * Form
    1143      */
    1144     Form form = new Form("newFileForm");
    1145     form.setTitle("File upload");
    1146     form.addFieldset(fs);
    1147     return form;
    1148   }
    1149 
    1150 
    1151   public Form getFileForm(DbControl dc, File file)
    1152   {
    1153     log.debug("FormFactory::getFileForm(): file = " + file);
    1154     Fieldset fs = new Fieldset();
    1155     fs.getLegendTitle().setTitle("Properties");
    1156     // id
    1157     TextField<Integer> itemIdF = newHiddenItemIdField();
    1158     fs.add(itemIdF);
    1159     if (file != null)
    1160     {
    1161       itemIdF.setValue(file.getId());
    1162       // Name field
    1163       TextField<String> nameF = new TextField<String>(VREQUIRED_FILENAME);
    1164       nameF.setLabel("Name");
    1165       nameF.setDisabled(true);
    1166       fs.add(nameF);
    1167       nameF.setValue(file.getName());
    1168       /*
    1169        * This hidden forward field sets action id used by the directory
    1170        * selection action called by MoveFile1.
    1171        */
    1172       TextField<String> forwardF = newForwardField();
    1173       forwardF.setValue(actionFactory.getId(MoveFile2.class));
    1174       fs.add(forwardF);
    1175     }
    1176     else
    1177     {
    1178       // Name field
    1179       FileField fileF = newFileField();
    1180       fs.add(fileF);
    1181       // File type selector
    1182       Select<VInteger> fileTypeS = selectFileType(dc, null);
    1183       fs.add(fileTypeS);
    1184     }
    1185     /***********************************************************************
    1186      * Form
    1187      */
    1188     Form form = new Form("fileForm");
    1189     form.setTitle("File upload");
    1190     form.addFieldset(fs);
    1191     return form;
    1192   }
    1193 
     1118 // Cleaning up from here
    11941119
    11951120  public Form getFileTypeForm(DbControl dc, File file)
     
    12021127    fs.add(itemIdF);
    12031128    // File type selector
    1204     Select<VInteger> fileTypeS = selectFileType(dc, file);
     1129    Select<VInteger> fileTypeS = new FileTypeSelect(dc,file);
    12051130    fs.add(fileTypeS);
    12061131    /***********************************************************************
     
    40693994    //
    40703995    return form;
    4071   }
    4072 
    4073 
    4074   @SuppressWarnings("unused")
    4075   private Select<VInteger> selectFileType(DbControl dc, File file)
    4076   {
    4077     Select<VInteger> select = new Select<VInteger>(VFILETYPEID);
    4078     select.setLabel("FileType");
    4079     Option noFileType = new Option("0");
    4080     noFileType.setContent("");
    4081     select.addOption(noFileType);
    4082     if (dc != null && dc.isConnected())
    4083     {
    4084       ItemQuery<FileType> query = FileType.getQuery();
    4085       query.include(Include.SHARED);
    4086       for (FileType ft : query.list(dc))
    4087       {
    4088         Option o = new Option("" + ft.getId());
    4089         o.setContent(ft.getName());
    4090         select.addOption(o);
    4091         if (file != null && file.getFileType() != null && file
    4092           .getFileType().equals(ft))
    4093           o.setSelected(true);
    4094       }
    4095     }
    4096     return select;
    40973996  }
    40983997
     
    1058110480      }
    1058210481      // File type selector
    10583       Select<VInteger> fileTypeS = selectFileType(dc, file);
     10482      Select<VInteger> fileTypeS = new FileTypeSelect(dc, file);
    1058410483      fs.add(fileTypeS);
    1058510484      TextField<String> uriF = createField(VURI);
Note: See TracChangeset for help on using the changeset viewer.