Package org.apache.tapestry5.plastic

Examples of org.apache.tapestry5.plastic.FieldHandle


        "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

    }

    private void transformMethod(final PlasticClass plasticClass, final PlasticMethod method) {

        final PlasticField tokenFieldInstance = plasticClass.introduceField(InterceptorStatusToken.class,"_$token");
        final FieldHandle tokenFieldHandle = tokenFieldInstance.getHandle();
       
       
        // Attribute definition
        final Secured annotation = method.getAnnotation(Secured.class);
        //final String configField = createConfigAttributeDefinitionField(transformation, annotation);
        final ConfigAttributeHolder confAttrHolder = createConfigAttributeDefinitionField(plasticClass, annotation);

        final SecurityChecker secChecker = this.securityChecker;
        MethodAdvice securedMethodAdvice = new MethodAdvice() {
         
          public void advise(MethodInvocation invocation) {
           
              InterceptorStatusToken statusTokenVal = secChecker.checkBefore(confAttrHolder);
              tokenFieldHandle.set(invocation.getInstance(), statusTokenVal);
               
                invocation.proceed();

                InterceptorStatusToken tokenFieldValue = (InterceptorStatusToken) tokenFieldHandle.get(invocation.getInstance());
                secChecker.checkAfter(tokenFieldValue, null);
            }
        };

        method.addAdvice(securedMethodAdvice);
View Full Code Here

        Class fieldType = classCache.forName(field.getTypeName());

        ValueEncoder encoder = valueEncoderSource.getValueEncoder(fieldType);

        FieldHandle handle = field.getHandle();

        String fieldName = String.format("%s.%s", field.getPlasticClass().getClassName(), field.getName());

        setValueFromInitializeEventHandler(support, fieldName, handle, parameterName, encoder, urlEncoder);
View Full Code Here

    private void transformField(TransformationSupport support, PlasticField field)
    {
        PageActivationContext annotation = field.getAnnotation(PageActivationContext.class);

        FieldHandle handle = field.getHandle();

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

            {
                int count = Math.min(handles.length, event.getEventContext().getCount());
                for (int i = 0; i < count; ++i)
                {
                    String fieldType = fieldTypes[i];
                    FieldHandle handle = handles[i];
                    Object value = event.coerceContext(i, fieldType);
                    handle.set(instance, value);
                }
            }
        };
    }
View Full Code Here

                } else {
                    LinkedList<Object> list = CollectionFactory.newLinkedList();

                    // iterate backwards
                    for (int i = handles.length - 1; i > -1; i--) {
                        FieldHandle handle = handles[i];
                        Object value = handle.get(instance);

                        // ignore trailing nulls
                        if (value != null || !list.isEmpty()) {
                            list.addFirst(value);
                        }
View Full Code Here

        Class fieldType = classCache.forName(field.getTypeName());

        ValueEncoder encoder = valueEncoderSource.getValueEncoder(fieldType);

        FieldHandle handle = field.getHandle();

        String fieldName = String.format("%s.%s", field.getPlasticClass().getClassName(), field.getName());

        setValueFromInitializeEventHandler(support, fieldName, annotation.required(), handle, parameterName, encoder, urlEncoder);
View Full Code Here

        public void replaceAccess(TransformField conduitField)
        {
            // Ugly:
            PlasticField conduitFieldPlastic = ((BridgeTransformField) conduitField).plasticField;

            final FieldHandle conduitHandle = conduitFieldPlastic.getHandle();

            plasticField.setConduit(new WrapFieldHandleForFieldValueConduitAsFieldConduit(conduitHandle));
        }
View Full Code Here

            plasticField.injectComputed(toComputedValue(provider));
        }

        public FieldAccess getAccess()
        {
            final FieldHandle handle = plasticField.getHandle();

            return new WrapFieldHandleAsFieldAccess(handle);
        }
View Full Code Here

TOP

Related Classes of org.apache.tapestry5.plastic.FieldHandle

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.