Class DashboardController
- Object
-
- 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
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
DashboardController.ControllerItem
static class
DashboardController.ControllerItemType
-
Constructor Summary
Constructors Constructor Description DashboardController()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addBackendCall(String label, String apiUrl)
Performs a backend call in the user's context (i.e.void
addBackendCall(String label, String apiUrl, String payload)
Performs a backend call in the user's context (i.e.void
addBackendCall(String label, String apiUrl, String payload, String successMessage, String failMessage)
Performs a backend call in the user's context (i.e.void
addButton(String label, String targetPage)
Adds a button to the controllervoid
addButton(String label, String targetPage, Object targetPageState)
Adds a button to the controllervoid
addButton(String label, String targetPage, Object targetPageState, Object componentId)
Adds a button to the controllervoid
addDownloadButton(String label, String url)
Performs a backend call in the user's context in new window.void
addDownloadButton(String label, String url, String payload)
Performs a backend call in the user's context in new window.void
addHTML(String html)
Adds a HTML snippet into the controllerList<DashboardController.ControllerItem>
getItems()
String
getResultType()
-
-
-
Method Detail
-
getResultType
public String getResultType()
- Specified by:
getResultType
in interfaceComplexCalculationResult
-
getItems
public List<DashboardController.ControllerItem> getItems()
-
addButton
public void addButton(String label, String targetPage)
Adds a button to the controllerExample:
def controller = api.newController() controller.addButton("1. STEP: Go to Live Price Grids", "priceGridPage")
- Parameters:
label
- The label of the buttontargetPage
- 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 controllerExample:
def controller = api.newController() controller.addButton("2. STEP: Go to LPG ABC", "priceGridPage", "45.PG")
- Parameters:
label
- The label of the buttontargetPage
- The name of the target page. Hint: This is also displayed in the URL after the hash symboltargetPageState
- 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 controllerExample:
def controller = api.newController() controller.addButton("Open Dashboard", "dashboardPage", null, "FirstDash")
- Parameters:
label
- The label of the buttontargetPage
- The name of the target page. Hint: This is also displayed in the URL after the hash symboltargetPageState
- A extra parameter that is used for deep links. E.g. a typed id to open a specific pagecomponentId
- 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 buttonapiUrl
- 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 buttonapiUrl
- The URL to callpayload
- 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 buttonapiUrl
- The URL to callpayload
- The POST data to send along with the requestsuccessMessage
- A text that should be displayed in case of a successful response from the backendfailMessage
- 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 controllerExample:
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 buttonurl
- 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 buttonurl
- The URL to callpayload
- The POST data to send along with the request
-
-