Revision 12838
trunk/extensions/extRasterTools-SE/src/org/gvsig/rastertools/colortable/ui/ColorTablePanel.java | ||
---|---|---|
102 | 102 |
|
103 | 103 |
private String palettesPath = System.getProperty("user.home") + |
104 | 104 |
File.separator + |
105 |
"gvSIG"; // PluginServices.getArguments()[0]; |
|
105 |
"gvSIG" + // PluginServices.getArguments()[0] + |
|
106 |
File.separator + "colortable"; |
|
106 | 107 |
|
107 | 108 |
/** |
108 | 109 |
* Construir un nuevo ColorTablePanel |
... | ... | |
133 | 134 |
|
134 | 135 |
add(jSplitPane1, BorderLayout.CENTER); |
135 | 136 |
|
136 |
ArrayList fileList = ColorTableLibraryPersistence.getPaletteFileList(palettesPath, "colortable");
|
|
137 |
ArrayList fileList = ColorTableLibraryPersistence.getPaletteFileList(palettesPath); |
|
137 | 138 |
|
138 | 139 |
for (int i = 0; i < fileList.size(); i++) { |
139 | 140 |
ArrayList paletteItems = new ArrayList(); |
140 |
String paletteName = ColorTableLibraryPersistence.loadPalette(palettesPath, (String) fileList.get(i), paletteItems, "colortable");
|
|
141 |
String paletteName = ColorTableLibraryPersistence.loadPalette(palettesPath, (String) fileList.get(i), paletteItems); |
|
141 | 142 |
|
142 | 143 |
if (paletteItems.size() <= 0) |
143 | 144 |
continue; |
trunk/extensions/extRasterTools-SE/src-test-ui/org/gvsig/rastertools/colortableJaume/TestComboBoxColorTable.java | ||
---|---|---|
42 | 42 |
|
43 | 43 |
private String palettesPath = System.getProperty("user.home") + |
44 | 44 |
File.separator + |
45 |
"gvSIG"; // PluginServices.getArguments()[0]; |
|
45 |
"gvSIG" + // PluginServices.getArguments()[0] + |
|
46 |
File.separator + "colortable"; |
|
46 | 47 |
|
47 | 48 |
public TestComboBoxColorTable() { |
48 | 49 |
super(); |
... | ... | |
56 | 57 |
private void initialize() { |
57 | 58 |
jComboBox = new JComboBox(); |
58 | 59 |
|
59 |
ArrayList fileList = ColorTableLibraryPersistence.getPaletteFileList(palettesPath, "colortable");
|
|
60 |
ArrayList fileList = ColorTableLibraryPersistence.getPaletteFileList(palettesPath); |
|
60 | 61 |
|
61 | 62 |
for (int i = 0; i < fileList.size(); i++) { |
62 | 63 |
ArrayList paletteItems = new ArrayList(); |
63 |
String paletteName = ColorTableLibraryPersistence.loadPalette(palettesPath, (String) fileList.get(i), paletteItems, "colortable");
|
|
64 |
String paletteName = ColorTableLibraryPersistence.loadPalette(palettesPath, (String) fileList.get(i), paletteItems); |
|
64 | 65 |
|
65 | 66 |
if (paletteItems.size() <= 0) |
66 | 67 |
continue; |
trunk/libraries/libUIComponent/src/org/gvsig/gui/beans/listview/ListViewComponent.java | ||
---|---|---|
36 | 36 |
import java.awt.event.MouseEvent; |
37 | 37 |
import java.awt.event.MouseListener; |
38 | 38 |
import java.awt.event.MouseMotionListener; |
39 |
import java.awt.image.ColorModel; |
|
39 | 40 |
import java.util.ArrayList; |
40 | 41 |
import java.util.Iterator; |
41 | 42 |
|
43 |
import javax.media.jai.ColormapOpImage; |
|
42 | 44 |
import javax.swing.ButtonGroup; |
43 | 45 |
import javax.swing.JComponent; |
44 | 46 |
import javax.swing.JMenu; |
trunk/libraries/libRaster/src/org/gvsig/raster/datastruct/serializer/ColorTableLibraryPersistence.java | ||
---|---|---|
42 | 42 |
* @param palettesBasePath |
43 | 43 |
* @return |
44 | 44 |
*/ |
45 |
public static ArrayList getPaletteFileList(String palettesBasePath, String nameSubdir) {
|
|
46 |
updateVersion(palettesBasePath, nameSubdir);
|
|
45 |
public static ArrayList getPaletteFileList(String palettesBasePath) { |
|
46 |
updateVersion(palettesBasePath); |
|
47 | 47 |
|
48 |
File paletteFiles = new File(palettesBasePath + File.separator + nameSubdir);
|
|
48 |
File paletteFiles = new File(palettesBasePath); |
|
49 | 49 |
|
50 | 50 |
if (!paletteFiles.exists()) |
51 | 51 |
return null; |
... | ... | |
64 | 64 |
* antigua version. |
65 | 65 |
* @param palettesPath |
66 | 66 |
*/ |
67 |
public static void updateVersion_1_0_to_1_1(String palettesBasePath, String nameSubdir) {
|
|
68 |
File palettesFile = new File(palettesBasePath + File.separator + "palettes.xml");
|
|
67 |
public static void updateVersion_1_0_to_1_1(String palettesBasePath) { |
|
68 |
File palettesFile = new File(new File(palettesBasePath).getParent().toString() + File.separator + "palettes.xml");
|
|
69 | 69 |
if (!palettesFile.exists()) |
70 | 70 |
return; |
71 |
new File(palettesBasePath + File.separator + nameSubdir).mkdir();
|
|
71 |
new File(palettesBasePath).mkdir(); |
|
72 | 72 |
|
73 | 73 |
try { |
74 | 74 |
KXmlParser parser = new KXmlParser(); |
75 |
FileInputStream fileInputStream = new FileInputStream(palettesBasePath + File.separator + "palettes.xml");
|
|
75 |
FileInputStream fileInputStream = new FileInputStream(palettesFile);
|
|
76 | 76 |
parser.setInput(fileInputStream, null); |
77 | 77 |
int tag = parser.nextTag(); |
78 | 78 |
|
... | ... | |
88 | 88 |
if (parser.getAttributeCount() == 2) { |
89 | 89 |
// Generar nuevo fichero |
90 | 90 |
KXmlSerializer parserOutput = new KXmlSerializer(); |
91 |
FileOutputStream fileOutputStream = new FileOutputStream(palettesBasePath + File.separator + nameSubdir + File.separator + parser.getAttributeValue(0) + ".xml");
|
|
91 |
FileOutputStream fileOutputStream = new FileOutputStream(palettesBasePath + File.separator + parser.getAttributeValue(0) + ".xml"); |
|
92 | 92 |
|
93 | 93 |
parserOutput.setOutput(fileOutputStream, null); |
94 | 94 |
parserOutput.startDocument("UTF-8", null); |
... | ... | |
180 | 180 |
* Invocar? todos los metodos de actualizaciones de version |
181 | 181 |
* @param palettesBasePath |
182 | 182 |
*/ |
183 |
public static void updateVersion(String palettesBasePath, String nameSubdir) {
|
|
184 |
updateVersion_1_0_to_1_1(palettesBasePath, nameSubdir);
|
|
183 |
public static void updateVersion(String palettesBasePath) { |
|
184 |
updateVersion_1_0_to_1_1(palettesBasePath); |
|
185 | 185 |
//updateVersion_1_1_to_1_2(palettesBasePath); |
186 | 186 |
} |
187 | 187 |
|
... | ... | |
206 | 206 |
* @param palettesPath Camino al fichero de paletas predefinidas. |
207 | 207 |
* @param paletteName Nombre de paleta a cargar desde el fichero xml. |
208 | 208 |
*/ |
209 |
public static String loadPalette(String palettesBasePath, String paletteFileName, ArrayList items, String nameSubdir) {
|
|
210 |
updateVersion(palettesBasePath, nameSubdir);
|
|
209 |
public static String loadPalette(String palettesBasePath, String paletteFileName, ArrayList items) { |
|
210 |
updateVersion(palettesBasePath); |
|
211 | 211 |
|
212 | 212 |
items.clear(); |
213 | 213 |
|
214 |
File palettesFile = new File(palettesBasePath + File.separator + nameSubdir + File.separator + paletteFileName);
|
|
214 |
File palettesFile = new File(palettesBasePath + File.separator + paletteFileName); |
|
215 | 215 |
if (!palettesFile.exists()) |
216 | 216 |
return null; |
217 | 217 |
|
... | ... | |
220 | 220 |
ArrayList rows = new ArrayList(); |
221 | 221 |
|
222 | 222 |
KXmlParser parser = new KXmlParser(); |
223 |
FileInputStream fileInputStream = new FileInputStream(palettesBasePath + File.separator + nameSubdir + File.separator + paletteFileName);
|
|
223 |
FileInputStream fileInputStream = new FileInputStream(palettesBasePath + File.separator + paletteFileName); |
|
224 | 224 |
parser.setInput(fileInputStream, null); |
225 | 225 |
int tag = parser.nextTag(); |
226 | 226 |
|
Also available in: Unified diff