Refreshing Selected UI Components from Custom JCA Actions
You can customize actions to target specific areas of the Matrix Editor to be refreshed without having to perform a full page refresh. These custom actions can target refresh of the configurable structure based on a list of part OIDs. This should also handle a custom New View Version action that removes all children. For handling the refresh of the UI after the custom action processing, relevant OIDs must be passed to the result map to reflect the changes. The following is an example of populating the result map that is done in the example customURLAction.jsp for custom action in Matrix Editor.
The result map contains the following keys:
replacementMap: This key is used to provide a replacement map for any OID changes done by the custom action (including part and variant specification OIDs). The map has the old OID as key and new OID as value, separated by hyphen (“-”). Multiple entries must be comma-separated (“,”). For example, if a variant specification is updated, and a part is also updated, the result map would be:
refreshPart: This Key is used to provide a list of part OIDs for which the sub-part structure must be refreshed. The refresh of the part structure reloads the sub-structure rows and cells and reflects changes to the structure including new or deleted parts. Any expansion of the child rows will be lost and all the first level children under the part will be collapsed after the refresh. Multiple entries must be comma-separated. For example, if Part A is updated by the custom action such that it has new parts added to the structure, and it also updated the OID of the part, the result map would be:
refreshParentOfPart: This key is used to provide a list of part OIDs whose parent’s sub-structure must be refreshed. If there are multiple parents of the provided part OID, the sub-structure of all the parents is refreshed. The refresh of the part structure will reload the sub-structure rows and cells. Any expansion of the child rows will be lost and all the first level children under the part will be collapsed after the refresh.
Multiple entries must be comma-separated. For example, if Part B is updated by the custom action such that it is now included in a variant baseline and the version and baseline attributes will change, its parent’s structure must be refreshed to show the changes in the UI, and the result map would be:
* 
The replacements are handled first. So if there is a common part in the result map for the replacement and refresh keys, the updated or new OID of the part must be provided in the refreshPart or refreshParentOfPart key.
If the custom action changes are related to the exclusion or inclusion of a part or add, remove, or update of the part from the variant baseline, to reflect these changes, the sub-structure of the parent of this part must be updated. This can be achieved by providing the part OID as value for key refreshParentOfPart in the result map.
If a part is modified by the custom action such that its iteration is changed (new OID) and this part also had a sub-structure, along with the replacement map, the iterated part OID must also be added to the refreshPart key in result map. If the OID of the part changes, the usage link between the part and the children is also updated. To update the UI with the new usage links, the sub-structure of the part must be refreshed.
Example: Testing the Refresh Capability with the Example Custom Action
In the example customURLAction.jsp that is launched from the example custom action added to the BOM tree context of the Matrix Editor, there are three input fields corresponding to the three key value expected in the result map. The following is the snapshot of the UI for the example custom action, with input fields highlighted:
Replacement map (oldOID1-newOID1, oldOID2-newOID2...): This field is for providing the replacement map. The map can be provided by giving old OID and new OID separated by hyphen.
Refresh part structure for given part (comma separated OIDs for which sub structure would be refreshed): This field is for providing the part OID for which the sub-structure must be refreshed.
Refresh part structure for given part's parent (comma separated OIDs whose parent's sub structure would be refreshed): This field is for providing the part OID, whose parent’s sub-structure must be refreshed.
To simulate the refresh for the custom action, perform the following steps:
1. Launch the custom action for the appropriate part in the Matrix Editor.
2. Open another UI session to make the changes to the part or variant specification.
3. Provide the respective replacement map or OIDs to be refreshed as the input in the custom action UI launched in the Matrix Editor.
4. Click OK and verify that the changes are now reflected in the Matrix Editor.
Было ли это полезно?