1 package org.apache.maven.continuum.web.util;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import org.apache.maven.continuum.project.ContinuumProjectState;
23
24
25
26
27
28 public class StateGenerator
29 {
30 public static final String NEW = "NEW";
31
32 public static final String SUCCESS = "Success";
33
34 public static final String FAILED = "Failed";
35
36 public static final String ERROR = "Error";
37
38 public static final String BUILDING = "Building";
39
40 public static final String UPDATING = "Updating";
41
42 public static final String CHECKING_OUT = "Checking Out";
43
44 public static final String UNKNOWN = "Unknown";
45
46 public static String generate( int state, String contextPath )
47 {
48 if ( state == ContinuumProjectState.NEW )
49 {
50 return NEW;
51 }
52 else if ( state == ContinuumProjectState.OK || state == ContinuumProjectState.UPDATED )
53 {
54 return "<img src=\"" + contextPath + "/images/icon_success_sml.gif\" alt=\"" + SUCCESS + "\" title=\"" +
55 SUCCESS + "\" border=\"0\" />";
56 }
57 else if ( state == ContinuumProjectState.FAILED )
58 {
59 return "<img src=\"" + contextPath + "/images/icon_warning_sml.gif\" alt=\"" + FAILED + "\" title=\"" +
60 FAILED + "\" border=\"0\" />";
61 }
62 else if ( state == ContinuumProjectState.ERROR )
63 {
64 return "<img src=\"" + contextPath + "/images/icon_error_sml.gif\" alt=\"" + ERROR + "\" title=\"" + ERROR +
65 "\" border=\"0\" />";
66 }
67 else if ( state == ContinuumProjectState.BUILDING )
68 {
69 return "<img src=\"" + contextPath + "/images/building.gif\" alt=\"" + BUILDING + "\" title=\"" + BUILDING +
70 "\" border=\"0\" />";
71 }
72 else if ( state == ContinuumProjectState.UPDATING )
73 {
74 return "<img src=\"" + contextPath + "/images/checkingout.gif\" alt=\"" + UPDATING + "\" title=\"" +
75 UPDATING + "\" border=\"0\" />";
76 }
77 else if ( state == ContinuumProjectState.CHECKING_OUT )
78 {
79 return "<img src=\"" + contextPath + "/images/checkingout.gif\" alt=\"" + CHECKING_OUT + "\" title=\"" +
80 CHECKING_OUT + "\" border=\"0\" />";
81 }
82 else
83 {
84 return UNKNOWN;
85 }
86 }
87 }