Package org.auraframework.instance

Examples of org.auraframework.instance.Component


        StringBuilder sb = new StringBuilder();
        Aura.getSerializationService().write(value, attributes, getType(), sb, "JS");
        attribs.put("auraInitBlock", String.format("<script>%s</script>", sb.toString()));

        try {
            Component c = Aura.getInstanceService().getInstance("aura:template", ComponentDef.class, attribs);
            Aura.getRenderingService().render(c, out);
        } catch (QuickFixException e) {
            throw new AuraError(e);
        }
    }
View Full Code Here


            Aura.getSerializationService().write(context, null, AuraContext.class, contextWriter, "JSON");

            auraInit.put("context", new Literal(contextWriter.toString()));

            attributes.put("auraInit", Json.serialize(auraInit, context.getJsonSerializationContext()));
            Component template = instanceService.getInstance(templateDef.getDescriptor(), attributes);
            renderingService.render(template, out);
        } catch (QuickFixException e) {
            throw new AuraRuntimeException(e);
        }
    }
View Full Code Here

            attributes.put("def", def);
            InstanceService instanceService = Aura.getInstanceService();
            DefinitionService definitionService = Aura.getDefinitionService();
            DefDescriptor<ComponentDef> tmplDesc = definitionService.getDefDescriptor("auradev:saveStyle",
                    ComponentDef.class);
            Component tmpl = instanceService.getInstance(tmplDesc, attributes);
            Aura.getRenderingService().render(tmpl, out);
        } catch (QuickFixException x) {
            throw new AuraError(x);
        } catch (IOException x) {
            throw new AuraRuntimeException(x);
View Full Code Here

     * @throws Exception
     * @hierarchy Aura.Runtime.Service
     * @userStory AuraServlet: POST
     */
    public void testGetComponent() throws Exception {
        Component component = Aura.getInstanceService()
                .getInstance("auratest:testComponent1", ComponentDef.class, null);
        assertEquals("Default String", component.getAttributes().getExpression("myString")); // from
                                                                                             // the
                                                                                             // component
        assertEquals(true, component.getAttributes().getExpression("myBoolean")); // from
                                                                                  // the
                                                                                  // parent
                                                                                  // component
        assertEquals("Interface String", component.getAttributes().getExpression("interfaceString")); // from
                                                                                                      // the
                                                                                                      // interface
        assertEquals("1", component.getGlobalId());
    }
View Full Code Here

                        baseComponentTag,
                        "isTemplate='true' extends='aura:template' model='java://org.auraframework.impl.java.model.TestModel'",
                        extraScriptTags + extraStyleTags + extraMetaTags));

        StringBuffer sb = new StringBuffer();
        Component template = Aura.getInstanceService().getInstance(scriptTagInBodyOfTemplate);
        Aura.getRenderingService().render(template, sb);
        String result = sb.toString();
        assertTrue("extraScriptTags attribute on aura:template could not retrieve value off model",
                result.contains("<script type=\"text/javascript\" src=\"firstThingDefault\""));
        assertTrue("extraStyleTags attribute on aura:template could not retrieve value off model",
View Full Code Here

                        baseComponentTag,
                        "isTemplate='true' extends='aura:template' ",
                        ""));
       
        StringBuffer sb = new StringBuffer();
        Component template = Aura.getInstanceService().getInstance(errorTitleIntemplate);
        Aura.getRenderingService().render(template, sb);
        String result = sb.toString();
        assertTrue("errorTitle attribute on aura:template has wrong text: "+result,
                result.contains("Looks like there's a problem:"));
       
View Full Code Here

                        baseComponentTag,
                        "isTemplate='true' extends='aura:template' ",
                        errorTitle));
       
        StringBuffer sb = new StringBuffer();
        Component template = Aura.getInstanceService().getInstance(errorTitleIntemplate);
        Aura.getRenderingService().render(template, sb);
        String result = sb.toString();
        assertTrue("errorTitle attribute on aura:template has wrong text",
                result.contains("Looks like there's a problem."));             
    }
View Full Code Here

     * Unsupported.
     *
     * @throws Exception
     */
    public void testUseOfJSRendererLocally() throws Exception {
        Component dummyCmp = null;
        StringWriter sw = new StringWriter();
        DefDescriptor<RendererDef> descriptor = DefDescriptorImpl.getInstance("js://test.testJSRenderer",
                RendererDef.class);
        RendererDef def = descriptor.getDef();
        try {
View Full Code Here

     *
     * @expectedResults Rendering section found in component instance.
     * @throws Exception
     */
    public void testComponentInstanceDefWhenRendererIsJava() throws Exception {
        Component component = Aura.getInstanceService().getInstance("test:test_SimpleJavaRenderer", ComponentDef.class,
                null);
        // Convert the instance to a format that is used by the client
        String defInJson = Json.serialize(component, false, true);
        // Convert back to the object, just like the client does in javascript
        Object defObj = new JsonReader().read(defInJson);
View Full Code Here

    public void writeElement(ThemeDef def, Appendable out) throws IOException {
        try {
            Map<String, Object> attributes = ImmutableMap.<String, Object>of("def", def);
            DefinitionService defService = Aura.getDefinitionService();
            DefDescriptor<ComponentDef> tmplDesc = defService.getDefDescriptor("auradev:saveTheme", ComponentDef.class);
            Component tmpl = Aura.getInstanceService().getInstance(tmplDesc, attributes);
            Aura.getRenderingService().render(tmpl, out);
        } catch (QuickFixException x) {
            throw new AuraError(x);
        }
    }
View Full Code Here

TOP

Related Classes of org.auraframework.instance.Component

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.