?? treemodeladapter.java
字號:
package oracle.adfdemo.view.faces;
import java.beans.IntrospectionException;
import java.util.List;
import oracle.adf.view.faces.model.ChildPropertyTreeModel;
import oracle.adf.view.faces.model.TreeModel;
/**
* This class facilitates the construction of a ChildPropertyTreeModel instance
* via managed-beans. ChildPropertyTreeModel does not have a no-arg constructor.
* This class does, and so can be instantiated as a managed-bean.
* Two properties need to be set: "childProperty" and "instance"
*/
public class TreeModelAdapter implements java.io.Serializable
{
public TreeModelAdapter()
{
}
private String _propertyName = null;
private Object _instance = null;
private transient TreeModel _model = null;
public TreeModel getModel() throws IntrospectionException
{
if (_model == null)
{
_model = new ChildPropertyTreeModel(getInstance(), getChildProperty());
}
return _model;
}
public String getChildProperty()
{
return _propertyName;
}
/**
* Sets the property to use to get at child lists
* @param propertyName
*/
public void setChildProperty(String propertyName)
{
_propertyName = propertyName;
_model = null;
}
public Object getInstance()
{
return _instance;
}
/**
* Sets the root list for this tree.
* @param instance must be something that can be converted into a List
*/
public void setInstance(Object instance)
{
_instance = instance;
_model = null;
}
/**
* Sets the root list for this tree.
* This is needed for passing a List when using the managed bean list
* creation facility, which requires the parameter type is List.
* @param instance the list of root nodes
*/
public void setListInstance(List instance)
{
setInstance(instance);
}
/**
* This should only be called if setListInstance was called.
*
* This method shouldn't be needed according to
* faces spec 1.1 rev 1, see 5.3.1.3
* However without this we get the following error in websphere:
* java.beans.IntrospectionException: No method
* "getListInstance" with 0 arg(s) of
* matching types in websphere
*/
public List getListInstance()
{
return (List)getInstance();
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -