use of org.knime.workbench.editor2.model.WorkflowPortBar in project knime-core by knime.
the class WorkflowOutPortBarEditPart method createFigure.
/**
* {@inheritDoc}
*/
@Override
protected IFigure createFigure() {
NodeUIInformation uiInfo = ((WorkflowPortBar) getModel()).getUIInfo();
if (uiInfo != null) {
int[] bounds = uiInfo.getBounds();
Rectangle newBounds = new Rectangle(bounds[0], bounds[1], bounds[2], bounds[3]);
return new WorkflowOutPortBarFigure(newBounds);
} else {
int[] minmax = getMinMaxXcoordInWorkflow();
return new WorkflowOutPortBarFigure(minmax[1]);
}
}
use of org.knime.workbench.editor2.model.WorkflowPortBar in project knime-core by knime.
the class PortGraphicalRoleEditPolicy method getConnectionCreateCommand.
/**
* This tries to initialize the command to create a connection as far as
* possible. However, it is completed by
* <code>getConnectionCompleteCommand</code>
*
* {@inheritDoc}
*/
@Override
protected Command getConnectionCreateCommand(final CreateConnectionRequest req) {
if (!(getHost() instanceof AbstractPortEditPart)) {
return null;
}
ConnectableEditPart nodePart = (ConnectableEditPart) getHost().getParent();
WorkflowManagerUI wm;
// TODO: if NodeContainerEditPart -> getParent
if (nodePart instanceof NodeContainerEditPart) {
NodeContainerEditPart p = (NodeContainerEditPart) nodePart;
wm = p.getWorkflowManager();
} else if (nodePart instanceof WorkflowInPortBarEditPart) {
WorkflowInPortBarEditPart barEditPart = (WorkflowInPortBarEditPart) nodePart;
WorkflowPortBar model = (WorkflowPortBar) barEditPart.getModel();
wm = model.getWorkflowManager();
} else {
return null;
}
CreateConnectionCommand cmd = new CreateConnectionCommand(Wrapper.unwrapWFM(wm));
if (getHost() instanceof NodeOutPortEditPart || getHost() instanceof WorkflowInPortEditPart || getHost() instanceof MetaNodeOutPortEditPart) {
// request started on out port?
cmd.setSourceNode(nodePart);
cmd.setSourcePortID(((AbstractPortEditPart) getHost()).getIndex());
cmd.setStartedOnOutPort(true);
} else if (getHost() instanceof NodeInPortEditPart || getHost() instanceof WorkflowOutPortEditPart) {
return null;
}
// we need the manager to execute the command
// we must remember this partially initialized command in the request.
req.setStartCommand(cmd);
return cmd;
}
Aggregations