continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From och...@apache.org
Subject svn commit: r734072 - in /continuum/branches/continuum-parallel-builds/continuum-webapp/src/main: java/org/apache/maven/continuum/web/action/ScheduleAction.java resources/localization/Continuum.properties webapp/WEB-INF/jsp/editSchedule.jsp
Date Tue, 13 Jan 2009 08:11:14 GMT
Author: oching
Date: Tue Jan 13 00:11:13 2009
New Revision: 734072

URL: http://svn.apache.org/viewvc?rev=734072&view=rev
Log:
change Add Build Queue list box in editSchedule.jsp to an optiontransferselect box 

Modified:
    continuum/branches/continuum-parallel-builds/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ScheduleAction.java
    continuum/branches/continuum-parallel-builds/continuum-webapp/src/main/resources/localization/Continuum.properties
    continuum/branches/continuum-parallel-builds/continuum-webapp/src/main/webapp/WEB-INF/jsp/editSchedule.jsp

Modified: continuum/branches/continuum-parallel-builds/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ScheduleAction.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-parallel-builds/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ScheduleAction.java?rev=734072&r1=734071&r2=734072&view=diff
==============================================================================
--- continuum/branches/continuum-parallel-builds/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ScheduleAction.java
(original)
+++ continuum/branches/continuum-parallel-builds/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ScheduleAction.java
Tue Jan 13 00:11:13 2009
@@ -21,7 +21,6 @@
 
 import java.util.ArrayList;
 import java.util.Collection;
-import java.util.Collections;
 import java.util.List;
 
 import org.apache.maven.continuum.ContinuumException;
@@ -72,20 +71,49 @@
     private String dayOfWeek = "?";
 
     private String year;
-
-    private List<BuildQueue> schedulesBuildQueue;
-
-    private BuildQueue buildQueue;
-
-    private List<BuildQueue> buildQueues;
-
-    private List<String> buildQueueIds;
+    
+    private List<String> availableBuildQueues;
+    
+    private List<String> selectedBuildQueues = new ArrayList<String>();
 
     public void prepare()
         throws Exception
     {
         super.prepare();
+        
+        populateBuildQueues();
+    }
+
+    private void populateBuildQueues()
+        throws ContinuumException
+    {
+        List<BuildQueue> buildQueues = null;
+        if( schedule != null )
+        {
+            buildQueues = schedule.getBuildQueues();
+            for( BuildQueue buildQueue : buildQueues )
+            {
+                selectedBuildQueues.add( buildQueue.getName() );
+            }
+
+        }
+            
+        availableBuildQueues = new ArrayList<String>();
+        
         buildQueues = getContinuum().getAllBuildQueues();
+        for( BuildQueue buildQueue : buildQueues )
+        {
+            availableBuildQueues.add( buildQueue.getName() );
+        }
+        
+        // remove selected build queues from available build queues
+        for( String buildQueue : selectedBuildQueues )
+        {
+            if( availableBuildQueues.contains( buildQueue ) )
+            {
+                availableBuildQueues.remove( buildQueue );
+            }
+        }
     }
 
     public String summary()
@@ -106,8 +134,7 @@
             return REQUIRES_AUTHENTICATION;
 
         }
-        buildQueueIds = new ArrayList<String>();
-
+        
         schedules = getContinuum().getSchedules();
 
         return SUCCESS;
@@ -154,7 +181,7 @@
             delay = schedule.getDelay();
             maxJobExecutionTime = schedule.getMaxJobExecutionTime();
 
-            getBuildQueueIdsFromSchedule();
+            populateBuildQueues();
         }
         else
         {
@@ -165,22 +192,6 @@
         return SUCCESS;
     }
 
-    private void getBuildQueueIdsFromSchedule()
-    {
-        if ( schedule != null )
-        {
-            List<BuildQueue> buildQueues = schedule.getBuildQueues();
-            if ( buildQueueIds == null )
-            {
-                buildQueueIds = new ArrayList<String>();
-            }
-            for ( BuildQueue buildQueue : buildQueues )
-            {
-                buildQueueIds.add( buildQueue.getName() );
-            }
-        }
-    }
-
     public String save()
         throws ContinuumException
     {
@@ -247,16 +258,15 @@
         schedule.setName( name );
         schedule.setMaxJobExecutionTime( maxJobExecutionTime );
 
-        // remove old build queues
+     // remove old build queues
         schedule.setBuildQueues( null );
 
-        // add selected build queues
-        for ( String buildQueueId : buildQueueIds )
+        for( String name : selectedBuildQueues )
         {
-            BuildQueue buildQueue = getContinuum().getBuildQueueByName( buildQueueId );
+            BuildQueue buildQueue = getContinuum().getBuildQueueByName( name );
             schedule.addBuildQueue( buildQueue );
         }
-
+        
         return schedule;
     }
 
@@ -485,43 +495,23 @@
         return ( second + " " + minute + " " + hour + " " + dayOfMonth + " " + month + "
" + dayOfWeek + " " + year ).trim();
     }
 
-    public BuildQueue getBuildQueue()
-    {
-        return buildQueue;
-    }
-
-    public void setBuildQueue( BuildQueue buildQueue )
-    {
-        this.buildQueue = buildQueue;
-    }
-
-    public List<BuildQueue> getBuildQueues()
-    {
-        return buildQueues;
-    }
-
-    public void setBuildQueues( List<BuildQueue> buildQueues )
-    {
-        this.buildQueues = buildQueues;
-    }
-
-    public List<String> getBuildQueueIds()
+    public List<String> getAvailableBuildQueues()
     {
-        return buildQueueIds == null ? Collections.EMPTY_LIST : buildQueueIds;
+        return availableBuildQueues;
     }
 
-    public void setBuildQueueIds( List<String> buildQueueIds )
+    public void setAvailableBuildQueues( List<String> availableBuildQueues )
     {
-        this.buildQueueIds = buildQueueIds;
+        this.availableBuildQueues = availableBuildQueues;
     }
 
-    public List<BuildQueue> getSchedulesBuildQueue()
+    public List<String> getSelectedBuildQueues()
     {
-        return schedulesBuildQueue;
+        return selectedBuildQueues;
     }
 
-    public void setSchedulesBuildQueue( List<BuildQueue> schedulesBuildQueue )
+    public void setSelectedBuildQueues( List<String> selectedBuildQueues )
     {
-        this.schedulesBuildQueue = schedulesBuildQueue;
+        this.selectedBuildQueues = selectedBuildQueues;
     }
 }

Modified: continuum/branches/continuum-parallel-builds/continuum-webapp/src/main/resources/localization/Continuum.properties
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-parallel-builds/continuum-webapp/src/main/resources/localization/Continuum.properties?rev=734072&r1=734071&r2=734072&view=diff
==============================================================================
--- continuum/branches/continuum-parallel-builds/continuum-webapp/src/main/resources/localization/Continuum.properties
(original)
+++ continuum/branches/continuum-parallel-builds/continuum-webapp/src/main/resources/localization/Continuum.properties
Tue Jan 13 00:11:13 2009
@@ -618,6 +618,7 @@
 schedule.dayOfWeek.label = Day of Week
 schedule.year.label = Year [optional]
 schedule.remove.error = The schedule can't be removed, it is probably used by a build definition.
+schedule.buildqueues.label = Add Build Queue
 schedule.buildqueues.define = Configure the used build queues
 schedule.available.buildqueues = --- Available Build Queues ---
 schedule.available.buildqueues.used = --- Used Build Queues ---

Modified: continuum/branches/continuum-parallel-builds/continuum-webapp/src/main/webapp/WEB-INF/jsp/editSchedule.jsp
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-parallel-builds/continuum-webapp/src/main/webapp/WEB-INF/jsp/editSchedule.jsp?rev=734072&r1=734071&r2=734072&view=diff
==============================================================================
--- continuum/branches/continuum-parallel-builds/continuum-webapp/src/main/webapp/WEB-INF/jsp/editSchedule.jsp
(original)
+++ continuum/branches/continuum-parallel-builds/continuum-webapp/src/main/webapp/WEB-INF/jsp/editSchedule.jsp
Tue Jan 13 00:11:13 2009
@@ -72,9 +72,16 @@
             <s:textfield label="%{getText('schedule.quietPeriod.label')}" name="delay">
                 <s:param name="desc"><p><s:text name="schedule.quietPeriod.message"/></p></s:param>
             </s:textfield>
-    	
-            <s:select label="Add Build Queue" id="buildQueueIds" name="buildQueueIds"
listKey="name" listValue="name" multiple="true"
-                list="buildQueues" />
+    	                
+            <s:optiontransferselect label="%{getText('schedule.buildqueues.label')}" name="availableBuildQueues"
+                list="availableBuildQueues" size="8" multiple="true" emptyOption="false"
+                doubleName="selectedBuildQueues" doubleList="selectedBuildQueues" doubleSize="8"

+                doubleMultiple="true" doubleEmptyOption="false"
+                addAllToRightOnclick="selectAllOptions(document.getElementById('saveSchedule_availableBuildQueues'));selectAllOptions(document.getElementById('saveSchedule_selectedBuildQueues'));"
+				addToRightOnclick="selectAllOptions(document.getElementById('saveSchedule_availableBuildQueues'));selectAllOptions(document.getElementById('saveSchedule_selectedBuildQueues'));"
+				addAllToLeftOnclick="selectAllOptions(document.getElementById('saveSchedule_availableBuildQueues'));selectAllOptions(document.getElementById('saveSchedule_selectedBuildQueues'));"
+				addToLeftOnclick="selectAllOptions(document.getElementById('saveSchedule_availableBuildQueues'));selectAllOptions(document.getElementById('saveSchedule_selectedBuildQueues'));"
+                />
                                        
             <s:checkbox label="%{getText('schedule.enabled.label')}" name="active" value="active"
fieldValue="true">
                 <s:param name="desc"><p><s:text name="schedule.enabled.message"/></p></s:param>



Mime
View raw message