Class DashboardController

  • All Implemented Interfaces:
    Serializable, ComplexCalculationResult

    public class DashboardController
    extends Object
    implements Serializable, ComplexCalculationResult
    This class is used to generate the definition of a so called controller dashboard portlet (or wizard). It consitsts generally out of two elements: HTML snippets and buttons The buttons can trigger UI actions (e.g. opening a page) or backend actions (calling a backend URL)
    See Also:
    Serialized Form
    • Constructor Detail

      • DashboardController

        public DashboardController()
    • Method Detail

      • getResultType

        public String getResultType()
        Specified by:
        getResultType in interface ComplexCalculationResult
      • addButton

        public void addButton​(String label,
                              String targetPage)
        Adds a button to the controller

        Example:

         def controller = api.newController()
         controller.addButton("1. STEP: Go to Live Price Grids", "priceGridPage")
         
        Parameters:
        label - The label of the button
        targetPage - The name of the target page. Hint: This is also displayed in the URL after the hash symbol
      • addButton

        public void addButton​(String label,
                              String targetPage,
                              Object targetPageState)
        Adds a button to the controller

        Example:

         def controller = api.newController()
         controller.addButton("2. STEP: Go to LPG ABC", "priceGridPage", "45.PG")
         
        Parameters:
        label - The label of the button
        targetPage - The name of the target page. Hint: This is also displayed in the URL after the hash symbol
        targetPageState - A extra parameter that is used for deep links. E.g. a typed id to open a specific page
      • addButton

        public void addButton​(String label,
                              String targetPage,
                              Object targetPageState,
                              Object componentId)
        Adds a button to the controller

        Example:

         def controller = api.newController()
         controller.addButton("Open Dashboard", "dashboardPage", null, "FirstDash")
         
        Parameters:
        label - The label of the button
        targetPage - The name of the target page. Hint: This is also displayed in the URL after the hash symbol
        targetPageState - A extra parameter that is used for deep links. E.g. a typed id to open a specific page
        componentId - Some UI actions require a parameter in this field (e.g. opening a specific dashboard)
      • addBackendCall

        public void addBackendCall​(String label,
                                   String apiUrl)
        Performs a backend call in the user's context (i.e. from the browser)

        Example:

         def controller = api.newController()
         controller.addBackendCall("Calculate LPG", "/pricegridmanager.calculate/45")
         
        Parameters:
        label - The label of the button
        apiUrl - The URL to call
      • addBackendCall

        public void addBackendCall​(String label,
                                   String apiUrl,
                                   String payload)
        Performs a backend call in the user's context (i.e. from the browser)
        Parameters:
        label - The label of the button
        apiUrl - The URL to call
        payload - The POST data to send along with the request
      • addBackendCall

        public void addBackendCall​(String label,
                                   String apiUrl,
                                   String payload,
                                   String successMessage,
                                   String failMessage)
        Performs a backend call in the user's context (i.e. from the browser)

        Example:

         def controller = api.newController()
         controller.addBackendCall("Calculate LPG", "/pricegridmanager.calculate/45", null, "OK", "Not OK")
         
        Parameters:
        label - The label of the button
        apiUrl - The URL to call
        payload - The POST data to send along with the request
        successMessage - A text that should be displayed in case of a successful response from the backend
        failMessage - A text that should be displayed in case of a error response from the backend
      • addHTML

        public void addHTML​(String html)
        Adds a HTML snippet into the controller

        Example:

        
         def controller = api.newController()
         controller.addHTML("<h2>Welcome to Price f(x)</h2>")
         
        Parameters:
        html - The html snippet
      • addDownloadButton

        public void addDownloadButton​(String label,
                                      String url)
        Performs a backend call in the user's context in new window. Useful for downloading Excel, PDF
        Parameters:
        label - The label of the button
        url - The URL to call
      • addDownloadButton

        public void addDownloadButton​(String label,
                                      String url,
                                      String payload)
        Performs a backend call in the user's context in new window. Useful for downloading Excel, PDF
        Parameters:
        label - The label of the button
        url - The URL to call
        payload - The POST data to send along with the request