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