Thanks Jesse...

I will give your stuff a shot... but am already building/trying an 
IntegerPropertySelectionModel right now to see if it induces the proper 
coercian.

I am happy to try any new builds/patches you submit. It would be nice to know 
when it happens.

Thanks for your patience.

Best regards
Ken in nashua

package org.trails.util;

import org.apache.tapestry.form.IPropertySelectionModel;

public class IntegerPropertySelectionModel implements IPropertySelectionModel
{
    private Integer[] _set;

    public IntegerPropertySelectionModel(Integer[] set)
    {
        _set = set;
    }

    public String getLabel(int index)
    {
        return _set[index].toString();
    }

    public Object getOption(int index)
    {

        return _set[index];
    }

    public int getOptionCount()
    {
        return _set.length;
    }

    public String getValue(int index)
    {
        return _set[index].toString();
    }

    public boolean isDisabled(int index)
    {
        return false;
    }

    public Object translateValue(String value)
    {
        for (Integer e : _set)
        {
            if (e.toString().equals(value))
                return e;
        }

        return null;
    }
}


From: [EMAIL PROTECTED]
To: users@tapestry.apache.org
Subject: Does tapestry need an IntegerPropertySelectionModel ?
Date: Fri, 12 Oct 2007 15:12:14 -0400








I am trying to operate a PropertySelection that uses an array of strings but 
their content are numbers.

private static final String[] tableSizeOptions = new String[] { 
             "1", "2", "3"
};

I am assuming OGNL is smart enough to coerce these during render cycle on IF 
conditions that attempt to perform arithmetic.

NOT the case... see stack trace below.

Do I need to implement an IntegerPropertySelectionModel for this to operate 
properly?

Best regards
Ken in nashua

2007-10-12 15:01:00,575 [btpool0-2] ERROR 
org.apache.tapestry.services.impl.HiveMindExpressionCompiler - Error generating 
OGNL getter for expression (index % tableSize) == 0 with root [EMAIL 
PROTECTED]/galleryWidget] and body:
{ return  ($w) ((ognl.OgnlOps.equal( ($w) ((($Gallery_17)$2).getIndex() % 
(($Gallery_17)$2).getTableSize() ), ($w)  0)));}
org.apache.hivemind.ApplicationRuntimeException: Unable to add method 
java.lang.Object get(ognl.OgnlContext, java.lang.Object) to class 
$ASTEq_1159596f3b2: [source error] invalid types for %
    at org.apache.tapestry.enhance.ClassFabImpl.addMethod(ClassFabImpl.java:278)
    at 
org.apache.tapestry.services.impl.HiveMindExpressionCompiler.compileExpression(HiveMindExpressionCompiler.java:176)
    at ognl.OgnlRuntime.compileExpression(OgnlRuntime.java:523)
    

Windows Live Hotmail and Microsoft Office Outlook – together at last. Get it 
now!

_________________________________________________________________
Windows Live Hotmail and Microsoft Office Outlook – together at last.  Get it 
now.
http://office.microsoft.com/en-us/outlook/HA102225181033.aspx?pid=CL100626971033

Reply via email to