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

📄 wdoc.java

📁 Java写的ERP系统
💻 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  Business Solution
 * The Initial Developer of the Original Code is Jorg Janke  and ComPiere, Inc.
 * Portions created by Jorg Janke are Copyright (C) 1999-2001 Jorg Janke, parts
 * created by ComPiere are Copyright (C) ComPiere, Inc.;   All Rights Reserved.
 * Contributor(s): ______________________________________.
 *****************************************************************************/
package org.compiere.www;

import java.io.*;
import org.apache.ecs.xhtml.*;

/**
 *  XHTML Document
 *
 *  @author Jorg Janke
 *  @version  $Id: WDoc.java,v 1.1.1.1 2002/10/12 01:06:54 jjanke Exp $
 */
public class WDoc
{
	/**
	 *  Create Document
	 *  @param plain if true adds stylesheet and standard js
	 *  @return Document
	 */
	public static WDoc create (boolean plain)
	{
		WDoc doc = new WDoc();
		doc.setUp (plain);
		return doc;
	}   //  create

	/**
	 *  Create Document with Title
	 *  @param title title
	 *  @return Document
	 */
	public static WDoc create (String title)
	{
		WDoc doc = WDoc.create(false);
		doc.setTitle (title);
		return doc;
	}   //  create

	/*************************************************************************/

	/**
	 *  Create new XHTML Document structure
	 */
	private WDoc ()
	{
	}   //  WDoc

	private html    m_html = new html();
	private head    m_head = new head();
	private body    m_body = new body();

	/**
	 *  Set up Document
	 *  @param plain if true adds stylesheet and standard js
	 */
	protected void setUp (boolean plain)
	{
		m_html.addElement(m_head);
		m_html.addElement(m_body);
		if (!plain)
		{
			m_head.addElement(new link().setRel("stylesheet").setHref(WEnv.getStylesheetURL()));
			script std = new script("", WEnv.getBaseDirectory("standard.js"));
			m_head.addElement(std);
			m_body.addElement(WEnv.getLogo());
		}
	}   //  setUp

	/**
	 *  Create new XHTML Document with Title & Logo
	 *  @param title title
	 */
	protected void setTitle (String title)
	{
		if (title == null)
			return;

		m_head.addElement(new title(title));
		m_body.addElement(new h1(title));
	}   //  setTitle

	/**
	 *  Get Body
	 *  @return Body
	 */
	public body getBody()
	{
		return m_body;
	}   //  getBody

	/**
	 *  Get Head
	 *  @return Header
	 */
	public head getHead()
	{
		return m_head;
	}   //  getHead

	/**
	 *  String representation
	 *  @return String
	 */
	public String toString()
	{
		return m_html.toString();
	}   //  toString

	/**
	 *  Output Document
	 *  @param out out
	 */
	public void output (OutputStream out)
	{
		m_html.output(out);
	}   //  output

	/**
	 *  Output Document
	 *  @param out out
	 */
	public void output (PrintWriter out)
	{
		m_html.output(out);
	}   //  output

	/*************************************************************************/

	/**
	 *  Test Class
	 *  @param args args
	 */
	public static void main (String[] args)
	{
		WDoc doc = WDoc.create("Test");
		System.out.println(doc.toString());
		System.out.println("---------");
		doc.output(System.out);

	}   //  main
}   //  WDoc

⌨️ 快捷键说明

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