PropertyEventMethodIndex
WebSquare.uiplugin.multiupload - 5.0_1.3015A.20180410.143527

Allows for simultaneous uploading of multiple files. Supports various features through options.

Type

uiplugin

Property Summary

action
URL to upload the files
displaySizeUnit
Unit of the size to be displayed upon completion of uploading (or occurrence of the ondone event) (Byte, KB, MB (Default), GB, TB)
filter
Limits the file types through extensions.
fireEventOnError
Fires onerror event upon an error (file count, file size, existing file, etc.)
id
Component ID
lang
Language
maxcount
Maximum number of files to upload
maxsize
Maximum file size to upload (in Kb)
mode
UI mode
selectCallback
Callback function to execute after file selection. (Valid when the mode is transparent.)
sizeUnit
Unit of the size notified to the server upon completion of uploading (or occurrence of the ondone event) (Byte (Default), KB, MB (Default), GB, TB)
subDir
Name of the node specifying the sub directory.
subSize
Name of the node that saves the maximum upload size in websquare.xml and config.xml.
uploadButton
Hides the uploading button.
userData1
User-defined property
userData2
User-defined property
userData3
User-defined property
wmode
Uses the wmode.

Event Summary

onComplete
Triggered after the uploading process starts.
ondone
Triggered after all files are uploaded.
onerror
Triggered upon a file uploading failure on the client side. (Error types: File count, file size, existing file)

Method Summary

addClass( className )
Adds a class to the component.
bind( eventType , function )
Dynamically allocates events to the component.
browserDisable( disable )
Disables the feature to open the file in the transparent mode.
changeAction( action )
Sets the URL for the MultiUpload object to multi-upload the input.
changeClass( oldClassName , newClassName )
Renames the class from oldClassName to newClassName.
disableCancel( disable )
Disables the Cancel button.
disableUpload( disable )
Disables the Upload button.
dropFiles( e )
A function to support drag&drop feature in the MultiUpload component.
focus( )
Moves the focus to the component.
getFileCount( )
Gets the number of the files to upload.
getFileInfos( )
Gets information of the files in the multi-upload grid as an array.
getFileNames( )
Returns the names of the files waiting for uploading as an array.
getGenerator( )
Called by a component under the Generator component. When called, gets the parent Generator object.
getID( )
Gets the ID of the component.
getOpacity( )
Gets the opacity of the component defined in CSS.
getPluginName( )
Gets the pluginName (or the name) of the component.
getPosition( positionName )
Gets the left or top position of the component.
getReadOnly( )
Gets the current setting of the readOnly property.
getSize( sizeName )
Gets the size of the component.
getStyle( propertyName )
Gets the current value of the propertyName of the component defined in CSS.
getStyleValue( style )
[deprecated] Use getStyle instead.
getTitle( )
Gets the title value.
getUserData( key )
Returns the user-defined property value set by setUserData as the user data or source (page XML).
hasClass( className )
Checks whether the component has className received as a parameter or not.
hide( )
Hides the component.
isUploading( )
Returns the uploading status.
removeAllFiles( )
Removes all file names currently in the Multi-Upload.
removeClass( className )
Removes className from the component.
removeFile( name )
Removes files to exclude from uploading among the files selected for multi-uploading.
setEventPause( evList , flag )
Disables or enables the component event.
setMaxFileCount( value )
Sets the number of the files that can be simultaneously uploaded.
setMaxFileSize( value )
Sets the size of the files that can be simultaneously uploaded.
setMessageDuplicateText( label )
Sets a message to guide that there are overlapping files to be simultaneously uploaded.
setMessageMaxCountText( label )
Sets a message to guide the maximum number of files to be simultaneously uploaded.
setMessageMaxSizeText( label )
Sets a message to guide the maximum size of the files to be simultaneously uploaded.
setOpacity( value )
Sets the opacity of the component.
setParam( index , name , value )
Sets the parameter for file uploading.
setPosition( left , top , mode )
Sets the position (left, top) of the component.
setReadOnly( readOnly )
Controls the "readOnly" property.
setRefCancelText( label )
Sets a message to guide that the multi-uploading is being cancelled.
setRefProgressText( label )
Sets a message to guide that the multi-uploading is under progress.
setRefSuccessText( label )
Sets a message to guide that the multi-uploading is completed.
setSelectCallback( functionName )
Sets the selectCallback function.
setSize( width , heigth )
Sets the size (width, height) of the component.
setStyle( propertyName , value )
Sets the style of the specified property.
setSubDir( subDir )
Sets the subDir path of the MultiUpload.
setUserData( key , value )
Sets the user data in the component.
show( displayType )
Displays the component.
startUpload( )
Starts multi-uploading.
toggleClass( className )
Removes a class named className, or if there is no such a class, adds a class named className.
trigger( type , array )
Triggers a certain event registered for the component.
unbind( type , function )
Removes an event registered for the component.
visible( flag )
[deprecated] Shows/Hides the component, or sets the visible property using setStyle.

Property Detail

action
URL to upload the files
displaySizeUnit
Unit of the size to be displayed upon completion of uploading (or occurrence of the ondone event) (Byte, KB, MB (Default), GB, TB)
(Added in 5.0_1.2701A.20170714.211228.)
filter
Limits the file types through extensions.
fireEventOnError
Fires onerror event upon an error (file count, file size, existing file, etc.)
true: Fires the event.
false (Default): Not fire the event.
id
Component ID
lang
Language
maxcount
Maximum number of files to upload
maxsize
Maximum file size to upload (in Kb)
mode
UI mode
flash : Uses flash (swf).
transparent : Allows the developer to customize the UI in flash mode.
html5_transparent : Functions in flash mode in IE9 and lower versions, and uses XHR for other browsers.
selectCallback
Callback function to execute after file selection. (Valid when the mode is transparent.)
sizeUnit
Unit of the size notified to the server upon completion of uploading (or occurrence of the ondone event) (Byte (Default), KB, MB (Default), GB, TB)
(Added in 5.0_1.2701A.20170714.211228.)
subDir
Name of the node specifying the sub directory. If specified as /websquare/upload/baseDir/"subDirNodeName"/@value in websquare.xml, returns the path. If not specified, the baseDir path will be returned.
subSize
Name of the node that saves the maximum upload size in websquare.xml and config.xml.
(Added in 5.0_1.2701A.20170714.211228.)
uploadButton
Hides the uploading button.
userData1
User-defined property. Use getUserData("userData1") to get the data.
userData2
User-defined property. Use getUserData("userData2") to get the data.
userData3
User-defined property. Use getUserData("userData3") to get the data.
wmode
Uses the wmode. If wmode is true, the component will be displayed above the object tag. Not recommended. (It is recommended to use the wmode of the object tag.)

Event Detail

onComplete
Triggered after the uploading process starts.
ondone
Triggered after all files are uploaded. (data: JSON obejct to be received after file uploading is done.)
Parameter
nametypedescription
dataObjectJSON object returned after uploading is done. [{ deniedFile : new String(), // Name of the file not saved. localFile : new String(), // Local file name of the saved file. deniedCode : new String(), // Failure code (101: Not allowed file type, 102: File size exceeding the limit, 999: Others) key : new String(), // File saving path maxUploadSize : new String(), // Maximum file size to upload (in byte) file : new String(), // Name of the saved file size : new String() // Size of the saved file }]
onerror
Triggered upon a file uploading failure on the client side. (Error types: File count, file size, existing file)
Errors on the server side can be detected through the ondone event.
Parameter
nametypedescription
dataObjectJSON containing uploading failure info { type : string, // Error type. ( fileExist, uploadCountExceed, fileSizeExceed ) message : string, // Error message. }

Method Detail

addClass( className )
Adds a class to the component.
Parameter
nametyperequireddescription
classNameStringYName of the class to add
Sample
// Add oddClass to component input1. input1.addClass("oddClass");
bind( eventType , function )
Dynamically allocates events to the component.
Parameter
nametyperequireddescription
eventTypeStringYName of the event to allocate.
functionFunctionYHandler function of the event to allocate.
Sample
// Define the event handler function for the onclick event in the input component, and bind the function. input1.bind("onclick", function(e){ alert(input1.getValue();})); // Bind commObj.ev_click function for the onclick event with component input1. var commObj = {}; commObj.ev_click = function(e){ alert("click :: "+this.id); }; input1.bind("onclick", commObj.ev_click );
browserDisable( disable )
Disables the feature to open the file in the transparent mode. (For the use in the transparent mode only.)
Parameter
nametyperequireddescription
disableBooleanYdisabled status
Sample
multiupload1.browserDisable(true); Disables file uploading upon clicking of the multi-upload button.
changeAction( action )
Sets the URL for the MultiUpload object to multi-upload the input.
Parameter
nametyperequireddescription
actionStringYURL to multi-upload the files
changeClass( oldClassName , newClassName )
Renames the class from oldClassName to newClassName.
In the default setting, only the classes added by addClass will be applied. In order to directly remove the class defined in the "class" property of the component, add the following setting in config.xml file.
<style><removeDefaultClass value="true" /></style>
Parameter
nametyperequireddescription
oldClassNameStringYName of the class to remove
newClassNameStringYName of the class to add
Sample
// Define a class for the Input component. <xf:input id="input1" style="position: relative;width: 144px;height: 21px;" class="tmpInputClass"></xf:input> // Add the following to config.xml. <style> <removeDefaultClass value="true" /> </style> // Change tmpInputClass class to tmpInputWarninClass. input1.changeClass("tmpInputClass","tmpInputWarninClass");
disableCancel( disable )
Disables the Cancel button.
Parameter
nametyperequireddescription
disableBooleanYstatus
Sample
multiupload1.disableCancel(true); Disable the Cancel button.
disableUpload( disable )
Disable the Upload button.
Parameter
nametyperequireddescription
disableBooleanYstatus
Sample
multiupload1.disableUpload(true); Disable the Upload button.
dropFiles( e )
A function to support drag&drop feature in the MultiUpload component. (Added in 5.0_1.2701A.20170714.211228.)
Parameter
nametyperequireddescription
eDragEventYdragEvent object (Event object)
Sample
fileDropZone.addEventListener("drop", multiupload.dropFiles, false);
focus( )
Moves the focus to the component.
getFileCount( )
Gets the number of the files to upload.
Return
typedescription
NumberNumber of the files to simultaneously upload
Sample
(Example) Tiger.jpg, Lion.jpg var returnValue = multiupload1.getFileCount(); 2 will be returned.
getFileInfos( )
Gets information of the files in the multi-upload grid as an array.
Return
typedescription
Array<Object>Information of the files on the grid
[{ name : new String(), // File name size : new Integer(), // File size (unit: byte). displaySize : new String() // File size to be displayed }]
Sample
(Example) Tiger.jpg, Lion.jpg var returnArr = multiupload1.getFileInfos(); [{name:"Tiger.jpg",size:1024,displaySize:"1Kb"},{name:"Lion.jpg",size:2048,displaySize:"2Kb"}]
getFileNames( )
Returns the names of the files waiting for uploading as an array.
Return
typedescription
ArrayName of the file waiting for uploading
Sample
(Example) Tiger.jpg, Lion.jpg var returnArr = multiupload1.getFileNames(); returnArr.length is 2. returnArr[0] is Tiger.jpg, and returnArr[1] is Lion.jpg.
getGenerator( )
Called by a component under the Generator component. When called, gets the parent Generator object.
Return
typedescription
ObjectParent Generator object
Sample
<w2:generator id="generator1"> <w2:trigger id="trigger1" ev:onclick="scwin.trigger1_onclick"></w2:trigger></w2:generator> scwin.trigger1.onclick = function(){ console.log(this.getGenerator());} // Click trigger1 to display the generator1 object on the console. // See https://inswave.com/jira/browse/WPF-1425.
getID( )
Gets the ID of the component.
Return
typedescription
StringID of the WebSquare5 component
Sample
// The WebSquare5 component dynamically received as a parameter can be used as shown in the following. function fn_validCheck(tmpObj){ // tmpObj has an ID of "input1". var compID = tmpObj.getID(); // (Return Example) "input1" }
getOpacity( )
Gets the opacity of the component defined in CSS.
Return
typedescription
IntegerOpacity
Sample
// Apply opacity CSS to the Input component. <xf:input id="input1" style="position: relative;width: 144px;height: 21px;opacity:0.2;"></xf:input> var returnValue = input1.getOpacity(); // "returnValue" is a real number between 0 and 1. // (Return Value) "0.2"
getPluginName( )
Gets the pluginName (or the name) of the component.
Return
typedescription
StringpluginName of the WebSquare5 component
Sample
// For a WebSquare5 object dynamically received by a common function, conditional statements can be used as shown below. var commObj = {}; commObj.fn_makeReqData = function(tmpObj){ var tmpID = tmpObj.getID(); // Component ID var tmpCompType = tmpObj.getPluginName(); // Component Type if(tmpCompType == "input"){ //..Logic.. }else if(tmpCompType == "gridView"){ //..Logic .. }else{ //..Logic.. } };
getPosition( positionName )
Gets the left or top position of the component. If set by %, the corresponding pixel value will be returned.
Parameter
nametyperequireddescription
positionNameStringY[left,top] Type of the position
Return
typedescription
NumberPosition of the component
Sample
// Apply margin CSS to the Input component. <xf:input id="input1" style="position: relative;width: 144px;height: 21px;margin:10px;"></xf:input> var returnValue = input1.getPosition("top"); // The returnValue will be a position in pixels. // (Return Example) 10
getReadOnly( )
Gets the current setting of the readOnly property.
Return
typedescription
BooleanThe current setting of the readOnly property
Sample
var returnValue = componentId.getReadOnly(); // (Return Example) false
getSize( sizeName )
Gets the size of the component. If set by "%", the corresponding pixel value will be returned.
Parameter
nametyperequireddescription
sizeNameStringY[height, innerHeight, outerHeight, outerMarginHeight, width, innerWidth, outerWidth, outerMarginWidth] Type of the size. For the calculation of each size type, see below.
height : element.clientHeight innerHeight : element.clientHeight + padding outerHeight : element.clientHeight + padding + border outerMarginHeight : element.clientHeight + padding + border + margin width : element.clientWidth innerWidth : element.clientWidth + padding outerWidth : element.clientWidth + padding + border outerMarginWidth : element.clientWidth + padding + border + margin
Return
typedescription
NumberSize of the component
Sample
var returnValue = componentId.getSize("width"); // "returnValue" will be a size in pixels. If set by "%", the corresponding pixel value will be returned. // (Return Example) 100
getStyle( propertyName )
Gets the current value of the propertyName of the component defined in CSS.
Parameter
nametyperequireddescription
propertyNameStringYName of the property in the style
Return
typedescription
StringStyle value
Sample
// Define an Input component. <xf:input id="input1" style="position: relative;width: 144px;height: 21px;"></xf:input> var returnValue = input1.getStyle("width"); // (Return Example) "144px"
getStyleValue( style )
[deprecated] Use getStyle instead.
Gets the current value of the propertyName of the component defined in CSS.
Parameter
nametyperequireddescription
styleStringYName of the property defined in the style
Return
typedescription
StringValue defined in the style property. (In case of a color, the hexcode of the color will be returned.)
getTitle( )
Gets the title value.
Return
typedescription
StringTitle value
Sample
// Define the "title" for the Input component. <xf:input id="input1" style="position: relative;width: 144px;height: 21px;" title="이름 입력"></xf:input> var tmpTitle = input1.getTitle(); // (Return Example ) "Input Name"
getUserData( key )
Returns the user-defined property value set by setUserData as the user data or source (page XML).
Parameter
nametyperequireddescription
keyStringYRandom data key
Return
typedescription
StringData of the corresponding key
Sample
// Apply the customized property (eduTest) to the Input component. <xf:input id="input1" style="position: relative;width: 144px;height: 21px;" eduTest="Hello"></xf:input> input1.getUserData("eduTest"); // (Return Example) "Hello" // Use setUserData. input1.setUserData("eduTest","WebSquare"); input1.getUserData("WebSquare"); // (Return Example) "Hello"
hasClass( className )
Checks whether the component has className received as a parameter or not.
Parameter
nametyperequireddescription
classNameStringYclassName to check
Return
typedescription
BooleanWhether the component has the class or not
Sample
// Define a class for the Input component. <xf:input id="input1" style="position: relative;width: 144px;height: 21px;" class="tmpInputClass"></xf:input> var returnValue = input1.hasClass("tmpInputClass"); // (Return Example) true
hide( )
Hides the component.
he CSS setting will be "display:none;" and "visibility:hidden;".
Sample
componentId.hide();
isUploading( )
Returns the uploading status.
Return
typedescription
BooleanUploading status
Sample
var returnValue = multiupload1.isUploading(); "true" will be returned during uploading.
removeAllFiles( )
"true" will be returned during uploading.
Sample
(Example) Tiger.jpg, Lion.jpg multiupload1.removeAllFiles(); The file list will be removed from the Multi-Upload.
removeClass( className )
Removes className from the component.
In the default setting, only the classes added by addClass will be applied. In order to directly remove the class defined in the "class" property of the component, add the following setting in config.xml file.
<style><removeDefaultClass value="true" /></style>
Parameter
nametyperequireddescription
classNameStringYName of the class to remove
Sample
// Define a class for the Input component. <xf:input id="input1" style="position: relative;width: 144px;height: 21px;" class="tmpInputClass"></xf:input> // Add the following to config.xml. <style> <removeDefaultClass value="true" /> </style> // Remove tmpInputClass class. input1.removeClass("tmpInputClass");
removeFile( name )
Removes files to exclude from uploading among the files selected for multi-uploading.
Parameter
nametyperequireddescription
nameStringYName of the file to remove
Sample
(Example) Tiger.jpg, Lion.jpg multiupload1.removeFile("Tiger.jpg"); Tiger.jpg file will be removed from the list.
setEventPause( evList , flag )
Disables or enables the component event.
Parameter
nametyperequireddescription
evListStringNList of the events. If not specified, all user events of the component will be listed. (Enter null data.)
flagBooleanYtrue is to pause, or false is to cancel pausing.
Sample
input1.setEventPause("onclick", true); // Dynamically pauses the onclick event. input1.setEventPause("onfocus,onblur", false); // Restarts the onfocus and the onblur events. input1.setEventPause(null, true); // Pauses all user events registered for the Input component.
setMaxFileCount( value )
Sets the number of the files that can be simultaneously uploaded.
Parameter
nametyperequireddescription
valueNumberYMaximum number of files that can be simultaneously upladed
Sample
multiupload1.setMaxFileCount(5); Set the maximum number of files as 5.
setMaxFileSize( value )
Sets the size of the files that can be simultaneously uploaded.
Parameter
nametyperequireddescription
valueNumberYMaximum file size (Kb)
Sample
multiupload1.setMaxFileSize(1*1024); Set the maximum file size to upload as 1MB.
setMessageDuplicateText( label )
Sets a message to guide that there are overlapping files to be simultaneously uploaded.
Parameter
nametyperequireddescription
labelStringYMessage to guide overlapping of the files
Sample
multiupload1.setMessageDuplicateText('File overlapping error');
setMessageMaxCountText( label )
Sets a message to guide the maximum number of files to be simultaneously uploaded.
Parameter
nametyperequireddescription
labelStringYGuide message
Sample
multiupload1.setMessageMaxCountText('Maximm number of files to be simultaneously uploaded');
setMessageMaxSizeText( label )
Sets a message to guide the maximum size of the files to be simultaneously uploaded.
Parameter
nametyperequireddescription
labelStringYGuide message
Sample
multiupload1.setMessageMaxSizeText('Maximum file size (byte)');
setOpacity( value )
Sets the opacity of the component.
Parameter
nametyperequireddescription
valueNumberYOpacity value (A real number between 0 and 1)
Sample
componentId.setOpacity(0.45);
setParam( index , name , value )
Sets the parameter for file uploading.
Parameter
nametyperequireddescription
indexNumberYIndex of the parameter
nameStringYName of the parameter
valueStringYValue of the parameter
setPosition( left , top , mode )
Sets the position (left, top) of the component.
Parameter
nametyperequireddescription
leftNumberYLeft position or null.
topNumberYTop position or null.
modeStringN[defulat:absolute, delta] absolute sets the current positions as x and y, and delta adds x and y to the current positions.
Sample
// Set the top position of the component as 100 pixels. componentId.setPosition(null, 100);
setReadOnly( readOnly )
Controls the "readOnly" property. True to enable, or false to disable.
Parameter
nametyperequireddescription
readOnlyBooleanYTrue to enable, or false to disable.
Sample
// Enable the read-only. componentId.setReadOnly(true);
setRefCancelText( label )
Sets a message to guide that the multi-uploading is being cancelled.
Parameter
nametyperequireddescription
labelStringYTitle
Sample
multiupload1.setRefProgressText('CANCEL'); Sets a message to guide that the multi-uploading is under progress.
setRefProgressText( label )
Sets a message to guide that the multi-uploading is under progress.
Parameter
nametyperequireddescription
labelStringYNew text
Sample
multiupload1.setRefProgressText('PROCESSING'); Sets a message to guide that the multi-uploading is under progress.
setRefSuccessText( label )
Sets a message to guide that the multi-uploading is completed.
Parameter
nametyperequireddescription
labelStringYNew text
Sample
multiupload1.setRefSuccessText('DONE'); Sets a message to guide that the multi-uploading is completed.
setSelectCallback( functionName )
Sets the selectCallback function.
Parameter
nametyperequireddescription
functionNameStringYName of the function to be set as selectCallback.
Sample
console.log( typeof newSelectCallback ); // function multiupload1.setSelectCallback("newSelectCallback");
setSize( width , heigth )
Sets the size (width, height) of the component.
Parameter
nametyperequireddescription
widthNumberYComponent width or null
heigthNumberYComponent height or null
Sample
// Set the component height as 100 pixels. componentId.setSize(null,100);
setStyle( propertyName , value )
Sets the style of the specified property.
Parameter
nametyperequireddescription
propertyNameStringYName of the style
valueStringYValue of the style
Sample
// Set the component width as 200px. componentId.setStyle("width", "200px"); // Change the background color to olive. componentId.setStyle("background-color","olive");
setSubDir( subDir )
Sets the subDir path of the MultiUpload.
(Version: Added in 5.0_1.2783B.20170908.145609.)
Parameter
nametyperequireddescription
subDirStringY
setUserData( key , value )
Sets the user data in the component. If the key cannot be set for the component, corresponding logs will be displayed.
Parameter
nametyperequireddescription
keyStringYRandom data key
valueStringYRandom data key
Sample
// Setting a (key, value) pair of ("data", "WebSquare5") in the component. componentId.setUserData("data", "WebSquare"); // Some keys cannot be set for the component. componentId.setUserData("title", "WebSquare"); // (Log Example) !!!WARNING - [title] can't define as UserData
show( displayType )
Displays the component.
The related CSS properties are display and visibility:show;.
Parameter
nametyperequireddescription
displayTypeStringN[default:block ,inline ,none ,""] Value of the Display property.
Sample
// Block the "display" property. componentId.show(); // Enable the "display" property in the class. componentId.show("");
startUpload( )
Starts multi-uploading.
Sample
multiupload1.startUpload();
toggleClass( className )
Removes a class named className, or if there is no such a class, adds a class named className.
In the default setting, only the classes added by addClass can be removed. To remove other classes, add the following setting in config.xml.
<style><removeDefaultClass value="true" /></style>
Parameter
nametyperequireddescription
classNameStringYclassName to set
Sample
// Define a class for the Input component. <xf:input id="input1" style="position: relative;width: 144px;height: 21px;" class="tmpInputClass"></xf:input> // Add the following to config.xml. <style> <removeDefaultClass value="true" /> </style> // Remove tmpInputClass class. input1.toggleClass("tmpInputClass"); // Add tmpInputClass class again. input1.toggleClass("tmpInputClass");
trigger( type , array )
Triggers a certain event registered for the component.
Parameter
nametyperequireddescription
typeStringYName of the event to trigger
arrayArrayNArray of parameters to send to the event handler
Sample
// Trigger the onclick event in the input1 component. input1.trigger("onclick"); // Trigger the onviewchange event in the input component and call the event handler function by sending arguments of (1, 2). input1.trigger("onviewchange", [1,2]);
unbind( type , function )
Removes an event registered for the component.
Parameter
nametyperequireddescription
typeStringNName of the event to remove. If not specified, all events of the components will be removed.
functionFunctionNHandler function of the event to remove. If not specified, all handler functions of the event will be removed.
Sample
// Remove all events registered in the input component. input1.unbind(); // Remove all handler functions of onviewchange event registered in the input component. input1.unbind("onviewchange"); // Remove the func1 event handler of onviewchange event registered for component input1. input1.unbind("onviewchange", func1);
visible( flag )
[deprecated] Shows/Hides the component, or sets the visible property using setStyle.
Sets the visibility of the component style. In case of true, set visible. In case of false, set hidden.
Parameter
nametyperequireddescription
flagBooleanYVisibility (In case of true, set visible. In case of false, set hidden.)