Package org.auraframework.def

Examples of org.auraframework.def.ControllerDef


                                throw new AuraRuntimeException(String.format("%s cannot be instantiated directly.",
                                        descriptor));
                            }
                           
                            // new component may have its own controllerdef so add that one
                            ControllerDef cd = c.getControllerDef();
                            if (cd != null) {
                                this.valueProviders.put(ValueProviderType.CONTROLLER.getPrefix(), cd);
                            }
                        } catch (DefinitionNotFoundException dnfe) {
                            throw new AuraRuntimeException(String.format("%s did not provide a valid component",
View Full Code Here


        }

        Map<String, ActionDef> flattened = Maps.newHashMap();

        for (DefDescriptor<ControllerDef> delegate : componentDef.getControllerDefDescriptors()) {
            ControllerDef c = delegate.getDef();
            for (Map.Entry<String, ? extends ActionDef> e : c.getActionDefs().entrySet()) {
                ActionDef a = flattened.get(e.getKey());
                if (a != null) {
                    // TODO: server and client actions by same name, map needs
                    // key on action type
                } else {
View Full Code Here

            }

            PropertyReference ref = (PropertyReference) expression;
            ref = ref.getStem();

            ControllerDef controllerDef = getControllerDef();
            ActionDef actionDef = controllerDef.getSubDefinition(ref.toString());
            Action action = Aura.getInstanceService().getInstance(actionDef);

            AuraContext context = Aura.getContextService().getCurrentContext();
            Action previous = context.setCurrentAction(action);
            try {
View Full Code Here

            this.valueProviders.put(ValueProviderType.VIEW.getPrefix(), attributeSet);

            // def can be null if a definition not found exception was thrown for that definition. Odd.
            if (def != null) {
                ControllerDef cd = def.getDeclaredControllerDef();
                if (cd != null) {
                    // Insure that this def is allowed to create an instance of the controller
                    defRegistry.assertAccess(descriptor, cd);

                    this.valueProviders.put(ValueProviderType.CONTROLLER.getPrefix(), cd);
View Full Code Here

            return (T) new ComponentImpl((DefDescriptor<ComponentDef>) descriptor, attributes);
        case ACTION:
            AuraContext context = Aura.getContextService().getCurrentContext();
            context.pushCallingDescriptor(descriptor);
            try {
                ControllerDef controllerDef = ((SubDefDescriptor<ActionDef, ControllerDef>) descriptor)
                        .getParentDescriptor().getDef();
                return (T) controllerDef.createAction(descriptor.getName(), attributes);
            } finally {
                context.popCallingDescriptor();
            }
        case EVENT:
            return (T) new EventImpl((DefDescriptor<EventDef>) descriptor, attributes);
View Full Code Here

        assertEquals("TestJavaModel", lmdd.getName());

        ModelDef model = application.getModelDef();
        assertEquals("TestJavaModel", model.getName());

        ControllerDef controller = application.getControllerDef();
        assertEquals("testApplication1", controller.getName());

        DefDescriptor<RendererDef> rd = application.getRendererDescriptor();
        assertEquals("testApplication1", rd.getName());

        DefDescriptor<StyleDef> td = application.getStyleDescriptor();
View Full Code Here

     * @throws DefinitionNotFoundException
     * @throws Exception
     */
    public MockAction mockServerAction(DefDescriptor<ControllerDef> controllerDefDescriptor, String actionName,
            Object returnValue) throws Exception {
        final ControllerDef originalControllerDef = Aura.getDefinitionService().getDefinition(controllerDefDescriptor);
        final ControllerDef controllerDef = Mockito.spy(originalControllerDef);
        final MockAction mockAction = Mockito.spy(new MockAction(originalControllerDef.getSubDefinition(actionName)
                .getDescriptor(), State.SUCCESS, returnValue));
        Mockito.doReturn(mockAction).when(controllerDef)
                .createAction(Mockito.eq(actionName), Mockito.anyMapOf(String.class, Object.class));
        mockDef(controllerDef);
View Full Code Here

    public LabelControllerTest(String name) {
        super(name);
    }

    public void testLabelController() throws Exception {
        ControllerDef def = labelCntrDesc.getDef();
        assertNotNull("Failed to fetch the definition of the Label Controller.", def);
        runLabelAction("Related_Lists", "task_mode_today", State.SUCCESS, "Today");
    }
View Full Code Here

     * @throws Exception
     */
    public void testControllerWithComments() throws Exception {
        DefDescriptor<ControllerDef> descriptor = DefDescriptorImpl.getInstance(
                "js://test.test_JSController_WithComments", ControllerDef.class);
        ControllerDef def = descriptor.getDef();
        assertNotNull("Failed to fetch the definition of the Javascript Controller.", def);
        assertTrue(def instanceof JavascriptControllerDef);
        Map<String, JavascriptActionDef> actions = ((JavascriptControllerDef) def).getActionDefs();
        assertTrue("Expected there be only two action in the javascript controller.", actions.size() == 2);
        assertNotNull("Expected action not present.", actions.get("functionName1"));
View Full Code Here

        assertEquals("TestJavaModel", lmdd.getName());

        ModelDef model = component.getModelDef();
        assertEquals("TestJavaModel", model.getName());

        ControllerDef controller = component.getControllerDef();
        assertEquals("testComponent1", controller.getName());

        DefDescriptor<RendererDef> rd = component.getRendererDescriptor();
        assertEquals("testComponent1", rd.getName());

        DefDescriptor<StyleDef> td = component.getStyleDescriptor();
View Full Code Here

TOP

Related Classes of org.auraframework.def.ControllerDef

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.