Examples of DataSqueezer


Examples of org.apache.tapestry.services.DataSqueezer

     */
    protected Object getValueFromStringRep(Iterator sourceIterator, Iterator fullSourceIterator,
            Map repToValueMap, String rep)
    {
        Object value = null;
        DataSqueezer squeezer = getDataSqueezer();

        // Check if the string rep is empty. If so, just return the default value.
        if (rep == null || rep.length() == 0)
            return getDefaultValue();

        // If required, find a value with an equivalent string representation and return it
        boolean match = getMatch();
        if (match)
        {
            value = findValueWithStringRep(
                    sourceIterator,
                    fullSourceIterator,
                    repToValueMap,
                    rep,
                    COMPLETE_REP_SOURCE);
            if (value != null)
                return value;
        }

        // Matching of the string representation was not successful or was disabled.
        // Use the standard approaches to obtain the value from the rep.
        char desc = rep.charAt(0);
        String squeezed = rep.substring(1);
        switch (desc)
        {
            case DESC_VALUE:
                // If the string rep is just the value itself, unsqueeze it
                value = squeezer.unsqueeze(squeezed);
                break;

            case DESC_PRIMARY_KEY:
                // Perform keyExpression match if not already attempted
                if (!match && getKeyExpression() != null)
                    value = findValueWithStringRep(
                            sourceIterator,
                            fullSourceIterator,
                            repToValueMap,
                            rep,
                            KEY_EXPRESSION_REP_SOURCE);

                // If 'converter' is defined, try to perform conversion from primary key to value
                if (value == null)
                {
                    IPrimaryKeyConverter converter = getConverter();
                    if (converter != null)
                    {
                        Object pk = squeezer.unsqueeze(squeezed);
                        value = converter.getValue(pk);
                    }
                }
                break;
        }
View Full Code Here

Examples of org.apache.tapestry.services.DataSqueezer

    public void test_Render()
    {  
        IRequestCycle cycle = newCycle();
        IForm form = newMock(IForm.class);
        DataSqueezer squeezer = newMock(DataSqueezer.class);
       
        IMarkupWriter writer = newMarkupWriter();

        MockDelegate delegate = new MockDelegate();
       
        Hidden component = newInstance(Hidden.class, new Object[]
        { "name", "fred", "value", new Integer(10),
            "encode", Boolean.TRUE, "dataSqueezer", squeezer });
       
        expect(cycle.renderStackPush(component)).andReturn(component);
       
        trainGetForm(cycle, form);
        trainWasPrerendered(form, writer, component, false);
        trainGetDelegate(form, delegate);
       
        delegate.setFormComponent(component);
       
        trainGetElementId(form, component, "fred");
        trainIsRewinding(form, false);
        trainIsRewinding(cycle, false);
       
        form.setFormFieldUpdating(true);
       
        expect(squeezer.squeeze(10)).andReturn("i10");
       
        delegate.setFormComponent(component);
       
        form.addHiddenValue("fred", "fred", "i10");
       
View Full Code Here

Examples of org.apache.tapestry.util.io.DataSqueezer

     *
     **/

    public DataSqueezer createDataSqueezer()
    {
        return new DataSqueezer(_resolver);
    }
View Full Code Here

Examples of org.apache.tapestry.util.io.DataSqueezer

        String serviceName,
        String[] serviceContext,
        Object[] parameters,
        boolean stateful)
    {
        DataSqueezer squeezer = cycle.getEngine().getDataSqueezer();
        String[] squeezed = null;

        try
        {
            squeezed = squeezer.squeeze(parameters);
        }
        catch (IOException ex)
        {
            throw new ApplicationRuntimeException(ex);
        }
View Full Code Here

Examples of org.apache.tapestry.util.io.DataSqueezer

        if (Tapestry.size(squeezed) == 0)
            return squeezed;

        try
        {
            DataSqueezer squeezer = cycle.getEngine().getDataSqueezer();

            return squeezer.unsqueeze(squeezed);
        }
        catch (IOException ex)
        {
            throw new ApplicationRuntimeException(ex);
        }
View Full Code Here

Examples of org.apache.tapestry.util.io.DataSqueezer

     *
     **/

    public DataSqueezer createDataSqueezer()
    {
        return new DataSqueezer(_resolver);
    }
View Full Code Here

Examples of org.apache.tapestry.util.io.DataSqueezer

     *
     **/

    public DataSqueezer createDataSqueezer()
    {
        return new DataSqueezer(_resolver);
    }
View Full Code Here

Examples of org.apache.tapestry.util.io.DataSqueezer

     *
     **/

    public DataSqueezer createDataSqueezer()
    {
        return new DataSqueezer(_resolver);
    }
View Full Code Here

Examples of org.apache.tapestry.util.io.DataSqueezer

        String serviceName,
        String[] serviceContext,
        Object[] parameters,
        boolean stateful)
    {
        DataSqueezer squeezer = cycle.getEngine().getDataSqueezer();
        String[] squeezed = null;

        try
        {
            squeezed = squeezer.squeeze(parameters);
        }
        catch (IOException ex)
        {
            throw new ApplicationRuntimeException(ex);
        }
View Full Code Here

Examples of org.apache.tapestry.util.io.DataSqueezer

        if (Tapestry.size(squeezed) == 0)
            return squeezed;

        try
        {
            DataSqueezer squeezer = cycle.getEngine().getDataSqueezer();

            return squeezer.unsqueeze(squeezed);
        }
        catch (IOException ex)
        {
            throw new ApplicationRuntimeException(ex);
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.