Search in sources :

Example 21 with Command

use of org.uberfire.mvp.Command in project kie-wb-common by kiegroup.

the class RegisteredDocumentsMenuBuilderTest method testOnOpenDocument_WithCommand.

@Test
public void testOnOpenDocument_WithCommand() {
    final Command command = mock(Command.class);
    builder.setOpenDocumentCommand(command);
    builder.onOpenDocument();
    verify(command, times(1)).execute();
    verify(view, times(1)).enableOpenDocumentButton(eq(true));
}
Also used : ParameterizedCommand(org.uberfire.mvp.ParameterizedCommand) Command(org.uberfire.mvp.Command) Test(org.junit.Test)

Example 22 with Command

use of org.uberfire.mvp.Command in project kie-wb-common by kiegroup.

the class RegisteredDocumentsMenuBuilderTest method testOnNewDocument_WithCommand.

@Test
public void testOnNewDocument_WithCommand() {
    final Command command = mock(Command.class);
    builder.setNewDocumentCommand(command);
    builder.onNewDocument();
    verify(command, times(1)).execute();
    verify(view, times(1)).enableNewDocumentButton(eq(true));
}
Also used : ParameterizedCommand(org.uberfire.mvp.ParameterizedCommand) Command(org.uberfire.mvp.Command) Test(org.junit.Test)

Example 23 with Command

use of org.uberfire.mvp.Command in project kie-wb-common by kiegroup.

the class AbstractToolbarCommand method executeWithConfirm.

protected void executeWithConfirm(final Command command) {
    final Command yesCommand = () -> {
        command.execute();
    };
    final Command noCommand = () -> {
    };
    // TODO: I18n.
    final YesNoCancelPopup popup = YesNoCancelPopup.newYesNoCancelPopup("Are you sure?", null, yesCommand, noCommand, noCommand);
    popup.show();
}
Also used : ClientSessionCommand(org.kie.workbench.common.stunner.core.client.session.command.ClientSessionCommand) ToolbarCommand(org.kie.workbench.common.stunner.client.widgets.toolbar.ToolbarCommand) Command(org.uberfire.mvp.Command) YesNoCancelPopup(org.uberfire.ext.widgets.common.client.common.popups.YesNoCancelPopup)

Example 24 with Command

use of org.uberfire.mvp.Command in project kie-wb-common by kiegroup.

the class AbstractToolbarCommand method executeWithConfirm.

private <V> void executeWithConfirm(final ClientSessionCommand.Callback<V> callback) {
    final Command yesCommand = () -> {
        this.executeWithNoConfirm(callback);
    };
    final Command noCommand = () -> {
    };
    final YesNoCancelPopup popup = YesNoCancelPopup.newYesNoCancelPopup(getConfirmMessage(), null, yesCommand, noCommand, noCommand);
    popup.show();
}
Also used : ClientSessionCommand(org.kie.workbench.common.stunner.core.client.session.command.ClientSessionCommand) ToolbarCommand(org.kie.workbench.common.stunner.client.widgets.toolbar.ToolbarCommand) Command(org.uberfire.mvp.Command) YesNoCancelPopup(org.uberfire.ext.widgets.common.client.common.popups.YesNoCancelPopup)

Example 25 with Command

use of org.uberfire.mvp.Command in project kie-wb-common by kiegroup.

the class SessionPreviewCanvasHandlerProxyTest method checkDestroyGraphIndexExecutesCallback.

@Test
public void checkDestroyGraphIndexExecutesCallback() {
    final Command loadCallback = mock(Command.class);
    proxy.destroyGraphIndex(loadCallback);
    verify(loadCallback).execute();
}
Also used : ParameterizedCommand(org.uberfire.mvp.ParameterizedCommand) Command(org.uberfire.mvp.Command) Test(org.junit.Test)

Aggregations

Command (org.uberfire.mvp.Command)117 Test (org.junit.Test)66 ParameterizedCommand (org.uberfire.mvp.ParameterizedCommand)15 ClientSessionCommand (org.kie.workbench.common.stunner.core.client.session.command.ClientSessionCommand)11 Group (com.ait.lienzo.client.core.shape.Group)9 YesNoCancelPopup (org.uberfire.ext.widgets.common.client.common.popups.YesNoCancelPopup)9 Before (org.junit.Before)8 HasListSelectorControl (org.kie.workbench.common.dmn.client.widgets.grid.controls.list.HasListSelectorControl)7 Path (org.uberfire.backend.vfs.Path)7 ArrayList (java.util.ArrayList)6 Collection (java.util.Collection)6 PlaceRequest (org.uberfire.mvp.PlaceRequest)5 MenuItem (org.uberfire.workbench.model.menu.MenuItem)5 IsWidget (com.google.gwt.user.client.ui.IsWidget)4 Inject (javax.inject.Inject)4 OrganizationalUnit (org.guvnor.structure.organizationalunit.OrganizationalUnit)4 RemoteCallback (org.jboss.errai.common.client.api.RemoteCallback)4 DeleteHeaderValueCommand (org.kie.workbench.common.dmn.client.commands.general.DeleteHeaderValueCommand)4 SetCellValueCommand (org.kie.workbench.common.dmn.client.commands.general.SetCellValueCommand)4 SetHeaderValueCommand (org.kie.workbench.common.dmn.client.commands.general.SetHeaderValueCommand)4