Skip to end of metadata
Go to start of metadata

INTRODUCTION TO WEB USER INTERFACE EXTENSIBILITY

This Chapter describes new ability to extend the Web User Interface.

FORM

Create a New Form

While signed into Compiere as the System Administrator Role, use the form window to create a new form.

Enter a name for the new Form into the Name field and include a description and comments for this Form in the Description and Comments fields.

Select the Data Access Level from the Data Access Level drop menu.

Then include the Java Classname for Web UI in the Java Classname for Web UI field to create the new form.

JAVA CLASS

Create a New Java Class

In order for the Java Class to render the new form properly, the user needs to create one class that implements WindowImplIntf.java, and one or more classes that each implement ComponentImplIntf.java depending on the types of components they want to create.

WindowImplIntf.java

This is the interface to implement when you want to create a custom Form for the web UI.

Note: The class that implements this interface needs to have a constructor accepting the parameters (int windowNO, Ctx serverCtx, WindowCtx, windowCtx, UWindowID uid), since this is the constructor that the class loading system will look for using the Java reflection API.

Once the class is created, the fully qualified Java class name needs to be entered in the "Java Classname for Web UI" field in the Form window.

ArrayList<ComponentImplIntf> getComponents();

Returns:
The list of ComponentImplIntf objects that handle the data retrieval for each component in the window.

ChangeVO processCallback(String sender);

This method allows the WindowImplIntf to handle callbacks from the client. By default, the fields that are buttons or have FieldVO.isImpactsValue = true will automatically trigger a callback to this method to allow server-side processing, e.g. dynamically changing the window layout, or perform database operations.

Parameters:
sender - The name of the field that initiated the callback.

Returns:
The ChangeVO indicating the types of changes that should be reflected in the client UI, e.g. changed field values, message pop-ups, new window layouts, etc.

String getName();

Implement this method to return the translated name for the window. The language should be identified via the Ctx object passed in through the constructor.

Returns:
The translated name of the window, or null to not display the name.

validateResponse(ResponseVO responseVO);

This method provides a mechanism for the server-side code to signal errors or warnings to the client upon the initial loading of the window.

This is done by calling ResponseVO.addError() or ResponseVO.addWarning() if error conditions are detected. If you want to use this method for validation during processCallback(), you need to call this method explicitly.

Parameters:
responseVO - The ResponseVO object that will be passed back to the client.

Box getLayout();

Implement this method to return a custom layout for the components.

Note: This layout mechanism is currently only supported for client window type of GENERIC_STACK.

Returns:
The layout specified using the Box model or null to use the default layout.

ClientWindowType getClientWindowType();

Implement this method to indicate the type of client-side UI that should be used to render this window. Only GENERIC_STACK is officially supported for 3rd party custom windows in this release.

Returns:
The client window type, or null to use the default.

ComponentImplIntf.java

This is the interface to implement when you want to create a custom component for a custom window.

ComponentVO getComponentVO();

Implement this method to populate and return a ComponentVO to describe the desired behavior for the component.

The minimum fields in the ComponentVO that should be populated are:
• componentType
• name
• tableName
• fieldVOs

Returns:
The ComponentVO that describes the behavior of the implemented component.

TableModel getQueryResults();

TableModel getQueryResults(QueryVO queryVO, WindowImplIntf windowImpl, WindowCtx windowCtx, FieldVO fieldVO, int startRow, int rowCount, boolean countOnly, boolean asc, int sortCol);

Implement this method to return the result set for this component.

Parameters:
queryVO - The QueryVO passed in from the client.
windowImpl - The the WindowImplIntf that contains this component.
windowCtx - The WindowCtx client-side window context passed in from the client.
fieldVO - The FieldVO of to the window tab field that initiated window.
(This is used to constrain the result set using the FieldVO's validationCode.)
startRow - The zero-based starting row number.
rowCount - The number of rows of results to retrieve.
countOnly - Indicates whether only a record count is requested.
(If true,the TableModel returned should be populated with only a single row and single column containing the record count.)
asc - if true, sort in ascending order. Otherwise, sort in descending order.
sortCol - The zero-based column number on which to perform the sort.

Returns:
The TableModel containing the result set for tabular result set components, or null for SEARCH components.

Labels
  • None