Package org.richfaces.component

Examples of org.richfaces.component.UISimpleTogglePanel


        }
        return "none";
    }

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

        String switchType = tgComp.getSwitchType();
        StringBuffer onClick = new StringBuffer();
        //String userOnClick = (String)component.getAttributes().get("onclick");
        //if(userOnClick!=null) {
        //  onClick.append(userOnClick);
        //  if(!userOnClick.trim().endsWith(";")) {
        //    onClick.append("; ");
        //  }
        //}


        if (UISimpleTogglePanel.CLIENT_SWITCH_TYPE.equals(switchType)) {
            // Client
            String panelId = tgComp.getClientId(context);
            onClick.append("SimpleTogglePanelManager.toggleOnClient('")
                    .append(panelId)
                    .append("');");
        } else if (UISimpleTogglePanel.AJAX_SWITCH_TYPE.equals(switchType)) {
            // Ajax
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

    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;
        String switchType = comp.getSwitchType();
        if (UISimpleTogglePanel.CLIENT_SWITCH_TYPE.equals(switchType) || comp.isOpened()) {
            super.encodeChildren(context, component);
        }
    }
View Full Code Here

    super.setProperties(component);

    if (_value != null) {
      if (_value.isLiteralText()) {
        try {
          UISimpleTogglePanel panel = (UISimpleTogglePanel) component;
          panel.setOpened(Boolean.valueOf(_value.getExpressionString()));
        } catch (ELException e) {
          throw new FacesException(e);
        }
      } else {
        component.setValueExpression("value", _value);
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());
            }
           
            if (AjaxRendererUtils.isAjaxRequest(context) && panel.getSwitchType().equals(UISimpleTogglePanel.AJAX_SWITCH_TYPE)) {
                AjaxRendererUtils.addRegionByName(context,
                        panel,
                        panel.getId());
            }

        }
       
       
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();
        //String userOnClick = (String)component.getAttributes().get("onclick");
        //if(userOnClick!=null) {
        //  onClick.append(userOnClick);
        //  if(!userOnClick.trim().endsWith(";")) {
        //    onClick.append("; ");
        //  }
        //}


        if (UISimpleTogglePanel.CLIENT_SWITCH_TYPE.equals(switchType)) {
            // Client
            String panelId = tgComp.getClientId(context);
            onClick.append("SimpleTogglePanelManager.toggleOnClient('")
                    .append(panelId)
                    .append("');");
        } else if (UISimpleTogglePanel.AJAX_SWITCH_TYPE.equals(switchType)) {
            // Ajax
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

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.