Package org.richfaces.component

Examples of org.richfaces.component.UISimpleTogglePanel


    super.doDecode(context, component);
    ExternalContext exCtx = context.getExternalContext();

    Map <String, String> rqMap = exCtx.getRequestParameterMap();
    Object clnId = rqMap.get(component.getClientId(context));
    UISimpleTogglePanel panel = (UISimpleTogglePanel) component;

    if (clnId != null) {
      boolean currentState = panel.isOpened();
      boolean submittedState = false;

      // enqueue event here for this component or for component with Id
      // taken fro forId attribute
      String switchType = panel.getSwitchType();

      if (UISimpleTogglePanel.CLIENT_SWITCH_TYPE.equals(switchType)) {
        submittedState = Boolean.parseBoolean((String) clnId);
      } else {
        submittedState = !currentState;
      }

      if (currentState != submittedState) {
        SimpleToggleEvent event = new SimpleToggleEvent(panel, submittedState);
        event.queue();

        SimpleTogglePanelSwitchEvent stateEvent = new SimpleTogglePanelSwitchEvent(panel, submittedState);
        stateEvent.queue();
      }

      // in case of "ajax" request and "ajax" switch mode of toggle panel
      // set the regions to be rendered (reRendered) after operating this
      // "ajax" request
      if (AjaxRendererUtils.isAjaxRequest(context)
              && panel.getSwitchType().equals(UISimpleTogglePanel.AJAX_SWITCH_TYPE)) {
       
          // add toggle panel itself to rendered list of components
        AjaxRendererUtils.addRegionByName(context, panel, panel.getId());
       
        // add regions specified in the "reRender" attribute of toggle
        // panel to rendered list of components
        AjaxRendererUtils.addRegionsFromComponent(panel, context);
View Full Code Here


    }
  }

    public String getdivdisplay(FacesContext context, UIComponent component) {
      UISimpleTogglePanel simpleTogglePanel = (UISimpleTogglePanel) component;
      return simpleTogglePanel.isOpened() ? EMPTY : NONE;
// String Switch = Boolean.toString(((UISimpleTogglePanel)
// component).isOpened());
//        if (Switch == null || Switch.equals(Boolean.toString(UISimpleTogglePanel.EXPANDED)))
//        {
//            //xxxx by nick - denis - do not set "block" explicitly - that can break some elements, set "" for display. See Element.show() in prototype.js
View Full Code Here

//        }
//        return "none";
    }

    public String getOnClick(FacesContext context, UIComponent component) {
        UISimpleTogglePanel tgComp = (UISimpleTogglePanel) component;

        String switchType = tgComp.getSwitchType();
        StringBuffer onClick = new StringBuffer();
      JSReference eventRef = new JSReference("event");
      String panelId = tgComp.getClientId(context);

  if (UISimpleTogglePanel.CLIENT_SWITCH_TYPE.equals(switchType)) {
            // Client
            JSFunction function = new JSFunction("SimpleTogglePanelManager.toggleOnClient");
            function.addParameter(eventRef);
View Full Code Here

    protected String getValueAsString(FacesContext context, UISimpleTogglePanel Panel) {
        return getUtils().getValueAsString(context, Panel);
    }

    public void encodeChildren(FacesContext context, UIComponent component) throws IOException {
        UISimpleTogglePanel comp = (UISimpleTogglePanel) component;
        if (!(((comp.getSwitchType() == null) || (comp.getSwitchType().equals(UISimpleTogglePanel.CLIENT_SWITCH_TYPE) != true)) && (!comp.isOpened())))
        {
            super.encodeChildren(context, component);
        }
    }
View Full Code Here

            super.encodeChildren(context, component);
        }
    }
   
    public String getSwitchOnStatus(FacesContext context, UIComponent component) {
      UISimpleTogglePanel simpleTogglePanel = (UISimpleTogglePanel) component;
      return simpleTogglePanel.isOpened() ? EMPTY : NONE;
//        String sw = Boolean.toString(((UISimpleTogglePanel) component).isOpened());
//        if (sw == null || sw.equals(Boolean.toString(UISimpleTogglePanel.EXPANDED)))
//            return EMPTY;
//        else return NONE;
    }
View Full Code Here

//            return EMPTY;
//        else return NONE;
    }

    public String getSwitchOffStatus(FacesContext context, UIComponent component) {
      UISimpleTogglePanel simpleTogglePanel = (UISimpleTogglePanel) component;
      return simpleTogglePanel.isOpened() ?  NONE : EMPTY ;
    
//      String sw = Boolean.toString(((UISimpleTogglePanel) component).isOpened());
//        if (sw == null || sw.equals(Boolean.toString(UISimpleTogglePanel.EXPANDED)))
//            return NONE;
//        else return EMPTY;
View Full Code Here

        ExternalContext exCtx = context.getExternalContext();

        Map rqMap = exCtx.getRequestParameterMap();
        Object clnId = rqMap.get(component.getClientId(context));
        UISimpleTogglePanel panel = (UISimpleTogglePanel) component;

        if (clnId != null) {
            // enqueue event here for this component or for component with Id
            // taken fro forId attribute
           
            String switchType = panel.getSwitchType();
            if (!(UISimpleTogglePanel.CLIENT_SWITCH_TYPE.equals(switchType))) {

                //xxxx by nick - denis - use constants, please!
                if ((panel.isOpened() == UISimpleTogglePanel.EXPANDED)) {
                    //panel.setOpened(UISimpleTogglePanel.COLLAPSED);
                    panel.setOpenedSet(UISimpleTogglePanel.COLLAPSED);
                } else {
                    //xxxx by nick - denis - use constants, please!
                    //panel.setOpened(UISimpleTogglePanel.EXPANDED);
                    panel.setOpenedSet(UISimpleTogglePanel.EXPANDED);
                }
                SimpleToggleEvent event = new SimpleToggleEvent(panel, (panel.isOpened()));
                if (panel.isImmediate()) {
                    event.setPhaseId(PhaseId.APPLY_REQUEST_VALUES);
                } else {
                    event.setPhaseId(PhaseId.INVOKE_APPLICATION);
                }
                event.queue();
               
            } else {
                boolean submittedState = Boolean.parseBoolean((String) clnId);
              if (panel.isOpened() != submittedState){
                  //panel.setAjaxSingle(false);
                    SimpleToggleEvent event = new SimpleToggleEvent(panel, (panel.isOpened()));
                    if (panel.isImmediate()) {
                        event.setPhaseId(PhaseId.APPLY_REQUEST_VALUES);
                    } else {
                        event.setPhaseId(PhaseId.INVOKE_APPLICATION);
                    }
                    event.queue();
                }
                if (null == panel.getValueBinding("value"))
                  panel.setOpened(submittedState);
                  panel.setOpenedSet(submittedState);
            }
           
            // in case of "ajax" request and "ajax" switch mode of toggle panel
            // set the regions to be rendered (reRendered) after operating this "ajax" request
            if (AjaxRendererUtils.isAjaxRequest(context) && panel.getSwitchType().equals(UISimpleTogglePanel.AJAX_SWITCH_TYPE)) {
                // add toggle panel itself to rendered list of components
          AjaxRendererUtils.addRegionByName(context,
                        panel,
                        panel.getId());
          // add regions specified in the "reRender" attribute of toggle panel
          // to rendered list of components
                AjaxRendererUtils.addRegionsFromComponent(panel, context);
            }
View Full Code Here

        }
        return "none";
    }

    public String getOnClick(FacesContext context, UIComponent component) {
        UISimpleTogglePanel tgComp = (UISimpleTogglePanel) component;

        String switchType = tgComp.getSwitchType();
        StringBuffer onClick = new StringBuffer();
      JSReference eventRef = new JSReference("event");
      String panelId = tgComp.getClientId(context);

  if (UISimpleTogglePanel.CLIENT_SWITCH_TYPE.equals(switchType)) {
            // Client
            JSFunction function = new JSFunction("SimpleTogglePanelManager.toggleOnClient");
            function.addParameter(eventRef);
View Full Code Here

        return getUtils().getValueAsString(context, Panel);
    }

    public void encodeChildren(FacesContext context, UIComponent component) throws IOException {
        // TODO Auto-generated method stub
        UISimpleTogglePanel comp = (UISimpleTogglePanel) component;
        //xxxx by nick - denis - use constants, please!
        if (!(((comp.getSwitchType() == null) || (comp.getSwitchType().equals(UISimpleTogglePanel.CLIENT_SWITCH_TYPE) != true)) && (comp.isOpened() == UISimpleTogglePanel.COLLAPSED)))
        {
            super.encodeChildren(context, component);
        }
    }
View Full Code Here

        ExternalContext exCtx = context.getExternalContext();

        Map rqMap = exCtx.getRequestParameterMap();
        Object clnId = rqMap.get(component.getClientId(context));
        UISimpleTogglePanel panel = (UISimpleTogglePanel) component;

        if (clnId != null) {
            // enqueue event here for this component or for component with Id
            // taken fro forId attribute
           
            String switchType = panel.getSwitchType();
            if (!(UISimpleTogglePanel.CLIENT_SWITCH_TYPE.equals(switchType))) {

                //xxxx by nick - denis - use constants, please!
                if ((panel.isOpened() == UISimpleTogglePanel.EXPANDED)) {
                    panel.setOpened(UISimpleTogglePanel.COLLAPSED);
                } else {
                    //xxxx by nick - denis - use constants, please!
                    panel.setOpened(UISimpleTogglePanel.EXPANDED);
                }
                SimpleToggleEvent event = new SimpleToggleEvent(panel, (panel.isOpened()));
                if (panel.isImmediate()) {
                    event.setPhaseId(PhaseId.APPLY_REQUEST_VALUES);
                } else {
                    event.setPhaseId(PhaseId.INVOKE_APPLICATION);
                }
                event.queue();
               
            } else {
                if (panel.isOpened()!= new Boolean((String) clnId).booleanValue()){
                  panel.setAjaxSingle(false);
                    SimpleToggleEvent event = new SimpleToggleEvent(panel, (panel.isOpened()));
                    if (panel.isImmediate()) {
                        event.setPhaseId(PhaseId.APPLY_REQUEST_VALUES);
                    } else {
                        event.setPhaseId(PhaseId.INVOKE_APPLICATION);
                    }
                    event.queue();
                }
                if (null == panel.getValueBinding("value"))
                  panel.setOpened(new Boolean((String) clnId).booleanValue());
            }
           
            // in case of "ajax" request and "ajax" switch mode of toggle panel
            // set the regions to be rendered (reRendered) after operating this "ajax" request
            if (AjaxRendererUtils.isAjaxRequest(context) && panel.getSwitchType().equals(UISimpleTogglePanel.AJAX_SWITCH_TYPE)) {
              // add toggle panel itself to rendered list of components
              AjaxRendererUtils.addRegionByName(context,
                        panel,
                        panel.getId());
              // add regions specified in the "reRender" attribute of toggle panel
              // to rendered list of components
              AjaxRendererUtils.addRegionsFromComponent(panel, context);
            }
View Full Code Here

TOP

Related Classes of org.richfaces.component.UISimpleTogglePanel

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.