Reopen document after commit (Ok button)

Hello everyone.
I am new to Cuba platform and I want to override Ok buttons behaviour during document creation or modification.

I am trying to override onWindowCommit method and I have a doc object. I do not know how to reopen the document after it is saved. Any help would be greatly appreciated. Thanks.



I suppose that instead of overriding the windowCommitAndClose action it would be more convenient for you to use the windowCommit action, e.g. you can implement the editActions box of your entity editor like this:

<hbox id="editActions" spacing="true">
    <button action="windowCommit"/>
    <button action="windowClose"/>

In this case, the editor screen will have two buttons: Save and Close:

Screenshot 2020-09-23 at 13.27.37


Thank you Gleb.

The problem is changes to the document are made with new dialog window and when ok button is clicked dialog window and the main window are auto closed. I want to reopen edit window with changes made. Is it possible?

Could you please describe your problem in more detail? Is document is an association entity for the other main one? What do you mean by the main window? If possible, please attach a small demo project along with reproduction scenario, so it would be much easier to help you.

Sorry for the late response. We have a project developed on thesis based on cuba-platform and I am not able to implement editActions (windowActions) box. When new document is created there are some buttons except Ok and Cancel that opens new dialog box with controls, inputs and Ok/Close button. When Ok button is pressed changes are made to the entity and dialogBox with document edit window are closed. Users than try to find their newly created documents on lists. We want documents to be reopened after create or update/edit.


Unfortunately, it still remains unclear for me what functionality comes from Thesis and what is added by you.

Every screen can be extended, so that shouldn’t be a problem to replace CommitAndCloseaction with CommitAction.

In general, a newly created or edited entity is selected in a table, so that it’s easy to identify it. The only suggestion I can give you without investigating your project is to add CollectionChangeListener: e.g.:

private GroupDatasource<Product, UUID> productsDs;

public void init(Map<String, Object> params) {
    productsDs.addCollectionChangeListener(e -> {
        Operation operation = e.getOperation();
        if (operation == Operation.ADD
                || operation == Operation.UPDATE) {
            List<Product> items = e.getItems();
            if (items.size() == 1) {
                // reopen a screen 

Since your project is based on Thesis, it would be more efficient to contact their support.