Package org.richfaces.component

Examples of org.richfaces.component.UIToggleControl


    Map<String, String> rqMap = exCtx.getRequestParameterMap();
    Object clnId = rqMap.get(component.getClientId(context));
    if (clnId != null) {
      // enqueue event here for this component or for component with Id
      // taken fro forId attribute
      UIToggleControl control = (UIToggleControl)component;

      UITogglePanel panel = control.getPanel();

          new SwitchablePanelSwitchEvent(panel, null, control).queue();
     
        if (UITogglePanel.AJAX_METHOD.equals(panel.getSwitchType())) {
           new AjaxEvent(component).queue();
View Full Code Here


        component.queueEvent(actionEvent);
    }
  }

  public String getOnClick(FacesContext context, UIComponent component) {
    UIToggleControl tgComp = (UIToggleControl)component;
    UITogglePanel panel = tgComp.getPanel();
    //UITogglePanel panel = tgComp.getPanel(context);
    //denis
    String switchType = panel.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(UITogglePanel.CLIENT_METHOD.equals(switchType)) {
      // Client
      String panelId = panel.getClientId(context);
      String switchToDivId = tgComp.getSwitchToState();
      onClick.append("TogglePanelManager.toggleOnClient('")
      .append(panelId).append("',")
      .append(switchToDivId==null?"null":"'" + switchToDivId + "'")
      .append(");");
    } else if(UITogglePanel.AJAX_METHOD.equals(switchType)) {
      // Ajax
      if ( !getUtils().isBooleanAttribute(component,"disabled")) {
        return AjaxRendererUtils.buildOnClick(component, context).toString();
      } else {
        return "return false;";
      }
    } else {
      // Server
      //xxx by nick - denis - use org.ajax4jsf.renderkit.RendererUtils#getNestingForm(FacesContext, UIComponent)
      UIForm Form= getUtils().getNestingForm(context, component);
      String formId=null;     
      if (Form!=null){
         formId = Form.getClientId(context);
      }           
      if(formId==null) {
        throw new RuntimeException("toogleControl (id=\"" + component.getClientId(context) + "\") did not find parent form.");
      }

      onClick.append("TogglePanelManager.toggleOnServer('")
        .append(formId).append("','")
        .append(component.getClientId(context)).append("',")
        .append(tgComp.getSwitchToState()==null?"''":"'" + tgComp.getSwitchToState() + "'")
        .append(");");
    }
    return onClick.toString();
  }
View Full Code Here

    Map rqMap = exCtx.getRequestParameterMap();
    Object clnId = rqMap.get(component.getClientId(context));
    if(clnId!=null) {
      // enqueue event here for this component or for component with Id
      // 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()) {
View Full Code Here

        component.queueEvent(actionEvent);
    }
  }

  public String getOnClick(FacesContext context, UIComponent component) {
    UIToggleControl tgComp = (UIToggleControl)component;
    UITogglePanel panel = tgComp.getPanel();
    //UITogglePanel panel = tgComp.getPanel(context);
    //denis
    String switchType = panel.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(UITogglePanel.CLIENT_METHOD.equals(switchType)) {
      // Client
      String panelId = panel.getClientId(context);
      String switchToDivId = tgComp.getSwitchToState();
      onClick.append("TogglePanelManager.toggleOnClient('")
      .append(panelId)
      .append("',")
      .append(switchToDivId==null?"null":"'" + switchToDivId + "'")
      .append("")
      .append(");");
    } else if(UITogglePanel.AJAX_METHOD.equals(switchType)) {
      // Ajax
      if ( !getUtils().isBooleanAttribute(component,"disabled")) {
        return AjaxRendererUtils.buildOnClick(component, context).toString();
      } else {
        return "return false;";
      }
    } else {
      // Server
      //xxx by nick - denis - use org.ajax4jsf.renderkit.RendererUtils#getNestingForm(FacesContext, UIComponent)
      UIForm Form= getUtils().getNestingForm(context, component);
      String formId=null;     
      if (Form!=null){
         formId = Form.getClientId(context);
      }           
      if(formId==null) {
        throw new RuntimeException("toogleControl (id=\"" + component.getClientId(context) + "\") did not find parent form.");
      }
      onClick.append("TogglePanelManager.toggleOnServer('")
        .append(formId)
        .append("','")
        .append(component.getClientId(context))
        .append("',")
        .append(tgComp.getSwitchToState()==null?"''":"'" + tgComp.getSwitchToState() + "'")
        .append("")
        .append(");");
    }
    return onClick.toString();
  }
View Full Code Here

    Map rqMap = exCtx.getRequestParameterMap();
    Object clnId = rqMap.get(component.getClientId(context));
    if(clnId!=null) {
      // enqueue event here for this component or for component with Id
      // 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()) {
View Full Code Here

        }
    }
  }

  public String getOnClick(FacesContext context, UIComponent component) {
    UIToggleControl tgComp = (UIToggleControl)component;
    UITogglePanel panel = tgComp.getPanel();
    //UITogglePanel panel = tgComp.getPanel(context);
    //denis
    String switchType = panel.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(UITogglePanel.CLIENT_METHOD.equals(switchType)) {
      // Client
      String panelId = panel.getClientId(context);
      String switchToDivId = tgComp.getSwitchToState();
      onClick.append("TogglePanelManager.toggleOnClient('")
      .append(panelId)
      .append("',")
      .append(switchToDivId==null?"null":"'" + switchToDivId + "'")
      .append("")
      .append(");");
    } else if(UITogglePanel.AJAX_METHOD.equals(switchType)) {
      // Ajax
      if ( !getUtils().isBooleanAttribute(component,"disabled")) {
        return AjaxRendererUtils.buildOnClick(component, context).toString();
      } else {
        return "return false;";
      }
    } else {
      // Server
      //xxx by nick - denis - use org.ajax4jsf.renderkit.RendererUtils#getNestingForm(FacesContext, UIComponent)
      RendererUtils rendererUtils = new RendererUtils();
      UIForm Form= rendererUtils.getNestingForm(context, component);
      String formId=null;     
      if (Form!=null){
         formId = Form.getClientId(context);
      }           
      if(formId==null) {
        throw new RuntimeException("toogleControl (id=\"" + component.getClientId(context) + "\") did not find parent form.");
      }
      onClick.append("TogglePanelManager.toggleOnServer('")
        .append(formId)
        .append("','")
        .append(component.getClientId(context))
        .append("',")
        .append(tgComp.getSwitchToState()==null?"''":"'" + tgComp.getSwitchToState() + "'")
        .append("")
        .append(");");
    }
    return onClick.toString();
  }
View Full Code Here

    Map<String, String> rqMap = exCtx.getRequestParameterMap();
    Object clnId = rqMap.get(component.getClientId(context));
    if (clnId != null) {
      // enqueue event here for this component or for component with Id
      // taken fro forId attribute
      UIToggleControl control = (UIToggleControl)component;

      UITogglePanel panel = control.getPanel();

          new SwitchablePanelSwitchEvent(panel, null, control).queue();
     
        if (UITogglePanel.AJAX_METHOD.equals(panel.getSwitchType())) {
           new AjaxEvent(component).queue();
View Full Code Here

        component.queueEvent(actionEvent);
    }
  }

  public String getOnClick(FacesContext context, UIComponent component) {
    UIToggleControl tgComp = (UIToggleControl)component;
    UITogglePanel panel = tgComp.getPanel();
    //UITogglePanel panel = tgComp.getPanel(context);
    //denis
    String switchType = panel.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(UITogglePanel.CLIENT_METHOD.equals(switchType)) {
      // Client
      String panelId = panel.getClientId(context);
      String switchToDivId = tgComp.getSwitchToState();
      onClick.append("TogglePanelManager.toggleOnClient('")
      .append(panelId).append("',")
      .append(switchToDivId==null?"null":"'" + switchToDivId + "'")
      .append(");");
    } else if(UITogglePanel.AJAX_METHOD.equals(switchType)) {
      // Ajax
      if ( !getUtils().isBooleanAttribute(component,"disabled")) {
        return AjaxRendererUtils.buildOnClick(component, context, true).toString();
      } else {
        return "return false;";
      }
    } else {
      // Server
      //xxx by nick - denis - use org.ajax4jsf.renderkit.RendererUtils#getNestingForm(FacesContext, UIComponent)
      UIForm Form= getUtils().getNestingForm(context, component);
      String formId=null;     
      if (Form!=null){
         formId = Form.getClientId(context);
      }           
      if(formId==null) {
        throw new RuntimeException("toogleControl (id=\"" + component.getClientId(context) + "\") did not find parent form.");
      }

      onClick.append("TogglePanelManager.toggleOnServer('")
        .append(formId).append("','")
        .append(component.getClientId(context)).append("',")
        .append(tgComp.getSwitchToState()==null?"''":"'" + tgComp.getSwitchToState() + "'")
        .append(");");
    }
    return onClick.toString();
  }
View Full Code Here

TOP

Related Classes of org.richfaces.component.UIToggleControl

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.