use of org.knime.core.ui.node.workflow.NodeContainerUI in project knime-core by knime.
the class NodeContainerEditPart method checkMetaNodeLockIcon.
private void checkMetaNodeLockIcon() {
NodeContainerUI nc = getNodeContainer();
if (nc instanceof WorkflowManagerUI) {
WorkflowManagerUI wm = (WorkflowManagerUI) nc;
Image i;
if (wm.isEncrypted()) {
if (wm.isUnlocked()) {
i = META_NODE_UNLOCK_ICON;
} else {
i = META_NODE_LOCK_ICON;
}
} else {
i = null;
}
NodeContainerFigure fig = (NodeContainerFigure) getFigure();
fig.setMetaNodeLockIcon(i);
}
}
use of org.knime.core.ui.node.workflow.NodeContainerUI in project knime-core by knime.
the class NodeInPortEditPart method createFigure.
/**
* {@inheritDoc}
*/
@Override
protected IFigure createFigure() {
// Create the figure, we need the number of ports from the parent
// container
NodeContainerUI container = getNodeContainer();
boolean isMetaNode = !(container instanceof SingleNodeContainerUI);
NodeInPortFigure portFigure = new NodeInPortFigure(getType(), getIndex(), container.getNrInPorts(), isMetaNode, container.getInPort(getIndex()).getPortName());
portFigure.setIsConnected(isConnected());
return portFigure;
}
use of org.knime.core.ui.node.workflow.NodeContainerUI in project knime-core by knime.
the class NewWorkflowXYLayoutPolicy method createChangeConstraintCommand.
/**
* Creates command to move / resize <code>NodeContainer</code> components on
* the project's client area.
*
* {@inheritDoc}
*/
@Override
protected Command createChangeConstraintCommand(final EditPart child, final Object constraint) {
// only rectangular constraints are supported
if (!(constraint instanceof Rectangle)) {
return null;
}
Command command = null;
Rectangle rect = ((Rectangle) constraint).getCopy();
if (child.getModel() instanceof NodeContainerUI) {
NodeContainerUI container = (NodeContainerUI) child.getModel();
if (!Wrapper.wraps(container, NodeContainer.class)) {
// not supported for others than ordinary NodeContainers
return null;
}
NodeContainerEditPart nodePart = (NodeContainerEditPart) child;
command = new ChangeNodeBoundsCommand(Wrapper.unwrapNC(container), (NodeContainerFigure) nodePart.getFigure(), rect);
} else if (child instanceof AbstractWorkflowPortBarEditPart) {
command = new ChangeWorkflowPortBarCommand((AbstractWorkflowPortBarEditPart) child, rect);
} else if (child instanceof AnnotationEditPart) {
AnnotationEditPart annoPart = (AnnotationEditPart) child;
// TODO the workflow annotation could know what its WFM is?
WorkflowRootEditPart root = (WorkflowRootEditPart) annoPart.getParent();
WorkflowManagerUI wm = root.getWorkflowManager();
if (!Wrapper.wraps(wm, WorkflowManager.class)) {
// not supported for others than an ordinary workflow manager
return null;
}
command = new ChangeAnnotationBoundsCommand(Wrapper.unwrapWFM(wm), annoPart, rect);
}
return command;
}
use of org.knime.core.ui.node.workflow.NodeContainerUI in project knime-core by knime.
the class NodeMonitorView method dispose.
/**
* {@inheritDoc}
*/
@Override
public void dispose() {
NodeContainerUI cont = m_lastNode;
if (cont != null) {
cont.removeNodeStateChangeListener(this);
m_lastNode = null;
}
getViewSite().getPage().removeSelectionListener(this);
super.dispose();
}
use of org.knime.core.ui.node.workflow.NodeContainerUI in project knime-core by knime.
the class NodeMonitorView method selectionChanged.
/**
* The method updating the content of the monitor.
*
* {@inheritDoc}
*/
@Override
public void selectionChanged(final IWorkbenchPart part, final ISelection selection) {
if (!(selection instanceof IStructuredSelection)) {
return;
}
IStructuredSelection structSel = (IStructuredSelection) selection;
if (m_pinned) {
m_lastSelectionWhilePinned = structSel;
return;
}
if (structSel.equals(m_lastSelection)) {
// selection hasn't changed - return.
return;
}
m_lastSelection = structSel;
if (structSel.size() < 1) {
// Nothing selected
m_title.setText("");
m_state.setText("no node selected");
m_table.removeAll();
return;
}
if (structSel.size() > 1) {
// too many selected items
m_title.setText("");
m_state.setText("more than one element selected.");
m_table.removeAll();
return;
}
// retrieve first (and only!) selection:
Iterator<?> selIt = structSel.iterator();
Object sel = selIt.next();
//
if (sel instanceof NodeContainerEditPart) {
// a NodeContainer was selected, display it's name and status
NodeContainerUI nc = ((NodeContainerEditPart) sel).getNodeContainer();
updateNodeContainerInfo(nc);
} else {
// unsupported selection
unsupportedSelection(sel);
}
}
Aggregations