Edit Extended Windows button

Hello Cuba Team

Could you please help me in editing the extended buttons(i.e Save and close,Save etc.).

I want to change the caption of “Save and close” and their icons.I am unable to find their properties file,So is it possible to edit those?

Please reply.
Thanks

Hello,

If you need just to customize captions of the buttons, it may be easily done by redefining them in the project message pack (see https://doc.cuba-platform.com/manual-6.2/main_message_pack.html).

Let me explain on the exapmle:

  1. Main message pack of the project is defined by the cuba.mainMessagePack application property. In my project it is (automatically filled by Studio):

cuba.mainMessagePack = com.haulmont.cuba.web com.company.myproject.gui com.company.myproject.web
  1. I want to customize captions of the “Ok”, “Save”, “Cancel”, “Save and close” buttons on the editor screen.
    By viewing the CUBA source code I discovered that these captions are defined in the message.properties of the com.haulmont.cuba.gui

actions.Ok=OK
actions.OkClose=Save and close
actions.Save=Save
actions.Cancel=Cancel
  1. To redefine that properties for my project I have added them to message.properties of the com.company.myproject.web

actions.Ok=Apply and Close
actions.OkClose=SAVE and CLOSE
actions.Save=OK
actions.Cancel=Close without saving

As the result, editor screens of all entities have been modified.

If custom icons should be put on the buttons, it may be done by several ways. The following considered as the most appropriate.

In the screen XML descriptor we can see that the windowActions frame is filled with the “editWindowActions”.


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

That screen could be extended in the project. To do this:

  1. Open the SCREENS tab of the navigation panel in Studio
  2. Press the ‘NEW’ button
  3. Choose “Extend an existing screen from the base project” and “edit-window.actions.xml” (or “extended-edit-window.actions.xml” ) from the dropdown.

After that we should manually modify the screen controller via the IDE: created class should extend the AbstractFrame (https://doc.cuba-platform.com/manual-6.2/frame.html)


package com.company.myproject.web.editwindow.actions;

import com.haulmont.cuba.gui.components.AbstractFrame;

public class ExtEditWindow extends AbstractFrame {
}

Now it is possible to edit the screen in the Studio.
And as in previous example, modifications are applied to all the editor screens of the application.

Other screens from base projects could also be customized by the similar way.

Regards.

Thanks a lot Rostislav.

It worked fine :slight_smile:

Hello again

It helped me in changing the Label(caption),but could you please help me in setting the icon for (Save and Close,Save etc.) other than customizing buttons method?

Can we?

Please reply

Did you tried to do as described here? https://www.cuba-platform.com/discuss/t/edit-extended-windows-button#comment-1642

Yes

In that case I am not able to change the icon ?

So how to change the icon?

There is the “icon” property of button. You can chose one of CUBA or FONT AWESOME icons.
See the attached screenshot.

icons