123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833 |
- /**
- * XFormsElementBase
- *
- * @param strParentId
- * @param strId
- * @param strTag
- * @return
- */
- function XFormsElementBase (strParentId, strId, strTag)
- {
- if (!strId)
- {
- return;
- }
-
- // Property
- this.children = new Collection(); // child collection
- this.elementName = strTag;
- this.parent;
- this.id = strId;
- this.tag = strTag;
- this.text;
-
- this.m_strLocalTag = strTag;
-
- var nIndex = this.m_strLocalTag.indexOf(":");
- if (-1 != nIndex)
- {
- this.m_strLocalTag = this.m_strLocalTag.substr(nIndex + 1);
- }
- this.m_objElement = null;
-
- this.setParent(strParentId);
-
- XFormsDocument.appendAll(strId, this);
- };
- XFormsElementBase.prototype.getElement = function ()
- {
- if (this.m_objElement)
- {
- this.m_objElement.setRefElement(this);
- }
-
- return this.m_objElement;
- };
- XFormsElementBase.prototype.setElement = function (objElement)
- {
- this.m_objElement = objElement;
- };
- XFormsElementBase.prototype.getAttribute = function (strName)
- {
- return null;
- };
- XFormsElementBase.prototype.setAttribute = function (strName, strValue)
- {
- return;
- };
- XFormsElementBase.prototype.getId = function ()
- {
- return this.getAttribute("id");
- };
- XFormsElementBase.prototype.getTag = function ()
- {
- return this.tag;
- };
- XFormsElementBase.prototype.getLocalTag = function ()
- {
- return this.m_strLocalTag;
- };
- XFormsElementBase.prototype.getParent = function ()
- {
- return this.parent;
- };
- XFormsElementBase.prototype.setParent = function (strParentId)
- {
- if (this instanceof XFormsElementBase)
- {
- // 부모 setting
- var objParent = document.allElement.item(strParentId);
- this.parent = objParent;
-
- // 부모에 자식 세팅
- if (objParent instanceof XFormsElementBase)
- {
- if (this instanceof XFormsModel)
- {
- if (objParent.children.exists(this.id))
- {
- return;
- }
- }
- objParent.setChild(this.id, this);
- }
- }
- };
- XFormsElementBase.prototype.setChild = function (strChildId, objChild)
- {
- this.children.add(strChildId, objChild);
- };
- XFormsElementBase.prototype.getElementName = function ()
- {
- return this.elementName;
- };
- XFormsElementBase.prototype.getText = function ()
- {
- return this.text;
- };
- XFormsElementBase.prototype.setText = function (strText)
- {
- // TODO isParsed 처리
- this.text = strText;
- this.attribute["text"] = strText;
- };
- XFormsElementBase.prototype.isChild = function (strId)
- {
- var objElement = document.allElement.item(strId);
-
- if (!objElement)
- {
- return false;
- }
-
- return (this == objElement.parent);
- };
- XFormsElementBase.prototype.isDescendants = function (strId, bIncludeThis)
- {
- var objElement = document.allElement.item(strId);
-
- if (!objElement)
- {
- return false;
- }
-
- var objParent;
- if (bIncludeThis)
- {
- objParent = objElement;
- }
- else
- {
- objParent = objElement.parent;
- }
-
- while (objParent)
- {
- if (this == objParent)
- {
- return true;
- }
- objParent = objParent.parent;
- }
- return false;
- };
- /**
- * XFormsAttribute
- * @return
- */
- XFormsAttribute.prototype = new XFormsElementBase;
- function XFormsAttribute (strParentId, strId, strTag)
- {
- if (!strId)
- {
- return;
- }
- XFormsElementBase.call(this, strParentId, strId, strTag);
-
- this.attribute = new Hashtable();
-
- // Attribute
- this.attribute["id"] = strId;
- this.attribute["tag"] = strTag;
-
- /**
- * 일반 스티일 외의 스타일
- */
- this.m_htHoverStyle = null; // hover style
- this.m_htDownStyle = null; // down style
- this.m_htFocusStyle = null; // focus style
- this.m_htDisableStyle = null; // disable style
- this.m_htSelectStyle = null; // select style
- };
- XFormsAttribute.prototype.initStyle = function (strAttribute)
- {
-
- };
- XFormsAttribute.prototype.getAttribute = function (strName)
- {
- return this.attribute[strName];
- };
- XFormsAttribute.prototype.setAttribute = function (strName, objValue)
- {
- if (STYLE_LIST[strName])
- {
- HtmlLib.setStyle(this.m_heControl, strName, objValue);
- }
-
- this.attribute[strName] = objValue;
- };
- XFormsAttribute.prototype.applyDefaultStyle = function ()
- {
- if (null != this.m_heControl)
- {
- if (this.attribute["right"])
- {
- HtmlLib.setStyle(this.m_heControl, "right", this.attribute["right"]);
- }
- if (this.attribute["bottom"])
- {
- HtmlLib.setStyle(this.m_heControl, "bottom", this.attribute["bottom"]);
- }
- if (!this.attribute["color"] && !this.m_heControl.style.color)
- {
- HtmlLib.setStyle(this.m_heControl, "color", "#000000");
- }
- if (!this.attribute["font-family"] && !this.m_heControl.style.fontFamily)
- {
- HtmlLib.setStyle(this.m_heControl, "font-family", Lan_DefaultFontFamily);
- }
-
- if (!this.attribute["font-size"] && !this.m_heControl.style.fontSize)
- {
- HtmlLib.setStyle(this.m_heControl, "font-size", "10pt");
- }
-
- if (this.attribute["word-wrap"])
- {
- var strWordWrap = "break-word";
- if ("none" == this.attribute["word-wrap"] || "hard" == this.attribute["word-wrap"])
- {
- strWordWrap = "normal";
- }
-
- HtmlLib.setStyle(this.m_heControl, "word-wrap", strWordWrap);
- }
-
- if (this.attribute["line-spacing"])
- {
- var strLineSpacing = this.attribute["line-spacing"];
- if (strLineSpacing)
- {
- var strLineHeight = (parseInt(strLineSpacing.replaceAll("px","")) + 18) + "px";
- HtmlLib.setStyle(this.m_heControl, "line-height", strLineHeight);
- }
- }
-
- if (this.attribute["background-image"])
- {
- if (!this.attribute["background-color"])
- {
- HtmlLib.setStyle(this.m_heControl, "background-color", "transparent");
- }
-
- var strBackgroundImage = this.attribute["background-image"];
- if (0 > strBackgroundImage.indexOf("url("))
- {
- HtmlLib.setStyle(this.m_heControl, "background-image", strBackgroundImage);
- }
- }
-
- if (!this.attribute["background-color"] && !this.m_heControl.style.backgroundColor)
- {
- //HtmlLib.setStyle(this.m_heControl, "background-color", "transparent");
- }
-
- if (!this.attribute["background-repeat"] && !this.m_heControl.style.backgroundRepeat)
- {
- HtmlLib.setStyle(this.m_heControl, "background-repeat", "no-repeat");
- }
-
- // background-position
- if (this.attribute["background-position"])
- {
- var strBackgroundPosition = this.attribute["background-position"];
- // background-position-x 설정
- var strBackgroundPositionX = "";
- if (-1 != strBackgroundPosition.indexOf("left"))
- {
- strBackgroundPositionX = "left";
- }
- else if (-1 != strBackgroundPosition.indexOf("right"))
- {
- strBackgroundPositionX = "right";
- }
-
- // background-position-y 설정
- var strBackgroundPositionY = "";
- if (-1 != strBackgroundPosition.indexOf("top"))
- {
- strBackgroundPositionY = "top";
- }
- else if (-1 != strBackgroundPosition.indexOf("bottom"))
- {
- strBackgroundPositionY = "bottom";
- }
-
- // 설정 값이 center일 때
- if ("centercenter" == strBackgroundPosition)
- {
- strBackgroundPositionX = "center";
- strBackgroundPositionY = "center";
- }
- if (-1 != strBackgroundPosition.indexOf("center"))
- {
- if ("" == strBackgroundPositionX) strBackgroundPositionX = "center";
- if ("" == strBackgroundPositionY) strBackgroundPositionY = "center";
- }
-
- HtmlLib.setStyle(this.m_heControl, "background-position-x", strBackgroundPositionX);
- HtmlLib.setStyle(this.m_heControl, "background-position-y", strBackgroundPositionY);
- }
- else
- {
- HtmlLib.setStyle(this.m_heControl, "background-position-x", "left");
- HtmlLib.setStyle(this.m_heControl, "background-position-y", "top");
- }
-
- // opacity
- if (this.attribute["opacity"])
- {
- var strOpacity = this.attribute["opacity"];
- HtmlLib.setStyle(this.m_heControl, "opacity", strOpacity);
- }
-
- // cursor
- if (this.attribute["cursor"])
- {
- var strCursor = this.attribute["cursor"];
- HtmlLib.setStyle(this.m_heControl, "cursor", strCursor);
- }
-
- // border-width
- if (this.attribute["border-width"])
- {
- // var nWidthIndex = arKey.find("border-width");
- // var nLeftWidthIndex = arKey.find("border-left-width");
- // var nTopWidthIndex = arKey.find("border-top-width");
- // var nRightWidthIndex = arKey.find("border-right-width");
- // var nBottomWidthIndex = arKey.find("border-bottom-width");
- //
- // if (nWidthIndex < nLeftWidthIndex ||
- // nWidthIndex < nTopWidthIndex ||
- // nWidthIndex < nRightWidthIndex ||
- // nWidthIndex < nBottomWidthIndex)
- {
- HtmlLib.setStyleFront(this.m_heControl, "border-width", this.attribute["border-width"]);
- }
- }
- else
- {
- HtmlLib.setStyleFront(this.m_heControl, "border-width", "1px");
- }
-
- // border-style
- if (this.attribute["border-style"])
- {
- var bSunken = false;
-
- if ("hidden" == this.attribute["border-style"])
- {
- HtmlLib.setStyle(this.m_heControl, "border-style", "none");
- }
- else if ("sunken" == this.attribute["border-style"])
- {
- bSunken = true;
- }
-
- if ("hidden" == this.attribute["border-left-style"])
- {
- HtmlLib.setStyle(this.m_heControl, "border-left-style", "none");
- }
- else if ("sunken" == this.attribute["border-left-style"])
- {
- bSunken = true;
- }
-
- if ("hidden" == this.attribute["border-top-style"])
- {
- HtmlLib.setStyle(this.m_heControl, "border-top-style", "none");
- }
- else if ("sunken" == this.attribute["border-top-style"])
- {
- bSunken = true;
- }
-
- if ("hidden" == this.attribute["border-right-style"])
- {
- HtmlLib.setStyle(this.m_heControl, "border-right-style", "none");
- }
- else if ("sunken" == this.attribute["border-right-style"])
- {
- bSunken = true;
- }
-
- if("hidden" == this.attribute["border-bottom-style"])
- {
- HtmlLib.setStyle(this.m_heControl, "border-bottom-style", "none");
- }
- else if ("sunken" == this.attribute["border-bottom-style"])
- {
- bSunken = true;
- }
-
- if (bSunken)
- {
- HtmlLib.setStyle(this.m_heControl, "border-left-style", "");
- HtmlLib.setStyle(this.m_heControl, "border-top-style", "");
- HtmlLib.setStyle(this.m_heControl, "border-right-style", "");
- HtmlLib.setStyle(this.m_heControl, "border-bottom-style", "");
- HtmlLib.setStyle(this.m_heControl, "border-style", "inset");
- HtmlLib.setStyle(this.m_heControl, "border-width", "2px");
- }
- else
- {
- HtmlLib.setStyleFront(this.m_heControl, "border-style", this.attribute["border-style"]);
- }
- }
- }
- };
- XFormsAttribute.prototype.setChildStyle = function ()
- {
- if (!this.parent || !this.parent.m_heControl)
- {
- return;
- }
-
- if (!this.attribute["font-family"] && !this.m_heControl.style.fontFamily && -1 != this.parent.m_strStyle.indexOf("font-family"))
- {
- HtmlLib.setStyle(this.m_heControl, "font-family", this.parent.m_heControl.style.fontFamily);
- }
- if (!this.attribute["font-size"] && !this.m_heControl.style.fontSize && -1 != this.parent.m_strStyle.indexOf("font-size"))
- {
- HtmlLib.setStyle(this.m_heControl, "font-size", this.parent.m_heControl.style.fontSize);
- }
- if (!this.attribute["font-weight"] && !this.m_heControl.style.fontWeight && -1 != this.parent.m_strStyle.indexOf("font-weight"))
- {
- HtmlLib.setStyle(this.m_heControl, "font-weight", this.parent.m_heControl.style.fontWeight);
- }
- if (!this.attribute["font-style"] && !this.m_heControl.style.fontStyle && -1 != this.parent.m_strStyle.indexOf("font-style"))
- {
- HtmlLib.setStyle(this.m_heControl, "font-style", this.parent.m_heControl.style.fontStyle);
- }
- if (!this.attribute["text-decoration"] && !this.m_heControl.style.textDecoration && -1 != this.parent.m_strStyle.indexOf("text-decoration"))
- {
- HtmlLib.setStyle(this.m_heControl, "text-decoration", this.parent.m_heControl.style.textDecoration);
- }
- if (!this.attribute["color"] && !this.m_heControl.style.color && -1 != this.parent.m_strStyle.indexOf("color"))
- {
- HtmlLib.setStyle(this.m_heControl, "color", this.parent.m_heControl.style.color);
- }
-
- if (!this.attribute["text-align"] && !this.m_heControl.style.textAlign && -1 != this.parent.m_strStyle.indexOf("text-align"))
- {
- HtmlLib.setStyle(this.m_heControl, "text-align", this.parent.m_heControl.style.textAlign);
- }
- if (!this.attribute["vertical-align"] && !this.m_heControl.style.verticalAlign && -1 != this.parent.m_strStyle.indexOf("vertical-align"))
- {
- HtmlLib.setStyle(this.m_heControl, "vertical-align", this.parent.m_heControl.style.verticalAlign);
- }
- if (!this.attribute["line-height"] && !this.m_heControl.style.lineHeight && -1 != this.parent.m_strStyle.indexOf("line-height"))
- {
- HtmlLib.setStyle(this.m_heControl, "line-height", this.parent.m_heControl.style.lineHeight);
- }
- if (!this.attribute["letter-spacing"] && !this.m_heControl.style.letterSpacing && -1 != this.parent.m_strStyle.indexOf("letter-spacing"))
- {
- HtmlLib.setStyle(this.m_heControl, "letter-spacing", this.parent.m_heControl.style.letterSpacing);
- }
- if (!this.attribute["background-repeat"] && !this.m_heControl.style.backgroundRepeat && -1 != this.parent.m_strStyle.indexOf("background-repeat"))
- {
- HtmlLib.setStyle(this.m_heControl, "background-repeat", "no-repeat");
- }
-
- if (!this.attribute["cursor"] && !this.m_heControl.style.cursor && -1 != this.parent.m_strStyle.indexOf("cursor"))
- {
- HtmlLib.setStyle(this.m_heControl, "cursor", this.parent.m_heControl.style.cursor);
- }
- };
- XFormsAttribute.prototype.setNotObjToChildStyle = function ()
- { //물리적인 컨트롤이 존재하지 않는 객체(item..)들의 부모 기본 스타일을 받는다
- if (!this.parent || !this.parent.m_heControl)
- {
- return;
- }
-
- if (!this.attribute["font-family"])
- {
- this.setAttribute("font-family", this.parent.m_heControl.style.fontFamily);
- }
- if (!this.attribute["font-size"])
- {
- this.setAttribute("font-size", this.parent.m_heControl.style.fontSize);
- }
- if (!this.attribute["font-weight"])
- {
- this.setAttribute("font-weight", this.parent.m_heControl.style.fontWeight);
- }
- if (!this.attribute["font-style"])
- {
- this.setAttribute("font-style", this.parent.m_heControl.style.fontStyle);
- }
- if (!this.attribute["text-decoration"])
- {
- this.setAttribute("text-decoration", this.parent.m_heControl.style.textDecoration);
- }
- if (!this.attribute["color"])
- {
- this.setAttribute("color", this.parent.m_heControl.style.color);
- }
- if (!this.attribute["line-height"])
- {
- this.setAttribute("line-height", this.parent.m_heControl.style.lineHeight);
- }
- if (!this.attribute["letter-spacing"])
- {
- this.setAttribute("line-height", this.parent.m_heControl.style.letterSpacing);
- }
- if (!this.attribute["background-repeat"])
- {
- this.setAttribute("line-height", this.parent.m_heControl.style.backgroundRepeat);
- }
- if (!this.attribute["cursor"])
- {
- this.setAttribute("line-height", this.parent.m_heControl.style.cursor);
- }
- };
- XFormsAttribute.createAttribute = function (xnHtmlNode, clAttribute)
- {
- return xnHtmlNode;
- };
- XFormsAttribute.prototype.setHoverStyle = function (htStyle)
- {
- this.m_htHoverStyle = htStyle;
- };
- XFormsAttribute.prototype.getHoverAttribute = function (strKey)
- {
- var strValue = null;
- if (null != this.m_htHoverStyle)
- {
- return this.m_htHoverStyle[strKey];
- }
- return strValue;
- };
- XFormsAttribute.prototype.setHoverAttribute = function (strKey, strName)
- {
- if (null == this.m_htHoverStyle)
- {
- this.m_htHoverStyle = new Hashtable();
- }
-
- this.m_htHoverStyle[strKey] = strName;
- };
- XFormsAttribute.prototype.setDownStyle = function (htStyle)
- {
- this.m_htDownStyle = htStyle;
- };
- XFormsAttribute.prototype.getDownAttribute = function (strKey)
- {
- var strValue = null;
- if (null != this.m_htDownStyle)
- {
- return this.m_htDownStyle[strKey];
- }
- return strValue;
- };
- XFormsAttribute.prototype.setDownAttribute = function (strKey, strName)
- {
- if (null == this.m_htDownStyle)
- {
- this.m_htDownStyle = new Hashtable();
- }
-
- this.m_htDownStyle[strKey] = strName;
- };
- XFormsAttribute.prototype.setFocusStyle = function (htStyle)
- {
- this.m_htFocusStyle = htStyle;
- };
- XFormsAttribute.prototype.getFocusAttribute = function (strKey)
- {
- var strValue = null;
- if (null != this.m_htFocusStyle)
- {
- return this.m_htFocusStyle[strKey];
- }
- return strValue;
- };
- XFormsAttribute.prototype.setFocusAttribute = function (strKey, strName)
- {
- if (null == this.m_htFocusStyle)
- {
- this.m_htFocusStyle = new Hashtable();
- }
-
- this.m_htFocusStyle[strKey] = strName;
- };
- XFormsAttribute.prototype.setDisableStyle = function (htStyle)
- {
- this.m_htDisableStyle = htStyle;
- };
- XFormsAttribute.prototype.getDisableAttribute = function (strKey)
- {
- var strValue = null;
- if (null != this.m_htDisableStyle)
- {
- return this.m_htDisableStyle[strKey];
- }
- return strValue;
- };
- XFormsAttribute.prototype.setDisableAttribute = function (strKey, strName)
- {
- if (null == this.m_htDisableStyle)
- {
- this.m_htDisableStyle = new Hashtable();
- }
-
- this.m_htDisableStyle[strKey] = strName;
- };
- XFormsAttribute.prototype.setSelectStyle = function (htStyle)
- {
- this.m_htDisableStyle = htStyle;
- };
- XFormsAttribute.prototype.getSelectAttribute = function (strKey)
- {
- var strValue = null;
- if (null != this.m_htSelectStyle)
- {
- return this.m_htSelectStyle[strKey];
- }
- return strValue;
- };
- XFormsAttribute.prototype.setSelectAttribute = function (strKey, strName)
- {
- if (null == this.m_htSelectStyle)
- {
- this.m_htSelectStyle = new Hashtable();
- }
-
- this.m_htSelectStyle[strKey] = strName;
- };
- XFormsAttribute.prototype.getSelectAttribute = function (strKey)
- {
- if (null == this.m_htSelectStyle)
- {
- return "";
- }
- return this.m_htSelectStyle[strKey];
- };
- /**
- * XFormsElement
- */
- XFormsElement.prototype = new XFormsAttribute;
- function XFormsElement (strParentId, strId, strTag)
- {
- if (!strId)
- {
- return;
- }
- XFormsAttribute.call(this, strParentId, strId, strTag);
-
- this.m_hmEvent = new Hashtable();
- this.m_objRefElement = null;
- };
- XFormsElement.prototype.init = function ()
- {
- };
- XFormsElement.prototype.getElement = function ()
- {
- return this;
- };
- XFormsElement.prototype.getRefElement = function ()
- {
- return this.m_objRefElement;
- };
- XFormsElement.prototype.setRefElement = function (objElementBase)
- {
- this.m_objRefElement = objElementBase;
- };
- XFormsElement.prototype.isCSSValid = function (strKey)
- {
- var bValid = false;
- if ((null == this.attribute[strKey] || "" == this.attribute[strKey])
- && (null == HtmlLib.getStyle(this.m_heControl, strKey) || "" == HtmlLib.getStyle(this.m_heControl, strKey)))
- {
- bValid = true;
- }
-
- return bValid;
- };
- /**
- * 자식 엘리먼트를 만드는 함수 XFormsElement를 상속받는 클래스에서 재정의 해서 쓰자.
- * @param strElement
- * @param strAttribute
- * @return
- */
- XFormsElement.prototype.createChild = function (strElementName, strAttribute)
- {
- strAttribute = strAttribute.trim();
- if (";" == strAttribute.charAt(strAttribute.length - 1))
- {
- strAttribute = strAttribute.substring(0, strAttribute.length - 1);
- }
-
- var arAttribute = strAttribute.split(";");
-
- var strStyle = "";
- var clAttribute = new Collection();
-
- var strAttributeName;
- var strAttributeValue;
- for (var i=0; i<arAttribute.length; i++)
- {
- if (null != arAttribute[i] && "" != arAttribute[i])
- {
- var arAttributeUnit = arAttribute[i].split(":");
-
- strAttributeName = arAttributeUnit[0].trim();
- strAttributeValue = arAttributeUnit[1].trim();
- if (null != strAttributeValue && "" != strAttributeValue)
- {
- clAttribute.add(strAttributeName, strAttributeValue);
-
- if (STYLE_LIST[strAttributeName])
- {
- strStyle += strAttributeName + ":" + strAttributeValue + ";";
- }
- }
- }
- }
-
- var objChild;
- // 같은 아이디의 컨트롤이 있으면 생성하지 않고 기존 컨트롤을 반환함
- var strId = clAttribute.item("id");
- if (document.allElement.item(strId)) return document.allElement.item(strId);
-
- // ElementName에 따라 해당 js에서 html element 및 obj create
- if ("xforms:input" == strElementName)
- {
- objChild = XFormsInput.create(this.id, clAttribute, strStyle);
- }
- else if ("xforms:inputbutton" == strElementName)
- {
- objChild = XFormsInputButton.create(this.id, clAttribute, strStyle);
- }
- else if ("xforms:calendar" == strElementName)
- {
- objChild = XFormsCalendar.create(this.id, clAttribute, strStyle);
- }
- else if ("xforms:caption" == strElementName)
- {
- objChild = XFormsCaption.create(this.id, clAttribute, strStyle);
- }
- else if ("xforms:output" == strElementName)
- {
- objChild = XFormsOutput.create(this.id, clAttribute, strStyle);
- }
- else if ("xforms:secret" == strElementName)
- {
- objChild = XFormsSecret.create(this.id, clAttribute, strStyle);
- }
- else if ("xforms:textarea" == strElementName)
- {
- objChild = XFormsTextArea.create(this.id, clAttribute, strStyle);
- }
- else if ("xforms:button" == strElementName)
- {
- objChild = XFormsButton.create(this.id, clAttribute, strStyle);
- }
- else if ("xforms:select" == strElementName)
- {
- objChild = XFormsSelect.create(this.id, clAttribute, strStyle);
- }
- else if ("xforms:select1" == strElementName)
- {
- objChild = XFormsSelect1.create(this.id, clAttribute, strStyle);
- }
- else if ("xforms:selectitem" == strElementName)
- {
- objChild = XFormsSelectItem.create(this.id, clAttribute, strStyle);
- }
- else if ("xforms:comboinput" == strElementName)
- {
- objChild = XFormsInput.create(this.id, clAttribute, strStyle);
- }
- else if ("xforms:combobutton" == strElementName)
- {
- objChild = XFormsButton.create(this.id, clAttribute, strStyle);
- }
- else if ("xforms:treeview" == strElementName)
- {
- objChild = XFormsTreeView.create(this.id, clAttribute, strStyle);
- }
- else if ("xforms:treeitem" == strElementName)
- {
- objChild = XFormsTreeViewItem.create(this.id, clAttribute);
- }
- else if ("xforms:img" == strElementName)
- {
- objChild = XFormsImg.create(this.id, clAttribute, strStyle);
- }
- else if ("xforms:line" == strElementName)
- {
- objChild = XFormsLine.create(this.id, clAttribute, strStyle);
- }
- else if ("xforms:shape" == strElementName)
- {
- objChild = XFormsShape.create(this.id, clAttribute, strStyle);
- }
- else if ("xforms:object" == strElementName)
- {
- // 미구현 object 전반적 구조변경 필요하며 ActiveX 뷰어도 보완되어야 함
- }
- else if ("xforms:browser" == strElementName)
- {
- objChild = XFormsBrowser.create(this.id, clAttribute, strStyle);
- }
- else if ("xforms:group" == strElementName)
- {
- objChild = XFormsGroup.create(this.id, clAttribute, strStyle);
- }
- else if ("xforms:switch" == strElementName)
- {
- objChild = XFormsSwitch.create(this.id, clAttribute, strStyle);
- }
- else if ("xforms:import" == strElementName)
- {
- objChild = XFormsImport.create(this.id, clAttribute, strStyle);
- }
- else if ("xforms:iviewer" == strElementName)
- {
- objChild = XFormsIViewer.create(this.id, clAttribute, strStyle);
- }
- else if ("xforms:datagrid" == strElementName)
- {
- // 때가 되면 만들리라....
- }
- else if ("xforms:gridfixedcell" == strElementName)
- {
- objChild = XFormsGridFixedCell.create(this.id, clAttribute, strStyle);
- }
- else if ("xforms:col" == strElementName)
- {
- objChild = XFormsGridCol.create(this.id, clAttribute, strStyle);
- }
- else if ("xforms:gridinput" == strElementName)
- {
- objChild = XFormsGridInput.create(this.id, clAttribute, strStyle);
- }
- else if ("xforms:multilinegrid" == strElementName)
- {
- // 미구현 아직 multilinegrid 없음 2010.4.15
- }
- else if ("xforms:bool" == strElementName)
- {
- objChild = XFormsBool.create(this.id, clAttribute, strStyle);
- }
- else if ("xforms:file" == strElementName)
- {
- // file은 디자인 관련 추가 개발을 좀 더 하고 만들 예정 2010.5.26
- }
- else if ("xforms:table" == strElementName)
- {
- // 미구현 아직 table 없음 2010.4.15
- }
- else if ("xforms:choices" == strElementName)
- {
- objChild = XFormsChoices.create(this.id, clAttribute, strStyle);
- return objChild;
- }
- else if ("xforms:itemset" == strElementName)
- {
- objChild = XFormsItemset.create(this.id, clAttribute, strStyle);
- return objChild;
- }
- else if ("xforms:label" == strElementName)
- {
- objChild = XFormsLabel.create(this.id, clAttribute, strStyle);
- return objChild;
- }
- else if ("xforms:value" == strElementName)
- {
- objChild = XFormsValue.create(this.id, clAttribute, strStyle);
- return objChild;
- }
- else if ("xforms:depth" == strElementName)
- {
- objChild = XFormsDepth.create(this.id, clAttribute, strStyle);
- return objChild;
- }
- else if ("xforms:image" == strElementName)
- {
- objChild = XFormsImage.create(this.id, clAttribute, strStyle);
- return objChild;
- }
- else if ("xforms:selectedimage" == strElementName)
- {
- objChild = XFormsSelectedImage.create(this.id, clAttribute, strStyle);
- return objChild;
- }
- else if ("xforms:expandedimage" == strElementName)
- {
- objChild = XFormsExpandedImage.create(this.id, clAttribute, strStyle);
- return objChild;
- }
- else if ("xforms:case" == strElementName)
- {
- objChild = XFormsCase.create(this.id, clAttribute, strStyle);
- }
- else if ("xforms:submission" == strElementName)
- {
- objChild = XFormsSubmission.create(this.id, clAttribute, strStyle);
- }
- else
- {
- return null;
- }
-
- if (objChild)
- {
- objChild.init();
- }
-
- return objChild;
- };
- /**
- * 자식 엘리먼트를 삭제
- * @param strElement
- */
- XFormsElement.prototype.removeChild = function (strElementName)
- {
- // 존재하지 않는 아이디인 경우 종료
- var objTarget = this.children.item(strElementName);
- if (!strElementName || !objTarget)
- {
- return;
- }
-
- var objTargetChildren = objTarget.children;
- var nChiildrenCount = objTargetChildren.length;
- for(var i = 0; i < nChiildrenCount; i++)
- {
- var strChildrenId = objTargetChildren.item(0).id;
- objTarget.removeChild(strChildrenId);
- }
-
- var heTarget = objTarget.m_heControl;
- if (heTarget)
- {
- var heParent = heTarget.parentNode;
- if (heParent)
- {
- heParent.removeChild(objTarget.m_heControl);
- }
- }
-
- if (document.getElementById("HE_"+strElementName+"_allitem"))
- {
- document.getElementById("HE_"+strElementName+"_allitem").parentNode.removeChild(document.getElementById("HE_"+strElementName+"_allitem"));
- }
-
- this.children.remove(strElementName);
- document.allElement.remove(strElementName);
- };
- XFormsElement.prototype.getAbility = function ()
- {
- return 0;
- };
- XFormsElement.prototype.isEnable = function ()
- {
- return true;
- };
- XFormsElement.prototype.getAttribute = function (strName)
- {
- var strValue = "";
- if (this.m_objRefElement)
- {
- strValue = this.m_objRefElement.getAttribute(strName);
- }
-
- if (null == strValue || "" == strValue || -1 < strName.indexOf("align") || -1 < strName.indexOf("font"))
- {
- strValue = XFormsAttribute.prototype.getAttribute.call(this, strName);
-
- if (null == strValue)
- {
- strValue = "";
- }
- }
- return strValue;
- };
- /**
- * Attribute 값을 변경시키고 Attribute 값 변화에 맞는 동작을 수행한다.
- * @param strAttribute
- * @param strValue
- * @return
- */
- XFormsElement.prototype.setAttribute = function (strName, objValue)
- {
- XFormsAttribute.prototype.setAttribute.call(this, strName, objValue);
- switch (strName)
- {
- case "xforms-select" :
- {
- this.addEventListener("xforms-select", this.id + "_xforms_select", "", "");
- break;
- }
- case "xforms-deselect" :
- {
- this.addEventListener("xforms-deselect", this.id + "_xforms_deselect", "", "");
- break;
- }
- case "xforms-noneselect" :
- {
- this.addEventListener("xforms-noneselect", this.id + "_xforms_noneselect", "", "");
- break;
- }
- case "xforms-recalculate" :
- {
- this.addEventListener("xforms-recalculate", this.id + "_xforms_recalculate", "", "");
- break;
- }
- case "xforms-revalidate" :
- {
- this.addEventListener("xforms-revalidate", this.id + "_xforms_revalidate", "", "");
- break;
- }
- case "xforms-refresh" :
- {
- this.addEventListener("xforms-refresh", this.id + "_xforms_refresh", "", "");
- break;
- }
- case "xforms-compute-exception" :
- {
- this.addEventListener("xforms-compute-exception", this.id + "_xforms_compute_exception", "", "");
- break;
- }
- case "xforms-link-exception" :
- {
- this.addEventListener("xforms-link-exception", this.id + "_xforms_link_exception", "", "");
- break;
- }
- case "xforms-model-construct" :
- {
- this.addEventListener("xforms-model-construct", this.id + "_xforms_model_construct", "", "");
- break;
- }
- case "xforms-close" :
- {
- this.addEventListener("xforms_close", this.id + "_xforms_close", "", "");
- break;
- }
- case "xforms-reset" :
- {
- this.addEventListener("xforms-reset", this.id + "_xforms_reset", "", "");
- break;
- }
- case "xforms-ready" :
- {
- this.addEventListener("xforms-ready", this.id + "_xforms_ready", "", "");
- break;
- }
- case "onredirecthtml" :
- {
- this.addEventListener("onredirecthtml", this.id + "_onredirecthtml", "", "");
- break;
- }
- case "ontimeout" :
- {
- this.addEventListener("ontimeout", this.id + "_ontimeout", "", "");
- break;
- }
- case "DOMActivate" :
- {
- this.addEventListener("DOMActivate", this.id + "_DOMActivate", "", "");
- break;
- }
- case "DOMFocusIn" :
- {
- this.addEventListener("DOMFocusIn", this.id + "_DOMFocusIn", "", "");
- break;
- }
- case "DOMFocusOut" :
- {
- this.addEventListener("DOMFocusOut", this.id + "_DOMFocusOut", "", "");
- break;
- }
- case "xforms-activate" :
- {
- this.addEventListener("xforms-activate", this.id + "_xforms_activate", "", "");
- break;
- }
- case "onmouseactivate" :
- {
- this.addEventListener("onmouseactivate", this.id + "_onmouseactivate", "", "");
- break;
- }
- case "onmousemove" :
- {
- this.addEventListener("onmousemove", this.id + "_onmousemove", "", "");
- break;
- }
- case "onmousedown" :
- {
- this.addEventListener("onmousedown", this.id + "_onmousedown", "", "");
- break;
- }
- case "onmouseenter" :
- {
- this.addEventListener("onmouseenter", this.id + "_onmouseenter", "", "");
- break;
- }
- case "onmouseup" :
- {
- this.addEventListener("onmouseup", this.id + "_onmouseup", "", "");
- break;
- }
- case "oncursor" :
- {
- this.addEventListener("oncursor", this.id + "_oncursor", "", "");
- break;
- }
- case "onmouseover" :
- {
- this.addEventListener("onmouseover", this.id + "_onmouseover", "", "");
- break;
- }
- case "onmouseout" :
- {
- this.addEventListener("onmouseout", this.id + "_onmouseout", "", "");
- break;
- }
- case "onclick" :
- {
- this.addEventListener("onclick", this.id + "_onclick", "", "");
- break;
- }
- case "ondblclick" :
- {
- this.addEventListener("ondblclick", this.id + "_ondblclick", "", "");
- break;
- }
- case "onblur" :
- {
- this.addEventListener("onblur", this.id + "_onblur", "", "");
- break;
- }
- case "onkeypress" :
- {
- this.addEventListener("onkeypress", this.id + "_onkeypress", "", "");
- break;
- }
- case "onkeydown" :
- {
- this.addEventListener("onkeydown", this.id + "_onkeydown", "", "");
- break;
- }
- case "onkeyup" :
- {
- this.addEventListener("onkeyup", this.id + "_onkeyup", "", "");
- break;
- }
- case "onscrolldown" :
- {
- this.addEventListener("onscrolldown", this.id + "_onscrolldown", "", "");
- break;
- }
- case "onscrollup" :
- {
- this.addEventListener("onscrollup", this.id + "_onscrollup", "", "");
- break;
- }
- case "onscrollpagedown" :
- {
- this.addEventListener("onscrollpagedown", this.id + "_onscrollpagedown", "", "");
- break;
- }
- case "onscrollpageup" :
- {
- this.addEventListener("onscrollpageup", this.id + "_onscrollpageup", "", "");
- break;
- }
- case "onscrollpos" :
- {
- this.addEventListener("onscrollpos", this.id + "_onscrollpos", "", "");
- break;
- }
- case "onscrolltrack" :
- {
- this.addEventListener("onscrolltrack", this.id + "_onscrolltrack", "", "");
- break;
- }
- case "onscrolltrackdown" :
- {
- this.addEventListener("onscrolltrackdown", this.id + "_onscrolltrackdown", "", "");
- break;
- }
- case "onscrolltrackup" :
- {
- this.addEventListener("onscrolltrackup", this.id + "_onscrolltrackup", "", "");
- break;
- }
- case "onscroll" :
- {
- this.addEventListener("onscroll", this.id + "_onscroll", "", "");
- break;
- }
- case "onmousewheel" :
- {
- this.addEventListener("onmousewheel", this.id + "_onmousewheel", "", "");
- break;
- }
- case "ontimer" :
- {
- this.addEventListener("ontimer", this.id + "_ontimer", "", "");
- break;
- }
- case "onnext" :
- {
- this.addEventListener("onnext", this.id + "_onnext", "", "");
- break;
- }
- case "onprevious" :
- {
- this.addEventListener("onprevious", this.id + "_onprevious", "", "");
- break;
- }
- case "xforms-invalid" :
- {
- this.addEventListener("xforms-invalid", this.id + "_xforms_invalid", "", "");
- break;
- }
- case "xforms-optional" :
- {
- this.addEventListener("xforms-optional", this.id + "_xforms_optional", "", "");
- break;
- }
- case "xforms-readonly" :
- {
- this.addEventListener("xforms-readonly", this.id + "_xforms_readonly", "", "");
- break;
- }
- case "xforms-readwrite" :
- {
- this.addEventListener("xforms-readwrite", this.id + "_xforms_readwrite", "", "");
- break;
- }
- case "xforms-required" :
- {
- this.addEventListener("xforms-required", this.id + "_xforms_required", "", "");
- break;
- }
- case "xforms-valid" :
- {
- this.addEventListener("xforms-valid", this.id + "_xforms_valid", "", "");
- break;
- }
- case "xforms-enabled" :
- {
- this.addEventListener("xforms-enabled", this.id + "_xforms_enabled", "", "");
- break;
- }
- case "xforms-disabled" :
- {
- this.addEventListener("xforms-disabled", this.id + "_xforms_disabled", "", "");
- break;
- }
- case "ondragenter" :
- {
- this.addEventListener("ondragenter", this.id + "_ondragenter", "", "");
- break;
- }
- case "ondragleave" :
- {
- this.addEventListener("ondragleave", this.id + "_ondragleave", "", "");
- break;
- }
- case "ondrop" :
- {
- this.addEventListener("ondrop", this.id + "_ondrop", "", "");
- break;
- }
- case "ondragover" :
- {
- this.addEventListener("ondragover", this.id + "_ondragover", "", "");
- break;
- }
- case "ondragstart" :
- {
- this.addEventListener("ondragstart", this.id + "_ondragstart", "", "");
- break;
- }
- case "onscrollmax" :
- {
- this.addEventListener("onscrollmax", this.id + "_onscrollmax", "", "");
- break;
- }
- case "onscrollmin" :
- {
- this.addEventListener("onscrollmin", this.id + "_onscrollmin", "", "");
- break;
- }
- case "onbeforeedit" :
- {
- this.addEventListener("onbeforeedit", this.id + "_onbeforeedit", "", "");
- break;
- }
- case "onstartedit" :
- {
- this.addEventListener("onstartedit", this.id + "_onstartedit", "", "");
- break;
- }
- case "onentercell" :
- {
- this.addEventListener("onentercell", this.id + "_onentercell", "", "");
- break;
- }
- case "onleavecell" :
- {
- this.addEventListener("onleavecell", this.id + "_onleavecell", "", "");
- break;
- }
- case "onafteredit" :
- {
- this.addEventListener("onafteredit", this.id + "_onafteredit", "", "");
- break;
- }
- case "onbeforeuserresize" :
- {
- this.addEventListener("onbeforeuserresize", this.id + "_onbeforeuserresize", "", "");
- break;
- }
- case "onafteruserresize" :
- {
- this.addEventListener("onafteruserresize", this.id + "_onafteruserresize", "", "");
- break;
- }
- case "onbeforemovecolumn" :
- {
- this.addEventListener("onbeforemovecolumn", this.id + "_onbeforemovecolumn", "", "");
- break;
- }
- case "onaftermovecolumn" :
- {
- this.addEventListener("onaftermovecolumn", this.id + "_onaftermovecolumn", "", "");
- break;
- }
- case "onimestart" :
- {
- this.addEventListener("onimestart", this.id + "_onimestart", "", "");
- break;
- }
- case "onspinupbuttonclick" :
- {
- this.addEventListener("onspinupbuttonclick", this.id + "_onspinupbuttonclick", "", "");
- break;
- }
- case "onspindownbuttonclick" :
- {
- this.addEventListener("onspindownbuttonclick", this.id + "_onspindownbuttonclick", "", "");
- break;
- }
- case "onbuttonclick" :
- {
- this.addEventListener("onbuttonclick", this.id + "_onbuttonclick", "", "");
- break;
- }
-
-
- case "onselect" :
- {
- this.addEventListener("onselect", this.id + "_onselect", "", "");
- break;
- }
- case "ondayselect" :
- {
- this.addEventListener("ondayselect", this.id + "_ondayselect", "", "");
- break;
- }
- case "oncolorselect" :
- {
- this.addEventListener("oncolorselect", this.id + "_oncolorselect", "", "");
- break;
- }
- case "onautomaticcolor" :
- {
- this.addEventListener("onautomaticcolor", this.id + "_onautomaticcolor", "", "");
- break;
- }
- case "oncustomcolor" :
- {
- this.addEventListener("oncustomcolor", this.id + "_oncustomcolor", "", "");
- break;
- }
- case "onhidepopup" :
- {
- this.addEventListener("onhidepopup", this.id + "_onhidepopup", "", "");
- break;
- }
- case "onbeforevalidation" :
- {
- this.addEventListener("onbeforevalidation", this.id + "_onbeforevalidation", "", "");
- break;
- }
- case "oninvalidformat" :
- {
- this.addEventListener("oninvalidformat", this.id + "_oninvalidformat", "", "");
- break;
- }
-
- case "ondeselect" :
- {
- this.addEventListener("ondeselect", this.id + "_ondeselect", "", "");
- break;
- }
- case "onglobalmousedown" :
- {
- this.addEventListener("onglobalmousedown", this.id + "_onglobalmousedown", "", "");
- break;
- }
- }
- };
- XFormsElement.prototype.setText = function (strText)
- {
- XFormsElementBase.prototype.setText.call(this, strText);
-
- this.attribute["text"] = strText;
- };
- XFormsElement.prototype.dispatch = function (strEventName, strDesc, strPropagate, strDefaultAction)
- {
- // current event setting
- var event = XFormsWindow.getCurrentEvent();
-
- var strOriginEventName = event.name;
- var strOriginTarget = event.target;
- var strOriginCurrentTarget = event.currentTarget;
- var strOriginDescription = event.description;
- var strOriginPropagate = event.propagate;
- var strOriginDefaultAction = event.defaultAction;
-
- event.name = strEventName;
- event.target = this.getId();
- event.currentTarget = event.target;
- if (null!=strPropagate)event.propagate = strPropagate;
- if (null!=strDefaultAction)event.defaultAction = strDefaultAction;
- if (null!=strDesc)event.description = strDesc;
-
- // 스마트폰의 더블 클릭을 위해
- if (is_smartphone && "onclick" == strEventName)
- {
- if (window.isSmartPhoneDblClick(this.getId()))
- {
- window.removePrevClickInfo();
- this.dispatch("ondblclick");
- return;
- }
- else
- {
- var dateCurrent = new Date();
- window.setPrevClickInfo(this.getId(), dateCurrent.getTime());
- }
- }
-
- // 이벤트 무한루프 방지
- event.m_nRef++;
- if (event.m_nRef > 32)
- {
- // TODO Error Message
- event.m_nRef--;
- return;
- }
-
- // run capture
- if ("" != event.capture)
- {
- var objCapture = document.allElement.item(event.capture);
-
- if (null != objCapture && EA_HAS_EVENT & objCapture.getAbility())
- {
- // objCapture.runAction("oncapture");
- if ("cancel" != event.defaultAction)
- {
- objCapture.onCapture(event);
- }
- }
- }
-
- this.internalDispatch(strEventName);
-
- event.name = strOriginEventName;
- event.target = strOriginTarget;
- event.currentTarget = strOriginCurrentTarget;
- event.description = strOriginDescription;
- event.propagate = strOriginPropagate;
- event.defaultAction = strOriginDefaultAction;
-
- event.m_nRef--;
-
- try
- {
- if (!((this instanceof XFormsTextArea) || (this instanceof XFormsGroup)))
- {
- if (event.name != "onkeypress" &&
- event.name != "onkeydown" &&
- event.name != "onkeyup" &&
- event.name != "onmousewheel")
- {
- // if (!(this instanceof XFormsCol && this.m_bInputKey))
- // {
- event.m_browserEvent.returnValue = false;
- if (event.m_browserEvent.stopPropagation)
- {
- event.m_browserEvent.stopPropagation();
- event.m_browserEvent.preventDefault();
- }
- // }
- }
- }
- }
- catch (e)
- {
- // TODO exception
- }
- };
- XFormsElement.prototype.addEventListener = function (strEventName, strHandler, strPropagate, strDefaultAction, strActionArg1, strActionArg2, strActionArg3)
- {
- var objEvent = new TFEvent();
- objEvent.name = strEventName;
- objEvent.handler = strHandler;
- objEvent.propagate = strPropagate;
- objEvent.defaultAction = strDefaultAction;
-
- if ("inPacking_destroy" == strHandler)
- {
- objEvent.ref = strActionArg1;
- }
- else if ("inPacking_dispatch" == strHandler)
- {
- objEvent.dispatchtarget = strActionArg1;
- objEvent.dispatchtargetname = strActionArg2;
- }
- else if ("inPacking_load" == strHandler)
- {
- objEvent.resource = strActionArg1;
- objEvent.show = strActionArg2;
- }
- else if ("inPacking_message" == strHandler)
- {
- objEvent.src = strActionArg1;
- objEvent.level = strActionArg2;
- objEvent.text = strActionArg3;
- }
- else if ("inPacking_reset" == strHandler)
- {
- objEvent.model = strActionArg1;
- }
- else if ("inPacking_send" == strHandler)
- {
- objEvent.submission = strActionArg1;
- }
- else if ("inPacking_setfocus" == strHandler)
- {
- objEvent.control = strActionArg1;
- }
- else if ("inPacking_setvalue" == strHandler)
- {
- objEvent.ref = strActionArg1;
- objEvent.value = strActionArg2;
- }
- else if ("inPacking_toggle" == strHandler)
- {
- objEvent.togglecase = strActionArg1;
- }
-
- var alEvent = this.m_hmEvent[strEventName];
- if (alEvent)
- {
- alEvent.push(objEvent);
- }
- else
- {
- alEvent = new Array();
- alEvent.push(objEvent);
- this.m_hmEvent[strEventName] = alEvent;
- }
- };
- XFormsElement.prototype.eventAddAttribute = function (event, objEvent)
- {
- event.handler = objEvent.handler;
- event.propagate = objEvent.propagate;
- event.defaultAction = objEvent.defaultAction;
-
- if ("inPacking_destroy" == event.handler)
- {
- event.ref = objEvent.ref;
- }
- else if ("inPacking_dispatch" == event.handler)
- {
- event.dispatchtarget = objEvent.dispatchtarget;
- event.dispatchtargetname = objEvent.dispatchtargetname;
- }
- else if ("inPacking_load" == event.handler)
- {
- event.resource = objEvent.resource;
- event.show = objEvent.show;
- }
- else if ("inPacking_message" == event.handler)
- {
- event.src = objEvent.src;
- event.level = objEvent.level;
- event.text = objEvent.text;
- }
- else if ("inPacking_reset" == event.handler)
- {
- event.text = objEvent.model;
- }
- else if ("inPacking_send" == event.handler)
- {
- event.submission = objEvent.submission;
- }
- else if ("inPacking_setfocus" == event.handler)
- {
- event.control = objEvent.control;
- }
- else if ("inPacking_setvalue" == event.handler)
- {
- event.ref = objEvent.ref;
- event.value = objEvent.value;
- }
- else if ("inPacking_toggle" == event.handler)
- {
- event.togglecase = objEvent.togglecase;
- }
-
- return event;
- };
- XFormsElement.prototype.internalDispatch = function (strEventName)
- {
- var event = XFormsWindow.getCurrentEvent();
-
- event.name = strEventName;
- event.currentTarget = this.getId();
- event.propagate = "";
- event.defaultAction = "";
-
- this.preTranslateEvent(event);
- var strGlobalFunc = "";
- if (event.name)
- {
- strGlobalFunc = event.name;
- strGlobalFunc = strGlobalFunc.replaceAll("-", "_");
- }
- if (!("stop" == event.propagate))
- {
- this.fireEvent(strGlobalFunc);
- }
-
- var alEvent = this.m_hmEvent[strEventName];
- if(alEvent && !("stop" == event.propagate))
- {
- for (var i=0; i<alEvent.length; i++)
- {
- var objEvent = alEvent[i];
- this.runAction(this.eventAddAttribute(event, objEvent));
- }
- }
- if (!("cancel" == event.defaultAction))
- {
- this.defaultAction(strEventName, event);
- }
-
- // Bubbling
- if (!("stop" == event.propagate))
- {
- this.bubbles(strEventName, event);
- }
-
- event.handler = "";
- event.propagate = "";
- event.defaultAction = "";
- };
- XFormsElement.prototype.preTranslateEvent = function (event)
- {
- };
- XFormsElement.prototype.runAction = function (event)
- {
- if("inPacking_close" == event.handler)
- {
- inPacking_close();
- }
- else if("inPacking_recalculate" == event.handler)
- {
- inPacking_recalculate();
- }
- else if("inPacking_refresh" == event.handler)
- {
- inPacking_refresh();
- }
- else if ("inPacking_destroy" == event.handler)
- {
- inPacking_destroy(event);
- }
- else if ("inPacking_dispatch" == event.handler)
- {
- inPacking_dispatch(event);
- }
- else if ("inPacking_load" == event.handler)
- {
- inPacking_load(event);
- }
- else if ("inPacking_message" == event.handler)
- {
- inPacking_message(event);
- }
- else if ("inPacking_reset" == event.handler)
- {
- inPacking_reset(event);
- }
- else if ("inPacking_send" == event.handler)
- {
- inPacking_send(event);
- }
- else if ("inPacking_setfocus" == event.handler)
- {
- inPacking_setfocus(event);
- }
- else if ("inPacking_setvalue" == event.handler)
- {
- inPacking_setvalue(event);
- }
- else if ("inPacking_toggle" == event.handler)
- {
- inPacking_toggle(event);
- }
- else
- {
- var strFunction = "if (window." + event.handler + "){" + event.handler + "(event);}";
- eval(strFunction);
- if (null != this.getAttribute(event.name))
- {
- eval(this.getAttribute(event.name));
- }
- }
- };
- XFormsElement.prototype.fireEvent = function (strFunctionName)
- {
- if (window.m_arGlobalEventFireList[strFunctionName])
- {
- var strFunction = strFunctionName + "();";
- eval(strFunction);
- }
- };
- XFormsElement.prototype.bubbles = function (strEventName, event)
- {
- var objParent = this.parent;
-
- if (null != objParent && objParent instanceof XFormsElement && (objParent.getAbility() & EA_HAS_EVENT))
- {
- objParent.internalDispatch(strEventName, event);
- }
- };
- XFormsElement.prototype.onCapture = function ()
- {
- };
- XFormsElement.createAttribute = function (xnHtmlNode, clAttribute)
- {
- xnHtmlNode = XFormsAttribute.createAttribute(xnHtmlNode, clAttribute);
- return xnHtmlNode;
- };
|