Step 15: Integration with the Page Undo and Redo Behavior

Because Oracle Content Management stores properties on behalf of the custom component, changes to those properties are automatically part of the page's Undo and Redo behavior.

To ensure that it is clear what is happening when a user clicks Undo or Redo, these "undo events" should only happen when a user has actually done something to the page. For example, bringing up the custom component Settings panel should not update the properties within the page until the user actually makes a change to the property. Simply initializing the properties in the Settings panel should not cause an update event.

If care is not taken to ensure this behavior, then unexpected behavior may occur. The page will still run, but to the detriment of the user experience. For example, these behaviors may occur:

  • The Save button will become active simply by bringing up the Settings panel.

  • The user must click Undo multiple times before any effect is visible.

  • The Redo stack is removed because the component wrote back an unexpected change and updated the Redo stack with the new value.

The sample code provided in this tutorial for the Settings panel gives an example of how to ensure you are only writing back when you're ready to actually call saveData and not on initialization. Similar care should be taken within the component itself to not update customSettingsData unless it involved a user interaction, though typically this is less of a concern.

Continue to Step 16: Asset Management.