Revision 22364 trunk/extensions/extRasterTools-SE/src/org/gvsig/raster/gui/preferences/panels/PreferenceLoadLayer.java
PreferenceLoadLayer.java | ||
---|---|---|
40 | 40 |
import org.gvsig.raster.datastruct.persistence.ColorTableLibraryPersistence; |
41 | 41 |
import org.gvsig.raster.gui.preferences.combocolortable.PaintItem; |
42 | 42 |
import org.gvsig.raster.gui.preferences.combocolortable.PreferenceColorTableIconPainter; |
43 |
import org.gvsig.raster.util.PanelBase;
|
|
43 |
import org.gvsig.raster.util.BasePanel;
|
|
44 | 44 |
/** |
45 | 45 |
* PreferenceLoadLayer es una clase para la configuracion de las preferencias |
46 | 46 |
* de una capa raster. |
... | ... | |
48 | 48 |
* @version 14/12/2007 |
49 | 49 |
* @author BorSanZa - Borja S?nchez Zamorano (borja.sanchez@iver.es) |
50 | 50 |
*/ |
51 |
public class PreferenceLoadLayer extends PanelBase implements ActionListener { |
|
52 |
private JComboBox comboBoxColorTable = null; |
|
53 |
private JRadioButton radioButtonRealce = null; |
|
54 |
private JRadioButton radioButtonColorTable = null; |
|
55 |
private JLabel labelLoadLayer = null; |
|
56 |
private ButtonGroup buttonGroup = new ButtonGroup(); |
|
51 |
public class PreferenceLoadLayer extends BasePanel implements ActionListener { |
|
52 |
private static final long serialVersionUID = 1L; |
|
53 |
private JComboBox comboBoxColorTable = null; |
|
54 |
private JRadioButton radioButtonRealce = null; |
|
55 |
private JRadioButton radioButtonColorTable = null; |
|
56 |
private JLabel labelLoadLayer = null; |
|
57 |
private ButtonGroup buttonGroup = null; |
|
57 | 58 |
|
58 |
private String palettesPath = System.getProperty("user.home") + |
|
59 |
File.separator + |
|
60 |
"gvSIG" + // PluginServices.getArguments()[0] + |
|
61 |
File.separator + "colortable"; |
|
62 |
|
|
59 |
/** |
|
60 |
*Inicializa componentes gr?ficos y traduce |
|
61 |
*/ |
|
63 | 62 |
public PreferenceLoadLayer() { |
64 |
initialize();
|
|
63 |
init(); |
|
65 | 64 |
translate(); |
66 | 65 |
} |
67 |
|
|
66 |
|
|
68 | 67 |
/** |
69 | 68 |
* Traduce los textos de esta clase |
70 | 69 |
*/ |
71 |
private void translate() {
|
|
72 |
getPanel().setBorder(BorderFactory.createTitledBorder(getText(this, "carga_capas")));
|
|
70 |
protected void translate() {
|
|
71 |
setBorder(BorderFactory.createTitledBorder(getText(this, "carga_capas"))); |
|
73 | 72 |
getLabelLoadLayer().setText(getText(this, "loadlayer_aplicar") + ":"); |
74 | 73 |
getRadioButtonRealce().setText(getText(this, "realce")); |
75 | 74 |
getRadioButtonColorTable().setText(getText(this, "tabla_color")); |
76 | 75 |
} |
77 | 76 |
|
78 |
private void initialize() {
|
|
77 |
protected void init() {
|
|
79 | 78 |
GridBagConstraints gridBagConstraints; |
80 | 79 |
|
81 |
getPanel().setLayout(new GridBagLayout());
|
|
80 |
setLayout(new GridBagLayout()); |
|
82 | 81 |
|
83 | 82 |
gridBagConstraints = new GridBagConstraints(); |
84 | 83 |
gridBagConstraints.gridx = 0; |
... | ... | |
87 | 86 |
gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; |
88 | 87 |
gridBagConstraints.anchor = GridBagConstraints.WEST; |
89 | 88 |
gridBagConstraints.insets = new Insets(5, 5, 2, 5); |
90 |
getPanel().add(getLabelLoadLayer(), gridBagConstraints);
|
|
89 |
add(getLabelLoadLayer(), gridBagConstraints); |
|
91 | 90 |
|
92 | 91 |
gridBagConstraints = new GridBagConstraints(); |
93 | 92 |
gridBagConstraints.gridx = 0; |
... | ... | |
95 | 94 |
gridBagConstraints.gridwidth = 2; |
96 | 95 |
gridBagConstraints.anchor = GridBagConstraints.WEST; |
97 | 96 |
gridBagConstraints.insets = new Insets(2, 5, 2, 5); |
98 |
getPanel().add(getRadioButtonRealce(), gridBagConstraints);
|
|
97 |
add(getRadioButtonRealce(), gridBagConstraints); |
|
99 | 98 |
|
100 | 99 |
gridBagConstraints = new GridBagConstraints(); |
101 | 100 |
gridBagConstraints.gridx = 0; |
102 | 101 |
gridBagConstraints.gridy = 2; |
103 | 102 |
gridBagConstraints.anchor = GridBagConstraints.WEST; |
104 | 103 |
gridBagConstraints.insets = new Insets(2, 5, 5, 2); |
105 |
getPanel().add(getRadioButtonColorTable(), gridBagConstraints);
|
|
104 |
add(getRadioButtonColorTable(), gridBagConstraints); |
|
106 | 105 |
|
107 | 106 |
gridBagConstraints = new GridBagConstraints(); |
108 | 107 |
gridBagConstraints.gridx = 1; |
... | ... | |
110 | 109 |
gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; |
111 | 110 |
gridBagConstraints.weightx = 1.0; |
112 | 111 |
gridBagConstraints.insets = new Insets(2, 2, 5, 5); |
113 |
getPanel().add(getComboBoxColorTable(), gridBagConstraints);
|
|
112 |
add(getComboBoxColorTable(), gridBagConstraints); |
|
114 | 113 |
} |
114 |
|
|
115 |
/** |
|
116 |
* Obtiene el path del fichero de paletas |
|
117 |
* @return |
|
118 |
*/ |
|
119 |
public String getPalettesPath() { |
|
120 |
return System.getProperty("user.home") + |
|
121 |
File.separator + |
|
122 |
"gvSIG" + // PluginServices.getArguments()[0] + |
|
123 |
File.separator + "colortable"; |
|
124 |
} |
|
125 |
|
|
126 |
/** |
|
127 |
* Obtiene el grupo de botones |
|
128 |
* @return ButtonGroup |
|
129 |
*/ |
|
130 |
public ButtonGroup getButtonGroup() { |
|
131 |
if(buttonGroup == null) |
|
132 |
buttonGroup = new ButtonGroup(); |
|
133 |
return buttonGroup; |
|
134 |
} |
|
115 | 135 |
|
116 | 136 |
public JRadioButton getRadioButtonRealce() { |
117 | 137 |
if (radioButtonRealce == null) { |
118 | 138 |
radioButtonRealce = new JRadioButton(); |
119 |
buttonGroup.add(radioButtonRealce);
|
|
139 |
getButtonGroup().add(radioButtonRealce);
|
|
120 | 140 |
radioButtonRealce.addActionListener(this); |
121 | 141 |
radioButtonRealce.setSelected(true); |
122 | 142 |
radioButtonRealce.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); |
... | ... | |
128 | 148 |
public JRadioButton getRadioButtonColorTable() { |
129 | 149 |
if (radioButtonColorTable == null) { |
130 | 150 |
radioButtonColorTable = new JRadioButton(); |
131 |
buttonGroup.add(radioButtonColorTable);
|
|
151 |
getButtonGroup().add(radioButtonColorTable);
|
|
132 | 152 |
radioButtonColorTable.addActionListener(this); |
133 | 153 |
radioButtonColorTable.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); |
134 | 154 |
radioButtonColorTable.setMargin(new Insets(0, 0, 0, 0)); |
... | ... | |
147 | 167 |
if (comboBoxColorTable == null) { |
148 | 168 |
comboBoxColorTable = new JComboBox(); |
149 | 169 |
|
150 |
ArrayList fileList = ColorTableLibraryPersistence.getPaletteFileList(palettesPath);
|
|
170 |
ArrayList fileList = ColorTableLibraryPersistence.getPaletteFileList(getPalettesPath());
|
|
151 | 171 |
|
152 | 172 |
for (int i = 0; i < fileList.size(); i++) { |
153 | 173 |
ArrayList paletteItems = new ArrayList(); |
154 |
String paletteName = ColorTableLibraryPersistence.loadPalette(palettesPath, (String) fileList.get(i), paletteItems);
|
|
174 |
String paletteName = ColorTableLibraryPersistence.loadPalette(getPalettesPath(), (String) fileList.get(i), paletteItems);
|
|
155 | 175 |
|
156 | 176 |
if (paletteItems.size() <= 0) |
157 | 177 |
continue; |
Also available in: Unified diff