existingTransformers.put(transformer, tfd);
//transformer.beforeSerialization();
}
Record target = (Record) sourceNodes.get(paramContext.getArgument().getText());
//the output argument of transformer must be the source which should be linked in the first order
TransformerArgument source = transformer.getTransferArgument(transformerMapping.getLinkedArgumentName());
if(paramContext.isKey()){
target.setKeyType(Record.KEY);
}
try{
mapToolPanel.getModel().addLink(source, target);
}catch(Exception e){
e.printStackTrace();
}
new RecursiveLoop(){
@Override
public boolean logic(Object tree) {
return false;
}
@Override
public List getChildren(Object tree) {
if(tree instanceof TransformerMapping){
System.out.println();
}
// stops the recursive tracing when it meets the endpoints
if(!(tree instanceof Transformer)){
return null;
}
Transformer transformer = (Transformer)tree;
final ArrayList children = new ArrayList();
if(transformer.getInputArguments()!=null)
for(int i=0; i<transformer.getInputArguments().length; i++){
Object argumentSource = transformer.getArgumentSourceMap().get(transformer.getInputArguments()[i]);
TransformerArgument target = transformer.getTransferArgument(transformer.getInputArguments()[i]);
if(argumentSource==null) continue;
ArrayList argumentSources;
if(argumentSource instanceof ArrayList){
argumentSources = (ArrayList)argumentSource;
}else{
argumentSources = new ArrayList();
argumentSources.add(argumentSource);
}
for(int j=0; j<argumentSources.size(); j++){
argumentSource = argumentSources.get(j);
if(argumentSource instanceof TransformerMapping){
TransformerMapping priorTransformerMapping = (TransformerMapping) argumentSource;
Transformer priorTransformer = priorTransformerMapping.getTransformer();
argumentSource = priorTransformer;
if(!existingTransformers.containsKey(priorTransformer)){
TransformerDesigner tfd = priorTransformer.createDesigner(mapToolPanel.getLinkPanel());
existingTransformers.put(priorTransformer, tfd);
}
TransformerArgument priorTransformerArgument = priorTransformer.getTransferArgument(priorTransformerMapping.getLinkedArgumentName());
children.add(argumentSource);
if(priorTransformerArgument==null)
continue; //anyway never be occurred... means priorTransformerArgument must exist.
/**
* transformer argument is eager to be changed since the user interface occasionally re-rendered.
*/
priorTransformerArgument = priorTransformer.getTransferArgument(priorTransformerArgument.getName());
//the output argument of transformer must be the source which should be linked in the first order
TransformerArgument source = priorTransformerArgument;
try{
mapToolPanel.getModel().addLink(source, target);
}catch(Exception e){
e.printStackTrace();
}
}else{ // the case that the source is a node
Record source = (Record) targetNodes.get((String)argumentSource);
try{
mapToolPanel.getModel().addLink(source, target);
}catch(Exception e){
e.printStackTrace();
}
children.add(argumentSource);
}
}
}
return children;
}
}.run(transformer);
}else{
Record source = (Record) targetNodes.get(paramContext.getVariable().getName());
Record target = (Record) sourceNodes.get(paramContext.getArgument().getText());
if(paramContext.isKey()){
target.setKeyType(Record.KEY);
}
try{
mapToolPanel.getModel().addLink(source, target);
}catch(Exception e){