Package org.directwebremoting.extend

Examples of org.directwebremoting.extend.NamedConverter


                .append(dtojs)
                .append("    dwr.engine._setObject(\"" + jsClassName + "\", c);\n")
                .append("    dwr.engine._mappedClasses[\"" + jsClassName + "\"] = c;\n");

            // Generate inheritance
            NamedConverter namedConv = converterManager.getNamedConverter(jsClassName);
            String jsSuperClassName = namedConv.getJavascriptSuperClass();
            if (LocalUtil.hasLength(jsSuperClassName))
            {
                String classExpression = "dwr.engine._mappedClasses[\"" + jsClassName + "\"]";
                String superClassExpression = "dwr.engine._mappedClasses[\"" + jsSuperClassName + "\"]";
                buffer
View Full Code Here


        }

        // DTO inheritance definitions
        for (String jsClassName : converterManager.getNamedConverterJavaScriptNames())
        {
            NamedConverter namedConv = converterManager.getNamedConverter(jsClassName);
            String jsSuperClassName = namedConv.getJavascriptSuperClass();
            if (LocalUtil.hasLength(jsSuperClassName))
            {
                String classExpression = engineModule + "._mappedClasses[\"" + jsClassName + "\"]";
                String superClassExpression = engineModule + "._mappedClasses[\"" + jsSuperClassName + "\"]";
                mod.addContent("\n");
View Full Code Here

    /* (non-Javadoc)
     * @see org.directwebremoting.extend.Remoter#generateDtoScript(java.lang.String, java.lang.String, java.lang.String)
     */
    public String generateDtoJavaScript(String jsClassName, String indent, String assignVariable) throws SecurityException
    {
        NamedConverter namedConv = converterManager.getNamedConverter(jsClassName);
        if (namedConv != null)
        {
            // The desired output should follow this scheme (not wrapped by any
            // "if already defined clauses" as this is not used by all module
            // systems):
            // (1) <indent><assignVariable> = function() {
            // (2) <indent>  this.myProp = <initial value>;
            // (2) <indent>  ...
            // (2) <indent>}
            // (3) <indent><assignVariable>.$dwrClassName = 'pkg.MyData';
            // (4) <indent><assignVariable>.$dwrClassMembers = {};
            // (5) <indent><assignVariable>.$dwrClassMembers.myProp = {};
            // (6) <indent><assignVariable>.createFromMap = dwr.engine._createFromMap;
            StringBuilder buf = new StringBuilder();

            // Generate (1): <indent><assignVariable> = function() {
            buf.append(indent + assignVariable + " = function() {\n");

            // Generate (2): <indent>  this.myProp = <initial value>;
            Map<String, Property> properties = namedConv.getPropertyMapFromClass(namedConv.getInstanceType(), true, true);
            for (Entry<String, Property> entry : properties.entrySet())
            {
                String name = entry.getKey();
                Property property = entry.getValue();
                Class<?> propType = property.getPropertyType();
View Full Code Here

            // Generate DTO
            mod.addContent(dtojs);
            mod.addContent("    " + engineModule + "._mappedClasses[\"" + jsClassName + "\"] = c;\n");

            // Generate inheritance
            NamedConverter namedConv = converterManager.getNamedConverter(jsClassName);
            String jsSuperClassName = namedConv.getJavascriptSuperClass();
            if (LocalUtil.hasLength(jsSuperClassName))
            {
                mod.addContent("\n");
                mod.addRequire(dojoDtoBaseModulePath, jsSuperClassName);
                String superClassExpression = engineModule + "._mappedClasses[\"" + jsSuperClassName + "\"]";
View Full Code Here

        String script = null;

        String dtojs = remoter.generateDtoJavaScript(jsClassName, "  ", "c");
        if (dtojs != null)
        {
            NamedConverter namedConv = converterManager.getNamedConverter(jsClassName);
            String jsSuperClassName = namedConv.getJavascriptSuperClass();

            AmdModule mod = new AmdModule(contextPath, servletPath);
            mod.addDependency(amdDwrBaseModulePath, "engine", "dwr");
            if (LocalUtil.hasLength(jsSuperClassName))
            {
View Full Code Here

        }

        // DTO superclass definitions
        for (String jsClassName : converterManager.getNamedConverterJavaScriptNames())
        {
            NamedConverter namedConv = converterManager.getNamedConverter(jsClassName);
            String jsSuperClassName = namedConv.getJavascriptSuperClass();
            if (LocalUtil.hasLength(jsSuperClassName))
            {
                String classExpression = "dwr.engine._mappedClasses[\"" + jsClassName + "\"]";
                String superClassExpression = "dwr.engine._mappedClasses[\"" + jsSuperClassName + "\"]";
                buffer
View Full Code Here

            if (converter instanceof NamedConverter)
            {
                try
                {
                    NamedConverter namedConverter = (NamedConverter) converter;
                    Class<?> javaClass = LocalUtil.classForName(match);
                    setUpClassMapping(namedConverter, javaClass);
                }
                catch (Exception cne)
                {
View Full Code Here

        converter.setConverterManager(this);

        if (converter instanceof NamedConverter)
        {
            NamedConverter namedConverter = (NamedConverter) converter;
            setUpClassMapping(namedConverter, clazz);
        }

        convertersByClass.put(clazz, converter);
        converterCache.clear();
View Full Code Here

        if (conv != null)
        {
            // Check if mapped
            if (conv instanceof NamedConverter)
            {
                NamedConverter namedConv = (NamedConverter) conv;
                if (LocalUtil.hasLength(namedConv.getJavascript()))
                {
                    return namedConv.getJavascript();
                }
            }
        }
        return null;
    }
View Full Code Here

        }

        String objectName = data.getNamedObjectType();
        if (objectName != null)
        {
            NamedConverter converter = getNamedConverter(objectName, Object.class);
            if (converter != null)
            {
                return converter.getInstanceType();
            }
            else
            {
                return null;
            }
View Full Code Here

TOP

Related Classes of org.directwebremoting.extend.NamedConverter

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.