All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.sun.jsftemplating.component.factory.tree.TreeAdaptor Maven / Gradle / Ivy

/*
 * The contents of this file are subject to the terms 
 * of the Common Development and Distribution License 
 * (the License).  You may not use this file except in
 * compliance with the License.
 * 
 * You can obtain a copy of the license at 
 * https://jsftemplating.dev.java.net/cddl1.html or
 * jsftemplating/cddl1.txt.
 * See the License for the specific language governing 
 * permissions and limitations under the License.
 * 
 * When distributing Covered Code, include this CDDL 
 * Header Notice in each file and include the License file 
 * at jsftemplating/cddl1.txt.  
 * If applicable, add the following below the CDDL Header, 
 * with the fields enclosed by brackets [] replaced by
 * you own identifying information: 
 * "Portions Copyrighted [year] [name of copyright owner]"
 * 
 * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
 */
package com.sun.jsftemplating.component.factory.tree;

import java.util.List;
import java.util.Map;

import javax.faces.component.UIComponent;

import com.sun.jsftemplating.layout.descriptors.handler.Handler;


/**
 *  

This interface defines the methods required by * {@link DynamicTreeNodeFactory}. By providing these methods, you are * able to interface some tree structure with the * {@link DynamicTreeNodeFactory} so that whole or partial trees can be * created without having to do any tree conversion work (the work is done * by the TreeAdaptor implementation in conjunction with the * {@link DynamicTreeNodeFactory}).

* *

The TreeAdaptor implementation must have a public * static TreeAdaptor getInstance(FacesContext, LayoutComponent, * UIComponent) method in order to get access to an instance of the * TreeAdaptor instance.

* * @author Ken Paulsen ([email protected]) */ public interface TreeAdaptor { /** *

This method is called shortly after * getInstance(FacesContext, LayoutComponent, UIComponent). It * provides a place for post-creation initialization to take occur.

*/ public void init(); /** *

Returns the model object for the top TreeNode, this * may contain sub TreeNodes.

*/ public Object getTreeNodeObject(); /** *

Returns child TreeNodes for the given * TreeNode model Object.

*/ public List getChildTreeNodeObjects(Object nodeObject); /** *

This method returns the UIComponent factory class * implementation that should be used to create a * TreeNode for the given tree node model object.

*/ public String getFactoryClass(Object nodeObject); /** *

This method returns the "options" that should be supplied to the * factory that creates the TreeNode for the given tree * node model object.

* *

Some useful options for the standard TreeNode * component include:

* *

  • text
  • *
  • url
  • *
  • imageURL
  • *
  • target
  • *
  • action
  • *
  • actionListener
  • *
  • expanded
* *

See Tree / TreeNode component documentation for more details.

*/ public Map getFactoryOptions(Object nodeObject); /** *

This method returns the id for the given tree node * model object.

*/ public String getId(Object nodeObject); /** *

This method returns any facets that should be applied to the * TreeNode (comp). Useful facets for the sun * TreeNode component are: "content" and "image".

* *

Facets that already exist on comp, or facets that * are directly added to comp do not need to be returned * from this method.

* * @param comp The tree node UIComponent. * @param nodeObject The (model) object representing the tree node. */ public Map getFacets(UIComponent comp, Object nodeObject); /** *

Advanced framework feature which provides better handling for * things such as expanding TreeNodes, beforeEncode, and other * events.

* *

This method should return a Map of List * of Handler objects. Each List in the * Map should be registered under a key that cooresponds * to to the "event" in which the Handlers should be * invoked.

*/ public Map> getHandlersByType(UIComponent comp, Object nodeObject); }