hudson.model.BallColor Java Examples
The following examples show how to use
hudson.model.BallColor.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BallColorFolderIcon.java From multi-branch-project-plugin with MIT License | 6 votes |
/** * 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; }
Example #2
Source File: StaticAnalysisLabelProvider.java From warnings-ng-plugin with MIT License | 5 votes |
private UnescapedText getResultIcon(final QualityGateStatus qualityGateStatus) { BallColor color = qualityGateStatus.getColor(); return join(img().withSrc(jenkins.getImagePath(color)) .withClasses(color.getIconClassName()) .withAlt(color.getDescription()) .withTitle(color.getDescription()), color.getDescription()); }
Example #3
Source File: SummaryTest.java From warnings-ng-plugin with MIT License | 5 votes |
private StaticAnalysisLabelProvider createLabelProvider(final String id, final String name) { JenkinsFacade jenkins = mock(JenkinsFacade.class); when(jenkins.getImagePath(any(BallColor.class))).thenReturn("color"); when(jenkins.getImagePath(contains(StaticAnalysisLabelProvider.ERROR_ICON))).thenReturn("/path/to/error"); when(jenkins.getImagePath(contains(StaticAnalysisLabelProvider.INFO_ICON))).thenReturn("/path/to/info"); when(jenkins.getAbsoluteUrl(any())).thenReturn("absoluteUrl"); return new StaticAnalysisLabelProvider(id, name, jenkins); }
Example #4
Source File: SelectJobsBallColorFolderIcon.java From multi-branch-project-plugin with MIT License | 5 votes |
/** * 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); }
Example #5
Source File: SelectJobsBallColorFolderIcon.java From multi-branch-project-plugin with MIT License | 5 votes |
/** * 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(); }
Example #6
Source File: SelectJobsBallColorFolderIcon.java From multi-branch-project-plugin with MIT License | 5 votes |
/** * 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; }
Example #7
Source File: BallColorFolderIcon.java From multi-branch-project-plugin with MIT License | 5 votes |
/** * 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); }
Example #8
Source File: BallColorFolderIcon.java From multi-branch-project-plugin with MIT License | 5 votes |
/** * 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(); }
Example #9
Source File: ImageResolver.java From jenkins-status-badges-plugin with MIT License | 4 votes |
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 ); }
Example #10
Source File: BuildActionFactory.java From jenkins-status-badges-plugin with MIT License | 4 votes |
public StatusImage getBuildImage(BallColor ballColor, String style) throws IOException, FontFormatException { return iconResolver.getBuildImage(ballColor, style); }
Example #11
Source File: StatusActionFactory.java From jenkins-status-badges-plugin with MIT License | 4 votes |
public StatusImage getBuildImage( BallColor color, String style ) throws IOException, FontFormatException { return iconResolver.getBuildImage( color, style ); }
Example #12
Source File: DbBackedBuild.java From DotCi with MIT License | 4 votes |
@Override public BallColor getIconColor() { return !isBuilding() ? getResult().color : BallColor.YELLOW_ANIME; }