Revision 38254

View differences:

branches/v2_0_0_prep/applications/appgvSIG/src/org/gvsig/app/project/documents/view/toc/gui/TOC.java
333 333
                if (lyr instanceof Classifiable) {// && !(lyr instanceof
334 334
                                                  // FLyrAnnotation)) {
335 335

  
336
                    Classifiable aux = (Classifiable) lyr;
337
                    ILegend legendInfo = aux.getLegend();
336
                    Classifiable classifiable = (Classifiable) lyr;
337
                    ILegend legendInfo = classifiable.getLegend();
338 338

  
339 339
                    try {
340 340
                        if (legendInfo instanceof IClassifiedLegend) {
......
347 347
                                TocItemLeaf itemLeaf;
348 348
                                itemLeaf =
349 349
                                    new TocItemLeaf(symbols[j],
350
                                        descriptions[j], aux.getShapeType());
350
                                        descriptions[j], classifiable.getShapeType());
351 351
                                itemLeaf.setSize(sizeLeaf);
352 352

  
353 353
                                DefaultMutableTreeNode nodeValue =
......
364 364
                            itemLeaf =
365 365
                                new TocItemLeaf(legendInfo.getDefaultSymbol(),
366 366
                                    legendInfo.getDefaultSymbol()
367
                                        .getDescription(), aux.getShapeType());
367
                                        .getDescription(), classifiable.getShapeType());
368 368
                            itemLeaf.setSize(sizeLeaf);
369 369

  
370 370
                            DefaultMutableTreeNode nodeValue =
......
372 372
                            m_TreeModel.insertNodeInto(nodeValue, nodeLayer,
373 373
                                nodeLayer.getChildCount());
374 374
                        }
375
                        
376
                        if (legendInfo instanceof IHasImageLegend) {
377
                            TocItemLeaf itemLeaf;
378
                            IHasImageLegend imageLegend = (IHasImageLegend) legendInfo;
379
                            Image image = imageLegend.getImageLegend();
380

  
381
                            if (image != null) {
382
                                itemLeaf = new TocItemLeaf();
383
                                itemLeaf.setImageLegend(image, "", new Dimension(
384
                                    image.getWidth(null), image.getHeight(null)));// new
385
                                                                                  // Dimension(150,200));
386

  
387
                                DefaultMutableTreeNode nodeValue =
388
                                    new DefaultMutableTreeNode(itemLeaf);
389
                                m_TreeModel.insertNodeInto(nodeValue, nodeLayer,
390
                                    nodeLayer.getChildCount());
391
                            }
392
                        }
375 393
                    } catch (ReadException e) {
376 394
                        logger.error(MessageFormat.format(
377 395
                            "Can't add leyend of layer {0} to the TOC.", lyr),
378 396
                            e);
379 397
                    }
380
                } else
381
                    if (lyr instanceof IHasImageLegend) {
382
                        TocItemLeaf itemLeaf;
383
                        IHasImageLegend aux = (IHasImageLegend) lyr;
384
                        Image image = aux.getImageLegend();
385

  
386
                        if (image != null) {
387
                            itemLeaf = new TocItemLeaf();
388
                            itemLeaf.setImageLegend(image, "", new Dimension(
389
                                image.getWidth(null), image.getHeight(null)));// new
390
                                                                              // Dimension(150,200));
391

  
392
                            DefaultMutableTreeNode nodeValue =
393
                                new DefaultMutableTreeNode(itemLeaf);
394
                            m_TreeModel.insertNodeInto(nodeValue, nodeLayer,
395
                                nodeLayer.getChildCount());
396
                        }
397
                    }
398
                } 
398 399
            } // if instanceof layers
399 400
        }
400 401
    }

Also available in: Unified diff