Chinaunix首页 | 论坛 | 博客
  • 博客访问: 189397
  • 博文数量: 92
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 1413
  • 用 户 组: 普通用户
  • 注册时间: 2013-02-04 21:12
文章分类
文章存档

2013年(92)

我的朋友

分类: 信息化

2013-03-03 02:31:02

[代码] [Java]代码 package com.webbuilder.controls;

import java.util.Iterator;

import com.webbuilder.utils.StringUtil;
import com.webbuilder.utils.WebUtil;

public class ExtControl extends FrontCo ; ntrol {
	private StringBuilder propertiesBuffer = new StringBuilder();
	private StringBuilder eventsBuffer = new StringBuilder();
	private StringBuilder stylesBuffer = new StringBuilder();
	private StringBuilder objectsBuffer = new StringBuilder();
	protected boolean listenersPrefix = true;
	protected boolean setRender = true;

	public void create() throws Exception {
		createScript();
	}

	protected void createScript() throws Exception {
		if (hasParent) {
			String xtype = getMeta("xwlXtype");

			if (StringUtil.isEmpty(xtype))
				xtype = "";
			else
				xtype = StringUtil.concat("xtype:\"", xtype, "\"");
			headerScript(StringUtil.concat(getComma(), "{", getJson(xtype)));
			footerScript("}");
			if (hasChild) {
				headerScriptNL(",items:[");
				footerScript("]");
			}
		} else {
			String id = gs("id");
			headerScript(StringUtil.concat("Wd.", id, "=new ",
					getMeta("xwlType"), "({"));
			footerScript("});");
			if (setRender)
				headerScript(getJson("renderTo:Ext.getBody()"));
			else
				headerScript(getJson(null));
			if (hasChild) {
				headerScriptNL(",items:[");
				footerScript("]");
			}
		}
	}

	protected String getJson(String moreProperties) throws Exception {
		StringBuilder buf = new StringBuilder(), event = new StringBuilder();
		Iterator names = xwlObject.keys();
		String n, val;
		boolean addComma = false;
		String meta, tagProperties = null, tagEvents = null, metaType;
		String reserved[] = getReservedKeys(), tp, te;
		String expTypes[] = { "boolean", "bind", "express", "object", "date" };

		while (names.hasNext()) {
			n = (String) names.next();
			if (n.equals("xwlMeta") || n.equals("children") || reserved != null
					
阅读(287) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~