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

📄 wordfield.java

📁 OBPM是一个开源
💻 JAVA
字号:
// Source file:
// C:\\Java\\workspace\\SmartWeb3\\src\\com\\cyberway\\dynaform\\form\\ejb\\InputField.java

package cn.myapps.core.dynaform.form.ejb;

import cn.myapps.base.action.ParamsTable;
import cn.myapps.core.dynaform.PermissionType;
import cn.myapps.core.dynaform.document.ejb.Document;
import cn.myapps.core.dynaform.document.ejb.Item;
import cn.myapps.core.macro.runner.JavaScriptRunner;
import cn.myapps.core.user.action.WebUser;
import cn.myapps.util.sequence.Sequence;

public class WordField extends FormField {
	/**
	 * @roseuid 41ECB66E012A
	 */
	public WordField() {

	}

	/**
	 * @return boolean
	 * @roseuid 41ECB66E013E
	 */
	public ValidateMessage validate(JavaScriptRunner runner, Document doc)
			throws Exception {
		return null;
	}

	/**
	 * @roseuid 41ECB66E0152
	 */
	public void store() {

	}

	public String toHtmlTxt(ParamsTable params, WebUser user,
			JavaScriptRunner runner, Document doc) throws Exception {
		StringBuffer html = new StringBuffer();
		Item item = null;
		int displayType = getDisplayType(runner, doc);
		if (displayType == PermissionType.HIDDEN) {
			return "(hidden)";
		} else {
			if (doc != null) {
				item = doc.findItem(this.getName());

				if (displayType == PermissionType.MODIFY) {
					boolean isnew = false;
					if (item == null) {
						item = new Item();
						try {
							item.setId(Sequence.getSequence());
						} catch (Exception e) {
						}
						isnew = true;
					}

					html.append("<script language='JavaScript'>");
					html.append("var beforesave" + item.getId()
							+ "=new Function(");
					html.append("\"var iframe" + item.getId()
							+ "=document.all.wordEditor" + item.getId() + ";");
					html.append("iframe" + item.getId()
							+ ".Document.all.btnsave.onclick();");
					html.append("\");");
					html.append("addfunction(beforesave_functions, beforesave"
							+ item.getId() + ");");
					html.append("</script>");
					String src = "";
					if (doc.is_new() || isnew) {
						src = "/dynaform/document/newitem.do?id="
								+ item.getId() + "&docid=" + doc.getId()
								+ "&ISNEW=true&ISEDIT=TRUE&name="
								+ item.getName() + "&_type=word";
					} else {
						src = "/dynaform/document/edititem.do?id="
								+ item.getId() + "&docid=" + doc.getId()
								+ "&ISNEW=false&ISEDIT=TRUE&name="
								+ item.getName() + "&_type=word";
					}

					if (item != null) {
						html
								.append("<IFRAME ID='wordEditor"
										+ item.getId()
										+ "' src='"
										+ src
										+ "' frameborder='0' scrolling='no' width='100%' height='100%'></IFRAME>");
					}
				} else {
					if (item != null) {
						String src = "/dynaform/document/edititem.do?id="
								+ item.getId() + "&docid=" + doc.getId()
								+ "&ISNEW=false&ISEDIT=FALSE&name="
								+ item.getName() + "&_type=word";
						html
								.append("<IFRAME ID='wordEditor"
										+ item.getId()
										+ "' src='"
										+ src
										+ "' frameborder='0' scrolling='no' width='100%' height='100%'></IFRAME>");
					}
				}
			}
		}
		return html.toString();
	}

	public String toTemplate() {
		StringBuffer template = new StringBuffer();
		template.append("<input type='text'");
		template.append(" className='" + this.getClass().getName() + "'");
		template.append(" id='" + getId() + "'");
		template.append(" name='" + getName() + "'");
		template.append(" formid='" + getFormid() + "'");
		template.append(" discript='" + getDiscript() + "'");
		template.append(" hiddenScript='" + getHiddenScript() + "'");
		template.append(" hiddenPrintScript='" + getHiddenPrintScript() + "'");
		template.append(">");
		return template.toString();
	}

	/**
	 * 重新计算
	 * 
	 * @roseuid 41DB89D700F9
	 */
	public void recalculate(JavaScriptRunner runner, Document doc)
			throws Exception {
	}

	/*
	 * 运行计算Field值Script,返回值即为计算结果。
	 * 
	 * @return java.lang.String @roseuid 41DB8C1E03E7
	 */
	public Object runValueScript(JavaScriptRunner runner, Document doc)
			throws Exception {
		return null;
	}

	public String toPrintHtmlTxt(ParamsTable params, WebUser user,
			JavaScriptRunner runner, Document doc) throws Exception {
		// TODO Auto-generated method stub
		return null;
	}

}
/*
 * FormField InputField.init(java.lang.String){ return null; }
 */

⌨️ 快捷键说明

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