Create own save and cancel options

Hello everyone.

I would like to override the default behavior of the save and cancel buttons that are included when creating a view.

<frame id = "windowActions"
                Screen = "editWindowActions" />

I want to create my own behavior and make it extendable to the windows that I want, please help me or guide me to achieve it.

From already thank you very much.

Hi Nelson,

The editWindowActions and extendedEditWindowActions frames do not contain any logic, you can look at them if you find edit-window.actions.xml and extended-edit-window.actions.xml descriptors respectively in the platform code. They are just bound to actions with predefined names windowCommit, windowCommitAndClose, windowClose. These actions are added to your editors by the EditorWindowDelegate class that is responsible for entity editor logic.

So you can change saving behavior of an editor screen only by overriding AbstractEditor methods such as postValidate(), preCommit(), postCommit() and others, see documentation on AbstractWindow and AbstractEditor and JavaDocs for details.

On the other hand, you can replace standard windowActions frames by any other visual elements like custom buttons and just assign predefined names to them. Binding of these buttons to standard actions will be done automatically:

<vbox id="myButtonsBox">
    <button id="windowCommit" action="windowCommit"/>
    <button id="windowClose" action="windowClose"/>

Thanks Konstantin, but how do I make those buttons inherited in all windows or views, as now happens with the current functionality?, should I change something or should I create a template?

Since Studio version 6.4 you have the ability to create and use your own screen templates. So you can copy default Editor screen template and replace the standard editWindowActions frame with your own.

Please be aware that we have changed the templates engine in the upcoming Studio v.6.5 so you will have to adapt your custom templates when upgraded to 6.5.