- Source:
Methods
clearError()
Put the view in the normal state, but only if the current state is qui.views.STATE_ERROR
.
- Source:
clearProgress()
Put the view in the normal state, but only if the current state is qui.views.STATE_PROGRESS
.
- Source:
clearWarning()
Put the view in the normal state, but only if the current state is qui.views.STATE_WARNING
.
- Source:
close()
Close the view.
By default does nothing.
Override this method to implement your own close behavior.
- Source:
enterState(oldState, newState)
Define the behavior of the view when entering states. Entering a state usually means showing a visual element corresponding to that state.
Parameters:
Name | Type | Description |
---|---|---|
oldState |
String | |
newState |
String |
- Source:
getErrorMessage() → (nullable) {String}
Return the error message set with qui.views.ViewMixin#setError
or null
if no error message was set.
An exception will be thrown if the current view state is not qui.views.STATE_ERROR
.
- Source:
Returns:
- Type
- String
getHTML() → {jQuery}
Return the HTML element of this view.
- Source:
Returns:
- Type
- jQuery
getProgressPercent() → (nullable) {Number}
Return the current progress percent.
An exception will be thrown if the current view state is not qui.views.STATE_PROGRESS
.
- Source:
Returns:
- Type
- Number
getState() → {String}
Return the current view state.
- Source:
Returns:
- Type
- String
getWarningMessage() → (nullable) {String}
Return the warning message set with qui.views.ViewMixin#setWarning
or null
if no warning message
was set.
An exception will be thrown if the current view state is not qui.views.STATE_WARNING
.
- Source:
Returns:
- Type
- String
hasError() → {Boolean}
Tell if the view is currently in the error state (its state is qui.views.STATE_ERROR
).
- Source:
Returns:
- Type
- Boolean
hasHTML() → {Boolean}
Tells if the HTML element of this view has been created.
- Source:
Returns:
- Type
- Boolean
hasWarning() → {Boolean}
Tell if the view is currently in the warning state (its state is qui.views.STATE_WARNING
).
- Source:
Returns:
- Type
- Boolean
hideError()
Hide a previously displayed error.
qui.views.ViewMixin#hasError
returns false
when called from this method.
By default calls qui.messages.toast.hide
. Override this method to implement your own error
hiding.
- Source:
hideProgress()
Hide a previously displayed progress, re-enabling user interaction.
qui.views.ViewMixin#inProgress
returns false
when called from this method.
Does nothing by default. Override this method to implement your own progress hiding.
- Source:
hideWarning()
Hide a previously displayed warning.
qui.views.ViewMixin#hasWarning
returns false
when called from this method.
By default calls qui.messages.toast.hide
. Override this method to implement your own warning
hiding.
- Source:
init()
Initialize the view. Called after the HTML has been created and initialized.
- Source:
initHTML(html)
Override this to further initialize the HTML element of this view.
Parameters:
Name | Type | Description |
---|---|---|
html |
jQuery | the HTML element to be initialized |
- Source:
inProgress() → {Boolean}
Tell if the view is currently in progress (its state is qui.views.STATE_PROGRESS
).
- Source:
Returns:
- Type
- Boolean
isClosed() → {Boolean}
Tell if the view has been closed.
By default returns false
.
Override this method to implement your own closed status.
- Source:
Returns:
- Type
- Boolean
leaveState(oldState, newState)
Define the behavior of the view when leaving states. Leaving a state usually means hiding a visual element corresponding to that state.
Parameters:
Name | Type | Description |
---|---|---|
oldState |
String | |
newState |
String |
- Source:
(abstract) makeHTML() → {jQuery}
Create the HTML element of this view.
- Source:
Returns:
- Type
- jQuery
setError(messageopt)
Put the view in the error state or updates the error message.
The view state is set to qui.views.STATE_ERROR
.
It is safe to call this method multiple times, updating the error message.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
message |
String | Error |
<optional> |
null | an error message |
- Source:
setProgress(percentopt, nullable)
Put the view in the progress state or updates the progress. The view state is set to
qui.views.STATE_PROGRESS
.
It is safe to call this method multiple times, updating the progress percent.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
percent |
Number |
<optional> <nullable> |
null | optional progress percent (from |
- Source:
setState(state)
Update the current state.
Parameters:
Name | Type | Description |
---|---|---|
state |
String | the desired state |
- Source:
setWarning(messageopt, nullable)
Put the view in the warning state or updates the warning message. The view state is set to
qui.views.STATE_WARNING
.
It is safe to call this method multiple times, updating the warning message.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
message |
String |
<optional> <nullable> |
null | an optional warning message |
- Source:
showError(messagenullable)
Define how the view is displayed in error state, showing the error message.
qui.views.ViewMixin#hasError
returns true
when called from this method.
By default displays a error toast message. Override this method to implement your own error display.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
message |
String |
<nullable> |
the error message, or |
- Source:
showProgress(percentopt, nullable)
Define how the view is displayed in progress state, disallowing any user interaction.
qui.views.ViewMixin#inProgress
returns true
when called from this method.
Does nothing by default. Override this method to implement your own progress display.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
percent |
Number |
<optional> <nullable> |
optional progress percent (from |
- Source:
showWarning(messagenullable)
Define how the view is displayed in warning state, showing the warning message.
qui.views.ViewMixin#hasWarning
returns true
when called from this method.
By default displays a warning toast message. Override this method to implement your own warning display.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
message |
String |
<nullable> |
the warning message, or |
- Source: