use of org.kie.workbench.common.stunner.core.domainobject.DomainObject in project kie-wb-common by kiegroup.
the class RelationGrid method doAfterSelectionChange.
@Override
public void doAfterSelectionChange(final int uiRowIndex, final int uiColumnIndex) {
if (hasAnyHeaderCellSelected() || hasMultipleCellsSelected()) {
super.doAfterSelectionChange(uiRowIndex, uiColumnIndex);
return;
}
if (getExpression().get().isPresent()) {
final Relation relation = getExpression().get().get();
final RelationUIModelMapperHelper.RelationSection section = RelationUIModelMapperHelper.getSection(relation, uiColumnIndex);
if (section == RelationUIModelMapperHelper.RelationSection.INFORMATION_ITEM) {
final int iiIndex = RelationUIModelMapperHelper.getInformationItemIndex(relation, uiColumnIndex);
final HasExpression hasExpression = relation.getRow().get(uiRowIndex).getExpression().get(iiIndex);
final Expression expression = hasExpression.getExpression();
if (expression instanceof DomainObject) {
final DomainObject domainObject = (DomainObject) expression;
fireDomainObjectSelectionEvent(domainObject);
return;
}
}
}
super.doAfterSelectionChange(uiRowIndex, uiColumnIndex);
}
use of org.kie.workbench.common.stunner.core.domainobject.DomainObject in project kie-wb-common by kiegroup.
the class BaseGrid method fireDomainObjectSelectionEvent.
protected void fireDomainObjectSelectionEvent() {
final Optional<CanvasHandler> canvasHandler = getCanvasHandler();
if (!canvasHandler.isPresent()) {
return;
}
final Optional<DomainObject> domainObject = getDomainObject();
if (!domainObject.isPresent()) {
domainObjectSelectionEvent.fire(new DomainObjectSelectionEvent(canvasHandler.get(), new NOPDomainObject()));
return;
}
fireDomainObjectSelectionEvent(domainObject.get());
}
use of org.kie.workbench.common.stunner.core.domainobject.DomainObject in project kie-wb-common by kiegroup.
the class FormsCanvasSessionHandler method onDomainObjectSelectionEvent.
void onDomainObjectSelectionEvent(@Observes DomainObjectSelectionEvent event) {
checkNotNull("event", event);
if (checkCanvasHandler(event.getCanvasHandler())) {
final DomainObject domainObject = event.getDomainObject();
render(domainObject);
}
}
use of org.kie.workbench.common.stunner.core.domainobject.DomainObject in project kie-wb-common by kiegroup.
the class ListGrid method doAfterSelectionChange.
@Override
public void doAfterSelectionChange(final int uiRowIndex, final int uiColumnIndex) {
if (hasAnyHeaderCellSelected() || hasMultipleCellsSelected()) {
super.doAfterSelectionChange(uiRowIndex, uiColumnIndex);
return;
}
if (getExpression().get().isPresent()) {
final List list = getExpression().get().get();
final ListUIModelMapperHelper.ListSection section = ListUIModelMapperHelper.getSection(uiColumnIndex);
if (section == ListUIModelMapperHelper.ListSection.EXPRESSION) {
final HasExpression hasExpression = list.getExpression().get(uiRowIndex);
final Expression expression = hasExpression.getExpression();
if (expression instanceof DomainObject) {
final DomainObject domainObject = (DomainObject) expression;
fireDomainObjectSelectionEvent(domainObject);
return;
}
}
}
super.doAfterSelectionChange(uiRowIndex, uiColumnIndex);
}
use of org.kie.workbench.common.stunner.core.domainobject.DomainObject in project kie-wb-common by kiegroup.
the class PropertiesPanelNotifierTest method testOnDomainObjectSelectionEvent.
@Test
public void testOnDomainObjectSelectionEvent() {
final DomainObjectSelectionEvent selectionEvent = mock(DomainObjectSelectionEvent.class);
final DomainObject domainObject = mock(DomainObject.class);
final String uuid = "uuid";
when(selectionEvent.getDomainObject()).thenReturn(domainObject);
when(domainObject.getDomainObjectUUID()).thenReturn(uuid);
notifier.onDomainObjectSelectionEvent(selectionEvent);
verify(notifier).setSelectedElementUUID(uuid);
}
Aggregations