use of org.knime.core.node.workflow.ConnectionContainer in project knime-core by knime.
the class NewBendpointCreateCommand method redo.
/**
* {@inheritDoc}
*/
@Override
public void redo() {
ConnectionContainer connection = getConnectionContainer();
ConnectionUIInformation uiInfo = getUIInfo(connection);
Point location = m_location.getCopy();
WorkflowEditor.adaptZoom(m_zoomManager, location, true);
uiInfo = ConnectionUIInformation.builder(uiInfo).addBendpoint(location.x, location.y, m_index).build();
// we need this to fire some update event up
connection.setUIInfo(uiInfo);
}
use of org.knime.core.node.workflow.ConnectionContainer in project knime-core by knime.
the class NewBendpointMoveCommand method execute.
/**
* {@inheritDoc}
*/
@Override
public void execute() {
ConnectionContainer connection = getConnection();
ConnectionUIInformation uiInfo = connection.getUIInfo();
ConnectionUIInformation.Builder uiInfoBuilder = ConnectionUIInformation.builder(connection.getUIInfo());
int[] p = uiInfo.getBendpoint(m_index);
m_oldLocation = new Point(p[0], p[1]);
Point newLocation = m_newLocation.getCopy();
WorkflowEditor.adaptZoom(m_zoomManager, newLocation, true);
// TODO for every single bendpoint move a new ConnectionUIInformation object needs to be created
uiInfoBuilder.removeBendpoint(m_index);
uiInfoBuilder.addBendpoint(newLocation.x, newLocation.y, m_index);
// issue notification
connection.setUIInfo(uiInfoBuilder.build());
}
use of org.knime.core.node.workflow.ConnectionContainer in project knime-core by knime.
the class NewBendpointMoveCommand method redo.
/**
* {@inheritDoc}
*/
@Override
public void redo() {
ConnectionContainer connection = getConnection();
ConnectionUIInformation.Builder uiInfoBuilder = ConnectionUIInformation.builder(connection.getUIInfo());
uiInfoBuilder.removeBendpoint(m_index);
Point newLocation = m_newLocation.getCopy();
WorkflowEditor.adaptZoom(m_zoomManager, newLocation, true);
uiInfoBuilder.addBendpoint(newLocation.x, newLocation.y, m_index);
// issue notification
connection.setUIInfo(uiInfoBuilder.build());
}
use of org.knime.core.node.workflow.ConnectionContainer in project knime-core by knime.
the class ShiftConnectionCommand method execute.
/**
* {@inheritDoc}
*/
@Override
public void execute() {
m_oldPort = getLastConnectedPort();
ConnectionContainer existingConn = getHostWFM().getIncomingConnectionFor(m_nodeID, m_oldPort);
assert existingConn != null;
m_newPort = getNextMatchingPort(existingConn);
getHostWFM().removeConnection(existingConn);
try {
getHostWFM().addConnection(existingConn.getSource(), existingConn.getSourcePort(), m_nodeID, m_newPort);
} catch (Exception e) {
LOGGER.error("Unable to insert new connection - " + "restoring old connection", e);
getHostWFM().addConnection(existingConn.getSource(), existingConn.getSourcePort(), m_nodeID, m_oldPort);
m_oldPort = -1;
m_newPort = -1;
}
}
use of org.knime.core.node.workflow.ConnectionContainer in project knime-core by knime.
the class ShiftConnectionCommand method undo.
/**
* {@inheritDoc}
*/
@Override
public void undo() {
ConnectionContainer newConn = getHostWFM().getIncomingConnectionFor(m_nodeID, m_newPort);
assert newConn != null;
getHostWFM().removeConnection(newConn);
try {
getHostWFM().addConnection(newConn.getSource(), newConn.getSourcePort(), m_nodeID, m_oldPort);
} catch (Exception e) {
LOGGER.error("Unable to redo connection shift - " + "restoring shifted connection", e);
getHostWFM().addConnection(newConn.getSource(), newConn.getSourcePort(), m_nodeID, m_newPort);
}
}
Aggregations