classdef {class_name} < handle
    methods
        function obj = {class_name}(parent)
            import simian.gui.*;
            
            % Add components from JSON definition.
            parent.addFromJson(mfilename("fullpath") + ".json");
        end
    end
    
    % methods (Static)
    %     function composed = create(key, parent, options)
    %         % Create the composed component.
    %         %
    %         % Call to create and initialize the composed component programatically. It creates the
    %         % composed component placeholder and adds it to the parent component. Then it loads the
    %         % composed component by setting its className property. Lastly, a call to the component
    %         % initialization is made to pass the (optional) parameters.
    %         %
    %         % Usage:
    %         %     {class_name}.create("key", form, FirstParameter="Your name", SecondParameter="Click me!")
    
    %         arguments
    %             key
    %             parent
    %             options.FirstParameter  (1, 1) string = missing
    %             options.SecondParameter (1, 1) string = missing
    %         end
    
    %         import simian.gui.*;
    %         import {module_name}.*;
    
    %         % Create the composed component.
    %         composed            = component.Composed(key, parent);
    %         composed.className  = "{module_name}.{class_name}";
    
    %         {class_name}.initializeComponent(composed, options.FirstParameter, options.SecondParameter);
    %     end
    
    %     function initializer = getComponentInitializer(options)
    %         % Get a component initializer with enclosed parameters.
    %         %
    %         % To be able to parametrize composed components that are loaded from a Json form definition,
    %         % use the Form.componentInitializer. This function is an example of how to pass (optional)
    %         % parameters to an initialization function.
    %         %
    %         % Usage:
    %         %     In guiInit add the component initializer before creating the form from Json:
    %         %
    %         %     Form.componentInitializer(...
    %         %         key={class_name}.getInitializer(FirstParameter="Your name", SecondParameter="Click me!"));
    %         %
    %         %     Replace "key" with the actual key of the composed component.
    
    %         arguments
    %             options.FirstParameter  (1, 1) string = missing
    %             options.SecondParameter (1, 1) string = missing
    %         end
    
    %         import {module_name}.*;
    
    %         % Return the initializer with the enclosed parameters.
    %         initializer = @(comp) {class_name}.initializeComponent(comp, options.FirstParameter, options.SecondParameter);
    %     end
    % end
    
    % methods (Static, Hidden)
    %     function initializeComponent(comp, firstParameter, secondParameter)
    %         % Initialize the component using the parameters.
    %         %
    %         % This function is an example of how to use parameters to initialize a composed component. In
    %         % this example the parameters are used to set the labels of the two components.
    
    %         [firstComponent, secondComponent] = comp.components{{:}};
    
    %         if ~ismissing(firstParameter)
    %             firstComponent.label = firstParameter;
    %         end
    
    %         if ~ismissing(secondParameter)
    %             secondComponent.label  = secondParameter;
    %         end
    %     end
    % end
end
