Revision 6555

View differences:

trunk/applications/appgvSIG/src/com/iver/cit/gvsig/gui/toc/FPopupMenu.java
99 99
    		}
100 100
		} else if (isTocItemLeaf()) {
101 101
		    //bShow = true;
102
			
102

  
103 103
		}
104 104
		if (bShow)
105 105
		{
......
117 117
	 */
118 118
	public void actionPerformed(ActionEvent e) {
119 119
		ITocItem tocItem = (ITocItem) getNodeUserObject();
120
		
120

  
121 121
		boolean showDialog=false;
122 122
		if (isTocItemBranch()) {
123 123
			FLayer[] actives = getMapContext().getLayers().getActives();
......
132 132
                            break;
133 133
                        }
134 134
                    }
135
                }				
135
                }
136 136
			}
137 137
		}
138
		
138

  
139 139
		if (!showDialog) return;
140 140

  
141 141
        Color newColor = JColorChooser.showDialog(null,
......
236 236
			lyr = getNodeLayer();
237 237
            //if ((lyr instanceof ClassifiableVectorial) && (getMapContext().getLayers().getActives().length == 1)) {
238 238
            if ((lyr instanceof ClassifiableVectorial)) {
239
            	if (!((lyr instanceof FLyrVect) && 
240
            			!((FLyrVect)lyr).isPropertiesMenuVisible())){      
239
            	if (!((lyr instanceof FLyrVect) &&
240
            			!((FLyrVect)lyr).isPropertiesMenuVisible())){
241 241
            		prop = new JMenuItem(PluginServices.getText(this, "propiedades"));
242 242
            		getMenu().add(prop);
243 243
            		prop.setFont(FPopupMenu.theFont);
......
248 248
            		}
249 249
            		//Cambio estilo
250 250
            		prop.addActionListener(this);
251
            	}				
251
            	}
252 252
			}
253 253
		}
254 254
	}
......
513 513
        if (nombre != null){
514 514
			if (isTocItemBranch()){
515 515
				FLayer[] actives = getMapContext().getLayers().getActives();
516

  
516
				FLayers allLayers = getMapContext().getLayers();
517
				FLayer[] layers=new FLayer[allLayers.getLayersCount()];
518
				for (int i=0;i<allLayers.getLayersCount();i++) {
519
					layers[i]=allLayers.getLayer(i);
520
				}
517 521
				if (actives.length>1) {
518 522

  
519 523
					FLayers layerGroup=new FLayers(getMapContext(),getNodeLayer().getParentLayer());
520
					View theView = (View) PluginServices.getMDIManager().getActiveView();
521
					theView.getMapControl().getMapContext().getLayers()
522
					   .addLayer(layerGroup);
523
					for (int i=0;i<actives.length;i++){
524
					boolean first=true;
525
					for (int i=0;i<layers.length;i++) {
526
					//for (int i=0;i<actives.length;i++){
527
						FLayer layer=layers[i];
528
						if (layer.isActive()) {
529
							if (first) {
530
								getMapContext().getLayers().addLayer(i,layerGroup);
531
								first=false;
532
							}
533
							if(layer instanceof FLyrRaster)
534
								((FLyrRaster)layer).setRemoveRasterFlag(false);
524 535

  
525
						if(actives[i] instanceof FLyrRaster)
526
							((FLyrRaster)actives[i]).setRemoveRasterFlag(false);
527

  
528
						actives[i].getParentLayer().removeLayer(actives[i]);
529
						layerGroup.addLayer(actives[i]);
536
							layer.getParentLayer().removeLayer(layer);
537
							layerGroup.addLayer(layer);
538
						}
530 539
					}
531 540
					layerGroup.setName(nombre);
532 541

  
......
575 584
				FLayers agrupa = (FLayers)getNodeLayer();
576 585
				FLayers parent=agrupa.getParentLayer();
577 586
				if (parent!=null){
578
					for (int j=0;j<agrupa.getLayersCount();j++){
579
						parent.addLayer(agrupa.getLayer(j));
587
					FLayers allLayers=getMapContext().getLayers();
588
					for (int i=0;i<allLayers.getLayersCount();i++) {
589
						FLayer layer=allLayers.getLayer(i);
590
						if (layer.equals(agrupa)) {
591
							for (int j=0;j<agrupa.getLayersCount();j++){
592
								parent.addLayer(i+j,agrupa.getLayer(j));
593
							}
594
							parent.removeLayer(agrupa);
595
						}
580 596
					}
581
					parent.removeLayer(agrupa);
582 597
				}
583 598
			}
584 599
	        // TRUCO PARA REFRESCAR.
......
838 853
		if (isTocItemBranch()) {
839 854
			lyr = getNodeLayer();
840 855
    		// Opcciones para capas raster
841
    		
856

  
842 857
			properties = new JMenuItem(PluginServices.getText(this, "recargar"));
843 858
			getMenu().add( properties );
844
			properties.setFont(FPopupMenu.theFont);			
845
						
859
			properties.setFont(FPopupMenu.theFont);
860

  
846 861
			properties.setEnabled((!lyr.isAvailable()));
847
			
862

  
848 863
			properties.addActionListener(this);
849
			
864

  
850 865
		}
851 866
	}
852 867

  

Also available in: Unified diff