PropertyEventMethodIndex
WebSquare.util - 5.0_2.2916B.20171222.151448

WebSquare.util Package

Type

engine

Property Summary

Event Summary

Method Summary

appendingPathComponent( starturl , endurl )
Appends an additional path to the URL path. Handles abnormal functioning depending on whether / exists or not.
clearInterval( key , force )
WebSquare
clearPage( )
Refreshes the browser.
clearTimeout( key , force )
WebSquare
closePopup( id )
Closes the pop-up of the corresponding ID.
createPopup( id , type , popupName , style , useIFrame , modal , srcORurl , srcData , destData , xml )
Creates a pop-up according to the specified properties.
dbltoHexacode( dbl )
Converts the integer into hexa code for RGB.
first( elem )
Returns the first child node of the specified HTML element.
getBoolean( boolstr )
Returns true for "true", or false for "false".
getChildNodeAt( obj , idx )
Returns the child node of the corresponding index in the object.
getChildren( component , options )
Returns child components of a certain component as an array.
getComponentById( id )
Returns the WebSquare5 component of the corresponding ID.
getData( key )
Gets the data of the specified key.
getDate( str )
Removes the slash (/) from the date string.
getDocumentSize( sizeName )
Gets the width of height of the document not including the scroll bar size.
getGlobalFunction( str )
Gets a global function even from inside an object.
getIntervalKeyList( )
WebSquare
getKeyCode( comp , e )
Receives the component object with a key event and the event object, and returns a keyCode or unicode.
getNumber( str )
Removes the comma from the string, and returns parseInt/parseFloat result.
getPopup( id )
Returns the pop-up component of the corresponding ID.
getPopupParam( )
Returns the string of xmlDocument parameter of the pop-up.
getPopupWindow( id )
Returns the pop-up window of the corresponding ID.
getStringByteSize( str , ignoreChar )
Returns the byte size of the string.
getSubmissionURL( url )
Reads the submission URL.
getTextNodeValue( element )
Returns the Text node of the HTML element.
getTime( str )
Removes colons from the time string.
getTimeoutKeyList( )
WebSquare
hexacodetoDbl( hexa )
Converts the hexa code into an integer.
isInteger( num )
Checks whether the number is an integer or not.
isMobile( )
Checks whether the current device is mobile or not.
isNull( value )
Checks whether the entered value is null or not.
isNumber( value )
Checks whether the entered value is numeric data or not.
isOdd( num )
Checks whether the given integer is an odd number or not.
isPopup( )
Checks whether the current window is a pop-up or not. If it is a pop-up, returns true. Otherwise, returns false.
isString( value )
Checks whether the entered value is a string.
js( scriptUrl , callback )
Controls the sequence of loading multiple external scripts.
last( elem )
Returns the last child node of the HTML element.
multipleExcelDownload( options , infoArr )
Saves the grid data as an Excel file.
next( elem )
Returns the next node that is not a Text node.
openPopup( url , <Object:Y> , params , target )
Creates a pop-up according to the specified properties.
parent( elem , num )
Returns the node of the parent node as high as the given number in the HTML element.
parseFloat( str , defaultValue )
Calls parseFloat.
parseInt( str , defaultValue )
Calls parseInt.
prev( elem )
Returns the previous node that is not a Text node.
reinitialize( refresh )
Reloads the page without refreshing the browser, or refreshes the browser.
removeData( key )
Removes the data of the corresponding key.
setData( key , data )
Registers the data of the corresponding key.
setDate( str )
Adds / to the date string.
setDisabled( obj )
Disables the objects under the component.
setDocumentLang( lang )
Sets the language code in the HTML tag.
setDomain( domain )
Sets a domain to uspport cross-domainon frames and pop-ups.
setFullView( zoomResolve )
Sets the fullview feature in the current screen.
setInterval( func , options )
Registers a function and regularly executes the function.
setNumber( str )
Converts to a string by adding a comma to the entered number.
setTime( str )
Adds : to the time string.
setTimeout( func , options )
Registers a function and executes the function after time-out.
toHexColor( rgb )
Receives rgb (r, g, b) string and returns the color code in #RRGGBB format.
url( w2xPath , options )
Sends only w2xPath for page changing instead of sending the entire URL.

Property Detail

Event Detail

Method Detail

appendingPathComponent( starturl , endurl )
Appends an additional path to the URL path. Handles abnormal functioning depending on whether / exists or not.
case 1 : "/hoyoon/" + "/inswave.xml" = "/hoyoon/inswave.xml" (Remove / from //.)
case 2 : "/hoyoon" + "/inswave.xml" = "/hoyoon/inswave.xml" (Add.)
case 3 : "/hoyoon/" + "inswave.xml" = "/hoyoon/inswave.xml" (Add.)
case 4 : "/hoyoon" + "inswave.xml" = "/hoyoon/inswave.xml" (Add /.)
degenerating case : If the latter component is followed by :// (an absolute path including the protocol), only the latter part will be returned.
Parameter
nametyperequireddescription
starturlStringYStarting URL to append
endurlStringYEnding URL to append
Return
typedescription
StringAppended URL
clearInterval( key , force )
Clears the execution interval of the function registered by WebSquare.util.setInterval.
Parameter
nametyperequireddescription
keyStringYValue of the key set by options.key of WebSquare.util.setInterval
forceBooleanNWhether to execute the function registered by setInterval again or not. The default is false.
Sample
WebSquare.util.clearInterval("timer1");
clearPage( )
Refreshes the browser. Used by the onpageunload event when the browser needs to be initialized in the SPA mode. Add onpageunload event and call this function in the components that have memory leak issue in the SPA mode such as Editor or Chart. WebSquare.util.url(WebSquare.baseURI + "blank.xml", {"spa":true, "forceReload":true}); // Same as calling the function.
Sample
<body> <script type="javascript" ev:event="onpageunload"><![CDATA[ WebSquare.util.clearPage(); // 브라우저를 갱신하여 초기상태로 되돌린다. 이 경우 웹스퀘어 엔진 및 리소스를 새로 로딩하게 된다. ]]></script> </body>
clearTimeout( key , force )
Clears time-out of the function registered by WebSquare.util.setTimer.
Parameter
nametyperequireddescription
keyStringYValue of the key set by options.key of WebSquare.util.setTimer
forceBooleanNWhether to execute the setTimer function or not. The default is false.
Sample
WebSquare.util.clearTimeout("timer1");
closePopup( id )
Closes the pop-up of the corresponding ID.
Parameter
nametyperequireddescription
idStringYPopup ID
Sample
WebSquare.util.closePopup("popup1");
createPopup( id , type , popupName , style , useIFrame , modal , srcORurl , srcData , destData , xml )
Creates a pop-up according to the specified properties.
Parameter
nametyperequireddescription
idStringYPopup object ID
typeStringNPopup object type (litewindow, window, browser)
popupNameStringNPopup object name to be displayed on the popup frame
styleStringNPopup object style
useIFrameStringNtrue or false.
true : Uses IFrame. false: Uses window.open.
modalStringNtrue or false.
true : Not to use the background component of the pop-up object. false: To use the background component of the pop-up object.
srcORurlStringYWhen the popup object type is litewindow or window: when the pop-up object is litewindow or window
When the popup object type is browser: when the popup object type is browser.
srcDataStringNXPath to get from the parent when the pop-up object type is window
destDataStringNXPath to set in the pop-up when the pop-up object type is window
xmlArrayNXML document to be applied to the pop-up object
Sample
WebSquare.util.createPopup("popup1", "window", "People Profile", "width:600px;height:350px;top:100px;left:100px;", "true", "true", "WebSquare1.xml", peopleNode, "map", peopleNode);
dbltoHexacode( dbl )
Converts the integer into hexa code for RGB.
Parameter
nametyperequireddescription
dblNumberYRGB value in the integer type
Return
typedescription
StringConversion result into hexa code
Sample
WebSquare.util.dbltoHexacode(16777215);
first( elem )
Returns the first child node of the specified HTML element.
Parameter
nametyperequireddescription
elemObjectYThe object to check the child nodes
Return
typedescription
ObjectThe first child node of the element
Sample
WebSquare.util.first( xmlDoc);
getBoolean( boolstr )
Returns true for "true", or false for "false".
Parameter
nametyperequireddescription
boolstrStringYboolean string
Return
typedescription
Booleantrue for "ture", and false for "false".
Sample
WebSquare.util.getBoolean("true");
getChildNodeAt( obj , idx )
Returns the child node of the corresponding index in the object.
Parameter
nametyperequireddescription
objObjectYObject to check the child nodes
idxNumberYIndex of the child node
Return
typedescription
ObjectChild node of the corresponding index in the object
Sample
WebSquare.util.getChildNodeAt( xmlDoc, 1 );
getChildren( component , options )
Returns child components of a certain component as an array.
Parameter
nametyperequireddescription
componentObjectNParent component. When properties are not specified, the component means the body component.
optionsObjectNOptions are as shown below.
<boolean:N> obj.recursive : Whether to include descendant. The default is false. In case of the body component, false will be applied regardless of the option settings. <String:N> obj.excludeId : ID of the component to exclude. If there are multiple IDs, use space as a separator. <String:N> obj.excludePlugin : Plug-in of the component to exclude. If there are multiple plug-ins, use space as a separator.
Return
typedescription
ObjectArray of components
Sample
(ex1) WebSquare.util.getChildren(); or WebSquare.util.getChildren(null, {recursive:true}); => Returns all immediate child components of the body. In case of body, recursive option will be ignored. (Due to performance issues, recursive checking of the child nodes is not allowed.) (ex2) WebSquare.util.getChildren (group1, {excludePlugin : "trigger output", recursive : true}); => Returns all descendant components of group1 except Trigger and Output components. (ex3) WebSquare.util.getChildren(group2, {excludePlugin : "trigger input", excludeId : "treeview1_tooltip windowContainer1_tooltip"); => Returns an array of immediate child components of group1 except Trigger, Output, and the components of which ID is treeview1_tooltip or widnowContainer1_tooltip.
getComponentById( id )
Returns the WebSquare5 component of the corresponding ID.
Parameter
nametyperequireddescription
idStringYID of the WebSquare5 component
Return
typedescription
ObjectWebSquare component object
Sample
var output1 = WebSquare.util.getComponentById("output1");
getData( key )
Gets the data of the specified key.
Parameter
nametyperequireddescription
keyStringYKey of the data to get
Return
typedescription
ObjectData of the specified key
Sample
var itemList = WebSquare.util.getData("item1").itemList;
getDate( str )
Removes the slash (/) from the date string.
Parameter
nametyperequireddescription
strStringYDate String
Return
typedescription
StringEntered string without /
Sample
var data = WebSquare.util.getDate("2012/01/01"); date : 20120101
getDocumentSize( sizeName )
Gets the width of height of the document not including the scroll bar size.
Parameter
nametyperequireddescription
sizeNameStringY"width" or "height" in string
Return
typedescription
NumberDocument size
Sample
WebSquare.util.getDocumentSize("width");
getGlobalFunction( str )
Gets a global function even from inside an object. Gets a global function even from inside an object.
Parameter
nametyperequireddescription
strStringYString indicating the function
Return
typedescription
FunctionFunction to return
Sample
var func = WebSquare.util.getGlobalFunction("obj.formatter");
getIntervalKeyList( )
Returns all keys registered by WebSquare.util.setIntervalKey as an array.
Return
typedescription
ObjectKeys registered by getIntervalKey
Sample
var IntervalKeyList = WebSquare.util.getIntervalKeyList(); for(var i = 0; i &lt; IntervalKeyList.length; i++) { WebSquare.util.clearInterval(IntervalKeyList[i]); } // Clear all timers.
getKeyCode( comp , e )
Receives the component object with a key event and the event object, and returns a keyCode or unicode.
When a keyCode is generated, the keyCode will be returned as a decimal value. If no keyCode is not generated, the unicode will be returned as a decimal value.
Parameter
nametyperequireddescription
compObjectYComponent object
eEventYevent object
Return
typedescription
NumberReturns the keyCode or uniCode.
Sample
var returnValue = WebSquare.util.getKeyCode(input1,e);
console.log("returnValue="+returnValue);
getNumber( str )
Removes the comma from the string, and returns parseInt/parseFloat result.
Parameter
nametyperequireddescription
strStringYNumeric data as a string
Return
typedescription
NumberNumeric data converted from the inputted string
Sample
var data = WebSquare.util.getNumber("2,000"); data : 2000
getPopup( id )
Returns the pop-up component of the corresponding ID.
Parameter
nametyperequireddescription
idStringYPopup ID
Return
typedescription
ObjectPopup component
Sample
var popObj = WebSquare.util.getPopup("popup1");
getPopupParam( )
Returns the string of xmlDocument parameter of the pop-up.
Return
typedescription
StringxmlDocument string
Sample
var dataStr = WebSquare.util.getPopupParam();
getPopupWindow( id )
Returns the pop-up window of the corresponding ID.
Parameter
nametyperequireddescription
idStringYPopup ID
Return
typedescription
ObjectPopup window
Sample
var popObj = WebSquare.util.getPopup("popup1");
getStringByteSize( str , ignoreChar )
Returns the byte size of the string.
Parameter
nametyperequireddescription
strStringYString to get the byte size
ignoreCharStringNCharacters to ignore in the byte size checking
Return
typedescription
Numberbyte size
Sample
var data = WebSquare.util.getStringByteSize("websquare"); data : 9
getSubmissionURL( url )
Reads the submission URL. Uses appendingPathComponent.
Parameter
nametyperequireddescription
urlStringYDefault URL address
Return
typedescription
StringSubmission URL
getTextNodeValue( element )
Returns the Text node of the HTML element.
Parameter
nametyperequireddescription
elementObjectYhtml element
Return
typedescription
Stringtext node string
Sample
WebSquare.util.getTextNodeValue( xmlDoc);
getTime( str )
Removes colons from the time string.
Parameter
nametyperequireddescription
strStringYTime String
Return
typedescription
StringEntered string without ':'
Sample
var data = WebSquare.util.getTime("11:23"); data : 1123
getTimeoutKeyList( )
Returns all keys registered by WebSquare.util.setTimer as an array.
Return
typedescription
ObjectKeys registered by setTimer
Sample
var timeoutKeyList = WebSquare.util.getTimeoutKeyList(); for(var i = 0; i &lt; timeoutKeyList.length; i++) { WebSquare.util.clearTimeout(timeoutKeyList[i]); } // Clear all timers.
hexacodetoDbl( hexa )
Converts the hexa code into an integer.
Parameter
nametyperequireddescription
hexaStringYhexa code value
Return
typedescription
NumberConversion result in integer
Sample
WebSquare.util.hexacodetoDbl("A0D39C");
isInteger( num )
Checks whether the number is an integer or not.
Parameter
nametyperequireddescription
numStringYNumber or Number String
Return
typedescription
BooleanTrue for an integer, or false.
Sample
WebSquare.util.isInteger(10)
isMobile( )
Checks whether the current device is mobile or not. Supported devices include iPhone, iPad, iPodTouch, Android, and Blackberry.
Return
typedescription
Booleantrue is returned for mobile devices, or false.
isNull( value )
Checks whether the entered value is null or not.
Parameter
nametyperequireddescription
valueObejctYValue to check
Return
typedescription
BooleanTrue for null, or false.
isNumber( value )
Checks whether the entered value is numeric data or not.
Parameter
nametyperequireddescription
valueObejctYValue to check
Return
typedescription
BooleanTrue for number type, or false.
Sample
var data = WebSquare.util.isNumber("12"); data : false
isOdd( num )
Checks whether the given integer is an odd number or not.
Parameter
nametyperequireddescription
numStringYNumber String
Return
typedescription
BooleanTrue for an odd number, or false.
Sample
WebSquare.util.isOdd(11);
isPopup( )
Checks whether the current window is a pop-up or not. If it is a pop-up, returns true. Otherwise, returns false.
Return
typedescription
booleanChecks whether the current window is a pop-up or not.
Sample
var ispopup = WebSquare.util.isPopup();
isString( value )
Checks whether the entered value is a string.
Parameter
nametyperequireddescription
valueObejctYValue to check
Return
typedescription
BooleanTrue for the string type, or false.
Sample
var data = WebSquare.util.isString("12"); data : true
js( scriptUrl , callback )
Controls the sequence of loading multiple external scripts. Loads the scripts in parallel, but runs them in a sequential manner. If the last received parameter is a function, execute the function after script loading. (callback)
Parameter
nametyperequireddescription
scriptUrlStringYjavascript url. The parameter count is not fixed. When there are multiple scripts to load, as man script URLs as the script count will be received.
callbackFunctionNIf the last received type is a function, the function will be executed after all scripts are executed. A callback function.
Sample
WebSquare.util.js("/common/js/common.js", "/common/js/test1.js", "/common/js/test2.js", function(){alert("all done");} // common.js, test1.js, and test2.js will be loaded in parallel, but they will be executed in the receive order (common.js -> test1.js -> test2.js.) // The callback function will be executed after test2.js is loaded. Then, alert("all done"); will be executed.
last( elem )
Returns the last child node of the HTML element.
Parameter
nametyperequireddescription
elemObjectYThe object to check the child nodes
Return
typedescription
ObjectLast child node
Sample
WebSquare.util.last(xmlDoc);
multipleExcelDownload( options , infoArr )
Saves the grid data as an Excel file. Functions only when the proper settings have been made. Sheet names must be unique. (Supported for JDK 1.5 and higher versions.)
Parameter
nametyperequireddescription
optionsObjectYDownloading options for the grid data (stored in JSON format) as an Excel file
<String:N> options.fileName : [default: excel.xls] Name of the file to download <String:N> options.sheetName : [default: sheet] Name of the Excel sheet <String:N> options.rowsByN : [default: 100] Maximum number of the rows to download (Example: If this value is "1000", not more than 1000 rows can be downloaded.) <String:N> options.type : [default: 0] Type of the data to be downloaded. (0 for actual data, 1 for displayed data, and 2 for the entered data. When the type is 2, filtering will be ignored and the data of the cells of expression type will not be downloaded.) <String:N> options.removeColumns : [default: N/A] Column number to remove from the Excel file (Use comma for multiple inputs.) <String:N> options.removeHeaderRows : [default: N/A] Row index of the header to remove from the Excel file. (Use comma for multiple inputs.) <String:N> options.foldColumns : [default: N/A] Columns to fold in the Excel file. (Use comma for multiple inputs.) <Number:N> options.startRowIndex : [default: 0] Index of the row from which the grid data starts in the Excel file (including the header) <Number:N> options.startColumnIndex : [default: 0] Index of the column from which the grid data starts in the Excel file (including the header) <String:N> options.headerColor : [default: #33CCCC] Color of the grid header in the Excel file <String:N> options.headerFontName : [default: N/A] Header font name <String:N> options.headerFontSize : [default: 10] Header font size <String:N> options.headerFontColor : [default: N/A] Header font color <String:N> options.bodyColor : [default: #FFFFFF] Color of the grid body in the Excel file <String:N> options.bodyFontName : [default: N/A] Body font name <String:N> options.bodyFontSize : [default: 10] Body font size <String:N> options.bodyFontColor : [default: N/A] Body font color <String:N> options.subTotalColor : [default: #CCFFCC] Color of the grid subtotal in the Excel file <String:N> options.subTotalFontName : [default: N/A] Font name of the subtotal <String:N> options.subTotalFontSize : [default: 10] Subtotal font size <String:N> options.subTotalFontColor : [default: N/A] Subtotal font color <String:N> options.footerColor : [default: #008000] Color of the grid footer in the Excel file <String:N> options.footerFontName : [default: N/A] Footer color <String:N> options.footerFontSize : [default: 10] Footer font size <String:N> options.footerFontColor : [default: N/A] Footer color <Boolean:N> options.showProcess Whether to show the process window or not during the downloading <String:N> options.dataProvider : [default: N/A] Provider package to process the user data. <String:N> options.providerRequestXml : [default: N/A] XML string for internal uses by the provider <String:N> options.userDataXml : [default: N/A] Reserved for the developers to send data when developing server modules. <Boolean:N> options.bodyWordwrap : [default: false] Line changing in the body part during downloading <String:N> options.useEuroLocale : [default: false] Use of the Euro currency during downloading (Use , instead of . and vice versa.) <String:N> options.useHeader : [default: true] Whether to display the header or not (true or false). <String:N> options.useSubTotal : [default: false] Whether to display the SubTotal or not (true or false). In case an expression is specified, avg, sum, min, max, and targetColValue can be displayed. <String:N> options.useFooter : [default: true] Whether to display the footer or not (true or false). <String:N> options.separator : [default: ,] Data separator for data transmission to the server. The default is the comma. <Number:N> options.subTotalScale : [default: -1] Decimal point of the subTotal average <String:N> options.subTotalRoundingMode : [default: N/A] Rounding mode for subTotal average. ("CEILING","FLOOR","HALF_UP") <String:N> options.useStyle : [default: false] hehter to apply Style (not CSS) to Excel (such as background color and font). <String:N> options.freezePane : [default: ""] Coordinates to freeze the pane. (Example) freezePane="3,4" To fix to 3 (on X) and 4 (on Y)., freezePane="0,1,0,5" To fix to 0 (on X), 1 (on Y), 0 (on X) and 5 (on Y) <String:N> options.autoSizeColumn : [default: false] Whether to automatically size the width of not <String:N> options.displayGridlines : [default: false] Whether to display the grid lines or not <String:N> options.colMerge : [default: false] Whether to display the merged columns as they are merged. <String:N> options.useDataFormat : [default: N/A] Whether to display the data in Text format when the dataType of the grid is Text. (In case of true, display in Text format. Otherwise, display in a general format.) <Object:N> options.printSet Printing-related settings for the Excel data saved in JSON type. <String:N> options.printSet.fitToPage : [default: false] Whether to fit to the page for printing or not <String:N> options.printSet.landScape : [default: false] Whether to print in landscape direction <String:N> options.printSet.fitWidth : [default: 1] Paper width for printing of the Excel file <String:N> options.printSet.fitHeight : [default: 1] Paper height for printing of the Excel file <String:N> options.printSet.scale : [default: 100] Scaling ratio for printing. fitToPage must be false. <String:N> options.printSet.pageSize : [default: A4] Paper type for printing of the Excel file (Example) "A3", "A4", "A5", "B4") Valid when fitToPage is true.
infoArrObjectNAn array of GridView information to show it in another cell
<Number:N> infoArr.rowIndex : Row index to display text <Number:N> infoArr.colIndex : Column index to display contents <Number:N> infoArr.rowSpan : Number of the rows to merge <Number:N> infoArr.colSpan : Number of columns to merge <String:N> infoArr.text : Text to display <String:N> infoArr.textAlign : Alignment (left, center, right) <String:N> infoArr.fontSize : font size (Example) "20px" <String:N> infoArr.fontName : font name <String:N> infoArr.color : font color (Example) "red" <String:N> infoArr.fontWeight : font weight (Example) "bold" <String:N> infoArr.drawBorder : cell border (Example) true <String:N> infoArr.wordWrap : Line change in the cell (Example) "true"
Sample
// Grid with five columns with IDs of a, b, c, d, and e. var options = { common: { fileName : "user.xls", showProcess : true, multipleSheet : true, printSet : { landScape : "true", fitToPage : "true", fitWidth : "1", fitHeight : "1", scale : "222" } }, excelInfo: [ { gridId : "grid1", sheetName : "First sheet", type : "1", removeColumns : "1,3", foldColumns : "2", startRowIndex : 3, startColumnIndex : 0, headerColor : "#DBEEF3", bodyColor : "#92CDDC", dataProvider : "com.provider.Provider1", providerRequestXml : "<info><key value='TEST'/><info>", infoArr : [ { rowIndex : 1, colIndex : 3, rowSpan : 1, colSpan : 2, text : "Data Display" , textAlign : "center" } ] }, { gridId : "grid2", sheetName : "Second sheet", type : "1", removeColumns : "1,3", foldColumns : "2", startRowIndex : 3, startColumnIndex : 0, headerColor : "#DBEEF3", bodyColor : "#92CDDC", dataProvider : "com.provider.Provider1", providerRequestXml : "<info><key value='TEST'/><info>", infoArr : [ { rowIndex : 1, colIndex : 3, rowSpan : 1, colSpan : 2, text : "Data Display" , textAlign : "center" } ] } ] }; WebSquare.util.multipleExcelDownload( options ); (First sheet) A || C D E F ┌──────────────┐┌──────────┬──────┬──────┬──── 1 | || | | | | || ┌──────┴──────┐ 2 | || | Data Display | | || └──────┬──────┘ 3 | || | | | 4 | a || e | | | -> Grid Header. 5 | Renaissance || 20111231 | | | -> Grid Data. 6 | ... (Omitted.) (Second sheet) A || C D E F ┌──────────────┐┌──────────┬──────┬──────┬──── 1 | || | | | | || ┌──────┴──────┐ 2 | || | Data Display | | || └──────┬──────┘ 3 | || | | | 4 | a || e | | | -> Grid Header. 5 | Renaissance || 20111231 | | | -> Grid Data. 6 | ... (Omitted)
next( elem )
Returns the next node that is not a Text node.
Parameter
nametyperequireddescription
elemObjectYObject to check the next node
Return
typedescription
ObjectNext node
Sample
WebSquare.util.next(xmlDoc);
openPopup( url , <Object:Y> , params , target )
Opens a pop-up of the corresponding property. Functions same as createPopup although using different properties.
Parameter
nametyperequireddescription
urlStringYPop-up window URL
<Object:Y>ObjectYoptions Popup options. (width, height, etc.)
<String:N> options.id : [default: ppo1] popup id <String:N> options.type : [default: browser] Popup type - window or browser. When the value is browser, the window will be open by window.open regardless of the useIFrame setting. <String:N> options.width : [default: 500px] Popup width <String:N> options.height : [default: 500px] Popup height <String:N> options.top : [default: 100px] Top value of the popup. In case of useIframe:true, the calculation will be based on the browser, In case of false, the calculation will be based on the monitor. <String:N> options.left : [default: 100px] Left value of the popup. In case of useIframe:true, the calculation will be based on the browser, In case of false, the calculation will be based on the monitor. <String:N> options.popupName : [default: WebSquarePopup] Name of the popup object. To be displayed on the popup frame. <String:N> options.modal : [default: false] Uses the modal and disables the background. In case of false, the components on the background can be used. <String:N> options.useModalStack : [default: false] Activates the last opened popup when there are multiple popups. (true: Activates the last popup only. false: Activates all popups.) (Added in 5.0_1.2701A.20170714.211228.) <String:N> options.useIFrame : [default: false]In case of type:window, true is to use IFrame for the popup and false is to use window.open. <String:N> options.style : [default: ""] Style values of the popup If defined, left, top, width, height settings will not be applied. <String:N> options.srcData : [default: null] Xpath to give to the parent when the popup object type is window. <String:N> options.destData : [default: null] XPath to set in the popup when the popup object type is window. <Object:N> options.dataObject An object containing the data type, data, and the parameter name to set in the popup. (Example) { type: ["xml","string","json","array"], data: "Data" , name :"Parameter name"} <String:N> options.xml : [default: null] xmlDocument string for the popup. Use WebSquare.uiplugin.popup.getPopupParam() to get it from the popup. <String:N> options.resizable : [default: false] Resizability (Valid when useIfrmae is false.) <String:N> options.status : [default: false] status display (In case of useIfrmae:false) <String:N> options.menubar : [default: false] menubar display (In case of useIfrmae:false) <String:N> options.scrollbars : [default: false] scrollbar display (In case of useIfrmae:false) <String:N> options.title : [default: false] title display (In case of useIfrmae:false) <String:N> options.useMaximize : [default: true] Maximization of the title upon the end user’s double-clicking in case of useIFrame:true <String:N> options.closeAction : [default: ""] Name of the function to be called upon the end user’s clicking the Close button in case of useIFrame:true Closes the popup if the user-defined function returns true. <String:N> options.className : [default: ""] userIFrame: Class to apply to the popup design <String:N> options.fullscreen : [default: false] fullscreen: Displays the popup on the full screen (For IE only.) <String:N> options.useControl : [default: false] useControl: true is to use Min, Max, and Close buttons. <String:N> options.foldOnMinimized : [default: false] foldOnMinimize: true is to fold the popup instead of minimizing.
paramsObjectNParameter to send to the popup
targetObjectNwindow object. The default is window.
Sample
var options = { id : "popup1", type : "window", width: "250px", height: "250px", top: "200px", left: "200px", popupName : "Test", modal : true, useIFrame : false, style : "", resizable : true, status : false, menubar : false, scrollbars : false, title : false, xml: empNm, srcData: "", destData: "" }; WebSquare.util.openPopup("/ComponentTest/innerPopup1.xml", options );
parent( elem , num )
Returns the node of the parent node as high as the given number in the HTML element.
Parameter
nametyperequireddescription
elemObjectYObject to check the parent node
numNumberNNumber of the times to check the parent nodes
Return
typedescription
ObjectParent node
Sample
WebSquare.util.parent( xmlDoc, 1)
parseFloat( str , defaultValue )
Calls parseFloat. defaultValue will be given. If the result is NaN, the defaultValue will be returned.
Parameter
nametyperequireddescription
strStringYNumber string
defaultValueNumberNThe default value to return when the result is NaN.
Return
typedescription
NumberNumeric value converted from the string
Sample
var data = WebSquare.util.parseFloat(num, 0);
parseInt( str , defaultValue )
Calls parseInt. defaultValue will be given. If the result is NaN, the defaultValue will be returned.
Parameter
nametyperequireddescription
strStringYNumber string
defaultValueNumberNThe default value to return when the result is NaN.
Return
typedescription
NumberNumeric value converted from the string
Sample
var data = WebSquare.util.parseInt(num, 0);
prev( elem )
Returns the previous node that is not a Text node.
Parameter
nametyperequireddescription
elemObjectYObject to check the previous nodes
Return
typedescription
ObjectPrevious node
Sample
WebSquare.util.prev( xmlDoc);
reinitialize( refresh )
Reloads the page without refreshing the browser, or refreshes the browser.
Parameter
nametyperequireddescription
refreshBooleanNWhether to refresh the browser or not. (The defatul is false.)
Sample
Load the page without refreshing the browser.
WebSquare.util.reinitialize(true); // Refreshes the browser.
removeData( key )
Removes the data of the corresponding key. The lower objects of the data will be removed.
Parameter
nametyperequireddescription
keyStringYKey of the data to delete
Return
typedescription
ObjectData of the specified key
Sample
var itemList = WebSquare.util.getData("item1").itemList;
setData( key , data )
Registers the data of the corresponding key. The data will be registered as a global variable of WebSquare5. Upon the end user's changing pages in the SPA mode, both the key and the data will be automatically set.
Parameter
nametyperequireddescription
keyStringYValue of the key to control the registered data
dataObjectYData to register
Sample
window["common"] = {}; common.itemList = []; common.func = function(){}; WebSquare.util.setData("item1", common);
setDate( str )
Adds / to the date string.
Parameter
nametyperequireddescription
strStringYDate String
Return
typedescription
StringEntered string with '/' added.
Sample
var data = WebSquare.util.setDate ("20120101"); data : 2012/01/01
setDisabled( obj )
Disables the objects under the component.
Parameter
nametyperequireddescription
objObjectYdisabled parameter
<String:N> obj.componentId : Component ID. If empty, body. <boolean:Y> obj.disabled : disabled flag &lt;Array<String>:N> obj.excludeIdList : List of component IDs to exclude. (If not specified, all will be excluded.) &lt;Array<String>:N> obj.includeIdList : List of component IDs to include. (If not specified, all will be included.)
Return
typedescription
Objectobject
<String> object.doneComponents List of the completed components <String> object.skipComponents List of the skipped components because they are already disabled
Sample
WebSquare.util.setDisabled({"componentId":"", "disabled":true}); // All disabled. WebSquare.util.setDisabled({"componentId":"", "disabled":false}); // All enabled. WebSquare.util.setDisabled({"componentId":"", "disabled":true, "excludeIdList": ["output10"]}); // All but output10 disabled. WebSquare.util.setDisabled({"componentId":"", "disabled":true, "includeIdList": ["output1","output2"]}); // Only output1 and output2 disabled.
setDocumentLang( lang )
Sets the language code in the HTML tag.
Parameter
nametyperequireddescription
langStringYLanguage code. (Example) xml:lang="ko"
Sample
WebSquare.util.setDocumentLang("ko");
setDomain( domain )
Sets a domain to support cross-domain on frames and pop-ups.
Parameter
nametyperequireddescription
domainStringYCommon domain
setFullView( zoomResolve )
Sets the fullview feature in the current screen. fullview is to control the zoom feature by calculating the ratio between the reference width/height and the browser width/height.
Parameter
nametyperequireddescription
zoomResolveFunctionYReturns an object containing baseWidth and baseHeight, or a zoom value.
Sample
scwin.zoomResolve = function() { var width = window.innerWidth || document.body.clientWidth; var height = window.innerHeight || document.body.clientHeight; var ratio = height / width; var baseRatio = 0.5625; // In case of 16:9, the ratio between the width and the height is 0.5625. if(ratio > baseRatio) { wrapper.addClass("hideWidget"); return {"baseWidth" : 1440, "baseHeight" : 979}; } else { wrapper.removeClass("hideWidget"); return {"baseWidth" : 1920, "baseHeight" : 979}; } } WebSquare.util.setFullView(zoomResolve);
setInterval( func , options )
Registers a function and regularly executes the function. Upon the end user's changing pages in the SPA mode, the timer registered by setInterval will be cleared.
Parameter
nametyperequireddescription
funcFunctionYFunction to execute
optionsObjectNOptions are as shown below.
<String:N> options.key : timer key If not specified, func.toString().slice(0,30) will be used. <Number:N> options.delay : Second argument of setInterval. The function is executed after the delay time. The default is 1. <Object:N> options.caller : Changes this into Caller within the function. <Object:N> options.args : Arguments of the "func" in the array format. <function:N> options.before_call : The function to be executed right before func. Receives data as arguments. <function:N> options.callback : The function to be executed right after func. Receives the func return as arguments.
Sample
WebSquare.util.setInterval("function(){alert(this.id);}", {caller:grid1, delay:2000, key:"interval1"});
setNumber( str )
Converts to a string by adding a comma to the entered number.
Parameter
nametyperequireddescription
strStringYNumber string
Return
typedescription
StringEntered string with commas
Sample
var data = WebSquare.util.setNumber ( 1234652 ); data : 1,234,652
setTime( str )
Adds : to the time string.
Parameter
nametyperequireddescription
strStringYTime String
Return
typedescription
StringEntered string with ':' added.
Sample
var data = WebSquare.util.setTime ("1123"); data : 11:23
setTimeout( func , options )
Registers a function and executes the function after time-out. Upon the end user's changing pages in the SPA mode, the timer added by this function will be cleared.
Parameter
nametyperequireddescription
funcFunctionYFunction to execute
optionsObjectNOptions are as shown below.
<String:N> options.key : timer key If not specified, func.toString().slice(0,30) will be used. <Number:N> options.delay : The second argument of setTimer. func will be executed after delay time. The default is 1. <Object:N> options.caller : Changes this into Caller within the function. <Object:N> options.args : Arguments of the "func" in the array format. <function:N> options.before_call : The function to be executed right before func. Receives data as arguments. <function:N> options.callback : The function to be executed right after func. Receives the func return as arguments.
Sample
WebSquare.util.setTimeout("function(){alert(this.id);}", {caller:grid1, delay:200, key:timer1});
toHexColor( rgb )
Receives rgb (r, g, b) string and returns the color code in #RRGGBB format.
Parameter
nametyperequireddescription
rgbStringYrgb (r, g, b) string
Return
typedescription
StringColor code in #RRGGBB format
Sample
WebSquare.util.toHexColor("rgb(17,59,158)");
url( w2xPath , options )
Sends only w2xPath for page changing instead of sending the entire URL. Add additional arguments in the options to use the SPA mode.
Parameter
nametyperequireddescription
w2xPathStringYXML file path
optionsObjectNOptions are as shown below.
<Boolean:N> options.spa : When spa is true, w2xPath will be sent as hash (#) upon the end user's changing the pages. Otherwise, w2xPath will be sent as search (?). If SPA option is not specifed, config.xml setting will be used. If SPA setting is not specified in config.xml, SPA setting will be considered as false. <Boolean:N> options.forceReload : Whether to force reloading of the browser after page changing. Relevant only when SPA optionis true. Accumulated page changing on the SPA mode may result in memory leak. In this case, set forceReload as true to reload the browser upon page changing and to initialize the global resources. <Boolean:N> options.replaceHistory : Whether to replace the browser history. When this is true, location.replace will be called. Otherwise, location.assign will be called. <Object:N> options.param : Upon page changing, additional parameters will be set as an array. The object value must be string. <Boolean:N> options.shortURL : Whether to send the w2xPath URL or the entire path starting with http://. If not specified, the WebSquare5 Engine will decide. <String:N> options.transition : Page transition effects upon moving between pages. [fadeout , slideup] <String:N> options.urlHashText : In case of spa = true, the URL can display the hash part in a different way. Note, however, that three characters (?, &amp;, and #) must not be included.
Sample
var param1 = { "name" = "123", "ID"= "asdf" }; var param2 = { "addr" = "abcd", "PW"= "dddx" }; WebSquare.util.url("/folder1/bar.xml", {"spa" : true, "replaceHistory" : true, "param" : param1}); // Send name and ID while moving from bar.xml on SPA. WebSquare.util.url("/folder1/bar.xml", {"spa" : true, "forceReload" : true, "param" : param2}); // Reload the browser and send addr and PW upon moving from bar.xml on SPA. WebSquare.util.url("/folder1/bar.xml", {"spa" : true, "forceReload" : true, "param" : param2,"transition":"fadeout"}); // Move to bar.xml in SPA and reload the browser. Send the addr and PW and create the fading-out effects. WebSquare.util.url("/folder1/bar.xml", {"spa" : true, "urlHashText" : "pId=bar"}); // After page changing in the SPA mode, the URL will be displayed as http://xxx/websquare.html#pId=bar.