Package org.apache.tapestry5.services

Examples of org.apache.tapestry5.services.PersistentFieldStrategy


        Messages messages = mockMessages();
        MessageFormatter formatter = mockMessageFormatter();
        Object inputValue = new Object();
        ComponentResources resources = mockComponentResources();
        Messages containerMessages = mockMessages();
        FormSupport fs = mockFormSupport();

        Map<String, Validator> map = singletonMap("required", validator);

        train_getFormValidationId(fs, "myform");
View Full Code Here


        MessageFormatter minLengthFormatter = mockMessageFormatter();
        Object inputValue = "input value";
        ComponentResources resources = mockComponentResources();
        Messages containerMessages = mockMessages();
        Integer fifteen = 15;
        FormSupport fs = mockFormSupport();

        Map<String, Validator> map = newMap();

        map.put("required", required);
        map.put("minLength", minLength);
View Full Code Here

        MessageFormatter formatter = mockMessageFormatter();
        Object inputValue = new Object();
        ComponentResources resources = mockComponentResources();
        Messages containerMessages = mockMessages();
        Integer five = 5;
        FormSupport fs = mockFormSupport();

        Map<String, Validator> map = singletonMap("minLength", validator);

        train_getConstraintType(validator, Integer.class);
View Full Code Here

        this.strategies = strategies;
    }

    private PersistentFieldStrategy getStrategy(String strategyName)
    {
        PersistentFieldStrategy result = strategies.get(strategyName);

        if (result == null)
            throw new UnknownValueException(String.format("'%s' is not a defined persistent strategy.", strategyName),
                    new AvailableValues("Configured persistent field strategies", strategies));
View Full Code Here

            strategy.discardChanges(pageName);
        }
    }

    public void discardChanges(String pageName, String strategyName) {
        PersistentFieldStrategy strategy = strategies.get(strategyName);
        if (strategy != null) strategy.discardChanges(pageName);
    }
View Full Code Here

   
   
    public void postChange(String pageName, ComponentResources resources, String fieldName, Object newValue)
    {
        String strategyName = findStrategy(resources, fieldName);
        PersistentFieldStrategy strategy = getStrategy(strategyName);

        strategy.postChange(pageName, resources.getNestedId(), fieldName, newValue);
    }
View Full Code Here

        this.strategies = strategies;
    }

    private PersistentFieldStrategy getStrategy(String strategyName)
    {
        PersistentFieldStrategy result = strategies.get(strategyName);

        if (result == null)
            throw new UnknownValueException(String.format("'%s' is not a defined persistent strategy.", strategyName),
                    new AvailableValues("Configured persistent field strategies", strategies));
View Full Code Here

    }

    public void postChange(String pageName, ComponentResources resources, String fieldName, Object newValue)
    {
        String strategyName = findStrategy(resources, fieldName);
        PersistentFieldStrategy strategy = getStrategy(strategyName);

        strategy.postChange(pageName, resources.getNestedId(), fieldName, newValue);
    }
View Full Code Here

    @Test
    public void post_change_with_unknown_strategy()
    {
        String fieldName = "field";

        PersistentFieldStrategy strat1 = newPersistentFieldStrategy();
        PersistentFieldStrategy strat2 = newPersistentFieldStrategy();
        ComponentResources resources = mockComponentResources();
        ComponentModel model = mockComponentModel();

        Map<String, PersistentFieldStrategy> strategies = newMap();
        strategies.put("foo", strat1);
View Full Code Here

     * TAPESTRY-1475
     */
    @Test
    public void discard_changes()
    {
        PersistentFieldStrategy strat1 = newPersistentFieldStrategy();
        PersistentFieldStrategy strat2 = newPersistentFieldStrategy();

        Map<String, PersistentFieldStrategy> strategies = newMap();
        strategies.put("foo", strat1);
        strategies.put("bar", strat2);

        String pageName = "gnip.gnop";

        strat1.discardChanges(pageName);
        strat2.discardChanges(pageName);

        replay();

        PersistentFieldManager manager = new PersistentFieldManagerImpl(null, strategies);

View Full Code Here

TOP

Related Classes of org.apache.tapestry5.services.PersistentFieldStrategy

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.