new Engine()
- Description:
Main UI Controller with abstract view to display components.
- Controller implements the UI logic with interactions between components (list, form, menu...) and the data (ajax).
- It does not contain UI drawing and must load the view service to display controls.
- Each View engine implements the UI interfaces (without data access) and interacts with the controller (to access to data).
Members
app
- Description:
Ajax session
Ajax session
grant
- Description:
User rights
User rights
nav
- Description:
Main navigation
Main navigation
options
- Description:
global options: merge of the launch parameters with Simplicite.UI.Globals
global options: merge of the launch parameters with Simplicite.UI.Globals
view
- Description:
View: main renderer
View: main renderer
Methods
addLocalLogin(g)
- Description:
Add the connected login to local storage
Parameters:
Name | Type | Description |
---|---|---|
g |
Object | grant |
applyConstraints(ctn, obj, elt, index, context, cbk)
- Description:
Apply constraints
Parameters:
Name | Type | Description |
---|---|---|
ctn |
jQuery | Container |
obj |
Simplicite.UI.BusinessObject | Object |
elt |
string | Optional DOM element (input, select, textarea) with data {field, index} |
index |
string | Optional editlist line index (row Id or creation index 00 01...) |
context |
number | Optional context (default Simplicite.CONTEXT_UPDATE) |
cbk |
function | Optional callback |
bind(name, fn)
- Description:
Bind one UI action with implementation
Parameters:
Name | Type | Description |
---|---|---|
name |
string | action name |
fn |
function | handler |
bindChange(ctn, obj, selector)
- Description:
Attach change event to fields
- set the hasChanged on object
- apply related constraints
- exclude elements with class
js-ignore-haschanged
Parameters:
Name | Type | Description |
---|---|---|
ctn |
jQuery | Container of inputs, selects and textareas |
obj |
Simplicite.UI.BusinessObject | Simplicite.Ajax.BusinessProcess | Object or Process |
selector |
string | Optional selector (default: input, select and textarea) |
bindEnabled(name, enable)
- Description:
Enable action binding
Parameters:
Name | Type | Description |
---|---|---|
name |
string | Action name |
enable |
boolean | True to activate / false to disable binding |
bindGenericActions()
- Description:
Bind generic actions (create, copy, delete...)
bindSaveAndQuit(ctn, obj, save)
- Description:
Manage the save and close when fields have changed
Parameters:
Name | Type | Description |
---|---|---|
ctn |
jQuery | Container |
obj |
Simplicite.UI.BusinessObject | Simplicite.Ajax.BusinessProcess | Object or Process |
save |
function | Save handler |
canCloseContent(ctn, cbk)
- Description:
Checks if the content can close
Parameters:
Name | Type | Description |
---|---|---|
ctn |
jQuery | Container |
cbk |
function | Callback if the content can close |
changeLang(lang, pref)
- Description:
Change user's language on server side and reload the page
Parameters:
Name | Type | Description |
---|---|---|
lang |
string | Language FRA, ENU... |
pref |
boolean | true to update also the preferred language |
clickDocument(doc)
- Description:
Click on a document: open the document
Parameters:
Name | Type | Description | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
doc |
Object | Document data Properties
|
clickImage(doc)
- Description:
Click on image: default open a dialog with the image
Parameters:
Name | Type | Description | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
doc |
Object | Image data Properties
|
clickMenu(item)
- Description:
Main menu handler
Parameters:
Name | Type | Description | |||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
item |
Object | Menu item Properties
|
clickShortcut(item)
- Description:
Shortcut handler
Parameters:
Name | Type | Description |
---|---|---|
item |
Item |
closeForm(ctn)
- Description:
Close the object form: default going back in navigation
Parameters:
Name | Type | Description |
---|---|---|
ctn |
jQuery | Container |
contentClose(ctn, cbk)
- Description:
Force to close a content and destroy components
Parameters:
Name | Type | Description |
---|---|---|
ctn |
jQuery | Container |
cbk |
function | Callback when done |
contentLoaded(ctn, onload, onunload, params)
- Description:
Prepare content handlers
Parameters:
Name | Type | Description |
---|---|---|
ctn |
jQuery | Container |
onload |
function | Optional load handler |
onunload |
function | Optional unload handler |
params |
Object | Optional context parameters (workflow) |
contentUnload(ctn, cbk)
- Description:
Unload the container = destroy embedded components (editors...)
Parameters:
Name | Type | Description |
---|---|---|
ctn |
jQuery | Container |
cbk |
function | Callback when done |
countList(ctn, obj, options, cbk)
- Description:
Count rows with context and filters
Parameters:
Name | Type | Description |
---|---|---|
ctn |
string | jQuery | Container |
obj |
string | Simplicite.UI.BusinessObject | Name or Business Object |
options |
Simplicite.UI.Globals.list | Options to override Globals |
cbk |
function | Optional callback(obj) to read obj.count |
countReference(obj, parent, cbk)
- Description:
Count references of a parent object in PANELLIST context
Parameters:
Name | Type | Description |
---|---|---|
obj |
string | Referenced object name or business object |
parent |
Object | Specify the parent object and the foreign-key |
cbk |
function | Callback(obj, count) |
doAction(a, obj, rowId)
- Description:
Execute one action
Parameters:
Name | Type | Description |
---|---|---|
a |
Object | Action metadata |
obj |
Simplicite.UI.BusinessObject | Business object |
rowId |
string | Optional object row ID on form/row |
doActionCustom(a, obj, rowId, values, cbk)
- Description:
Execute a custom/backend action (object.action call) after saving the form
Parameters:
Name | Type | Description |
---|---|---|
a |
Object | Action metadata |
obj |
Simplicite.UI.BusinessObject | Business object |
rowId |
string | Optional object row ID on form/row |
values |
Object | Optional confirm field values |
cbk |
function | Optional callback(msg) |
doActionGeneric(a, obj, rowId)
- Description:
Execute a generic/UI action (all binded implementations)
Parameters:
Name | Type | Description |
---|---|---|
a |
Object | Action metadata |
obj |
Simplicite.UI.BusinessObject | Business object |
rowId |
string | Optional object row ID on form/row |
doActionModel()
- Description:
Wrap "open model" actions
doActionURL(a, obj, rowId)
- Description:
Wrap a backend URL action to front
Parameters:
Name | Type | Description |
---|---|---|
a |
Object | Action metadata |
obj |
Simplicite.UI.BusinessObject | Business object |
rowId |
string | Optional object row ID on form/row |
getAjax()
- Description:
Current ajax session (deprecated use getApp)
- Deprecated:
- Yes
Returns:
Simplicite.Ajax instance
getApp()
- Description:
Current ajax session
Returns:
Simplicite.Ajax instance
getGrant()
- Description:
Get user rights
getLocalLogins()
- Description:
All logins from local storage
getNav(c)
- Description:
Get container navigator, default returns the main navigation of #work area
Parameters:
Name | Type | Description |
---|---|---|
c |
string | jQuery | Component or selector |
Returns:
Simplicite.UI.Navigator instance
getNavContainer(c)
- Description:
Find the closest container with a navigator
Parameters:
Name | Type | Description |
---|---|---|
c |
string | jQuery | component |
getUIAction(ctn, obj, action)
- Description:
Gets the action with UIAction interface
Parameters:
Name | Type | Description |
---|---|---|
ctn |
string | jQuery | Container |
obj |
Simplicite.UI.BusinessObject | Object |
action |
Object | Action metadata or name |
getUIArea(ctn, obj, area)
- Description:
Gets the area with UIArea interface
Parameters:
Name | Type | Description |
---|---|---|
ctn |
string | jQuery | Container |
obj |
Simplicite.UI.BusinessObject | Object |
area |
Object | Area metadata or name or position |
getUIField(ctn, obj, field, index, silent)
- Description:
Gets the field extended with the UIField interface
Parameters:
Name | Type | Description |
---|---|---|
ctn |
string | jQuery | Container |
obj |
Simplicite.UI.BusinessObject | Object |
field |
string | Simplicite.Ajax.ObjectField | Object field or name |
index |
string | Optional for multiple inputs of the same field (edit list) |
silent |
boolean | No trace when field is unknown |
getUIView(ctn, obj, view)
- Description:
Gets the view with UIView interface
Parameters:
Name | Type | Description |
---|---|---|
ctn |
string | jQuery | Container |
obj |
Simplicite.UI.BusinessObject | Optional object |
view |
Object | View metadata or name |
initConfirmAction(a, obj, rowId, run, cancel)
- Description:
Init and confirm one action
Parameters:
Name | Type | Description |
---|---|---|
a |
Object | Action metadata |
obj |
Simplicite.Ajax.BusinessObject | Business object |
rowId |
string | Optional object row ID on form/row |
run |
function | Optional callback to execute the confirmed action |
cancel |
function | Optional callback to cancel the action |
isActionBinded(a)
- Description:
Is action binded ?
Parameters:
Name | Type | Description |
---|---|---|
a |
Object | Action metadata |
Returns:
True if the action is binded
isBinded(name)
- Description:
Is UI action binded and enabled ?
Parameters:
Name | Type | Description |
---|---|---|
name |
string | Action name |
Returns:
True if the action is enabled
keepAlive(enable, obj, id)
- Description:
Keep the session alive during data updates (used by form and edit list) and refresh object usage by other people
Parameters:
Name | Type | Description |
---|---|---|
enable |
boolean | true to start the timer, false to stop |
obj |
string | optional object name to get usage |
id |
string | optional rowId |
linkedLists(ctn, obj, field, code, index, cbk, all)
- Description:
Reload the linked lists of an enum field
Parameters:
Name | Type | Description |
---|---|---|
ctn |
string | jQuery | Container |
obj |
Simplicite.UI.BusinessObject | Object |
field |
Simplicite.Ajax.ObjectField | Enum field |
code |
string | Array | Selected value(s) |
index |
string | Edit list index |
cbk |
function | Callback |
all |
boolean | Get all values when code is empty (case of a search field) |
onFollow(method, param, cbk)
- Description:
Follow service wrapper
Parameters:
Name | Type | Description |
---|---|---|
method |
string | Method name |
param |
string | Mmethod param |
cbk |
function | Optional callback |
openObject(ctn, obj, rowId, params)
- Description:
Open handler (on a list row or summary): default switch to open object form, reference, doc or image
Parameters:
Name | Type | Description | ||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
ctn |
string | jQuery | Container |
||||||||||||||||||||||||||||||
obj |
Simplicite.UI.BusinessObject | String | Target object or name |
||||||||||||||||||||||||||||||
rowId |
string | Target row ID |
||||||||||||||||||||||||||||||
params |
Object | Optional parameters Properties
|
populateAction(ctn, obj, refField, refId, action, cbk)
- Description:
Populate the referenced fields of action
Parameters:
Name | Type | Description |
---|---|---|
ctn |
string | jQuery | Container |
obj |
Simplicite.UI.BusinessObject | Object |
refField |
string | Foreign key field |
refId |
string | Reference row ID, or null to reset referenced fields |
action |
Object | Current action on object |
cbk |
function | Optional callback |
populateReference(ctn, obj, refField, refId, index, cbk, noChange, userKey)
- Description:
Populate the referenced fields
Parameters:
Name | Type | Description |
---|---|---|
ctn |
string | jQuery | Container |
obj |
Simplicite.UI.BusinessObject | Object |
refField |
string | Foreign key field |
refId |
string | Reference row ID, or null to reset referenced fields |
index |
string | Optional row index (edit list) |
cbk |
function | Optional callback |
noChange |
boolean | Optional to bypass change events on each fields |
userKey |
boolean | Optional to get foreign user-key |
previewDocument(doc, options)
- Description:
Preview a document: default open a dialog with the preview
Parameters:
Name | Type | Description | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
doc |
Object | Document data Properties
|
||||||||||||||||||
options |
Object | Options Properties
|
readForm(ctn, obj, index)
- Description:
Read all form fields into object fields (async/file reading)
Parameters:
Name | Type | Description |
---|---|---|
ctn |
string | jQuery | Container to find fields |
obj |
Simplicite.UI.BusinessObject | Business object |
index |
string | Optional index (list edit) |
Returns:
Promise
reloadForm(ctn)
- Description:
Reload the object form: default reload navigation
Parameters:
Name | Type | Description |
---|---|---|
ctn |
jQuery | Container |
removeLocalLogin(login)
- Description:
Remove a login from local storage
Parameters:
Name | Type | Description |
---|---|---|
login |
string | remove all logins if null |
saveField(obj, rowId, field, index)
- Description:
Save one object field
Parameters:
Name | Type | Description |
---|---|---|
obj |
Simplicite.UI.BusinessObject | Business object |
rowId |
String | Record Id to update |
field |
Simplicite.Ajax.ObjectField | Field definition |
index |
String | Row index |
Returns:
Promise
saveForm(ctn, obj, params)
- Description:
Save the object form
Parameters:
Name | Type | Description |
---|---|---|
ctn |
jQuery | Container |
obj |
Simplicite.UI.BusinessObject | Business object |
params |
Object | Optional parameters (parent) |
Returns:
Promise with messages or catch errors
saveList(ctn, obj, params)
- Description:
Save the object list
Parameters:
Name | Type | Description |
---|---|---|
ctn |
jQuery | List container |
obj |
Simplicite.UI.BusinessObject | Business object |
params |
Object | Optional parameters (parent) |
Returns:
Promise with optional results { messages, errors }
saveObject(ctn, obj, index, params)
- Description:
Save the object after reading UI values
Parameters:
Name | Type | Description |
---|---|---|
ctn |
jQuery | Container |
obj |
Simplicite.UI.BusinessObject | Business object |
index |
string | Optional index/row ID in list |
params |
Object | Optional parameters (parent, inline) |
Returns:
Promise with messages or errors
setApp()
- Description:
Set ajax session
setCompletionMinSize(size)
- Description:
Completion minimum size to trigger the search
Parameters:
Name | Type | Description |
---|---|---|
size |
number | Positive number (0 = disable) |
setGrant()
- Description:
Set user rights
setNav()
- Description:
Set main navigation
setView()
- Description:
Set the View engine
speechAssist(options, cbk)
- Description:
Speech assistant (experimental)
Parameters:
Name | Type | Description | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object | Options Properties
|
||||||||||||||||||||||||
cbk |
function | Callback(assist) |
speechRecognition(el, options)
- Description:
Speech recognition
Parameters:
Name | Type | Description | |||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
el |
Object | Element input or textarea |
|||||||||||||||||||||||||||||||||||||||
options |
Object | Options Properties
|
speechSynthesis(el, options)
- Description:
Speech synthesis
Parameters:
Name | Type | Description | ||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
el |
Object | Text or input or textarea |
||||||||||||||||||||||||||||||
options |
Object | Options Properties
|
unbind(name)
- Description:
Unbind one UI action
Parameters:
Name | Type | Description |
---|---|---|
name |
string | Action name |
undoRedo(ctn, action, num, url)
- Description:
Undo/Redo service
Parameters:
Name | Type | Description |
---|---|---|
ctn |
string | jQuery | Target container |
action |
string | Undo|redo |
num |
string | Number of iterations (default 1) |
url |
string | Optional URL to reload after server call (else use response url) |