1 package de.desy.acop.displayers.chart;
2
3 import java.awt.Component;
4
5 import javax.swing.DefaultListCellRenderer;
6 import javax.swing.JList;
7
8 import de.desy.acop.chart.AcopGraphStyleEnum;
9
10
11
12
13
14
15
16
17
18
19 public class StyleComboRenderer extends DefaultListCellRenderer {
20
21 private static final long serialVersionUID = 1L;
22
23
24
25
26
27 @Override
28 public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
29 if (value instanceof AcopGraphStyleEnum) {
30 AcopGraphStyleEnum style = (AcopGraphStyleEnum)value;
31 String name = style.name();
32 String n = name.toLowerCase();
33 if (n.startsWith("time")) {
34 name = name.substring(4);
35 } else if (n.startsWith("lin") || n.startsWith("log")) {
36 name = name.substring(3);
37 }
38 value = name;
39 }
40 return super.getListCellRendererComponent(list,value,index,isSelected,cellHasFocus);
41
42 }
43 }