public class BaseWidget extends Object implements Widget
Modifier and Type | Field and Description |
---|---|
static BBjString |
BASIS_DASHBOARD_UTILITY_FILL_ERROR_ACTION_KEY_NAME$
Name of STBL key whose value can be set to determine how widgets react to fill errors, overriding the default value.
|
BBjImage |
CachedImage!
Saves out the last known good state of the widget into a BBjImage for use later on when loading the widget/dashboard
|
DashboardWidget |
DashboardWidget!
Internal field variable used to associate the parent DashboardWidget with this widget.
|
BBjNumber |
FillErrorAction
Determines how the dashboard should react after encountering an error filling a widget.
|
static BBjNumber |
ON_FILL_ERROR_IGNORE
A constant to define how the dashboard handles widget fill errors - This value indicates it should ignore the error and proceed as normal (note that all errors are logged to the BBjServices debug log file).
|
static BBjNumber |
ON_FILL_ERROR_STOP
A constant to define how the dashboard handles widget fill errors - This value indicates it should THROW the error which usually results in the program stopping (note that all errors are logged to the BBjServices debug log file).
|
static BBjNumber |
ON_FILL_ERROR_WARN
A constant to define how the dashboard handles widget fill errors - This value indicates it should warn the user then proceed as normal (note that all errors are logged to the BBjServices debug log file.
|
Object |
UserData!
Contains user-settable data for the widget
|
Modifier and Type | Method and Description |
---|---|
BBjNumber |
active()
Returns the active status of the widget
|
void |
destroy()
Destroys the widget
|
BBjString |
getClientSlash()
Returns the client's path separator: "\" for Windows and "/" for all other operating systems
|
BBjNumber |
getFillError()
Gets the number of the last error that occurred when filling the widget.
|
BBjString |
getFillErrorDesc()
Gets the description of the last error that occurred when filling the widget.
|
BBjImage |
getImage(BBjString p_imageName!)
Returns an image specified in the provided path.
|
BBjImage |
getImage(Object p_object!,
BBjString p_defaultImagePath!,
Object p_widget!)
Gets an image from the provided file path or Java URL.
|
BBjString |
imageFileSaveDialog()
Displays a file save dialog to save a client image file.
|
BBjNumber |
isDestroyed()
Determins if the widget is destroyed
|
void |
logError(BBjNumber p_errorNumber,
BBjString p_errorMessage$,
BBjNumber p_lineNumber)
This is the common method that handles errors for the widgets.
|
BBjString |
name()
Returns the name of the widget
|
BBjImage |
previewImage()
Returns the preview image of the widget
|
BBjString |
previewText()
Returns the preview text of the widget
|
void |
setActive(BBjNumber p_active)
An internal method that sets the active status of the widget based on its parent
|
void |
setFillErrorDisplayImage(BBjString p_imageFile$)
Sets the image that will appear in the widget if it experiences an error upon creation or filling its dataset
|
void |
setFillErrorDisplayText(BBjString p_displayText$)
Sets the text that will appear in the widget if it experiences an error filling its underlying dataset
|
void |
setLastSaveDir(BBjString p_lastSaveDir$)
Sets the last save directory used.
|
BBjNumber |
spacesValid()
Determines if spaces are valid on the client OS as part a file name.
|
BBjString |
title()
Returns the title of the widget
|
public DashboardWidget DashboardWidget!
public Object UserData!
public BBjImage CachedImage!
public BBjNumber FillErrorAction
This numeric field variable defaults to Widget.getON_FILL_ERROR_IGNORE() (0), meaning that if an error occurs when filling the widget with data the program will silently log the error then continue to run normally. This prevents an entire dashboard application from failing when there is a problem with one widget. The behavior can be set using static field variables like Widget.getON_FILL_ERROR_IGNORE(), Widget.getON_FILL_ERROR_WARN(), or Widget.getON_FILL_ERROR_STOP().
The FillErrorAction can be set programmatically on a Widget, Dashboard Category, or Dashboard object. If you set the FillErrorAction on a Dashboard object, all added DashboardCategories and their Widgets will inherit the setting. If you set the FillErrorAction on a DashboardCategory object, all added Widgets will inherit the setting.
Here is an example showing how to set the behavior in code via a widget:
widget!.setFillErrorAction(Widget.getON_FILL_ERROR_WARN())
Note that you may also set the "BASIS_DASHBOARD_UTILITY_FILL_ERROR_ACTION" global string entry
either via code or in a configuration file to control the behavior. If the FillErrorAction is set
via a global string it will override all default and programmatically set values for all widgets.
Here are two examples showing how to set the FillErrorAction via a global string:
1) Setting the global string entry in code, before creating any dashboards or widgets:
temp$ = STBL("BASIS_DASHBOARD_UTILITY_FILL_ERROR_ACTION", "1")
2) Setting the global string entry in the config file, without changing any code:
SET BASIS_DASHBOARD_UTILITY_FILL_ERROR_ACTION = 1
public static BBjNumber ON_FILL_ERROR_IGNORE
public static BBjNumber ON_FILL_ERROR_WARN
public static BBjNumber ON_FILL_ERROR_STOP
public static BBjString BASIS_DASHBOARD_UTILITY_FILL_ERROR_ACTION_KEY_NAME$
public void logError(BBjNumber p_errorNumber, BBjString p_errorMessage$, BBjNumber p_lineNumber)
As of BBj 18.20, the routine will behave differently based on the widget's FillErrorAction. It always logs the error information, but depending on the FillErrorAction it may quietly ignore the error and continue, warn the user of the error and continue, or THROW the error and stop. See the BaseWidget's FillErrorAction field for more information.
p_errorNumber
- The error numberp_errorMessage$
- The error messagep_lineNumber
- The line number on which the error occurredpublic BBjImage getImage(BBjString p_imageName!)
public BBjImage getImage(Object p_object!, BBjString p_defaultImagePath!, Object p_widget!)
You may either provide a fully-qualified path or a relative path based on the prefix for the first parameter. You may pass in null() or a valid widget for the last parameter. If the widget parameter is valid, the method will log a Dashboard Utility error with an error code of 320 and set the widget's error code and description accordingly.
p_object!
- An image identifier, which is typically a string corresponding to the image path or a Java URL containing the path to the imagep_defaultImagePath!
- A string path to a BBjImage that will be loaded as a fallback if the desired image cannot be loaded or does not resolve to a valid imagep_widget!
- A dashboard widget correlated to the image. If this parameter not null(), then the error code and description will be assigned to the widget.URL documentation for more information.
public void setActive(BBjNumber p_active)
p_active
- The active status of the widget, 0 = inactive, 1 = activepublic BBjNumber active()
public BBjString name()
public BBjString title()
public BBjNumber isDestroyed()
isDestroyed
in interface Widget
public BBjImage previewImage()
Widget
previewImage
in interface Widget
public BBjString previewText()
Widget
previewText
in interface Widget
public BBjString getClientSlash()
public BBjNumber spacesValid()
public void setLastSaveDir(BBjString p_lastSaveDir$)
p_lastSaveDir$
- Specifies the last save diretorypublic BBjString imageFileSaveDialog()
public void setFillErrorDisplayImage(BBjString p_imageFile$)
As of BBj 18.20, it's possible for a dashboard to continue after a widget experiences a fill error. Given the nature of the fill error, the widget may be entirely empty or may contain only partial data. To signify that the widget has incomplete data, you may specify an image or text that will be placed on top of the widget. If a custom error image or text is not set then the widget will display a default error indicator.
See Also: BaseWidget::setFillErrorDisplayText()
p_imageFile$
- A string with the path to an image to display over the widget. The path may be fully qualified or rely on the prefix.public void setFillErrorDisplayText(BBjString p_displayText$)
As of BBj 18.20, it's possible for a dashboard to continue after a widget experiences a fill error. Given the nature of the fill error, it may be entirely empty or may contain only partial data. To signify that the widget has incomplete data, you may specify an image or text that will be placed on top of the widget. Note that all chart customizations, such as background images and gradients, will still be honored and the text will be placed on top of the regularly rendered chart.
See Also: BaseWidget::setFillErrorDisplayImage()
p_displayText$
- A string with the text to display instead of the empty chartpublic BBjNumber getFillError()
public BBjString getFillErrorDesc()