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

📄 graphmenutreetag.java

📁 一个java写的加密算法
💻 JAVA
字号:
/* * $Id: GraphMenuTreeTag.java,v 1.3 2004/11/14 07:33:16 tcfujii Exp $ *//* * Copyright 2004-2005 Sun Microsystems, Inc.  All rights reserved. * Use is subject to license terms. */package components.taglib;import components.components.GraphComponent;import components.model.Graph;import javax.faces.component.UIComponent;import javax.faces.context.FacesContext;import javax.faces.el.MethodBinding;import javax.faces.el.ValueBinding;import javax.faces.event.ActionEvent;import javax.faces.webapp.UIComponentBodyTag;/** * This class creates a <code>Graph</code> instance if there is no modelReference * attribute specified on the component, represented by this tag and * stores it against the attribute name "graph_tree" in session scope. */public class GraphMenuTreeTag extends UIComponentBodyTag {    protected String actionListener = null;    protected String styleClass = null;    protected String selectedClass = null;    protected String unselectedClass = null;    protected String value = null;    protected String immediate = null;    /**     * method reference to handle menu expansion and contraction events     */    public void setActionListener(String actionListener) {        this.actionListener = actionListener;    }    /**     * Value Binding reference expression that points to a Graph in scoped     * namespace.     */    public void setValue(String newValue) {        value = newValue;    }    /**     * The CSS style <code>class</code> to be applied to the text     * of selected nodes. This can be value or a value binding reference     * expression.     */    public void setSelectedClass(String styleSelected) {        this.selectedClass = styleSelected;    }    /**     * The CSS style <code>class</code> to be applied to the text     * of unselected nodes. This can be value or a value binding reference     * expression.     */    public void setUnselectedClass(String styleUnselected) {        this.unselectedClass = styleUnselected;    }    /**     * The CSS style <code>class</code> to be applied to the entire menu.     * This can be value or a value binding reference     * expression.     */    public void setStyleClass(String style) {        this.styleClass = style;    }    /**     * A flag indicating that the default ActionListener should execute     * immediately (that is, during the Apply Request Values phase of the     * request processing lifecycle, instead of waiting for Invoke     * Application phase). The default value of this property must be false.     * This can be value or a value binding reference expression.     */    public void setImmediate(java.lang.String immediate) {        this.immediate = immediate;    }    public String getComponentType() {        return ("Graph");    }    public String getRendererType() {        return ("MenuTree");    }    protected void setProperties(UIComponent component) {        super.setProperties(component);        FacesContext context = FacesContext.getCurrentInstance();        ValueBinding vb = null;        GraphComponent graphComponent = (GraphComponent) component;        if (actionListener != null) {            if (isValueReference(actionListener)) {                Class args[] = {ActionEvent.class};                MethodBinding mb = FacesContext.getCurrentInstance()                    .getApplication()                    .createMethodBinding(actionListener, args);                graphComponent.setActionListener(mb);            } else {                Object params [] = {actionListener};                throw new javax.faces.FacesException();            }        }        // if the attributes are values set them directly on the component, if        // not set the ValueBinding reference so that the expressions can be        // evaluated lazily.        if (styleClass != null) {            if (isValueReference(styleClass)) {                vb = context.getApplication().createValueBinding(styleClass);                graphComponent.setValueBinding("styleClass", vb);            } else {                graphComponent.getAttributes().put("styleClass", styleClass);            }        }        if (selectedClass != null) {            if (isValueReference(selectedClass)) {                vb =                    context.getApplication().createValueBinding(selectedClass);                graphComponent.setValueBinding("selectedClass", vb);            } else {                graphComponent.getAttributes().put("selectedClass",                                                   selectedClass);            }        }        if (unselectedClass != null) {            if (isValueReference(unselectedClass)) {                vb =                    context.getApplication().createValueBinding(                        unselectedClass);                graphComponent.setValueBinding("unselectedClass", vb);            } else {                graphComponent.getAttributes().put("unselectedClass",                                                   unselectedClass);            }        }        if (immediate != null) {            if (isValueReference(immediate)) {                vb = context.getApplication().createValueBinding(immediate);                graphComponent.setValueBinding("immediate", vb);            } else {                boolean _immediate = new Boolean(immediate).booleanValue();                graphComponent.setImmediate(_immediate);            }        }        if (value != null) {            // if the value is not value reference expression, we need            // to build the graph using the node tags.            if (isValueReference(value)) {                vb = context.getApplication().createValueBinding(value);                component.setValueBinding("value", vb);            }        }                // if there is no valueRef attribute set on this tag, then        // we need to build the graph.        if (value == null) {            vb =                context.getApplication().createValueBinding(                    "#{sessionScope.graph_tree}");            component.setValueBinding("value", vb);                        // In the postback case, graph exists already. So make sure            // it doesn't created again.            Graph graph = (Graph) ((GraphComponent) component).getValue();            if (graph == null) {                graph = new Graph();                vb.setValue(context, graph);            }        }    }}

⌨️ 快捷键说明

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