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-2006 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.collab.channel.chat;
042:
043: import org.openide.*;
044: import org.openide.util.*;
045:
046: import java.awt.Image;
047:
048: import java.beans.*;
049:
050: import java.util.*;
051:
052: import org.netbeans.modules.collab.*;
053: import org.netbeans.modules.collab.core.Debug;
054:
055: /**
056: *
057: * @author Todd Fast, todd.fast@sun.com
058: */
059: public class ChatCollabletFactoryBeanInfo extends SimpleBeanInfo {
060: ////////////////////////////////////////////////////////////////////////////
061: // Instance variables
062: ////////////////////////////////////////////////////////////////////////////
063: private PropertyDescriptor[] descriptors;
064: private Image smallIcon;
065: private Image largeIcon;
066:
067: /**
068: *
069: *
070: */
071: public ChatCollabletFactoryBeanInfo() {
072: super ();
073: }
074:
075: /**
076: *
077: *
078: */
079: public PropertyDescriptor[] getPropertyDescriptors() {
080: if (descriptors == null) {
081: List descriptorList = new LinkedList();
082:
083: try {
084: PropertyDescriptor descriptor = null;
085:
086: // class
087: descriptor = new PropertyDescriptor("class", // NOI18N
088: ChatCollabletFactory.class, "getClass", null); // NOI18N
089: descriptor
090: .setDisplayName(NbBundle
091: .getMessage(
092: ChatCollabletFactoryBeanInfo.class,
093: "PROP_ChatCollabletFactoryBeanInfo_class_DisplayName")); // NOI18N
094: descriptor
095: .setShortDescription(NbBundle
096: .getMessage(
097: ChatCollabletFactoryBeanInfo.class,
098: "PROP_ChatCollabletFactoryBeanInfo_class_Description")); // NOI18N
099: descriptorList.add(descriptor);
100:
101: // displayName
102: descriptor = new PropertyDescriptor(
103: "displayName", // NOI18N
104: ChatCollabletFactory.class, "getDisplayName",
105: null); // NOI18N
106: descriptor
107: .setDisplayName(NbBundle
108: .getMessage(
109: ChatCollabletFactoryBeanInfo.class,
110: "PROP_ChatCollabletFactoryBeanInfo_displayName_DisplayName")); // NOI18N
111: descriptor
112: .setShortDescription(NbBundle
113: .getMessage(
114: ChatCollabletFactoryBeanInfo.class,
115: "PROP_ChatCollabletFactoryBeanInfo_displayName_Description")); // NOI18N
116: descriptorList.add(descriptor);
117:
118: // identifier
119: descriptor = new PropertyDescriptor(
120: "identifier", // NOI18N
121: ChatCollabletFactory.class, "getIdentifier",
122: null); // NOI18N
123: descriptor
124: .setDisplayName(NbBundle
125: .getMessage(
126: ChatCollabletFactoryBeanInfo.class,
127: "PROP_ChatCollabletFactoryBeanInfo_identifier_DisplayName")); // NOI18N
128: descriptor
129: .setShortDescription(NbBundle
130: .getMessage(
131: ChatCollabletFactoryBeanInfo.class,
132: "PROP_ChatCollabletFactoryBeanInfo_identifier_Description")); // NOI18N
133: descriptorList.add(descriptor);
134: } catch (IntrospectionException e) {
135: Debug.debugNotify(e);
136: }
137:
138: descriptors = (PropertyDescriptor[]) descriptorList
139: .toArray(new PropertyDescriptor[descriptorList
140: .size()]);
141: }
142:
143: return descriptors;
144: }
145:
146: /**
147: *
148: *
149: */
150: public Image getIcon(int type) {
151: if ((type == BeanInfo.ICON_COLOR_16x16)
152: || (type == BeanInfo.ICON_MONO_16x16)) {
153: if (smallIcon == null) {
154: smallIcon = Utilities
155: .loadImage("org/netbeans/modules/collab/channel/chat/resources/chat_png.gif"); // NOI18N
156: }
157:
158: return smallIcon;
159: } else {
160: if (largeIcon == null) {
161: largeIcon = Utilities
162: .loadImage("org/netbeans/modules/collab/channel/chat/resources/chat_png.gif"); // NOI18N
163: }
164:
165: return largeIcon;
166: }
167: }
168: }
|