Revision 6469

View differences:

trunk/applications/appgvSIG/src/com/iver/cit/gvsig/gui/layout/fframes/dialogs/FFrameLegendDialog.java
45 45
package com.iver.cit.gvsig.gui.layout.fframes.dialogs;
46 46

  
47 47
import com.iver.andami.PluginServices;
48
import com.iver.andami.messages.NotificationManager;
48 49
import com.iver.andami.ui.mdiManager.ViewInfo;
49 50

  
51
import com.iver.cit.gvsig.fmap.layers.FLayer;
52
import com.iver.cit.gvsig.fmap.layers.FLayers;
50 53
import com.iver.cit.gvsig.gui.dialogs.FontChooser;
51 54
import com.iver.cit.gvsig.gui.layout.FLayoutUtilities;
52 55
import com.iver.cit.gvsig.gui.layout.Layout;
......
54 57
import com.iver.cit.gvsig.gui.layout.fframes.FFrameView;
55 58
import com.iver.cit.gvsig.gui.layout.fframes.IFFrame;
56 59
import com.iver.cit.gvsig.gui.layout.fframes.ListViewModel;
60
import com.iver.cit.gvsig.gui.project.MapProperties;
57 61

  
62
import java.awt.Component;
63
import java.awt.Dimension;
64
import java.awt.event.ActionListener;
58 65
import java.awt.geom.Rectangle2D;
59 66

  
67
import javax.swing.JCheckBox;
60 68
import javax.swing.JList;
61 69
import javax.swing.JPanel;
70
import javax.swing.JScrollPane;
71
import java.awt.CardLayout;
72
import java.util.ArrayList;
73
import java.util.HashMap;
62 74

  
75
import javax.swing.BoxLayout;
76
import javax.swing.event.ChangeEvent;
77
import javax.swing.event.ChangeListener;
63 78

  
79
import org.apache.batik.dom.util.HashTable;
80
import org.gvsig.gui.beans.AcceptCancelPanel;
81
import org.gvsig.gui.beans.swing.JButton;
82

  
83

  
64 84
/**
65 85
 * Dialogo para a?adir la leyenda de alguna vista al Layout.
66 86
 *
......
80 100
	private Rectangle2D rect = new Rectangle2D.Double();
81 101
	private Layout m_layout = null; //  @jve:visual-info  decl-index=0 visual-constraint="393,10"
82 102
	private FFrameLegend fframelegend = null; //new FFrameLegend();
103
	private ArrayList nameLayers=new ArrayList();
104
	private ArrayList areVisible=new ArrayList();
83 105
	private boolean isAcepted = false;
84
	private javax.swing.JButton bFuente = null;
106
	private JButton bFuente = null;
85 107
	private FFrameView fframeview = null;
86 108
	private JPRotation pRotation = null;
87 109
	//private JLabel lblNumColum = null;
88 110
	//private JTextField txtNumColum = null;
89 111
	//private ColumPanel pNumColum = null;
112
	private JScrollPane jScrollPane1 = null;
113
	private JPanel jPanel = null;
114
	private AcceptCancelPanel accept;
90 115

  
91 116
	/**
92 117
	 * This is the default constructor
......
116 141
	private void initialize() {
117 142
		this.setLayout(null);
118 143
		this.add(getJContentPane(), null);
119
		this.setSize(531, 190);
144
		this.setSize(616, 199);
145
		this.setSize(new java.awt.Dimension(616,189));
120 146
		getPRotation().setRotation(fframelegend.getRotation());
121 147
	}
122 148

  
......
129 155
		if (jContentPane == null) {
130 156
			jContentPane = new javax.swing.JPanel();
131 157
			jContentPane.setLayout(null);
158
			jContentPane.setBounds(new java.awt.Rectangle(3,1,609,183));
132 159
			jContentPane.add(getLMarcoVista(), null);
133 160
			jContentPane.add(getJScrollPane(), null);
134 161
			jContentPane.add(getLVisualizacion(), null);
135 162
			jContentPane.add(getCbVisualizacion(), null);
136 163
			jContentPane.add(getLCalidad(), null);
137 164
			jContentPane.add(getCbCalidad(), null);
138
			jContentPane.add(getBAceptar(), null);
139
			jContentPane.add(getBCancelar(), null);
165
			//jContentPane.add(getBAceptar(), null);
166
			//jContentPane.add(getBCancelar(), null);
167
			jContentPane.add(getAcceptCancelPanel(),null);
140 168
			jContentPane.add(getBFuente(), null);
141
			jContentPane.setBounds(3, 1, 524, 188);
169
			jContentPane.setBounds(3, 1, 609, 241);
142 170
			jContentPane.add(getPRotation(), null);
143 171
			//jContentPane.add(lblNumColum, null);
172
			jContentPane.add(getJScrollPane1(), null);
144 173
		}
145 174

  
146 175
		return jContentPane;
......
154 183
	private javax.swing.JLabel getLMarcoVista() {
155 184
		if (lMarcoVista == null) {
156 185
			lMarcoVista = new javax.swing.JLabel();
157
			lMarcoVista.setSize(156, 63);
186
			lMarcoVista.setSize(115, 63);
158 187
			lMarcoVista.setText(PluginServices.getText(this, "marco_vista"));
159 188
			lMarcoVista.setLocation(5, 10);
160 189
		}
......
171 200
		if (jScrollPane == null) {
172 201
			jScrollPane = new javax.swing.JScrollPane();
173 202
			jScrollPane.setViewportView(getLiVistas());
174
			jScrollPane.setSize(217, 65);
203
			jScrollPane.setSize(179, 65);
175 204
			jScrollPane.setPreferredSize(new java.awt.Dimension(70, 60));
176
			jScrollPane.setLocation(167, 10);
205
			jScrollPane.setLocation(129, 10);
177 206
		}
178 207

  
179 208
		return jScrollPane;
......
187 216
	private javax.swing.JLabel getLVisualizacion() {
188 217
		if (lVisualizacion == null) {
189 218
			lVisualizacion = new javax.swing.JLabel();
190
			lVisualizacion.setSize(99, 16);
219
			lVisualizacion.setSize(115, 16);
191 220
			lVisualizacion.setText(PluginServices.getText(this, "visualizacion"));
192 221
			lVisualizacion.setLocation(6, 83);
193 222
		}
......
208 237
			cbVisualizacion.setSelectedIndex(fframelegend.getViewing());
209 238
			cbVisualizacion.setSize(179, 20);
210 239
			cbVisualizacion.setPreferredSize(new java.awt.Dimension(200, 20));
211
			cbVisualizacion.setLocation(111, 83);
240
			cbVisualizacion.setLocation(129, 83);
212 241
			cbVisualizacion.setEnabled(false);
213 242
		}
214 243

  
......
223 252
	private javax.swing.JLabel getLCalidad() {
224 253
		if (lCalidad == null) {
225 254
			lCalidad = new javax.swing.JLabel();
226
			lCalidad.setSize(99, 16);
255
			lCalidad.setSize(115, 16);
227 256
			lCalidad.setText(PluginServices.getText(this, "calidad"));
228 257
			lCalidad.setLocation(6, 103);
229 258
		}
......
244 273
			cbCalidad.setSelectedIndex(fframelegend.getQuality());
245 274
			cbCalidad.setSize(179, 20);
246 275
			cbCalidad.setPreferredSize(new java.awt.Dimension(200, 20));
247
			cbCalidad.setLocation(111, 103);
276
			cbCalidad.setLocation(129, 103);
248 277
		}
249 278

  
250 279
		return cbCalidad;
251 280
	}
281
	private AcceptCancelPanel getAcceptCancelPanel() {
282
		if (accept == null) {
283
			ActionListener okAction, cancelAction;
284
			okAction = new java.awt.event.ActionListener() {
285
				public void actionPerformed(java.awt.event.ActionEvent e) {
286
					IFFrame[] fframes=m_layout.getFFrames();
287
					for (int i = 0; i < fframes.length;
288
							i++) {
289
						IFFrame f = fframes[i];
252 290

  
253
	/**
254
	 * This method initializes bAceptar
255
	 *
256
	 * @return javax.swing.JButton
257
	 */
258
	private javax.swing.JButton getBAceptar() {
259
		if (bAceptar == null) {
260
			bAceptar = new javax.swing.JButton();
261
			bAceptar.setSize(79, 26);
262
			bAceptar.setText(PluginServices.getText(this, "Aceptar"));
263
			bAceptar.setLocation(77, 145);
264
			bAceptar.addActionListener(new java.awt.event.ActionListener() {
265
					public void actionPerformed(java.awt.event.ActionEvent e) {
266
						IFFrame[] fframes=m_layout.getFFrames();
267
						for (int i = 0; i < fframes.length;
268
								i++) {
269
							IFFrame f = fframes[i];
291
						if (f instanceof FFrameView &&
292
								(fframeview != null)) {
293
							fframelegend.setName("Leyenda de " +
294
								((FFrameView) f).toString());
270 295

  
271
							if (f instanceof FFrameView &&
272
									(fframeview != null)) {
273
								//if (f.getName().compareTo(m_projectView.getName())==0){
274
								//Esto cambia para que la escala se calcule en fframeview y no en fframescalebar.
275
								///	fframelegend.setFMap(((FFrameView)f).getFMap());
276
								fframelegend.setName("Leyenda de " +
277
									((FFrameView) f).toString());
278 296

  
279
								///fframescalebar.setScaleView(((FFrameView)f).getScale());
280
								//}
281
							}
282 297
						}
283

  
284
						/*if (m_projectView!=null){
285
						   fframelegend.setLayers(m_projectView.getMapContext().getLayers());
286
						   }
287
						 */
288
						fframelegend.setViewing(cbVisualizacion.getSelectedIndex());
289
						fframelegend.setQuality(cbCalidad.getSelectedIndex());
290
						fframelegend.setBoundBox(FLayoutUtilities.toSheetRect(
291
								rect, m_layout.getAT()));
292
						fframelegend.setRotation(getPRotation().getRotation());
293

  
294
						PluginServices.getMDIManager().closeView(FFrameLegendDialog.this);
295
						m_layout.refresh();
296
						isAcepted = true;
297 298
					}
298
				});
299
		}
300 299

  
301
		return bAceptar;
302
	}
300
					/*if (m_projectView!=null){
301
					   fframelegend.setLayers(m_projectView.getMapContext().getLayers());
302
					   }
303
					 */
304
					fframelegend.setNameLayers(nameLayers);
305
					fframelegend.setAreVisible(areVisible);
306
					fframelegend.setViewing(cbVisualizacion.getSelectedIndex());
307
					fframelegend.setQuality(cbCalidad.getSelectedIndex());
308
					fframelegend.setBoundBox(FLayoutUtilities.toSheetRect(
309
							rect, m_layout.getAT()));
310
					fframelegend.setRotation(getPRotation().getRotation());
303 311

  
304
	/**
305
	 * This method initializes bCancelar
306
	 *
307
	 * @return javax.swing.JButton
308
	 */
309
	private javax.swing.JButton getBCancelar() {
310
		if (bCancelar == null) {
311
			bCancelar = new javax.swing.JButton();
312
			bCancelar.setSize(85, 26);
313
			bCancelar.setText(PluginServices.getText(this, "Cancelar"));
314
			bCancelar.setLocation(233, 145);
315
			bCancelar.addActionListener(new java.awt.event.ActionListener() {
316
					public void actionPerformed(java.awt.event.ActionEvent e) {
317
						PluginServices.getMDIManager().closeView(FFrameLegendDialog.this);
318
					}
319
				});
312
					PluginServices.getMDIManager().closeView(FFrameLegendDialog.this);
313
					m_layout.refresh();
314
					isAcepted = true;
315
				}
316
				};
317
			cancelAction = new java.awt.event.ActionListener() {
318
				public void actionPerformed(java.awt.event.ActionEvent e) {
319
					PluginServices.getMDIManager().closeView(FFrameLegendDialog.this);
320
				}
321
			};
322
			accept = new AcceptCancelPanel(okAction, cancelAction);
323
			accept.setPreferredSize(new java.awt.Dimension(300,34));
324
			accept.setBounds(new java.awt.Rectangle(5,140,200,30));
325
			//accept.setLocation(5, 200);
320 326
		}
321

  
322
		return bCancelar;
327
		return accept;
323 328
	}
324 329

  
325 330
	/**
......
344 349

  
345 350
					if (fframeview == fframelegend.getFFrameDependence()) {
346 351
						liVistas.setSelectedIndex(i);
352
						nameLayers=fframelegend.getNameLayers();
353
						areVisible=fframelegend.getAreVisible();
354
						refreshLayers();
347 355
					}
348 356

  
349 357
					/*m_projectView=(ProjectView)liVistas.getModel().getElementAt(i);
......
376 384
												.getView()) {
377 385
											fframelegend
378 386
													.setFFrameDependence(fframeview);
387
											refreshLayers();
379 388
										}
380 389
									}
381 390
								}
......
383 392
								// fframelegend.setFFrameView(fframeview);
384 393
							}
385 394
						}
395

  
386 396
					});
387 397
		}
388 398

  
389 399
		return liVistas;
390 400
	}
401
	private void refreshLayers() {
402
		getJPanel().removeAll();
391 403

  
404
		if (fframeview==null)
405
			return;
406

  
407
		FLayers layers=fframeview.getFMap().getLayers();
408
		boolean clear=false;
409
		if (layers.getLayersCount()!=nameLayers.size()) {
410
			clear=true;
411
		}else {
412
			int j=0;
413
			for (int i=layers.getLayersCount()-1;i>=0;i--) {
414
				String name=(String)nameLayers.get(j);
415
				if (!(nameLayers.size()>j && nameLayers.get(j).equals(name))) {
416
					clear=true;
417
					break;
418
				}
419
				j++;
420
			}
421
		}
422
		if (clear) {
423
			nameLayers.clear();
424
			areVisible.clear();
425
		}
426
		int j=0;
427
		for (int i=layers.getLayersCount()-1;i>=0;i--) {
428
			String name=layers.getLayer(i).getName();
429
			if (nameLayers.size()>j && nameLayers.get(j).equals(name)) {
430
				 boolean b=((Boolean)areVisible.get(j)).booleanValue();
431
				 addLayer(name,j,b);
432
				 nameLayers.set(j,name);
433
				 areVisible.set(j,new Boolean(b));
434
			}else {
435
				addLayer(name,j,layers.getLayer(j).isVisible());
436
				nameLayers.add(name);
437
				areVisible.add(new Boolean(layers.getLayer(i).isVisible()));
438

  
439
			}
440
			j++;
441

  
442
		}
443
		getJPanel().setSize(new Dimension(100,100));
444
	}
445
	private void addLayer(String name,int i,boolean b) {
446
		JCheckBox chbox=new JCheckBox(name,b);
447
//		if (nameLayers.size()>i) {
448
//			nameLayers.set(i,name);
449
//			areVisible.set(i,new Boolean(b));
450
//		}else {
451
//			nameLayers.add(name);
452
//			areVisible.add(new Boolean(b));
453
//		}
454

  
455
		chbox.addChangeListener(new ChangeListener() {
456

  
457
			public void stateChanged(ChangeEvent arg0) {
458
				JCheckBox ckb=(JCheckBox)arg0.getSource();
459
				Component[] components=getJPanel().getComponents();
460
				int j=0;
461
				for (int i=components.length-1;i>=0;i--) {
462
					if (components[i].equals(ckb)) {
463
						areVisible.set(i,new Boolean(ckb.isSelected()));
464
					}
465
					j++;
466
				}
467
				//hashVisible.put(ckb.getLabel(),new Boolean(ckb.isSelected()));
468
			}
469

  
470
		});
471
		getJPanel().add(name,chbox);
472
	}
392 473
	/* (non-Javadoc)
393 474
	 * @see com.iver.mdiApp.ui.MDIManager.View#getViewInfo()
394 475
	 */
......
418 499
	 *
419 500
	 * @return javax.swing.JButton
420 501
	 */
421
	private javax.swing.JButton getBFuente() {
502
	private JButton getBFuente() {
422 503
		if (bFuente == null) {
423
			bFuente = new javax.swing.JButton();
504
			bFuente = new JButton();
424 505
			bFuente.setSize(90, 23);
425 506
			bFuente.setText(PluginServices.getText(this, "fuente"));
426
			bFuente.setLocation(297, 89);
507
			bFuente.setLocation(217, 146);
427 508
			bFuente.addActionListener(new java.awt.event.ActionListener() {
428 509
					public void actionPerformed(java.awt.event.ActionEvent e) {
429 510
						if (fframelegend.getFont() != null) {
......
451 532
	private JPRotation getPRotation() {
452 533
		if (pRotation == null) {
453 534
			pRotation = new JPRotation();
454
			pRotation.setBounds(400, 19, 120, 120);
535
			pRotation.setBounds(470, 19, 120, 120);
455 536
		}
456 537
		return pRotation;
457 538
	}
458 539

  
540
	/**
541
	 * This method initializes jScrollPane1
542
	 *
543
	 * @return javax.swing.JScrollPane
544
	 */
545
	private JScrollPane getJScrollPane1() {
546
		if (jScrollPane1 == null) {
547
			jScrollPane1 = new JScrollPane();
548
			jScrollPane1.setBounds(new java.awt.Rectangle(314,10,137,158));
549
			jScrollPane1.setVerticalScrollBarPolicy(javax.swing.JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
550
			jScrollPane1.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
551
			jScrollPane1.setViewportView(getJPanel());
552
		}
553
		return jScrollPane1;
554
	}
555

  
556
	/**
557
	 * This method initializes jPanel
558
	 *
559
	 * @return javax.swing.JPanel
560
	 */
561
	private JPanel getJPanel() {
562
		if (jPanel == null) {
563
			jPanel = new JPanel();
564
			jPanel.setLayout(new BoxLayout(getJPanel(), BoxLayout.Y_AXIS));
565
		}
566
		return jPanel;
567
	}
568

  
459 569
}  //  @jve:decl-index=0:visual-constraint="10,10"
trunk/applications/appgvSIG/src/com/iver/cit/gvsig/gui/layout/fframes/FFrameLegend.java
64 64
import java.awt.geom.AffineTransform;
65 65
import java.awt.geom.Rectangle2D;
66 66
import java.awt.image.BufferedImage;
67
import java.util.ArrayList;
68
import java.util.HashMap;
69
import java.util.Set;
67 70

  
71
import org.apache.batik.dom.util.HashTable;
68 72

  
73

  
69 74
/**
70 75
 * FFrame para introducir una leyenda en el Layout.
71 76
 *
......
82 87
    private int m_numLayers;
83 88
    private FLayers layers = null;
84 89
    private int dependenceIndex = -1;
90
	private ArrayList nameLayers=new ArrayList();
91
	private ArrayList areVisible=new ArrayList();
85 92

  
86 93
    /**
87 94
     * Rellena la calidad que se quiere aplicar.
......
204 211
            sizefont = (float) (re.getWidth() / (m_max * 0.7));
205 212
        }
206 213

  
214
        int l=0;
207 215
        //////Se recorren los layers dibujando el s?mbolo y su nombre sobre el graphics
208 216
        for (int i = layers.getLayersCount() - 1; i >= 0; i--) {
209 217
            FLayer layer = (FLayer) layers.getLayer(i);
218
            boolean b=false;
210 219

  
211
            if (layer.isVisible()) {
220
            if (nameLayers.size()>l && nameLayers.get(l).equals(layer.getName())) {
221
            	b=((Boolean)areVisible.get(l)).booleanValue();
222
            }else {
223
            	b=layer.isVisible();
224
            }
225
            l++;
226
            if (b) {
212 227
                if (layer instanceof FLayers) {
213 228
                    n[0]++;
214 229

  
......
454 469

  
455 470
        /////Aqu? hay que calcular cuantos layers y sublayers hay, para saber que distancias dejar entre uno y otro.
456 471
        ///y adem?s el tama?o de cada uno de ellos para saber que anchura dejar.
457
        for (int i = 0; i < layers.getLayersCount(); i++) {
472
        int l=0;
473
        for (int i = layers.getLayersCount()-1; i>=0; i--) {
458 474
            FLayer layer = (FLayer) layers.getLayer(i);
459

  
460
            if (layer.isVisible()) {
475
            boolean b=false;
476
            if (nameLayers.size()>l && nameLayers.get(l).equals(layer.getName())) {
477
            	b=((Boolean)areVisible.get(l)).booleanValue();
478
            }else {
479
            	b=layer.isVisible();
480
            }
481
            l++;
482
            if (b) {
483
            //if (layer.isVisible()) {
461 484
                if (layer.getName().length() > m_max) {
462 485
                    m_max = layer.getName().length();
463 486
                }
......
670 693
                    }
671 694
                }
672 695
            }
696

  
697
            String[] s=new String[nameLayers.size()];
698
            boolean[] b=new boolean[nameLayers.size()];
699
            for (int i=0;i<nameLayers.size();i++) {
700
            	String k=(String)nameLayers.get(i);
701
            	s[i]=k;
702
            	b[i]=((Boolean)areVisible.get(i)).booleanValue();
703
            }
704
            xml.putProperty("nameLayers",s);
705
            xml.putProperty("areVisible",b);
673 706
        } catch (Exception e) {
674 707
            throw new SaveException(e, this.getClass().getName());
675 708
        }
......
722 755
        if (xml.contains("index")) {
723 756
            dependenceIndex = xml.getIntProperty("index");
724 757
        }
758
        if (xml.contains("nameLayers")) {
759
        	String[] s=xml.getStringArrayProperty("nameLayers");
760
        	boolean[] b=xml.getBooleanArrayProperty("areVisible");
761
        	for (int i=0;i<s.length;i++) {
762
        		nameLayers.add(s[i]);
763
        		areVisible.add(new Boolean(b[i]));
764
        	}
765
        }
725 766
    }
726 767

  
727 768
    /**
......
756 797
		// TODO Auto-generated method stub
757 798

  
758 799
	}
800

  
801
	public void setNameLayers(ArrayList nameLayers) {
802
		this.nameLayers=nameLayers;
803
	}
804

  
805
	public void setAreVisible(ArrayList areVisible) {
806
		this.areVisible=areVisible;
807
	}
808

  
809
	public ArrayList getNameLayers() {
810
		return nameLayers;
811
	}
812

  
813
	public ArrayList getAreVisible() {
814
		return areVisible;
815
	}
759 816
}
trunk/applications/appgvSIG/src/com/iver/cit/gvsig/FFrameLegendExtension.java
1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
 *
19
 * For more information, contact:
20
 *
21
 *  Generalitat Valenciana
22
 *   Conselleria d'Infraestructures i Transport
23
 *   Av. Blasco Ib??ez, 50
24
 *   46010 VALENCIA
25
 *   SPAIN
26
 *
27
 *      +34 963862235
28
 *   gvsig@gva.es
29
 *      www.gvsig.gva.es
30
 *
31
 *    or
32
 *
33
 *   IVER T.I. S.A
34
 *   Salamanca 50
35
 *   46005 Valencia
36
 *   Spain
37
 *
38
 *   +34 963163400
39
 *   dac@iver.es
40
 */
41
package com.iver.cit.gvsig;
42

  
43
import com.iver.andami.PluginServices;
44
import com.iver.andami.plugins.Extension;
45
import com.iver.andami.ui.mdiManager.View;
46
import com.iver.cit.gvsig.gui.layout.FLayoutGraphics;
47
import com.iver.cit.gvsig.gui.layout.Layout;
48
import com.iver.cit.gvsig.gui.layout.fframes.FFrameLegend;
49
import com.iver.cit.gvsig.gui.layout.fframes.IFFrame;
50

  
51

  
52

  
53
/**
54
 * Extensi?n preparada para controlar las opciones que se pueden realizar sobre
55
 * una vista a?adida en el Layout.
56
 *
57
 * @author Vicente Caballero Navarro
58
 */
59
public class FFrameLegendExtension extends Extension {
60
	//private static Logger logger = Logger.getLogger(FFrameViewExtension.class.getName());
61
	private Layout layout = null;
62

  
63
	/**
64
	 * @see com.iver.andami.plugins.IExtension#initialize()
65
	 */
66
	public void initialize() {
67
	}
68

  
69
	/**
70
	 * @see com.iver.andami.plugins.IExtension#execute(java.lang.String)
71
	 */
72
	public void execute(String s) {
73
		layout = (Layout) PluginServices.getMDIManager().getActiveView();
74
		FLayoutGraphics lg = new FLayoutGraphics(layout);
75
		if (s.compareTo("SIMPLIFICAR") == 0) {
76
			lg.simplify();
77
		}
78
	}
79

  
80
	/**
81
	 * @see com.iver.andami.plugins.IExtension#isEnabled()
82
	 */
83
	public boolean isEnabled() {
84
		Layout l = (Layout)PluginServices.getMDIManager().getActiveView();
85
		IFFrame[] fframes = l.getFFrameSelected();
86
		if (!l.isEditable())
87
			return false;
88
		for (int i = 0; i < fframes.length; i++) {
89
			if (fframes[i] instanceof FFrameLegend) {
90
				return true;
91
			}
92
		}
93

  
94
		return false;
95
	}
96

  
97
	/**
98
	 * @see com.iver.andami.plugins.IExtension#isVisible()
99
	 */
100
	public boolean isVisible() {
101
		View f = PluginServices.getMDIManager().getActiveView();
102

  
103
		if (f == null) {
104
			return false;
105
		}
106

  
107
		if (f instanceof Layout) {
108
			return true; //layout.m_Display.getMapControl().getMapContext().getLayers().layerCount() > 0;
109
		} else {
110
			return false;
111
		}
112
	}
113
}
0 114

  
trunk/applications/appgvSIG/src/com/iver/cit/gvsig/LayoutGraphicControls.java
72 72
		FLayoutGraphics lg = new FLayoutGraphics(layout);
73 73
		logger.debug("Comand : " + s);
74 74

  
75
		if (s.compareTo("SIMPLIFICAR") == 0) {
76
			lg.simplify();
77
		} else if (s.compareTo("AGRUPAR") == 0) {
75
		if (s.compareTo("AGRUPAR") == 0) {
78 76
			layout.getEFS().startComplexCommand();
79 77
			lg.grouping();
80 78
			layout.getEFS().endComplexCommand(PluginServices.getText(this,"group"));
......
106 104
		}
107 105

  
108 106
		if (f instanceof Layout) {
109
		//	Layout layout = (Layout) f;
110

  
111 107
			return true; //layout.m_Display.getMapControl().getMapContext().getLayers().layerCount() > 0;
112 108
		} else {
113 109
			return false;
trunk/applications/appgvSIG/config/config.xml
328 328
			<menu text="Mapa/Graficos/alinear" action-command="ALINEAR" tooltip="alinear_graficos"/>
329 329
			<menu text="Mapa/Graficos/agrupar" action-command="AGRUPAR" tooltip="agrupar_graficos" icon="images/agrupar.png"/>
330 330
			<menu text="Mapa/Graficos/desagrupar" action-command="DESAGRUPAR" tooltip="desagrupar_graficos" icon="images/desagrupar.png"/>
331
			<menu text="Mapa/Graficos/simplificar" action-command="SIMPLIFICAR" tooltip="simplificar"/>
332 331

  
333 332
			<menu text="Mapa/Graficos/colocar_delante" action-command="DELANTE" tooltip="colocar_delante" icon="images/delante.png"/>
334 333
			<menu text="Mapa/Graficos/colocar_detras" action-command="DETRAS" tooltip="colocar_detras" icon="images/detras.png"/>
335 334
			<menu text="Mapa/Graficos/tamano_posicion" action-command="POSICIONAR" tooltip="tamano_posicion" icon="images/posicionar.png"/>
336 335
			<menu text="Mapa/Graficos/linea_grafica" action-command="BORDEAR" tooltip="linea_grafica" icon="images/bordear.png"/>
337
			<tool-bar name="Layout_Tools_Grafics" position="10">
336
			<tool-bar name="Layout_Tools_Graphics" position="10">
338 337
				<action-tool icon="images/delante.png" action-command="DELANTE" tooltip="colocar_delante"/>
339 338
				<action-tool icon="images/detras.png" action-command="DETRAS" tooltip="colocar_detras"/>
340 339
				<action-tool icon="images/posicionar.png" action-command="POSICIONAR" tooltip="tamano_posicion"/>
......
567 566
			<menu text="Mapa/unir_celdas" action-command="JOIN"/>
568 567
			<menu text="Mapa/editar_grupo" action-command="EDITGROUP"/>
569 568
		</extension-->
569
		<extension class-name="com.iver.cit.gvsig.FFrameLegendExtension"
570
			description="Extensi?n encargada de controlar un FFrameLegend."
571
			active="true">
572
			<menu text="Mapa/Graficos/simplificar_leyenda" action-command="SIMPLIFICAR" tooltip="simplificar_leyenda"/>
573

  
574
		</extension>
570 575
		<extension class-name="com.iver.cit.gvsig.About"
571 576
			description="Extensi?n encargada de abrir una ventana con la informaci?n relativa al programa."
572 577
			active="true">

Also available in: Unified diff