use of org.kie.workbench.common.stunner.forms.client.event.FormFieldChanged in project kie-wb-common by kiegroup.
the class FormsContainerTest method testRender.
private FormDisplayer testRender(NodeImpl<Definition<?>> node, int expectedDisplayers, int currentDisplayerRender, RenderMode renderMode) {
// clear mocks
reset(renderer);
reset(formFieldChangedEvent);
formsContainer.render(GRAPH_UUID, node.getUUID(), node.getContent().getDefinition(), path, fieldChangeHandler, renderMode);
verify(displayersInstance, times(expectedDisplayers)).get();
assertThat(activeDisplayers).isNotEmpty().hasSize(expectedDisplayers);
FormDisplayer displayer = activeDisplayers.get(expectedDisplayers - 1);
verify(displayer, times(currentDisplayerRender)).render(node.getUUID(), node.getContent().getDefinition(), path, fieldChangeHandler, renderMode);
verify(displayer, times(currentDisplayerRender)).hide();
verify(view, times(currentDisplayerRender)).addDisplayer(displayer);
verify(displayer).show();
// test fire FormFieldChanged event
final ArgumentCaptor<FieldChangeHandler> fieldChangeHandlerArgumentCaptor = ArgumentCaptor.forClass(FieldChangeHandler.class);
verify(renderer).addFieldChangeHandler(fieldChangeHandlerArgumentCaptor.capture());
fieldChangeHandlerArgumentCaptor.getValue().onFieldChange("field", "value");
final ArgumentCaptor<FormFieldChanged> formFieldChangedArgumentCaptor = ArgumentCaptor.forClass(FormFieldChanged.class);
verify(formFieldChangedEvent).fire(formFieldChangedArgumentCaptor.capture());
final FormFieldChanged formFieldChanged = formFieldChangedArgumentCaptor.getValue();
assertThat(formFieldChanged.getName()).isEqualTo("field");
assertThat(formFieldChanged.getValue()).isEqualTo("value");
assertThat(formFieldChanged.getUuid()).isEqualTo(node.getUUID());
return displayer;
}
use of org.kie.workbench.common.stunner.forms.client.event.FormFieldChanged in project kie-wb-common by kiegroup.
the class FormsContainer method render.
public void render(final String graphUuid, final String domainObjectUUID, final Object domainObject, final Path diagramPath, final FieldChangeHandler changeHandler, final RenderMode renderMode) {
FormDisplayer displayer = getDisplayer(graphUuid, domainObjectUUID);
displayer.render(domainObjectUUID, domainObject, diagramPath, changeHandler, renderMode);
if (null != currentDisplayer && !displayer.equals(currentDisplayer)) {
currentDisplayer.hide();
}
displayer.show();
currentDisplayer = displayer;
currentDisplayer.getRenderer().addFieldChangeHandler((name, value) -> {
formFieldChangedEvent.fire(new FormFieldChanged(name, value, domainObjectUUID));
});
}
use of org.kie.workbench.common.stunner.forms.client.event.FormFieldChanged in project kie-wb-common by kiegroup.
the class MultipleInstanceNodeFilterProviderTest method testOnFormFieldChangedForOtherThanMultipleInstance.
@Test
public void testOnFormFieldChangedForOtherThanMultipleInstance() {
FormFieldChanged formFieldChanged = mockFormFieldChanged("anyOtherField", "anyOtherUUID");
filterProvider.onFormFieldChanged(formFieldChanged);
verify(refreshFormPropertiesEvent, never()).fire(any());
}
use of org.kie.workbench.common.stunner.forms.client.event.FormFieldChanged in project kie-wb-common by kiegroup.
the class MultipleInstanceNodeFilterProviderTest method testOnFormFieldChangedForMultipleInstance.
@Test
public void testOnFormFieldChangedForMultipleInstance() {
FormFieldChanged formFieldChanged = mockFormFieldChanged(IS_MULTIPLE_INSTANCE, UUID);
filterProvider.onFormFieldChanged(formFieldChanged);
verifyFieldChangeFired();
}
use of org.kie.workbench.common.stunner.forms.client.event.FormFieldChanged in project kie-wb-common by kiegroup.
the class BaseReusableSubProcessFilterProviderTest method testOnFormFieldChangedForIndependentField.
@Test
public void testOnFormFieldChangedForIndependentField() {
FormFieldChanged formFieldChanged = mockFormFieldChanged(INDEPENDENT, UUID);
filterProvider.onFormFieldChanged(formFieldChanged);
verifyFieldChangeFired();
}
Aggregations