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
008: * Development and Distribution License("CDDL") (collectively, the
009: * "License"). You may not use this file except in compliance with the
010: * License. You can obtain a copy of the License at
011: * http://www.netbeans.org/cddl-gplv2.html
012: * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
013: * specific language governing permissions and limitations under the
014: * License. When distributing the software, include this License Header
015: * Notice in each file and include the License file at
016: * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
017: * particular file as subject to the "Classpath" exception as provided
018: * by Sun in the GPL Version 2 section of the License file that
019: * accompanied this code. If applicable, add the following below the
020: * License Header, with the fields enclosed by brackets [] replaced by
021: * your own identifying information:
022: * "Portions Copyrighted [year] [name of copyright owner]"
023: *
024: * Contributor(s):
025: *
026: * The Original Software is NetBeans. The Initial Developer of the Original
027: * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
028: * Microsystems, Inc. All Rights Reserved.
029: *
030: * If you wish your version of this file to be governed by only the CDDL
031: * or only the GPL Version 2, indicate your decision by adding
032: * "[Contributor] elects to include this software in this distribution
033: * under the [CDDL or GPL Version 2] license." If you do not indicate a
034: * single choice of license, a recipient has the option to distribute
035: * your version of this file under either the CDDL, the GPL Version 2 or
036: * to extend the choice of license to its licensees as provided above.
037: * However, if you add GPL Version 2 code and therefore, elected the GPL
038: * Version 2 license, then the option applies only if the new code is
039: * made subject to such option by the copyright holder.
040: */
041:
042: package com.sun.rave.designtime.markup;
043:
044: import com.sun.rave.designtime.DesignInfo;
045:
046: /**
047: * <P>The MarkupDesignInfo interface is an extension of the DesignInfo interface that adds the
048: * ability to annotate the render stream of a markup element for design-time, and provide clickable
049: * sub-regions and context items within the visual markup element.</P>
050: *
051: * <P><B>IMPLEMENTED BY THE COMPONENT AUTHOR</B> - This interface is designed to be implemented by
052: * the component (bean) author.</P>
053: *
054: * @author Joe Nuxoll
055: * @version 1.0
056: * @see DesignInfo
057: */
058: public interface MarkupDesignInfo extends DesignInfo {
059:
060: /**
061: * <p>This method is called <b>after</b> a JSF component has been invoked to render itself
062: * in design-mode, and just <b>before</b> the rendered markup is displayed on the designer
063: * surface. The component author may use this hook to modify the design-time rendered content
064: * for the given component. They can also associate elements with MarkupMouseRegion
065: * objects.</p>
066: *
067: * <p>For example, the following markup might be emitted when a JSF component is rendered:</p>
068: *
069: * <p><pre>
070: * <table border="1">
071: * <tr>
072: * <th>Name</th>
073: * <th>Address</th>
074: * <th>Phone</th>
075: * </tr>
076: * <tr>
077: * <td>John Smith</td>
078: * <td>100 Milky Way</td>
079: * <td>555-1212</td>
080: * </tr>
081: * <tr>
082: * <td>Luke Johnson</td>
083: * <td>200 Super Drive</td>
084: * <td>911-1234</td>
085: * </tr>
086: * <tr>
087: * <td>Gary Raddo</td>
088: * <td>747 Airport Way</td>
089: * <td>277-9473</td>
090: * </tr>
091: * </table>
092: * </pre></p>
093: *
094: * <p>This markup is parsed into a DOM DocumentFragment, and passed to the 'customizeRender'
095: * method along with the instance of the DesignBean that rendered it. The resultant DOM
096: * DocumentFragment might look like this:</p>
097: *
098: * <p><pre>
099: * <table border="1">
100: * <tr>
101: * <th>Name [CUSTOMER.NAME]</th>
102: * <th>Address [CUSTOMER.ADDRESS]</th>
103: * <th>Phone [CUSTOMER.PHONE]</th>
104: * </tr>
105: * <tr>
106: * <td>John Smith</td>
107: * <td>100 Milky Way</td>
108: * <td>555-1212</td>
109: * </tr>
110: * <tr>
111: * <td>Luke Johnson</td>
112: * <td>200 Super Drive</td>
113: * <td>911-1234</td>
114: * </tr>
115: * <tr>
116: * <td>Gary Raddo</td>
117: * <td>747 Airport Way</td>
118: * <td>277-9473</td>
119: * </tr>
120: * </table>
121: * </pre></p>
122: *
123: * <p>This annotated markup stream would be passed to the designer, where it would be displayed
124: * as an instance of an HTML table (in this example). The component author may have also
125: * 'hooked' the markup elements to instances of MarkupMouseRegion via the
126: * 'MarkupRenderContext.associateMouseRegion' method.</p>
127: *
128: * @param designBean The MarkupDesignBean about to be displayed on the design surface
129: * @param renderContext The context (including rendered content) representing this component's
130: * markup output
131: */
132: public void customizeRender(MarkupDesignBean designBean,
133: MarkupRenderContext renderContext);
134: }
|