⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 facesgisresourcefactory.java

📁 esri的ArcGIS Server超级学习模板程序(for java)
💻 JAVA
字号:
package com.esri.solutions.jitk.web.data;

import javax.faces.context.FacesContext;
import javax.faces.el.ValueBinding;

import com.esri.adf.web.data.GISResource;

/**
 * Implementation of {@link IGISResourceFactory} that uses 
 * Faces to create a GIS Resource.  The {@link #createResource()}
 * method essentially creates a new instance of a managed bean
 * that is specified through the {@link #setManagedBeanName(String)}
 * method.
 */
public class FacesGISResourceFactory implements IGISResourceFactory<GISResource> {

	/**
	 * Name of Managed Bean to create a new instance from.
	 */
	private String m_name;

	/*
	 * (non-Javadoc)
	 * @see com.esri.solutions.jitk.web.data.IGISResourceFactory#createResource()
	 */
	public GISResource createResource() {
		
		FacesContext fc = FacesContext.getCurrentInstance();
		String vbString = "#{" + m_name + "}";
		
		ValueBinding vb = fc.getApplication().createValueBinding(vbString);
		return (GISResource) vb.getValue(fc);
	}

	/**
	 * Calls {@link #createResource()}.  Helper method for integrating
	 * into bean frameworks such as Faces.
	 * 
	 * @return	New Instance of Managed Bean
	 */
	public GISResource getResource () {
		return createResource();
	}
	
	/**
	 * Sets the name of the managed bean that should be
	 * instantiated from {@link #createResource()}.
	 * 
	 * @param name	Name of Managed Bean.
	 */
	public void setManagedBeanName (String name) {
		m_name = name;
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -