1
2
3
4
5
6
7
8
9
10
11 package org.eclipse.jgit.awtui;
12
13 import java.awt.Color;
14 import java.util.LinkedList;
15
16 import org.eclipse.jgit.revplot.PlotCommitList;
17 import org.eclipse.jgit.revplot.PlotLane;
18
19 class SwingCommitList extends PlotCommitList<SwingCommitList.SwingLane> {
20 final LinkedList<Color> colors;
21
22 SwingCommitList() {
23 colors = new LinkedList<>();
24 repackColors();
25 }
26
27 private void repackColors() {
28 colors.add(Color.green);
29 colors.add(Color.blue);
30 colors.add(Color.red);
31 colors.add(Color.magenta);
32 colors.add(Color.darkGray);
33 colors.add(Color.yellow.darker());
34 colors.add(Color.orange);
35 }
36
37
38 @Override
39 protected SwingLane createLane() {
40 final SwingLane lane = new SwingLane();
41 if (colors.isEmpty())
42 repackColors();
43 lane.color = colors.removeFirst();
44 return lane;
45 }
46
47
48 @Override
49 protected void recycleLane(SwingLane lane) {
50 colors.add(lane.color);
51 }
52
53 static class SwingLane extends PlotLane {
54 private static final long serialVersionUID = 1L;
55 Color color;
56 }
57 }