classdef UserInterface< handle
%USERINTERFACE Provides User-Interface utilities for an SLSimApp app
%   
%   Examples of these utilities are: plotting selected signals,
%   plotting a specific signal, clearing a plot or a table, etc.
%   
%   User Interface operations are intended to be performed by an SLSimApp
%   app in the app's .mlapp file in App Designer.
% 
%   UserInterface is created by SimulationHelper and is made available
%   through a public property with the same name. SimulationHelper serves
%   as a common utility class for performing app-related task and is
%   intended for use in SLSimApps to facilitate app development.
% 
%   Usage:
% 
%   The example below shows how to obtain a UserInterface from
%   SimulationHelper and use it to create a SimulationInput.
%   
%   (app = SLSimApp generated using the genapp command)
% 
%   Example:
%       >> import simulink.compiler.app.SimulationHelper;
%       >> simHelper = SimulationHelper(app);
%       >> userInterface = simHelper.UserInterface;
%       >> userInterface.clearAllPlots();
% 
%   See also simulink.compiler.genapp,
%   SIMULINK.COMPILER.APP.SIMULATIONHELPER, INPUTOUTPUT, WORKSPACE, BINDER

 
%   Copyright 2020 The MathWorks, Inc.

    methods
        function out=anySignalsSelected(~) %#ok<STOUT>
            %ANYSIGNALSSELECTED Determine if there any selected signals in the
            %provided component that are plotted on the provided axes.
            %
            %   Accepts a component that lists signals and a
            %   matlab.ui.control.UIAxes handle where the signals are plotted.
            %
            %   See also matlab.ui.control.UIAxes
        end

        function out=clearAllPlots(~) %#ok<STOUT>
            %CLEARALLPLOTS clear all plots in the app
        end

        function out=clearGridAndLegend(~) %#ok<STOUT>
            %CLEARGRIDANDLEGEND Turn the grid off and hide the legend.
            %
            %   Accepts a matlab.ui.control.UIAxes handle and turns the x
            %   and y grids and legend off for the provided UIAxes.
            %
            % See also matlab.ui.control.UIAxes
        end

        function out=clearPlotLinesForSelectedSignals(~) %#ok<STOUT>
            %CLEARPLOTLINESFORSELECTEDSIGNALS clear plot lines
            %corresponding to the selected signals in the listing component.
            %
            %   clearPlotLinesForSelectedSignals retrieves the signals
            %   specified by the selected indexes in the listing component
            %   and clears them.
            %
            %   It accepts a component that lists signals and a
            %   matlab.ui.control.UIAxes handle where the signals are plotted.
            %
            %   See also matlab.ui.control.UIAxes
        end

        function out=clearSignalAtIndex(~) %#ok<STOUT>
            %CLEARSIGNALATINDEX clear the plotted signal located at the
            %specified row index in the listing component.
            %
            %   clearSignalAtIndex retrieves the signal specified by
            %   the index and clears it.
            %
            %   It accepts a component that lists signals, index of the
            %   signal to clear, and a matlab.ui.control.UIAxes handle 
            %   where the signal is plotted.
            %
            %   See also matlab.ui.control.UIAxes
        end

        function out=deselectAllTableRows(~) %#ok<STOUT>
            %DESELECTALLTABLEROWS deselect all row entries in a table.
            %
            %    --------------------        --------------------
            %   |  -  |    Signal    |      |  -  |    Signal    |
            %    --------------------        --------------------
            %   | [x] |     one      |      | [ ] |     one      |
            %    --------------------   ==>  --------------------
            %   | [x] |     two      |      | [ ] |     two      |
            %    --------------------        --------------------
            %   | [x] |    three     |      | [ ] |    three     |
            %    --------------------        --------------------
            %
            %   Accepts a matlab.ui.control.Table handle with a column
            %   specified by a Data.selected logical array and deselects
            %   all rows.
            %
            % See also matlab.ui.control.Table
        end

        function out=getSelectedSet(~) %#ok<STOUT>
            % GETSELECTEDSET return selected set for the specified app
            % config type.
            %
            %   Accepts the name of an app config type and returns the
            %   selected set (from the bound component) for that config
            %   type.
            %
            %   Supported app config types are:
            %   - InitialState
            %   - ExternalInput
            %   - ReferenceWorkspaceVariable
            %
            %   Example:
            %
            %   If the app maintainer binds external input sets loaded from
            %   a MAT-file to a dropdown component as follows:
            %
            %     app.SimulationHelper.Binder.bindToExternalInputSets(...
            %       app.SelectExtInpsSetDropDown);
            %
            %   they can then call getSelectedSet to obtain the set
            %   corresponding to the name selected in that dropdown:
            %
            %     [set, setName] = ...
            %       app.SimulationHelper.UserInterface.getSelectedSet(...
            %       'ExternalInput');
            %
            %   See also Binder
        end

        function out=getSelectedSetName(~) %#ok<STOUT>
            % GETSELECTEDSETNAME return selected set name for the specified
            % app config type.
            %
            %   Accepts the name of an app config type and returns the
            %   selected set name (from the bound component) for that
            %   config type.
            %
            %   Supported app config types are:
            %   - InitialState
            %   - ExternalInput
            %   - ReferenceWorkspaceVariable
            %
            %   Example:
            %
            %   If the app maintainer binds external input sets loaded from
            %   a MAT-file to a dropdown component as follows:
            %
            %     app.SimulationHelper.Binder.bindToExternalInputSets(...
            %       app.SelectExtInpsSetDropDown);
            %
            %   they can then call getSelectedSetName to obtain the name of
            %   the selected set from that dropdown:
            %
            %     setName = ...
            %       app.SimulationHelper.UserInterface.getSelectedSetName(...
            %       'ExternalInput');
            %
            %   See also Binder
        end

        function out=guardedCellVariableUpdate(~) %#ok<STOUT>
            %GUARDEDCELLVARIABLEUPDATE Tries to update a variable-holding
            %table cell or restores original value if it can't.
            %
            %    --------------------------
            %   |    myVar   |  old_value  |  <-- new_value
            %    --------------------------
            %                /              \
            %          Success              Failure
            %      v.Name = 'myVar'     v.Name = 'myVar'
            %     v.Value = new_value  v.Value = old_value
            %       error = []           error = <error>
            %
            %   Accepts a cell update event and tries to evaluate the new
            %   data held in that event. If evaluation succeeds, it returns
            %   a struct with the variable's name in its Name field and the
            %   new data in its Value field. An empty error is returned in
            %   this case. If evaluation fails, it returns the old value in
            %   the Value field and sets the error output to the error that
            %   was thrown.
        end

        function out=plotExternalInputSignalAtIndex(~) %#ok<STOUT>
            %PLOTEXTERNALINPUTSIGNALATINDEX plot external input signal
            %located at the specified row index in the listing component.
            %
            %   plotExternalInputSignalAtIndex retrieves the signal
            %   specified by the index and plots it.
            %
            %   It accepts a component that lists external input signals,
            %   index of the signal to plot, and a matlab.ui.control.UIAxes
            %   handle to plot the signal on.
            %
            %   See also matlab.ui.control.UIAxes
        end

        function out=plotLoggedSignalAtIndex(~) %#ok<STOUT>
            %PLOTLOGGEDSIGNALATINDEX plot logged signal located at the
            %specified row index in the listing component.
            %
            %   plotLoggedSignalAtIndex retrieves the signal specified by
            %   the index and plots it.
            %
            %   It accepts a component that lists logged signals, index of
            %   the signal to plot, and a matlab.ui.control.UIAxes handle
            %   to plot the signal on.
            %
            %   See also matlab.ui.control.UIAxes
        end

        function out=plotSelectedExternalInputSignals(~) %#ok<STOUT>
            %PLOTSELECTEDEXTERNALINPUTSIGNALS plot external input signals
            %selected in the listing component.
            %
            %   plotSelectedExternalInputSignals retrieves selected signals
            %   from the listing component and plots them.
            %
            %   It accepts a component that lists external input signals
            %   and a matlab.ui.control.UIAxes handle to plot the signals on.
            %
            %   See also matlab.ui.control.UIAxes
        end

        function out=plotSelectedLoggedSignals(~) %#ok<STOUT>
            %PLOTSELECTEDLOGGEDSIGNALS plot logged signals selected in the
            %listing component.
            %
            %   plotSelectedLoggedSignals retrieves selected signals
            %   from the listing component and plots them.
            %
            %   It accepts a component that lists logged signals and a
            %   matlab.ui.control.UIAxes handle to plot the signals on.
            %
            %   See also matlab.ui.control.UIAxes
        end

        function out=refreshAxes(~) %#ok<STOUT>
        end

        function out=reportError(~) %#ok<STOUT>
            %REPORTERROR Display a modal with an error message.
            %
            %   Accepts an MException object and displays its error message
            %   in a modal window.
            %
            %   See also MException, uialert
        end

        function out=setStatusMessage(~) %#ok<STOUT>
            %SETSTATUSMESSAGE display a message representing simulation
            %status using the component bound to App status updates.
            %
            %   Accepts a string message to display in the component bound
            %   to App status updates in the app's .mlapp file. Bound
            %   component must have a Text and/or Tooltip property,
            %   otherwise, nothing will be displayed.
            %
            % See also Binder
        end

    end
end
