You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by sc...@apache.org on 2007/01/18 15:26:56 UTC

svn commit: r497442 - in /incubator/uima/uimaj/trunk/uimaj-ep-configurator/src/main/java/org/apache/uima/taeconfigurator/editors/ui: AggregateSection.java FlowSection.java

Author: schor
Date: Thu Jan 18 06:26:56 2007
New Revision: 497442

URL: http://svn.apache.org/viewvc?view=rev&rev=497442
Log:
UIMA-205 Fix case of adding flow constraints to user-defined flows
having previously no flow constraint.

Also - clarify messages about key names and import names
in user-defined flows, by showing a Warning string in those
cases where there is no value for these fields.  It is allowed
to have no key name, (but then you cannot reference that
component for specifying an overriding parameter, for instance).
It is also allowed to not have an import, but in that case
you have to specify the flow component descriptor "in-line".

Modified:
    incubator/uima/uimaj/trunk/uimaj-ep-configurator/src/main/java/org/apache/uima/taeconfigurator/editors/ui/AggregateSection.java
    incubator/uima/uimaj/trunk/uimaj-ep-configurator/src/main/java/org/apache/uima/taeconfigurator/editors/ui/FlowSection.java

Modified: incubator/uima/uimaj/trunk/uimaj-ep-configurator/src/main/java/org/apache/uima/taeconfigurator/editors/ui/AggregateSection.java
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-ep-configurator/src/main/java/org/apache/uima/taeconfigurator/editors/ui/AggregateSection.java?view=diff&rev=497442&r1=497441&r2=497442
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-ep-configurator/src/main/java/org/apache/uima/taeconfigurator/editors/ui/AggregateSection.java (original)
+++ incubator/uima/uimaj/trunk/uimaj-ep-configurator/src/main/java/org/apache/uima/taeconfigurator/editors/ui/AggregateSection.java Thu Jan 18 06:26:56 2007
@@ -322,6 +322,8 @@
 
     FlowNodes flow = new FlowNodes(getAnalysisEngineMetaData().getFlowConstraints());
     String[] savedFlowNodes = flow.getFlow();
+    if (null == savedFlowNodes) 
+      savedFlowNodes = stringArray0;
 
     // item may be in the flow 0, 1 or more times
 
@@ -387,7 +389,7 @@
   private void addNodeToFlow(String node) {
     FlowSection fs = editor.getAggregatePage().getFlowSection();
     fs.addNode(node);
-    fs.refresh();
+//    fs.refresh();  // the fs.addNode does a refresh
   }
 
   private void handleRemoveFromFlow() {

Modified: incubator/uima/uimaj/trunk/uimaj-ep-configurator/src/main/java/org/apache/uima/taeconfigurator/editors/ui/FlowSection.java
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-ep-configurator/src/main/java/org/apache/uima/taeconfigurator/editors/ui/FlowSection.java?view=diff&rev=497442&r1=497441&r2=497442
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-ep-configurator/src/main/java/org/apache/uima/taeconfigurator/editors/ui/FlowSection.java (original)
+++ incubator/uima/uimaj/trunk/uimaj-ep-configurator/src/main/java/org/apache/uima/taeconfigurator/editors/ui/FlowSection.java Thu Jan 18 06:26:56 2007
@@ -22,6 +22,7 @@
 import java.text.MessageFormat;
 import java.util.List;
 
+import org.apache.uima.UIMAFramework;
 import org.apache.uima.analysis_engine.metadata.CapabilityLanguageFlow;
 import org.apache.uima.analysis_engine.metadata.FixedFlow;
 import org.apache.uima.analysis_engine.metadata.FlowConstraints;
@@ -229,16 +230,24 @@
 
   private void refreshFcd(FlowControllerDeclaration fcd) {
     enableFlowControllerGUI(true);
-    flowControllerKeyGUI.setText(null == fcd.getKey() ? "" : fcd.getKey());
+    String keyName;
+    if (null == fcd.getKey() || "".equals(fcd.getKey())) {
+      keyName = "Warning: no key name is specified";
+      flowControllerKeyGUI.setToolTipText(
+              "Use Source tab below to specify a key name " +
+              "in the <flowController> element, or the imported <flowController>");
+    } else
+      keyName = fcd.getKey();
+    flowControllerKeyGUI.setText(keyName);
     Import fcdImport = fcd.getImport();
     String fileName = null;
     if (null != fcdImport) {
       fileName = fcdImport.getLocation();
       if (null == fileName || (0 == fileName.length()))
         fileName = fcdImport.getName();
-
     }
-    flowControllerGUI.setText(null == fileName ? "" : fileName);
+    flowControllerGUI.setText(null == fileName ? 
+            "Warning: no <import> in <flowController>" : fileName);
     flowControllerChoice.setText(USER_DEFINED_FLOW);
     // must follow label updates
     // because this method also does the redraw
@@ -427,8 +436,15 @@
    *          the key of the delegate
    */
   public void addNode(String node) {
-
-    FlowNodes flowNodes = new FlowNodes(getModelFlow());
+    FlowConstraints flowConstraints = getModelFlow();
+    if (null == flowConstraints) {
+      // no constraints declared
+      // set up Fix Flow style of contraints
+      //   This can happen if the style is user-defined flow
+      flowConstraints = UIMAFramework.getResourceSpecifierFactory().createFixedFlow();
+      getAnalysisEngineMetaData().setFlowConstraints(flowConstraints);
+    }
+    FlowNodes flowNodes = new FlowNodes(flowConstraints);
     String[] nodes = flowNodes.getFlow();
 
     if (nodes == null) {