Author: kwright
Date: Tue Jun 17 17:38:36 2014
New Revision: 1603231

URL: http://svn.apache.org/r1603231
Log:
Fix a couple of UI problems

Modified:
    manifoldcf/trunk/framework/crawler-ui/src/main/webapp/editjob.jsp
    
manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/jobs/JobDescription.java

Modified: manifoldcf/trunk/framework/crawler-ui/src/main/webapp/editjob.jsp
URL: 
http://svn.apache.org/viewvc/manifoldcf/trunk/framework/crawler-ui/src/main/webapp/editjob.jsp?rev=1603231&r1=1603230&r2=1603231&view=diff
==============================================================================
--- manifoldcf/trunk/framework/crawler-ui/src/main/webapp/editjob.jsp (original)
+++ manifoldcf/trunk/framework/crawler-ui/src/main/webapp/editjob.jsp Tue Jun 
17 17:38:36 2014
@@ -1081,6 +1081,7 @@
                                        referenceCounts.put(thisOne,new 
Integer(x.intValue() + 1));
                        }
                }
+               boolean anyTransformationButtons = false;
                for (int j = 0; j < pipelineConnectionNames.length; j++)
                {
                        String pipelineConnectionName = 
pipelineConnectionNames[j];
@@ -1105,6 +1106,7 @@
                        }
                        if (transformationList.length > 0)
                        {
+                               anyTransformationButtons = true;
 %>
                                                                <input 
type="button" 
value="<%=Messages.getBodyString(pageContext.getRequest().getLocale(),"editjob.InsertTransformationBefore")%>"
 
alt='<%=Messages.getBodyString(pageContext.getRequest().getLocale(),"editjob.Insertnewtransformationhere")%>'
 onclick="javascript:InsertPipelineStageTransformation(<%=j%>);"/>
 <%
@@ -1134,7 +1136,7 @@
                                                </tr>
 <%
                }
-               if (transformationList.length > 0)
+               if (anyTransformationButtons)
                {
 %>
                                                <tr class="formrow"><td 
class="formseparator" colspan="4"><hr/></td></tr>

Modified: 
manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/jobs/JobDescription.java
URL: 
http://svn.apache.org/viewvc/manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/jobs/JobDescription.java?rev=1603231&r1=1603230&r2=1603231&view=diff
==============================================================================
--- 
manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/jobs/JobDescription.java
 (original)
+++ 
manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/jobs/JobDescription.java
 Tue Jun 17 17:38:36 2014
@@ -277,11 +277,12 @@ public class JobDescription implements I
     PipelineStage currentStage = pipelineStages.get(index);
     PipelineStage ps = new 
PipelineStage(currentStage.getPrerequisiteStage(),isOutput,pipelineStageConnectionName,pipelineStageDescription);
     pipelineStages.add(index,ps);
+    currentStage.adjustReplacedStage(index,isOutput);
     // Adjust stage back-references
-    int stage = index + 1;
+    int stage = index + 2;
     while (stage < pipelineStages.size())
     {
-      pipelineStages.get(stage).adjustForInsert(index,isOutput);
+      pipelineStages.get(stage).adjustForInsert(index);
       stage++;
     }
     return ps.getSpecification();
@@ -348,6 +349,7 @@ public class JobDescription implements I
     while (stage < pipelineStages.size())
     {
       
pipelineStages.get(stage).adjustForDelete(index,ps.getPrerequisiteStage());
+      stage++;
     }
   }
 
@@ -670,10 +672,20 @@ public class JobDescription implements I
       this.specification = spec;
     }
     
-    public void adjustForInsert(int index, boolean isOutput)
+    public void adjustReplacedStage(int index, boolean isOutput)
+    {
+      if (!isOutput)
+       prerequisiteStage = index;
+      else
+       adjustForInsert(index);
+    }
+    
+    public void adjustForInsert(int index)
     {
-      if (prerequisiteStage > index || (prerequisiteStage == index && 
!isOutput))
+      if (prerequisiteStage >= index)
+      {
         prerequisiteStage++;
+      }
     }
     
     public void adjustForDelete(int index, int prerequisite)


Reply via email to