How CustomDisplay
Works
Steps to Display an Object
When displaying an object, MATLAB® determines the state of the object and calls the appropriate method for that state (see Object States That Affect Display).
For example, suppose obj
is a valid scalar object of a class derived from CustomDisplay
. If you type obj
at the command line without terminating the statement with a semicolon:
>> obj
The following sequence results in the display of obj
:
MATLAB determines the class of
obj
and calls thedisp
method to display the object.disp
callssize
to determine ifobj
is scalar or nonscalarWhen
obj
is a scalar handle object,disp
callsisvalid
to determine ifobj
is the handle of a deleted object. Deleted handles in nonscalar arrays do not affect the display.disp
calls the state handler method for an object of the state ofobj
. In this case,obj
is a valid scalar that results in a call to:displayScalarObject(obj)
displayScalarObject
calls the display part-builder methods to provide the respective header, property list, and footer.... header = getHeader(obj); disp(header) ... groups = getPropertyGroups(obj) displayPropertyGroups(obj,groups) ... footer = getFooter disp(footer)
MATLAB follows a similar sequence for nonscalar object arrays and empty object arrays.
In the case of scalar handles to deleted objects, disp
calls the displayScalarHandleToDeletedObject
method, which displays the default text for handles to deleted objects without calling any part-builder methods.
Methods Called for a Given Object State
The following diagram illustrates the methods called to display an object that derives from CustomDisplay
. The disp
method calls the state handler method that is appropriate for the state of the object or object array being displayed.
Only an instance of a handle class can be in a state of scalar handle to a deleted object.