当前位置: 首页>>代码示例>>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;未经允许,请勿转载。