Changeset 3797


Ignore:
Timestamp:
Aug 30, 2010, 12:52:01 PM (13 years ago)
Author:
Gregory Vincic
Message:

Refs #698. Removing getNewUserForm() method from FormFactory?. Introducing NewUserForm? and related fields. Also added gui test NewUserFormTest?. Note that you should run 'ant test' from client/servlet. This will produce static html files in www/ which you can inspect visually.

Location:
trunk/client/servlet
Files:
6 added
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/client/servlet/src/org/proteios/action/execute/Login.java

    r3776 r3797  
    5858  try
    5959  {
    60     username = getString(UsernameField.VUSERNAME);
     60    username = getString(UsernameField.VPARAM);
    6161  }
    6262  catch(InvalidParameterValue e)
  • trunk/client/servlet/src/org/proteios/action/user/AddUser.java

    r1916 r3797  
    3333import org.proteios.core.Quota;
    3434import org.proteios.core.User;
    35 import org.proteios.gui.form.Form;
    36 import org.proteios.gui.form.FormFactory;
     35import org.proteios.gui.form.*;
    3736import org.proteios.method.write.SaveUserRolesMethod;
    3837import se.lu.thep.waf.ActionException;
     
    5251    DbControl dc = newDbControl();
    5352    ItemFactory factory = new ItemFactory(dc);
    54     Form form = getFormFactory().getNewUserForm(dc);
     53    Form form = new NewUserForm(dc);
    5554    verifyParameters(form);
    56     ArrayList<Integer> roleIds = getValidIntegerList(FormFactory.VROLEID);
     55    ArrayList<Integer> roleIds = getValidIntegerList(RoleCheckbox.VPARAM);
    5756    // parameters are all there, verify that the passwords match
    5857    String pwd1 = getString(FormFactory.VPWD1);
     
    6564    }
    6665    // All is ok, get the values
    67     String login = getString(FormFactory.VLOGIN);
    68     String name = getString(FormFactory.VNAME);
    69     String email = getString(FormFactory.VEMAIL);
     66    String login = getString(LoginField.VPARAM);
     67    String name = getString(UsernameField.VPARAM);
     68    String email = getString(EmailField.VPARAM);
    7069    // Save a new user
    7170    User user = factory.createUser(login, pwd1);
  • trunk/client/servlet/src/org/proteios/action/user/NewUser.java

    r3610 r3797  
    3333import org.proteios.gui.Title;
    3434import org.proteios.gui.form.Form;
     35import org.proteios.gui.form.NewUserForm;
    3536import org.proteios.gui.layout.RowLayout;
    3637import se.lu.thep.waf.ActionException;
     
    5657  dc = newDbControl();
    5758    layout = getLayoutFactory().getRowLayout();
    58     form = getFormFactory().getNewUserForm(dc);
     59    form = new NewUserForm(dc);
    5960    populateForm(form);
    6061
  • trunk/client/servlet/src/org/proteios/action/user/SaveUserRoles.java

    r1916 r3797  
    3030import org.proteios.action.ProteiosAction;
    3131import org.proteios.core.DbControl;
    32 import org.proteios.gui.form.Form;
    33 import org.proteios.gui.form.FormFactory;
     32import org.proteios.gui.form.*;
    3433import org.proteios.method.write.SaveUserRolesMethod;
    3534import se.lu.thep.waf.ActionException;
     
    5049    Form form = getFormFactory().getViewUserRolesForm(dc, null);
    5150    verifyParameters(form);
    52     ArrayList<Integer> roleIds = getValidIntegerList(FormFactory.VROLEID);
     51    ArrayList<Integer> roleIds = getValidIntegerList(RoleCheckbox.VPARAM);
    5352    // All is ok, get the values
    54     Integer userId = getValidInteger(FormFactory.VID);
     53    Integer userId = getValidInteger(ItemIdField.VPARAM);
    5554    // Save user roles
    5655    new SaveUserRolesMethod(dc, userId, roleIds);
  • trunk/client/servlet/src/org/proteios/gui/form/FormFactory.java

    r3795 r3797  
    214214  public static final VInteger VANNOTYPEID = new VInteger("annotationTypeId",
    215215    0, true);
    216   public static final VInteger VROLEID = new VInteger("roleId", 1, true);
    217216  public static final VInteger VGROUPID = new VInteger("groupId", 1, false);
    218217  public static final VString VNAME = NameField.VPARAM;
     
    931930
    932931 // Cleaning up from here
    933   public Form getNewUserForm(DbControl dc)
    934   {
    935     Form form = new Form("newUserForm");
    936     // properties
    937     Fieldset properties = new Fieldset();
    938     properties.getLegendTitle().setTitle("Properties");
    939     properties.add(newLoginField());
    940     properties.add(new NameField());
    941     properties.add(newEmailField());
    942     properties.add(newDescriptionField());
    943     form.addFieldset(properties);
    944     // password
    945     Fieldset passwords = new Fieldset();
    946     passwords.getLegendTitle().setTitle("Password");
    947     passwords.add(new PasswordField(VPWD1).setLabel("Password"));
    948     passwords.add(new PasswordField(VPWD2).setLabel("VerifyPassword"));
    949     form.addFieldset(passwords);
    950     // Roles
    951     Fieldset roles = new Fieldset();
    952     roles.getLegendTitle().setTitle("Roles");
    953     ItemQuery<Role> query = Role.getQuery();
    954     for (Role r : query.list(dc))
    955     {
    956       Checkbox<VInteger> cb = new Checkbox<VInteger>(VROLEID);
    957       cb.setValue("" + r.getId());
    958       cb.setLabel(r.getName());
    959       if (r.getSystemId().equals(org.proteios.core.Role.USER))
    960         cb.isChecked(true);
    961       roles.add(cb);
    962     }
    963     form.addFieldset(roles);
    964     return form;
    965   }
    966 
    967 
    968932  public Form getGroupsForm(DbControl dc, User user)
    969933  {
     
    1022986    for (Role r : query.list(dc))
    1023987    {
    1024       Checkbox<VInteger> cb = new Checkbox<VInteger>(VROLEID);
     988      Checkbox<VInteger> cb = new RoleCheckbox();
    1025989      cb.setValue("" + r.getId());
    1026990      cb.setLabel(r.getName());
  • trunk/client/servlet/src/org/proteios/gui/form/ProfilePasswordForm.java

    r3794 r3797  
    5555  pwd1 = new PasswordField(PasswordField.VPWD1);
    5656  pwd2 = new PasswordField(PasswordField.VPWD2);
    57 
    5857  userIdF.setHidden(true);
    5958  pwd1.setLabel("Password");
  • trunk/client/servlet/src/org/proteios/gui/form/TemplateForm.java

    r3790 r3797  
    3232 TODO
    3333
    34  @author Gregory Vincic
     34 @author gregory
    3535*/
    3636public final class TemplateForm
  • trunk/client/servlet/src/org/proteios/gui/form/UsernameField.java

    r3593 r3797  
    3333 extends TextField<String>
    3434{
    35   public static final VString VUSERNAME = new VString("username", 1, 32, true);
     35  public static final VString VPARAM = new VString("username", 1, 32, true);
    3636
    3737 public UsernameField()
    3838 {
    39   super(UsernameField.VUSERNAME);
     39  super(UsernameField.VPARAM);
    4040  this.setLabel("Username");
    4141  this.setCharWidth(15);
  • trunk/client/servlet/test/build.xml

    r3716 r3797  
    4444      <include name="**/*.jar" />
    4545    </fileset>
     46    <dirset dir="../build" />
    4647    <fileset dir="${env.CATALINA_HOME}/webapps/proteios/WEB-INF/lib">
    4748      <include name="*.jar" />
    4849    </fileset>
    49     <dirset dir="../build" />
    5050 
    5151    <pathelement location="${env.CATALINA_HOME}/webapps/proteios/WEB-INF/classes"/>
     
    7575    <fileset dir=".">
    7676      <include name="TEST*.txt"/>
     77    </fileset>
     78    <fileset dir="../www">
     79      <include name="TEST_*.html"/>
    7780    </fileset>
    7881  </delete>
  • trunk/client/servlet/test/src/org/proteios/gui/HtmlOutputUtil.java

    r2597 r3797  
    1212  public void printToFile(Tag html, String filename)
    1313  {
    14     String dir = System.getProperty("java.io.tmpdir");
    15     File file = new File(dir + File.separatorChar + filename);
     14  // You must be in client servlet when you run ant test
     15    File file = new File("." + File.separatorChar + "www" + File.separatorChar + filename);
    1616    HtmlTagWriter output;
    1717    try
  • trunk/client/servlet/test/src/org/proteios/gui/web/WebGUITest.java

    r3693 r3797  
    8989    layout.setConverter(lconverter);
    9090    Tag html = layout.getHtml(".", null);
    91     out.printToFile(html, "webGUITest.html");
     91    out.printToFile(html, "TEST_WebGUITest.html"); // Name the file TEST_TestClassName.html
    9292  }
    9393}
Note: See TracChangeset for help on using the changeset viewer.