《j2ee开发全程实录》随书源码

源代码在线查看: uifactory.java

软件大小: 16821 K
上传用户: add505
关键词: j2ee 源码
下载地址: 免注册下载 普通下载 VIP

相关代码

				package com.cownew.PIS.ui.base;
				
				import java.awt.Dialog;
				import java.awt.Frame;
				import java.awt.Window;
				
				import javax.swing.WindowConstants;
				
				import com.cownew.ctk.common.ExceptionUtils;
				
				public class UIFactory
				{
				
					private static UIPanel getUIPanel(String uiClassName)
					{
						UIPanel uiPanel;
						try
						{
							uiPanel = (UIPanel) Class.forName(uiClassName).newInstance();
						} catch (InstantiationException e)
						{
							throw ExceptionUtils.toRuntimeException(e);
						} catch (IllegalAccessException e)
						{
							throw ExceptionUtils.toRuntimeException(e);
						} catch (ClassNotFoundException e)
						{
							throw ExceptionUtils.toRuntimeException(e);
						}
						return uiPanel;
					}
				
					public static UIDialogContainer getUIDialogContainer(String uiClassName,
							Window owner)
					{
						UIPanel uiPanel = getUIPanel(uiClassName);
						UIDialogContainer cont = null;
						if(owner instanceof Dialog)
						{
							cont = new UIDialogContainer((Dialog)owner, true,uiPanel);
						}
						else if(owner instanceof Frame)
						{
							cont = new UIDialogContainer((Frame)owner,true, uiPanel);
						}
						
						cont.setResizable(false);
						return cont;
					}
				
				
					public static UIDialogContainer getUIDialogContainer(String uiClassName,
							Window owner, boolean modal)
					{
						UIPanel uiPanel = getUIPanel(uiClassName);
						UIDialogContainer cont = null;
						if(owner instanceof Dialog)
						{
							cont = new UIDialogContainer((Dialog)owner,modal, uiPanel);
						}
						else if(owner instanceof Frame)
						{
							cont = new UIDialogContainer((Frame)owner,modal, uiPanel);
						}
						cont.setResizable(false);
						return cont;
					}
				
					public static UIInternalFrameContainer getInternalFrameContainer(String uiClassName)
					{
						UIPanel uiPanel = getUIPanel(uiClassName);
						UIInternalFrameContainer cont = new UIInternalFrameContainer(uiPanel);
						cont.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
						return cont;
					}
				
				}
							

相关资源