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.ui.options;
042:
043: import java.awt.Image;
044: import java.beans.*;
045: import java.util.*;
046: import org.openide.util.*;
047:
048: import org.netbeans.modules.collab.core.Debug;
049:
050: /**
051: *
052: *
053: * @author Todd Fast, todd.fast@sun.com
054: */
055: public class CollabSettingsBeanInfo extends SimpleBeanInfo {
056: ////////////////////////////////////////////////////////////////////////////
057: // Instance variables
058: ////////////////////////////////////////////////////////////////////////////
059: private PropertyDescriptor[] descriptors;
060: private Image smallIcon;
061: private Image largeIcon;
062:
063: /**
064: *
065: *
066: */
067: public CollabSettingsBeanInfo() {
068: super ();
069: }
070:
071: /**
072: *
073: *
074: */
075: public PropertyDescriptor[] getPropertyDescriptors() {
076: if (descriptors == null) {
077: List descriptorList = new LinkedList();
078:
079: try {
080: PropertyDescriptor descriptor = null;
081:
082: /*
083: descriptor=new PropertyDescriptor(
084: CollabSettings.PROP_TEST, // NOI18N
085: CollabSettings.class);
086: descriptor.setDisplayName(
087: NbBundle.getMessage(CollabSettingsBeanInfo.class,
088: "PROP_CollabSettingsBeanInfo_Test_DisplayName")); // NOI18N
089: descriptor.setShortDescription(
090: NbBundle.getMessage(CollabSettingsBeanInfo.class,
091: "PROP_CollabSettingsBeanInfo_Test_Description")); // NOI18N
092: descriptorList.add(descriptor);
093: */
094: // Idle timout setting
095: descriptor = new PropertyDescriptor(
096: CollabSettings.PROP_IDLE_TIMEOUT, // NOI18N
097: CollabSettings.class);
098: descriptor.setDisplayName(NbBundle.getMessage(
099: CollabSettingsBeanInfo.class,
100: "PROP_CollabSettingsBeanInfo_" + // NOI18N
101: "IdleTimeout_DisplayName")); // NOI18N
102: descriptor.setShortDescription(NbBundle.getMessage(
103: CollabSettingsBeanInfo.class,
104: "PROP_CollabSettingsBeanInfo_" + // NOI18N
105: "IdleTimeout_Description")); // NOI18N
106: descriptorList.add(descriptor);
107:
108: // Presence subscription approval
109: descriptor = new PropertyDescriptor(
110: CollabSettings.PROP_AUTO_APPROVE, // NOI18N
111: CollabSettings.class);
112: descriptor.setDisplayName(NbBundle.getMessage(
113: CollabSettingsBeanInfo.class,
114: "PROP_CollabSettingsBeanInfo_" + // NOI18N
115: "AutoApprove_DisplayName")); // NOI18N
116: descriptor.setShortDescription(NbBundle.getMessage(
117: CollabSettingsBeanInfo.class,
118: "PROP_CollabSettingsBeanInfo_" + // NOI18N
119: "AutoApprove_Description")); // NOI18N
120: descriptorList.add(descriptor);
121:
122: // Auto-login
123: descriptor = new PropertyDescriptor(
124: CollabSettings.PROP_AUTO_LOGIN, // NOI18N
125: CollabSettings.class);
126: descriptor.setDisplayName(NbBundle.getMessage(
127: CollabSettingsBeanInfo.class,
128: "PROP_CollabSettingsBeanInfo_" + // NOI18N
129: "AutoLogin_DisplayName")); // NOI18N
130: descriptor.setShortDescription(NbBundle.getMessage(
131: CollabSettingsBeanInfo.class,
132: "PROP_CollabSettingsBeanInfo_" + // NOI18N
133: "AutoLogin_Description")); // NOI18N
134: descriptorList.add(descriptor);
135:
136: // Auto-accept conversation
137: descriptor = new PropertyDescriptor(
138: CollabSettings.PROP_AUTO_ACCEPT_CONVERSATION, // NOI18N
139: CollabSettings.class);
140: descriptor.setDisplayName(NbBundle.getMessage(
141: CollabSettingsBeanInfo.class,
142: "PROP_CollabSettingsBeanInfo_" + // NOI18N
143: "AutoAcceptConversation_DisplayName")); // NOI18N
144: descriptor.setShortDescription(NbBundle.getMessage(
145: CollabSettingsBeanInfo.class,
146: "PROP_CollabSettingsBeanInfo_" + // NOI18N
147: "AutoAcceptConversation_Description")); // NOI18N
148: descriptorList.add(descriptor);
149: } catch (IntrospectionException e) {
150: Debug.debugNotify(e);
151: }
152:
153: descriptors = (PropertyDescriptor[]) descriptorList
154: .toArray(new PropertyDescriptor[descriptorList
155: .size()]);
156: }
157:
158: return descriptors;
159: }
160:
161: /**
162: *
163: *
164: */
165: public Image getIcon(int type) {
166: if ((type == BeanInfo.ICON_COLOR_16x16)
167: || (type == BeanInfo.ICON_MONO_16x16)) {
168: if (smallIcon == null) {
169: smallIcon = Utilities
170: .loadImage("org/netbeans/modules/collab/core/resources/"
171: + // NOI18N
172: "collab_png.gif"); // NOI18N
173: }
174:
175: return smallIcon;
176: } else {
177: if (largeIcon == null) {
178: largeIcon = Utilities
179: .loadImage("org/netbeans/modules/collab/core/resources/"
180: + // NOI18N
181: "collab_png.gif"); // NOI18N
182: }
183:
184: return largeIcon;
185: }
186: }
187: }
|