Revision 17045 trunk/extensions/extRasterTools-SE/src/org/gvsig/rastertools/properties/panels/TransparencyPanel.java
TransparencyPanel.java | ||
---|---|---|
22 | 22 |
import java.awt.event.ActionEvent; |
23 | 23 |
import java.awt.event.ActionListener; |
24 | 24 |
|
25 |
import javax.swing.BorderFactory; |
|
25 | 26 |
import javax.swing.JCheckBox; |
27 |
import javax.swing.border.TitledBorder; |
|
26 | 28 |
|
27 | 29 |
import org.gvsig.fmap.raster.layers.FLyrRasterSE; |
28 | 30 |
import org.gvsig.fmap.raster.layers.IRasterLayerActions; |
... | ... | |
32 | 34 |
import org.gvsig.gui.beans.slidertext.listeners.SliderListener; |
33 | 35 |
import org.gvsig.gui.util.StatusComponent; |
34 | 36 |
import org.gvsig.raster.hierarchy.IRasterProperties; |
35 |
import org.gvsig.rastertools.properties.control.TransparencyControl;
|
|
37 |
import org.gvsig.rastertools.properties.control.TransparencyListener;
|
|
36 | 38 |
|
37 | 39 |
import com.iver.andami.PluginServices; |
38 | 40 |
import com.iver.cit.gvsig.fmap.layers.FLayer; |
... | ... | |
43 | 45 |
*/ |
44 | 46 |
public class TransparencyPanel extends AbstractPanel implements ActionListener, SliderListener { |
45 | 47 |
private static final long serialVersionUID = -4556920949255458471L; |
46 |
private IRasterProperties op = null;
|
|
48 |
private IRasterProperties op = null;
|
|
47 | 49 |
|
48 | 50 |
/** |
49 | 51 |
* N?mero de bandas del raster |
50 | 52 |
*/ |
51 |
public int nBands = 3;
|
|
52 |
private JCheckBox cbTransparencia = null;
|
|
53 |
private TransparencySelectionPanel pTransSelect = null;
|
|
54 |
private TranspByPixelPanel pTranspByPixel = null;
|
|
55 |
private CheckSliderTextContainer pOpacity = null;
|
|
56 |
private TransparencyControl tControl = null;
|
|
53 |
public int nBands = 3;
|
|
54 |
private JCheckBox cbTransparencia = null;
|
|
55 |
private TranspByPixelPanel pTranspByPixel = null;
|
|
56 |
private CheckSliderTextContainer pOpacity = null;
|
|
57 |
private TransparencyListener transparencyListener = null;
|
|
58 |
private NoDataPanel pNoDataPanel = null;
|
|
57 | 59 |
|
58 | 60 |
/** |
59 | 61 |
* Constructor. |
60 | 62 |
*/ |
61 | 63 |
public TransparencyPanel() { |
62 | 64 |
setLabel(PluginServices.getText(this, "transparencia")); |
63 |
tControl = new TransparencyControl(this); |
|
64 | 65 |
initialize(); |
65 | 66 |
} |
66 | 67 |
|
68 |
private TransparencyListener getTransparencyListener() { |
|
69 |
if (transparencyListener == null) { |
|
70 |
transparencyListener = new TransparencyListener(this); |
|
71 |
} |
|
72 |
return transparencyListener; |
|
73 |
} |
|
74 |
|
|
67 | 75 |
/** |
68 | 76 |
* This method initializes this |
69 | 77 |
* @return void |
70 | 78 |
*/ |
71 | 79 |
protected void initialize() { |
72 | 80 |
this.setLayout(new BorderLayout()); |
81 |
this.add(getOpacityPanel(), BorderLayout.NORTH); |
|
73 | 82 |
this.add(getPTranspByPixel(), BorderLayout.CENTER); |
74 |
this.add(getOpacityPanel(), BorderLayout.NORTH); |
|
75 |
//this.add(getSelectionPanel(), BorderLayout.SOUTH); |
|
83 |
this.add(getNoDataPanel().getPanel(), BorderLayout.SOUTH); |
|
76 | 84 |
initControls(); |
77 | 85 |
} |
78 | 86 |
|
79 |
/* |
|
80 |
* (non-Javadoc) |
|
81 |
* @see org.gvsig.raster.gui.properties.dialog.IRegistrablePanel#initializeUI() |
|
82 |
*/ |
|
83 |
public void initializeUI() {} |
|
84 |
|
|
85 | 87 |
/** |
86 | 88 |
* Asigna el n?mero de bandas de la imagen |
87 | 89 |
* @param nBands |
... | ... | |
130 | 132 |
* This method initializes TranspOpacitySliderPanel |
131 | 133 |
* @return javax.swing.JPanel |
132 | 134 |
*/ |
133 |
public TransparencySelectionPanel getSelectionPanel() { |
|
134 |
if (pTransSelect == null) |
|
135 |
pTransSelect = new TransparencySelectionPanel(); |
|
135 |
public NoDataPanel getNoDataPanel() { |
|
136 |
if (pNoDataPanel == null) { |
|
137 |
pNoDataPanel = new NoDataPanel(getTransparencyListener()); |
|
138 |
pNoDataPanel.getPanel().setBorder(BorderFactory.createTitledBorder(null, PluginServices.getText(this, "nodata"), TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, null, null)); |
|
139 |
pNoDataPanel.setComboValueSetup(0); |
|
140 |
} |
|
136 | 141 |
|
137 |
return pTransSelect;
|
|
142 |
return pNoDataPanel;
|
|
138 | 143 |
} |
139 | 144 |
|
140 | 145 |
/** |
... | ... | |
164 | 169 |
* @return javax.swing.JPanel |
165 | 170 |
*/ |
166 | 171 |
public TranspByPixelPanel getPTranspByPixel() { |
167 |
if (pTranspByPixel == null) |
|
172 |
if (pTranspByPixel == null) {
|
|
168 | 173 |
pTranspByPixel = new TranspByPixelPanel(); |
174 |
pTranspByPixel.setBorder(BorderFactory.createTitledBorder(null, PluginServices.getText(this, "transp_by_pixel"), TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, null, null)); |
|
175 |
} |
|
169 | 176 |
|
170 | 177 |
return pTranspByPixel; |
171 | 178 |
} |
... | ... | |
215 | 222 |
|
216 | 223 |
if (lyr instanceof IRasterProperties) { |
217 | 224 |
op = (IRasterProperties) lyr; |
218 |
tControl.setTransparencyObject(op.getRenderTransparency()); |
|
225 |
getTransparencyListener().setLayer(op); |
|
226 |
getNoDataPanel().setNumBands(op.getBandCount()); |
|
219 | 227 |
} |
228 |
|
|
220 | 229 |
actionEnabled(); |
221 | 230 |
} |
222 | 231 |
|
... | ... | |
246 | 255 |
* @see org.gvsig.rastertools.properties.dialog.IRegistrablePanel#accept() |
247 | 256 |
*/ |
248 | 257 |
public void accept() { |
249 |
tControl.accept();
|
|
258 |
getTransparencyListener().accept();
|
|
250 | 259 |
} |
251 | 260 |
|
252 | 261 |
/* |
... | ... | |
254 | 263 |
* @see org.gvsig.rastertools.properties.dialog.IRegistrablePanel#apply() |
255 | 264 |
*/ |
256 | 265 |
public void apply() { |
257 |
tControl.apply();
|
|
266 |
getTransparencyListener().apply();
|
|
258 | 267 |
} |
259 | 268 |
|
260 | 269 |
/* |
... | ... | |
262 | 271 |
* @see org.gvsig.rastertools.properties.dialog.IRegistrablePanel#cancel() |
263 | 272 |
*/ |
264 | 273 |
public void cancel() { |
265 |
tControl.cancel();
|
|
274 |
getTransparencyListener().cancel();
|
|
266 | 275 |
} |
267 | 276 |
|
268 | 277 |
/* |
... | ... | |
270 | 279 |
* @see org.gvsig.gui.beans.slidertext.listeners.SliderListener#actionValueChanged(org.gvsig.gui.beans.slidertext.listeners.SliderEvent) |
271 | 280 |
*/ |
272 | 281 |
public void actionValueChanged(SliderEvent e) { |
273 |
tControl.onlyApply();
|
|
282 |
getTransparencyListener().onlyApply();
|
|
274 | 283 |
} |
275 | 284 |
|
276 |
/* |
|
277 |
* (non-Javadoc) |
|
278 |
* @see org.gvsig.gui.beans.slidertext.listeners.SliderListener#actionValueDragged(org.gvsig.gui.beans.slidertext.listeners.SliderEvent) |
|
279 |
*/ |
|
280 | 285 |
public void actionValueDragged(SliderEvent e) {} |
281 |
|
|
282 |
public void selected() { |
|
283 |
} |
|
286 |
public void selected() {} |
|
284 | 287 |
} |
Also available in: Unified diff