use of org.kie.workbench.common.stunner.forms.client.event.RefreshFormPropertiesEvent in project kie-wb-common by kiegroup.
the class StunnerFormsHandlerTest method testRefreshCurrentSessionFormsByDomain.
@Test
@SuppressWarnings("unchecked")
public void testRefreshCurrentSessionFormsByDomain() {
ClientSession session = mock(ClientSession.class);
CanvasHandler handler = mock(CanvasHandler.class);
Diagram diagram = mock(Diagram.class);
Metadata metadata = mock(Metadata.class);
when(sessionManager.getCurrentSession()).thenReturn(session);
when(session.getCanvasHandler()).thenReturn(handler);
when(handler.getDiagram()).thenReturn(diagram);
when(diagram.getMetadata()).thenReturn(metadata);
when(metadata.getDefinitionSetId()).thenReturn(BindableAdapterUtils.getDefinitionSetId(SomeDomain.class));
tested.refreshCurrentSessionForms(SomeDomain.class);
ArgumentCaptor<RefreshFormPropertiesEvent> eventCaptor = ArgumentCaptor.forClass(RefreshFormPropertiesEvent.class);
verify(refreshFormsEvent, times(1)).fire(eventCaptor.capture());
RefreshFormPropertiesEvent event = eventCaptor.getValue();
assertEquals(session, event.getSession());
assertNull(event.getUuid());
}
use of org.kie.workbench.common.stunner.forms.client.event.RefreshFormPropertiesEvent in project kie-wb-common by kiegroup.
the class RuleLanguageFilterProvider method onFormFieldChanged.
void onFormFieldChanged(@Observes FormFieldChanged formFieldChanged) {
final String ruleLanguageFieldName = BusinessRuleTask.EXECUTION_SET + "." + BusinessRuleTaskExecutionSet.RULE_LANGUAGE;
if (!Objects.equals(formFieldChanged.getName(), ruleLanguageFieldName)) {
return;
}
refreshFormPropertiesEvent.fire(new RefreshFormPropertiesEvent(sessionManager.getCurrentSession(), formFieldChanged.getUuid()));
}
use of org.kie.workbench.common.stunner.forms.client.event.RefreshFormPropertiesEvent in project kie-wb-common by kiegroup.
the class BaseExpressionGridGeneralTest method testSelectHeaderCellWithDomainObjectInStunnerGraph.
@Test
public void testSelectHeaderCellWithDomainObjectInStunnerGraph() {
grid.getModel().appendColumn(new RowNumberColumn());
grid.getModel().appendColumn(new RowNumberColumn());
// Mock graph to contain decision
final Definition definition = mock(Definition.class);
when(node.getUUID()).thenReturn(NODE_UUID);
when(node.getContent()).thenReturn(definition);
when(definition.getDefinition()).thenReturn(decision);
// Mock grid to dispatch header selection as a DomainObject
doAnswer(i -> {
grid.fireDomainObjectSelectionEvent(decision);
return null;
}).when(grid).doAfterHeaderSelectionChange(anyInt(), anyInt());
grid.selectHeaderCell(0, 1, false, false);
assertHeaderSelection();
verify(refreshFormPropertiesEvent).fire(refreshFormPropertiesEventCaptor.capture());
final RefreshFormPropertiesEvent refreshFormPropertiesEvent = refreshFormPropertiesEventCaptor.getValue();
assertThat(refreshFormPropertiesEvent.getUuid()).isEqualTo(NODE_UUID);
assertThat(refreshFormPropertiesEvent.getSession()).isEqualTo(session);
}
use of org.kie.workbench.common.stunner.forms.client.event.RefreshFormPropertiesEvent in project kie-wb-common by kiegroup.
the class PropertiesPanelNotifier method refreshFormProperties.
void refreshFormProperties(final Node node) {
final ClientSession currentSession = getCurrentSession().orElseThrow(UnsupportedOperationException::new);
final String uuid = node.getUUID();
getSelectedElementUUID().ifPresent(selectedElementUUID -> {
if (Objects.equals(uuid, selectedElementUUID)) {
refreshFormPropertiesEvent.fire(new RefreshFormPropertiesEvent(currentSession, uuid));
}
});
}
use of org.kie.workbench.common.stunner.forms.client.event.RefreshFormPropertiesEvent in project kie-wb-common by kiegroup.
the class NavigateToDRGEditorCommandTest method executeCanvasCommand.
@Test
@Override
public void executeCanvasCommand() {
setup(false);
assertEquals(CanvasCommandResultBuilder.SUCCESS, command.getCanvasCommand(canvasHandler).execute(canvasHandler));
verify(canvas).enableHandlers();
verify(command).hidePaletteWidget(eq(false));
verify(command).addDRGEditorToCanvasWidget();
verify(sessionPresenterView).setCanvasWidget(view);
verify(sessionPresenter).focus();
verify(refreshFormPropertiesEvent).fire(refreshFormPropertiesEventCaptor.capture());
final RefreshFormPropertiesEvent refreshFormPropertiesEvent = refreshFormPropertiesEventCaptor.getValue();
assertEquals(NODE_UUID, refreshFormPropertiesEvent.getUuid());
}
Aggregations