Java 类hudson.model.BallColor 实例源码

项目:embeddable-badges-plugin    文件:ImageResolver.java   
/**
 * TO DO
 * @param color
 * @return
 */
public StatusImage getImage(BallColor color) {
    StatusImage[] images = styles.get("default");

    if (color.isAnimated()) {
        return images[3];
    }

    switch (color) {
        case RED:
            return images[0];
        case YELLOW:
            return images[1];
        case BLUE:
            return images[2];
        case ABORTED:
            return images[4];
        default:
            return images[5];
    }
}
项目:multi-branch-project-plugin    文件:BallColorFolderIcon.java   
/**
 * Calculates the color of the status ball for the owner based on its descendants.
 * <br>
 * Kanged from Branch API (original author Stephen Connolly).
 *
 * @return the color of the status ball for the owner.
 */
@Nonnull
private BallColor calculateBallColor() {
    if (owner instanceof TemplateDrivenMultiBranchProject
            && ((TemplateDrivenMultiBranchProject) owner).isDisabled()) {
        return BallColor.DISABLED;
    }

    BallColor c = BallColor.DISABLED;
    boolean animated = false;

    for (Job job : owner.getAllJobs()) {
        BallColor d = job.getIconColor();
        animated |= d.isAnimated();
        d = d.noAnime();
        if (d.compareTo(c) < 0) {
            c = d;
        }
    }

    if (animated) {
        c = c.anime();
    }

    return c;
}
项目:multi-branch-project-plugin    文件:SelectJobsBallColorFolderIcon.java   
/**
 * Delegates the image to the {@link #owner}'s {@link BallColor}.
 * <br>
 * {@inheritDoc}
 */
@Override
public String getImageOf(String size) {
    if (owner == null) {
        return BallColor.GREY.getImageOf(size);
    }

    return calculateBallColor().getImageOf(size);
}
项目:multi-branch-project-plugin    文件:SelectJobsBallColorFolderIcon.java   
/**
 * Delegates the description to the {@link #owner}'s {@link BallColor}.
 * <br>
 * {@inheritDoc}
 */
@Override
public String getDescription() {
    if (owner == null) {
        return BallColor.GREY.getDescription();
    }

    return calculateBallColor().getDescription();
}
项目:multi-branch-project-plugin    文件:SelectJobsBallColorFolderIcon.java   
/**
 * Calculates the color of the status ball for the owner based on selected descendants.
 * <br>
 * Logic kanged from Branch API (original author Stephen Connolly).
 *
 * @return the color of the status ball for the owner.
 */
@Nonnull
private BallColor calculateBallColor() {
    if (owner instanceof TemplateDrivenMultiBranchProject
            && ((TemplateDrivenMultiBranchProject) owner).isDisabled()) {
        return BallColor.DISABLED;
    }

    BallColor c = BallColor.DISABLED;
    boolean animated = false;

    StringTokenizer tokens = new StringTokenizer(Util.fixNull(jobs), ",");
    while (tokens.hasMoreTokens()) {
        String jobName = tokens.nextToken().trim();
        TopLevelItem item = owner.getItem(jobName);
        if (item != null && item instanceof Job) {
            BallColor d = ((Job) item).getIconColor();
            animated |= d.isAnimated();
            d = d.noAnime();
            if (d.compareTo(c) < 0) {
                c = d;
            }
        }
    }

    if (animated) {
        c = c.anime();
    }

    return c;
}
项目:multi-branch-project-plugin    文件:BallColorFolderIcon.java   
/**
 * Delegates the image to the {@link #owner}'s {@link BallColor}.
 * <br>
 * {@inheritDoc}
 */
@Override
public String getImageOf(String size) {
    if (owner == null) {
        return BallColor.GREY.getImageOf(size);
    }

    return calculateBallColor().getImageOf(size);
}
项目:multi-branch-project-plugin    文件:BallColorFolderIcon.java   
/**
 * Delegates the description to the {@link #owner}'s {@link BallColor}.
 * <br>
 * {@inheritDoc}
 */
@Override
public String getDescription() {
    if (owner == null) {
        return BallColor.GREY.getDescription();
    }

    return calculateBallColor().getDescription();
}
项目:hue-light-plugin    文件:LightNotifier.java   
@Override
public boolean perform(AbstractBuild<?, ?> build, Launcher launcher, BuildListener listener) throws InterruptedException, IOException {

    // Allowable values from build results:
    //
    // RED              - Bad Build
    // RED_ANIME
    // YELLOW           - Unstable Build
    // YELLOW_ANIME
    // BLUE             - Good Build
    // BLUE_ANIME
    // GREY
    // GREY_ANIME
    // DISABLED
    // DISABLED_ANIME
    // ABORTED
    // ABORTED_ANIME
    // NOTBUILT
    // NOTBUILT_ANIME

    BallColor ballcolor = build.getResult().color;

    for(String id : this.lightId) {
     Light light = this.lightController.getLightForId(id);

     switch (ballcolor) {
         case RED:
             this.lightController.setColor(light, "Bad Build", ConfigColorToHue(this.badBuild));
             break;
         case YELLOW:
             this.lightController.setColor(light, "Unstable Build", ConfigColorToHue(this.unstableBuild));
             break;
         case BLUE:
             this.lightController.setColor(light, "Good Build", ConfigColorToHue(this.goodBuild));
             break;
     }
    }
    return true;
}
项目:jenkins-status-badges-plugin    文件:ImageResolver.java   
public StatusImage getBuildImage( BallColor ballColor, String style )
    throws IOException, FontFormatException
{
    String subject = "build";
    String status = "unknown";
    String color;

    if ( ballColor.isAnimated() )
    {
        status = "running";
    }
    switch ( ballColor )
    {
        case RED:
        case ABORTED:
            status = "failing";
            // fall through
        case RED_ANIME:
        case ABORTED_ANIME:
            color = "red";
            break;
        case YELLOW:
            status = "unstable";
            // fall through
        case YELLOW_ANIME:
            color = "yellow";
            break;
        case BLUE:
            status = "passing";
            // fall through
        case BLUE_ANIME:
            color = "brightgreen";
            break;
        case DISABLED:
        case DISABLED_ANIME:
        case GREY:
        case GREY_ANIME:
        case NOTBUILT:
        case NOTBUILT_ANIME:
        default:
            color = "lightgrey";
            break;
    }

    return new StatusImage( subject, status, color, style );
}
项目:jenkins-status-badges-plugin    文件:BuildActionFactory.java   
public StatusImage getBuildImage(BallColor ballColor, String style) throws IOException, FontFormatException {
    return iconResolver.getBuildImage(ballColor, style);
}
项目:jenkins-status-badges-plugin    文件:StatusActionFactory.java   
public StatusImage getBuildImage( BallColor color, String style )
    throws IOException, FontFormatException
{
    return iconResolver.getBuildImage( color, style );
}
项目:DotCi    文件:DbBackedBuild.java   
@Override
public BallColor getIconColor() {
    return !isBuilding() ? getResult().color : BallColor.YELLOW_ANIME;
}
项目:embeddable-badges-plugin    文件:BadgeActionFactory.java   
/**
 * TO DO
 * @param color
 * @return
 */
public StatusImage getImage(BallColor color) {
    return iconResolver.getImage(color);
}