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

📄 window.java

📁 开源项目simpleoa-0.3.zip是最新版本
💻 JAVA
字号:
package com.ejsun.entapps.presentation.components.window;

import java.util.HashMap;
import java.util.Map;

import org.apache.tapestry.ApplicationRuntimeException;
import org.apache.tapestry.BaseComponent;
import org.apache.tapestry.IEngine;
import org.apache.tapestry.IMarkupWriter;
import org.apache.tapestry.IRequestCycle;
import org.apache.tapestry.IResourceLocation;
import org.apache.tapestry.IScript;
import org.apache.tapestry.engine.IScriptSource;
import org.apache.tapestry.html.Body;

/**
 * @author	Quake Wang
 * @since	2004-4-8
 * @version $Revision: 1.1 $
 * 
 **/
public abstract class Window extends BaseComponent {
	private Map _symbols;
	private IScript _script;

	protected void renderComponent(IMarkupWriter writer, IRequestCycle cycle) {
		// Don't do any additional work if rewinding
		// (some other action or form on the page).
		if (!cycle.isRewinding()) {
			_symbols = new HashMap(1);
			runScript(cycle);
		}
		super.renderComponent(writer, cycle);
	}

	private void runScript(IRequestCycle cycle) {
		// Get the script, if not already gotten.  Scripts are re-entrant, so it is
		// safe to share this between instances of Window.
		if (_script == null) {
			IEngine engine = getPage().getEngine();
			IScriptSource source = engine.getScriptSource();

			IResourceLocation scriptLocation =
				getSpecification()
					.getSpecificationLocation()
					.getRelativeLocation(
					"Window.script");

			_script = source.getScript(scriptLocation);
		}

		Body body = Body.get(cycle);
		if (body == null)
			throw new ApplicationRuntimeException(
				"Window component must be wrapped by a Body.",
				this,
				null,
				null);

		_symbols.put("id", this.getId());

		_script.execute(cycle, body, _symbols);
	}

	protected void cleanupAfterRender(IRequestCycle cycle) {
		_symbols = null;
		super.cleanupAfterRender(cycle);
	}

	public Map getSymbols() {
		return _symbols;
	}

}

⌨️ 快捷键说明

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