use of org.kie.workbench.common.stunner.forms.client.event.RefreshFormPropertiesEvent in project kie-wb-common by kiegroup.
the class BaseGrid method fireDomainObjectSelectionEvent.
protected void fireDomainObjectSelectionEvent(final DomainObject domainObject) {
final Optional<CanvasHandler> canvasHandler = getCanvasHandler();
if (!canvasHandler.isPresent()) {
return;
}
final Optional<Node> domainObjectNode = findDomainObjectNodeByDomainObject(domainObject);
if (domainObjectNode.isPresent()) {
refreshFormPropertiesEvent.fire(new RefreshFormPropertiesEvent(getCurrentSession(), domainObjectNode.get().getUUID()));
selectedDomainObject = Optional.empty();
} else {
domainObjectSelectionEvent.fire(new DomainObjectSelectionEvent(canvasHandler.get(), domainObject));
selectedDomainObject = Optional.of(domainObject);
}
}
use of org.kie.workbench.common.stunner.forms.client.event.RefreshFormPropertiesEvent in project kie-wb-common by kiegroup.
the class FormsCanvasSessionHandlerTest method setup.
@Before
@SuppressWarnings("unchecked")
public void setup() {
this.refreshFormPropertiesEvent = new RefreshFormPropertiesEvent(session, UUID);
this.handler = spy(new FormsCanvasSessionHandler(definitionManager, commandFactory, sessionCommandManager) {
@Override
protected FormsCanvasSessionHandler.FormsDomainObjectCanvasListener getFormsDomainObjectCanvasListener() {
return domainObjectCanvasListener;
}
});
this.handler.setRenderer(formRenderer);
when(session.getCanvasHandler()).thenReturn(abstractCanvasHandler);
when(session.getSelectionControl()).thenReturn(selectionControl);
when(abstractCanvasHandler.getGraphIndex()).thenReturn(index);
when(abstractCanvasHandler.getDiagram()).thenReturn(diagram);
when(index.get(eq(UUID))).thenReturn(element);
when(diagram.getGraph()).thenReturn(graph);
when(graph.getUUID()).thenReturn(GRAPH_UUID);
when(definitionManager.adapters()).thenReturn(adapterManager);
when(adapterManager.forProperty()).thenReturn(propertyAdapter);
when(propertyAdapter.getId(any())).thenReturn(FIELD_PROPERTY_ID);
when(commandFactory.updateDomainObjectPropertyValue(domainObject, FIELD_NAME, FIELD_VALUE)).thenReturn(updateDomainObjectPropertyCommand);
}
use of org.kie.workbench.common.stunner.forms.client.event.RefreshFormPropertiesEvent in project kie-wb-common by kiegroup.
the class StunnerFormsHandlerTest method testRefreshCurrentSessionForms.
@Test
@SuppressWarnings("unchecked")
public void testRefreshCurrentSessionForms() {
ClientSession session = mock(ClientSession.class);
when(sessionManager.getCurrentSession()).thenReturn(session);
tested.refreshCurrentSessionForms();
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 DefaultImportsEditorWidget method addDataTypes.
public void addDataTypes(ImportsValue imports) {
boolean updated = false;
for (DefaultImport imported : imports.getDefaultImports()) {
if (imported.getClassName() != null && !defaultTypes.contains(imported.getClassName())) {
updated = true;
dataTypeNamesService.add(imported.getClassName(), null);
}
}
if (updated) {
refreshFormsEvent.fire(new RefreshFormPropertiesEvent(sessionManager.getCurrentSession()));
}
}
use of org.kie.workbench.common.stunner.forms.client.event.RefreshFormPropertiesEvent in project kie-wb-common by kiegroup.
the class BPMNDiagramFilterProviderTest method onFormFieldChanged.
@Test
public void onFormFieldChanged() {
tested.onFormFieldChanged(formFieldChanged);
final ArgumentCaptor<RefreshFormPropertiesEvent> refreshFormPropertiesArgumentCaptor = ArgumentCaptor.forClass(RefreshFormPropertiesEvent.class);
verify(refreshFormPropertiesEvent).fire(refreshFormPropertiesArgumentCaptor.capture());
RefreshFormPropertiesEvent refreshEvent = refreshFormPropertiesArgumentCaptor.getValue();
assertEquals(refreshEvent.getUuid(), UUID);
assertEquals(refreshEvent.getSession(), session);
}
Aggregations