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.vmd.midp.components.resources;
042:
043: import org.netbeans.modules.vmd.api.codegen.CodeSetterPresenter;
044: import org.netbeans.modules.vmd.api.model.*;
045: import org.netbeans.modules.vmd.api.properties.DefaultPropertiesPresenter;
046: import org.netbeans.modules.vmd.midp.codegen.MidpParameter;
047: import org.netbeans.modules.vmd.midp.codegen.MidpSetter;
048: import org.netbeans.modules.vmd.midp.components.MidpTypes;
049: import org.netbeans.modules.vmd.midp.components.MidpVersionDescriptor;
050: import org.netbeans.modules.vmd.midp.components.MidpVersionable;
051: import org.netbeans.modules.vmd.midp.propertyeditors.MidpPropertiesCategories;
052: import org.netbeans.modules.vmd.midp.propertyeditors.PropertyEditorString;
053: import org.openide.util.NbBundle;
054:
055: import java.util.Arrays;
056: import java.util.List;
057:
058: /**
059: * @author Karol Harezlak
060: */
061:
062: public final class TickerCD extends ComponentDescriptor {
063:
064: public static final TypeID TYPEID = new TypeID(
065: TypeID.Kind.COMPONENT, "javax.microedition.lcdui.Ticker"); // NOI18N
066:
067: public static final String PROP_STRING = "string"; // NOI18N
068:
069: public TypeDescriptor getTypeDescriptor() {
070: return new TypeDescriptor(ResourceCD.TYPEID, TYPEID, true, true);
071: }
072:
073: public VersionDescriptor getVersionDescriptor() {
074: return MidpVersionDescriptor.MIDP;
075: }
076:
077: public List<PropertyDescriptor> getDeclaredPropertyDescriptors() {
078: return Arrays.asList(new PropertyDescriptor(PROP_STRING,
079: MidpTypes.TYPEID_JAVA_LANG_STRING, MidpTypes
080: .createStringValue(""), false, true,
081: MidpVersionable.MIDP) // NOI18N
082: );
083: }
084:
085: private static DefaultPropertiesPresenter createPropertiesPresenter() {
086: return new DefaultPropertiesPresenter().addPropertiesCategory(
087: MidpPropertiesCategories.CATEGORY_PROPERTIES)
088: .addProperty(
089: NbBundle.getMessage(TickerCD.class,
090: "DISP_Ticker_String"), // NOI18N
091: PropertyEditorString.createInstance(NbBundle
092: .getMessage(TickerCD.class,
093: "LBL_Ticker_String")),
094: PROP_STRING); // NOI18N
095: }
096:
097: private static Presenter createSetterPresenter() {
098: return new CodeSetterPresenter().addParameters(
099: MidpParameter.create(PROP_STRING)).addSetters(
100: MidpSetter.createConstructor(TYPEID,
101: MidpVersionable.MIDP)
102: .addParameters(PROP_STRING)).addSetters(
103: MidpSetter.createSetter("setString",
104: MidpVersionable.MIDP)
105: .addParameters(PROP_STRING)); // NOI18N
106: }
107:
108: protected List<? extends Presenter> createPresenters() {
109: return Arrays.asList(
110: // properties
111: createPropertiesPresenter(),
112: // code
113: createSetterPresenter());
114: }
115:
116: }
|