Package org.ajax4jsf.component.behavior

Examples of org.ajax4jsf.component.behavior.AjaxBehavior


        if (!(behavior instanceof AjaxBehavior)) {
            throw new IllegalArgumentException("org.ajax4jsf.component.behavior.AjaxBehavior required: " + behavior);
        }

        AjaxBehavior ajaxBehavior = (AjaxBehavior) behavior;

        if (ajaxBehavior.isDisabled()) {
            return;
        }

        component.queueEvent(createEvent(component, ajaxBehavior));
View Full Code Here


  ------------------------------------------------------------------------------------*/
  private static void afegirAjax(UIComponent control, String event, ArrayList<String> renderList, ArrayList<String> execute)
  {
    Application application = FacesContext.getCurrentInstance().getApplication();
   
      AjaxBehavior ajaxBehavior = (AjaxBehavior) application.createBehavior(AjaxBehavior.BEHAVIOR_ID);
     
      ajaxBehavior.setExecute(execute);
     
      ajaxBehavior.setRender(renderList);
      
      ((UIComponentBase) control).addClientBehavior(event, ajaxBehavior);
  }
View Full Code Here

        Application application = ctx.getFacesContext().getApplication();
        Behavior behavior = application.createBehavior(getBehaviorId());
        if (behavior instanceof AjaxBehavior) {
            setAttributes(ctx, behavior);
            AjaxBehavior ajaxBehavior = (AjaxBehavior) behavior;

            FacesContext context = ctx.getFacesContext();

            BehaviorStack ajaxBehaviors = BehaviorStack.getBehaviorStack(context, true);
            String eventName = getEventName();
            ajaxBehaviors.pushBehavior(context, ajaxBehavior, getBehaviorId(), eventName);

            AttachQueueStack attachQueueStack = AttachQueueStack.getStack(context, true);
            AttachQueueInfo attachQueueInfo = new AttachQueueInfo(parent);
            attachQueueStack.push(attachQueueInfo);

            nextHandler.apply(ctx, parent);

            attachQueueStack.pop();

            BehaviorInfo behaviorInfo = ajaxBehaviors.popBehavior();
            if (behaviorInfo != null) {
                if (isWrapping()) {
                    AbstractAttachQueue attachQueue = attachQueueInfo.getAttachQueue();
                    if (attachQueue != null) {
                        List<ClientBehavior> behaviors = behaviorInfo.getBehaviors();
                        if (behaviors != null) {
                            for (ClientBehavior processBehavior : behaviors) {
                                if (processBehavior instanceof AjaxBehavior) {
                                    AjaxBehavior createdAjaxBehavior = (AjaxBehavior) processBehavior;
                                    attachQueue.associateWith(createdAjaxBehavior);
                                }
                            }
                        }
                    }
View Full Code Here

        if (!(behavior instanceof AjaxBehavior)) {
            throw new IllegalArgumentException("org.ajax4jsf.component.behavior.AjaxBehavior required: " + behavior);
        }

        AjaxBehavior ajaxBehavior = (AjaxBehavior) behavior;

        if (ajaxBehavior.isDisabled()) {
            return;
        }

        component.queueEvent(createEvent(component, ajaxBehavior));
View Full Code Here

    @Test
    public void testAttachQueueWithNestedAjax() throws Exception {
        buildView("/attachQueueWithNestedAjax.xhtml");

        AjaxBehavior defaultEvent = getAjaxBehavior(":form:defaultEventText", null);
        assertNotNull(defaultEvent);
        assertEquals("form:defaultEventQueue", defaultEvent.getQueueId());

        AjaxBehavior keyup = getAjaxBehavior(":form:keyupText", "keyup");
        assertNotNull(keyup);
        assertEquals("form:keyupQueue", keyup.getQueueId());

        checkNotAssignedToParent(":form:defaultEventQueue");
        checkNotAssignedToParent(":form:keyupQueue");
    }
View Full Code Here

    @Test
    public void testAttachQueueWithWrappingAjax() throws Exception {
        buildView("/attachQueueWithWrappingAjax.xhtml");

        AjaxBehavior defaultEventInput = getAjaxBehavior(":form:defaultEventInput", null);
        assertNotNull(defaultEventInput);
        assertEquals("form:defaultEventQueue", defaultEventInput.getQueueId());

        AjaxBehavior defaultEventLinkBehavior = getAjaxBehavior(":form:defaultEventLink", null);
        assertNotNull(defaultEventLinkBehavior);
        assertEquals("form:defaultEventQueue", defaultEventLinkBehavior.getQueueId());

        AjaxBehavior valueChangeInput = getAjaxBehavior(":form:valueChangeInput", null);
        assertNotNull(valueChangeInput);
        assertEquals("form:valueChangeQueue", valueChangeInput.getQueueId());

        AjaxBehavior valueChangeLink = getAjaxBehavior(":form:valueChangeLink", null);
        assertNull(valueChangeLink);

        checkNotAssignedToParent(":form:defaultEventQueue");
        checkNotAssignedToParent(":form:valueChangeQueue");
    }
View Full Code Here

    @Test
    public void testAttachQueueWithWrappingBehaviors() throws Exception {
        buildView("/attachQueueWithWrappingBehaviors.xhtml");

        AjaxBehavior input = getAjaxBehavior(":form:input", "click");
        assertNotNull(input);
        assertEquals("form:clickQueue", input.getQueueId());

        AjaxBehavior button = getAjaxBehavior(":form:button", "click");
        assertNotNull(button);
        assertEquals("form:clickQueue", button.getQueueId());

        AjaxBehavior nestedInputClick = getAjaxBehavior(":form:nestedInput", "click");
        assertNotNull(nestedInputClick);
        assertEquals("form:clickQueue", nestedInputClick.getQueueId());

        AjaxBehavior nestedInputChange = getAjaxBehavior(":form:nestedInput", "valueChange");
        assertNotNull(nestedInputChange);
        assertEquals("form:valueChangeQueue", nestedInputChange.getQueueId());

        AjaxBehavior nestedButtonClick = getAjaxBehavior(":form:nestedButton", "click");
        assertNotNull(nestedButtonClick);
        assertEquals("form:clickQueue", nestedButtonClick.getQueueId());

        checkNotAssignedToParent(":form:valueChangeQueue");
        checkNotAssignedToParent(":form:clickQueue");
    }
View Full Code Here

TOP

Related Classes of org.ajax4jsf.component.behavior.AjaxBehavior

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.