Class DisplayAPI

Index Home MAE > MAE Architecture > MAE Data Types > Class Index > Class DisplayAPI

Summary
Public Methods
static bool setfield(device, table, field, value)
static bool settext(device, text, style)
static bool write(device, text, style)
static bool writeln(device, text, style)
static bool writewiki(device, text)
static bool addhotspot(device, text, action, cbdata, style)
static bool addhinttext(device, text)
static bool button(device, text, action, cbdata)
static bool format(device, control, on)
static bool newregion(device, newtag, styleName, size)
static bool style(device, styleName)
static bool attention(device, text)
static bool selection(device, value)
static bool chat(device, from, text)
static bool clear(device)
static bool show(device)
static bool hide(device)
static bool newtable(device, tableName, tableType, rows, columns)
static bool newlist(device, name, items)
static bool record(device, recordName, idmap, values, overwrite)
static bool report(device, reportName, table, table_id)
static bool prompt(device, query, value, promptType, xid, style)
static bool select(device, option0, options, xid, selected)
static bool checkbox(device, query, value, xid, style)
static bool textarea(device, text, xid, style, saveLabel)
static bool form(device, formName, vars, xid)
static bool screen(device, name, rows, columns)
static bool scrattr(device, attributes)
static bool scrchar(device, row, column, letter, amount)
static bool setmenu(device, menu, option, command)
static bool unsetmenu(device, menu, option)
static bool setwindow(device, windowName)
static bool unsetwindow(device, windowName)
static bool setindex(device, indexName)
static bool unsetindex(device, indexName)
static bool newsection(device, title, sectionType, newtag)
static bool collapseSection(device)
static bool expandSection(device)
static bool displayImage(device, imageName, image_type, action, cbdata, append)
static bool displayImage(device, image_id, action, cbdata, append)
static bool playAudio(device, audioName)
static bool download(device, query, fileclass, xid)
static bool upload(device, imageName, image_type)
static bool imagelibpre(device, id)
static bool bufimage(device, imageName, image_type, width, height, size, binary, chunk, totalChunks, chunksize, data)
static bool setvar(device, variable, value)
static bool getvar(device, variable, value)
static bool run(device, appname, startParams)
static bool stop(device)
static bool userAccountChange(userId, action, value)
static bool registerApp(appmode, apptype, action, contentInputType, contentOutputType, operations, msgchannel, privatePages)
static bool startraw(device, statusCode, contentType)
static bool writeraw(device, text, isBinary)
static bool closeraw(device)
static bool send(request, params)

#include <DisplayAPI.h >

Summary

This class is used by other apps to send messages to the display channel.

Use this interface instead of sending messages directly to ensure message keywords are spelled correctly, all parameters are specified, and error checked.

The receiving app defined this interface to ensure it receives the messages correctly.

Public Methods

static bool setfield(device, table, field, value)

const UserDevice& device

the end-user's device

const string& table

the area with a collection of fields in it

const string& field

the specific field within that area

const string& value

the string to display


Update/Replace the table and field entry with the value provided

Return value: true if sent successfully

static bool settext(device, text, style)

const UserDevice& device

the end-user's device

const string& text

the text to put there

const string& style

display style for the text


Replace the display region with the text provided.

Return value: true if sent successfully

static bool write(device, text, style)

const UserDevice& device

the end-user's device

const string& text

the text to append

const string& style

display style for the text


Append to the display reagion with the provided text for the user specified

Return value: true if sent successfully

static bool writeln(device, text, style)

const UserDevice& device

the end-user's device

const string& text

the text to append

const string& style

display style for the text


Append to the display reagion with the provided text for the user specified, followed by a line break.

Return value: true if sent successfully

static bool writewiki(device, text)

const UserDevice& device

the end-user's device

const string& text

the text to append


Convert the text from wiki text (see wiki2doc) and display to the display region.

Return value: true if sent successfully

static bool addhotspot(device, text, action, cbdata, style)

const UserDevice& device

the end-user's device

const string& text

the text to append

const string& action

the message keyword to send when user clicks on text (aka request)

const XMLData& cbdata

data to send along with action message

const string& style

the preset way to display the text (color, font, etc)


Append the tagged area with the provided text for the user specified and make it a hot spot that triggers an action.

Return value: true if sent successfully

static bool addhinttext(device, text)

const UserDevice& device

the end-user's device

const string& text

the hint text to show the user


Provide hint text to the end-user for the display region. Exact implementation up to the end interface, but it may be to display text when the user hovers over the display region.

Return value: true if sent successfully

static bool button(device, text, action, cbdata)

const UserDevice& device

the end-user's device

const string& text

the text on the button

const string& action

the message keyword to send when user clicks on text (aka request)

const XMLData& cbdata

data to send along with action message


Append the tagged area with the provided text on a button for the user on the device specified. When clicked, it triggers a a message with the action and callback data.

static bool format(device, control, on)

const UserDevice& device

the end-user's device

const string& control

the UI state keyword to update, e.g. strong, emphasis, bold, italic, underline, color:color

bool on

flag to say turn the control on or off


DEPRECATED - use style() instead.  Update the current display style state.

Return value: true if sent successfully

static bool newregion(device, newtag, styleName, size)

const UserDevice& device

the end-user's device

const string& newtag

the new region's name

const string& styleName

the preset way to display the text (color, font, etc)

int size

the number of characters wide for the new region (suggestion)


Create a new display region inside device's current display region.

Return value: true if sent successfully

static bool style(device, styleName)

const UserDevice& device

the end-user's device

const string& styleName

the new region's name


Set the named display style for device's current display region.  See the configured properties of the style in the appropriate end-user display type (e.g. usergw uses HTML CSS).

Return value: true if sent successfully

static bool attention(device, text)

const UserDevice& device

the end-user's device

const string& text

the text for the user to see


Display a message to get the user's attention.

Return value: true if sent successfully

static bool selection(device, value)

const UserDevice& device

the end-user's device

const string& value

the value to show on the selector


When a display region contains a selector, set the active selection to the value provided. If the value is not a valid selection, behavior is undefined.

Return value: true if sent successfully

static bool chat(device, from, text)

const UserDevice& device

the end-user's device

const string& from

name of user whom the message is from

const string& text

the message to display


Send a chat message to the end-user's device.

Return value: true if sent successfully

static bool clear(device)

const UserDevice& device

the end-user's device


Clear all displayed objects and text from the current display region of the device.

Return value: true if sent successfully

static bool show(device)

const UserDevice& device

the end-user's device


Display the objects and text inside the current display region of the device.

Return value: true if sent successfully

static bool hide(device)

const UserDevice& device

the end-user's device


Hide the objects and text inside the current display region of the device. Make them non-visible.

Return value: true if sent successfully

static bool newtable(device, tableName, tableType, rows, columns)

const UserDevice& device

the end-user's device

string tableName

the name of the table

const string& tableType

the type of table, e.g. left, center, right

int rows

the number of rows in the table

int columns

the number of columns in the table


Create a table display region on the user'd device. It will be setup with the rows and columns specified.  Note that referencing one column more to the right will create that column; and referencing one more row below will create that row.

Return value: true if sent successfully

static bool newlist(device, name, items)

const UserDevice& device

the end-user's device

string name

the name of the list

int items

a count of the expected number of list items (suggestion)


Create a bulleted list that can contains items. Note that adding a list item immediately beyond the end will expand the list.

Return value: true if sent successfully

static bool record(device, recordName, idmap, values, overwrite)

const UserDevice& device

the end-user's device

const string& recordName

the record template's name (this corresponds to a file under .../html/record)

const HashArray& idmap

(optional) mapping of template field names to actual ids to use

const HashArray& values

key/value paris of id/values to fill in values in the record

bool overwrite

flag: true to replace existing display region, false to append

Default value: true


Output a record of information using a templte to map old UI ids to new ones.  For idmap, the key is the old id and the value is the new id

Return value: true if sent successfully

static bool report(device, reportName, table, table_id)

const UserDevice& device

the end-user's device

const string& reportName

the name of the report to output

const string& table

the name of the table to ...?

DbRecNum table_id

the id for the table ...?


FUTURE USE.  Output a report of information

Return value: true if sent successfully

static bool prompt(device, query, value, promptType, xid, style)

const UserDevice& device

the end-user's device

const string& query

(optional) the question text for the user

const string& value

the default value

const string& promptType

the type of prompt, e.g. text, yn, int, etc.

DbRecNum xid

a transaction id maintained by the calling app (guibroker)

const string& style

the style to use for the query


Present the user with a question and response (text entry) box. The xid parameter ties back to the appropriate response action and callback data to use when replying (see GuiAPI).

Return value: true if sent successfully

static bool select(device, option0, options, xid, selected)

const UserDevice& device

the end-user's device

const string& option0

The visible question that is the first option on the list - and the default if no value is given.  If the user actually selects this option, the app will be given the value $NA

const HashArray& options

the list of options to show the user.  They key is show; the value is returned as the reply.

DbRecNum xid

a transaction id maintained by the calling app (guibroker)

const string& selected

the selected option


Present the user with a selection of choices.  The xid parameter ties back to the appropriate response action and callback data to use when replying (see GuiAPI).

Return value: true if sent successfully

static bool checkbox(device, query, value, xid, style)

const UserDevice& device

the end-user's device

const string& query

(optional) the question text for the user

const string& value

the default value

DbRecNum xid

a transaction id maintained by the calling app (guibroker)

const string& style

the style to use for the query


Present the user with a selection of choices as checkboxes.  The xid parameter ties back to the appropriate response action and callback data to use when replying (see GuiAPI).

Return value: true if sent successfully

static bool textarea(device, text, xid, style, saveLabel)

const UserDevice& device

the end-user's device

const string& text

the initial text in the box

DbRecNum xid

a transaction id maintained by the calling app (guibroker)

const string& style

the style to use for the query

const string& saveLabel

the label on the button for the user to click on to send the revised text


Present the user with an area to type a lot of text.  The xid parameter ties back to the appropriate response action and callback data to use when replying (see GuiAPI).

Return value: true if sent successfully

static bool form(device, formName, vars, xid)

const UserDevice& device

the end-user's device

const string& formName

the name of the form (relates to .../html/form files)

const HashArray& vars

key/value paris of id/values to fill in default values

DbRecNum xid

a transaction id maintained by the calling app (guibroker)


Present the user with input form template.  The xid parameter ties back to the appropriate response action and callback data to use when replying (see GuiAPI).

Return value: true if sent successfully

static bool screen(device, name, rows, columns)

const UserDevice& device

the end-user's device

const string& name

the name of the screen for reference

int rows

number of rows in the screen

Default value: 25

int columns

the number of columns in the screen

Default value: 80


Create a terminal screen of the specified size on the user's device.

Return value: true if sent successfully

static bool scrattr(device, attributes)

const UserDevice& device

the end-user's device

const string& attributes

a comma separated list of styles, e.g. cursor, bold, underline, reverse, red, blue, etc


Set the current terminal screen attributes for the next character(s) to be written.

Return value: true if sent successfully

static bool scrchar(device, row, column, letter, amount)

const UserDevice& device

the end-user's device

int row

the terminal row

int column

the terminal column

int letter

a numerical value for the letter to write, e.g. ASCII. Note that letters 0-31 are non-printable.

int amount

the number of letters to write out (repeating letters)

Default value: 1


Write a character to the terminal screen previously defined at device's display region.

Return value: true if sent successfully

static bool setmenu(device, menu, option, command)

const UserDevice& device

the end-user's device

const string& menu

the menu heading that contains menu options

const string& option

the menu option text

const string& command

the request keyword to send to the app


Configure the end-user's device with the menu option under the specified menu.  When the end-user selects it, the specified command will be sent as a message request of the app.

Return value: true if sent successfully

static bool unsetmenu(device, menu, option)

const UserDevice& device

the end-user's device

const string& menu

the menu heading that contains menu options

const string& option

the menu option text


Remove the menu option under the specified menu on the end-user's device.

Return value: true if sent successfully

static bool setwindow(device, windowName)

const UserDevice& device

the end-user's device

const string& windowName

the name of the window; it appears as the window's title


Configure the end-user's device with a window, titled with the name provided.

Return value: true if sent successfully

static bool unsetwindow(device, windowName)

const UserDevice& device

the end-user's device

const string& windowName

the name of the window; it appears as the window's title


Remove/Close the named window from the end-user's device.

Return value: true if sent successfully

static bool setindex(device, indexName)

const UserDevice& device

the end-user's device

const string& indexName

the name of the index; it appears as the index's title


Configure the end-user's device with the index (tab).

Return value: true if sent successfully

static bool unsetindex(device, indexName)

const UserDevice& device

the end-user's device

const string& indexName

the name of the index; it appears as the index's title


Remove the named index from the end-user's device.

Return value: true if sent successfully

static bool newsection(device, title, sectionType, newtag)

const UserDevice& device

the end-user's device

const string& title

the section title

const string& sectionType

a comma separated list of section qualities, e.g. collabsable, h2, h3

const string& newtag

the tag for the section (must begin with Section_)


Add a section the the UI.  Sections can be manipulated, for example expanded/collapsed.

Return value: true if sent successfully

static bool collapseSection(device)

const UserDevice& device

the end-user's device


Collapse the section identified as the current display region.

Return value: true if sent successfully

static bool expandSection(device)

const UserDevice& device


/////// Images APIs

static bool displayImage(device, imageName, image_type, action, cbdata, append)

const UserDevice& device

the end-user's device

const string& imageName

the Image's name (see Image class)

const string& image_type

the image type, e.g. svg, gif

const string& action

(optional) if specified, then image is a hot spot; when the user clicks on it, a message will be send with this action/request keyword

const XMLData& cbdata

(optional) if an action was specified, then image is a hot spot; when the user clicks on it, a message will be send with this callback data

bool append

Add the image or replace the contents of the device's current region. Default: false/replace.

Default value: false


Display the referenced buffered image that has already been transferred to display channel. If an action is provided, the image can be clicked on to trigger the action with its callback data.

Return value: true if sent successfully

static bool displayImage(device, image_id, action, cbdata, append)

const UserDevice& device

the end-user's device

ImageLibId image_id

the image id from the ImageLib library

const string& action

(optional) if specified, then image is a hot spot; when the user clicks on it, a message will be send with this action/request keyword

const XMLData& cbdata

(optional) if an action was specified, then image is a hot spot; when the user clicks on it, a message will be send with this callback data

bool append

Add the image or replace the contents of the device's current region. Default: false/replace.

Default value: false


Display the referenced buffered image that has already been transferred to display channel. If an action is provided, the image can be clicked on to trigger the action with its callback data.

Return value: true if sent successfully

static bool playAudio(device, audioName)

const UserDevice& device

the end-user's device

const string& audioName

the audio sound's name (or HTML tag, e.g. audio_audioName)


Play the referenced audio sound.

Return value: true if sent successfully

static bool download(device, query, fileclass, xid)

const UserDevice& device

the end-user's device

const string& query

the question/prompt to the user

const string& fileclass

a comma separated list of file types, e.g. html, pdf, svg, etc.

DbRecNum xid

a transaction id maintained by the calling app (guibroker)


Request that the user send the app a file.

Return value: true if sent successfully

static bool upload(device, imageName, image_type)

const UserDevice& device

the end-user's device

const string& imageName

the Image's name (see Image class)

const string& image_type

the image type, e.g. svg, gif


Send a file to the end-user's device that has already been transferred to display channel.

Return value: true if sent successfully

static bool imagelibpre(device, id)

const UserDevice& device

the end-user's device

DbRecNum id

the image's id in ImageLib


Pre-fetch and image from ImageLib.

Return value: true if sent successfully

static bool bufimage(device, imageName, image_type, width, height, size, binary, chunk, totalChunks, chunksize, data)

const UserDevice& device

the end-user's device

const string& imageName

the Image's name (see Image class)

const string& image_type

the image type, e.g. svg, gif

int width

image width, in pixels

int height

image height, in pixels

int size

size of image, in bytes

bool binary

flag set to true if data is binary (hex encoded)

int chunk

chunk #, starting at 0, increasing with subsequent chunks

int totalChunks

total number of chunks being sent

int chunksize

size of this chunk of data, in bytes

const string& data

the data of this chunk


Send a chunk of data to the display chennel (to fit within a message max size).

Return value: true if sent successfully

static bool setvar(device, variable, value)

const UserDevice& device

the end-user's device

const string& variable

the end-user device variable to set, e.g. wid (tenant id), pc

const string& value

the new value of the variable


Alter a end-user device built-in variable value.

Return value: true if sent successfully

static bool getvar(device, variable, value)

const UserDevice& device

the end-user's device

const string& variable

the end-user device variable to set, e.g. wid (tenant id), pc

string& value

(output) the current value of the variable


Alter a end-user device built-in variable value.

Return value: true if sent successfully

static bool run(device, appname, startParams)

const UserDevice& device

the end-user's device

const string& appname

the app to run

const XMLData& startParams

the initial parameters for running that app (app-specific); note that any XML sub-objects will not pass through to new process - only key/value property pairs


Switch the user from running one app to a different app using the provided parameters.

Return value: true if sent successfully

static bool stop(device)

const UserDevice& device

the end-user's device


Stop running the current application.

Return value: true if sent successfully

static bool userAccountChange(userId, action, value)

int userId

User datastore's id for user

const string& action

Action to take on user's account, e.g disable

string value

Parameter for action, e.g. T, F


Take an action on a user's account.

Return value: true if sent successfully

static bool registerApp(appmode, apptype, action, contentInputType, contentOutputType, operations, msgchannel, privatePages)

const string& appmode

Name of appmode, likely the app's name. All URL's for //site/appmode/ will trigger a message using action below

const string& apptype

type of behavior to remote client: Ux (asynchronous user experience in browser), Direct (synchronous query gets synchronous response), Pipe (streamed data from remote connection is fed to app by line or binary block)

Default value: "Ux"

const string& action

name of action to send to app when URL connection established

Default value: ""

const string& contentInputType

the expected input content payload. A HTTP simple form POSTing sends form-data; a REST call may send json or xml.

Default value: "form-data"

const string& contentOutputType

the default response content payload, e.g. json, xml

Default value: "json"

const StringList& operations

a list of HTTP operations allowed. "GET,POST" is typical, but a REST interface may also include PUT, DELETE, or PATCH. The value is a comma separted list.

Default value: StringList("GET,POST")

const string& msgchannel

specify if other than the default channel for the calling app.

Default value: ""

bool privatePages

true if only authenticated users may access, false if public

Default value: true


Register an app mode with UserGW. This captures all URL activity for URLs that begin with that appmode.

Return value: true if sent successfully

static bool startraw(device, statusCode, contentType)

const UserDevice& device

the end-user's device

int statusCode

disposition status of the connection: 0- Success, 1- Input error, 2- Invalid, 3- Not authorized, 4- Failure (no output

Default value: 0

string contentType

the output content type, likely json or xml. However a major/minor value is allowed (and passes straight through)

Default value: ""


Declare to UserGW that response output is ready to send.

Return value: true if sent successfully

static bool writeraw(device, text, isBinary)

const UserDevice& device

the end-user's device

const string& text

the text to send

bool isBinary

true if text is hexadecimal codes for binary data

Default value: false


Output text to the connection without modifying the text at all.  If the text is binary, it is converted from hex codes to binary before transmission.

Return value: true if sent successfully

static bool closeraw(device)

const UserDevice& device

the end-user's device)


Append to the display reagion with the provided text for the user specified

Return value: true if sent successfully

static bool send(request, params)

const string& request

the request keyword

const XMLData& params

the data (parameter payload)

Default value: XMLData("")


Send an API message to channel display.