Search in sources :

Example 36 with Command

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

the class DefaultAdminPageHelper method addSecurityPerspective.

private void addSecurityPerspective() {
    if (hasAccessToPerspective(PerspectiveIds.SECURITY_MANAGEMENT)) {
        adminPage.addTool("root", constants.Roles(), "fa-unlock-alt", "security", () -> {
            final Command accessRoles = () -> {
                Map<String, String> params = new HashMap<>();
                params.put("activeTab", "RolesTab");
                placeManager.goTo(new DefaultPlaceRequest(SECURITY_MANAGEMENT, params));
            };
            accessRoles.execute();
            addAdminBreadcrumbs(SECURITY_MANAGEMENT, constants.SecurityManagement(), accessRoles);
        }, command -> userSystemManager.roles((AbstractEntityManager.SearchResponse<Role> response) -> {
            if (response != null) {
                command.execute(response.getTotal());
            }
        }, (o, throwable) -> false).search(new SearchRequestImpl("", 1, 1, null)));
        adminPage.addTool("root", constants.Groups(), "fa-users", "security", () -> {
            final Command accessGroups = () -> {
                Map<String, String> params = new HashMap<>();
                params.put("activeTab", "GroupsTab");
                placeManager.goTo(new DefaultPlaceRequest(SECURITY_MANAGEMENT, params));
            };
            accessGroups.execute();
            addAdminBreadcrumbs(SECURITY_MANAGEMENT, constants.SecurityManagement(), accessGroups);
        }, command -> userSystemManager.groups((AbstractEntityManager.SearchResponse<Group> response) -> {
            if (response != null) {
                command.execute(response.getTotal());
            }
        }, (o, throwable) -> false).search(new SearchRequestImpl("", 1, 1, null)));
        adminPage.addTool("root", constants.Users(), "fa-user", "security", () -> {
            final Command accessUsers = () -> {
                Map<String, String> params = new HashMap<>();
                params.put("activeTab", "UsersTab");
                placeManager.goTo(new DefaultPlaceRequest(SECURITY_MANAGEMENT, params));
            };
            accessUsers.execute();
            addAdminBreadcrumbs(SECURITY_MANAGEMENT, constants.SecurityManagement(), accessUsers);
        }, command -> userSystemManager.users((AbstractEntityManager.SearchResponse<User> response) -> {
            if (response != null) {
                command.execute(response.getTotal());
            }
        }, (o, throwable) -> false).search(new SearchRequestImpl("", 1, 1, null)));
    }
}
Also used : Command(org.uberfire.mvp.Command) SearchRequestImpl(org.uberfire.ext.security.management.impl.SearchRequestImpl) DefaultPlaceRequest(org.uberfire.mvp.impl.DefaultPlaceRequest) HashMap(java.util.HashMap) Map(java.util.Map)

Example 37 with Command

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

the class ActiveOptionsInitTest method testParametersInPlaceRequest_business_tree.

@Test
public void testParametersInPlaceRequest_business_tree() throws Exception {
    Command completeCommand = mock(Command.class);
    PlaceRequest placeRequest = mock(PlaceRequest.class);
    when(placeRequest.getParameter("mode", "")).thenReturn("business_tree");
    options.init(placeRequest, completeCommand);
    assertFalse(options.getOptions().isEmpty());
    assertTrue(options.isBusinessViewActive());
    assertTrue(options.isTreeNavigatorVisible());
    assertFalse(options.areHiddenFilesVisible());
    verify(completeCommand).execute();
}
Also used : PlaceRequest(org.uberfire.mvp.PlaceRequest) Command(org.uberfire.mvp.Command) Test(org.junit.Test)

Example 38 with Command

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

the class ContainerView method confirmRemove.

@Override
public void confirmRemove(final Command command) {
    final YesNoCancelPopup result = YesNoCancelPopup.newYesNoCancelPopup(getConfirmRemovePopupTitle(), getConfirmRemovePopupMessage(), command, new Command() {

        @Override
        public void execute() {
        }
    }, null);
    result.clearScrollHeight();
    result.show();
}
Also used : Command(org.uberfire.mvp.Command) YesNoCancelPopup(org.uberfire.ext.widgets.common.client.common.popups.YesNoCancelPopup)

Example 39 with Command

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

the class ContainerCardPresenter method updateContent.

public void updateContent(final ServerInstanceKey serverInstanceKey, final Container container) {
    linkTitlePresenter.setup(serverInstanceKey.getServerName(), new Command() {

        @Override
        public void execute() {
            remoteServerSelectedEvent.fire(new ServerInstanceSelected(serverInstanceKey));
        }
    });
    bodyPresenter.setup(container.getMessages());
    footerPresenter.setup(container.getUrl(), container.getResolvedReleasedId().getVersion());
}
Also used : Command(org.uberfire.mvp.Command) ServerInstanceSelected(org.kie.workbench.common.screens.server.management.client.events.ServerInstanceSelected)

Example 40 with Command

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

the class ServerNavigationView method addTemplate.

@Override
public void addTemplate(final String id, final String name) {
    final CustomGroupItem template = new CustomGroupItem(name, IconType.FOLDER_O, new Command() {

        @Override
        public void execute() {
            presenter.select(id);
        }
    });
    idItem.put(id, template);
    serverTemplates.add(template);
}
Also used : Command(org.uberfire.mvp.Command) CustomGroupItem(org.kie.workbench.common.screens.server.management.client.widget.CustomGroupItem)

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