IlvObject

IlvObject
Category:
Common component
JavaScript File:
IlvUtil.js
Description:
The base class for all JavaScript classes. To create a subclass of an IlvObject (or any of its subclasses), do the following:
 1 - Define a constructor for your new class. For example:
           function MySubclass (params) {
             // Call the super constructor.
             this.superConstructor(params);
             // Some additional initialization code.
           }
 
2 - Make it a subclass of MySuperclass, (note that the following code will not work if MySuperclass is not IlvObject or one of its subclasses). For example:
           IlvObject.inherits(MySuperclass, MySubclass);
 
3 - Define additional methods. For example:
           MySubclass.prototype.foo = function (bar) {
             // Some code.
           }
 
4 - Override, if necessary, some methods of the superclass. For example:
           MySubclass.prototype.setSize = function (width, height) {
             this.superInvoke("setSize",width,height);
             // Some additional code.
           }
 

Constructor Summary
IlvObject()

Method Summary
callDispose()
Disposes all user objects that have been registered by calling the IlvObject.prototype.registerDispose method.
dispose()
Disposes of all resources being used by this object.
getClassName()
Returns the class name of this object.
hashCode()
Returns a hash code value for this object.
inherits(parent, sub, className)
Make sure the sub class inherits from the parent class.
instanceOf(clazz)
Returns true if this object is an instance of the given class, or false otherwise.
invoke(method, param1, paramn)
Invokes the provided method for this object.
registerDispose()
Registers the object's dispose method to be called when the IlvObject.callDispose() function is invoked.
removeHTML()
Erase the printed HTML content of the object The SubClasses with HTML Elements such as IlvHTMLPanel should override this method
setClassName(className)
Sets the class name of this object.
superConstructor(param1, paramn)
Invokes the constructor of the superclass on this object.
superInvoke(method, param1, paramn)
Invokes a method of the superclass on this object.
toString()
Returns a string representation of this object.
updateVisibility()
Update the visibility state of the component.

Constructor Detail

IlvObject

IlvObject()
Creates an instance of IlvObject.

Method Detail

callDispose

static callDispose()
Disposes all user objects that have been registered by calling the IlvObject.prototype.registerDispose method. This method invokes the IlvObject.prototype.dispose method of each registered object. This method must be called on the onunload event of the page.

dispose

dispose()
Disposes of all resources being used by this object. This default implementation does nothing. Subclasses should override this method in order to remove cyclic references between an object and the DOM. Such cyclic references between user objects and the DOM might prevent proper GC in some browsers, particularly IE.

If a subclass instance contains references to DOM entities, that class should override this method and make sure to call superInvoke like this:

  MySubclass.prototype.dispose = function() {
    this.superInvoke("dispose");
    this.aDOMElement = null;
    // Remove any other references to DOM entities.
  }
 
The subclass instance must also register to have its dispose method invoked. This is done by calling the registerDispose method at the end of the subclass constructor:
  function MySubclass(params) {
    this.superConstructor(params);
    // Initialize the instance.
    this.registerDispose();
  }
 
Finally, you must make sure to call the IlvObject.callDispose() function on the onunload event of the page:
  <body onunload="IlvObject.callDispose()">
 
This will be done for you when using the JSF components.

getClassName

getClassName()
Returns the class name of this object.

hashCode

hashCode()
Returns a hash code value for this object.

inherits

static inherits(parent, sub, className)
Make sure the sub class inherits from the parent class. The method parameter can be the name of the method or a function.
Parameters:
parent - The super class.
sub - The sub class.

Since:
JViews 8.1


instanceOf

instanceOf(clazz)
Returns true if this object is an instance of the given class, or false otherwise. If the given class is undefined, this method also returns false.

invoke

invoke(method, param1, paramn)
Invokes the provided method for this object. When the code in the body of this method is executed, the this keyword refers to this object.
Parameters:
method - The method to be invoked on this object. The method parameter can be the name of the method or a function.
param1....paramn - The parameters to be used when the method is invoked.

registerDispose

registerDispose()
Registers the object's dispose method to be called when the IlvObject.callDispose() function is invoked.

removeHTML

removeHTML()
Erase the printed HTML content of the object The SubClasses with HTML Elements such as IlvHTMLPanel should override this method

setClassName

setClassName(className)
Sets the class name of this object. Never call this method, unless you are creating a new class and using this object as its prototype.

superConstructor

superConstructor(param1, paramn)
Invokes the constructor of the superclass on this object.
Parameters:
param1....paramn - The parameters to be used when the method is invoked.

superInvoke

superInvoke(method, param1, paramn)
Invokes a method of the superclass on this object. This method is especially useful when overriding an implementation of a given method. This is a convenience method; the following two statements are equivalent:
 anObject.superInvoke("theMethod", someParameters);
 anObject.invoke("superClass.prototype.theMethod", someParameters);
 
Note: There is a constraint; the method using superInvoke cannot be recursive.
Parameters:
method - The name (a string) of the superclass method to be invoked.
param1....paramn - The parameters to be used when the method is invoked.

toString

toString()
Returns a string representation of this object. This implementation returns "theClassName_theHashCode".

updateVisibility

updateVisibility()
Update the visibility state of the component. This method is used with IlvPanel.visibilityLock boolean. If this boolean is not defined (default behavior) object.setVisible directly update the visibility of the component. If this boolean is set to true, a call to object.setVisible will update the visible state but not the concrete HTML visible state. A call to updateVisibility will show the HTML of the visible objects after setting IlvPanel.visibilityLock to false. This mechanism is used to hide the components until the appropriate moment to show them occurs.