Package org.apache.tapestry5.beaneditor

Examples of org.apache.tapestry5.beaneditor.PropertyModel


    public BeanModel<T> exclude(String... propertyNames)
    {
        for (String propertyName : propertyNames)
        {
            PropertyModel model = properties.get(propertyName);

            if (model == null)
                continue;

            // De-referencing from the model is needed because the name provided may not be a
            // case-exact match, so we get the normalized or canonical name from the model because
            // that's the one in propertyNames.

            this.propertyNames.remove(model.getPropertyName());

            properties.remove(propertyName);
        }

        return this;
View Full Code Here


        List<String> remainingPropertyNames = CollectionFactory.newList(this.propertyNames);
        List<String> reorderedPropertyNames = CollectionFactory.newList();

        for (String name : propertyNames)
        {
            PropertyModel model = get(name);

            // Get the canonical form (which may differ from name in terms of case)
            String canonical = model.getPropertyName();

            reorderedPropertyNames.add(canonical);

            remainingPropertyNames.remove(canonical);
        }
View Full Code Here

        Map<String, PropertyModel> reduced = CollectionFactory.newCaseInsensitiveMap();

        for (String name : propertyNames)
        {

            PropertyModel model = get(name);

            String canonical = model.getPropertyName();

            reorderedPropertyNames.add(canonical);
            reduced.put(canonical, model);

        }
View Full Code Here

        public List<SortConstraint> getSortConstraints()
        {
            if (sortColumnId == null)
                return Collections.emptyList();

            PropertyModel sortModel = getDataModel().getById(sortColumnId);

            SortConstraint constraint = new SortConstraint(sortModel, getColumnSort());

            return Collections.singletonList(constraint);
        }
View Full Code Here

        public List<SortConstraint> getSortConstraints()
        {
            if (sortColumnId == null)
                return Collections.emptyList();

            PropertyModel sortModel = getDataModel().getById(sortColumnId);

            SortConstraint constraint = new SortConstraint(sortModel, getColumnSort());

            return Collections.singletonList(constraint);
        }
View Full Code Here

    @Test
    public void add()
    {
        BeanModel model = mockBeanModel();
        PropertyModel fred = mockPropertyModel();
        PropertyModel barney = mockPropertyModel();

        expect(model.add("fred", null)).andReturn(fred);
        expect(model.add("barney", null)).andReturn(barney);

        replay();
View Full Code Here

     */
    @Test
    public void include_before_add()
    {
        BeanModel model = mockBeanModel();
        PropertyModel fred = mockPropertyModel();

        EasyMock.checkOrder(model, true);

        expect(model.add("fred", null)).andReturn(fred);

View Full Code Here

    @Test
    public void modify_full()
    {
        BeanModel model = mockBeanModel();
        PropertyModel fred = mockPropertyModel();
        PropertyModel barney = mockPropertyModel();

        expect(model.add("fred", null)).andReturn(fred);
        expect(model.add("barney", null)).andReturn(barney);

        expect(model.exclude("pebbles", "bambam")).andReturn(model);
View Full Code Here

            if (paginationModel == null || paginationModel.getSortColumnId() == null)
            {
                return Collections.emptyList();
            }

            PropertyModel sortModel = getDataModel().getById(paginationModel.getSortColumnId());

            SortConstraint constraint = new SortConstraint(sortModel, getColumnSort());

            return Collections.singletonList(constraint);
        }
View Full Code Here

        assertEquals(model.getPropertyNames(), Arrays.asList("firstName", "lastName", "age"));

        assertEquals(model.toString(),
                     "BeanModel[org.apache.tapestry5.internal.services.SimpleBean properties:firstName, lastName, age]");

        PropertyModel age = model.get("age");

        assertEquals(age.getLabel(), "Age");
        assertSame(age.getPropertyType(), int.class);
        assertEquals(age.getDataType(), "number");

        PropertyModel firstName = model.get("firstName");

        assertEquals(firstName.getLabel(), "First Name");
        assertEquals(firstName.getPropertyType(), String.class);
        assertEquals(firstName.getDataType(), "text");

        assertEquals(model.get("lastName").getLabel(), "Last Name");

        PropertyConduit conduit = model.get("lastName").getConduit();
View Full Code Here

TOP

Related Classes of org.apache.tapestry5.beaneditor.PropertyModel

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.