View Javadoc

1   /*
2    * Copyright (c) 2005, The K-Wf Grid Consortium
3    * Fraunhofer Institute for Computer Architecture and Software Technology
4    * See http://www.kwfgrid.eu and http://www.first.fraunhofer.de for more details.
5    */
6   package net.kwfgrid.gwui.gui;
7   
8   import net.kwfgrid.gworkflowdl.protocol.structure.ProtocolTransition;
9   import net.kwfgrid.gworkflowdl.protocol.structure.ProtocolWorkflow;
10  import net.kwfgrid.gworkflowdl.structure.*;
11  
12  import org.glassbox.executor.Executor;
13  
14  /***
15     Default implementation of <code>OperationEditorDelegateFactory</code>.
16   */
17  public class DefaultOperationEditorDelegateFactory implements OperationEditorDelegateFactory {
18      /***
19         Creates one of <code>NullOperationEditor, NullClassOperationEditor, OperationCandidateEditor, OperationObjectEditor</code>.
20         @exception IllegalArgumentException If an unknown implementation of <code>ClassOperation</code> is referenced by 
21         the specified transition.
22       */
23      public AbstractWorkflowElementEditor createOperationEditorDelegate(Executor executor, 
24  								       ProtocolWorkflow workflow, 
25  								       ProtocolTransition transition) 
26  	throws IllegalArgumentException {
27  	Operation o = transition.getOperation();
28  	if (o == null) {
29  	    return new NullOperationEditor(executor, workflow, transition);
30  	} else {
31  	    if (o.get() == null) {
32  	    	return new NullClassOperationEditor(executor, workflow, transition);
33  	    } else if (o.get() instanceof OperationClass) {
34      		return new OperationCandidateEditor(executor, workflow, transition);
35  //	    } else if (co instanceof OperationObject) {
36  //		return new OperationObjectEditor(executor, workflow, transition);
37          } else {
38  		    throw new IllegalArgumentException("Unknown OperationClass implementation: "+o.get().getClass().getName());
39  	    }
40  	}
41      }
42  }