use of org.kie.workbench.common.stunner.core.client.canvas.command.AbstractCanvasGraphCommand in project kie-wb-common by kiegroup.
the class SessionPreviewImplTest method checkVetoUndoCommands.
@Test
public void checkVetoUndoCommands() {
final AbstractCanvasGraphCommand command = new MockVetoUndoCommand();
preview.handleCanvasUndoCommandExecutedEvent(makeCommandUndoContext(command));
verify(canvasCommandManager, never()).undo(any(AbstractCanvasHandler.class), any(AbstractCanvasGraphCommand.class));
}
use of org.kie.workbench.common.stunner.core.client.canvas.command.AbstractCanvasGraphCommand in project kie-wb-common by kiegroup.
the class BaseExpressionGrid method getUpdateStunnerTitleCommand.
protected Optional<AbstractCanvasGraphCommand> getUpdateStunnerTitleCommand(final String value) {
AbstractCanvasGraphCommand command = null;
if (nodeUUID.isPresent()) {
final String uuid = nodeUUID.get();
final AbstractCanvasHandler canvasHandler = (AbstractCanvasHandler) sessionManager.getCurrentSession().getCanvasHandler();
final Element<?> element = canvasHandler.getGraphIndex().get(uuid);
if (element.getContent() instanceof Definition) {
final Definition definition = (Definition) element.getContent();
final String nameId = definitionUtils.getNameIdentifier(definition.getDefinition());
if (nameId != null) {
command = (AbstractCanvasGraphCommand) canvasCommandFactory.updatePropertyValue(element, nameId, value);
}
}
}
return Optional.ofNullable(command);
}
use of org.kie.workbench.common.stunner.core.client.canvas.command.AbstractCanvasGraphCommand in project kie-wb-common by kiegroup.
the class DecisionTableGridTest method testOutputClauseHasNameWrapperForHeaderMetaData.
@Test
@SuppressWarnings("unchecked")
public void testOutputClauseHasNameWrapperForHeaderMetaData() {
setupGrid(makeHasNameForDecision(), 0);
// More than one OutputClause column is required before the tested wrapper is instantiated.
addOutputClause(3);
final DecisionTable dtable = expression.get();
final OutputClause outputClause = dtable.getOutput().get(0);
final GridColumn.HeaderMetaData outputClauseHeaderMetaData = grid.getModel().getColumns().get(2).getHeaderMetaData().get(1);
assertThat(outputClause.getName()).isEqualTo(outputClauseHeaderMetaData.getTitle());
reset(sessionCommandManager);
extractHeaderMetaData(1, 2).setValue(new Name(NAME_NEW));
verify(sessionCommandManager).execute(eq(canvasHandler), compositeCommandCaptor.capture());
((AbstractCanvasGraphCommand) compositeCommandCaptor.getValue().getCommands().get(0)).execute(canvasHandler);
assertThat(outputClause.getName()).isEqualTo(NAME_NEW);
}
use of org.kie.workbench.common.stunner.core.client.canvas.command.AbstractCanvasGraphCommand in project kie-wb-common by kiegroup.
the class BaseExpressionGrid method getUpdateStunnerTitleCommand.
protected <V> Optional<AbstractCanvasGraphCommand> getUpdateStunnerTitleCommand(final V value) {
AbstractCanvasGraphCommand command = null;
if (getNodeUUID().isPresent()) {
final String uuid = getNodeUUID().get();
final AbstractCanvasHandler canvasHandler = (AbstractCanvasHandler) sessionManager.getCurrentSession().getCanvasHandler();
final Element<?> element = canvasHandler.getGraphIndex().get(uuid);
if (element.getContent() instanceof Definition) {
final Definition definition = (Definition) element.getContent();
final String nameId = definitionUtils.getNameIdentifier(definition.getDefinition());
if (nameId != null) {
command = (AbstractCanvasGraphCommand) canvasCommandFactory.updatePropertyValue(element, nameId, value);
}
}
}
return Optional.ofNullable(command);
}
Aggregations