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: package org.netbeans.modules.visualweb.faces.dt.component;
042:
043: import com.sun.rave.designtime.DisplayAction;
044: import com.sun.rave.designtime.Result;
045: import com.sun.rave.designtime.DesignBean;
046: import com.sun.rave.designtime.DesignInfo;
047: import com.sun.rave.designtime.DesignEvent;
048: import com.sun.rave.designtime.DesignProperty;
049: import com.sun.rave.faces.component.EncodingComponent;
050:
051: /**
052: * <p>Design time information for this component.</p>
053: */
054:
055: public class EncodingComponentDesignInfo implements DesignInfo {
056:
057: // ---------------------------------------------------- DesignInfo Methods
058:
059: /**
060: * <p>Return the bean class for which this <code>DesignInfo</code>
061: * instance provides design time information.</p>
062: */
063: public Class getBeanClass() {
064:
065: return EncodingComponent.class;
066:
067: }
068:
069: public boolean acceptParent(DesignBean parentBean,
070: DesignBean childBean, Class childClass) {
071: return true;
072: }
073:
074: public boolean acceptChild(DesignBean parentBean,
075: DesignBean childBean, Class childClass) {
076: return true;
077: }
078:
079: /**
080: * <p>Set up the initial state of a newly created bean.</p>
081: *
082: * @param bean <code>DesignBean</code> wrapping the newly created
083: * bean instance
084: */
085: public Result beanCreatedSetup(DesignBean bean) {
086:
087: // Set the default value binding expression for the "value" property
088: bean.getProperty("value").setValueSource(
089: "#{ApplicationBean1.localeCharacterEncoding}"); //NOI18N
090: return Result.SUCCESS;
091:
092: }
093:
094: public Result beanPastedSetup(DesignBean bean) {
095: return Result.SUCCESS;
096: }
097:
098: /**
099: * <p>Clean up before a bean is deleted.</p>
100: *
101: * @param bean <code>DesignBean</code> wrapping the bean instance
102: * about to be deleted
103: */
104: public Result beanDeletedCleanup(DesignBean bean) {
105:
106: return Result.SUCCESS;
107:
108: }
109:
110: /**
111: * <p>Return a list or hierarchy of items to be included in a context menu
112: * for this bean at design time.</p>
113: *
114: * @param bean <code>DesignBean</code> wrapping the bean instance for which
115: * to return context menu items
116: */
117: public DisplayAction[] getContextItems(DesignBean bean) {
118:
119: return new DisplayAction[0];
120:
121: }
122:
123: /**
124: * <p>Return <code>true</code> if instances of the specified type may be
125: * dropped on the specified target bean.</p>
126: *
127: * @param targetBean <code>DesignBean</code> wrapping the target bean instance
128: * @param sourceBean <code>DesignBean</code> wrapping the source bean instance (may be null)
129: * @param sourceClass <code>Class</code> of the potential drop instance
130: */
131: public boolean acceptLink(DesignBean targetBean,
132: DesignBean sourceBean, Class sourceClass) {
133:
134: return false;
135:
136: }
137:
138: /**
139: * <p>Process the drop of the specified source bean on the specified
140: * target bean.</p>
141: *
142: * @param target <code>DesignBean</code> wrapping the target bean instance
143: * @param source <code>DesignBean</code> wrapping the source bean instance
144: */
145: public Result linkBeans(DesignBean target, DesignBean source) {
146:
147: return Result.SUCCESS;
148:
149: }
150:
151: // ------------------------------------------------ DesignBeanListener Methods
152:
153: public void beanContextActivated(DesignBean bean) {
154: }
155:
156: public void beanContextDeactivated(DesignBean bean) {
157: }
158:
159: public void instanceNameChanged(DesignBean bean,
160: String oldInstanceName) {
161: }
162:
163: /**
164: * <p>Process a bean changed event.</p>
165: *
166: * @param bean <code>DesignBean</code> wrapping the bean that changed
167: */
168: public void beanChanged(DesignBean bean) {
169: }
170:
171: /**
172: * <p>Process an event changed event.</p>
173: *
174: * @param event <code>DesignEvent</code> wrapping the event that changed
175: */
176: public void eventChanged(DesignEvent event) {
177: }
178:
179: /**
180: * <p>Process a property changed event.</p>
181: *
182: * @param prop <code>DesignProperty</code> wrapping the property that changed
183: * @param oldValue the old value of the property (may be null)
184: */
185: public void propertyChanged(DesignProperty prop, Object oldValue) {
186: }
187:
188: }
|