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.displayables;
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.PropertyEditorBooleanUC;
053:
054: import java.util.Arrays;
055: import java.util.List;
056: import org.openide.util.NbBundle;
057:
058: /**
059: * @author David Kaspar
060: */
061:
062: public final class CanvasCD extends ComponentDescriptor {
063:
064: public static final TypeID TYPEID = new TypeID(
065: TypeID.Kind.COMPONENT, "javax.microedition.lcdui.Canvas"); // NOI18N
066:
067: public static final String ICON_PATH = "org/netbeans/modules/vmd/midp/resources/components/canvas_16.png"; // NOI18N
068: public static final String ICON_LARGE_PATH = "org/netbeans/modules/vmd/midp/resources/components/canvas_32.png"; // NOI18N
069:
070: public static final Integer VALUE_DOWN = 6;
071: public static final Integer VALUE_FIRE = 8;
072: public static final Integer VALUE_GAME_A = 9;
073: public static final Integer VALUE_GAME_B = 10;
074: public static final Integer VALUE_GAME_C = 11;
075: public static final Integer VALUE_GAME_D = 12;
076:
077: public static final Integer VALUE_KEY_NUM0 = 48;
078: public static final Integer VALUE_KEY_NUM1 = 49;
079: public static final Integer VALUE_KEY_NUM2 = 50;
080: public static final Integer VALUE_KEY_NUM3 = 51;
081: public static final Integer VALUE_KEY_NUM4 = 52;
082: public static final Integer VALUE_KEY_NUM5 = 53;
083: public static final Integer VALUE_KEY_NUM6 = 54;
084: public static final Integer VALUE_KEY_NUM7 = 55;
085: public static final Integer VALUE_KEY_NUM8 = 56;
086: public static final Integer VALUE_KEY_NUM9 = 57;
087: public static final Integer VALUE_KEY_POUND = 35;
088: public static final Integer VALUE_KEY_STAR = 42;
089: public static final Integer VALUE_LEFT = 2;
090: public static final Integer VALUE_RIGHT = 5;
091: public static final Integer VALUE_UP = 1;
092:
093: public static final String PROP_IS_FULL_SCREEN = "isFullScreen"; //NOI18N
094:
095: static {
096: MidpTypes.registerIconResource(TYPEID, ICON_PATH);
097: }
098:
099: public TypeDescriptor getTypeDescriptor() {
100: return new TypeDescriptor(DisplayableCD.TYPEID, TYPEID, false,
101: true);
102: }
103:
104: public VersionDescriptor getVersionDescriptor() {
105: return MidpVersionDescriptor.MIDP;
106: }
107:
108: public List<PropertyDescriptor> getDeclaredPropertyDescriptors() {
109: return Arrays.asList(
110: //MIDP 2.0
111: new PropertyDescriptor(PROP_IS_FULL_SCREEN,
112: MidpTypes.TYPEID_BOOLEAN, MidpTypes
113: .createBooleanValue(false), false,
114: true, MidpVersionable.MIDP_2));
115: }
116:
117: private static DefaultPropertiesPresenter createPropertiesPresenter() {
118: return new DefaultPropertiesPresenter().addPropertiesCategory(
119: MidpPropertiesCategories.CATEGORY_PROPERTIES)
120: .addProperty(
121: NbBundle.getMessage(CanvasCD.class,
122: "DISP_Canvas_Full_Screen"), // NOI18N
123: NbBundle.getMessage(CanvasCD.class,
124: "TTIP_Canvas_Full_Screen"), // NOI18N
125: PropertyEditorBooleanUC.createInstance(NbBundle
126: .getMessage(CanvasCD.class,
127: "LBL_Canvas_Full_Screen")),
128: PROP_IS_FULL_SCREEN); // NOI18N
129: }
130:
131: private static Presenter createSetterPresenter() {
132: return new CodeSetterPresenter().addParameters(
133: MidpParameter.create(PROP_IS_FULL_SCREEN)).addSetters(
134: MidpSetter.createSetter("setFullScreenMode",
135: MidpVersionable.MIDP_2).addParameters(
136: PROP_IS_FULL_SCREEN)); // NOI18N
137: }
138:
139: protected List<? extends Presenter> createPresenters() {
140: return Arrays.asList(
141: // properties
142: createPropertiesPresenter(),
143: // code
144: createSetterPresenter());
145: }
146:
147: }
|