@Test
  public void loop_createsStreamWithSingleColor() {
    ColorSequence sequence = new ColorSequence(display, rgb1);

    ColorStream stream = sequence.loop();

    assertEquals(new Color(display, rgb1), stream.next());
  }
  @Test
  public void keepsSafeCopyOfColorsArray() {
    RGB[] colors = {rgb1, rgb2, rgb3};
    ColorSequence sequence = new ColorSequence(display, colors);

    colors[0] = new RGB(47, 47, 47);
    ColorStream stream = sequence.loop();

    assertEquals(new Color(display, rgb1), stream.next());
  }
  @Test
  public void loop_createsLoopingStream() {
    ColorSequence sequence = new ColorSequence(display, rgb1, rgb2);

    ColorStream stream = sequence.loop();

    assertEquals(new Color(display, rgb1), stream.next());
    assertEquals(new Color(display, rgb2), stream.next());
    assertEquals(new Color(display, rgb1), stream.next());
  }
  @Test
  public void loop_createsStreamWithMultipleColors() {
    ColorSequence sequence = new ColorSequence(display, rgb1, rgb2, rgb3);

    ColorStream stream = sequence.loop();

    assertEquals(new Color(display, rgb1), stream.next());
    assertEquals(new Color(display, rgb2), stream.next());
    assertEquals(new Color(display, rgb3), stream.next());
  }
 private void createItems() {
   List<String> columns = dataSet.getColumns();
   for (String browser : columns) {
     ChartItem item = new ChartItem(chart);
     item.setText(browser);
     item.setColor(colors.next());
   }
 }
  /**
   * 데이터베이스 통계 bar chart를 생성합니다.
   *
   * @param composite
   * @param listData
   */
  private void makeBarChart(Composite compositeCursor, List listData) {
    try {
      ColorStream colors = Colors.cat20Colors(compositeCursor.getDisplay()).loop();

      BarChart barChart = new BarChart(compositeCursor, SWT.NONE);
      GridLayout gl_grpConnectionInfo = new GridLayout(1, true);
      gl_grpConnectionInfo.verticalSpacing = 0;
      gl_grpConnectionInfo.horizontalSpacing = 0;
      gl_grpConnectionInfo.marginHeight = 0;
      gl_grpConnectionInfo.marginWidth = 0;
      barChart.setLayout(gl_grpConnectionInfo);
      barChart.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
      barChart.setBarWidth(10);

      for (Object element : listData) {
        Map<String, Object> retMap = (HashMap<String, Object>) element;

        ChartItem item = new ChartItem(barChart);
        item.setText(
            retMap.get("dbms_type")
                + " ("
                + retMap.get("tot")
                + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
        item.setColor(colors.next());

        float floatVal =
            Float.parseFloat("" + retMap.get("tot")) / 300; // $NON-NLS-1$ //$NON-NLS-2$
        item.setValue(floatVal);
      }

      barChart.layout();
      barChart.getParent().layout();
    } catch (Exception e) {
      logger.error("Get registered DB", e); // $NON-NLS-1$
    }
  }