Package org.richfaces.event

Examples of org.richfaces.event.SwitchablePanelSwitchEvent


  public void broadcast(FacesEvent facesEvent) throws AbortProcessingException {
    if (facesEvent instanceof SwitchablePanelSwitchEvent) {
      if (isRendered()) {
        FacesContext facesContext = FacesContext.getCurrentInstance();
       
        SwitchablePanelSwitchEvent switchEvent = (SwitchablePanelSwitchEvent) facesEvent;
        Object newValue = convertSwitchValue(switchEvent.getEventSource(),
            switchEvent.getValue());
       
        Object oldValue = getValue();
        if (oldValue == null && newValue != null ||
            oldValue != null && !oldValue.equals(newValue)) {
 
View Full Code Here


   
    if (facesEvent instanceof SwitchablePanelSwitchEvent) {
      if (isRendered()) {
        FacesContext facesContext = FacesContext.getCurrentInstance();
       
        SwitchablePanelSwitchEvent switchEvent = (SwitchablePanelSwitchEvent) facesEvent;
        Object newValue = convertSwitchValue(switchEvent.getEventSource(),
            switchEvent.getValue());
       
        Object oldValue = getValue();
        if ((oldValue == null && newValue != null) ||
          (oldValue != null && !oldValue.equals(newValue))) {
 
View Full Code Here

                eventTab = tab;
            }
        }

        if (eventTab != null) {
            new SwitchablePanelSwitchEvent(panel, null, eventTab).queue();
            new ActionEvent(eventTab).queue();

            if (UISwitchablePanel.AJAX_METHOD.equals(eventTab.getSwitchTypeOrDefault()))
            {
                new AjaxEvent(eventTab).queue();
            }
        } else {
            String newValue = (String) requestParameterMap.get(clientId);
           
            if (null != newValue) {
                new SwitchablePanelSwitchEvent(panel, newValue, null).queue();
            }
        }
    }
View Full Code Here

      // taken fro forId attribute
      UIToggleControl control = (UIToggleControl)component;

      UITogglePanel panel = control.getPanel();

          new SwitchablePanelSwitchEvent(panel, null, control).queue();
     
//      ToggleEvent event = new ToggleEvent(panel, control.getSwitchToState());
//        if (control.isImmediate()) {
//          event.setPhaseId(PhaseId.APPLY_REQUEST_VALUES);
//        } else {
View Full Code Here

    public void testSwitch() throws Exception {

        HtmlPage page = renderView();
        // System.out.println(page.asXml());
        togglePanel.setValue("a");
        togglePanel.broadcast(new SwitchablePanelSwitchEvent(togglePanel, null,
                toggleControl));
        assertFalse(((String) togglePanel.getValue()).equals("a"));
        assertTrue(((String) togglePanel.getValue()).equals("b"));

        toggleControl.setSwitchToState("a");
        togglePanel.broadcast(new SwitchablePanelSwitchEvent(togglePanel,
                "null", toggleControl));
        assertFalse(((String) togglePanel.getValue()).equals("b"));
        assertTrue(((String) togglePanel.getValue()).equals("a"));

        toggleControl.setSwitchToState(null);
        togglePanel.setStateOrder("c,b,a");
        togglePanel.broadcast(new SwitchablePanelSwitchEvent(togglePanel,
                "null", toggleControl));
        assertFalse(((String) togglePanel.getValue()).equals("a"));
        assertTrue(((String) togglePanel.getValue()).equals("c"));

        togglePanel.setValue(null);
        togglePanel.setStateOrder("c,b,a");
        togglePanel.broadcast(new SwitchablePanelSwitchEvent(togglePanel,
                "null", toggleControl));
        assertTrue(((String) togglePanel.getValue()).equals("c"));
       
        togglePanel.setStateOrder("");
        toggleControl.setSwitchToState("d");
        try {
            togglePanel.broadcast(new SwitchablePanelSwitchEvent(togglePanel,
                    "null", toggleControl));
            //fail();
        } catch (Exception ex) {
        }
    }
View Full Code Here

        assertNotNull(events);
        assertEquals(2, events.size());

        FacesEvent event = (FacesEvent) events.remove();
        assertTrue(event instanceof SwitchablePanelSwitchEvent);
        SwitchablePanelSwitchEvent switchEvent = (SwitchablePanelSwitchEvent) event;
        assertEquals(switchEvent.getValue(), "ABYBC");

        events = mockViewRoot.getEventsQueue(PhaseId.INVOKE_APPLICATION);
        assertNotNull(events);
        assertEquals(1, events.size());
View Full Code Here

        assertNotNull(events);
        assertEquals(1, events.size());

        FacesEvent event = (FacesEvent) events.remove();
        assertTrue(event instanceof SwitchablePanelSwitchEvent);
        SwitchablePanelSwitchEvent switchEvent = (SwitchablePanelSwitchEvent) event;
        assertEquals(switchEvent.getValue(), "Swich");
    }
View Full Code Here

   
    if (facesEvent instanceof SwitchablePanelSwitchEvent) {
      if (isRendered()) {
        FacesContext facesContext = FacesContext.getCurrentInstance();
       
        SwitchablePanelSwitchEvent switchEvent = (SwitchablePanelSwitchEvent) facesEvent;
        Object newValue = convertSwitchValue(switchEvent.getEventSource(),
            switchEvent.getValue());
       
        Object oldValue = getValue();
        if ((oldValue == null && newValue != null) ||
          (oldValue != null && !oldValue.equals(newValue))) {
 
View Full Code Here

    super.decode(context,component);

    Map requestParameterMap = context.getExternalContext().getRequestParameterMap();
    String value = (String)requestParameterMap.get(component.getClientId(context));
    if (value != null) {
      new SwitchablePanelSwitchEvent(component, value, null).queue();
    }
   
/*    Object property=context.getExternalContext().getRequestParameterMap().get(component.getClientId(context));
    if (property!=null){
      component.getAttributes().put(EXPANDED_ATTR,property);
View Full Code Here

  public void broadcast(FacesEvent facesEvent) throws AbortProcessingException {
    if (facesEvent instanceof SwitchablePanelSwitchEvent) {
      if (isRendered()) {
        FacesContext facesContext = FacesContext.getCurrentInstance();
       
        SwitchablePanelSwitchEvent switchEvent = (SwitchablePanelSwitchEvent) facesEvent;
        Object newValue = convertSwitchValue(switchEvent.getEventSource(),
            switchEvent.getValue());
       
        Object oldValue = getValue();
        if (oldValue == null && newValue != null ||
            oldValue != null && !oldValue.equals(newValue)) {
 
View Full Code Here

TOP

Related Classes of org.richfaces.event.SwitchablePanelSwitchEvent

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.