Commits

Anonymous committed 50cfb9b

Patch from WF-434

  • Participants
  • Parent commits 8c87daa

Comments (0)

Files changed (4)

src/designer/com/opensymphony/workflow/designer/editor/ConditionEditor.java

       cond.setParent(getParent());
       cond.setType(condition.getType());
       cond.setName(condition.getName());
+
+      // negate?
+      String n = (String)condition.getArgs().get("negate");
+      condition.getArgs().remove("negate");
+
+      cond.setNegate("true".equalsIgnoreCase(n) || "yes".equalsIgnoreCase(n));
       cond.getArgs().putAll(condition.getArgs());
 
       return cond;
 
     if(condition != null)
     {
+      // negate?
+      String n = (String)condition.getArgs().get("negate");
+      condition.getArgs().remove("negate");
+
+      cond.setNegate("true".equalsIgnoreCase(n) || "yes".equalsIgnoreCase(n));
       cond.getArgs().putAll(condition.getArgs());
     }
   }

src/designer/com/opensymphony/workflow/designer/model/ConditionsTableModel.java

  */
 public class ConditionsTableModel extends ListTableModel
 {
-  private String[] header = new String[]{ResourceManager.getString("name"), ResourceManager.getString("type")};
+  private String[] header = new String[]{ResourceManager.getString("name"), ResourceManager.getString("type"), ResourceManager.getString("negate")};
   private WorkflowGraphModel graphModel;
   private int type;
   public static final int JOIN = 1;
             descriptor = palette.getResultCondition(condition.getName());
             break;
         }
-        return descriptor!=null && descriptor.getDisplayName()!=null ? descriptor.getDisplayName() : ResourceManager.getString("unknown");
+        return descriptor != null && descriptor.getDisplayName() != null ? descriptor.getDisplayName() : ResourceManager.getString("unknown");
       case 1:
         return condition.getType();
+      case 2:
+        return String.valueOf(condition.isNegate());
     }
     return null;
   }

src/designer/com/opensymphony/workflow/designer/resources.properties

 info=Info
 ok=OK
 name=Name
+negate=Negate?
 view=View
 type=Type
 status=Status

src/designer/com/opensymphony/workflow/loader/ConfigConditionDescriptor.java

     type = condition.getAttribute("type");
 
     String n = condition.getAttribute("negate");
-    if("true".equalsIgnoreCase(n) || "yes".equalsIgnoreCase(n))
-    {
-      negate = true;
-    }
-    else
-    {
-      negate = false;
-    }
+    negate = ("true".equalsIgnoreCase(n) || "yes".equalsIgnoreCase(n));
+
+    // add negate as modifiable argument
+    this.args.put("negate", String.valueOf(negate));
+    this.modifiableArgs.add("negate");
 
     List args = XMLUtil.getChildElements(condition, "arg");
     for(int l = 0; l < args.size(); l++)
       if("true".equals(arg.getAttribute("modifiable")))
       {
         modifiableArgs.add(arg.getAttribute("name"));
-				String sArgType = arg.getAttribute("argtype");
-				if (sArgType!=null)
-				{
-					ArgType at = (ArgType)palette.getArgType(sArgType);
-					if (at!=null)
-					{
-						argTypeMap.put(arg.getAttribute("name"), at);
-					}
-				}
+        String sArgType = arg.getAttribute("argtype");
+        if(sArgType != null)
+        {
+          ArgType at = palette.getArgType(sArgType);
+          if(at != null)
+          {
+            argTypeMap.put(arg.getAttribute("name"), at);
+          }
+        }
       }
     }
     plugin = XMLUtil.getChildText(condition, "plugin");