Package org.apache.tapestry.form

Examples of org.apache.tapestry.form.IPropertySelectionModel


public abstract class SelectionField extends AbstractPostfield
{
    protected void rewind(IRequestCycle cycle)
    {
        String optionValue = cycle.getRequestContext().getParameter(getName());
        IPropertySelectionModel model = getModel();
        Object value = (optionValue == null) ? null : model.translateValue(optionValue);

        updateValue(value);
    }
View Full Code Here


    public void bind(IMarkupWriter writer, IRequestCycle cycle) throws ValidatorException
    {
        // get all the values
        String[] optionValues = cycle.getParameters(getName());

        IPropertySelectionModel model = getModel();
       
        List selectedList = new ArrayList(getModel().getOptionCount());

        // Nothing was selected
        if (optionValues != null)
        {
            // Go through the array and translate and put back in the list
            for (int i = 0; i < optionValues.length; i++)
            {
                // Translate the new value
                Object selectedValue = model.translateValue(optionValues[i]);

                // Add this element in the list back
                selectedList.add(selectedValue);
            }
        }
View Full Code Here

        List selectedList = getSelectedList();

        if (selectedList == null)
            throw Tapestry.createRequiredParameterException(this, "selectedList");

        IPropertySelectionModel model = getModel();

        if (model == null)
            throw Tapestry.createRequiredParameterException(this, "model");

        IMultiplePropertySelectionRenderer renderer = getRenderer();

        // Start rendering
        renderer.beginRender(this, writer, cycle);

        int count = model.getOptionCount();

        for (int i = 0; i < count; i++)
        {
            Object option = model.getOption(i);

            // Try to find the option in the list and if yes, then it is checked.
            boolean optionSelected = selectedList.contains(option);

            renderer.renderOption(this, writer, cycle, model, option, i, optionSelected);
View Full Code Here

        PaletteColumn selectedColumn = new PaletteColumn(getName(), getRows());

        // Each value specified in the model will go into either the selected or available
        // lists.

        IPropertySelectionModel model = getModel();

        int count = model.getOptionCount();

        for (int i = 0; i < count; i++)
        {
            Object optionValue = model.getOption(i);

            PaletteOption o = new PaletteOption(model.getValue(i), model.getLabel(i));

            int index = selected.indexOf(optionValue);
            boolean isSelected = index >= 0;

            if (sortUser && isSelected)
View Full Code Here

        if (count == 0)
            return;

        List selected = new ArrayList(count);
        IPropertySelectionModel model = getModel();

        for (int i = 0; i < count; i++)
        {
            String value = values[i];
            Object option = model.translateValue(value);

            selected.add(option);
        }

        setSelected(selected);
View Full Code Here

public abstract class SelectionField extends AbstractPostfield
{public static com.cortexeb.tools.clover.d __CLOVER_478_0 = com.cortexeb.tools.clover.aq.getRecorder(new char[] {67,58,92,119,111,114,107,115,112,97,99,101,92,106,97,107,97,114,116,97,45,116,97,112,101,115,116,114,121,92,102,114,97,109,101,119,111,114,107,92,116,97,114,103,101,116,92,99,108,111,118,101,114,45,100,98},1096998272901L);
    protected void rewind(IRequestCycle cycle)
    {try { __CLOVER_478_0.M[2630]++;
        __CLOVER_478_0.S[10646]++;String optionValue = cycle.getRequestContext().getParameter(getName());
        __CLOVER_478_0.S[10647]++;IPropertySelectionModel model = getModel();
        __CLOVER_478_0.S[10648]++;Object value = ((((optionValue == null) ) && (++__CLOVER_478_0.CT[1833] != 0)) || (++__CLOVER_478_0.CF[1833] == 0))? null : model.translateValue(optionValue);

        __CLOVER_478_0.S[10649]++;updateValue(value);
    } finally { }}
View Full Code Here

    {try { __CLOVER_476_0.M[2628]++;
        __CLOVER_476_0.S[10610]++;boolean render = !cycle.isRewinding();

        __CLOVER_476_0.S[10611]++;if ((((render) && (++__CLOVER_476_0.CT[1825] != 0)) || (++__CLOVER_476_0.CF[1825] == 0))){
        {
            __CLOVER_476_0.S[10612]++;IPropertySelectionModel model = getModel();

            __CLOVER_476_0.S[10613]++;writer.begin("select");

            __CLOVER_476_0.S[10614]++;writer.attribute("name", getName());

            __CLOVER_476_0.S[10615]++;renderInformalParameters(writer, cycle);

            __CLOVER_476_0.S[10616]++;writer.println();

            __CLOVER_476_0.S[10617]++;int count = model.getOptionCount();

            __CLOVER_476_0.S[10618]++;for (int i = 0; (((i < count) && (++__CLOVER_476_0.CT[1826] != 0)) || (++__CLOVER_476_0.CF[1826] == 0)); i++){
            {

                __CLOVER_476_0.S[10619]++;writer.begin("option");
                __CLOVER_476_0.S[10620]++;writer.attribute("value", model.getValue(i));

                __CLOVER_476_0.S[10621]++;writer.print(model.getLabel(i));

                __CLOVER_476_0.S[10622]++;writer.end();
                __CLOVER_476_0.S[10623]++;writer.println();
            }}
View Full Code Here

        assertEquals(model.translateValue("1"), Boolean.FALSE);
    }
   
    private IPropertySelectionModel createInnerModel()
    {
        return new IPropertySelectionModel()
        {
            private boolean[] values = new boolean[] { true, false };
           
            public int getOptionCount()
            {
View Full Code Here

        PaletteColumn selectedColumn = new PaletteColumn(getName(), getRows());

        // Each value specified in the model will go into either the selected or available
        // lists.

        IPropertySelectionModel model = getModel();

        int count = model.getOptionCount();

        for (int i = 0; i < count; i++)
        {
            Object optionValue = model.getOption(i);

            PaletteOption o = new PaletteOption(model.getValue(i), model.getLabel(i));

            int index = selected.indexOf(optionValue);
            boolean isSelected = index >= 0;

            if (sortUser && isSelected)
View Full Code Here

        if (count == 0)
            return;

        List selected = new ArrayList(count);
        IPropertySelectionModel model = getModel();

        for (int i = 0; i < count; i++)
        {
            String value = values[i];
            Object option = model.translateValue(value);

            selected.add(option);
        }

        setSelected(selected);
View Full Code Here

TOP

Related Classes of org.apache.tapestry.form.IPropertySelectionModel

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.