Class DashboardController

Object
AbstractPortletDto
DashboardController
All Implemented Interfaces:
Serializable, AppPages, Portlet, ComplexCalculationResult

public class DashboardController extends AbstractPortletDto implements Serializable, ComplexCalculationResult, AppPages
This class is used to generate the definition of a so-called controller dashboard portlet (or wizard). It consists generally of two types of elements: HTML text snippets, and buttons.
The buttons can trigger UI actions (e.g. opening a page) or backend actions (calling a backend URL). It's also possible to display plain HTML links instead of buttons, with the exact same functionality.
See Also:
  • Constructor Details

    • DashboardController

      public DashboardController()
  • Method Details

    • getResultType

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

      public List<DashboardController.ControllerItem> getItems()
    • 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", controller.PB_LPG_PAGE)
       
      Parameters:
      label - The label of the button
      targetPage - The name of the target page. See predefined constants in AppPages interface.
    • 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", controller.PB_LPG_PAGE, "45.PG")
       
      Parameters:
      label - The label of the button
      targetPage - The name of the target page. See predefined constants in AppPages interface.
      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", controller.DB_DASHBOARDS_PAGE, null, "FirstDash")
       
      Parameters:
      label - The label of the button
      targetPage - The name of the target page. See predefined constants in AppPages interface.
      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)
    • addLink

      public void addLink(String label, String targetPage)
      Adds a link (simple <A> tag) to the controller.

      Note: This is available in Unity UI only. No backporting planned for the Classic UI.

      Example:

      
       def controller = api.newController()
       controller.addLink("1. STEP: Go to Live Price Grids", controller.PB_LPG_PAGE)
       
      Parameters:
      label - The label of the link
      targetPage - The name of the target page. See predefined constants in AppPages interface.
      Since:
      7.0 Bijou
    • addLink

      public void addLink(String label, String targetPage, Object targetPageState)
      Adds a link (simple <A> tag) to the controller.

      Note: This is available in Unity UI only. No backporting planned for the Classic UI.

      Example:

      
       def controller = api.newController()
       controller.addLink("2. STEP: Go to LPG ABC", controller.PB_LPG_PAGE, "45.PG")
       
      Parameters:
      label - The label of the link
      targetPage - The name of the target page. See predefined constants in AppPages interface.
      targetPageState - An extra parameter that is used for deep links. E.g. a typed id to open a specific page
      Since:
      7.0 Bijou
    • addLink

      public void addLink(String label, String targetPage, Object targetPageState, Object componentId)
      Adds a link (simple <A> tag) to the controller.

      Note: This is available in Unity UI only. No backporting planned for the Classic UI.

      Example:

      
       def controller = api.newController()
       controller.addLink("Open Dashboard", controller.DB_DASHBOARDS_PAGE, null, "FirstDash")
       
      Parameters:
      label - The label of the link
      targetPage - The name of the target page. See predefined constants in AppPages interface.
      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)
      Since:
      7.0 Bijou
    • 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 an HTML snippet into the controller.

      Example:

      
       def controller = api.newController()
       controller.addHTML("<h2>Welcome to Pricefx</h2>")
       
      Parameters:
      html - The html snippet.
      Since:
      11.1 - Paper Plane
    • addCollapsibleHTML

      public void addCollapsibleHTML(boolean isCollapsed, String sectionLabel, String html)
      Adds an HTML snippet into the controller as a collapsible section.

      Example:

      
       def controller = api.newController()
       controller.addHTML(false, "section 1", "<h2>Welcome to Pricefx</h2>")
       
      Parameters:
      isCollapsed - boolean flag indicating initial state collapsed if isCollapsible == true
      sectionLabel - label of the collapsible section
      html - The html snippet
      Since:
      11.1 - Paper Plane
    • 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