continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ken...@apache.org
Subject svn commit: r446649 - in /maven/continuum/trunk/continuum-webapp/src/main: java/org/apache/maven/continuum/web/view/BuildNowCell.java java/org/apache/maven/continuum/web/view/StateCell.java webapp/images/cancelbuild.gif
Date Fri, 15 Sep 2006 16:03:18 GMT
Author: kenney
Date: Fri Sep 15 09:03:17 2006
New Revision: 446649

URL: http://svn.apache.org/viewvc?view=rev&rev=446649
Log:
PR: MCONTINUUM-369

Add cancel build icon - shown in place of the Build Now icon.

Added:
    maven/continuum/trunk/continuum-webapp/src/main/webapp/images/cancelbuild.gif   (with
props)
Modified:
    maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/view/BuildNowCell.java
    maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/view/StateCell.java

Modified: maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/view/BuildNowCell.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/view/BuildNowCell.java?view=diff&rev=446649&r1=446648&r2=446649
==============================================================================
--- maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/view/BuildNowCell.java
(original)
+++ maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/view/BuildNowCell.java
Fri Sep 15 09:03:17 2006
@@ -16,6 +16,7 @@
  * limitations under the License.
  */
 
+import org.apache.maven.continuum.project.ContinuumProjectState;
 import org.apache.maven.continuum.web.model.ProjectSummary;
 import org.extremecomponents.table.bean.Column;
 import org.extremecomponents.table.cell.DisplayCell;
@@ -36,17 +37,43 @@
 
         String contextPath = tableModel.getContext().getContextPath();
 
-        if ( !project.isInQueue() && ( project.getState() == 1 || project.getState()
== 2 || project.getState() == 3 ||
-            project.getState() == 4 ) )
+        if ( project.isInQueue() )
         {
-            return "<a href=\"" + contextPath + "/buildProject.action?projectId=" + project.getId()
+ "\"><img src=\"" +
-                contextPath +
-                "/images/buildnow.gif\" alt=\"Build Now\" title=\"Build Now\" border=\"0\"></a>";
+            return image( contextPath, "In Queue", "buildnow_disabled.gif" );
         }
-        else
+
+        switch ( project.getState() )
         {
-            return "<img src=\"" + contextPath +
-                "/images/buildnow_disabled.gif\" alt=\"Build Now\" title=\"Build Now\" border=\"0\">";
+            case ContinuumProjectState.NEW:
+            case ContinuumProjectState.OK:
+            case ContinuumProjectState.FAILED:
+            case ContinuumProjectState.ERROR:
+            {
+                return createActionLink( contextPath, project, "buildProject", "Build Now",
"buildnow.gif" );
+            }
+
+            case ContinuumProjectState.BUILDING:
+            {
+                return createActionLink( contextPath, project, "cancelBuild", "Cancel Build",
"cancelbuild.gif" );
+            }
+
+            default:
+            {
+                return image( contextPath, "Build Now", "buildnow_disabled.gif" );
+            }
         }
+    }
+
+    private static String createActionLink( String contextPath, ProjectSummary project, String
action, String label,
+                                            String image )
+    {
+        return "<a href='" + contextPath + "/" + action + ".action?projectId=" + project.getId()
+ "'>"
+            + image( contextPath, label, image ) + "</a>";
+    }
+
+    private static String image( String contextPath, String label, String image )
+    {
+        return "<img src='" + contextPath + "/images/" + image + "' alt=' " + label +
"' title='" + image
+            + "' border='0' />";
     }
 }

Modified: maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/view/StateCell.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/view/StateCell.java?view=diff&rev=446649&r1=446648&r2=446649
==============================================================================
--- maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/view/StateCell.java
(original)
+++ maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/view/StateCell.java
Fri Sep 15 09:03:17 2006
@@ -47,6 +47,7 @@
             case ContinuumProjectState.OK:
             case ContinuumProjectState.FAILED:
             case ContinuumProjectState.ERROR:
+            case ContinuumProjectState.BUILDING:
             {
                 String state = StateGenerator.generate( project.getState(), tableModel.getContext().getContextPath()
);
 
@@ -58,12 +59,6 @@
                 {
                     return state;
                 }
-            }
-
-            case ContinuumProjectState.BUILDING:
-            {
-                return StateGenerator.generate( project.getState(), tableModel.getContext().getContextPath()
) + " "
-                    + createActionLink( "cancelBuild", project, "(cancel)" );
             }
 
             default:

Added: maven/continuum/trunk/continuum-webapp/src/main/webapp/images/cancelbuild.gif
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-webapp/src/main/webapp/images/cancelbuild.gif?view=auto&rev=446649
==============================================================================
Binary file - no diff available.

Propchange: maven/continuum/trunk/continuum-webapp/src/main/webapp/images/cancelbuild.gif
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream



Mime
View raw message