Revision 28832 trunk/applications/appgvSIG/src/com/iver/cit/gvsig/gui/panels/CRSSelectPanel.java
CRSSelectPanel.java | ||
---|---|---|
49 | 49 |
import org.cresques.cts.IProjection; |
50 | 50 |
import org.gvsig.gui.beans.swing.JButton; |
51 | 51 |
|
52 |
import com.iver.andami.PluginServices; |
|
53 |
import com.iver.cit.gvsig.gui.panels.crs.CrsUIFactory; |
|
54 |
import com.iver.cit.gvsig.gui.panels.crs.ICrsUIFactory; |
|
55 |
import com.iver.cit.gvsig.gui.panels.crs.ISelectCRSButton; |
|
56 |
import com.iver.cit.gvsig.gui.panels.crs.ISelectCrsPanel; |
|
57 |
import com.iver.cit.gvsig.project.documents.view.info.gui.CSSelectionDialog; |
|
58 |
|
|
52 | 59 |
/** |
53 | 60 |
* |
54 | 61 |
* @author Luis W. Sevilla <sevilla_lui@gva.es> |
55 | 62 |
*/ |
56 |
public abstract class CRSSelectPanel extends JPanel { |
|
57 |
private static Class panelClass = ProjChooserPanel.class; |
|
63 |
public abstract class CRSSelectPanel extends JPanel |
|
64 |
implements ISelectCRSButton { |
|
65 |
private static Class panelClass = ProjChooserPanel.class; |
|
66 |
private static Class uiFactory = CrsUIFactory.class; |
|
58 | 67 |
private boolean transPanelActive = false; |
59 | 68 |
|
60 | 69 |
protected ActionListener actionListener = null; |
... | ... | |
62 | 71 |
public static void registerPanelClass(Class panelClass) { |
63 | 72 |
CRSSelectPanel.panelClass = panelClass; |
64 | 73 |
} |
74 |
|
|
75 |
public static void registerUIFactory(Class uiFactory) { |
|
76 |
CRSSelectPanel.uiFactory = uiFactory; |
|
77 |
} |
|
65 | 78 |
|
66 | 79 |
public static CRSSelectPanel getPanel(IProjection proj) { |
67 | 80 |
CRSSelectPanel panel = null; |
... | ... | |
70 | 83 |
try { |
71 | 84 |
panel = (CRSSelectPanel) panelClass.getConstructor(args).newInstance(params); |
72 | 85 |
} catch (IllegalArgumentException e) { |
73 |
// TODO Auto-generated catch block |
|
74 |
e.printStackTrace(); |
|
86 |
PluginServices.getLogger().error("Error creating CRS selection button", e); |
|
75 | 87 |
} catch (SecurityException e) { |
76 |
// TODO Auto-generated catch block |
|
77 |
e.printStackTrace(); |
|
88 |
PluginServices.getLogger().error("Error creating CRS selection button", e); |
|
78 | 89 |
} catch (InstantiationException e) { |
79 |
// TODO Auto-generated catch block |
|
80 |
e.printStackTrace(); |
|
90 |
PluginServices.getLogger().error("Error creating CRS selection button", e); |
|
81 | 91 |
} catch (IllegalAccessException e) { |
82 |
// TODO Auto-generated catch block |
|
83 |
e.printStackTrace(); |
|
92 |
PluginServices.getLogger().error("Error creating CRS selection button", e); |
|
84 | 93 |
} catch (InvocationTargetException e) { |
85 |
// TODO Auto-generated catch block |
|
86 |
e.printStackTrace(); |
|
94 |
PluginServices.getLogger().error("Error creating CRS selection button", e); |
|
87 | 95 |
} catch (NoSuchMethodException e) { |
88 |
// TODO Auto-generated catch block |
|
89 |
e.printStackTrace(); |
|
96 |
PluginServices.getLogger().error("Error creating CRS selection button", e); |
|
90 | 97 |
} |
91 | 98 |
return panel; |
92 | 99 |
} |
... | ... | |
117 | 124 |
this.transPanelActive = transPanelActive; |
118 | 125 |
} |
119 | 126 |
|
127 |
public static ICrsUIFactory getUIFactory() { |
|
128 |
ICrsUIFactory factory; |
|
129 |
try { |
|
130 |
factory = (ICrsUIFactory) uiFactory.newInstance(); |
|
131 |
} catch (InstantiationException e) { |
|
132 |
PluginServices.getLogger().error("Error creating CRS UI factory. Switching to default factory", e); |
|
133 |
factory = new CrsUIFactory(); |
|
134 |
} catch (IllegalAccessException e) { |
|
135 |
PluginServices.getLogger().error("Error creating CRS UI factory. Switching to default factory", e); |
|
136 |
factory = new CrsUIFactory(); |
|
137 |
} |
|
138 |
return factory; |
|
139 |
} |
|
140 |
|
|
120 | 141 |
} |
Also available in: Unified diff