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.web.ui.dt.component;
042:
043: import java.awt.Image;
044: import java.beans.BeanDescriptor;
045: import java.beans.EventSetDescriptor;
046: import java.beans.PropertyDescriptor;
047: import java.lang.reflect.Method;
048:
049: import javax.faces.event.ActionEvent;
050:
051: import com.sun.rave.faces.event.Action;
052: import com.sun.rave.designtime.*;
053: import com.sun.rave.designtime.Constants;
054: import org.netbeans.modules.visualweb.web.ui.dt.component.util.DesignMessageUtil;
055:
056: /**
057: * BeanCreateInfo which creates a Group Panel with Grid Positioning
058: *
059: * @author Tor Norbye
060: */
061: public class AbsGridBeanCreateInfo implements BeanCreateInfo {
062: public AbsGridBeanCreateInfo() {
063: }
064:
065: public String getBeanClassName() {
066: return "org.netbeans.modules.visualweb.web.ui.dt.component.PanelGroup";
067: }
068:
069: public Result beanCreatedSetup(DesignBean bean) {
070: DesignContext context = bean.getDesignContext();
071:
072: // Force to block (div)
073: DesignProperty property = bean.getProperty("block");
074:
075: if (property != null) {
076: property.setValue(Boolean.TRUE);
077: }
078:
079: // Style
080: property = bean.getProperty("style");
081:
082: if (property != null) {
083: String s = "-rave-layout: grid; position: relative; background-color: white; border: solid 1px gray; width: 200px; height: 200px;";
084: String style = (String) property.getValue();
085:
086: if ((style != null) && (style.length() > 0)) {
087: s = s + style;
088: }
089:
090: property.setValue(s);
091: }
092:
093: return Result.SUCCESS;
094: }
095:
096: public String getDisplayName() {
097: return DesignMessageUtil.getMessage(
098: AbsGridBeanCreateInfo.class, "absGrid.name");
099: }
100:
101: public String getDescription() {
102: return DesignMessageUtil.getMessage(
103: AbsGridBeanCreateInfo.class, "absGrid.tip");
104: }
105:
106: public Image getLargeIcon() {
107: return null;
108: }
109:
110: public Image getSmallIcon() {
111: String iconFileName_C16 = "AbsGrid_C16";
112:
113: String name;
114: name = iconFileName_C16;
115:
116: if (name == null) {
117: return null;
118: }
119:
120: Image image = TabGridBeanCreateInfo.loadImage(name + ".png");
121:
122: if (image == null) {
123: image = TabGridBeanCreateInfo.loadImage(name + ".gif");
124: }
125:
126: return image;
127:
128: //return null;
129: }
130:
131: public String getHelpKey() {
132: return null;
133: }
134: }
|