⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 panecomponent.java

📁 一个java写的加密算法
💻 JAVA
字号:
/* * $Id: PaneComponent.java,v 1.4 2004/11/14 07:33:13 tcfujii Exp $ *//* * Copyright 2004-2005 Sun Microsystems, Inc.  All rights reserved. * Use is subject to license terms. */package components.components;import org.apache.commons.logging.Log;import org.apache.commons.logging.LogFactory;import javax.faces.component.StateHolder;import javax.faces.component.UIComponent;import javax.faces.component.UIComponentBase;import javax.faces.context.FacesContext;import javax.faces.event.FacesEvent;import javax.faces.event.FacesListener;import java.util.Iterator;/** * <p>Component designed to contain child components (and possibly other * layout in a JSP environment) for things like a tabbed pane control. */public class PaneComponent extends UIComponentBase {    private static Log log = LogFactory.getLog(PaneComponent.class);    // creates and adds a listener;    public PaneComponent() {        PaneSelectedListener listener = new PaneSelectedListener();        addFacesListener(listener);    }    /**     * <p>Return the component family for this component.     */    public String getFamily() {        return ("Pane");    }    // Does this component render its own children?    public boolean getRendersChildren() {        return (true);    }    public void processDecodes(FacesContext context) {        // Process all facets and children of this component        Iterator kids = getFacetsAndChildren();        while (kids.hasNext()) {            UIComponent kid = (UIComponent) kids.next();            kid.processDecodes(context);        }        // Process this component itself        try {            decode(context);        } catch (RuntimeException e) {            context.renderResponse();            throw e;        }    }    // Ignore update model requests    public void updateModel(FacesContext context) {    }    /**     * <p>Faces Listener implementation which sets the selected tab     * component     */    public class PaneSelectedListener implements FacesListener, StateHolder {        public PaneSelectedListener() {        }        // process the event..        public void processPaneSelectedEvent(FacesEvent event) {            UIComponent source = event.getComponent();            PaneSelectedEvent pevent = (PaneSelectedEvent) event;            String id = pevent.getId();            boolean paneSelected = false;            // Find the parent tab control so we can set all tabs            // to "unselected";            UIComponent tabControl = findParentForRendererType(source,                                                               "Tabbed");            int n = tabControl.getChildCount();            for (int i = 0; i < n; i++) {                PaneComponent pane = (PaneComponent) tabControl.getChildren()                    .get(i);                if (pane.getId().equals(id)) {                    pane.setRendered(true);                    paneSelected = true;                } else {                    pane.setRendered(false);                }            }            if (!paneSelected) {                log.warn("Cannot select pane for id=" + id + "," +                         ", selecting first pane");                ((PaneComponent) tabControl.getChildren().get(0)).setRendered(                    true);            }        }        // methods from StateHolder        public Object saveState(FacesContext context) {            return null;        }        public void restoreState(FacesContext context, Object state) {        }        public void setTransient(boolean newTransientValue) {        }        public boolean isTransient() {            return true;        }    }    private UIComponent findParentForRendererType(UIComponent component, String rendererType) {        Object facetParent = null;        UIComponent currentComponent = component;                // Search for an ancestor that is the specified renderer type;        // search includes the facets.        while (null != (currentComponent = currentComponent.getParent())) {            if (currentComponent.getRendererType().equals(rendererType)) {                break;            }        }        return currentComponent;    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -