public void actionPerformed(ActionEvent e) { Component parent = UIUtils.getActionEventParentWindow(e); String name = (String) JOptionPane.showInputDialog(parent, "Name for the new workflow input?", "Name required", JOptionPane.QUESTION_MESSAGE, null, null, ""); if (name != null) { try { model.getWorkflowSourceProcessor() .addPort( new OutputPort(model .getWorkflowSourceProcessor(), name)); model.forceUpdate(); } catch (PortCreationException pce) { JOptionPane.showMessageDialog(parent, "Port creation exception : \n" + pce.getMessage(), "Exception!", JOptionPane.ERROR_MESSAGE); } catch (DuplicatePortNameException dpne) { JOptionPane.showMessageDialog(parent, "Duplicate name : \n" + dpne.getMessage(), "Exception!", JOptionPane.ERROR_MESSAGE); } } } }
processor = scuflModel.getWorkflowSourceProcessor(); if (processor.getPorts().length != 0)
void addInputPort(String name) throws DuplicatePortNameException, PortCreationException { model.getWorkflowSourceProcessor().addPort( new OutputPort(model.getWorkflowSourceProcessor(), name)); model.forceUpdate(); }
menu.add(new AddOutputAction(model)); } else if (scuflObject == model .getWorkflowSourceProcessor()) { menu = new JPopupMenu(); menu.add(new ShadedLabel(
public void remove(Object[] cells) { for (int index = 0; index < cells.length; index++) { if (cells[index] instanceof Processor) { if (cells[index] != model.getWorkflowSinkProcessor() && cells[index] != model.getWorkflowSourceProcessor()) { model.destroyProcessor((Processor) cells[index]); } } else if (cells[index] instanceof DataConstraint) { model.destroyDataConstraint((DataConstraint) cells[index]); } else if (cells[index] instanceof ConcurrencyConstraint) { model.destroyConcurrencyConstraint((ConcurrencyConstraint) cells[index]); } else if (cells[index] instanceof Port) { // TODO Check port is actually on the workflow edge? Port port = (Port) cells[index]; port.getProcessor().removePort(port); } } }
JPopupMenu theMenu = new JPopupMenu("Possible targets"); if (fromPort.getProcessor() == model.getWorkflowSourceProcessor()) { theMenu.add(new ShadedLabel("Workflow Input : " + sourcePort.getName(), ShadedLabel.TAVERNA_GREEN));
public void testBoring() throws ScuflException { addInputPort("input7"); addOutputPort("output8"); linkPorts("input7", "output8"); model.getWorkflowSourceProcessor().setBoring(true); String LINK = "\"WORKFLOWINTERNALSOURCE_input7\"->\"WORKFLOWINTERNALSINK_output8\""; assertTrue(view.getDot().contains(LINK)); view.setBoring(false); // Should no longer show links from WORKFLOWINTERNALSOURCE assertFalse(view.getDot().contains(LINK)); // Unless it is not boring anymore! model.getWorkflowSourceProcessor().setBoring(false); assertTrue(view.getDot().contains(LINK)); } public void testGetViewSettings() {
void linkPorts(String from, String to) throws UnknownPortException, DataConstraintCreationException { Port fromPort = model.getWorkflowSourceProcessor().locatePort(from); Port toPort = model.getWorkflowSinkProcessor().locatePort(to); model.addDataConstraint(new DataConstraint(model, fromPort, toPort)); }
for (int i = 0; i < ip.length; i++) { String portName = ip[i].getName(); OutputPort port = new OutputPort(m.getWorkflowSourceProcessor(), portName); m.getWorkflowSourceProcessor().addPort(port); m.addDataConstraint(new DataConstraint(m, port, ip[i]));
if (processor == model.getWorkflowSourceProcessor())
theInternalModel.getWorkflowSourceProcessor().locatePort(portName); } catch (UnknownPortException upe) { removePort(ourInputPorts[i]);