Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
   * JBoss, Home of Professional Open Source
   * Copyright ${year}, Red Hat, Inc. and individual contributors
   * by the @authors tag. See the copyright.txt in the distribution for a
   * full listing of individual contributors.
   * This is free software; you can redistribute it and/or modify it
   * under the terms of the GNU Lesser General Public License as
   * published by the Free Software Foundation; either version 2.1 of
  * the License, or (at your option) any later version.
  * This software is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * Lesser General Public License for more details.
  * You should have received a copy of the GNU Lesser General Public
  * License along with this software; if not, write to the Free
  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
  * 02110-1301 USA, or see the FSF site:
 package org.richfaces.component.behavior;
 import  javax.faces.FacesException;
 import  javax.faces.component.UIComponent;
 import  javax.faces.component.behavior.ClientBehaviorContext;
 import  javax.faces.context.FacesContext;
 import  org.richfaces.component.ComponentIterators;

The <rich:toggleControl> behavior can be attached to any interface component, whether inside or outside the controlled panel itself. It works with a <rich:togglePanel> component to switch between different <rich:togglePanelItem> components.

 @JsfBehavior(id = "org.richfaces.component.behavior.ToggleControl", tag = @Tag(name = "toggleControl", handler = "org.richfaces.view.facelets.html.CustomBehaviorHandler", type = .), renderer = @JsfBehaviorRenderer(type = "org.richfaces.component.behavior.ToggleControl"))
 public class ToggleControl extends ClientBehavior {
     public static final String BEHAVIOR_ID = "org.richfaces.component.behavior.ToggleControl";
     private static final RendererUtils RENDERER_UTILS = RendererUtils.getInstance();
     private enum PropertyKeys {

The event on which to toggle the target panel
     public String getEvent() {
         return (StringgetStateHelper().eval(.);
     public void setEvent(String eventName) {

The next <rich:togglePanelItem> to switch to
     public String getTargetItem() {
     public void setTargetItem(String target) {

The <rich:togglePanel> to switch when this <rich:toggleControl> is not a child of a <rich:togglePanel>
     public String getTargetPanel() {
         return (StringgetStateHelper().eval(.);
     public void setTargetPanel(String selector) {

If "true", disable the default action of the parent component
     public void setDisableDefault(Boolean disableDefault) {
    public Boolean getDisableDefault() {
        return Boolean.valueOf(String.valueOf(getStateHelper().eval(.true)));
    public String getPanelId(ClientBehaviorContext behaviorContextthrows FacesException {
        return getPanel(behaviorContext.getComponent()).getClientId(behaviorContext.getFacesContext());
    public AbstractTogglePanel getPanel(UIComponent compthrows FacesException {
        String target = this.getTargetPanel();
        if (target != null) {
            UIComponent targetComponent = .findComponentFor(comptarget);
            if (null != targetComponent) {
                return (AbstractTogglePaneltargetComponent;
            } else {
                throw new FacesException("Parent panel for control (id=" + comp.getClientId(getFacesContext())
                    + ") has not been found.");
        } else {
            return getEnclosedPanel(comp);
    public static AbstractTogglePanel getEnclosedPanel(UIComponent comp) {
        if (comp == null) {
            return null;
        AbstractTogglePanel panel = ComponentIterators.getParent(compAbstractTogglePanel.class);
        if (panel == null) {
            throw new FacesException("Parent panel for control (id=" + comp.getClientId(FacesContext.getCurrentInstance())
                + ") has not been found.");
        return panel;
    public String getRendererType() {
        return ;
    public void setLiteralAttribute(String nameObject value) {
        if (compare(.name)) {
        } else if (compare(.name)) {
        } else if (compare(.name)) {
            ExpressionFactory expFactory = getFacesContext().getApplication().getExpressionFactory();
New to GrepCode? Check out our FAQ X