Revision 3873 branches/v05/extensions/extWMS/src/com/iver/cit/gvsig/gui/panels/StyleTree.java

View differences:

StyleTree.java
43 43
*
44 44
* $Id$
45 45
* $Log$
46
* Revision 1.2.2.3  2006-01-31 16:25:24  jaume
46
* Revision 1.2.2.4  2006-02-01 16:25:23  jaume
47
* *** empty log message ***
48
*
49
* Revision 1.2.2.3  2006/01/31 16:25:24  jaume
47 50
* correcciones de bugs
48 51
*
49 52
* Revision 1.4  2006/01/31 10:40:31  jaume
......
99 102
import java.awt.Component;
100 103
import java.util.ArrayList;
101 104
import java.util.Hashtable;
102
import java.util.Iterator;
103 105
import java.util.Vector;
104 106

  
105 107
import javax.swing.JLabel;
......
344 346
        return values;
345 347
    }
346 348

  
349
//    /**
350
//     * Sets a leaf (an style) selected.
351
//     * @param selectionPath to this leaf.
352
//     */
353
//    protected void _setSelectedLeaf(TreePath selectionPath) {
354
//        if (selectionPath!=null){
355
//            Object[] objects = selectionPath.getPath();
356
//            Object item = objects[objects.length-1];
357
//            if (isLeaf(item)){
358
//                selections.put(((FMapWMSStyle) item).parent, item);
359
//            }
360
//        }
361
//    }
362
    
347 363
    /**
348 364
     * Sets a leaf (an style) selected.
349 365
     * @param selectionPath to this leaf.
......
353 369
            Object[] objects = selectionPath.getPath();
354 370
            Object item = objects[objects.length-1];
355 371
            if (isLeaf(item)){
356
                selections.put(((FMapWMSStyle) item).parent, item);
357
            }
358
        }
359
    }
372
            	FMapWMSStyle style = (FMapWMSStyle) item;
373
            	String layerName = style.parent.getName();
374
            	
375
            	// find a layer with the same name of the selected style's owner one
376
            	for (int i = 0; i < layers.size(); i++) {
377
        			WMSLayerNode lyr = (WMSLayerNode) layers.get(i);
378
        			if (lyr.getName().equals(layerName)){
379
        				
380
        				// find the style of the layer that we have found that has the same
381
        				// name of the selected style.
382
        				for (int j = 0; j < lyr.getStyles().size(); j++) {
383
        					FMapWMSStyle theStyle = (FMapWMSStyle) lyr.getStyles().get(j);
384
        					if (theStyle.name.equals(style.name)){
385
        						
386
        						// and then, set it selected.
387
                				selections.put(((FMapWMSStyle) theStyle).parent, theStyle);
388
            					return;
389
    }}}}}}}	
360 390
    
361 391
    /**
362 392
     * Will return true if this style is selected.
......
365 395
     */
366 396
    protected boolean isSelected(FMapWMSStyle style){
367 397
    	String layerName = style.parent.getName();
368
    	boolean b = false;
369 398
    	for (int i = 0; i < layers.size(); i++) {
370 399
			WMSLayerNode lyr = (WMSLayerNode) layers.get(i);
371 400
			if (lyr.getName().equals(layerName))
372
				//if (selections.get(lyr) == style)
373 401
				if (((FMapWMSStyle)selections.get(lyr)).name.equals(style.name))
374 402
					return true;
375 403
		}
376 404
        return false;
377
    	//return selections.get(style.parent) == style;
378 405
    }
379 406
    
380 407
    /*

Also available in: Unified diff