/** * Method for generating a valid filename for a port * * @param Port * the port to generate a filename for * @return the filename * */ private String generateFilename(Port Port) { String portName = Port.getName(); return portName.replaceAll("\\W", "_") + ".png"; }
public void setValueAt(Object aValue, int rowIndex, int columnIndex) { if (columnIndex > 0) { int listCount = 0; String prettyMime = null; switch (columnIndex) { case 1: listCount = ((Integer) aValue).intValue(); prettyMime = (String) getValueAt(rowIndex, 2); break; case 2: listCount = ((Integer) getValueAt(rowIndex, 1)).intValue(); prettyMime = (String) aValue; break; } String mimeType = "bleh"; Iterator entryIterator = DataThing.mimeTypes.entrySet().iterator(); while (entryIterator.hasNext()) { Map.Entry entry = (Map.Entry) entryIterator.next(); if (entry.getValue().equals(prettyMime)) { mimeType = (String) entry.getKey(); } } getPorts()[rowIndex].setSyntacticType(getSyntacticType(listCount, mimeType)); } }
private int getPortDepth(Port port) { String syntacticType = port.getSyntacticType(); if (syntacticType == null) { return 0; } else { return syntacticType.split("l\\(").length - 1; } }
public String toString() { if (sourcePort.getProcessor().getName().equals("SCUFL_INTERNAL_SOURCEPORTS")) { return sourcePort.getName(); } return sourcePort.getProcessor().getName() + ":" + sourcePort.getName(); }
public Object valueForCellChanged(Object cell, Object newValue) { if (cell instanceof Processor) { Processor processor = (Processor) cell; processor.setName(newValue.toString()); return processor.getName(); } if (cell instanceof Port) { Port port = (Port) cell; if (isPortOnWorkflowEdge(port)) { for (Port p : port.getProcessor().getPorts()) { //prevent renaming if a port already has that name if (p.getName().equals(newValue.toString())) { return port.getName(); } } port.setName(newValue.toString()); return port.getName(); } } return null; } }
public void testNameEdit() throws DuplicatePortNameException, PortCreationException { Port port = new EditablePort(proc, "sillyport"); assertEquals("sillyport", port.getName()); port.setName("Something illegal with spaces"); assertEquals("sillyport", port.getName()); port.setName("somethingelse"); assertEquals("somethingelse", port.getName()); }
locatePort(outputs[i].getName()).setSyntacticType(outputs[i].getSyntacticType()); } catch (UnknownPortException upe) { Port newPort = new OutputPort(this, outputs[i].getName()); newPort.setSyntacticType(outputs[i].getSyntacticType()); locatePort(inputs[i].getName()).setSyntacticType(inputs[i].getSyntacticType()); } catch (UnknownPortException upe) { Port newPort = new InputPort(this, inputs[i].getName()); newPort.setSyntacticType(inputs[i].getSyntacticType()); for (int i = 0; i < ourInputPorts.length; i++) { String portName = ourInputPorts[i].getName(); try { theInternalModel.getWorkflowSourceProcessor().locatePort(portName); for (int i = 0; i < ourOutputPorts.length; i++) { String portName = ourOutputPorts[i].getName(); try { theInternalModel.getWorkflowSinkProcessor().locatePort(portName);
if (dc.getSource().getProcessor() == p) { colour = "#ff44bb"; } else if (dc.getSink().getProcessor() == p) { colour = "#dd9922"; Port thePort = (Port) userObject; ScuflModel model = thePort.getProcessor().getModel(); if (thePort.isSource()) { } else if (thePort.isSink()) { .getUserObject(); String originalPortName = theAlternate .getPortTranslation(thePort.getName()); if (originalPortName == null) { originalPortName = "<NO MAPPING>"; setText(thePort.getName() + " == " + originalPortName); } else { String toString = thePort.toString(); String colour = null; String defaultText = ""; + thePort.getSyntacticType() + "</font>" + defaultText + "</html>");
Port newPort = new InputPort(this, name + "_filter"); if (filter.isList()) { newPort.setSyntacticType("l('text/plain')"); } else { newPort.setSyntacticType("'text/plain'"); for (int i = 0; i < currentInputs.length; i++) { Port inputPort = currentInputs[i]; if (filterNames.contains(inputPort.getName()) == false) { removePort(inputPort);
public Input(Port port) { this.port = port; setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); JLabel title = new JLabel("<html><b>" +port.getName() + "</b> " + port.getMetadata().getFirstMIMEType() + "</html>"); title.setAlignmentX(Component.LEFT_ALIGNMENT); add(title); String description = port.getMetadata().getDescription(); if (! description.equals("")) { JTextArea descriptionArea = new JTextArea(description); descriptionArea.setEditable(false); descriptionArea.setLineWrap(true); descriptionArea.setOpaque(false); descriptionArea.setWrapStyleWord(true); descriptionArea.setAlignmentX(Component.LEFT_ALIGNMENT); descriptionArea.setFont(Font.getFont("Dialog")); add(descriptionArea); } } }
if (task instanceof PortTask) { String portName = ((PortTask) task).getScuflPort().getName(); String portType = ((PortTask) task).getScuflPort() .getSyntacticType(); DataThing portData = inputMap.get(portName); try { lsidForNamedOutput.put(outputPortTask.getScuflPort().getName(), collectionLSID); outputMap.put(outputPortTask.getScuflPort().getName(), outputThing); String inputLSID = inputThing.getLSID(inputThing .getDataObject()); String inputName = inputPortTask.getScuflPort().getName(); inputNameToLSID.put(inputName, inputLSID); inputShredding.put(inputLSID, new HashSet<String>());
} else if (object instanceof Port) { Port port = (Port) object; if (!port.isNameEditable()) { JOptionPane.showMessageDialog(null, "Only input and output ports can be renamed.", return; name = port.getName(); description = "New name for the port?"; } else if (object instanceof ScuflModel) { } else if (object instanceof Port) { Port port = (Port) object; port.setName(new_name); name = port.getName(); } else if (object instanceof ScuflModel) { ScuflModel model = (ScuflModel) object;
/** * @return the processor that this ResultSource is part of */ public Processor getProcessor() { return sourcePort.getProcessor(); }
String portSyntaxType = thePort.getSyntacticType(); String dataSyntaxType = newDataThing.getSyntacticType(); SemanticMarkup portMarkup = targetMetadataPort.getMetadata(); String[] portMIMETypes = portMarkup.getMIMETypes(); for (int i = 0; i < portMIMETypes.length; i++) { SemanticMarkup portMarkup = getScuflPort().getMetadata(); String[] portMIMETypes = portMarkup.getMIMETypes(); for (int i = 0; i < portMIMETypes.length; i++) { if (getScuflPort().isSource()) { if (ProcessorTask.STORE != null) { try {
public boolean isText() { logger.debug(port.getMetadata().getDisplayTypeList()); for (int index = 0; index < port.getMetadata().getMIMETypeList() .size(); index++) { String mimeType = (String) port.getMetadata().getMIMETypeList() .get(index); if (textPattern.matcher(mimeType).matches()) { return true; } } return false; }
Processor processor = link.getSource().getProcessor(); if (processor.getName().equals("SCUFL_INTERNAL_SOURCEPORTS")) if(link.getSink().getProcessor().getName().equals("SCUFL_INTERNAL_SINKPORTS")) thing = (DataThing)instance.getOutput().get(link.getSink().getName()); .getProcessor().getName()); Map outputs = maps[0]; thing = (DataThing) outputs.get(link.getSink().getName()); thing = (DataThing) outputs.get(link.getSource().getName());
Port newPort = new OutputPort(this, name); if (attribute.getAttributes() != null) { newPort.setSyntacticType("l(l('text/plain'))"); } else { newPort.setSyntacticType("l('text/plain')"); } catch (UnknownPortException upe) { Port newPort = new OutputPort(this, name); newPort.setSyntacticType(MartServiceUtils.getMimeTypeForFormatter(formatter)); addPort(newPort); for (int i = 0; i < ports.length; i++) { Port outputPort = ports[i]; if (attributeNames.contains(outputPort.getName()) == false) { removePort(outputPort);
@SuppressWarnings("unchecked") private void createOutputs(Dataflow dataflow) throws EditException { for (Port sinkPort : scuflModel.getWorkflowSinkPorts()) { List<String> typeList = sinkPort.getMetadata().getMIMETypeList(); edits.getCreateDataflowOutputPortEdit(dataflow, sinkPort.getName()) .doEdit(); for (DataflowOutputPort outputPort : dataflow.getOutputPorts()) { // firstly add the mime types to the new port if (outputPort.getName().equals(sinkPort.getName())) { for (String mimeType : typeList) { MimeType mimeTypeAnnotation = new MimeType(); mimeTypeAnnotation.setText(mimeType); try { EditsRegistry.getEdits().getAddAnnotationChainEdit( outputPort, mimeTypeAnnotation).doEdit(); } catch (EditException e) { // TODO Auto-generated catch block e.printStackTrace(); } } outputMap.put(sinkPort, outputPort); break; } } } }
private boolean isPortOnWorkflowEdge(Object port) { if (port instanceof InputPort) { return ((Port) port).getProcessor() instanceof InternalSinkPortHolder; } else if (port instanceof OutputPort) { return ((Port) port).getProcessor() instanceof InternalSourcePortHolder; } return false; }