Search in sources :

Example 1 with DialogAction

use of io.jmix.ui.action.DialogAction in project jmix-docs by Haulmont.

the class OrderBrowse2 method onBeforeCommitChanges.

@Subscribe
public void onBeforeCommitChanges(BeforeCommitChangesEvent event) {
    if (getEditedEntity().getNum() == null) {
        dialogs.createOptionDialog().withCaption("Confirmation").withMessage("Number is empty. Do you want to commit?").withActions(new DialogAction(DialogAction.Type.OK).withHandler(e -> {
            event.resume();
        }), new DialogAction(DialogAction.Type.CANCEL)).show();
        event.preventCommit();
    }
}
Also used : DialogAction(io.jmix.ui.action.DialogAction)

Example 2 with DialogAction

use of io.jmix.ui.action.DialogAction in project jmix-docs by Haulmont.

the class OrderEdit3 method onBeforeCommitChanges.

@Subscribe
public void onBeforeCommitChanges(BeforeCommitChangesEvent event) {
    if (getEditedEntity().getNum() == null) {
        dialogs.createOptionDialog().withCaption("Confirmation").withMessage("Number is empty. Do you want to set default?").withActions(new DialogAction(DialogAction.Type.OK).withHandler(e -> {
            getEditedEntity().setNum(DEFAULT_NUM);
            event.resume(commitChanges());
        }), new DialogAction(DialogAction.Type.CANCEL)).show();
        event.preventCommit();
    }
}
Also used : DialogAction(io.jmix.ui.action.DialogAction)

Example 3 with DialogAction

use of io.jmix.ui.action.DialogAction in project jmix-docs by Haulmont.

the class CustomerEdit method onBrandsTableExclude.

// end::exclude-action-cancelled-handler[]
// tag::exclude-action-performed-event[]
@Subscribe("brandsTable.exclude")
public void onBrandsTableExclude(Action.ActionPerformedEvent event) {
    excludeAction.setConfirmation(false);
    dialogs.createOptionDialog().withCaption("My confirm dialog").withMessage("Do you really want to remove the brand from the list?").withActions(new DialogAction(DialogAction.Type.YES).withHandler(// execute action
    e -> excludeAction.execute()), new DialogAction(DialogAction.Type.NO)).show();
}
Also used : DialogAction(io.jmix.ui.action.DialogAction)

Example 4 with DialogAction

use of io.jmix.ui.action.DialogAction in project jmix by jmix-framework.

the class UserIndicatorImpl method substituteUser.

protected void substituteUser(HasValue.ValueChangeEvent<UserDetails> valueChangedEvent) {
    UserDetails newUser = valueChangedEvent.getValue();
    UserDetails prevUser = valueChangedEvent.getPrevValue();
    if (newUser == null || prevUser == null) {
        // should not happen
        return;
    }
    if (currentUserSubstitution.getEffectiveUser().equals(newUser)) {
        return;
    }
    SubstituteUserAction substituteUserAction = new SubstituteUserAction(newUser, prevUser, messages, icons, substitutionManager).withCancelAction(this::revertSelection);
    substituteUserAction.setPrimary(true);
    dialogs.createOptionDialog().withCaption(messages.getMessage("substitutionConfirmation.caption")).withMessage(messages.formatMessage("", "substitutionConfirmation.message", generateUserCaption(newUser))).withActions(substituteUserAction, new DialogAction(DialogAction.Type.CANCEL).withHandler(event -> revertSelection(prevUser))).show();
}
Also used : UserDetails(org.springframework.security.core.userdetails.UserDetails) DialogAction(io.jmix.ui.action.DialogAction)

Example 5 with DialogAction

use of io.jmix.ui.action.DialogAction in project jmix by jmix-framework.

the class ScreensImpl method checkModificationsAndCloseAll.

/**
 * Check modifications and close all screens in all main windows excluding root screens.
 *
 * @return operation result
 */
public OperationResult checkModificationsAndCloseAll() {
    if (hasUnsavedChanges()) {
        UnknownOperationResult result = new UnknownOperationResult();
        ui.getDialogs().createOptionDialog().withCaption(messages.getMessage("closeUnsaved.caption")).withMessage(messages.getMessage("discardChangesOnClose")).withActions(new BaseAction("closeApplication").withCaption(messages.getMessage("closeApplication")).withIcon(icons.get(JmixIcon.DIALOG_OK)).withHandler(event -> {
            ui.getApp().closeWindowsInternal(true);
            result.success();
        }), new DialogAction(DialogAction.Type.CANCEL, Action.Status.PRIMARY).withHandler(event -> result.fail())).show();
        return result;
    } else {
        ui.getApp().closeWindowsInternal(true);
        return OperationResult.success();
    }
}
Also used : DialogAction(io.jmix.ui.action.DialogAction) UnknownOperationResult(io.jmix.ui.util.UnknownOperationResult) BaseAction(io.jmix.ui.action.BaseAction)

Aggregations

DialogAction (io.jmix.ui.action.DialogAction)21 Dialogs (io.jmix.ui.Dialogs)6 BaseAction (io.jmix.ui.action.BaseAction)4 Action (io.jmix.ui.action.Action)3 ScreenContext (io.jmix.ui.screen.ScreenContext)3 AbstractAction (io.jmix.ui.action.AbstractAction)2 UnknownOperationResult (io.jmix.ui.util.UnknownOperationResult)2 HashSet (java.util.HashSet)2 LoggedAttribute (io.jmix.audit.entity.LoggedAttribute)1 LoggedEntity (io.jmix.audit.entity.LoggedEntity)1 Entity (io.jmix.core.Entity)1 Messages (io.jmix.core.Messages)1 AbstractPrintFormAction (io.jmix.reportsui.action.AbstractPrintFormAction)1 Notifications (io.jmix.ui.Notifications)1 ListAction (io.jmix.ui.action.ListAction)1 Component (io.jmix.ui.component.Component)1 ListComponent (io.jmix.ui.component.ListComponent)1 RootWindow (io.jmix.ui.component.RootWindow)1 InputDialogAction (io.jmix.ui.component.inputdialog.InputDialogAction)1 IllegalConcurrentAccessException (io.jmix.ui.executor.IllegalConcurrentAccessException)1