123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264 |
- XFormsCase.prototype = new XFormsGroup;
- function XFormsCase (strParentId, strAlert, strHelp, strHint, strAccesskey, strClass, bDisabled, strId, nNavindex, strOverflow,
- strScroll, bSelected, strStyle, strTag, strVisibility, strUserDefineAttrib)
- {
- if (!strId)
- {
- return;
- }
- XFormsGroup.call(this, strParentId, strAlert, strHelp, strHint, strAccesskey, ""/*strBind*/, strClass, bDisabled, strId, nNavindex,
- strOverflow, ""/*bPopup*/, ""/*strRef*/, strScroll, ""/*strShowEffect*/, strStyle, strTag, strVisibility, strUserDefineAttrib);
-
- /**
- * html Element 별도로 정의한다. init 구조 수정 후 보완
- */
- this.m_heControl = document.getElementById("HE_" + strId);
- /**
- * Attribute
- */
- this.attribute["selected"] = String(bSelected); // selected
-
- this.m_nIndex = -1;
- this.m_bIsChild = true;
- };
- XFormsCase.prototype.init = function ()
- {
- XFormsGroup.prototype.init.call(this);
- };
- XFormsCase.prototype.applyDefaultStyle = function ()
- {
- HtmlLib.setStyle(this.m_heControl, "left", "0px");
- HtmlLib.setStyle(this.m_heControl, "top", "0px");
- HtmlLib.setStyle(this.m_heControl, "width", "100%");
- HtmlLib.setStyle(this.m_heControl, "height", "100%");
- };
- XFormsCase.prototype.setAttribute = function (strAttribute, strValue)
- {
- XFormsGroup.prototype.setAttribute.call(this, strAttribute, strValue);
- switch (strAttribute)
- {
- case "selected" :
- {
- this.select(strValue);
- break;
- }
- }
- };
- XFormsCase.prototype.getIndex = function ()
- {
- return this.m_nIndex;
- };
- XFormsCase.prototype.setIndex = function (nIndex)
- {
- this.m_nIndex = nIndex;
- };
- XFormsCase.prototype.select = function (bSelected)
- {
- // String으로 처리한다.
- bSelected = String(bSelected);
- if ("true" == bSelected)
- {
- var objSwitch = this.parent;
- if (null != objSwitch)
- {
- if (objSwitch instanceof XFormsSwitch)
- {
- var arKeySet = objSwitch.children.keys();
- for (var i=0; i<arKeySet.length; i++)
- {
- var strId = arKeySet[i];
- if (this.id != strId)
- {
- var objOtherCase = objSwitch.children.item(strId);
- objOtherCase.select("false");
- }
- }
- }
- objSwitch.selectedIndex = this.m_nIndex;
- }
- this.attribute["selected"] = "true";
- this.m_heControl.style.visibility = "visible";
- if(is_smartphone)this.m_heControl.style.display = "";
- this.m_heControl.style.width = "100%";
- this.m_heControl.style.height = "100%";
- //this.m_heControl.style.display = "";
- }
- else
- {
- this.attribute["selected"] = "false";
- this.m_heControl.style.visibility = "hidden";
- if(is_smartphone)this.m_heControl.style.display = "none";
- this.m_heControl.style.width = "0%";
- this.m_heControl.style.height = "0%";
- //this.m_heControl.style.display = "none";
- }
- };
- XFormsCase.prototype.descendants = function (strId, bIncludeThis)
- {
-
- };
- XFormsCase.create = function (strParentId, clAttribute, strStyle)
- {
- // 메인노드 생성
- var xnCase = XFormsCase.createMainNode(clAttribute);
- var xnParent = document.getElementById("HE_"+strParentId);
- xnParent.appendChild(xnCase);
- // 하위노드 생성
- xnCase = XFormsCase.createSubNodes(xnCase, clAttribute);
- // object 생성
- var objCase = XFormsCase.createObject(strParentId, xnCase, clAttribute, strStyle);
- var objParent = document.controls.item(strParentId);
-
- var nIndex = -1;
- var arKeyset = objParent.children.keys();
- for (var i=0; i<arKeyset.length; i++)
- {
- var strId = arKeyset[i];
- var objTempCase = objParent.children.item(strId);
- if (objTempCase instanceof XFormsCase)
- {
- if (objTempCase != objCase && objTempCase.m_nIndex > nIndex)
- {
- nIndex = objTempCase.m_nIndex;
- }
- }
- }
- nIndex++;
- objCase.setIndex(nIndex);
-
- return objCase;
- };
- XFormsCase.createMainNode = function (clAttribute)
- {
- var xnCase = document.createElement("div");
- xnCase = XFormsCase.createAttribute(xnCase, clAttribute);
- return xnCase;
- };
- XFormsCase.createSubNodes = function (xnCase, clAttribute)
- {
- return xnCase;
- };
- XFormsCase.createObject = function (strParentId, xnCase, clAttribute, strStyle)
- {
- var strAlert = "";
- var strHelp = "";
- var strHint = "";
- var strAccesskey = "";
- var strClass = "";
- var bDisabled = false;
- var strId = "";
- var nNavindex = 9007199254740992;
- var strOverflow = "";
- var strScroll = "";
- var bSelected = "false";
- var strVisibility = "visible";
- var strUserDefineAttrib = "";
-
- for (var i=0; i<clAttribute.count(); i++)
- {
- var strAttributeName = clAttribute.keys()[i];
- switch (strAttributeName)
- {
- case "alert" :
- {
- strAlert = clAttribute.item(strAttributeName);
- break;
- }
- case "help" :
- {
- strHelp = clAttribute.item(strAttributeName);
- break;
- }
- case "hint" :
- {
- strHint = clAttribute.item(strAttributeName);
- break;
- }
- case "accesskey" :
- {
- strAccesskey = clAttribute.item(strAttributeName);
- break;
- }
- case "class" :
- {
- strClass = clAttribute.item(strAttributeName);
- break;
- }
- case "disabled" :
- {
- if ("true" == clAttribute.item(strAttributeName))
- {
- bDisabled = true;
- }
- break;
- }
- case "id" :
- {
- strId = clAttribute.item(strAttributeName);
- break;
- }
- case "navindex" :
- {
- nNavindex = parseInt(clAttribute.item(strAttributeName));
- break;
- }
- case "overflow" :
- {
- strOverflow = clAttribute.item(strAttributeName);
- break;
- }
- case "scroll" :
- {
- strScroll = clAttribute.item(strAttributeName);
- break;
- }
- case "selected" :
- {
- if ("true" == clAttribute.item(strAttributeName))
- {
- bSelected = "true";
- }
- break;
- }
- case "visibility" :
- {
- strVisibility = clAttribute.item(strAttributeName);
- break;
- }
-
- default :
- {
- if (!STYLE_LIST[strAttributeName])
- {
- strUserDefineAttrib += strAttributeName + ":" + clAttribute.item(strAttributeName) + "; ";
- }
- break;
- }
- }
- }
- var objCase = new XFormsCase (strParentId, strAlert, strHelp, strHint, strAccesskey, strClass, bDisabled, strId, nNavindex, strOverflow, strScroll, bSelected, strStyle, "xforms:case", strVisibility, strUserDefineAttrib);
- return objCase;
- };
- XFormsCase.createAttribute = function (xnHtmlNode, clAttribute)
- {
- xnHtmlNode = XFormsGroup.createAttribute(xnHtmlNode, clAttribute);
- return xnHtmlNode;
- };
|