Search in sources :

Example 66 with Command

use of com.google.gwt.user.client.Command in project drools-wb by kiegroup.

the class AddFieldClickHandler method onClick.

@Override
public void onClick(final ClickEvent event) {
    final FormStylePopup pop = new FormStylePopup(TestScenarioConstants.INSTANCE.ChooseAFieldToAdd());
    final FactFieldSelector selector = createAddNewField(pop);
    pop.addAttribute(TestScenarioConstants.INSTANCE.ChooseAFieldToAdd(), selector);
    pop.add(new ModalFooterOKCancelButtons(new Command() {

        @Override
        public void execute() {
            SelectionEvent.fire(selector, selector.getSelectedText());
        }
    }, new Command() {

        @Override
        public void execute() {
            pop.hide();
        }
    }));
    pop.show();
}
Also used : Command(com.google.gwt.user.client.Command) ModalFooterOKCancelButtons(org.uberfire.ext.widgets.common.client.common.popups.footers.ModalFooterOKCancelButtons) FormStylePopup(org.uberfire.ext.widgets.common.client.common.popups.FormStylePopup)

Example 67 with Command

use of com.google.gwt.user.client.Command in project drools-wb by kiegroup.

the class GuidedDecisionTableModellerPresenter method removeDecisionTable.

@Override
public void removeDecisionTable(final GuidedDecisionTableView.Presenter dtPresenter) {
    final Command afterRemovalCommand = () -> {
        availableDecisionTables.remove(dtPresenter);
        if (dtPresenter.equals(activeDecisionTable)) {
            activeDecisionTable = null;
        }
        dtPresenter.onClose();
        removeLinksForDecisionTable(dtPresenter);
    };
    view.removeDecisionTable(dtPresenter.getView(), afterRemovalCommand);
}
Also used : Command(com.google.gwt.user.client.Command)

Example 68 with Command

use of com.google.gwt.user.client.Command in project drools-wb by kiegroup.

the class ColumnsPagePresenterTest method testDeleteMetaDataColumnAnchor.

@Test
public void testDeleteMetaDataColumnAnchor() {
    final DeleteColumnManagementAnchorWidget expectedWidget = mock(DeleteColumnManagementAnchorWidget.class);
    final String columnHeader = "columnHeader";
    final Command command = mock(Command.class);
    doReturn(columnHeader).when(metadataColumn).getMetadata();
    doReturn(expectedWidget).when(deleteColumnManagementAnchorWidgets).get();
    doReturn(command).when(presenter).deleteMetadataCommand(modeller, metadataColumn);
    final DeleteColumnManagementAnchorWidget actualWidget = presenter.deleteMetaDataColumnAnchor(modeller, metadataColumn);
    verify(actualWidget).init(columnHeader, command);
    assertEquals(expectedWidget, actualWidget);
}
Also used : Command(com.google.gwt.user.client.Command) ParameterizedCommand(org.uberfire.mvp.ParameterizedCommand) DeleteColumnManagementAnchorWidget(org.drools.workbench.screens.guided.dtable.client.widget.table.columns.control.DeleteColumnManagementAnchorWidget) Matchers.anyString(org.mockito.Matchers.anyString) Test(org.junit.Test)

Example 69 with Command

use of com.google.gwt.user.client.Command in project drools-wb by kiegroup.

the class GuidedDecisionTableModellerPresenterTest method exitPinnedMode.

@Test
public void exitPinnedMode() {
    final Command command = mock(Command.class);
    presenter.exitPinnedMode(command);
    verify(gridLayer, times(1)).exitPinnedMode(eq(command));
    verify(columnHeaderPopOver, times(1)).hide();
}
Also used : Command(com.google.gwt.user.client.Command) Test(org.junit.Test)

Example 70 with Command

use of com.google.gwt.user.client.Command in project drools-wb by kiegroup.

the class GuidedDecisionTableModellerPresenterTest method refreshingDecisionTableRetainsExistingLocation.

@Test
public void refreshingDecisionTableRetainsExistingLocation() {
    final GuidedDecisionTableView.Presenter dtPresenter = makeDecisionTable();
    final GuidedDecisionTableEditorContent dtContent = makeDecisionTableContent();
    final GuidedDecisionTableView dtView = dtPresenter.getView();
    final ObservablePath path = mock(ObservablePath.class);
    final PlaceRequest placeRequest = mock(PlaceRequest.class);
    final Point2D dtLocation = new Point2D(100, 100);
    when(dtView.getLocation()).thenReturn(dtLocation);
    final ArgumentCaptor<Command> afterRemovalCommandCaptor = ArgumentCaptor.forClass(Command.class);
    presenter.refreshDecisionTable(dtPresenter, path, placeRequest, dtContent, false);
    verify(dtView, times(1)).getLocation();
    verify(view, times(1)).removeDecisionTable(eq(dtView), afterRemovalCommandCaptor.capture());
    final Command afterRemovalCommand = afterRemovalCommandCaptor.getValue();
    assertNotNull(afterRemovalCommand);
    afterRemovalCommand.execute();
    verify(dtView, times(1)).setLocation(eq(dtLocation));
}
Also used : PlaceRequest(org.uberfire.mvp.PlaceRequest) Point2D(com.ait.lienzo.client.core.types.Point2D) Command(com.google.gwt.user.client.Command) GuidedDecisionTableEditorContent(org.drools.workbench.screens.guided.dtable.model.GuidedDecisionTableEditorContent) ObservablePath(org.uberfire.backend.vfs.ObservablePath) Test(org.junit.Test)

Aggregations

Command (com.google.gwt.user.client.Command)189 AppCommand (org.rstudio.core.client.command.AppCommand)39 ScheduledCommand (com.google.gwt.core.client.Scheduler.ScheduledCommand)38 RepeatingCommand (com.google.gwt.core.client.Scheduler.RepeatingCommand)21 JsArrayString (com.google.gwt.core.client.JsArrayString)16 Test (org.junit.Test)16 ClickEvent (com.google.gwt.event.dom.client.ClickEvent)15 ClickHandler (com.google.gwt.event.dom.client.ClickHandler)15 ArrayList (java.util.ArrayList)11 ServerError (org.rstudio.studio.client.server.ServerError)11 JsonCallbackEvents (cz.metacentrum.perun.webgui.json.JsonCallbackEvents)10 CustomButton (cz.metacentrum.perun.webgui.widgets.CustomButton)10 FileSystemItem (org.rstudio.core.client.files.FileSystemItem)9 JavaScriptObject (com.google.gwt.core.client.JavaScriptObject)8 MenuItem (com.google.gwt.user.client.ui.MenuItem)8 Handler (org.rstudio.core.client.command.Handler)8 TextEditingTarget (org.rstudio.studio.client.workbench.views.source.editors.text.TextEditingTarget)8 Widget (com.google.gwt.user.client.ui.Widget)7 Operation (org.rstudio.core.client.widget.Operation)7 EditingTarget (org.rstudio.studio.client.workbench.views.source.editors.EditingTarget)7