Revision 38371 branches/v2_0_0_prep/libraries/org.gvsig.symbology/org.gvsig.symbology.swing/org.gvsig.symbology.swing.api/src/main/java/org/gvsig/app/gui/styling/JComboBoxColorScheme.java

View differences:

JComboBoxColorScheme.java
57 57
import javax.swing.JList;
58 58
import javax.swing.ListCellRenderer;
59 59

  
60
import org.gvsig.gui.IColorTables;
61
import org.gvsig.gui.IColorTables.IColorTablePaint;
60
import org.gvsig.gui.ColorTablePainter;
62 61
import org.gvsig.i18n.Messages;
63 62
import org.gvsig.symbology.swing.SymbologySwingLocator;
64 63

  
......
80 79
	File.separator +
81 80
	"ColorSchemes";
82 81
//	private boolean interpolated = false;
83
	private List<IColorTablePaint> colorTables = new ArrayList<IColorTablePaint>();
82
	private List<ColorTablePainter> colorTables = new ArrayList<ColorTablePainter>();
84 83

  
85 84
	private ActionListener innerActionUpdateTooltip = new ActionListener() {
86 85
		public void actionPerformed(ActionEvent e) {
87
			IColorTablePaint colorTable = (IColorTablePaint)getSelectedItem();
86
			ColorTablePainter colorTable = (ColorTablePainter)getSelectedItem();
88 87
			if (colorTable != null) {
89 88
				setToolTipText(colorTable.getTableName());
90 89
			} else {
......
103 102
//		interpolated = interpolateValues;
104 103
		setPreferredSize(new Dimension(150, 20));
105 104
		
106
		IColorTables colorTables = SymbologySwingLocator.getSwingManager().createColorTables();
105
		List<ColorTablePainter> colorTables = SymbologySwingLocator.getSwingManager().createColorTables();
107 106
		if(colorTables != null){
108
			colorTables.load(palettesPath, interpolateValues);
109 107
			for (int i=0; i<colorTables.size(); i++) {
110
				IColorTablePaint colorTable = colorTables.get(i);
108
				ColorTablePainter colorTable = colorTables.get(i);
111 109
//				ArrayList array = new ArrayList();
112 110
//				array.add(colorTable.getTableName());
113 111
//				array.add(colorTable);
......
117 115
			addActionListener(innerActionUpdateTooltip);
118 116
			setRenderer(new ListCellRenderer() {
119 117
				public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
120
					IColorTablePaint colorTable = (IColorTablePaint) value;
118
					ColorTablePainter colorTable = (ColorTablePainter) value;
121 119
					ColorSchemeItemPainter paintItem = new ColorSchemeItemPainter(colorTable.getTableName(), colorTable, isSelected);
122 120
					paintItem.setPreferredSize(getPreferredSize());
123 121
					return paintItem;
......
132 130
	 * @return
133 131
	 */
134 132
	public Color[] getSelectedColors() {
135
		IColorTablePaint colorTable = (IColorTablePaint) getSelectedItem();
133
		ColorTablePainter colorTable = (ColorTablePainter) getSelectedItem();
136 134
		if (colorTable == null) {
137 135
			return null;
138 136
		}
......
147 145
			return;
148 146
		} else {
149 147
			for (int i = 0; i < getItemCount(); i++) {
150
				colorTables.add((IColorTablePaint) getItemAt(i));
148
				colorTables.add((ColorTablePainter) getItemAt(i));
151 149
			}
152 150

  
153 151
			for (int i = 0; i < colorTables.size(); i++) {
154
				IColorTablePaint colorTable = colorTables.get(i);
152
				ColorTablePainter colorTable = colorTables.get(i);
155 153
				Color[] myColors = colorTable.getColors();
156 154

  
157 155
				boolean isEqual = true;
......
179 177
	private class ColorSchemeItemPainter extends JComponent {
180 178
		private static final long serialVersionUID = -6448740563809113949L;
181 179
		private boolean isSelected = false;
182
		private IColorTablePaint colorTablePaint = null;
180
		private ColorTablePainter colorTablePaint = null;
183 181
		/**
184 182
		 * Constructor method
185 183
		 *
......
187 185
		 * @param colorTablePaint
188 186
		 * @param isSelected
189 187
		 */
190
		public ColorSchemeItemPainter(String name, IColorTablePaint colorTablePaint, boolean isSelected) {
188
		public ColorSchemeItemPainter(String name, ColorTablePainter colorTablePaint, boolean isSelected) {
191 189
			super();
192 190
			this.colorTablePaint = colorTablePaint;
193 191
			this.isSelected = isSelected;
......
210 208
				g2.setColor(Color.black);
211 209
			}
212 210

  
213
			colorTablePaint.paint(g2, isSelected, getBounds());
211
			colorTablePaint.paint(g2, isSelected);
214 212
		}
215 213
	}
216 214
	

Also available in: Unified diff