maptag.java

来自「一个java写的加密算法」· Java 代码 · 共 143 行

JAVA
143
字号
/* * Copyright 2004-2005 Sun Microsystems, Inc.  All rights reserved. * Use is subject to license terms. */package components.taglib;import components.components.MapComponent;import components.renderkit.Util;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.UIComponentTag;/** * <p>{@link UIComponentTag} for an image map.</p> */public class MapTag extends UIComponentTag {    private String current = null;    public void setCurrent(String current) {        this.current = current;    }    private String actionListener = null;    public void setActionListener(String actionListener) {        this.actionListener = actionListener;    }    private String action = null;    public void setAction(String action) {        this.action = action;    }    private String immediate = null;    public void setImmediate(String immediate) {        this.immediate = immediate;    }    private String styleClass = null;    public void setStyleClass(String styleClass) {        this.styleClass = styleClass;    }    public String getComponentType() {        return ("DemoMap");    }    public String getRendererType() {        return ("DemoMap");    }    public void release() {        super.release();        current = null;        styleClass = null;        actionListener = null;        action = null;        immediate = null;        styleClass = null;    }    protected void setProperties(UIComponent component) {        super.setProperties(component);        MapComponent map = (MapComponent) component;        //        if (current != null) {        //            map.setCurrent(current);        //        }        if (styleClass != null) {            if (isValueReference(styleClass)) {                ValueBinding vb = FacesContext.getCurrentInstance()                    .getApplication().                    createValueBinding(styleClass);                map.setValueBinding("styleClass", vb);            } else {                map.getAttributes().put("styleClass", styleClass);            }        }        if (actionListener != null) {            if (isValueReference(actionListener)) {                Class args[] = {ActionEvent.class};                MethodBinding mb = FacesContext.getCurrentInstance()                    .getApplication()                    .createMethodBinding(actionListener, args);                map.setActionListener(mb);            } else {                Object params [] = {actionListener};                throw new javax.faces.FacesException();            }        }        if (action != null) {            if (isValueReference(action)) {                MethodBinding vb = FacesContext.getCurrentInstance()                    .getApplication()                    .createMethodBinding(action, null);                map.setAction(vb);            } else {                map.setAction(Util.createConstantMethodBinding(action));            }        }        if (immediate != null) {            if (isValueReference(immediate)) {                ValueBinding vb = FacesContext.getCurrentInstance()                    .getApplication().                    createValueBinding(immediate);                map.setValueBinding("immediate", vb);            } else {                boolean _immediate = new Boolean(immediate).booleanValue();                map.setImmediate(_immediate);            }        }    }}

⌨️ 快捷键说明

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