001: /*
002: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003: *
004: * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005: *
006: * The contents of this file are subject to the terms of either the GNU
007: * General Public License Version 2 only ("GPL") or the Common Development
008: * and Distribution License("CDDL") (collectively, the "License"). You
009: * may not use this file except in compliance with the License. You can obtain
010: * a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
011: * or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific
012: * language governing permissions and limitations under the License.
013: *
014: * When distributing the software, include this License Header Notice in each
015: * file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
016: * Sun designates this particular file as subject to the "Classpath" exception
017: * as provided by Sun in the GPL Version 2 section of the License file that
018: * accompanied this code. If applicable, add the following below the License
019: * Header, with the fields enclosed by brackets [] replaced by your own
020: * identifying information: "Portions Copyrighted [year]
021: * [name of copyright owner]"
022: *
023: * Contributor(s):
024: *
025: * If you wish your version of this file to be governed by only the CDDL or
026: * only the GPL Version 2, indicate your decision by adding "[Contributor]
027: * elects to include this software in this distribution under the [CDDL or GPL
028: * Version 2] license." If you don't indicate a single choice of license, a
029: * recipient has the option to distribute your version of this file under
030: * either the CDDL, the GPL Version 2 or to extend the choice of license to
031: * its licensees as provided above. However, if you add GPL Version 2 code
032: * and therefore, elected the GPL Version 2 license, then the option applies
033: * only if the new code is made subject to such option by the copyright
034: * holder.
035: */
036: package com.sun.jbi.jsf.factory;
037:
038: import com.sun.jsftemplating.layout.descriptors.handler.Handler;
039:
040: import java.util.List;
041: import java.util.Map;
042:
043: import javax.faces.component.UIComponent;
044:
045: /**
046: * <p> This interface defines the methods required by
047: * {@link DynamicPropertySheetFactory}. By providing these methods, you are
048: * able to interface some tree structure with the
049: * {@link DynamicPropertySheetFactory} so that whole or partial trees can be
050: * created without having to do any tree conversion work (the work is done
051: * by the <code>TreeAdaptor</code> implementation in conjunction with the
052: * {@link DynamicPropretySheetFactory}).</p>
053: *
054: * <p> The <code>TreeAdaptor</code> implementation must have a <code>public
055: * static TreeAdaptor getInstance(FacesContext, LayoutComponent,
056: * UIComponent)</code> method in order to get access to an instance of the
057: * <code>TreeAdaptor</code> instance.</p>
058: *
059: * @author Ken Paulsen (ken.paulsen@sun.com)
060: */
061: public interface PropertySheetAdaptor {
062:
063: /**
064: * <p> This method is called shortly after
065: * getInstance(FacesContext, LayoutComponent, UIComponent). It
066: * provides a place for post-creation initialization to take occur.</p>
067: */
068: public void init();
069:
070: /**
071: * <p> Returns the <code>PropertySheet</code>s for the given
072: * <code>PropertySheet</code> model Object.</p>
073: */
074: public UIComponent getPropertySheet(UIComponent parent);
075:
076: /**
077: * <p> This method returns the <code>UIComponent</code> factory class
078: * implementation that should be used to create a
079: * <code>PropertySheet</code> for the given tree node model object.</p>
080: */
081: public String getFactoryClass();
082:
083: /**
084: * <p> This method returns the "options" that should be supplied to the
085: * factory that creates the <code>PropertySheet</code>.</p>
086: *
087: * <p> Some useful options for the standard <code>PropertySheet</code>
088: * component include:<p>
089: *
090: * <ul><li>propertySheetId</li>
091: * <li>propertySheetSectionIdTag</li>
092: * <li>propertyIdTag</li>
093: * <li>staticTextIdTag</li>
094: * <li>dropDownIdTag</li>
095: * <li>dropDownDefaultLevel</li>
096: * <li>hiddenFieldIdTag</li>
097: * <li>componentName</li>
098: * <li>targetName</li>
099: * <li>instanceName</li>
100: * <li>propertySheetAdaptorClass</li></ul>
101: *
102: * <p> See PropertySheet component documentation for more details.</p>
103: */
104: public Map<String, Object> getFactoryOptions();
105:
106: /**
107: * <p> This method returns the <code>id</code> for the given tree node
108: * model object.</p>
109: */
110: public String getId();
111:
112: /**
113: * <p> This method returns any facets that should be applied to the
114: * <code>PropertySheet (comp)</code>. Useful facets for the sun
115: * <code>PropertySheet</code> component are: "content" and "image".</p>
116: *
117: * <p> Facets that already exist on <code>comp</code>, or facets that
118: * are directly added to <code>comp</code> do not need to be returned
119: * from this method.</p>
120: *
121: * @param comp The tree node <code>UIComponent</code>.
122: * @param nodeObject The (model) object representing the tree node.
123: */
124: public Map<String, UIComponent> getFacets(UIComponent comp,
125: Object nodeObject);
126:
127: /**
128: * <p> Advanced framework feature which provides better handling for
129: * things such as expanding PropertySheets, beforeEncode, and other
130: * events.</p>
131: *
132: * <p> This method should return a <code>Map</code> of <code>List</code>
133: * of <code>Handler</code> objects. Each <code>List</code> in the
134: * <code>Map</code> should be registered under a key that cooresponds
135: * to to the "event" in which the <code>Handler</code>s should be
136: * invoked.</p>
137: */
138: public Map<String, List<Handler>> getHandlersByType(
139: UIComponent comp, Object nodeObject);
140: }
|