當前位置: 首頁>>代碼示例>>Java>>正文


Java AddChildEdit類代碼示例

本文整理匯總了Java中org.apache.taverna.workflow.edits.AddChildEdit的典型用法代碼示例。如果您正苦於以下問題:Java AddChildEdit類的具體用法?Java AddChildEdit怎麽用?Java AddChildEdit使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


AddChildEdit類屬於org.apache.taverna.workflow.edits包,在下文中一共展示了AddChildEdit類的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: transferConditions

import org.apache.taverna.workflow.edits.AddChildEdit; //導入依賴的package包/類
private void transferConditions(List<Edit<?>> editList,
		Map<Object, Object> oldNewMapping, Processor nestingProcessor) {
	for (Processor p : currentDataflow.getProcessors()) {
		boolean isTargetMoved = oldNewMapping.containsKey(p);
		for (BlockingControlLink c : p.controlLinksWaitingFor()) {
			Processor pre = c.getUntilFinished();
			boolean isControlMoved = oldNewMapping.containsKey(pre);
			if (isTargetMoved && isControlMoved) {
				// Add in new condition
				new BlockingControlLink(
						(Processor) oldNewMapping.get(pre),
						(Processor) oldNewMapping.get(p));
			} else if (isTargetMoved) {
				editList.add(new RemoveChildEdit<>(c.getParent(),c));
				editList.add(new AddChildEdit<>(c.getParent(),
						new BlockingControlLink(pre, nestingProcessor)));
			} else if (isControlMoved) {
				editList.add(new RemoveChildEdit<>(c.getParent(), c));
				editList.add(new AddChildEdit<>(c.getParent(),
						new BlockingControlLink(nestingProcessor, p)));
			}
		}
	}
}
 
開發者ID:apache,項目名稱:incubator-taverna-plugin-component,代碼行數:25,代碼來源:NestedWorkflowCreationDialog.java

示例2: considerEdit

import org.apache.taverna.workflow.edits.AddChildEdit; //導入依賴的package包/類
private void considerEdit(Edit<?> edit, boolean undoing) {
	if (edit instanceof CompoundEdit) {
		CompoundEdit compound = (CompoundEdit) edit;
		for (Edit<?> e : compound.getChildEdits())
			considerEdit(e, undoing);
	} else if (edit instanceof AddChildEdit
			&& edit.getSubject() instanceof Workflow) {
		Workflow subject = (Workflow) edit.getSubject();
		DataflowSelectionModel selectionModel = getDataflowSelectionModel(subject
				.getParent());
		Object child = ((AddChildEdit<?>) edit).getChild();
		if (child instanceof Processor
				|| child instanceof InputWorkflowPort
				|| child instanceof OutputWorkflowPort) {
			if (undoing
					&& selectionModel.getSelection().contains(child))
				selectionModel.clearSelection();
			else {
				Set<Object> selection = new HashSet<>();
				selection.add(child);
				selectionModel.setSelection(selection);
			}
		}
	}
}
 
開發者ID:apache,項目名稱:incubator-taverna-workbench,代碼行數:26,代碼來源:SelectionManagerImpl.java

示例3: createInputPort

import org.apache.taverna.workflow.edits.AddChildEdit; //導入依賴的package包/類
private void createInputPort(Activity activity, List<Edit<?>> editList,
		List<ProcessorBinding> processorBindings,
		ActivityPortConfiguration portDefinition) {
	InputActivityPort actPort = new InputActivityPort(null,
			portDefinition.getName());
	actPort.setDepth(portDefinition.getDepth());
	// add port to activity
	editList.add(new AddChildEdit<>(activity, actPort));
	for (ProcessorBinding processorBinding : processorBindings) {
		Processor processor = processorBinding.getBoundProcessor();
		// add a new processor port
		InputProcessorPort procPort = new InputProcessorPort();
		procPort.setName(portDefinition.getName());
		procPort.setDepth(portDefinition.getDepth());
		editList.add(new AddProcessorInputPortEdit(processor, procPort));
		// add a new port binding
		ProcessorInputPortBinding binding = new ProcessorInputPortBinding();
		binding.setBoundProcessorPort(procPort);
		binding.setBoundActivityPort(actPort);
		editList.add(new AddChildEdit<>(processorBinding, binding));
	}
}
 
開發者ID:apache,項目名稱:incubator-taverna-workbench,代碼行數:23,代碼來源:ActivityConfigurationDialog.java

示例4: createOutputPort

import org.apache.taverna.workflow.edits.AddChildEdit; //導入依賴的package包/類
private void createOutputPort(Activity activity, List<Edit<?>> editList,
		List<ProcessorBinding> processorBindings,
		ActivityPortConfiguration portDefinition) {
	OutputActivityPort actPort = new OutputActivityPort(null,
			portDefinition.getName());
	actPort.setDepth(portDefinition.getDepth());
	actPort.setGranularDepth(portDefinition.getGranularDepth());
	// add port to activity
	editList.add(new AddChildEdit<Activity>(activity, actPort));
	for (ProcessorBinding processorBinding : processorBindings) {
		Processor processor = processorBinding.getBoundProcessor();
		// add a new processor port
		OutputProcessorPort procPort = new OutputProcessorPort();
		procPort.setName(portDefinition.getName());
		procPort.setDepth(portDefinition.getDepth());
		procPort.setGranularDepth(portDefinition.getGranularDepth());
		editList.add(new AddProcessorOutputPortEdit(processor, procPort));
		// add a new port binding
		ProcessorOutputPortBinding binding = new ProcessorOutputPortBinding();
		binding.setBoundProcessorPort(procPort);
		binding.setBoundActivityPort(actPort);
		editList.add(new AddChildEdit<>(processorBinding, binding));
	}
}
 
開發者ID:apache,項目名稱:incubator-taverna-workbench,代碼行數:25,代碼來源:ActivityConfigurationDialog.java

示例5: createNestedWorkflow

import org.apache.taverna.workflow.edits.AddChildEdit; //導入依賴的package包/類
private void createNestedWorkflow() {
	final List<Edit<?>> currentWorkflowEditList = new ArrayList<>();
	Map<Object, Object> oldNewMapping = new HashMap<>();
	Map<DataLink, String> linkProcessorPortMapping = new HashMap<>();
	Map<SenderPort, OutputWorkflowPort> outputPortMap = new HashMap<>();
	Map<ReceiverPort, InputWorkflowPort> inputPortMap = new HashMap<>();

	Profile profile;//FIXME
	Processor nestingProcessor = createNestingProcessor(currentWorkflowEditList);
	Workflow nestedDataflow = createNestedDataflow();

	transferProcessors(currentWorkflowEditList, oldNewMapping,
			nestedDataflow);
	transferDatalinks(oldNewMapping, linkProcessorPortMapping,
			outputPortMap, inputPortMap, nestedDataflow);
	transferConditions(currentWorkflowEditList, oldNewMapping,
			nestingProcessor);
	addDataflowToNestingProcessor(nestingProcessor, nestedDataflow, profile);
	currentWorkflowEditList.add(new AddChildEdit<>(currentDataflow,
			nestingProcessor));
	createDatalinkEdits(currentWorkflowEditList, oldNewMapping,
			linkProcessorPortMapping, nestingProcessor);

	try {
		GraphController gc = graphView.getGraphController(currentDataflow);
		gc.setExpandNestedDataflow(nestingProcessor.getActivity(profile), true);
		em.doDataflowEdit(currentDataflow.getParent(), new CompoundEdit(
				currentWorkflowEditList));
		gc.redraw();
	} catch (EditException e1) {
		logger.error("failed to manufacture nested workflow", e1);
	}
}
 
開發者ID:apache,項目名稱:incubator-taverna-plugin-component,代碼行數:34,代碼來源:NestedWorkflowCreationDialog.java

示例6: createNestingProcessor

import org.apache.taverna.workflow.edits.AddChildEdit; //導入依賴的package包/類
private Processor createNestingProcessor(List<Edit<?>> editList) {
	//TODO check what workflow the new processor is going into
	Processor nestingProcessor = new Processor(currentDataflow, uniqueName(
			nameField.getText(), currentDataflow.getProcessors()));
	if (includedProcessors.size() != 1)
		return nestingProcessor;
	Processor includedProcessor = includedProcessors.get(0);
	for (Annotation a: includedProcessor.getAnnotations()) {
		Annotation newAnn = (Annotation) a.clone();
		newAnn.setTarget(nestingProcessor);
		editList.add(new AddChildEdit<>(a.getParent(), newAnn));
	}
	return nestingProcessor;
}
 
開發者ID:apache,項目名稱:incubator-taverna-plugin-component,代碼行數:15,代碼來源:NestedWorkflowCreationDialog.java

示例7: getMergeEdit

import org.apache.taverna.workflow.edits.AddChildEdit; //導入依賴的package包/類
/**
 * Make an {@link Edit} that when performed merges the given source dataflow
 * into the destination dataflow.
 * <p>
 * Internally a copy is made of the source dataflow, to avoid modifying the
 * links and processors.
 *
 * @param sourceWorkflow
 *            Dataflow to merge from
 * @param prefix
 *            A prefix which will be inserted in front of the names for the
 *            merged workflow components.
 * @return An edit that can perform and undo the insertion of the components
 *         from the source dataflow.
 * @throws MergeException
 *             If the merge cannot be performed.
 */
public CompoundEdit getMergeEdit(Workflow sourceWorkflow, String prefix)
		throws MergeException {
	List<Edit<?>> compoundEdit = new ArrayList<>();

	Workflow workflow = copyWorkflow(sourceWorkflow);

	for (InputWorkflowPort input : workflow.getInputPorts()) {
		destinationWorkflow.getInputPorts().addWithUniqueName(input);
		destinationWorkflow.getInputPorts().remove(input);
		compoundEdit.add(new AddWorkflowInputPortEdit(destinationWorkflow, input));
	}
	for (OutputWorkflowPort output : workflow.getOutputPorts()) {
		destinationWorkflow.getOutputPorts().addWithUniqueName(output);
		destinationWorkflow.getOutputPorts().remove(output);
		compoundEdit.add(new AddWorkflowOutputPortEdit(destinationWorkflow, output));
	}
	for (Processor processor : workflow.getProcessors()) {
		processor.setName(prefix + processor.getName());
		compoundEdit.add(new AddProcessorEdit(destinationWorkflow, processor));
	}
	for (DataLink dataLink : workflow.getDataLinks()) {
		compoundEdit.add(new AddDataLinkEdit(destinationWorkflow, dataLink));
	}
	for (ControlLink controlLink : workflow.getControlLinks()) {
		compoundEdit.add(new AddChildEdit<Workflow>(destinationWorkflow, controlLink));
	}

	return new CompoundEdit(compoundEdit);

}
 
開發者ID:apache,項目名稱:incubator-taverna-workbench,代碼行數:48,代碼來源:DataflowMerger.java

示例8: actionPerformed

import org.apache.taverna.workflow.edits.AddChildEdit; //導入依賴的package包/類
@Override
public void actionPerformed(ActionEvent event) {
	try {
		BlockingControlLink controlLink = new BlockingControlLink();
		controlLink.setUntilFinished(control);
		controlLink.setBlock(target);
		editManager.doDataflowEdit(dataflow.getParent(),
				new AddChildEdit<>(dataflow, controlLink));
	} catch (EditException e) {
		logger.debug("Create control link between '" + control.getName()
				+ "' and '" + target.getName() + "' failed");
	}
}
 
開發者ID:apache,項目名稱:incubator-taverna-workbench,代碼行數:14,代碼來源:AddConditionAction.java

示例9: actionPerformed

import org.apache.taverna.workflow.edits.AddChildEdit; //導入依賴的package包/類
public void actionPerformed(ActionEvent e) {
	try {
		Activity activity = new Activity();
		activity.setType(STRING_CONSTANT);
		Configuration configuration = new Configuration();
		configuration.setType(STRING_CONSTANT.resolve("#Config"));
		configuration.getJsonAsObjectNode().put("string", "");
		configuration.setConfigures(activity);

		StringConstantConfigView configView = new StringConstantConfigView(activity,
				configuration, serviceRegistry);

		int answer = JOptionPane.showConfirmDialog(component, configView,
				"Text constant value", JOptionPane.OK_CANCEL_OPTION);
		if (answer != JOptionPane.CANCEL_OPTION) {

			configView.noteConfiguration();
			configuration.setJson(configView.getJson());

			Profile profile = selectionManager.getSelectedProfile();

			Processor processor = new Processor();
			processor.setName(inputPort.getName() + "_value");

			CrossProduct crossProduct = new CrossProduct();
			crossProduct.setParent(processor.getIterationStrategyStack());

			ProcessorBinding processorBinding = new ProcessorBinding();
			processorBinding.setBoundProcessor(processor);
			processorBinding.setBoundActivity(activity);

			// create activity port
			OutputActivityPort activityPort = new OutputActivityPort(activity, "value");
			activityPort.setDepth(0);
			activityPort.setGranularDepth(0);
			// create processor port
			OutputProcessorPort processorPort = new OutputProcessorPort(processor,
					activityPort.getName());
			processorPort.setDepth(0);
			processorPort.setGranularDepth(0);
			// add a new port binding
			new ProcessorOutputPortBinding(processorBinding, activityPort, processorPort);

			// Add a data link between the string constant processor's output port
			// and the processor containing the passed inputPort.
			DataLink datalink = new DataLink();
			datalink.setReceivesFrom(processorPort);
			datalink.setSendsTo(inputPort);

			List<Edit<?>> editList = new ArrayList<Edit<?>>();
			editList.add(new AddChildEdit<Profile>(profile, activity));
			editList.add(new AddChildEdit<Profile>(profile, configuration));
			editList.add(new AddChildEdit<Profile>(profile, processorBinding));
			editList.add(new AddProcessorEdit(dataflow, processor));
			editList.add(new AddDataLinkEdit(dataflow, datalink));

			editManager.doDataflowEdit(dataflow.getParent(), new CompoundEdit(editList));

		}
	} catch (EditException ex) {
		logger.error("Adding default value for input port failed", ex);
	}
}
 
開發者ID:apache,項目名稱:incubator-taverna-workbench,代碼行數:64,代碼來源:AddInputPortDefaultValueAction.java


注:本文中的org.apache.taverna.workflow.edits.AddChildEdit類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。