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

📄 nextwindowbuttontag.java

📁 java 写的一个新闻发布系统
💻 JAVA
字号:
package org.jahia.taglibs.button;import org.jahia.data.JahiaData;import org.jahia.data.containers.JahiaContainerList;import org.jahia.exceptions.JahiaException;import org.jahia.services.usermanager.JahiaUser;import org.jahia.taglibs.container.ContainerListTag;import org.jahia.taglibs.util.Utils;import org.jahia.utils.JahiaConsole;import java.io.*;import java.util.*;import javax.servlet.*;import javax.servlet.http.*;import javax.servlet.jsp.*;import javax.servlet.jsp.tagext.*;/** * <p>Title: This tag generates a next window button for scrollable container lists</p> * <p>Description: </p> * <p>Copyright: Copyright (c) 2002</p> * <p>Company: Jahia Ltd</p> * @author Serge Huber * @version 1.0 */// 05.05.2002 NK : Added Post method supportpublic class NextWindowButtonTag extends AbstractButtonTag {    private JahiaContainerList containerList = null;    private String title = "Next&gt;&gt;";    private String style = "";    private String method = "get";    private String formName = "";    private int windowStepInt = 1;    private int windowSizeInt = -1;    // these are necessary since we must be JavaBean compliant.    private String windowStep;    private String windowSize;    public void setTitle(String title) {        this.title = title;    }    public void setStyle(String style) {        this.style = style;    }    public void setMethod(String method) {        if ( method != null )        {            this.method = method;        }    }    public void setFormName(String formName) {        if ( formName != null )        {            this.formName = formName.trim();        }    }    public void setWindowStep(String windowStep) {        this.windowStep = windowStep;        try {            windowStepInt = Integer.parseInt(windowStep);            if (windowStepInt < 0)              windowStepInt = 0;        } catch (NumberFormatException nfe) {            windowStepInt = 0;        }    }    public void setWindowSize(String windowSize) {        this.windowSize = windowSize;        try {            windowSizeInt = Integer.parseInt(windowSize);            if (windowSizeInt < 1)              windowSizeInt = -1;        } catch (NumberFormatException nfe) {            windowSizeInt = -1;        }    }    public String getTitle() {        return this.title;    }    public String getStyle() {        return this.style;    }    public String getMethod() {        return this.method;    }    public String getFormName() {        return this.formName;    }    public int getWindowStepInt() {        return this.windowStepInt;    }    public int getWindowSizeInt() {        return this.windowSizeInt;    }    public String getWindowStep() {        return this.windowStep;    }    public String getWindowSize() {        return this.windowSize;    }    public boolean testRights (JahiaData jData) {        JahiaUser user = jData.params().getUser();        // retrieves the current container list        ContainerListTag parent = (ContainerListTag) findAncestorWithClass(this,ContainerListTag.class);        if (parent != null) {            if (parent.isDeclarationPass()) {                return false;            }            containerList = parent.getContainerList();        }        if (containerList != null) {            Enumeration containers = containerList.getContainers();            return ( containers.hasMoreElements() );        }        return false;    }    public String getLauncher(JahiaData jData) throws JahiaException {        String value = jData.gui().drawContainerListNextWindowPageURL( containerList, windowStepInt, windowSizeInt, this.method.equals("post") );        if ( value != null && this.method.equals("post") )        {            StringBuffer buff = new StringBuffer("javascript:changePage(document.");            buff.append(getFormName());            buff.append(",document.");            buff.append(getFormName());            buff.append(".ctnscroll_");            buff.append(containerList.getDefinition().getName());            buff.append(",'");            buff.append(value);            buff.append("');");            value = buff.toString();        }        return value;    }    public int doEndTag() throws JspException {        // let's reinitialize the tag variables to allow tag object reuse in        // pooling.        containerList = null;        title = "Next&gt;&gt;";        style = "";        method = "get";        formName = "";        windowStepInt = 1;        windowSizeInt = -1;        windowStep = null;        windowSize = null;        return EVAL_PAGE;    }}

⌨️ 快捷键说明

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