Examples of IPropertySelectionModel


Examples of org.apache.tapestry.form.IPropertySelectionModel

        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

Examples of org.apache.tapestry.form.IPropertySelectionModel

    public void activate(IRequestCycle cycle, Integer fromUserId, Integer toUserId)
    {
        Person fromUser = readPerson(fromUserId);

        IPropertySelectionModel model = buildUserBookModel(fromUser);

        if (model.getOptionCount() == 0)
        {
            IErrorProperty page = (IErrorProperty) cycle.getPage();
            page.setError(format("user-has-no-books", fromUser.getNaturalName()));
            return;
        }
View Full Code Here

Examples of org.apache.tapestry.form.IPropertySelectionModel

        return result;
    }

    public void pageBeginRender(PageEvent event)
    {
        IPropertySelectionModel model = getBooksModel();

        if (model == null)
        {
            model = buildBooksModel();
            setBooksModel(model);
View Full Code Here

Examples of org.apache.tapestry.form.IPropertySelectionModel

    public void pageValidate(PageEvent event)
    {
        super.pageValidate(event);

        IPropertySelectionModel model = buildBooksModel();

        if (model.getOptionCount() == 0)
        {
            IRequestCycle cycle = getRequestCycle();
            IActivate page = (IActivate) cycle.getPage("MyLibrary");

            page.activate(cycle);
View Full Code Here

Examples of org.apache.tapestry.form.IPropertySelectionModel

        String[] values = cycle.getParameters(getName());

        int count = Tapestry.size(values);

        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

Examples of org.apache.tapestry.form.IPropertySelectionModel

        PaletteColumn selectedColumn = new PaletteColumn(getName(), getClientId(), 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

Examples of org.apache.tapestry.form.IPropertySelectionModel

        String[] values = cycle.getParameters(getName());

        int count = Tapestry.size(values);

        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

Examples of org.apache.tapestry.form.IPropertySelectionModel

        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

Examples of org.apache.tapestry.form.IPropertySelectionModel

        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

Examples of org.apache.tapestry.form.IPropertySelectionModel

    protected void rewindFormComponent(IMarkupWriter writer, IRequestCycle cycle)
    {
        // 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
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.