Class: Widget

settings/js/widget. Widget

<abstract> new Widget(options)

Base class for widgets. Extend this to add your own functionality

Parameters:
Name Type Description
options WidgetOptions

Options for the widget

Source:

Extends

  • Backbone.View

Members

className :string

Classes applied to the widget. Override if using Bootstrap 3

Type:
  • string
Default Value:
  • row-fluid accordion-group
Source:

controlGroupClass

Class applied to control groups. Set to 'form-group' if using Bootstrap 3

Default Value:
  • control-group
Source:

errorClass

Class used to indicate failed validation. Set to 'has-error' if using Bootstrap 3

Default Value:
  • error
Source:

formControlClass

Class applied to form controls. Set to 'form-control' if using Bootstrap 3

Default Value:
  • ''
Source:

successClass

Class used to indicate successful validation. Set to 'has-success' if using Bootstrap 3

Default Value:
  • success
Source:

widgetTemplate :module:settings/js/widget.Widget~WidgetTemplate

Base template for the widget. Override if using Bootstrap 3

Type:
Source:

Methods

<abstract> getConfig()

Returns the config associated with the widget

Source:

getName() → {string}

Gets the name for the widget

Deprecated:
  • Users of this class do not need to call this
Source:
Returns:

this.serverName, or this.configItem if serverName is undefined

Type
string

handleInputChange()

Handler for change events on any inputs in the widget. Calls hideValidationInfo and
setValidationFormatting

Source:

<abstract> handleValidation(config, response) → {boolean}

Handles the results of server side validation (several widgets have a Test Connection button to do
this). Override this method if your widget needs server side validation

Parameters:
Name Type Description
config object

The configuration object for the widget

response ValidationResponse

The validation response from the server

Source:
Returns:

True if the widget is valid; false otherwise

Type
boolean

hideValidationInfo()

Hides any validation information (elements with the settings-client-validation class)

Source:

render()

Renders the widget

Source:

setValidationFormatting(state)

Removes this.successClass and this.errorClass from elements in the widget with this.controlGroupClass.

If state === 'clear', remove successClass and errorClass from this.$el. Otherwise adds the given class
and removes the other class

Parameters:
Name Type Description
state string

clear to remove classes, otherwise this.successClass or this.errorClass to add that
class and remove the other class

Source:

<abstract> shouldValidate() → {boolean}

Returns false by default; override it to return true if your widget needs client side validation

Source:
Returns:

True if the widget should validate; false otherwise

Type
boolean

<abstract> updateConfig()

Updates the state of the widget. Subclasses should override this method, call this method and then
perform additional operations

Source:

<protected> updateInputValidation($input, isValid)

Updates the formatting of the given input

If isValid is true, removes errorClass from the input and hides elements with the class
settings-client-validation

If isValid is false, adds errorClass to the input and shows elements with the class
settings-client-validation

Parameters:
Name Type Description
$input jQuery

The input to apply the classes to

isValid boolean

True if the input is valid; false otherwise

Source:

<abstract> validateInputs() → {boolean}

Validates the inputs in the widget. Default implementation just returns true - override if you need
validation. This method should perform any formatting required to display the validation failure.

Source:
Returns:

True if the widget is valid; false otherwise

Type
boolean

Type Definitions

WidgetTemplate(parameters)

Parameters:
Name Type Description
parameters WidgetTemplateParameters
Source:
Copyright 2013--2018 Micro Focus International plc. Licensed under the MIT License (the "License"); you may not use this file except in compliance with the License.
Documentation generated by JSDoc 3.4.3 on Fri Jun 22nd 14:40 2018 using the DocStrap template.