📄 tabpane.java
字号:
/**
* @(#) TabPane.java 2006-8-18
*
* @author Roger Wang / Forever
*
* Copyright @ 2006 by primeton.com All rights reserved.
*/
package com.digitalchina.power.taglib;
import java.io.IOException;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.JspWriter;
import javax.servlet.jsp.tagext.BodyTagSupport;
import javax.servlet.jsp.tagext.Tag;
/**
* TabPane标签
*/
public class TabPane extends BodyTagSupport
{
private String tabPaneId;
private String width;
private String height;
private String align;
private String scrolling;
private String frameNames;
private String onload;
public TabPane()
{
tabPaneId = "tabPane1";
width = "100%";
height = "100%";
align = "center";
frameNames = null;
onload = null;
scrolling = "auto";
}
public int doStartTag() throws JspException
{
StringBuffer buf = new StringBuffer();
buf.append( "<!-- TabPane 开始 -->\n" );
buf.append( "<table width=\"" );
buf.append( width );
buf.append( "\" height=\"1\" border=\"0\" align=\"" );
buf.append( align );
buf.append( "\" cellpadding=\"0\" cellspacing=\"0\">\n" );
buf.append( "<tr>\n" );
buf.append( "<td height=\"24\" nowrap>\n" );
buf.append( "<table frameNames=\"" );
buf.append( checkString( frameNames ) );
buf.append( "\" height=\"24\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" style=\"border-collapse:collapse;table-layout:fixed;\">\n" );
buf.append( "<tr>\n" );
buf.append( "<td width=\"6\" align=\"center\" valign=\"bottom\" class=\"nav_ld\" id=\"_tabpane_bou_"+ tabPaneId +"\"></td>\n" );
try
{
JspWriter jspwriter = pageContext.getOut();
jspwriter.print( buf.toString() );
}
catch( IOException e )
{
e.printStackTrace();
throw new JspException( e.toString() );
}
return Tag.EVAL_BODY_INCLUDE;
}
public int doEndTag() throws JspException
{
StringBuffer buf = new StringBuffer();
buf.append( "</tr>\n" );
buf.append( "</table>\n" );
buf.append( "</td>\n" );
if( notBlankOrNull( frameNames ) )
{
buf.append( "<td class=\"right_top_td\" width=\"100%\" height=\"24\"> </td>\n" );
}
buf.append( "</tr>\n" );
if( notBlankOrNull( frameNames ) )
{
String[] frameNameArr = frameNames.split( ";" );
buf.append( "<!-- 在下面设置iframe的宽度和高度 -->\n" );
buf.append( "<tr>\n" );
buf.append( "<td colspan=\"2\" class=\"content_td\" height=\"1\">\n" );
for( int i = 0 ; i < frameNameArr.length ; i ++ )
{
buf.append( "<iframe id=\"" ).append( frameNameArr[i] ).append( "\" name=\"" );
buf.append( frameNameArr[i] );
buf.append( "\" width=\"" );
buf.append( width );
buf.append( "\" height=\"" );
buf.append( height );
buf.append( "\" " );
if( onload != null && onload.trim().length() > 0 )
{
buf.append( "onload=\"" );
buf.append( onload );
buf.append( "\" " );
}
buf.append( "frameborder=\"0\" style=\"display:none;\" scrolling=\""+scrolling+"\" src=\"\"></iframe>" );
}
buf.append( "</td>\n" );
buf.append( "</tr>\n" );
}
buf.append( "</table>\n" );
buf.append( "<!-- TabPane 结束 -->\n" );
try
{
JspWriter jspwriter = pageContext.getOut();
jspwriter.print( buf.toString() );
}
catch( IOException e )
{
e.printStackTrace();
throw new JspException( e.toString() );
}
release();
return super.doEndTag();
}
public void release()
{
tabPaneId = "tabPane1";
width = "100%";
height = "100%";
align = "center";
frameNames = null;
onload = null;
scrolling = "auto";
super.release();
}
public static boolean isBlankOrNull( String str )
{
if( str == null || str.trim().length() == 0 )
{
return true;
}
return false;
}
public static boolean notBlankOrNull( String str )
{
if( str == null || str.trim().length() == 0 )
{
return false;
}
return true;
}
/**
* @return 返回 align。
*/
public String getAlign()
{
return align;
}
/**
* @param align 要设置的 align。
*/
public void setAlign( String align )
{
this.align = align;
}
/**
* @return 返回 height。
*/
public String getHeight()
{
return height;
}
/**
* @param height 要设置的 height。
*/
public void setHeight( String height )
{
this.height = height;
}
/**
* @return 返回 width。
*/
public String getWidth()
{
return width;
}
/**
* @param width 要设置的 width。
*/
public void setWidth( String width )
{
this.width = width;
}
/**
* @return 返回 frameName。
*/
public String getFrameNames()
{
return frameNames;
}
/**
* @param frameName 要设置的 frameName。
*/
public void setFrameNames( String frameNames )
{
this.frameNames = frameNames;
}
/**
* @return 返回 tabPaneId。
*/
public String getTabPaneId()
{
return tabPaneId;
}
/**
* @param tabPaneId 要设置的 tabPaneId。
*/
public void setTabPaneId( String tabPaneId )
{
this.tabPaneId = tabPaneId;
}
/**
* @return 返回 onload。
*/
public String getOnload()
{
return onload;
}
/**
* @param onload 要设置的 onload。
*/
public void setOnload( String onload )
{
this.onload = onload;
}
/**
* @return 返回 scrolling。
*/
public String getScrolling()
{
return scrolling;
}
/**
* @param scrolling 要设置的 scrolling。
*/
public void setScrolling( String scrolling )
{
this.scrolling = scrolling;
}
private String checkString( String s )
{
if( s == null )
return "";
return s;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -