sysperfana/perfinvestigator/com.nokia.carbide.cpp.pi.util/src/com/nokia/carbide/cpp/pi/util/TestTableColorPalette.java
changeset 12 ae255c9aa552
parent 2 b9ab3b238396
equal deleted inserted replaced
11:5b9d4d8641ce 12:ae255c9aa552
    32 import org.eclipse.swt.widgets.Shell;
    32 import org.eclipse.swt.widgets.Shell;
    33 
    33 
    34 public class TestTableColorPalette {
    34 public class TestTableColorPalette {
    35 	private Shell sShell = null;
    35 	private Shell sShell = null;
    36 	
    36 	
    37 	private Map<Button,CLabel> testColorsMap = new HashMap<Button,CLabel>();
    37 	private final Map<Button,CLabel> testColorsMap = new HashMap<Button,CLabel>();
    38 	private FunctionColorPalette palette = new FunctionColorPalette();
    38 	private final FunctionColorPalette palette = new FunctionColorPalette();
    39 	
    39 	
    40 	public static void main(String[] args) {
    40 	public static void main(final String[] args) {
    41 		Display display = Display.getDefault();
    41 		Display display = Display.getDefault();
    42 		TestTableColorPalette thisClass = new TestTableColorPalette();
    42 		TestTableColorPalette thisClass = new TestTableColorPalette();
    43 		thisClass.createSShell();
    43 		thisClass.createSShell();
    44 		thisClass.sShell.open();
    44 		thisClass.sShell.open();
    45 
    45 
    46 		while (!thisClass.sShell.isDisposed()) {
    46 		while (!thisClass.sShell.isDisposed()) {
    47 			if (!display.readAndDispatch())
    47 			if (!display.readAndDispatch()){
    48 				display.sleep();
    48 				display.sleep();
       
    49 			}
    49 		}
    50 		}
    50 		display.dispose();
    51 		display.dispose();
    51 	}
    52 	}
    52 
    53 
    53 	/**
    54 	/**
    67 			palette.getColor(i.toString());
    68 			palette.getColor(i.toString());
    68 			final Button button = new Button(sShell, SWT.NONE);
    69 			final Button button = new Button(sShell, SWT.NONE);
    69 			button.setText(i.toString());
    70 			button.setText(i.toString());
    70 			button.setBackground(palette.getColor(i.toString()));
    71 			button.setBackground(palette.getColor(i.toString()));
    71 			button.addSelectionListener(new SelectionAdapter() {
    72 			button.addSelectionListener(new SelectionAdapter() {
    72             	public void widgetSelected(SelectionEvent e) {
    73             	public void widgetSelected(final SelectionEvent e) {
    73             		if(palette.recolorEntryDialog(sShell, finalI))
    74             		if(palette.recolorEntryDialog(sShell, finalI))
    74             		{
    75             		{
    75             			Color myColor = palette.getColor(finalI);
    76             			Color myColor = palette.getColor(finalI);
    76             			CLabel myLabel = testColorsMap.get(button);
    77             			CLabel myLabel = testColorsMap.get(button);
    77             			myLabel.setBackground(myColor);
    78             			myLabel.setBackground(myColor);