📄 infolinktag.java
字号:
/******************************************************************************
* The contents of this file are subject to the Compiere License Version 1.1
* ("License"); You may not use this file except in compliance with the License
* You may obtain a copy of the License at http://www.compiere.org/license.html
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
* the specific language governing rights and limitations under the License.
* The Original Code is Compiere ERP & CRM Smart Business Solution
* The Initial Developer of the Original Code is Jorg Janke and ComPiere, Inc.
* Portions created by Jorg Janke are Copyright (C) 1999-2003 Jorg Janke, parts
* created by ComPiere are Copyright (C) ComPiere, Inc.; All Rights Reserved.
* Contributor(s): ______________________________________.
*****************************************************************************/
package org.compiere.wstore;
import java.util.*;
import java.sql.*;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
import javax.servlet.jsp.tagext.*;
import org.apache.ecs.*;
import org.apache.ecs.xhtml.*;
import org.apache.log4j.Logger;
import org.compiere.www.*;
/**
* Info Links.
* Creates Invoice/Payment/Asset/AddressInfo/PaymentInfo Link
* <pre>
* <cws:infoLink/>
* </pre>
*
* @author Jorg Janke
* @version $Id: InfoLinkTag.java,v 1.6 2003/05/04 06:47:27 jjanke Exp $
*/
public class InfoLinkTag extends TagSupport
{
/** Logger */
private Logger log = Logger.getLogger (getClass());
/** One Line */
private boolean m_oneLine = false;
/**
* Set to one line
* @param var Y or something else
*/
public void setOneLine (String var)
{
m_oneLine = "Y".equals(var);
} // setOneLine
/**
* Start Tag
* @return SKIP_BODY
* @throws JspException
*/
public int doStartTag() throws JspException
{
HttpSession session = pageContext.getSession();
Properties ctx = (Properties)session.getAttribute(JSPEnv.CONTEXT_NAME);
if (ctx == null)
{
HttpServletRequest request = (HttpServletRequest)pageContext.getRequest();
ctx = JSPEnv.getCtx(request);
}
WebUser wu = (WebUser)session.getAttribute(WebUser.NAME);
if (wu != null && wu.isLoggedIn())
{
if (ctx != null)
{
Info info = (Info)session.getAttribute(Info.NAME);
if (info == null)
session.setAttribute (Info.NAME, new Info (ctx, wu.getC_BPartner_ID ()));
}
//
log.debug("doStartTag - WebUser exists");
//
JspWriter out = pageContext.getOut();
HtmlCode html = new HtmlCode();
//
if (!m_oneLine)
html.addElement(new hr("90%", "left"));
//
a a = new a("assets.jsp");
a.setClass("menuMain");
a.addElement("Assets");
html.addElement(a);
//
if (m_oneLine)
html.addElement(" - ");
else
html.addElement(new br());
//
a = new a("invoices.jsp");
a.setClass("menuMain");
a.addElement("Invoices");
html.addElement(a);
//
if (m_oneLine)
html.addElement(" - ");
else
html.addElement(new br());
//
a = new a("payments.jsp");
a.setClass("menuMain");
a.addElement("Payments");
html.addElement(a);
//
if (m_oneLine)
html.addElement(" - ");
else
html.addElement(new br());
//
a = new a("orders.jsp");
a.setClass("menuMain");
a.addElement("Orders");
html.addElement(a);
//
if (m_oneLine)
html.addElement(" - ");
else
html.addElement(new br());
//
a = new a("shipments.jsp");
a.setClass("menuMain");
a.addElement("Shipments");
html.addElement(a);
//
html.output(out);
}
else
log.debug("doStartTag - no WebUser");
return (SKIP_BODY);
} // doStartTag
/**
* End Tag
* @return EVAL_PAGE
* @throws JspException
*/
public int doEndTag() throws JspException
{
return EVAL_PAGE;
} // doEndTag
} // InfoLinkTag
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -