Statistics
| Revision:

root / org.gvsig.complexlegend / trunk / org.gvsig.complexlegend / org.gvsig.complexlegend.lib / org.gvsig.complexlegend.lib.impl / src / main / java / org / gvsig / complexlegend / impl / ComplexLegendUtils.java @ 86

History | View | Annotate | Download (929 Bytes)

1
package org.gvsig.complexlegend.impl;
2

    
3
import java.util.Iterator;
4
import java.util.List;
5

    
6
import org.gvsig.app.project.documents.view.legend.gui.AbstractParentPanel;
7
import org.gvsig.app.project.documents.view.legend.gui.ILegendPanel;
8
import org.gvsig.fmap.mapcontext.rendering.legend.ILegend;
9
import org.gvsig.symbology.swing.SymbologySwingLocator;
10

    
11
public class ComplexLegendUtils {
12
        
13
        public static ILegendPanel getLegendPanel(ILegend legend){
14
                List panels = SymbologySwingLocator.getSwingManager().getLegendEditorClasses();
15
                Iterator it = panels.iterator();
16
                while(it.hasNext()){
17
                        Class panelClass = (Class) it.next();
18
                        ILegendPanel panel;
19
                        try {
20
                                panel = (ILegendPanel) panelClass.newInstance();
21
                                if(!(panel instanceof AbstractParentPanel)){
22
                                        if(panel.getLegendClass().equals(legend.getClass())){
23
                                                return panel;
24
                                        }
25
                                }
26
                        } catch (Exception e) {
27
                                return null;
28
                        }
29
                }
30
                return null;
31
        }
32
        
33
}