Hi
The default message key taken for the localized caption of the windowClose
default action for an Editor
is not adequate.
It is using “actions.Cancel” while it could/should use “actions.Close” especially when this one exists for dialog actions (see code snippets below).
In our app, all screens open in read-only mode, so the windowClose button does not cancel anything, it closes the window (as per the action name)
Once the editing mode has been set, the “Cancel” caption is confusing : the button will yet cancel editing (with unsaved changes check) but also close the window.
So If i want to add a button to cancel editing without closing the window, I’m stuck because “actions.Cancel” caption has already be taken by windowClose
button.
Is there a simple way to change the message key for the windowClose
default action ?
com.haulmont.cuba.gui.components.AbstractEditor
Action closeAction = new BaseAction(WINDOW_CLOSE)
.withCaption(messages.getMainMessage("actions.Cancel"))
.withHandler(e ->
close(commitActionPerformed ? Window.COMMIT_ACTION_ID : getId())
);
getFrame().addAction(closeAction);
com.haulmont.cuba.gui.components.DialogAction
public class DialogAction extends BaseAction {
public enum Type {
OK("ok", "actions.Ok", CubaIcon.DIALOG_OK),
CANCEL("cancel", "actions.Cancel", CubaIcon.DIALOG_CANCEL),
YES("yes", "actions.Yes", CubaIcon.DIALOG_YES),
NO("no", "actions.No", CubaIcon.DIALOG_NO),
CLOSE("close", "actions.Close", CubaIcon.DIALOG_CLOSE);