hudson.util.ColorPalette Java Examples

The following examples show how to use hudson.util.ColorPalette. 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: History.java    From junit-plugin with MIT License 5 votes vote down vote up
/**
  * Graph of duration of tests over time.
  *
  * @return a graph of duration of tests over time.
  */
 public Graph getDurationGraph() {
    return new GraphImpl("seconds") {
 	   
        protected DataSetBuilder<String, ChartLabel> createDataSet() {
            DataSetBuilder<String, ChartLabel> data = new DataSetBuilder<String, ChartLabel>();
            
            List<TestResult> list;
            try {
            	list = getList(
            			Integer.parseInt(Stapler.getCurrentRequest().getParameter("start")), 
            			Integer.parseInt(Stapler.getCurrentRequest().getParameter("end")));
            } catch (NumberFormatException e) {
            	list = getList();
            }
            
for (hudson.tasks.test.TestResult o: list) {
                data.add(((double) o.getDuration()), "", new ChartLabel(o)  {
                    @Override
                    public Color getColor() {
                        if (o.getFailCount() > 0)
                            return ColorPalette.RED;
                        else if (o.getSkipCount() > 0)
                            return ColorPalette.YELLOW;
                        else
                            return ColorPalette.BLUE;
                    }
                });
            }
            return data;
        }
        
    };
 }