/** * 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]; } }
/** * 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; }
/** * 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); }
/** * 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(); }
/** * 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; }
@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; }
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 ); }
public StatusImage getBuildImage(BallColor ballColor, String style) throws IOException, FontFormatException { return iconResolver.getBuildImage(ballColor, style); }
public StatusImage getBuildImage( BallColor color, String style ) throws IOException, FontFormatException { return iconResolver.getBuildImage( color, style ); }
@Override public BallColor getIconColor() { return !isBuilding() ? getResult().color : BallColor.YELLOW_ANIME; }
/** * TO DO * @param color * @return */ public StatusImage getImage(BallColor color) { return iconResolver.getImage(color); }