Package org.jreform

Examples of org.jreform.Group


        return addNewGroup(name, false);
    }
   
    private Group addNewGroup(String name, boolean isRequired)
    {
        Group group = new GroupImpl(this, name, isRequired);
        addGroup(group);
        return group;
    }
View Full Code Here


    public final boolean validate(HttpServletRequest req)
    {
        validateInputs(req);
       
        Iterator<String> groupIter = groups.keySet().iterator();
        Group group;
       
        // validate input groups
        while(groupIter.hasNext())
        {
            group = groups.get(groupIter.next());
           
            if(!group.validate(req))
                getErrors().addAll(group.getErrors());
        }
       
        additionalValidate();
       
        setValid(getErrors().isEmpty());
View Full Code Here

    private static class TestForm extends HtmlForm
    {
        @SuppressWarnings("unchecked")
        public TestForm()
        {
            Group contact = requiredGroup(CONTACT);
            contact.input(stringType(), SURNAME);
            contact.input(stringType(), PHONE);
            contact.input(stringType(), EMAIL, emailAddress()).optional();
           
            Group metric = optionalGroup(METRIC);
            metric.input(doubleType(), HEIGHT_M);
            metric.input(intType(), WEIGHT_KG);
           
            Group imperial = optionalGroup(IMPERIAL);
            imperial.input(intType(), HEIGHT_FT);
            imperial.input(intType(), HEIGHT_IN);
            imperial.input(intType(), WEIGHT_LB);
           
            try
            {
                Group duplicate = optionalGroup(IMPERIAL);
                fail("Error - duplicate group name must throw an exception");
            }
            catch(DuplicateNameException ex) {}
        }
View Full Code Here

            catch(DuplicateNameException ex) {}
        }
       
        protected void additionalValidate()
        {
            Group metric = getGroup(METRIC);
            Group imperial = getGroup(IMPERIAL);
           
            if(metric.isEmpty() && imperial.isEmpty())
            {
                addError(MISSING_HEIGHT_WEIGHT);
            }
        }
View Full Code Here

        input(stringType(), "phoneNumber");

        // uses a custom InputDataType
        select(employmentType, "employmentStatus");
       
        Group employer = optionalGroup("employer");
        employer.input(stringType(), "company");
        employer.input(stringType(), "businessPhoneNumber");
       
        radio(booleanType(), "hasAccountWithUs");

        Group account = optionalGroup("accountDetails");
        account.select(stringType(), "accountType");
        account.input(intType(), "accountNumber");
        account.input(intType(), "branchNumber");

        input(intType(), "monthlyIncome");
        input(intType(), "monthlyExpenses");

    }
View Full Code Here

     */
    @Override
    protected void additionalValidate()
    {
        EmploymentStatus empStatus = getEmploymentStatus().getValue();
        Group employerInfo = getGroup("employer");
       
        if(empStatus == EmploymentStatus.EMPLOYED)
        {
            employerInfo.setRequired(true);
            employerInfo.validate(request);
        }
       
        Group accountDetails = getGroup("accountDetails");
       
        if(getHasAccountWithUs().getValue() == Boolean.TRUE)
        {
            accountDetails.setRequired(true);
            accountDetails.validate(request);
        }
    }
View Full Code Here

TOP

Related Classes of org.jreform.Group

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.