Saltar al contenido principal
Version: 4.8.0

Actions

To perform an action when we click a button, or a dependency is activated, we need to define a button-action or a dependency-action. El formato de estas acciones es el siguiente:

<button-action type="[action]" target="[action-target]" context="[action-context]" silent="[silent]" async="[async]"
server-action="[server-action]" target-action="[server-target-action]"/>

o

<dependency-action type="[action]" target="[action-target]" context="[action-context]" silent="[silent]" async="[async]"
server-action="[server-action]" target-action="[server-target-action]"/>

Atributos de acción

AtributoUsoTipoDescripciónValores
typeRequiredStringAcción que se lanzará.See client action list
targetOpcionalStringObjetivo de la acciónOpción, mensaje o identificador de componente, dependiendo del tipo de acción
contextOpcionalStringContexto donde está el objetivoVista en la que se encuentra el componente
server-actionOpcionalStringLlamada de acción del servidorSee server action list
target-actionOpcionalStringDestino para llamar al servidor
silentOpcionalBooleanIniciar la acción sin mostrar la barra de carga
asyncOpcionalBooleanLaunch the action in the async stack
valueOpcionalStringValor a establecer para el criterio en caso de que la acción sea de tipo "value"

Acciones del cliente

Las acciones de los clientes son procesos iniciados en el lado del cliente de la aplicación web (en el navegador). They are launched sequentially (unless defined as async). Depending on the action type, the target and context attributes may differ in meaning.

Comunes

Acciones genéricas que se lanzan en el navegador. Estas acciones no necesitan atributos extra y se aplican a todos los componentes de la pantalla.

Acciones generales

ActionDescripción
resetVaciar todos los criterios en la pantalla
restoreRestaurar los valores iniciales de todos los criterios en la pantalla
restore-targetRestaurar los valores de los criterios de la pantalla que estén dentro de una etiqueta con un identificador específico (definido en target)
validateIniciar una validación de todos los criterios de la pantalla
printLanza una impresión de la pantalla. Es igual que la opción de imprimir del navegador
confirm-updated-dataMuestra un diálogo de confirmación para advertir al usuario que hay criterios con datos en la pantalla, y puede perderlos al navegar a otra pantalla
confirm-not-updated-dataMuestra un diálogo de confirmación para advertir al usuario que los criterios en la pantalla no han sido actualizados
confirm-empty-dataMuestra un diálogo de confirmación para advertir al usuario que todos los criterios en la pantalla están vacíos
resizeFuerza un chequeo de tamaño de pantalla (útil en caso de que no se actualicen bien los tamaños de los componentes)
toggle-menuMostrar / Ocultar el menú
toggle-navbarMostrar / Ocultar la barra de navegación
disable-dependenciesDisable the dependency system
enable-dependenciesEnable the dependency system
cancelLimpia la pila de acciones actual
valueEstablece un valor a un criterio
waitWait an amount of milliseconds defined on target attribute
close-windowIntenta cerrar la ventana actual del navegador (a veces pedirá permiso al usuario)

Mensaje

Acciones que eventualmente pueden mostrar un mensaje al usuario.

Acciones de mensaje

ActionDescripción
confirmLaunch a confirm dialog with the message defined on target attribute

Atributos del mensaje

AtributoUsoTipoDescripciónValores
targetRequiredStringIdentificador de mensaje

Las acciones de navegación se utilizan para pasar de una pantalla a otra.

Acciones de navegación

ActionDescripción
backIr a la pantalla anterior. Igual que el botón atrás del navegador. Does not need target attribute.
forwardIr a la siguiente pantalla. Igual que el botón de avance del navegador. Does not need target attribute.
screenIr a una pantalla. Needs target attribute.
reloadRecargar pantalla actual
logoutCerrar sesión y salir del menú privado. Does not need target attribute.
redirectRedirects the current screen to a new URL defined in target attribute. If parameter newWindow is set to true, the URL will be open in a new window
redirectScreenLaunches a redirect action if the current screen matches the screen parameter

Atributos de navegación

AtributoUsoTipoDescripciónValores
targetDepends on actionStringIdentificador de opción
contextOpcionalStringContexto de la pantalla. Si no está definido, el contexto es el mismo que la pantalla del lanzador.screen/public for public options, screen/home for private options
newWindowOpcionalBooleanOpen the redirect url in a new window.
screenDepends on actionStringScreen to check when launching the redirectScreen action.

Componente

Acciones que funcionan sobre componentes en la pantalla.

Acciones del componente

ActionDescripciónFunciona en
add-classAdd the css class/classes defined on target-action to the tag with the selector defined on targettag
remove-classRemove the css class/classes defined on target-action to the tag with the selector defined on targettag
resetVaciar un valor de criteriocriteria, grid, chart
restoreRestaurar a los valores iniciales un criteriocriteria, grid, chart
start-loadSets a component as loadingcriteria, grid, chart
copy-criterion-value-clipboardCopy a criterion value to the clipboardcriteria
validateLaunch a validation on the criterion or criteria inside the target tagtag, criteria
dialogAbre un diálogo modaldialog
closeCierra un diálogodialog
filterRecargar una matrizgrid
add-rowAñadir una fila vacía en la parte inferior de la matrizgrid
add-row-topAñadir una fila vacía en la parte superior de la matrizgrid
add-row-upAñadir una fila vacía sobre la fila seleccionadagrid
add-row-downAñadir una fila vacía debajo de la fila seleccionadagrid
copy-rowCopia la fila seleccionada en la parte inferior de la matrizgrid
copy-row-topCopia la fila seleccionada en la parte superior de la matrizgrid
copy-row-upCopiar la fila seleccionada sobre la fila seleccionadagrid
copy-row-downCopiar la fila seleccionada debajo de la fila seleccionadagrid
delete-rowEliminar la fila seleccionadagrid
save-rowGuardar la fila seleccionadagrid
check-one-selectedComprueba si hay una fila seleccionadagrid
check-some-selectedComprueba si hay una o más filas seleccionadasgrid
check-records-savedComprueba si todos los registros están almacenados (el usuario no está editando una fila)grid
check-records-generatedComprueba si hay al menos una fila en la matrizgrid
select-first-rowSelecciona la primera fila de la matrizgrid
select-last-rowSelecciona la última fila de la matrizgrid
select-all-rowsSeleccionar todas las filas de la matrizgrid
unselect-all-rowsDeseleccionar todas las filas de la tablagrid
validate-selected-rowIniciar una validación en la fila seleccionada de la matrizgrid
copy-selected-rows-clipboardCopy the selected rows on the grid to the clipboardgrid
change-themeChanges the theme to the value defined on the target criterioncriteria
change-languageChanges the language to the value defined on the target criterioncriteria
reload-languageRecargar el idioma buscando cambioscriteria
next-stepMover al siguiente paso del asistentewizard
prev-stepMover al paso anterior del asistentewizard
first-stepMover al primer paso del asistentewizard
last-stepMover al último paso del asistentewizard
nth-stepMover al paso n del asistentewizard

Atributos del componente

AtributoUsoTipoDescripciónValores
targetRequiredStringIdentificador de componente o etiqueta
contextOpcionalStringContexto del componente. Si no se define, el contexto es el mismo que el componente lanzador.base for the menu container screen, report@home for the menu options

Llamada al servidor

Acciones de llamada al servidor

ActionDescripción
serverLanzar una llamada de servidor con los parámetros de la pantalla
server-printIniciar una llamada al servidor con los parámetros de la pantalla e información adicional de impresión
server-downloadLanzar una llamada de servidor con los parámetros de la pantalla para llamar a una acción que descargará un archivo

Atributos de llamada del servidor

AtributoUsoTipoDescripciónValores
targetOpcionalStringComponente o identificador de mensaje para la respuesta
contextOpcionalStringContexto del componente para la respuesta. Si no se define, el contexto es el mismo que el componente lanzador.base for the menu container screen, report@home for the menu options
server-actionRequiredStringAcción para lanzar en el servidor.See server actions
target-actionRequiredStringObjetivo para la acción del servidorQuery identifier or Maintain identifier

Acciones del servidor

ActionDescripciónValores
loginIniciar sesión en la aplicaciónUsuario y contraseña
logout
screenNavegar a una pantallatarget: Menu option identifier
dataObtener datos del servidor. Fills the values list of the criteriontargetAction: Query identifier
valueObtener un valor del servidor. Fills the selected list of the criterion. In suggests, this action also fills the values listtargetAction: Query identifier
update-modelObtener valores para algunos criterios. The query field alias must be the criterion id to match. Fills the selected list of the criteriatargetAction: Query identifier
subscribeSuscribirse a una recuperación de datos de consulta. La suscripción almacena la solicitud del componente y transmite datos a la dirección del componentetargetAction: Query identifier
maintainLanzar un proceso de mantenimientotargetAction: Maintain target identifier
maintain-silentLanzar un proceso de mantenimiento sin mensaje de respuestatargetAction: Maintain target identifier
maintain-asyncLanzar un proceso de mantenimiento sin ninguna respuestatargetAction: Maintain target identifier
validateEjecutar una consulta, y si devuelve una advertencia o error, invalida el componente lanzador con un mensajetargetAction: Query identifier
uniqueEjecutar una consulta, y si devuelve datos, no valida el lanzadortargetAction: Query identifier
controlLanzar una consulta, y si no termina bien, devuelve un mensajetargetAction: Query identifier
control-cancelLanzar una consulta, y si no termina bien, devuelve un mensaje y cancela la cola de accionestargetAction: Query identifier
control-confirmLanzar una consulta, y si no termina bien, devuelve un mensaje de confirmacióntargetAction: Query identifier, target: Confirm message identifier
control-confirm-cancelLanzar una consulta, y si termina bien, cancela la cola y si termina con un error, devuelve un mensaje de confirmacióntargetAction: Query identifier, target: Confirm message identifier
control-confirm-messageLanzar una consulta, y si no termina bien, devuelve un mensaje de confirmación con la salida del mensaje de consultatargetAction: Query identifier
control-empty-cancelLanzar una consulta, y si no devuelve datos, muestra un mensaje y cancela la colatargetAction: Query identifier, target: Message identifier
control-unique-cancelLanzar una consulta, y si devuelve datos, muestra un mensaje y cancela la colatargetAction: Query identifier, target: Message identifier
app-helpMuestra la ayuda de pantalla generada automáticamente basándose en los atributos de la pantallatarget: Screen identifier (optional)
helpObtener el libro de ayuda de la aplicación en el idioma actual
get-file-maintainLanzar un proceso de mantenimiento y recuperar un archivo para descargar

Acciones del cliente de servicios Java

Este tipo de acciones se utilizan para ejecutar las acciones del cliente desde los servicios java en el servidor. Son útiles para realizar muchas acciones en el elemento de la ventana con un único servicio. Por ejemplo, rellene criterios y matrices a la vez, añada dinámicamente columnas a una matriz, agregue o reemplace series en las gráficas, etc.

Acciones generales de servicios java

ActionDescripciónParámetros
messageEnviar un mensaje al cliente (sin target)type - Message type (ok, info, warning, error), title - Message title, message- Message description
target-messageEnviar un mensaje a un componente clientetype - Message type (ok, info, warning, error), title - Message title, message- Message description

message

// Client action list
ServiceData serviceData = new ServiceData();

// Message action
ClientAction messageAction = new ClientAction("message");
messageAction.addParameter("type", "warning");
messageAction.addParameter("title", title);
messageAction.addParameter("message", message);
serviceData.addClientAction(messageAction);

target-message

// Client action list
ServiceData serviceData = new ServiceData();

// Message action
ClientAction messageAction = new ClientAction("target-message");
messageAction.addParameter("type", "warning");
messageAction.addParameter("title", title);
messageAction.addParameter("message", message);

// Optional
ComponentAddress address = new ComponentAddress(applicationName, null, "report", null, "CriterionId", null, null);
messageAction.setAddress(address);

serviceData.addClientAction(messageAction);

Acciones de criterios de servicios java

ActionDescripciónParámetros
selectRellenar los valores seleccionados en un criteriovalues - Datalist with criteria value
fillRellenar la lista de los valores disponibles para seleccionar en un criteriorows - rows of datalist (at least must have value and label fields)

select

ServiceData setCriteriaValue() {
// Variable initialization
ServiceData serviceData = new ServiceData();

// Create client action to fill criteria
ClientAction selectCrtTransactionIdAction = new ClientAction("select");

// Set target (Criteria ID to set value)
selectCrtTransactionIdAction.setTarget("transactionId");

// Add parameters to actions
selectCrtTransactionIdAction.addParameter("values", Arrays.asList("TR001"))

// Add actions to serviceData
serviceData.addClientAction(selectCrtTransactionIdAction);

return serviceData;
}

Acciones de matrices desde servicios de java

ActionDescripciónParámetros
fillRellena una tabla con una lista de datosrows - rows of datalist
total - Number of total pages of datalist
page - Page of datalist
records - Records number of datalist
add-columnsAñadir columnas a la estructura de la matrizcolumns - ArrayNode with column structure
replace-columnsReemplazar las columnas de la matriz con otra estructura de columnascolumns - ArrayNode with column structure
update-cellActualizar una celda en una matriz. Utilizado para actualizar una celda de una tabla con otro valor, estilo, icono, título ...values - ObjectNode with cell attributes
add-rowAñadir una fila en la parte inferior de la matrizrow - row values (optional)
selectedRow - Selected row identifier (optional)
add-row-topAñadir una fila en la parte superior de la matrizrow - row values (optional)
selectedRow - Selected row identifier (optional)
add-row-upAñadir una fila sobre la fila seleccionadarow - row values (optional)
selectedRow - Selected row identifier (optional)
add-row-downAñadir una fila debajo de la fila seleccionadarow - row values (optional)
selectedRow - Selected row identifier (optional)
copy-rowCopia la fila seleccionada en la parte inferior de la matrizselectedRow - Selected row identifier (optional)
copy-row-topCopia la fila seleccionada en la parte superior de la matrizselectedRow - Selected row identifier (optional)
copy-row-upCopiar la fila seleccionada sobre la fila seleccionadaselectedRow - Selected row identifier (optional)
copy-row-downCopiar la fila seleccionada debajo de la fila seleccionadaselectedRow - Selected row identifier (optional)
update-rowActualizar los valores de fila seleccionadosrow - row values, rowId - id of row to be updated (if none given, selected one will be selected), style - CSS class to add to the row (optional)
delete-rowEliminar la fila seleccionada

fill

Using a list of beans as parameters:

@Data
@Accessors(chain=true)
public class MyBean {
private String id;
private String label;
private Integer type;
}

The fill action should be something like:

public ServiceData fillGrid(List<MyBean> beanList) {
return new ServiceData()
.addClientAction(new FillActionBuilder("GridToFill", DataListUtil.fromBeanList(beanList))
.build()
);
}

Using parameter list the fill action should be like:

public ServiceData fillGrid(List<String> idList, List<String> labelList, List<Integer> typeList) {
DataList dataList = new DataList();
DataListUtil.addColumn(dataList, "id", idList);
DataListUtil.addColumn(dataList, "label", labelList);
DataListUtil.addColumn(dataList, "type", typeList);

return new ServiceData()
.addClientAction(new FillActionBuilder("GridToFill", dataList)
.build()
);
}

add-columns

ServiceData addColumnsToGrid() {
// Variable initialization
ServiceData serviceData = new ServiceData();

// Create client action to fill many criteria
ClientAction addColumnsAction = new ClientAction("add-columns");

// Build dynamic column structure
List<Column> columnList = new ArrayList<Column>();
Column columnName = new Column();
columnName.setName("Name");
columnName.setLabel("COLUMN_LABEL");
columnName.setCharLength("15");
columnName.setField("Name");
columnName.setAlign("Center");

// Add column to list
columnList.add(columnName);

// Build column structure
ArrayNode columns = ColumnUtil.buildColumnListStructure(columnList);

addColumnsAction.setTarget("GrdDivididendList");

// Add parameters to action
addColumnsAction.addParameter("columns", new CellData(columns));

// Add action to list
clientActionList.add(addColumnsAction);

return serviceData;
}

replace-columns

ServiceData replaceColumnsToGrid() {
// Variable initialization
ServiceData serviceData = new ServiceData();

// Create client action to fill many criteria
ClientAction replaceColumnsAction = new ClientAction("replace-columns");

// Build dynamic column structure
ArrayList<Column> columnList = new ArrayList<Column>();
Column columnName = new Column();
column.setName("Name");
column.setLabel("COLUMN_LABEL");
column.setCharLength("15");
column.setField("Name");
column.setAlign("Center");

Column columnType = new Column();
columnType.setName("Type");
columnType.setLabel("COLUMN_TYPE");
columnType.setCharLength("15");
columnType.setField("Type");
columnType.setAlign("Center");

// Add column to list
columnList.add(columnName );
columnList.add(columnType );

// Build column structure
ArrayNode columns = ColumnUtil.buildColumnListStructure(columnList);

replaceColumnsAction.setTarget("GrdDivididendList");

// Add parameters to action
replaceColumnsAction.addParameter("columns", new CellData(columns));

// Add action to list
clientActionList.add(replaceColumnsAction);

return serviceData;
}

update-cell

...
// Variable initialization
ServiceData serviceData = new ServiceData();

ClientAction updateCell = new ClientAction("update-cell");

// Set values
ObjectNode values = JsonNodeFactory.instance.objectNode();
values.put("value", value);
values.put("label", label);
values.put("style", "updated");

// Build address of cell
ComponentAddress address = new ComponentAddress(applicationName, null, "report", null, "GrdSwapLst", idRow, idColumn);
updateCell.setAddress(address);
updateCell.setAsync("true");
updateCell.setSilent("true");
updateCell.addParameter("data", new CellData(values));

// Add action to list
clientActionList.add(updateCell);

return serviceData;

Note: If you want to change only a value, only passing the value to the data parameter inside a CellData is necessary. Si desea cambiar algo más, entonces será necesario generar un objeto JSON con el modelo que desea actualizar. In this model you must include the value and label attributes.

Acciones de gráficas desde servicios java

ActionDescripciónParámetros
replace-chart-seriesReemplazar la serie de un gráficoseries - ArrayNode with chart series
add-chart-seriesAñadir una serie al gráficoseries - ArrayNode with chart serie
remove-chart-seriesEliminar la serie de un gráficoseries - ArrayNode with chart series

replace-chart-series

/**
* Test method to replace the series of chart
*
* @param userList (Dummy list for build name of series)
* @return
* @throws AWException
*/
public ServiceData replaceSeriesChart(List<String> userList) throws AWException {

// Init variables
ServiceData serviceData = new ServiceData();
List<ClientAction> clientActionList = serviceData.getClientActionList();
JsonNodeFactory factory = JsonNodeFactory.instance;
ArrayNode serieList = factory.arrayNode();

// Get month list for xAxis
List<String> months = builDummyMonthList();

// Add json data of series
for (String user : userList) {
// New serie
ChartSerie serie = new ChartSerie();
serie.setId(user);
serie.setName(user);

// Add data to serie
for (String month : months) {
ChartSeriePoint point = new ChartSeriePoint(factory.textNode(month), factory.numberNode(new Random().nextInt((10 - 0) + 1) + 0));
// Add point to serie [x,y]
serie.getData().add(point);
}
// Add serie
serieList.add(serie.toJson());
}

// Create action replace series of chart
ClientAction replaceSeriesAction = new ClientAction("replace-chart-series");
replaceSeriesAction.setTarget("ChrLinTst");
ArrayList<Parameter> parameterList = replaceSeriesAction.getParameterList();
parameterList.add(new Parameter("series", new CellData(serieList)));
// Add action to list
clientActionList.add(replaceSeriesAction);

return serviceData;
}

add-chart-series

/**
* Test method to add the series of chart
*
* @param userList (Dummy list for build name of series)
* @return
* @throws AWException
*/
public ServiceData addSeriesChart(List<String> userList) throws AWException {

// Init variables
ServiceData serviceData = new ServiceData();
List<ClientAction> clientActionList = serviceData.getClientActionList();
JsonNodeFactory jsonFactory = JsonNodeFactory.instance;
// Get month list for xAxis
List<String> months = builDummyMonthList();

// Create arrayNode of chart series
ArrayNode serieList = jsonFactory.arrayNode();

// Add json data of series
for (String user : userList) {
// New serie
ChartSerie serie = new ChartSerie();
serie.setId(user);
serie.setName(user);

// Add data to serie
for (String month : months) {
ChartSeriePoint point = new ChartSeriePoint(jsonFactory.textNode(month), jsonFactory.numberNode(new Random().nextInt((10 - 0) + 1) + 0));
// Add point to serie [x,y]
serie.getData().add(point);
}
// Add serie
serieList.add(serie.toJson());
}

// Create action add series of chart
ClientAction addSeriesAction = new ClientAction("add-chart-series");
addSeriesAction.setTarget("ChrLinTst");
ArrayList<Parameter> parameterList = addSeriesAction.getParameterList();
parameterList.add(new Parameter("series", new CellData(serieList)));
// Add action to list
clientActionList.add(addSeriesAction);

return serviceData;
}

remove-chart-series

/**
* Test method to remove the series of chart
*
* @param userList (Dummy list for build name of series)
* @return
* @throws AWException
*/
public ServiceData removeSeriesChart(List<String> userList) throws AWException {

// Init variables
ServiceData serviceData = new ServiceData();
List<ClientAction> clientActionList = serviceData.getClientActionList();
JsonNodeFactory jsonFactory = JsonNodeFactory.instance;

// Create arrayNode of chart series
ArrayNode series = jsonFactory.arrayNode();

// Add json data of series
for (String user : userList) {
ChartSerie serie = new ChartSerie();
serie.setId(user);
// Add serie
series.add(serie.toJson());
}

// Create action remove series of chart
ClientAction removeSeriesAction = new ClientAction("remove-chart-series");
removeSeriesAction.setTarget("ChrLinTst");
ArrayList<Parameter> parameterList = removeSeriesAction.getParameterList();
parameterList.add(new Parameter("series", new CellData(series)));
// Add action to list
clientActionList.add(removeSeriesAction);

return serviceData;
}

Pila de acciones

Las acciones se lanzan secuencialmente. Se almacenan en una pila de acciones, y cuando la acción actual ha terminado, se lanza la siguiente.

There are some actions that can clean the actions stack, like the cancel client action. Other actions freeze the current stack and creates another stack in an upper level, like the dialog client action.

\sync-stack

Pila asíncrona

When you launch an action with the async flag activated, it is launched on the async stack. Se ejecuta de forma asincrónica, y no espera ninguna otra acción.

\async-stack

Mostrar la pila

If you want to see what the stacks are doing, you can add a delay to these actions and make them visible by typing the next keys within the application focus:

ALT + SHIFT + [number]

Where [number] is the number of seconds you want to delay every action (for example, 1);

To disable the action stack, just do the same thing delaying 0 seconds:

ALT + SHIFT + 0

Ejemplos

Validación

Validar todos los criterios, lanzar un mensaje de confirmación y después lanzar un target de mantenimiento para almacenar los datos de la pantalla:

<button-action type="validate" />
<button-action type="confirm" target="[target]" />
<button-action type="server" server-action="maintain" target-action="[maintain-target]" />

Ir a la pantalla anterior, advirtiendo al usuario que los datos de la pantalla pueden perderse

<button-action type="confirm-updated-data" />
<button-action type="back" />

Descargar un archivo

\TextView

Screen

<criteria label="PARAMETER_TEXT" id="TxtViw" variable="ButVal" component="text-view" style="col-xs-6 col-sm-3 col-lg-2" icon="download">
<dependency>
<dependency-element id="TxtViw"/>
<dependency-element id="TxtViw" event="click"/>
<dependency-action type="server-download" server-action="get-file-maintain" target-action="downloadFile"/>
</dependency>
...
</criteria>

Maintain.xml

<target name="downloadFile">
<serve service="downloadFile">
<variable id="fileName" type="STRING" name="TxtViw" />
</serve>
</target>

Service.xml

<service id="downloadFile">
<java classname="com.almis.awe.test.File" method="downloadFile">
<service-parameter type="STRING" name="fileName" />
</java>
</service>

Java service

/**
* Given a file identifier, download a file
*
* @param fileIdentifier
* @return ServiceData
* @throws AWException
*/
public ServiceData downloadFile(String fileIdentifier) throws AWException {
ServiceData serviceData = new ServiceData();
FileController fileController = new FileController();
FileData fileData = fileController.getFileData(fileIdentifier);

String path = fileData.getFilePath();
FileInputStream file = FileUtil.getFileStream(path);

// Set variables
fileData.setFileStream(file);
serviceData.setData(fileData);
return serviceData;
}