Revision 2158 branches/gvSIG_03_SLD/applications/appgvSIG/src/com/iver/cit/gvsig/gui/toc/FPopupMenu.java

View differences:

FPopupMenu.java
141 141
	}
142 142
}
143 143

  
144
/*class FLyrVectChangeStyleTocMenuEntry extends TocMenuEntry {
145
    private JMenuItem estilo;
146
	public void initialize(FPopupMenu m) {
147
		super.initialize(m);
148
		FLayer lyr = null;
149
		
150
		if (isTocItemBranch()) {
151
			lyr = getNodeLayer();
152
			if (lyr instanceof ClassifiableVectorial) {
153
		    	estilo = new JMenuItem(PluginServices.getText(this, "Cambio_Estilo"));
154
				getMenu().add(estilo);
155
				estilo.setFont(FPopupMenu.theFont);
156
				//Cambio estilo
157
				estilo.addActionListener(this);
158
			}
159
		}
160
	}
161
	
162
	public void actionPerformed(ActionEvent e) {
163
		FThemeManagerWindow m_LegendEditor = new FThemeManagerWindow();
164
		try {
165
			m_LegendEditor.setMapContext(getMapContext());
166
		} catch (com.iver.cit.gvsig.fmap.DriverException e1) {
167
			e1.printStackTrace();
168
		}
169
		if (PluginServices.getMainFrame() == null) {
170
			JDialog dlg = new JDialog();
171
			    							
172
			m_LegendEditor.setPreferredSize(m_LegendEditor.getSize());
173
			dlg.getContentPane().add(m_LegendEditor);
174
			dlg.setModal(false);			
175
			dlg.pack();
176
			dlg.show();
177
			
178
		} else
179
			PluginServices.getMDIManager().addView(m_LegendEditor);
180
	}
181
}
182
*/
183 144
/**
184 145
 * Muestra el men? de propiedades del tema.
185 146
 * 
......
435 396
					for (int i=0;i<actives.length;i++){
436 397
						actives[i].getParentLayer().removeLayer(actives[i]);
437 398
						layerGroup.addLayer(actives[i]);
438
						
439
						///removeLayer(actives[i]);
440
						
441 399
					}
442 400
					layerGroup.setName(nombre);
443
					//getNodeLayer().getParentLayer().addLayer(layerGroup);
444 401
					View theView = (View) PluginServices.getMDIManager().getActiveView();
445 402
					theView.getMapControl().getMapContext().getLayers()
446 403
					   .addLayer(layerGroup);        
......
448 405
	    		}
449 406
				
450 407
			}
451
			/*else
452
			{
453
    	        TocItemLeaf leaf = (TocItemLeaf) tocItem;
454
    	        FSymbol sym = leaf.getSymbol();
455
    	        sym.setColor(newColor);
456
    	        			    
457
			}*/
458
	        // TRUCO PARA REFRESCAR.
408
			// TRUCO PARA REFRESCAR.
459 409
	        getMapContext().invalidate();                    
460 410

  
461 411
        }
......
477 427
			if (!(lyr instanceof FLayers)){
478 428
				isFLayers=false;
479 429
			}
480
		/*	for (int i=0;i<actives.length;i++){
481
				if (!(actives[i] instanceof FLayers)){
482
					isFLayers=false;
483
				}
484
			}
485
		*/
486 430
		}
487 431
		if (isFLayers){
488 432
			desagrupar = new JMenuItem(PluginServices.getText(this, "desagrupar_capas"));
......
507 451
					}
508 452
					parent.removeLayer(agrupa);
509 453
				}
510
			
511
					/*View theView = (View) PluginServices.getMDIManager().getActiveView();
512
					theView.getMapControl().getMapContext().getLayers()
513
					   .addLayer(layerGroup);        
514
	    		*/
515
	    		
516 454
			}
517
			/*else
518
			{
519
    	        TocItemLeaf leaf = (TocItemLeaf) tocItem;
520
    	        FSymbol sym = leaf.getSymbol();
521
    	        sym.setColor(newColor);
522
    	        			    
523
			}*/
524 455
	        // TRUCO PARA REFRESCAR.
525 456
	        getMapContext().invalidate();                    
526 457

  
527 458
        }
528 459
    
529 460
}
530

  
531 461
/**
462
 * Cambia la posici?n actual del layer a la primera posici?n.
463
 * 
464
 * @author Vicente Caballero Navarro
465
 */
466
class FirstLayerTocMenuEntry extends TocMenuEntry {
467
    private JMenuItem first;    
468
	public void initialize(FPopupMenu m) {
469
		super.initialize(m);
470
	    	first = new JMenuItem(PluginServices.getText(this, "colocar_delante"));
471
        	first.setFont(FPopupMenu.theFont);
472
        	getMenu().add(first);        
473
        	getMenu().setEnabled(true);
474
	        first.addActionListener(this);
475
	}
476
	
477
	/* (non-Javadoc)
478
	 * @see com.iver.cit.gvsig.gui.toc.TocMenuEntry#execute(com.iver.cit.gvsig.gui.toc.ITocItem)
479
	 */
480
	public void actionPerformed(ActionEvent e) {
481
		ITocItem tocItem = (ITocItem) getNodeUserObject();
482
      
483
      	if (isTocItemBranch()){
484
				FLayer layer=((TocItemBranch)tocItem).getLayer();
485
				FLayers layers=layer.getParentLayer();
486
				for (int i=0;i<layers.getLayersCount();i++){
487
					if(layers.getLayer(i).equals(layer)){
488
						layers.removeLayer(i);
489
						layers.addLayer(layer);
490
					}
491
				}
492
				
493
				
494
			}
495
			// TRUCO PARA REFRESCAR.
496
	        getMapContext().invalidate();                    
497
        
498
	}
499
}
500
/**
532 501
 * Menu de bot?n derecho para el TOC.
533 502
 * Se pueden a?adir entradas facilmente desde una extensi?n,
534 503
 * creando una clase derivando de TocMenuEntry, y a?adiendola en
......
558 527
    	menuEntrys.add(new EliminarCapaTocMenuEntry());
559 528
		menuEntrys.add(new LayersGroupTocMenuEntry());
560 529
		menuEntrys.add(new LayersUngroupTocMenuEntry());
530
		menuEntrys.add(new FirstLayerTocMenuEntry());
561 531
    }
562 532

  
563 533
    public static void addEntry(TocMenuEntry entry) {

Also available in: Unified diff