KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > javawebstart > J2SERunConfigProviderImpl


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20 package org.netbeans.modules.javawebstart;
21
22 import java.util.Map JavaDoc;
23
24 import javax.swing.JComponent JavaDoc;
25
26 import org.netbeans.api.project.Project;
27
28 import org.netbeans.modules.java.j2seproject.api.J2SERunConfigProvider;
29 import org.netbeans.modules.java.j2seproject.api.J2SEPropertyEvaluator;
30
31 import org.netbeans.modules.javawebstart.ui.customizer.JWSCustomizerPanel;
32
33 import org.netbeans.spi.project.support.ant.PropertyEvaluator;
34
35 /**
36  *
37  * @author Milan Kubec
38  */

39 public class J2SERunConfigProviderImpl implements J2SERunConfigProvider {
40     
41     public J2SERunConfigProviderImpl() {}
42     
43     public JComponent JavaDoc createComponent(Project p, J2SERunConfigProvider.ConfigChangeListener listener) {
44         J2SEPropertyEvaluator j2sePropEval = p.getLookup().lookup(J2SEPropertyEvaluator.class);
45         PropertyEvaluator evaluator = j2sePropEval.evaluator();
46         String JavaDoc enabled = evaluator.getProperty("jnlp.enabled");
47         JWSCustomizerPanel.runComponent.addListener(listener);
48         if ("true".equals(enabled)) {
49             JWSCustomizerPanel.runComponent.setCheckboxEnabled(true);
50             JWSCustomizerPanel.runComponent.setHintVisible(false);
51         } else {
52             JWSCustomizerPanel.runComponent.setCheckboxEnabled(false);
53             JWSCustomizerPanel.runComponent.setHintVisible(true);
54         }
55         return JWSCustomizerPanel.runComponent;
56     }
57     
58     public void configUpdated(Map JavaDoc<String JavaDoc,String JavaDoc> m) {
59         if ((m.get("$target.run") != null) && (m.get("$target.debug") != null)) {
60             JWSCustomizerPanel.runComponent.setCheckboxSelected(true);
61         } else {
62             JWSCustomizerPanel.runComponent.setCheckboxSelected(false);
63         }
64     }
65     
66 }
67
Popular Tags