Revision 43476 trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.ui/src/main/java/org/gvsig/gui/DefaultColorTablePainter.java

View differences:

DefaultColorTablePainter.java
49 49
	}
50 50
	
51 51
	List<ColorItem> colorItems = null;
52
    String name;
52 53
	
53
	DefaultColorTablePainter() {
54
		this.colorItems = new ArrayList<ColorItem>();
54
	public DefaultColorTablePainter() {
55
		this.colorItems = new ArrayList<>();
55 56
		int n = 256;
56 57
		for( int i=0; i<n; i++) {
57 58
                Color color = Color.getHSBColor((float) i / (float) n, 0.85f, 1.0f);
58 59
                this.colorItems.add( new ColorItem(i,color));
59 60
        }
61
        name = "Default colot table";
62
	}
60 63

  
61
	}
64
    public DefaultColorTablePainter(Color[] colors, String name) {
65
		this.colorItems = new ArrayList<>();
66
        for( int i=0; i<colors.length; i++) {
67
            this.colorItems.add( new ColorItem(i, colors[i]));
68
        }
69
        this.name = name;
70
    }
62 71
	
72
    @Override
63 73
	public Color[] getColors() {
64 74
		Color[] colors = new Color[colorItems.size()];
65 75
		for (int i = 0; i < colors.length; i++) {
......
68 78
		return colors;	
69 79
	}
70 80

  
81
    @Override
71 82
	public String getTableName() {
72
		return "Default colot table";
83
		return name;
73 84
	}
74 85

  
86
    @Override
75 87
	public void paint(Graphics2D g, boolean isSelected) {
76 88
		Rectangle area = g.getClipBounds();
77 89
		area.y=0;

Also available in: Unified diff