Package org.apache.tapestry5.services

Examples of org.apache.tapestry5.services.FieldAccess


    @Test
    public void validator_with_constraint() throws Exception
    {
        ValidationMessagesSource messagesSource = mockValidationMessagesSource();
        Validator validator = mockValidator();
        TypeCoercer coercer = mockTypeCoercer();
        FieldComponent field = newFieldComponent();
        Messages messages = mockMessages();
        MessageFormatter formatter = mockMessageFormatter();
        Object inputValue = new Object();
        ComponentResources resources = mockComponentResources();
View Full Code Here


        }

        // Let subclasses do more.
        configure(config);

        renderSupport.addInit("autocompleter", new JSONArray(id, menuId, link.toAbsoluteURI(), config));
    }
View Full Code Here

        "class", "t-autocomplete-menu");
        writer.end();

        Link link = resources.createEventLink(EVENT_NAME);

        JSONObject config = new JSONObject();
        config.put("paramName", PARAM_NAME);
        config.put("indicator", loaderId);

        if (resources.isBound("minChars"))
            config.put("minChars", minChars);

        if (resources.isBound("frequency"))
            config.put("frequency", frequency);

        if (resources.isBound("tokens"))
        {
            for (int i = 0; i < tokens.length(); i++)
            {
                config.accumulate("tokens", tokens.substring(i, i + 1));
            }
        }

        // Let subclasses do more.
        configure(config);
View Full Code Here

     * not formatted correct.
     */
    JSONObject onParse(@RequestParameter(INPUT_PARAMETER)
    String input)
    {
        JSONObject response = new JSONObject();

        try
        {
            Date date = format.parse(input);

            response.put(RESULT, date.getTime());
        }
        catch (ParseException ex)
        {
            response.put(ERROR, ex.getMessage());
        }

        return response;
    }
View Full Code Here

     * the result.
     */
    JSONObject onFormat(@RequestParameter(INPUT_PARAMETER)
    String input)
    {
        JSONObject response = new JSONObject();

        try
        {
            long millis = Long.parseLong(input);

            Date date = new Date(millis);

            response.put(RESULT, format.format(date));
        }
        catch (NumberFormatException ex)
        {
            response.put(ERROR, ex.getMessage());
        }

        return response;
    }
View Full Code Here

        "src", icon.toClientURL(),

        "alt", "[Show]");
        writer.end(); // img

        JSONObject spec = new JSONObject();

        spec.put("field", clientId);
        spec.put("parseURL", resources.createEventLink("parse").toAbsoluteURI());
        spec.put("formatURL", resources.createEventLink("format").toAbsoluteURI());

        support.addInitializerCall("dateField", spec);
    }
View Full Code Here

    private void transformField(ClassTransformation transformation, MutableComponentModel model, TransformField field)
    {
        PageActivationContext annotation = field.getAnnotation(PageActivationContext.class);

        FieldAccess access = field.getAccess();

        if (annotation.activate())
        {
            transformation.addComponentEventHandler(EventConstants.ACTIVATE, 1,
                    "PageActivationContextWorker activate event handler",
View Full Code Here

                annotation);

        TransformField conduitField = transformation.addIndirectInjectedField(ParameterConduit.class, parameterName
                + "$conduit", provider);

        FieldAccess conduitAccess = conduitField.getAccess();

        addCodeForParameterDefaultMethod(transformation, parameterName, conduitAccess);

        field.replaceAccess(conduitField);
View Full Code Here

                new String[]
                { field.getType() }, null);

        ensureNotOverride(transformation, setter);

        final FieldAccess access = field.getAccess();

        transformation.getOrCreateMethod(setter).addAdvice(new ComponentMethodAdvice()
        {
            public void advise(ComponentMethodInvocation invocation)
            {
                access.write(invocation.getInstance(), invocation.getParameter(0));
            }
        });
    }
View Full Code Here

        TransformMethodSignature getter = new TransformMethodSignature(Modifier.PUBLIC, field.getType(), "get"
                + propertyName, null, null);

        ensureNotOverride(transformation, getter);

        final FieldAccess access = field.getAccess();

        transformation.getOrCreateMethod(getter).addAdvice(new ComponentMethodAdvice()
        {
            public void advise(ComponentMethodInvocation invocation)
            {
                invocation.overrideResult(access.read(invocation.getInstance()));
            }
        });
    }
View Full Code Here

TOP

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

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.