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:
042: package org.netbeans.modules.vmd.midpnb.components.svg;
043:
044: import org.netbeans.modules.vmd.api.codegen.CodeSetterPresenter;
045: import org.netbeans.modules.vmd.api.model.*;
046: import org.netbeans.modules.vmd.api.properties.DefaultPropertiesPresenter;
047: import org.netbeans.modules.vmd.api.properties.DesignEventFilterResolver;
048: import org.netbeans.modules.vmd.midp.codegen.MidpParameter;
049: import org.netbeans.modules.vmd.midp.codegen.MidpSetter;
050: import org.netbeans.modules.vmd.midp.components.MidpProjectSupport;
051: import org.netbeans.modules.vmd.midp.components.MidpTypes;
052: import org.netbeans.modules.vmd.midp.components.MidpVersionDescriptor;
053: import org.netbeans.modules.vmd.midp.components.MidpVersionable;
054: import org.netbeans.modules.vmd.midp.propertyeditors.MidpPropertiesCategories;
055: import org.netbeans.modules.vmd.midp.propertyeditors.PropertyEditorBooleanUC;
056: import org.netbeans.modules.vmd.midp.propertyeditors.PropertyEditorNumber;
057: import org.netbeans.modules.vmd.midpnb.codegen.MidpCustomCodePresenterSupport;
058: import org.openide.util.NbBundle;
059:
060: import java.util.Arrays;
061: import java.util.List;
062:
063: /**
064: *
065: * @author Karol Harezlak
066: */
067: public class SVGSplashScreenCD extends ComponentDescriptor {
068:
069: public static final TypeID TYPEID = new TypeID(
070: TypeID.Kind.COMPONENT,
071: "org.netbeans.microedition.svg.SVGSplashScreen"); // NOI18N
072:
073: public static final String ICON_PATH = "org/netbeans/modules/vmd/midpnb/resources/svg_splash_screen_16.png"; // NOI18N
074: public static final String ICON_LARGE_PATH = "org/netbeans/modules/vmd/midpnb/resources/svg_splash_screen_32.png"; // NOI18N
075:
076: public static final String PROP_TIMEOUT = "timeout"; //NOI18N
077: public static final String PROP_ALLOW_TIMEOUT_INTERRUPT = "allowTimeoutInterrupt"; //NOI18N
078:
079: static {
080: MidpTypes.registerIconResource(TYPEID, ICON_PATH);
081: }
082:
083: @Override
084: public void postInitialize(DesignComponent component) {
085: MidpProjectSupport.addLibraryToProject(component.getDocument(),
086: SVGPlayerCD.MIDP_NB_SVG_LIBRARY);
087: }
088:
089: public TypeDescriptor getTypeDescriptor() {
090: return new TypeDescriptor(SVGAnimatorWrapperCD.TYPEID, TYPEID,
091: true, true);
092: }
093:
094: public VersionDescriptor getVersionDescriptor() {
095: return MidpVersionDescriptor.MIDP_2;
096: }
097:
098: public List<PropertyDescriptor> getDeclaredPropertyDescriptors() {
099: return Arrays.asList(new PropertyDescriptor(PROP_TIMEOUT,
100: MidpTypes.TYPEID_INT, MidpTypes
101: .createIntegerValue(5000), false, true,
102: MidpVersionable.MIDP_2), new PropertyDescriptor(
103: PROP_ALLOW_TIMEOUT_INTERRUPT, MidpTypes.TYPEID_BOOLEAN,
104: MidpTypes.createBooleanValue(true), false, true,
105: MidpVersionable.MIDP_2));
106: }
107:
108: private static DefaultPropertiesPresenter createPropertiesPresenter() {
109: return new DefaultPropertiesPresenter(
110: DesignEventFilterResolver.THIS_COMPONENT)
111: .addPropertiesCategory(
112: MidpPropertiesCategories.CATEGORY_PROPERTIES)
113: .addProperty(
114: NbBundle.getMessage(SVGSplashScreenCD.class,
115: "DISP_SVGSplashScreen_Timeout"), // NOI18N
116: PropertyEditorNumber.createIntegerInstance(
117: false, NbBundle.getMessage(
118: SVGSplashScreenCD.class,
119: "LBL_SVGSplashScreen_Timeout")),
120: PROP_TIMEOUT) // NOI18N
121: .addProperty(
122: NbBundle
123: .getMessage(SVGSplashScreenCD.class,
124: "DISP_SVGSplashScreen_AllowTimeoutInterrupt"), // NOI18N
125: PropertyEditorBooleanUC
126: .createInstance(NbBundle
127: .getMessage(
128: SVGSplashScreenCD.class,
129: "LBL_SVGSplashScreen_AllowTimeoutInterrupt")),
130: PROP_ALLOW_TIMEOUT_INTERRUPT); // NOI18N
131: }
132:
133: private Presenter createSetterPresenter() {
134: return new CodeSetterPresenter()
135: .addParameters(
136: MidpCustomCodePresenterSupport
137: .createSVGTimeoutParameter())
138: .addParameters(
139: MidpParameter
140: .create(PROP_ALLOW_TIMEOUT_INTERRUPT))
141: .addParameters(
142: MidpCustomCodePresenterSupport
143: .createSVGSplashScreenCommandParameter())
144: .addSetters(
145: MidpSetter
146: .createConstructor(TYPEID,
147: MidpVersionable.MIDP_2)
148: .addParameters(
149: SVGPlayerCD.PROP_SVG_IMAGE,
150: MidpCustomCodePresenterSupport.PARAM_DISPLAY))
151: .addSetters(
152: MidpSetter
153: .createSetter("setTimeout",
154: MidpVersionable.MIDP_2)
155: .addParameters(
156: MidpCustomCodePresenterSupport.PARAM_SVG_TIMEOUT)) // NOI18N
157: .addSetters(
158: MidpSetter.createSetter(
159: "setAllowTimeoutInterrupt",
160: MidpVersionable.MIDP_2).addParameters(
161: PROP_ALLOW_TIMEOUT_INTERRUPT)); // NOI18N
162: }
163:
164: protected List<? extends Presenter> createPresenters() {
165: return Arrays.asList(
166: // properties
167: createPropertiesPresenter(),
168: // code
169: createSetterPresenter());
170: }
171:
172: }
|