Package org.apache.turbine.om

Examples of org.apache.turbine.om.ComboKey


            {
                String[] ss = pp.getStrings(getKey());
                ComboKey[] ival = new ComboKey[ss.length];
                for (int i=0; i<ss.length; i++)
                {
                    ival[i] = new ComboKey(ss[i]);
                }
                setTestValue(ival);
            }
            else
            {
                setTestValue( new ComboKey(pp.getString(getKey())) );
            }
        }
        catch (TurbineException e)
        {
            valid_flag = false;
View Full Code Here


    public ComboKeyField(XmlField field, Group group)
        throws Exception
    {
        super(field, group);

        onError = new ComboKey();

        ComboKey tmpMinValue = null;
        String tmpMinValueMessage = null;
        boolean tmpMinValueForce = false;
        ComboKey tmpMaxValue = null;
        String tmpMaxValueMessage = null;
        boolean tmpMaxValueForce = false;
        for (int i=0; i<field.getRules().size(); i++)
        {
            Rule rule = (Rule)field.getRules().get(i);

            if ( rule.getMinValue() != null )
            {
                tmpMinValue = new ComboKey(rule.getMinValue());
                tmpMinValueMessage = rule.getMessage();
                tmpMinValueForce = "force".equals(rule.getAction());
            }

            if ( rule.getMaxValue() != null )
            {
                tmpMaxValue = new ComboKey(rule.getMaxValue());
                tmpMaxValueMessage = rule.getMessage();
                tmpMaxValueForce = "force".equals(rule.getAction());
            }
        } 
        minValue = tmpMinValue;
View Full Code Here

    /**
     * Compares request data with constraints and sets the valid flag.
     */
    private ComboKey checkString(String val)
    {
        ComboKey ival = (ComboKey)onError;
        try
        {
            ival = new ComboKey(val);
        }
        catch (Exception e)
        {
            valid_flag = false;
            ival = (ComboKey)onError;
        }

        boolean b;
        if ( maxLength > 0 )
        {
            b = val.length() > maxLength;
            if ( maxLengthForce  && b )
            {
                val = val.substring(0, maxLength);
                try
                {
                    ival = new ComboKey(val);
                }
                catch (Exception e)
                {
                    valid_flag = false;
                    ival = (ComboKey)onError;
                }
            }
            else
            {
                valid_flag &= !b;
            }
            if (maxLengthMessage != null && b)
            {
                message = maxLengthMessage;
            }
        }

        if ( minValue != null )
        {
            b = ival.compareTo(minValue) < 0;
            if ( minValueForce  && b )
            {
                ival = minValue;
            }
            else
            {
                valid_flag &= !b;
            }
            if (minValueForce  && b)
            {
                message = minValueMessage;
            }
        }

        if ( maxValue != null  )
        {
            b = ival.compareTo(maxValue) > 0;
            if ( maxValueForce  && b )
            {
                ival = maxValue;
            }
            else
View Full Code Here

            {
                String[] ss = pp.getStrings(getKey());
                ComboKey[] ival = new ComboKey[ss.length];
                for (int i=0; i<ss.length; i++)
                {
                    ival[i] = new ComboKey(ss[i]);
                }
                setTestValue(ival);
            }
            else
            {
                setTestValue( new ComboKey(pp.getString(getKey())) );
            }
        }
        catch (Exception e)
        {
            valid_flag = false;
View Full Code Here

TOP

Related Classes of org.apache.turbine.om.ComboKey

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.