private void addNode(Collection collection, Object node) { collection.add(node); if (node instanceof Processor) { Port[] ports = ((Processor) node).getPorts(); for (int index = 0; index < ports.length; index++) { collection.add(ports[index]); } } }
public int getIndexOfChild(Object parent, Object child) { if (parent instanceof Processor) { Port[] ports = ((Processor) parent).getPorts(); for (int index = 0; index < ports.length; index++) { if (ports[index].equals(child)) { return index; } } } else if (parent instanceof Port) { // Check port is actually on the workflow edge? return 0; } return -1; }
public boolean isLeaf(Object node) { if (node instanceof Processor) { return ((Processor) node).getPorts().length != 0; } else if (node instanceof Port && isPortOnWorkflowEdge(node)) { return true; } return true; }
public Object getChild(Object parent, int index) { if (parent instanceof Processor) { Processor processor = (Processor) parent; Port[] ports = processor.getPorts(); if (index < ports.length) { return ports[index]; } return getDummyPort(processor); } else if (parent instanceof Port) { // TODO Check port is actually on the workflow edge? return getDummyPort(parent); } else if (parent instanceof List) { return ((List) parent).get(index); } return null; }
Port[] allPorts = theProcessor.getPorts(); final JComboBox subjects = new JComboBox(allPorts); subjects.setRenderer(renderer);
public int getChildCount(Object parent) { if (parent instanceof Processor) { int ports = ((Processor) parent).getPorts().length; if (getAttributes(parent) != null && getAttributes(parent).get(DUMMY_PORT) != null) { ports += 1; } return ports; } else if (parent instanceof Port && isPortOnWorkflowEdge(parent)) { return 0; } else if (parent instanceof List) { return ((List) parent).size(); } return 0; }
private void addRemovedObject(Object removedObject) { if (!model.isPort(removedObject) && removedObject instanceof Port && ((Port) removedObject).getProcessor().getPorts().length == 0) { if (!(removedObject instanceof Port)) { removedObject = model.getParent(removedObject); } } addNode(removed, removedObject); Object parent = model.getParent(removedObject); if (parent != null && !(parent instanceof InternalSinkPortHolder || parent instanceof InternalSourcePortHolder)) { changed.add(parent); } }
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; } }
} else { Processor processor = (Processor) scuflObject; Port[] ports = processor.getPorts(); if (ports.length > 0) { JMenu linkMenu = new JMenu(