18 package com.nokia.carbide.cpp.pi.util; |
18 package com.nokia.carbide.cpp.pi.util; |
19 |
19 |
20 import java.util.ArrayList; |
20 import java.util.ArrayList; |
21 import java.util.HashMap; |
21 import java.util.HashMap; |
22 import java.util.Iterator; |
22 import java.util.Iterator; |
|
23 import java.util.List; |
23 import java.util.Map; |
24 import java.util.Map; |
24 |
25 |
25 import org.eclipse.swt.SWT; |
26 import org.eclipse.swt.SWT; |
26 import org.eclipse.swt.custom.CLabel; |
27 import org.eclipse.swt.custom.CLabel; |
27 import org.eclipse.swt.events.SelectionAdapter; |
28 import org.eclipse.swt.events.SelectionAdapter; |
46 |
47 |
47 public class TestDataMiningPalette { |
48 public class TestDataMiningPalette { |
48 |
49 |
49 private Shell sShell = null; |
50 private Shell sShell = null; |
50 |
51 |
51 private Map<Button,CLabel> dataMiningColors = new HashMap<Button,CLabel>(); |
52 private final Map<Button,CLabel> dataMiningColors = new HashMap<Button,CLabel>(); |
52 private DataMiningPalette palette = new DataMiningPalette(); |
53 private final DataMiningPalette palette = new DataMiningPalette(); |
53 private ArrayList<Integer> sosThreadlist = new ArrayList<Integer>(); |
54 private final List<Integer> sosThreadlist = new ArrayList<Integer>(); |
54 private ArrayList<Integer> threadlist = new ArrayList<Integer>(); |
55 private final List<Integer> threadlist = new ArrayList<Integer>(); |
55 |
56 |
56 |
57 |
57 /** |
58 /** |
58 * @param args |
59 * @param args |
59 */ |
60 */ |
60 public static void main(String[] args) { |
61 public static void main(final String[] args) { |
61 Display display = Display.getDefault(); |
62 Display display = Display.getDefault(); |
62 TestDataMiningPalette thisClass = new TestDataMiningPalette(); |
63 TestDataMiningPalette thisClass = new TestDataMiningPalette(); |
63 thisClass.createSShell(); |
64 thisClass.createSShell(); |
64 thisClass.sShell.open(); |
65 thisClass.sShell.open(); |
65 |
66 |
66 while (!thisClass.sShell.isDisposed()) { |
67 while (!thisClass.sShell.isDisposed()) { |
67 if (!display.readAndDispatch()) |
68 if (!display.readAndDispatch()){ |
68 display.sleep(); |
69 display.sleep(); |
|
70 } |
69 } |
71 } |
70 display.dispose(); |
72 display.dispose(); |
71 } |
73 } |
72 |
74 |
73 /** |
75 /** |
100 |
102 |
101 final Button button = new Button(sShell, SWT.NONE); |
103 final Button button = new Button(sShell, SWT.NONE); |
102 button.setText(entry.toString()); |
104 button.setText(entry.toString()); |
103 button.setBackground(new Color(Display.getCurrent(), palette.getRGB(entry))); |
105 button.setBackground(new Color(Display.getCurrent(), palette.getRGB(entry))); |
104 button.addSelectionListener(new SelectionAdapter() { |
106 button.addSelectionListener(new SelectionAdapter() { |
105 public void widgetSelected(SelectionEvent e) { |
107 public void widgetSelected(final SelectionEvent e) { |
106 Integer index = Integer.valueOf(button.getText()); |
108 Integer index = Integer.valueOf(button.getText()); |
107 if(palette.recolorEntryDialog(sShell, index)) |
109 if(palette.recolorEntryDialog(sShell, index)) |
108 { |
110 { |
109 RGB newRGB = palette.getRGB(index); |
111 RGB newRGB = palette.getRGB(index); |
110 CLabel myLabel = dataMiningColors.get(button); |
112 CLabel myLabel = dataMiningColors.get(button); |