This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

View | Details | Raw Unified | Return to bug 200258
Collapse All | Expand All

(-)a/j2ee.common/nbproject/project.xml (-2 / +3 lines)
Lines 475-481 Link Here
475
            </test-dependencies>
475
            </test-dependencies>
476
            <friend-packages>
476
            <friend-packages>
477
                <friend>org.netbeans.modules.glassfish.eecommon</friend>
477
                <friend>org.netbeans.modules.glassfish.eecommon</friend>
478
                <friend>org.netbeans.modules.javaee.beanvalidation</friend>
479
                <friend>org.netbeans.modules.j2ee.archive</friend>
478
                <friend>org.netbeans.modules.j2ee.archive</friend>
480
                <friend>org.netbeans.modules.j2ee.clientproject</friend>
479
                <friend>org.netbeans.modules.j2ee.clientproject</friend>
481
                <friend>org.netbeans.modules.j2ee.ddloaders</friend>
480
                <friend>org.netbeans.modules.j2ee.ddloaders</friend>
Lines 487-492 Link Here
487
                <friend>org.netbeans.modules.j2ee.jboss4</friend>
486
                <friend>org.netbeans.modules.j2ee.jboss4</friend>
488
                <friend>org.netbeans.modules.j2ee.sun.appsrv81</friend>
487
                <friend>org.netbeans.modules.j2ee.sun.appsrv81</friend>
489
                <friend>org.netbeans.modules.j2ee.weblogic9</friend>
488
                <friend>org.netbeans.modules.j2ee.weblogic9</friend>
489
                <friend>org.netbeans.modules.javaee.beanvalidation</friend>
490
                <friend>org.netbeans.modules.maven.j2ee</friend>
490
                <friend>org.netbeans.modules.maven.j2ee</friend>
491
                <friend>org.netbeans.modules.maven.jaxws</friend>
491
                <friend>org.netbeans.modules.maven.jaxws</friend>
492
                <friend>org.netbeans.modules.mobility.end2end</friend>
492
                <friend>org.netbeans.modules.mobility.end2end</friend>
Lines 498-509 Link Here
498
                <friend>org.netbeans.modules.web.core</friend>
498
                <friend>org.netbeans.modules.web.core</friend>
499
                <friend>org.netbeans.modules.web.freeform</friend>
499
                <friend>org.netbeans.modules.web.freeform</friend>
500
                <friend>org.netbeans.modules.web.jsf</friend>
500
                <friend>org.netbeans.modules.web.jsf</friend>
501
                <friend>org.netbeans.modules.web.jsf.richfaces</friend>
501
                <friend>org.netbeans.modules.web.project</friend>
502
                <friend>org.netbeans.modules.web.project</friend>
502
                <friend>org.netbeans.modules.web.struts</friend>
503
                <friend>org.netbeans.modules.web.struts</friend>
503
                <friend>org.netbeans.modules.websvc.core</friend>
504
                <friend>org.netbeans.modules.websvc.core</friend>
504
                <friend>org.netbeans.modules.websvc.jaxrpc</friend>
505
                <friend>org.netbeans.modules.websvc.jaxrpc</friend>
506
                <friend>org.netbeans.modules.websvc.manager</friend>
505
                <friend>org.netbeans.modules.websvc.restapi</friend>
507
                <friend>org.netbeans.modules.websvc.restapi</friend>
506
                <friend>org.netbeans.modules.websvc.manager</friend>
507
                <friend>org.netbeans.modules.websvc.wsitconf</friend>
508
                <friend>org.netbeans.modules.websvc.wsitconf</friend>
508
                <package>org.netbeans.modules.j2ee.common</package>
509
                <package>org.netbeans.modules.j2ee.common</package>
509
                <package>org.netbeans.modules.j2ee.common.dd</package>
510
                <package>org.netbeans.modules.j2ee.common.dd</package>
(-)b39c30857a82 (+5 lines)
Added Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
2
<project basedir="." default="netbeans" name="web.jsf.richfaces">
3
    <description>Builds, tests, and runs the project org.netbeans.modules.web.jsf.richfaces</description>
4
    <import file="../nbbuild/templates/projectized.xml"/>
5
</project>
(-)b39c30857a82 (+6 lines)
Added Link Here
1
Manifest-Version: 1.0
2
OpenIDE-Module: org.netbeans.modules.web.jsf.richfaces
3
OpenIDE-Module-Layer: org/netbeans/modules/web/jsf/richfaces/resources/layer.xml
4
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/web/jsf/richfaces/Bundle.properties
5
OpenIDE-Module-Specification-Version: 1.0
6
(-)b39c30857a82 (+3 lines)
Added Link Here
1
javac.source=1.6
2
javac.compilerargs=-Xlint -Xlint:-serial
3
nbm.module.author=Martin Fousek <marfous@netbeans.org>
(-)b39c30857a82 (+90 lines)
Added Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
2
<project xmlns="http://www.netbeans.org/ns/project/1">
3
    <type>org.netbeans.modules.apisupport.project</type>
4
    <configuration>
5
        <data xmlns="http://www.netbeans.org/ns/nb-module-project/3">
6
            <code-name-base>org.netbeans.modules.web.jsf.richfaces</code-name-base>
7
            <module-dependencies>
8
                <dependency>
9
                    <code-name-base>org.netbeans.api.java.classpath</code-name-base>
10
                    <build-prerequisite/>
11
                    <compile-dependency/>
12
                    <run-dependency>
13
                        <release-version>1</release-version>
14
                        <specification-version>1.30</specification-version>
15
                    </run-dependency>
16
                </dependency>
17
                <dependency>
18
                    <code-name-base>org.netbeans.api.web.webmodule</code-name-base>
19
                    <build-prerequisite/>
20
                    <compile-dependency/>
21
                    <run-dependency>
22
                        <specification-version>1.24</specification-version>
23
                    </run-dependency>
24
                </dependency>
25
                <dependency>
26
                    <code-name-base>org.netbeans.modules.j2ee.common</code-name-base>
27
                    <build-prerequisite/>
28
                    <compile-dependency/>
29
                    <run-dependency>
30
                        <release-version>1</release-version>
31
                        <specification-version>1.65</specification-version>
32
                    </run-dependency>
33
                </dependency>
34
                <dependency>
35
                    <code-name-base>org.netbeans.modules.j2ee.dd</code-name-base>
36
                    <build-prerequisite/>
37
                    <compile-dependency/>
38
                    <run-dependency>
39
                        <release-version>1</release-version>
40
                        <specification-version>1.22</specification-version>
41
                    </run-dependency>
42
                </dependency>
43
                <dependency>
44
                    <code-name-base>org.netbeans.modules.java.project</code-name-base>
45
                    <build-prerequisite/>
46
                    <compile-dependency/>
47
                    <run-dependency>
48
                        <release-version>1</release-version>
49
                        <specification-version>1.39</specification-version>
50
                    </run-dependency>
51
                </dependency>
52
                <dependency>
53
                    <code-name-base>org.netbeans.modules.project.libraries</code-name-base>
54
                    <build-prerequisite/>
55
                    <compile-dependency/>
56
                    <run-dependency>
57
                        <release-version>1</release-version>
58
                        <specification-version>1.30</specification-version>
59
                    </run-dependency>
60
                </dependency>
61
                <dependency>
62
                    <code-name-base>org.netbeans.modules.web.jsfapi</code-name-base>
63
                    <build-prerequisite/>
64
                    <compile-dependency/>
65
                    <run-dependency>
66
                        <release-version>1</release-version>
67
                        <specification-version>1.7</specification-version>
68
                    </run-dependency>
69
                </dependency>
70
                <dependency>
71
                    <code-name-base>org.openide.filesystems</code-name-base>
72
                    <build-prerequisite/>
73
                    <compile-dependency/>
74
                    <run-dependency>
75
                        <specification-version>7.48</specification-version>
76
                    </run-dependency>
77
                </dependency>
78
                <dependency>
79
                    <code-name-base>org.openide.util</code-name-base>
80
                    <build-prerequisite/>
81
                    <compile-dependency/>
82
                    <run-dependency>
83
                        <specification-version>8.16</specification-version>
84
                    </run-dependency>
85
                </dependency>
86
            </module-dependencies>
87
            <public-packages/>
88
        </data>
89
    </configuration>
90
</project>
(-)b39c30857a82 (+52 lines)
Added Link Here
1
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
2
#
3
# Copyright 2011 Oracle and/or its affiliates. All rights reserved.
4
#
5
# Oracle and Java are registered trademarks of Oracle and/or its affiliates.
6
# Other names may be trademarks of their respective owners.
7
#
8
# The contents of this file are subject to the terms of either the GNU
9
# General Public License Version 2 only ("GPL") or the Common
10
# Development and Distribution License("CDDL") (collectively, the
11
# "License"). You may not use this file except in compliance with the
12
# License. You can obtain a copy of the License at
13
# http://www.netbeans.org/cddl-gplv2.html
14
# or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
15
# specific language governing permissions and limitations under the
16
# License.  When distributing the software, include this License Header
17
# Notice in each file and include the License file at
18
# nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
19
# particular file as subject to the "Classpath" exception as provided
20
# by Oracle in the GPL Version 2 section of the License file that
21
# accompanied this code. If applicable, add the following below the
22
# License Header, with the fields enclosed by brackets [] replaced by
23
# your own identifying information:
24
# "Portions Copyrighted [year] [name of copyright owner]"
25
#
26
# If you wish your version of this file to be governed by only the CDDL
27
# or only the GPL Version 2, indicate your decision by adding
28
# "[Contributor] elects to include this software in this distribution
29
# under the [CDDL or GPL Version 2] license." If you do not indicate a
30
# single choice of license, a recipient has the option to distribute
31
# your version of this file under either the CDDL, the GPL Version 2 or
32
# to extend the choice of license to its licensees as provided above.
33
# However, if you add GPL Version 2 code and therefore, elected the GPL
34
# Version 2 license, then the option applies only if the new code is
35
# made subject to such option by the copyright holder.
36
#
37
# Contributor(s):
38
#
39
# Portions Copyrighted 2011 Sun Microsystems, Inc.
40
 
41
OpenIDE-Module-Name=RichFaces
42
OpenIDE-Module-Display-Category=Java Web and EE
43
OpenIDE-Module-Short-Description=RichFaces is an open source component suite for development with JavaServer Faces framework.
44
OpenIDE-Module-Long-Description=\
45
    RichFaces is an open source component suite for development with JavaServer Faces web framework. \
46
    It has extended multiple areas of JSF, including usability, performance tuning, dynamic resources, skinning, and component development.
47
48
LBL_RichFaces4=RichFaces 4.0.0
49
LBL_RichFaces4_Description=\
50
    RichFaces is an open source component suite for JavaServer Faces 2. It has extended multiple areas of \
51
    JSF, including usability, performance tuning, dynamic resources, skinning, and component development.
52
(-)b39c30857a82 (+213 lines)
Added Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 2011 Oracle and/or its affiliates. All rights reserved.
5
 *
6
 * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
7
 * Other names may be trademarks of their respective owners.
8
 *
9
 * The contents of this file are subject to the terms of either the GNU
10
 * General Public License Version 2 only ("GPL") or the Common
11
 * Development and Distribution License("CDDL") (collectively, the
12
 * "License"). You may not use this file except in compliance with the
13
 * License. You can obtain a copy of the License at
14
 * http://www.netbeans.org/cddl-gplv2.html
15
 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
16
 * specific language governing permissions and limitations under the
17
 * License.  When distributing the software, include this License Header
18
 * Notice in each file and include the License file at
19
 * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
20
 * particular file as subject to the "Classpath" exception as provided
21
 * by Oracle in the GPL Version 2 section of the License file that
22
 * accompanied this code. If applicable, add the following below the
23
 * License Header, with the fields enclosed by brackets [] replaced by
24
 * your own identifying information:
25
 * "Portions Copyrighted [year] [name of copyright owner]"
26
 *
27
 * If you wish your version of this file to be governed by only the CDDL
28
 * or only the GPL Version 2, indicate your decision by adding
29
 * "[Contributor] elects to include this software in this distribution
30
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
31
 * single choice of license, a recipient has the option to distribute
32
 * your version of this file under either the CDDL, the GPL Version 2 or
33
 * to extend the choice of license to its licensees as provided above.
34
 * However, if you add GPL Version 2 code and therefore, elected the GPL
35
 * Version 2 license, then the option applies only if the new code is
36
 * made subject to such option by the copyright holder.
37
 *
38
 * Contributor(s):
39
 *
40
 * Portions Copyrighted 2011 Sun Microsystems, Inc.
41
 */
42
package org.netbeans.modules.web.jsf.richfaces;
43
44
import java.awt.Container;
45
import java.awt.Dialog;
46
import java.awt.event.WindowEvent;
47
import java.awt.event.WindowFocusListener;
48
import java.io.IOException;
49
import java.net.URL;
50
import java.util.ArrayList;
51
import java.util.HashMap;
52
import java.util.Iterator;
53
import java.util.List;
54
import java.util.Map.Entry;
55
import java.util.Set;
56
import java.util.logging.Level;
57
import java.util.logging.Logger;
58
import java.util.prefs.Preferences;
59
import javax.swing.JComponent;
60
import javax.swing.event.AncestorEvent;
61
import javax.swing.event.AncestorListener;
62
import javax.swing.event.ChangeEvent;
63
import javax.swing.event.ChangeListener;
64
import org.netbeans.api.project.libraries.Library;
65
import org.netbeans.api.project.libraries.LibraryManager;
66
import org.netbeans.modules.j2ee.common.Util;
67
import org.netbeans.modules.web.jsf.richfaces.ui.Richfaces4CustomizerPanelVisual;
68
import org.netbeans.modules.web.jsfapi.spi.components.JsfComponentCustomizer;
69
import org.openide.util.ChangeSupport;
70
import org.openide.util.NbPreferences;
71
72
/**
73
 *
74
 * @author Martin Fousek <marfous@netbeans.org>
75
 */
76
public class Richfaces4Customizer implements JsfComponentCustomizer {
77
78
    Richfaces4CustomizerPanelVisual panel;
79
    private ChangeSupport changeSupport = new ChangeSupport(this);
80
    boolean initialize = false;
81
    
82
    public static final Logger LOGGER = Logger.getLogger(Richfaces4Customizer.class.getName());
83
84
    public Richfaces4Customizer() {
85
        initialize = true;
86
    }
87
    
88
    @Override
89
    public void addChangeListener(ChangeListener listener) {
90
        changeSupport.addChangeListener(listener);
91
    }
92
93
    @Override
94
    public void removeChangeListener(ChangeListener listener) {
95
        changeSupport.removeChangeListener(listener);
96
    }
97
    
98
    @Override
99
    public JComponent getComponent() {
100
        if (panel == null) {
101
            panel = new Richfaces4CustomizerPanelVisual(new ChangeListener() {
102
103
                @Override
104
                public void stateChanged(ChangeEvent e) {
105
                    changeSupport.fireChange();
106
                }
107
            });
108
            
109
            panel.addAncestorListener(new AncestorListener() {
110
111
                @Override
112
                public void ancestorAdded(AncestorEvent event) {
113
                    Container component = event.getAncestor();
114
                    if (component instanceof Dialog) {
115
                        Dialog ancestorDialog = (Dialog)component;
116
                        ancestorDialog.addWindowFocusListener(new WindowFocusListener() {
117
118
                            @Override
119
                            public void windowGainedFocus(WindowEvent e) {
120
                                panel.initLibraries(initialize);
121
                                initialize = false;
122
                                changeSupport.fireChange();
123
                            }
124
125
                            @Override
126
                            public void windowLostFocus(WindowEvent e) {
127
                            }
128
                        });
129
                    }
130
                }
131
132
                @Override
133
                public void ancestorRemoved(AncestorEvent event) {
134
                }
135
136
                @Override
137
                public void ancestorMoved(AncestorEvent event) {
138
                }
139
            });
140
        }
141
        return panel;
142
    }
143
144
    @Override
145
    public boolean isValid() {
146
        Preferences preferences = NbPreferences.forModule(Richfaces4Customizer.class).node(Richfaces4Implementation.PREF_RICHFACES_NODE);
147
        String richfacesLibrary = preferences.get(Richfaces4Implementation.PREF_RICHFACES_LIBRARY, "");
148
        if (LibraryManager.getDefault().getLibrary(richfacesLibrary) != null) {
149
            return true;
150
        }
151
        
152
        for (Library library : LibraryManager.getDefault().getLibraries()) {
153
            if (!"j2se".equals(library.getType())) { // NOI18N
154
                continue;
155
            }
156
157
            List<URL> content = library.getContent("classpath"); //NOI18N
158
            if (isValidRichfacesLibrary(content)) {
159
                return true;
160
            } 
161
        }
162
        
163
        return false;
164
    }
165
166
    @Override
167
    public String getWarningMessage() {
168
        return panel.getWarningMessage();
169
    }
170
171
    @Override
172
    public String getErrorMessage() {
173
        return panel.getErrorMessage();
174
    }
175
176
    @Override
177
    public void saveConfiguration() {
178
        Preferences preferences = NbPreferences.forModule(Richfaces4Customizer.class).node(Richfaces4Implementation.PREF_RICHFACES_NODE);
179
        preferences.put(Richfaces4Implementation.PREF_RICHFACES_LIBRARY, panel.getRichFacesLibrary());
180
    }
181
182
    public static List<Library> getRichfacesLibraries() {
183
        List<Library> libraries = new ArrayList<Library>();
184
        List<URL> content; 
185
        for (Library library : LibraryManager.getDefault().getLibraries()) {
186
            if (!"j2se".equals(library.getType())) { // NOI18N
187
                continue;
188
            }
189
190
            content = library.getContent("classpath"); //NOI18N
191
            if (Richfaces4Customizer.isValidRichfacesLibrary(content)) {
192
                libraries.add(library);
193
            } 
194
        }
195
        return libraries;
196
    }
197
        
198
    public static boolean isValidRichfacesLibrary(List<URL> libraryContent) {
199
        Set<Entry<String, String>> entrySet = Richfaces4Implementation.RF_LIBRARIES.entrySet();
200
        for (Entry<String, String> entry : entrySet) {
201
            try {
202
                if (!Util.containsClass(libraryContent, entry.getKey())) {
203
                    return false;
204
                }
205
            } catch (IOException ex) {
206
                LOGGER.log(Level.INFO, null, ex);
207
                return false;
208
            }
209
        }
210
        return true;
211
    }
212
    
213
}
(-)b39c30857a82 (+167 lines)
Added Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 2011 Oracle and/or its affiliates. All rights reserved.
5
 *
6
 * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
7
 * Other names may be trademarks of their respective owners.
8
 *
9
 * The contents of this file are subject to the terms of either the GNU
10
 * General Public License Version 2 only ("GPL") or the Common
11
 * Development and Distribution License("CDDL") (collectively, the
12
 * "License"). You may not use this file except in compliance with the
13
 * License. You can obtain a copy of the License at
14
 * http://www.netbeans.org/cddl-gplv2.html
15
 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
16
 * specific language governing permissions and limitations under the
17
 * License.  When distributing the software, include this License Header
18
 * Notice in each file and include the License file at
19
 * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
20
 * particular file as subject to the "Classpath" exception as provided
21
 * by Oracle in the GPL Version 2 section of the License file that
22
 * accompanied this code. If applicable, add the following below the
23
 * License Header, with the fields enclosed by brackets [] replaced by
24
 * your own identifying information:
25
 * "Portions Copyrighted [year] [name of copyright owner]"
26
 *
27
 * If you wish your version of this file to be governed by only the CDDL
28
 * or only the GPL Version 2, indicate your decision by adding
29
 * "[Contributor] elects to include this software in this distribution
30
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
31
 * single choice of license, a recipient has the option to distribute
32
 * your version of this file under either the CDDL, the GPL Version 2 or
33
 * to extend the choice of license to its licensees as provided above.
34
 * However, if you add GPL Version 2 code and therefore, elected the GPL
35
 * Version 2 license, then the option applies only if the new code is
36
 * made subject to such option by the copyright holder.
37
 *
38
 * Contributor(s):
39
 *
40
 * Portions Copyrighted 2011 Sun Microsystems, Inc.
41
 */
42
package org.netbeans.modules.web.jsf.richfaces;
43
44
import java.io.IOException;
45
import java.util.ArrayList;
46
import java.util.Collections;
47
import java.util.HashMap;
48
import java.util.List;
49
import java.util.Map;
50
import java.util.Map.Entry;
51
import java.util.Set;
52
import java.util.logging.Level;
53
import java.util.logging.Logger;
54
import java.util.prefs.Preferences;
55
import org.netbeans.api.java.classpath.ClassPath;
56
import org.netbeans.api.java.project.classpath.ProjectClassPathModifier;
57
import org.netbeans.api.project.libraries.Library;
58
import org.netbeans.api.project.libraries.LibraryManager;
59
import org.netbeans.modules.web.api.webmodule.WebModule;
60
import org.netbeans.modules.web.jsfapi.api.JSFVersion;
61
import org.netbeans.modules.web.jsfapi.spi.components.JsfComponentImplementation;
62
import org.netbeans.modules.web.jsfapi.spi.components.JsfComponentCustomizer;
63
import org.openide.filesystems.FileObject;
64
import org.openide.util.NbBundle;
65
import org.openide.util.NbPreferences;
66
67
/**
68
 *
69
 * @author Martin Fousek <marfous@netbeans.org>
70
 */
71
public class Richfaces4Implementation implements JsfComponentImplementation {
72
    
73
    private final String name;
74
    private final String description;    
75
    
76
    private static Richfaces4Customizer customizer;
77
    
78
    public static final String LIBRARY_NAME = "Richfaces 4.0.0"; //NOI18N
79
    public static final Logger LOGGER = Logger.getLogger(Richfaces4Implementation.class.getName()); 
80
    
81
    public static final Map<String, String> RF_LIBRARIES = new HashMap<String, String>();
82
    public static final Map<String, String> RF_DEPENDENCIES = new HashMap<String, String>();
83
    
84
    public static final String PREF_RICHFACES_NODE = "richfaces4"; //NOI18N
85
    public static final String PREF_RICHFACES_LIBRARY = "base-library"; //NOI18N
86
    
87
    
88
    public Richfaces4Implementation() {
89
        this.name = NbBundle.getMessage(Richfaces4Implementation.class, "LBL_RichFaces4"); //NOI18N
90
        this.description = NbBundle.getMessage(Richfaces4Implementation.class, "LBL_RichFaces4_Description");  //NOI18N
91
     
92
        if (RF_LIBRARIES.isEmpty()) {
93
            RF_LIBRARIES.put("org.richfaces.application.Module", "richfaces-core-api-4.0.0.Final.jar"); //NOI18N
94
            RF_LIBRARIES.put("org.richfaces.application.ServiceLoader", "richfaces-core-impl-4.0.0.Final.jar"); //NOI18N
95
            RF_LIBRARIES.put("org.richfaces.el.ValueDescriptor", "richfaces-components-api-4.0.0.Final.jar"); //NOI18N
96
            RF_LIBRARIES.put("org.richfaces.el.ValueReference", "richfaces-components-ui-4.0.0.Final.jar"); //NOI18N
97
        }
98
        if (RF_DEPENDENCIES.isEmpty()) {
99
            RF_DEPENDENCIES.put("com.google.common.base.Functions", "guava.jar"); //NOI18N
100
            RF_DEPENDENCIES.put("org.w3c.css.sac.Parser", "sac.jar"); //NOI18N
101
            RF_DEPENDENCIES.put("com.steadystate.css.parser.ParseException", "cssparser.jar"); //NOI18N
102
        }
103
    }
104
105
    @Override
106
    public String getName() {
107
        return name;
108
    }
109
110
    @Override
111
    public String getDescription() {
112
        return description;
113
    }
114
115
    @Override
116
    public void remove(WebModule wm) {
117
    }    
118
    
119
    @Override
120
    public Set<org.openide.filesystems.FileObject> extend(org.netbeans.modules.web.api.webmodule.WebModule webModule) {
121
        FileObject[] javaSources =  webModule.getJavaSources();
122
        try {
123
            List<Library> libraries = new ArrayList<Library>(1);
124
            Preferences preferences = NbPreferences.forModule(Richfaces4Implementation.class).node(Richfaces4Implementation.PREF_RICHFACES_NODE);
125
            
126
            Library rfLibrary = LibraryManager.getDefault().getLibrary(preferences.get(Richfaces4Implementation.PREF_RICHFACES_LIBRARY, ""));
127
            if (rfLibrary == null) {
128
                rfLibrary = Richfaces4Customizer.getRichfacesLibraries().get(0);
129
            }
130
131
            libraries.add(rfLibrary);
132
            ProjectClassPathModifier.addLibraries(libraries.toArray(new Library[1]), javaSources[0], ClassPath.COMPILE);
133
        } catch (IOException ex) {
134
            LOGGER.log(Level.WARNING, "Exception during extending an web project", ex); //NOI18N
135
        } catch (UnsupportedOperationException ex) {
136
            LOGGER.log(Level.WARNING, "Exception during extending an web project", ex); //NOI18N
137
        }
138
        
139
        return Collections.<FileObject>emptySet();
140
    }
141
142
    @Override
143
    public JSFVersion getJsfVersion() {
144
        return JSFVersion.JSF_2_0;
145
    }
146
147
    @Override
148
    public boolean isInWebModule(org.netbeans.modules.web.api.webmodule.WebModule webModule) {
149
        ClassPath classpath = ClassPath.getClassPath(webModule.getDocumentBase(), ClassPath.COMPILE);
150
        Set<Entry<String, String>> entrySet = RF_LIBRARIES.entrySet();
151
        for (Entry<String, String> entry : entrySet) {
152
            if (classpath.findResource(entry.getKey().replace('.', '/') + ".class") == null) { //NOI18N
153
                return false;
154
            } 
155
        }
156
        return true;
157
    }
158
    
159
    @Override
160
    public JsfComponentCustomizer getJsfComponentCustomizer(boolean initialize, WebModule webModule) {
161
        if (customizer == null || initialize) {
162
            customizer = new Richfaces4Customizer();
163
        } 
164
        return customizer;
165
    }
166
    
167
}
(-)b39c30857a82 (+61 lines)
Added Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 2011 Oracle and/or its affiliates. All rights reserved.
5
 *
6
 * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
7
 * Other names may be trademarks of their respective owners.
8
 *
9
 * The contents of this file are subject to the terms of either the GNU
10
 * General Public License Version 2 only ("GPL") or the Common
11
 * Development and Distribution License("CDDL") (collectively, the
12
 * "License"). You may not use this file except in compliance with the
13
 * License. You can obtain a copy of the License at
14
 * http://www.netbeans.org/cddl-gplv2.html
15
 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
16
 * specific language governing permissions and limitations under the
17
 * License.  When distributing the software, include this License Header
18
 * Notice in each file and include the License file at
19
 * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
20
 * particular file as subject to the "Classpath" exception as provided
21
 * by Oracle in the GPL Version 2 section of the License file that
22
 * accompanied this code. If applicable, add the following below the
23
 * License Header, with the fields enclosed by brackets [] replaced by
24
 * your own identifying information:
25
 * "Portions Copyrighted [year] [name of copyright owner]"
26
 *
27
 * If you wish your version of this file to be governed by only the CDDL
28
 * or only the GPL Version 2, indicate your decision by adding
29
 * "[Contributor] elects to include this software in this distribution
30
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
31
 * single choice of license, a recipient has the option to distribute
32
 * your version of this file under either the CDDL, the GPL Version 2 or
33
 * to extend the choice of license to its licensees as provided above.
34
 * However, if you add GPL Version 2 code and therefore, elected the GPL
35
 * Version 2 license, then the option applies only if the new code is
36
 * made subject to such option by the copyright holder.
37
 *
38
 * Contributor(s):
39
 *
40
 * Portions Copyrighted 2011 Sun Microsystems, Inc.
41
 */
42
package org.netbeans.modules.web.jsf.richfaces;
43
44
import java.util.Collections;
45
import java.util.Set;
46
import org.netbeans.modules.web.jsfapi.spi.components.JsfComponentImplementation;
47
import org.netbeans.modules.web.jsfapi.spi.components.JsfComponentProvider;
48
49
/**
50
 * 
51
 * @author Martin Fousek <marfous@netbeans.org>
52
 */
53
public class RichfacesProvider implements JsfComponentProvider {
54
55
    @Override
56
    public Set<JsfComponentImplementation> getJsfComponents() {
57
        JsfComponentImplementation implementation = new Richfaces4Implementation();
58
        return Collections.singleton(implementation);
59
    }
60
    
61
}
(-)b39c30857a82 (+11 lines)
Added Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
2
<!DOCTYPE filesystem PUBLIC "-//NetBeans//DTD Filesystem 1.2//EN" "http://www.netbeans.org/dtds/filesystem-1_2.dtd">
3
<filesystem>
4
    <folder name="j2ee">
5
        <folder name="jsf">
6
            <folder name="components">
7
                <file name="org-netbeans-modules-web-jsf-richfaces-RichfacesProvider.instance"/>
8
            </folder>
9
        </folder>
10
    </folder>
11
</filesystem>
(-)b39c30857a82 (+6 lines)
Added Link Here
1
LBL_MissingRichFaces=No complete RichFaces library found. See list of mandatory JARs.
2
LBL_MissingDependency=It''s recommended to include into library also {0}.
3
4
Richfaces4CustomizerPanelVisual.newLibraryButton.text=Create Library
5
Richfaces4CustomizerPanelVisual.richfacesInfoLabel.text=<html>\n<b>RichFaces library has to contain:</b><ul><li>richfaces-components-api-4.0.0.Final.jar</li><li>richfaces-components-ui-4.0.0.Final.jar</li><li>richfaces-core-api-4.0.0.Final.jar</li><li>richfaces-core-impl-4.0.0.Final.jar</li></ul>\n<b>RichFaces library should contain:</b><ul><li>guava.jar (Google Guava)</li><li>sac.jar (Simple API for CSS)</li><li>cssparser.jar (CSS Parser)</li>\n</ul>\n</html>
6
Richfaces4CustomizerPanelVisual.richfacesLibraryLabel.text=Valid RichFaces Library:
(-)b39c30857a82 (+89 lines)
Added Link Here
1
<?xml version="1.1" encoding="UTF-8" ?>
2
3
<Form version="1.5" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
4
  <AuxValues>
5
    <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="1"/>
6
    <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
7
    <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
8
    <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
9
    <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="true"/>
10
    <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
11
    <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
12
    <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
13
    <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
14
  </AuxValues>
15
16
  <Layout>
17
    <DimensionLayout dim="0">
18
      <Group type="103" groupAlignment="0" attributes="0">
19
          <Group type="102" attributes="0">
20
              <EmptySpace max="-2" attributes="0"/>
21
              <Group type="103" groupAlignment="0" attributes="0">
22
                  <Group type="102" alignment="0" attributes="0">
23
                      <Component id="richfacesLibraryLabel" min="-2" max="-2" attributes="0"/>
24
                      <EmptySpace min="-2" pref="11" max="-2" attributes="0"/>
25
                      <Component id="richfacesComboBox" pref="395" max="32767" attributes="0"/>
26
                  </Group>
27
                  <Component id="newLibraryButton" alignment="1" min="-2" max="-2" attributes="0"/>
28
                  <Component id="richfacesInfoLabel" alignment="0" pref="552" max="32767" attributes="0"/>
29
              </Group>
30
              <EmptySpace max="-2" attributes="0"/>
31
          </Group>
32
      </Group>
33
    </DimensionLayout>
34
    <DimensionLayout dim="1">
35
      <Group type="103" groupAlignment="0" attributes="0">
36
          <Group type="102" alignment="0" attributes="0">
37
              <EmptySpace max="-2" attributes="0"/>
38
              <Group type="103" groupAlignment="3" attributes="0">
39
                  <Component id="richfacesLibraryLabel" alignment="3" min="-2" max="-2" attributes="0"/>
40
                  <Component id="richfacesComboBox" alignment="3" min="-2" max="-2" attributes="0"/>
41
              </Group>
42
              <EmptySpace max="-2" attributes="0"/>
43
              <Component id="newLibraryButton" min="-2" max="-2" attributes="0"/>
44
              <EmptySpace max="-2" attributes="0"/>
45
              <Component id="richfacesInfoLabel" pref="175" max="32767" attributes="0"/>
46
              <EmptySpace max="-2" attributes="0"/>
47
          </Group>
48
      </Group>
49
    </DimensionLayout>
50
  </Layout>
51
  <SubComponents>
52
    <Component class="javax.swing.JLabel" name="richfacesLibraryLabel">
53
      <Properties>
54
        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
55
          <ResourceString bundle="org/netbeans/modules/web/jsf/richfaces/ui/Bundle.properties" key="Richfaces4CustomizerPanelVisual.richfacesLibraryLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
56
        </Property>
57
      </Properties>
58
    </Component>
59
    <Component class="javax.swing.JComboBox" name="richfacesComboBox">
60
      <Properties>
61
        <Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
62
          <StringArray count="1">
63
            <StringItem index="0" value="Search RichFaces Libraries..."/>
64
          </StringArray>
65
        </Property>
66
      </Properties>
67
    </Component>
68
    <Component class="javax.swing.JButton" name="newLibraryButton">
69
      <Properties>
70
        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
71
          <ResourceString bundle="org/netbeans/modules/web/jsf/richfaces/ui/Bundle.properties" key="Richfaces4CustomizerPanelVisual.newLibraryButton.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
72
        </Property>
73
      </Properties>
74
      <Events>
75
        <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="newLibraryButtonActionPerformed"/>
76
      </Events>
77
    </Component>
78
    <Component class="javax.swing.JLabel" name="richfacesInfoLabel">
79
      <Properties>
80
        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
81
          <ResourceString bundle="org/netbeans/modules/web/jsf/richfaces/ui/Bundle.properties" key="Richfaces4CustomizerPanelVisual.richfacesInfoLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
82
        </Property>
83
        <Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
84
          <Dimension value="[100, 15]"/>
85
        </Property>
86
      </Properties>
87
    </Component>
88
  </SubComponents>
89
</Form>
(-)b39c30857a82 (+266 lines)
Added Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 2011 Oracle and/or its affiliates. All rights reserved.
5
 *
6
 * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
7
 * Other names may be trademarks of their respective owners.
8
 *
9
 * The contents of this file are subject to the terms of either the GNU
10
 * General Public License Version 2 only ("GPL") or the Common
11
 * Development and Distribution License("CDDL") (collectively, the
12
 * "License"). You may not use this file except in compliance with the
13
 * License. You can obtain a copy of the License at
14
 * http://www.netbeans.org/cddl-gplv2.html
15
 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
16
 * specific language governing permissions and limitations under the
17
 * License.  When distributing the software, include this License Header
18
 * Notice in each file and include the License file at
19
 * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
20
 * particular file as subject to the "Classpath" exception as provided
21
 * by Oracle in the GPL Version 2 section of the License file that
22
 * accompanied this code. If applicable, add the following below the
23
 * License Header, with the fields enclosed by brackets [] replaced by
24
 * your own identifying information:
25
 * "Portions Copyrighted [year] [name of copyright owner]"
26
 *
27
 * If you wish your version of this file to be governed by only the CDDL
28
 * or only the GPL Version 2, indicate your decision by adding
29
 * "[Contributor] elects to include this software in this distribution
30
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
31
 * single choice of license, a recipient has the option to distribute
32
 * your version of this file under either the CDDL, the GPL Version 2 or
33
 * to extend the choice of license to its licensees as provided above.
34
 * However, if you add GPL Version 2 code and therefore, elected the GPL
35
 * Version 2 license, then the option applies only if the new code is
36
 * made subject to such option by the copyright holder.
37
 *
38
 * Contributor(s):
39
 *
40
 * Portions Copyrighted 2011 Sun Microsystems, Inc.
41
 */
42
43
/*
44
 * Richfaces4CustomizerPanelVisual.java
45
 *
46
 * Created on Jun 22, 2011, 1:25:30 PM
47
 */
48
package org.netbeans.modules.web.jsf.richfaces.ui;
49
50
import java.awt.event.ActionEvent;
51
import java.awt.event.ActionListener;
52
import java.io.IOException;
53
import java.net.URL;
54
import java.util.HashSet;
55
import java.util.List;
56
import java.util.Map.Entry;
57
import java.util.Set;
58
import java.util.Vector;
59
import java.util.logging.Level;
60
import java.util.logging.Logger;
61
import java.util.prefs.Preferences;
62
import javax.swing.DefaultComboBoxModel;
63
import javax.swing.JComboBox;
64
import javax.swing.SwingUtilities;
65
import javax.swing.event.ChangeListener;
66
import org.netbeans.api.project.libraries.LibrariesCustomizer;
67
import org.netbeans.api.project.libraries.Library;
68
import org.netbeans.api.project.libraries.LibraryManager;
69
import org.netbeans.modules.j2ee.common.Util;
70
import org.netbeans.modules.web.jsf.richfaces.Richfaces4Implementation;
71
import org.netbeans.modules.web.jsf.richfaces.Richfaces4Customizer;
72
import org.openide.util.ChangeSupport;
73
import org.openide.util.NbBundle;
74
import org.openide.util.NbPreferences;
75
import org.openide.util.RequestProcessor;
76
77
/**
78
 *
79
 * @author Martin Fousek <marfous@netbeans.org>
80
 */
81
public final class Richfaces4CustomizerPanelVisual extends javax.swing.JPanel {
82
83
    public static final RequestProcessor RP = new RequestProcessor("JSF Component Libraries Updater", 1);
84
    public static final Logger LOGGER = Logger.getLogger(Richfaces4CustomizerPanelVisual.class.getName());
85
    
86
    private volatile Set<Library> richfacesLibraries = new HashSet<Library>();
87
    
88
    private ChangeSupport changeSupport = new ChangeSupport(this);
89
90
    /** Creates new form Richfaces4CustomizerPanelVisual */
91
    public Richfaces4CustomizerPanelVisual(ChangeListener listener) {
92
        initComponents();
93
        addChangeListener(listener);
94
        
95
        initLibraries(true);
96
97
        richfacesComboBox.addActionListener(new ActionListener() {
98
99
            @Override
100
            public void actionPerformed(ActionEvent e) {
101
                changeSupport.fireChange();
102
            }
103
        });
104
    }
105
106
    public void addChangeListener(ChangeListener listener) {
107
        changeSupport.addChangeListener(listener);
108
    }
109
110
    public void removeChangeListener(ChangeListener listener) {
111
        changeSupport.removeChangeListener(listener);
112
    }    
113
    
114
    public void initLibraries(final boolean firstInit) {
115
        long time = System.currentTimeMillis();
116
117
        final Vector<String> registeredRichfaces = new Vector<String>();
118
        
119
        RequestProcessor.getDefault().post(new Runnable() {
120
121
            @Override
122
            public void run() {
123
                for (Library library : Richfaces4Customizer.getRichfacesLibraries()) {
124
                    registeredRichfaces.add(library.getDisplayName());
125
                    richfacesLibraries.add(library);
126
                }
127
                
128
                SwingUtilities.invokeLater(new Runnable() {
129
130
                    @Override
131
                    public void run() {
132
                        setLibrariesComboBox(richfacesComboBox, registeredRichfaces);
133
                        
134
                        if (firstInit) {
135
                            setDefaultComboBoxValues();
136
                        }
137
                        changeSupport.fireChange();
138
                    }
139
                });
140
            }
141
        });
142
143
        LOGGER.log(Level.FINEST, "Time spent in {0} initLibraries = {1} ms", new Object[]{this.getClass().getName(), System.currentTimeMillis() - time});   //NOI18N
144
    }
145
146
    private void setDefaultComboBoxValues() {
147
        Preferences preferences = NbPreferences.forModule(Richfaces4Customizer.class).node(Richfaces4Implementation.PREF_RICHFACES_NODE);
148
        richfacesComboBox.setSelectedItem(preferences.get(Richfaces4Implementation.PREF_RICHFACES_LIBRARY, ""));
149
    }
150
    
151
    private void setLibrariesComboBox(JComboBox comboBox, Vector<String> items) {
152
        comboBox.setModel(new DefaultComboBoxModel(items));
153
        comboBox.setEnabled(!items.isEmpty());
154
    }
155
    
156
    public String getErrorMessage() {
157
        if (richfacesLibraries == null || richfacesLibraries.isEmpty()) {
158
            return NbBundle.getMessage(Richfaces4CustomizerPanelVisual.class, "LBL_MissingRichFaces"); //NOI18N
159
        }
160
        return null;
161
    }
162
    
163
    public String getWarningMessage() {
164
        if (richfacesLibraries == null || !richfacesLibraries.isEmpty()) {
165
            Library library = LibraryManager.getDefault().getLibrary(getRichFacesLibrary());
166
            if (library == null) {
167
                return null;
168
            }
169
            
170
            List<URL> content = library.getContent("classpath"); //NOI18N
171
            StringBuilder recommendedJars = new StringBuilder();
172
            if (library != null) {
173
                Set<Entry<String, String>> entrySet = Richfaces4Implementation.RF_DEPENDENCIES.entrySet();
174
                for (Entry<String, String> entry : entrySet) {
175
                    try {
176
                        if (!Util.containsClass(content, entry.getKey())) {
177
                            recommendedJars.append(entry.getValue()).append(", ");
178
                        }
179
                    } catch (IOException ex) {
180
                        LOGGER.log(Level.INFO, null, ex);
181
                    }
182
                }
183
                if (!"".equals(recommendedJars.toString())) {
184
                    return NbBundle.getMessage(Richfaces4CustomizerPanelVisual.class, 
185
                            "LBL_MissingDependency", recommendedJars .toString().substring(0, 
186
                            recommendedJars .toString().length() - 2)); //NOI18N
187
                }
188
            }
189
        }
190
        return null;
191
    }
192
    
193
    public String getRichFacesLibrary() {
194
        return (String)richfacesComboBox.getSelectedItem();
195
    }
196
    
197
    /** This method is called from within the constructor to
198
     * initialize the form.
199
     * WARNING: Do NOT modify this code. The content of this method is
200
     * always regenerated by the Form Editor.
201
     */
202
    @SuppressWarnings("unchecked")
203
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
204
    private void initComponents() {
205
206
        richfacesLibraryLabel = new javax.swing.JLabel();
207
        richfacesComboBox = new javax.swing.JComboBox();
208
        newLibraryButton = new javax.swing.JButton();
209
        richfacesInfoLabel = new javax.swing.JLabel();
210
211
        richfacesLibraryLabel.setText(org.openide.util.NbBundle.getMessage(Richfaces4CustomizerPanelVisual.class, "Richfaces4CustomizerPanelVisual.richfacesLibraryLabel.text")); // NOI18N
212
213
        richfacesComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Search RichFaces Libraries..." }));
214
215
        newLibraryButton.setText(org.openide.util.NbBundle.getMessage(Richfaces4CustomizerPanelVisual.class, "Richfaces4CustomizerPanelVisual.newLibraryButton.text")); // NOI18N
216
        newLibraryButton.addActionListener(new java.awt.event.ActionListener() {
217
            public void actionPerformed(java.awt.event.ActionEvent evt) {
218
                newLibraryButtonActionPerformed(evt);
219
            }
220
        });
221
222
        richfacesInfoLabel.setText(org.openide.util.NbBundle.getMessage(Richfaces4CustomizerPanelVisual.class, "Richfaces4CustomizerPanelVisual.richfacesInfoLabel.text")); // NOI18N
223
        richfacesInfoLabel.setPreferredSize(new java.awt.Dimension(100, 15));
224
225
        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
226
        this.setLayout(layout);
227
        layout.setHorizontalGroup(
228
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
229
            .addGroup(layout.createSequentialGroup()
230
                .addContainerGap()
231
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
232
                    .addGroup(layout.createSequentialGroup()
233
                        .addComponent(richfacesLibraryLabel)
234
                        .addGap(11, 11, 11)
235
                        .addComponent(richfacesComboBox, 0, 395, Short.MAX_VALUE))
236
                    .addComponent(newLibraryButton, javax.swing.GroupLayout.Alignment.TRAILING)
237
                    .addComponent(richfacesInfoLabel, javax.swing.GroupLayout.DEFAULT_SIZE, 552, Short.MAX_VALUE))
238
                .addContainerGap())
239
        );
240
        layout.setVerticalGroup(
241
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
242
            .addGroup(layout.createSequentialGroup()
243
                .addContainerGap()
244
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
245
                    .addComponent(richfacesLibraryLabel)
246
                    .addComponent(richfacesComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
247
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
248
                .addComponent(newLibraryButton)
249
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
250
                .addComponent(richfacesInfoLabel, javax.swing.GroupLayout.DEFAULT_SIZE, 175, Short.MAX_VALUE)
251
                .addContainerGap())
252
        );
253
    }// </editor-fold>//GEN-END:initComponents
254
255
    private void newLibraryButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_newLibraryButtonActionPerformed
256
        LibrariesCustomizer.showCreateNewLibraryCustomizer(LibraryManager.getDefault());
257
    }//GEN-LAST:event_newLibraryButtonActionPerformed
258
259
    // Variables declaration - do not modify//GEN-BEGIN:variables
260
    private javax.swing.JButton newLibraryButton;
261
    private javax.swing.JComboBox richfacesComboBox;
262
    private javax.swing.JLabel richfacesInfoLabel;
263
    private javax.swing.JLabel richfacesLibraryLabel;
264
    // End of variables declaration//GEN-END:variables
265
266
}
(-)a/web.jsf/nbproject/project.xml (-1 / +1 lines)
Lines 389-395 Link Here
389
                    <compile-dependency/>
389
                    <compile-dependency/>
390
                    <run-dependency>
390
                    <run-dependency>
391
                        <release-version>1</release-version>
391
                        <release-version>1</release-version>
392
                        <specification-version>1.6</specification-version>
392
                        <specification-version>1.7</specification-version>
393
                    </run-dependency>
393
                    </run-dependency>
394
                </dependency>
394
                </dependency>
395
                <dependency>
395
                <dependency>
(-)a/web.jsf/src/org/netbeans/modules/web/jsf/JSFCatalog.java (-1 / +1 lines)
Lines 46-52 Link Here
46
package org.netbeans.modules.web.jsf;
46
package org.netbeans.modules.web.jsf;
47
47
48
48
49
import org.netbeans.modules.web.jsf.api.facesmodel.JSFVersion;
49
import org.netbeans.modules.web.jsfapi.api.JSFVersion;
50
import org.netbeans.modules.xml.catalog.spi.*;
50
import org.netbeans.modules.xml.catalog.spi.*;
51
import org.openide.util.ImageUtilities;
51
import org.openide.util.ImageUtilities;
52
import org.openide.util.NbBundle;
52
import org.openide.util.NbBundle;
(-)a/web.jsf/src/org/netbeans/modules/web/jsf/JSFFrameworkProvider.java (-35 / +29 lines)
Lines 95-105 Link Here
95
import org.netbeans.modules.web.spi.webmodule.WebFrameworkProvider;
95
import org.netbeans.modules.web.spi.webmodule.WebFrameworkProvider;
96
import org.netbeans.modules.web.api.webmodule.WebModule;
96
import org.netbeans.modules.web.api.webmodule.WebModule;
97
import org.netbeans.modules.web.jsf.api.facesmodel.Application;
97
import org.netbeans.modules.web.jsf.api.facesmodel.Application;
98
import org.netbeans.modules.web.jsf.api.facesmodel.DefaultRenderKitId;
99
import org.netbeans.modules.web.jsf.api.facesmodel.FacesConfig;
98
import org.netbeans.modules.web.jsf.api.facesmodel.FacesConfig;
100
import org.netbeans.modules.web.jsf.api.facesmodel.JSFConfigModel;
99
import org.netbeans.modules.web.jsf.api.facesmodel.JSFConfigModel;
101
import org.netbeans.modules.web.jsf.api.facesmodel.ViewHandler;
100
import org.netbeans.modules.web.jsf.api.facesmodel.ViewHandler;
102
import org.netbeans.modules.web.jsf.palette.JSFPaletteUtilities;
101
import org.netbeans.modules.web.jsf.palette.JSFPaletteUtilities;
102
import org.netbeans.modules.web.jsfapi.spi.components.JsfComponentImplementation;
103
import org.netbeans.modules.web.project.api.WebPropertyEvaluator;
103
import org.netbeans.modules.web.project.api.WebPropertyEvaluator;
104
import org.netbeans.modules.web.spi.webmodule.WebModuleExtender;
104
import org.netbeans.modules.web.spi.webmodule.WebModuleExtender;
105
import org.openide.DialogDisplayer;
105
import org.openide.DialogDisplayer;
Lines 214-223 Link Here
214
                }
214
                }
215
            }
215
            }
216
216
217
            if (panel.getJsfComponentDescriptor() != null ) {
218
                ProjectClassPathModifier.addLibraries(new Library[]{panel.getJsfComponentDescriptor().getLibrary()}, javaSources[0], ClassPath.COMPILE);
219
            }
220
221
            boolean isMyFaces;
217
            boolean isMyFaces;
222
            if (jsfLibrary != null) {
218
            if (jsfLibrary != null) {
223
                // find out whether the added library is myfaces jsf implementation
219
                // find out whether the added library is myfaces jsf implementation
Lines 256-262 Link Here
256
            }
252
            }
257
253
258
            FileSystem fileSystem = webInf.getFileSystem();
254
            FileSystem fileSystem = webInf.getFileSystem();
255
            
259
            fileSystem.runAtomicAction(new CreateFacesConfig(webModule, isMyFaces));
256
            fileSystem.runAtomicAction(new CreateFacesConfig(webModule, isMyFaces));
257
            
258
            // extending for JSF component libraries
259
            for (JsfComponentImplementation jsfComponentDescriptor : panel.getEnabledJsfDescriptors()) {
260
                result.addAll(jsfComponentDescriptor.extend(webModule));
261
            }
260
262
261
            FileObject welcomeFile = (panel!=null && panel.isEnableFacelets()) ? webModule.getDocumentBase().getFileObject(WELCOME_XHTML):
263
            FileObject welcomeFile = (panel!=null && panel.isEnableFacelets()) ? webModule.getDocumentBase().getFileObject(WELCOME_XHTML):
262
                                                                webModule.getDocumentBase().getFileObject(WELCOME_JSF);
264
                                                                webModule.getDocumentBase().getFileObject(WELCOME_JSF);
Lines 319-325 Link Here
319
                    preferences.put(PREFERRED_LANGUAGE, "Facelets");    //NOI18N
321
                    preferences.put(PREFERRED_LANGUAGE, "Facelets");    //NOI18N
320
                }
322
                }
321
            }
323
            }
322
            panel = new JSFConfigurationPanel(this, controller, !defaultValue, preferences);
324
            panel = new JSFConfigurationPanel(this, controller, !defaultValue, preferences, webModule);
323
        } else {
325
        } else {
324
            if (webModule!=null && webModule.getDocumentBase() == null) {
326
            if (webModule!=null && webModule.getDocumentBase() == null) {
325
                controller.getProperties().setProperty("NoDocBase", true);  //NOI18N
327
                controller.getProperties().setProperty("NoDocBase", true);  //NOI18N
Lines 582-591 Link Here
582
                    if (!profile.equals(Profile.JAVA_EE_6_FULL) && !profile.equals(Profile.JAVA_EE_6_WEB) && !isJSF20) {
584
                    if (!profile.equals(Profile.JAVA_EE_6_FULL) && !profile.equals(Profile.JAVA_EE_6_WEB) && !isJSF20) {
583
                        createFacesConfig = true;
585
                        createFacesConfig = true;
584
                    }
586
                    }
585
                    if (isJSF20 && panel.getJsfComponentDescriptor() != null) {
586
                        if (panel.getJsfComponentDescriptor().getDefaultRenderKitId() != null)
587
                            createFacesConfig = true;
588
                    }
589
                }
587
                }
590
                if (createFacesConfig) {
588
                if (createFacesConfig) {
591
                    String content = readResource(Thread.currentThread().getContextClassLoader().getResourceAsStream(RESOURCE_FOLDER + facesConfigTemplate), "UTF-8"); //NOI18N
589
                    String content = readResource(Thread.currentThread().getContextClassLoader().getResourceAsStream(RESOURCE_FOLDER + facesConfigTemplate), "UTF-8"); //NOI18N
Lines 634-660 Link Here
634
                                viewHandler.setFullyQualifiedClassType(HANDLER);
632
                                viewHandler.setFullyQualifiedClassType(HANDLER);
635
                                application.addViewHandler(viewHandler);
633
                                application.addViewHandler(viewHandler);
636
                            }
634
                            }
637
                            // A component library may require a render kit
635
//                            // A component library may require a render kit
638
                            if (isJSF20 && panel.getJsfComponentDescriptor() != null) {
636
//                            if (isJSF20 && panel.getJsfComponentDescriptor() != null) {
639
                                String drki = panel.getJsfComponentDescriptor().getDefaultRenderKitId();
637
//                                String drki = panel.getJsfComponentDescriptor().getDefaultRenderKitId();
640
                                if (drki != null) {
638
//                                if (drki != null) {
641
                                    List<DefaultRenderKitId> drkits = application.getDefaultRenderKitIds();
639
//                                    List<DefaultRenderKitId> drkits = application.getDefaultRenderKitIds();
642
                                    boolean alreadyDefined = false;
640
//                                    boolean alreadyDefined = false;
643
                                    if (drkits != null){
641
//                                    if (drkits != null){
644
                                        for (DefaultRenderKitId drkit : drkits) {
642
//                                        for (DefaultRenderKitId drkit : drkits) {
645
                                            if (drki.equals(drkit.getText().trim())){
643
//                                            if (drki.equals(drkit.getText().trim())){
646
                                                alreadyDefined = true;
644
//                                                alreadyDefined = true;
647
                                                break;
645
//                                                break;
648
                                            }
646
//                                            }
649
                                        }
647
//                                        }
650
                                    }
648
//                                    }
651
                                    if (!alreadyDefined){
649
//                                    if (!alreadyDefined){
652
                                        DefaultRenderKitId newdrki = model.getFactory().createDefaultRenderKitId();
650
//                                        DefaultRenderKitId newdrki = model.getFactory().createDefaultRenderKitId();
653
                                        newdrki.setText(drki);
651
//                                        newdrki.setText(drki);
654
                                        application.addDefaultRenderKitId(newdrki);
652
//                                        application.addDefaultRenderKitId(newdrki);
655
                                    }
653
//                                    }
656
                                }
654
//                                }
657
                            }
655
//                            }
658
                            ClassPath cp = ClassPath.getClassPath(webModule.getDocumentBase(), ClassPath.COMPILE);
656
                            ClassPath cp = ClassPath.getClassPath(webModule.getDocumentBase(), ClassPath.COMPILE);
659
                            // FIXME icefaces on server
657
                            // FIXME icefaces on server
660
                            if (panel.getLibrary()!=null && panel.getLibrary().getName().indexOf("facelets-icefaces") != -1 //NOI18N
658
                            if (panel.getLibrary()!=null && panel.getLibrary().getName().indexOf("facelets-icefaces") != -1 //NOI18N
Lines 695-704 Link Here
695
                    HashMap<String, Object> params = new HashMap<String, Object>();
693
                    HashMap<String, Object> params = new HashMap<String, Object>();
696
                    if (isJSF20) {
694
                    if (isJSF20) {
697
                        params.put("isJSF20", Boolean.TRUE);    //NOI18N
695
                        params.put("isJSF20", Boolean.TRUE);    //NOI18N
698
                        if (panel.getJsfComponentDescriptor() != null) {
699
                            params.put("welcomeBody", panel.getJsfComponentDescriptor().getWelcomeBody());  //NOI18N
700
                            params.put("welcomeInclude", "xmlns:"+panel.getJsfComponentDescriptor().getNsPrefix()+"=\""+panel.getJsfComponentDescriptor().getNamespace()+"\"");    //NOI18N
701
                        }
702
                    }
696
                    }
703
                    JSFPaletteUtilities.expandJSFTemplate(template, params, target);
697
                    JSFPaletteUtilities.expandJSFTemplate(template, params, target);
704
                }
698
                }
(-)a/web.jsf/src/org/netbeans/modules/web/jsf/JSFUtils.java (-1 / +1 lines)
Lines 60-66 Link Here
60
import org.netbeans.modules.j2ee.dd.api.web.DDProvider;
60
import org.netbeans.modules.j2ee.dd.api.web.DDProvider;
61
import org.netbeans.modules.j2ee.dd.api.web.WebApp;
61
import org.netbeans.modules.j2ee.dd.api.web.WebApp;
62
import org.netbeans.modules.web.api.webmodule.WebModule;
62
import org.netbeans.modules.web.api.webmodule.WebModule;
63
import org.netbeans.modules.web.jsf.api.facesmodel.JSFVersion;
63
import org.netbeans.modules.web.jsfapi.api.JSFVersion;
64
import org.netbeans.spi.project.libraries.LibraryFactory;
64
import org.netbeans.spi.project.libraries.LibraryFactory;
65
import org.netbeans.spi.project.libraries.LibraryImplementation;
65
import org.netbeans.spi.project.libraries.LibraryImplementation;
66
import org.netbeans.spi.project.libraries.support.LibrariesSupport;
66
import org.netbeans.spi.project.libraries.support.LibrariesSupport;
(-)a/web.jsf/src/org/netbeans/modules/web/jsf/api/components/JsfComponentDescriptor.java (-144 lines)
Removed Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 2010 Oracle and/or its affiliates. All rights reserved.
5
 *
6
 * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
7
 * Other names may be trademarks of their respective owners.
8
 *
9
 * The contents of this file are subject to the terms of either the GNU
10
 * General Public License Version 2 only ("GPL") or the Common
11
 * Development and Distribution License("CDDL") (collectively, the
12
 * "License"). You may not use this file except in compliance with the
13
 * License. You can obtain a copy of the License at
14
 * http://www.netbeans.org/cddl-gplv2.html
15
 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
16
 * specific language governing permissions and limitations under the
17
 * License.  When distributing the software, include this License Header
18
 * Notice in each file and include the License file at
19
 * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
20
 * particular file as subject to the "Classpath" exception as provided
21
 * by Oracle in the GPL Version 2 section of the License file that
22
 * accompanied this code. If applicable, add the following below the
23
 * License Header, with the fields enclosed by brackets [] replaced by
24
 * your own identifying information:
25
 * "Portions Copyrighted [year] [name of copyright owner]"
26
 *
27
 * If you wish your version of this file to be governed by only the CDDL
28
 * or only the GPL Version 2, indicate your decision by adding
29
 * "[Contributor] elects to include this software in this distribution
30
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
31
 * single choice of license, a recipient has the option to distribute
32
 * your version of this file under either the CDDL, the GPL Version 2 or
33
 * to extend the choice of license to its licensees as provided above.
34
 * However, if you add GPL Version 2 code and therefore, elected the GPL
35
 * Version 2 license, then the option applies only if the new code is
36
 * made subject to such option by the copyright holder.
37
 *
38
 * Contributor(s):
39
 *
40
 * Portions Copyrighted 2010 Sun Microsystems, Inc.
41
 */
42
43
package org.netbeans.modules.web.jsf.api.components;
44
45
import org.netbeans.api.project.libraries.Library;
46
import org.netbeans.api.project.libraries.LibraryManager;
47
import org.netbeans.modules.web.jsf.api.facesmodel.JSFVersion;
48
import org.openide.util.Parameters;
49
50
/**
51
 *
52
 * @author alexey butenko
53
 */
54
final public class JsfComponentDescriptor {
55
    private final String name;
56
    private final String libraryName;
57
    private final String description;
58
    private final JSFVersion jsfVersion;
59
    private final String welcomeBody;
60
    private final String namespace;
61
    private final String nsPrefix;
62
    private final String defaultRenderKitId;
63
64
    public JsfComponentDescriptor(String libraryName, String name, JSFVersion jsfVersion, String description, String welcomeBody, String namespace, String nsPrefix) {
65
        this (libraryName, name, jsfVersion, description, welcomeBody, namespace, nsPrefix, null);
66
    }
67
    public JsfComponentDescriptor(String libraryName, String name, JSFVersion jsfVersion, 
68
            String description, String welcomeBody, String namespace, String nsPrefix, String defaultRenderKitId) {
69
        Parameters.notNull("name", name); // NOI18N
70
        Parameters.notNull("libraryName", libraryName); // NOI18N
71
        this.libraryName = libraryName;
72
        this.name = name;
73
        this.jsfVersion = jsfVersion;
74
        this.description = description;
75
        this.welcomeBody = welcomeBody;
76
        this.namespace = namespace;
77
        this.nsPrefix = nsPrefix;
78
        this.defaultRenderKitId = defaultRenderKitId;
79
    }
80
81
    public JSFVersion getJsfVersion() {
82
        return jsfVersion;
83
    }
84
85
    @Override
86
    public int hashCode() {
87
        return getLibraryName().hashCode();
88
    }
89
90
91
    @Override
92
    public boolean equals(Object obj) {
93
        if (obj instanceof JsfComponentDescriptor) {
94
            JsfComponentDescriptor descriptor = (JsfComponentDescriptor) obj;
95
            if (descriptor.getLibraryName().equals(getLibraryName())) {
96
                return true;
97
            }
98
        }
99
        return false;
100
    }
101
102
    public String getName() {
103
        return name;
104
    }
105
106
    public String getDescription() {
107
        if (description !=  null)
108
            return description;
109
        return getName();
110
    }
111
112
    public String getLibraryName() {
113
        return libraryName;
114
    };
115
    
116
    public Library getLibrary() {
117
        return LibraryManager.getDefault().getLibrary(getLibraryName());
118
    }
119
120
    @Override
121
    public String toString() {
122
        return getName();
123
    }
124
125
    public String getWelcomeBody() {
126
        return welcomeBody;
127
    }
128
129
    public String getNamespace() {
130
        return namespace;
131
    }
132
133
    public String getNsPrefix() {
134
        return nsPrefix;
135
    }
136
    
137
    /** Returns the value of default-render-kit-id element that should be placed 
138
     * in the application element in faces-config.xml. If <code>null</code> is 
139
     * returned, no default-render-kit-id element is written.
140
     */
141
    public String getDefaultRenderKitId() {
142
        return defaultRenderKitId;
143
    }
144
}
(-)a/web.jsf/src/org/netbeans/modules/web/jsf/api/components/JsfComponents.java (-70 lines)
Removed Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 2010 Oracle and/or its affiliates. All rights reserved.
5
 *
6
 * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
7
 * Other names may be trademarks of their respective owners.
8
 *
9
 * The contents of this file are subject to the terms of either the GNU
10
 * General Public License Version 2 only ("GPL") or the Common
11
 * Development and Distribution License("CDDL") (collectively, the
12
 * "License"). You may not use this file except in compliance with the
13
 * License. You can obtain a copy of the License at
14
 * http://www.netbeans.org/cddl-gplv2.html
15
 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
16
 * specific language governing permissions and limitations under the
17
 * License.  When distributing the software, include this License Header
18
 * Notice in each file and include the License file at
19
 * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
20
 * particular file as subject to the "Classpath" exception as provided
21
 * by Oracle in the GPL Version 2 section of the License file that
22
 * accompanied this code. If applicable, add the following below the
23
 * License Header, with the fields enclosed by brackets [] replaced by
24
 * your own identifying information:
25
 * "Portions Copyrighted [year] [name of copyright owner]"
26
 *
27
 * If you wish your version of this file to be governed by only the CDDL
28
 * or only the GPL Version 2, indicate your decision by adding
29
 * "[Contributor] elects to include this software in this distribution
30
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
31
 * single choice of license, a recipient has the option to distribute
32
 * your version of this file under either the CDDL, the GPL Version 2 or
33
 * to extend the choice of license to its licensees as provided above.
34
 * However, if you add GPL Version 2 code and therefore, elected the GPL
35
 * Version 2 license, then the option applies only if the new code is
36
 * made subject to such option by the copyright holder.
37
 *
38
 * Contributor(s):
39
 *
40
 * Portions Copyrighted 2010 Sun Microsystems, Inc.
41
 */
42
43
package org.netbeans.modules.web.jsf.api.components;
44
45
import java.util.Collection;
46
import java.util.HashSet;
47
import java.util.Set;
48
import org.netbeans.modules.web.jsf.spi.components.JsfComponentProvider;
49
import org.openide.util.lookup.Lookups;
50
51
/**
52
 *
53
 * @author alexey butenko
54
 */
55
public final class JsfComponents {
56
    private final static String COMPONENTS_PATH = "j2ee/jsf/components";    //NOI18N
57
58
59
    public static Set<? extends JsfComponentDescriptor> findJsfComponents() {
60
        Collection<? extends JsfComponentProvider> componentProvider =
61
                Lookups.forPath(COMPONENTS_PATH).lookupAll(JsfComponentProvider.class);
62
        Set<JsfComponentDescriptor> result = new HashSet<JsfComponentDescriptor>();
63
        for (JsfComponentProvider provider: componentProvider) {
64
            for(JsfComponentDescriptor descriptor: provider.getComponents()) {
65
                result.add(descriptor);
66
            }
67
        }
68
        return result;
69
    }
70
}
(-)a/web.jsf/src/org/netbeans/modules/web/jsf/api/facesmodel/JSFConfigModel.java (+1 lines)
Lines 44-49 Link Here
44
44
45
package org.netbeans.modules.web.jsf.api.facesmodel;
45
package org.netbeans.modules.web.jsf.api.facesmodel;
46
46
47
import org.netbeans.modules.web.jsfapi.api.JSFVersion;
47
import org.netbeans.modules.xml.xam.dom.DocumentModel;
48
import org.netbeans.modules.xml.xam.dom.DocumentModel;
48
49
49
/**
50
/**
(-)a/web.jsf/src/org/netbeans/modules/web/jsf/api/facesmodel/JSFVersion.java (-53 lines)
Removed Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 1997-2010 Oracle and/or its affiliates. All rights reserved.
5
 *
6
 * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
7
 * Other names may be trademarks of their respective owners.
8
 *
9
 * The contents of this file are subject to the terms of either the GNU
10
 * General Public License Version 2 only ("GPL") or the Common
11
 * Development and Distribution License("CDDL") (collectively, the
12
 * "License"). You may not use this file except in compliance with the
13
 * License. You can obtain a copy of the License at
14
 * http://www.netbeans.org/cddl-gplv2.html
15
 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
16
 * specific language governing permissions and limitations under the
17
 * License.  When distributing the software, include this License Header
18
 * Notice in each file and include the License file at
19
 * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
20
 * particular file as subject to the "Classpath" exception as provided
21
 * by Oracle in the GPL Version 2 section of the License file that
22
 * accompanied this code. If applicable, add the following below the
23
 * License Header, with the fields enclosed by brackets [] replaced by
24
 * your own identifying information:
25
 * "Portions Copyrighted [year] [name of copyright owner]"
26
 *
27
 * Contributor(s):
28
 *
29
 * The Original Software is NetBeans. The Initial Developer of the Original
30
 * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
31
 * Microsystems, Inc. All Rights Reserved.
32
 *
33
 * If you wish your version of this file to be governed by only the CDDL
34
 * or only the GPL Version 2, indicate your decision by adding
35
 * "[Contributor] elects to include this software in this distribution
36
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
37
 * single choice of license, a recipient has the option to distribute
38
 * your version of this file under either the CDDL, the GPL Version 2 or
39
 * to extend the choice of license to its licensees as provided above.
40
 * However, if you add GPL Version 2 code and therefore, elected the GPL
41
 * Version 2 license, then the option applies only if the new code is
42
 * made subject to such option by the copyright holder.
43
 */
44
45
package org.netbeans.modules.web.jsf.api.facesmodel;
46
47
/**
48
 *
49
 * @author Petr Pisl, ads
50
 */
51
public enum JSFVersion {
52
    JSF_1_0, JSF_1_1, JSF_1_2, JSF_2_0;
53
}
(-)a/web.jsf/src/org/netbeans/modules/web/jsf/impl/facesmodel/JSFConfigComponentFactoryImpl.java (-1 / +1 lines)
Lines 79-85 Link Here
79
import org.netbeans.modules.web.jsf.api.facesmodel.JSFConfigComponent;
79
import org.netbeans.modules.web.jsf.api.facesmodel.JSFConfigComponent;
80
import org.netbeans.modules.web.jsf.api.facesmodel.JSFConfigComponentFactory;
80
import org.netbeans.modules.web.jsf.api.facesmodel.JSFConfigComponentFactory;
81
import org.netbeans.modules.web.jsf.api.facesmodel.JSFConfigVisitor;
81
import org.netbeans.modules.web.jsf.api.facesmodel.JSFConfigVisitor;
82
import org.netbeans.modules.web.jsf.api.facesmodel.JSFVersion;
82
import org.netbeans.modules.web.jsfapi.api.JSFVersion;
83
import org.netbeans.modules.web.jsf.api.facesmodel.Lifecycle;
83
import org.netbeans.modules.web.jsf.api.facesmodel.Lifecycle;
84
import org.netbeans.modules.web.jsf.api.facesmodel.LifecycleFactory;
84
import org.netbeans.modules.web.jsf.api.facesmodel.LifecycleFactory;
85
import org.netbeans.modules.web.jsf.api.facesmodel.ListEntries;
85
import org.netbeans.modules.web.jsf.api.facesmodel.ListEntries;
(-)a/web.jsf/src/org/netbeans/modules/web/jsf/impl/facesmodel/JSFConfigModelImpl.java (-1 / +1 lines)
Lines 55-61 Link Here
55
import org.netbeans.modules.web.jsf.api.facesmodel.JSFConfigComponent;
55
import org.netbeans.modules.web.jsf.api.facesmodel.JSFConfigComponent;
56
import org.netbeans.modules.web.jsf.api.facesmodel.JSFConfigComponentFactory;
56
import org.netbeans.modules.web.jsf.api.facesmodel.JSFConfigComponentFactory;
57
import org.netbeans.modules.web.jsf.api.facesmodel.JSFConfigModel;
57
import org.netbeans.modules.web.jsf.api.facesmodel.JSFConfigModel;
58
import org.netbeans.modules.web.jsf.api.facesmodel.JSFVersion;
58
import org.netbeans.modules.web.jsfapi.api.JSFVersion;
59
import org.netbeans.modules.web.jsf.api.metamodel.JsfModel;
59
import org.netbeans.modules.web.jsf.api.metamodel.JsfModel;
60
import org.netbeans.modules.xml.xam.ComponentUpdater;
60
import org.netbeans.modules.xml.xam.ComponentUpdater;
61
import org.netbeans.modules.xml.xam.ModelSource;
61
import org.netbeans.modules.xml.xam.ModelSource;
(-)a/web.jsf/src/org/netbeans/modules/web/jsf/impl/facesmodel/JSFConfigQNames.java (-1 / +1 lines)
Lines 50-56 Link Here
50
50
51
import javax.xml.namespace.QName;
51
import javax.xml.namespace.QName;
52
52
53
import org.netbeans.modules.web.jsf.api.facesmodel.JSFVersion;
53
import org.netbeans.modules.web.jsfapi.api.JSFVersion;
54
54
55
/**
55
/**
56
 *
56
 *
(-)a/web.jsf/src/org/netbeans/modules/web/jsf/spi/components/JsfComponentProvider.java (-53 lines)
Removed Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
5
 *
6
 * The contents of this file are subject to the terms of either the GNU
7
 * General Public License Version 2 only ("GPL") or the Common
8
 * Development and Distribution License("CDDL") (collectively, the
9
 * "License"). You may not use this file except in compliance with the
10
 * License. You can obtain a copy of the License at
11
 * http://www.netbeans.org/cddl-gplv2.html
12
 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
13
 * specific language governing permissions and limitations under the
14
 * License.  When distributing the software, include this License Header
15
 * Notice in each file and include the License file at
16
 * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
17
 * particular file as subject to the "Classpath" exception as provided
18
 * by Sun in the GPL Version 2 section of the License file that
19
 * accompanied this code. If applicable, add the following below the
20
 * License Header, with the fields enclosed by brackets [] replaced by
21
 * your own identifying information:
22
 * "Portions Copyrighted [year] [name of copyright owner]"
23
 *
24
 * If you wish your version of this file to be governed by only the CDDL
25
 * or only the GPL Version 2, indicate your decision by adding
26
 * "[Contributor] elects to include this software in this distribution
27
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
28
 * single choice of license, a recipient has the option to distribute
29
 * your version of this file under either the CDDL, the GPL Version 2 or
30
 * to extend the choice of license to its licensees as provided above.
31
 * However, if you add GPL Version 2 code and therefore, elected the GPL
32
 * Version 2 license, then the option applies only if the new code is
33
 * made subject to such option by the copyright holder.
34
 *
35
 * Contributor(s):
36
 *
37
 * Portions Copyrighted 2010 Sun Microsystems, Inc.
38
 */
39
40
package org.netbeans.modules.web.jsf.spi.components;
41
42
import java.util.Set;
43
import org.netbeans.modules.web.jsf.api.components.JsfComponentDescriptor;
44
45
/**
46
 *
47
 * @author alexeybutenko
48
 */
49
public interface JsfComponentProvider {
50
51
    public Set<JsfComponentDescriptor> getComponents();
52
    
53
}
(-)a/web.jsf/src/org/netbeans/modules/web/jsf/wizards/Bundle.properties (-2 / +5 lines)
Lines 190-195 Link Here
190
WARN_MissingTargetServer=<html>The project doesn't have the target server set properly.<br> It is highly recommended to set it.</html>
190
WARN_MissingTargetServer=<html>The project doesn't have the target server set properly.<br> It is highly recommended to set it.</html>
191
ERR_NoJSFLibraryFound=No Facelets Libraries Found
191
ERR_NoJSFLibraryFound=No Facelets Libraries Found
192
192
193
LBL_JsfComponentNotValid=JSF library {0} not set up properly. Click more to update its configuration.
194
193
ERR_UserTransactionUnavailable=The class javax.transaction.UserTransaction is unavailable. Add an appropriate JAR file in Project Properties > Libraries.
195
ERR_UserTransactionUnavailable=The class javax.transaction.UserTransaction is unavailable. Add an appropriate JAR file in Project Properties > Libraries.
194
ERR_JsfTargetChooser_InvalidJsfFolder=The JSF pages folder name is invalid.
196
ERR_JsfTargetChooser_InvalidJsfFolder=The JSF pages folder name is invalid.
195
ERR_JavaTargetChooser_CantUseDefaultPackage=Provide a package name.
197
ERR_JavaTargetChooser_CantUseDefaultPackage=Provide a package name.
Lines 258-264 Link Here
258
260
259
USG_PERSISTENCE_JSF=JSF Pages was created for {0} Entity Classes
261
USG_PERSISTENCE_JSF=JSF Pages was created for {0} Entity Classes
260
262
261
LBL_Browse=Browse...
263
LBL_Browse=More...
262
LBL_Browse_Mnemonic=R
264
LBL_Browse_Mnemonic=R
263
ACSD_Browse=Browse directories
265
ACSD_Browse=Browse directories
264
266
Lines 310-313 Link Here
310
LBL_AVAILABLE_Components=Available components:
312
LBL_AVAILABLE_Components=Available components:
311
LBL_NONE_Components=Do not include any components libraries
313
LBL_NONE_Components=Do not include any components libraries
312
LBL_JSF_Components=Components Suite:
314
LBL_JSF_Components=Components Suite:
313
LBL_JSF_Components_Desc=Select the JSF component suite to setup for your web application.
315
LBL_JSF_Components_Desc_New_Project=Select JSF component suites to setup for your web application.
316
LBL_JSF_Components_Desc_Customizer=JSF component suites included in your web application.
(-)a/web.jsf/src/org/netbeans/modules/web/jsf/wizards/JSFConfigurationPanel.java (-12 / +12 lines)
Lines 47-52 Link Here
47
import java.io.File;
47
import java.io.File;
48
import java.util.HashSet;
48
import java.util.HashSet;
49
import java.util.Iterator;
49
import java.util.Iterator;
50
import java.util.List;
50
import java.util.Set;
51
import java.util.Set;
51
import java.util.prefs.Preferences;
52
import java.util.prefs.Preferences;
52
import javax.swing.event.ChangeEvent;
53
import javax.swing.event.ChangeEvent;
Lines 59-66 Link Here
59
import org.netbeans.modules.web.api.webmodule.ExtenderController;
60
import org.netbeans.modules.web.api.webmodule.ExtenderController;
60
import org.netbeans.modules.web.api.webmodule.WebModule;
61
import org.netbeans.modules.web.api.webmodule.WebModule;
61
import org.netbeans.modules.web.jsf.JSFFrameworkProvider;
62
import org.netbeans.modules.web.jsf.JSFFrameworkProvider;
62
import org.netbeans.modules.web.jsf.api.components.JsfComponentDescriptor;
63
import org.netbeans.modules.web.jsfapi.spi.components.JsfComponentImplementation;
63
import org.netbeans.modules.web.jsf.api.facesmodel.JSFVersion;
64
import org.netbeans.modules.web.spi.webmodule.WebModuleExtender;
64
import org.netbeans.modules.web.spi.webmodule.WebModuleExtender;
65
import org.openide.util.HelpCtx;
65
import org.openide.util.HelpCtx;
66
66
Lines 77-85 Link Here
77
    private static final String PREFERRED_LANGUAGE="jsf.language"; //NOI18N
77
    private static final String PREFERRED_LANGUAGE="jsf.language"; //NOI18N
78
78
79
    private Preferences preferences;
79
    private Preferences preferences;
80
80
    private WebModule webModule;
81
//    private Library jsfComponentsLibrary;
82
    private JsfComponentDescriptor jsfComponentDescriptor;
83
81
84
    public enum LibraryType {USED, NEW, SERVER};
82
    public enum LibraryType {USED, NEW, SERVER};
85
    private LibraryType libraryType;
83
    private LibraryType libraryType;
Lines 116-126 Link Here
116
        getComponent();
114
        getComponent();
117
    }
115
    }
118
116
119
    public JSFConfigurationPanel(JSFFrameworkProvider framework, ExtenderController controller, boolean customizer, Preferences preferences) {
117
    public JSFConfigurationPanel(JSFFrameworkProvider framework, ExtenderController controller, boolean customizer, Preferences preferences, WebModule webModule) {
120
        this.framework = framework;
118
        this.framework = framework;
121
        this.controller = controller;
119
        this.controller = controller;
122
        this.customizer = customizer;
120
        this.customizer = customizer;
123
        this.preferences = preferences;
121
        this.preferences = preferences;
122
        this.webModule = webModule;
124
        enableFacelets = preferences.get(PREFERRED_LANGUAGE, "JSP").equals(PreferredLanguage.Facelets.getName());
123
        enableFacelets = preferences.get(PREFERRED_LANGUAGE, "JSP").equals(PreferredLanguage.Facelets.getName());
125
124
126
        debugFacelets = true;
125
        debugFacelets = true;
Lines 339-354 Link Here
339
        return serverLibrary;
338
        return serverLibrary;
340
    }
339
    }
341
340
341
    public WebModule getWebModule() {
342
        return webModule;
343
    }
344
    
342
    protected void setServerLibrary(ServerLibrary library){
345
    protected void setServerLibrary(ServerLibrary library){
343
        this.serverLibrary = library;
346
        this.serverLibrary = library;
344
        fireChangeEvent();
347
        fireChangeEvent();
345
    }
348
    }
346
    void setJsfComponentDescriptor(JsfComponentDescriptor jsfComponentDescriptor) {
349
    
347
        this.jsfComponentDescriptor = jsfComponentDescriptor;
350
    public List<? extends JsfComponentImplementation> getEnabledJsfDescriptors() {
348
    }
351
        return component.getActivedJsfDescriptors();
349
350
    public JsfComponentDescriptor getJsfComponentDescriptor() {
351
        return jsfComponentDescriptor;
352
    }
352
    }
353
353
354
    protected static class PreferredLanguage {
354
    protected static class PreferredLanguage {
(-)a/web.jsf/src/org/netbeans/modules/web/jsf/wizards/JSFConfigurationPanelVisual.form (-41 / +37 lines)
Lines 61-67 Link Here
61
                  <Group type="102" attributes="0">
61
                  <Group type="102" attributes="0">
62
                      <EmptySpace max="-2" attributes="0"/>
62
                      <EmptySpace max="-2" attributes="0"/>
63
                      <Group type="103" groupAlignment="0" attributes="0">
63
                      <Group type="103" groupAlignment="0" attributes="0">
64
                          <Component id="rbNewLibrary" alignment="1" pref="478" max="32767" attributes="0"/>
64
                          <Component id="rbNewLibrary" alignment="1" pref="485" max="32767" attributes="0"/>
65
                          <Group type="102" alignment="0" attributes="0">
65
                          <Group type="102" alignment="0" attributes="0">
66
                              <EmptySpace min="22" pref="22" max="22" attributes="0"/>
66
                              <EmptySpace min="22" pref="22" max="22" attributes="0"/>
67
                              <Group type="103" groupAlignment="0" attributes="0">
67
                              <Group type="103" groupAlignment="0" attributes="0">
Lines 69-75 Link Here
69
                                  <Component id="lVersion" alignment="0" min="-2" max="-2" attributes="1"/>
69
                                  <Component id="lVersion" alignment="0" min="-2" max="-2" attributes="1"/>
70
                                  <Component id="lDirectory" alignment="0" min="-2" max="-2" attributes="1"/>
70
                                  <Component id="lDirectory" alignment="0" min="-2" max="-2" attributes="1"/>
71
                              </Group>
71
                              </Group>
72
                              <EmptySpace pref="202" max="32767" attributes="0"/>
72
                              <EmptySpace pref="245" max="32767" attributes="0"/>
73
                          </Group>
73
                          </Group>
74
                          <Group type="102" alignment="0" attributes="0">
74
                          <Group type="102" alignment="0" attributes="0">
75
                              <Group type="103" groupAlignment="1" max="-2" attributes="0">
75
                              <Group type="103" groupAlignment="1" max="-2" attributes="0">
Lines 78-93 Link Here
78
                              </Group>
78
                              </Group>
79
                              <EmptySpace type="unrelated" max="-2" attributes="0"/>
79
                              <EmptySpace type="unrelated" max="-2" attributes="0"/>
80
                              <Group type="103" groupAlignment="0" attributes="0">
80
                              <Group type="103" groupAlignment="0" attributes="0">
81
                                  <Component id="cbLibraries" pref="292" max="32767" attributes="0"/>
81
                                  <Component id="cbLibraries" pref="322" max="32767" attributes="0"/>
82
                                  <Group type="102" alignment="1" attributes="0">
82
                                  <Group type="102" alignment="1" attributes="0">
83
                                      <Group type="103" groupAlignment="1" attributes="0">
83
                                      <Group type="103" groupAlignment="1" attributes="0">
84
                                          <Component id="jtNewLibraryName" alignment="1" pref="187" max="32767" attributes="1"/>
84
                                          <Component id="jtNewLibraryName" alignment="1" pref="245" max="32767" attributes="1"/>
85
                                          <Component id="jtFolder" alignment="1" pref="187" max="32767" attributes="1"/>
85
                                          <Component id="jtFolder" alignment="1" pref="245" max="32767" attributes="1"/>
86
                                      </Group>
86
                                      </Group>
87
                                      <EmptySpace max="-2" attributes="0"/>
87
                                      <EmptySpace max="-2" attributes="0"/>
88
                                      <Component id="jbBrowse" min="-2" max="-2" attributes="0"/>
88
                                      <Component id="jbBrowse" min="-2" max="-2" attributes="0"/>
89
                                  </Group>
89
                                  </Group>
90
                                  <Component id="serverLibraries" alignment="0" pref="292" max="32767" attributes="0"/>
90
                                  <Component id="serverLibraries" alignment="0" pref="322" max="32767" attributes="0"/>
91
                              </Group>
91
                              </Group>
92
                          </Group>
92
                          </Group>
93
                      </Group>
93
                      </Group>
Lines 121-127 Link Here
121
                      </Group>
121
                      </Group>
122
                      <EmptySpace max="-2" attributes="0"/>
122
                      <EmptySpace max="-2" attributes="0"/>
123
                      <Component id="cbPackageJars" min="-2" max="-2" attributes="0"/>
123
                      <Component id="cbPackageJars" min="-2" max="-2" attributes="0"/>
124
                      <EmptySpace pref="28" max="32767" attributes="0"/>
124
                      <EmptySpace pref="22" max="32767" attributes="0"/>
125
                  </Group>
125
                  </Group>
126
              </Group>
126
              </Group>
127
            </DimensionLayout>
127
            </DimensionLayout>
Lines 299-305 Link Here
299
                          <Group type="102" alignment="0" attributes="0">
299
                          <Group type="102" alignment="0" attributes="0">
300
                              <Component id="lURLPattern" min="-2" max="-2" attributes="0"/>
300
                              <Component id="lURLPattern" min="-2" max="-2" attributes="0"/>
301
                              <EmptySpace max="-2" attributes="0"/>
301
                              <EmptySpace max="-2" attributes="0"/>
302
                              <Component id="tURLPattern" pref="276" max="32767" attributes="0"/>
302
                              <Component id="tURLPattern" pref="326" max="32767" attributes="0"/>
303
                          </Group>
303
                          </Group>
304
                          <Group type="102" alignment="0" attributes="0">
304
                          <Group type="102" alignment="0" attributes="0">
305
                              <Component id="jLabel1" min="-2" max="-2" attributes="0"/>
305
                              <Component id="jLabel1" min="-2" max="-2" attributes="0"/>
Lines 396-412 Link Here
396
          <Layout>
396
          <Layout>
397
            <DimensionLayout dim="0">
397
            <DimensionLayout dim="0">
398
              <Group type="103" groupAlignment="0" attributes="0">
398
              <Group type="103" groupAlignment="0" attributes="0">
399
                  <Group type="102" attributes="0">
399
                  <Group type="102" alignment="0" attributes="0">
400
                      <EmptySpace max="-2" attributes="0"/>
400
                      <EmptySpace max="-2" attributes="0"/>
401
                      <Group type="103" groupAlignment="0" attributes="0">
401
                      <Group type="103" groupAlignment="0" attributes="0">
402
                          <Group type="102" alignment="0" attributes="0">
402
                          <Component id="jsfComponentsScrollPane" alignment="0" pref="479" max="32767" attributes="0"/>
403
                              <Component id="jLabel2" min="-2" max="-2" attributes="0"/>
403
                          <Component id="jsfComponentsLabel" alignment="0" min="-2" max="-2" attributes="0"/>
404
                              <EmptySpace max="-2" attributes="0"/>
405
                              <Component id="cbJsfComponents" min="-2" max="-2" attributes="0"/>
406
                          </Group>
407
                          <Component id="jLabel3" alignment="0" min="-2" max="-2" attributes="0"/>
408
                      </Group>
404
                      </Group>
409
                      <EmptySpace max="32767" attributes="0"/>
405
                      <EmptySpace max="-2" attributes="0"/>
410
                  </Group>
406
                  </Group>
411
              </Group>
407
              </Group>
412
            </DimensionLayout>
408
            </DimensionLayout>
Lines 414-453 Link Here
414
              <Group type="103" groupAlignment="0" attributes="0">
410
              <Group type="103" groupAlignment="0" attributes="0">
415
                  <Group type="102" attributes="0">
411
                  <Group type="102" attributes="0">
416
                      <EmptySpace max="-2" attributes="0"/>
412
                      <EmptySpace max="-2" attributes="0"/>
417
                      <Component id="jLabel3" min="-2" max="-2" attributes="0"/>
413
                      <Component id="jsfComponentsLabel" min="-2" max="-2" attributes="0"/>
418
                      <EmptySpace type="unrelated" max="-2" attributes="0"/>
414
                      <EmptySpace max="-2" attributes="0"/>
419
                      <Group type="103" groupAlignment="3" attributes="0">
415
                      <Component id="jsfComponentsScrollPane" pref="153" max="32767" attributes="0"/>
420
                          <Component id="jLabel2" alignment="3" min="-2" max="-2" attributes="0"/>
416
                      <EmptySpace max="-2" attributes="0"/>
421
                          <Component id="cbJsfComponents" alignment="3" min="-2" max="-2" attributes="0"/>
422
                      </Group>
423
                      <EmptySpace pref="125" max="32767" attributes="0"/>
424
                  </Group>
417
                  </Group>
425
              </Group>
418
              </Group>
426
            </DimensionLayout>
419
            </DimensionLayout>
427
          </Layout>
420
          </Layout>
428
          <SubComponents>
421
          <SubComponents>
429
            <Component class="javax.swing.JComboBox" name="cbJsfComponents">
422
            <Component class="javax.swing.JLabel" name="jsfComponentsLabel">
430
              <Events>
431
                <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="cbJsfComponentsActionPerformed"/>
432
              </Events>
433
            </Component>
434
            <Component class="javax.swing.JLabel" name="jLabel2">
435
              <Properties>
423
              <Properties>
436
                <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
424
                <Property name="text" type="java.lang.String" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
437
                  <ComponentRef name="cbJsfComponents"/>
425
                  <Connection code="getJsfComponentsLabelText()" type="code"/>
438
                </Property>
439
                <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
440
                  <ResourceString bundle="org/netbeans/modules/web/jsf/wizards/Bundle.properties" key="LBL_JSF_Components" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
441
                </Property>
426
                </Property>
442
              </Properties>
427
              </Properties>
443
            </Component>
428
            </Component>
444
            <Component class="javax.swing.JLabel" name="jLabel3">
429
            <Container class="javax.swing.JScrollPane" name="jsfComponentsScrollPane">
445
              <Properties>
430
446
                <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
431
              <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
447
                  <ResourceString bundle="org/netbeans/modules/web/jsf/wizards/Bundle.properties" key="LBL_JSF_Components_Desc" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
432
              <SubComponents>
448
                </Property>
433
                <Component class="javax.swing.JTable" name="jsfComponentsTable">
449
              </Properties>
434
                  <Properties>
450
            </Component>
435
                    <Property name="model" type="javax.swing.table.TableModel" editor="org.netbeans.modules.form.editors2.TableModelEditor">
436
                      <Table columnCount="4" rowCount="4">
437
                        <Column editable="true" title="Title 1" type="java.lang.Object"/>
438
                        <Column editable="true" title="Title 2" type="java.lang.Object"/>
439
                        <Column editable="true" title="Title 3" type="java.lang.Object"/>
440
                        <Column editable="true" title="Title 4" type="java.lang.Object"/>
441
                      </Table>
442
                    </Property>
443
                  </Properties>
444
                </Component>
445
              </SubComponents>
446
            </Container>
451
          </SubComponents>
447
          </SubComponents>
452
        </Container>
448
        </Container>
453
      </SubComponents>
449
      </SubComponents>
(-)a/web.jsf/src/org/netbeans/modules/web/jsf/wizards/JSFConfigurationPanelVisual.java (-77 / +403 lines)
Lines 45-50 Link Here
45
package org.netbeans.modules.web.jsf.wizards;
45
package org.netbeans.modules.web.jsf.wizards;
46
46
47
import java.awt.Component;
47
import java.awt.Component;
48
import java.awt.event.ActionEvent;
49
import java.awt.event.ActionListener;
50
import java.awt.event.MouseAdapter;
51
import java.awt.event.MouseEvent;
48
import java.io.File;
52
import java.io.File;
49
import java.io.IOException;
53
import java.io.IOException;
50
import java.net.URL;
54
import java.net.URL;
Lines 62-70 Link Here
62
import java.util.logging.Logger;
66
import java.util.logging.Logger;
63
import java.util.regex.Pattern;
67
import java.util.regex.Pattern;
64
import javax.swing.DefaultComboBoxModel;
68
import javax.swing.DefaultComboBoxModel;
69
import javax.swing.DefaultListModel;
70
import javax.swing.JButton;
71
import javax.swing.JComponent;
65
import javax.swing.JFileChooser;
72
import javax.swing.JFileChooser;
73
import javax.swing.JTable;
74
import javax.swing.ListSelectionModel;
66
import javax.swing.SwingUtilities;
75
import javax.swing.SwingUtilities;
76
import javax.swing.UIManager;
77
import javax.swing.event.ChangeEvent;
78
import javax.swing.event.ChangeListener;
67
import javax.swing.event.DocumentListener;
79
import javax.swing.event.DocumentListener;
80
import javax.swing.table.AbstractTableModel;
81
import javax.swing.table.DefaultTableCellRenderer;
82
import javax.swing.table.TableCellRenderer;
68
import org.netbeans.api.j2ee.core.Profile;
83
import org.netbeans.api.j2ee.core.Profile;
69
import org.netbeans.api.project.libraries.Library;
84
import org.netbeans.api.project.libraries.Library;
70
import org.netbeans.api.project.libraries.LibraryManager;
85
import org.netbeans.api.project.libraries.LibraryManager;
Lines 78-91 Link Here
78
import org.netbeans.modules.web.api.webmodule.ExtenderController;
93
import org.netbeans.modules.web.api.webmodule.ExtenderController;
79
import org.netbeans.modules.web.api.webmodule.ExtenderController.Properties;
94
import org.netbeans.modules.web.api.webmodule.ExtenderController.Properties;
80
import org.netbeans.modules.web.jsf.JSFUtils;
95
import org.netbeans.modules.web.jsf.JSFUtils;
81
import org.netbeans.modules.web.jsf.api.components.JsfComponents;
96
import org.netbeans.modules.web.jsfapi.api.JSFVersion;
82
import org.netbeans.modules.web.jsf.api.components.JsfComponentDescriptor;
97
import org.netbeans.modules.web.jsfapi.spi.components.JsfComponentImplementation;
83
import org.netbeans.modules.web.jsf.api.facesmodel.JSFVersion;
98
import org.netbeans.modules.web.jsfapi.spi.components.JsfComponentCustomizer;
99
import org.netbeans.modules.web.jsfapi.spi.components.JsfComponentProvider;
100
import org.openide.DialogDescriptor;
101
import org.openide.DialogDisplayer;
84
import org.openide.WizardDescriptor;
102
import org.openide.WizardDescriptor;
85
import org.openide.util.Exceptions;
103
import org.openide.util.Exceptions;
86
import org.openide.util.HelpCtx;
104
import org.openide.util.HelpCtx;
105
import org.openide.util.Lookup;
87
import org.openide.util.NbBundle;
106
import org.openide.util.NbBundle;
88
import org.openide.util.RequestProcessor;
107
import org.openide.util.RequestProcessor;
108
import org.openide.util.lookup.Lookups;
89
109
90
/**
110
/**
91
 *
111
 *
Lines 102-108 Link Here
102
    
122
    
103
    private final List<LibraryItem> jsfLibraries = new ArrayList<LibraryItem>();
123
    private final List<LibraryItem> jsfLibraries = new ArrayList<LibraryItem>();
104
    //    private final List<JsfComponentDescriptor> componentsLibraries = new ArrayList<JsfComponentDescriptor>();
124
    //    private final List<JsfComponentDescriptor> componentsLibraries = new ArrayList<JsfComponentDescriptor>();
105
    private final Map<JSFVersion, List<JsfComponentDescriptor>> componentsMap = new HashMap<JSFVersion, List<JsfComponentDescriptor>>();
125
    private final Map<JSFVersion, List<JsfComponentImplementation>> componentsMap = new HashMap<JSFVersion, List<JsfComponentImplementation>>();
106
    /**
126
    /**
107
     * Do not modify it directly, use setJsfVersion method
127
     * Do not modify it directly, use setJsfVersion method
108
     */
128
     */
Lines 115-130 Link Here
115
    private String currentServerInstanceID;
135
    private String currentServerInstanceID;
116
    private final List<String> excludeLibs = Arrays.asList("javaee-web-api-6.0", "javaee-api-6.0", "jsp-compilation"); //NOI18N
136
    private final List<String> excludeLibs = Arrays.asList("javaee-web-api-6.0", "javaee-api-6.0", "jsp-compilation"); //NOI18N
117
    private boolean isWebLogicServer = false;
137
    private boolean isWebLogicServer = false;
138
    
139
    // Jsf component libraries related
140
    private JSFComponentsTableModel jsfComponentsTableModel;
141
    
142
    private static final Lookup.Result<? extends JsfComponentProvider> jsfComponentProviders = 
143
            Lookups.forPath(JsfComponentProvider.COMPONENTS_PATH).lookupResult(JsfComponentProvider.class);
144
    
118
    /** Creates new form JSFConfigurationPanelVisual */
145
    /** Creates new form JSFConfigurationPanelVisual */
119
    public JSFConfigurationPanelVisual(JSFConfigurationPanel panel, boolean customizer) {
146
    public JSFConfigurationPanelVisual(JSFConfigurationPanel panel, boolean customizer) {
120
        this.panel = panel;
147
        this.panel = panel;
121
        this.customizer = customizer;
148
        this.customizer = customizer;
149
        this.jsfComponentsTableModel = new JSFComponentsTableModel(customizer);
122
150
123
        initComponents();
151
        initComponents();
124
        
152
        
125
        tURLPattern.getDocument().addDocumentListener(this);
153
        tURLPattern.getDocument().addDocumentListener(this);
126
        cbPackageJars.setVisible(false);
154
        cbPackageJars.setVisible(false);
127
        cbJsfComponents.setModel(new DefaultComboBoxModel(new ComponentsLibraryItem[]{new ComponentsLibraryItem(null)}));
155
        
156
        // update JSF components list
157
        jsfComponentsTable.setModel(jsfComponentsTableModel);
158
        JsfComponentsTableCellRenderer renderer = new JsfComponentsTableCellRenderer();
159
        renderer.setBooleanRenderer(jsfComponentsTable.getDefaultRenderer(Boolean.class));
160
        renderer.setJButtonRenderer(new JTableButtonRenderer());
161
        jsfComponentsTable.setDefaultRenderer(JsfComponentImplementation.class, renderer);
162
        jsfComponentsTable.setDefaultRenderer(Boolean.class, renderer);
163
        jsfComponentsTable.setDefaultRenderer(JButton.class, renderer);
164
        jsfComponentsTable.addMouseListener(new JTableButtonMouseListener(jsfComponentsTable));
165
        initJsfComponentTableVisualProperties(jsfComponentsTable);
128
    }
166
    }
129
167
130
    @Override
168
    @Override
Lines 205-211 Link Here
205
                            updateJsfComponents();
243
                            updateJsfComponents();
206
                        }
244
                        }
207
                    });
245
                    });
208
                    LOG.finest("Time spent in initLibraries in Runnable = "+(System.currentTimeMillis()-time) +" ms");  //NOI18N
246
                    LOG.log(Level.FINEST, "Time spent in initLibraries in Runnable = {0} ms", (System.currentTimeMillis()-time));  //NOI18N
209
                }
247
                }
210
            }
248
            }
211
        };
249
        };
Lines 213-231 Link Here
213
251
214
        libsInitialized = true;
252
        libsInitialized = true;
215
//        repaint();
253
//        repaint();
216
        LOG.finest("Time spent in "+this.getClass().getName() +" initLibraries = "+(System.currentTimeMillis()-time) +" ms");   //NOI18N
254
        LOG.log(Level.FINEST, "Time spent in {0} initLibraries = {1} ms", new Object[]{this.getClass().getName(), System.currentTimeMillis()-time});   //NOI18N
217
    }
255
    }
218
256
219
    private void initJsfComponentsLibraries() {
257
    private void initJsfComponentsLibraries() {
220
        if (jsfComponentsInitialized)
258
        if (jsfComponentsInitialized)
221
            return;
259
            return;
222
        for (JsfComponentDescriptor components : JsfComponents.findJsfComponents()) {
260
        
223
            List<JsfComponentDescriptor> list = componentsMap.get(components.getJsfVersion());
261
        List<JsfComponentImplementation> jsfComponentDescriptors = new ArrayList<JsfComponentImplementation>();
262
        for (JsfComponentProvider provider: jsfComponentProviders.allInstances()) {
263
            jsfComponentDescriptors.addAll(provider.getJsfComponents());
264
        }
265
        
266
        for (JsfComponentImplementation jsfDescriptor : jsfComponentDescriptors) {
267
            List<JsfComponentImplementation> list = componentsMap.get(jsfDescriptor.getJsfVersion());
224
            if (list == null) {
268
            if (list == null) {
225
                list = new ArrayList<JsfComponentDescriptor>();
269
                list = new ArrayList<JsfComponentImplementation>();
226
            }
270
            }
227
            list.add(components);
271
            list.add(jsfDescriptor);
228
            componentsMap.put(components.getJsfVersion(), list);
272
            componentsMap.put(jsfDescriptor.getJsfVersion(), list);
229
        }
273
        }
230
        jsfComponentsInitialized = true;
274
        jsfComponentsInitialized = true;
231
        if (currentJSFVersion !=null) {
275
        if (currentJSFVersion !=null) {
Lines 473-481 Link Here
473
        cbPreferredLang = new javax.swing.JComboBox();
517
        cbPreferredLang = new javax.swing.JComboBox();
474
        jLabel1 = new javax.swing.JLabel();
518
        jLabel1 = new javax.swing.JLabel();
475
        componentsPanel = new javax.swing.JPanel();
519
        componentsPanel = new javax.swing.JPanel();
476
        cbJsfComponents = new javax.swing.JComboBox();
520
        jsfComponentsLabel = new javax.swing.JLabel();
477
        jLabel2 = new javax.swing.JLabel();
521
        jsfComponentsScrollPane = new javax.swing.JScrollPane();
478
        jLabel3 = new javax.swing.JLabel();
522
        jsfComponentsTable = new javax.swing.JTable();
479
523
480
        setLayout(new java.awt.CardLayout());
524
        setLayout(new java.awt.CardLayout());
481
525
Lines 571-598 Link Here
571
            .addGroup(libPanelLayout.createSequentialGroup()
615
            .addGroup(libPanelLayout.createSequentialGroup()
572
                .addContainerGap()
616
                .addContainerGap()
573
                .addGroup(libPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
617
                .addGroup(libPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
574
                    .addComponent(rbNewLibrary, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 478, Short.MAX_VALUE)
618
                    .addComponent(rbNewLibrary, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 485, Short.MAX_VALUE)
575
                    .addGroup(libPanelLayout.createSequentialGroup()
619
                    .addGroup(libPanelLayout.createSequentialGroup()
576
                        .addGap(22, 22, 22)
620
                        .addGap(22, 22, 22)
577
                        .addGroup(libPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
621
                        .addGroup(libPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
578
                            .addComponent(cbPackageJars)
622
                            .addComponent(cbPackageJars)
579
                            .addComponent(lVersion)
623
                            .addComponent(lVersion)
580
                            .addComponent(lDirectory))
624
                            .addComponent(lDirectory))
581
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 202, Short.MAX_VALUE))
625
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 245, Short.MAX_VALUE))
582
                    .addGroup(libPanelLayout.createSequentialGroup()
626
                    .addGroup(libPanelLayout.createSequentialGroup()
583
                        .addGroup(libPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
627
                        .addGroup(libPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
584
                            .addComponent(rbServerLibrary, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
628
                            .addComponent(rbServerLibrary, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
585
                            .addComponent(rbRegisteredLibrary, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
629
                            .addComponent(rbRegisteredLibrary, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
586
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
630
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
587
                        .addGroup(libPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
631
                        .addGroup(libPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
588
                            .addComponent(cbLibraries, 0, 292, Short.MAX_VALUE)
632
                            .addComponent(cbLibraries, 0, 322, Short.MAX_VALUE)
589
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, libPanelLayout.createSequentialGroup()
633
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, libPanelLayout.createSequentialGroup()
590
                                .addGroup(libPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
634
                                .addGroup(libPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
591
                                    .addComponent(jtNewLibraryName, javax.swing.GroupLayout.DEFAULT_SIZE, 187, Short.MAX_VALUE)
635
                                    .addComponent(jtNewLibraryName, javax.swing.GroupLayout.DEFAULT_SIZE, 245, Short.MAX_VALUE)
592
                                    .addComponent(jtFolder, javax.swing.GroupLayout.DEFAULT_SIZE, 187, Short.MAX_VALUE))
636
                                    .addComponent(jtFolder, javax.swing.GroupLayout.DEFAULT_SIZE, 245, Short.MAX_VALUE))
593
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
637
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
594
                                .addComponent(jbBrowse))
638
                                .addComponent(jbBrowse))
595
                            .addComponent(serverLibraries, 0, 292, Short.MAX_VALUE))))
639
                            .addComponent(serverLibraries, 0, 322, Short.MAX_VALUE))))
596
                .addContainerGap())
640
                .addContainerGap())
597
        );
641
        );
598
        libPanelLayout.setVerticalGroup(
642
        libPanelLayout.setVerticalGroup(
Lines 617-623 Link Here
617
                    .addComponent(lVersion))
661
                    .addComponent(lVersion))
618
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
662
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
619
                .addComponent(cbPackageJars)
663
                .addComponent(cbPackageJars)
620
                .addContainerGap(28, Short.MAX_VALUE))
664
                .addContainerGap(22, Short.MAX_VALUE))
621
        );
665
        );
622
666
623
        cbPackageJars.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(JSFConfigurationPanelVisual.class, "ACSD_PackageJarToWar")); // NOI18N
667
        cbPackageJars.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(JSFConfigurationPanelVisual.class, "ACSD_PackageJarToWar")); // NOI18N
Lines 650-656 Link Here
650
                    .addGroup(confPanelLayout.createSequentialGroup()
694
                    .addGroup(confPanelLayout.createSequentialGroup()
651
                        .addComponent(lURLPattern)
695
                        .addComponent(lURLPattern)
652
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
696
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
653
                        .addComponent(tURLPattern, javax.swing.GroupLayout.DEFAULT_SIZE, 276, Short.MAX_VALUE))
697
                        .addComponent(tURLPattern, javax.swing.GroupLayout.DEFAULT_SIZE, 326, Short.MAX_VALUE))
654
                    .addGroup(confPanelLayout.createSequentialGroup()
698
                    .addGroup(confPanelLayout.createSequentialGroup()
655
                        .addComponent(jLabel1)
699
                        .addComponent(jLabel1)
656
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
700
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
Lines 675-690 Link Here
675
719
676
        jsfTabbedPane.addTab(org.openide.util.NbBundle.getMessage(JSFConfigurationPanelVisual.class, "LBL_TAB_Configuration"), confPanel); // NOI18N
720
        jsfTabbedPane.addTab(org.openide.util.NbBundle.getMessage(JSFConfigurationPanelVisual.class, "LBL_TAB_Configuration"), confPanel); // NOI18N
677
721
678
        cbJsfComponents.addActionListener(new java.awt.event.ActionListener() {
722
        jsfComponentsLabel.setText(getJsfComponentsLabelText());
679
            public void actionPerformed(java.awt.event.ActionEvent evt) {
723
680
                cbJsfComponentsActionPerformed(evt);
724
        jsfComponentsTable.setModel(new javax.swing.table.DefaultTableModel(
725
            new Object [][] {
726
                {null, null, null, null},
727
                {null, null, null, null},
728
                {null, null, null, null},
729
                {null, null, null, null}
730
            },
731
            new String [] {
732
                "Title 1", "Title 2", "Title 3", "Title 4"
681
            }
733
            }
682
        });
734
        ));
683
735
        jsfComponentsScrollPane.setViewportView(jsfComponentsTable);
684
        jLabel2.setLabelFor(cbJsfComponents);
685
        jLabel2.setText(org.openide.util.NbBundle.getMessage(JSFConfigurationPanelVisual.class, "LBL_JSF_Components")); // NOI18N
686
687
        jLabel3.setText(org.openide.util.NbBundle.getMessage(JSFConfigurationPanelVisual.class, "LBL_JSF_Components_Desc")); // NOI18N
688
736
689
        javax.swing.GroupLayout componentsPanelLayout = new javax.swing.GroupLayout(componentsPanel);
737
        javax.swing.GroupLayout componentsPanelLayout = new javax.swing.GroupLayout(componentsPanel);
690
        componentsPanel.setLayout(componentsPanelLayout);
738
        componentsPanel.setLayout(componentsPanelLayout);
Lines 693-715 Link Here
693
            .addGroup(componentsPanelLayout.createSequentialGroup()
741
            .addGroup(componentsPanelLayout.createSequentialGroup()
694
                .addContainerGap()
742
                .addContainerGap()
695
                .addGroup(componentsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
743
                .addGroup(componentsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
696
                    .addGroup(componentsPanelLayout.createSequentialGroup()
744
                    .addComponent(jsfComponentsScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 479, Short.MAX_VALUE)
697
                        .addComponent(jLabel2)
745
                    .addComponent(jsfComponentsLabel))
698
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
746
                .addContainerGap())
699
                        .addComponent(cbJsfComponents, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
700
                    .addComponent(jLabel3))
701
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
702
        );
747
        );
703
        componentsPanelLayout.setVerticalGroup(
748
        componentsPanelLayout.setVerticalGroup(
704
            componentsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
749
            componentsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
705
            .addGroup(componentsPanelLayout.createSequentialGroup()
750
            .addGroup(componentsPanelLayout.createSequentialGroup()
706
                .addContainerGap()
751
                .addContainerGap()
707
                .addComponent(jLabel3)
752
                .addComponent(jsfComponentsLabel)
708
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
753
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
709
                .addGroup(componentsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
754
                .addComponent(jsfComponentsScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 153, Short.MAX_VALUE)
710
                    .addComponent(jLabel2)
755
                .addContainerGap())
711
                    .addComponent(cbJsfComponents, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
712
                .addContainerGap(125, Short.MAX_VALUE))
713
        );
756
        );
714
757
715
        jsfTabbedPane.addTab(org.openide.util.NbBundle.getMessage(JSFConfigurationPanelVisual.class, "LBL_TAB_Components"), componentsPanel); // NOI18N
758
        jsfTabbedPane.addTab(org.openide.util.NbBundle.getMessage(JSFConfigurationPanelVisual.class, "LBL_TAB_Components"), componentsPanel); // NOI18N
Lines 781-805 Link Here
781
    }
824
    }
782
    updatePreferredLanguages();
825
    updatePreferredLanguages();
783
}//GEN-LAST:event_serverLibrariesActionPerformed
826
}//GEN-LAST:event_serverLibrariesActionPerformed
784
785
private void cbJsfComponentsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cbJsfComponentsActionPerformed
786
    // TODO add your handling code here:
787
    panel.setJsfComponentDescriptor(((ComponentsLibraryItem)cbJsfComponents.getSelectedItem()).getJsfComponentDescriptor());
788
}//GEN-LAST:event_cbJsfComponentsActionPerformed
789
    
827
    
790
    
828
    
791
    // Variables declaration - do not modify//GEN-BEGIN:variables
829
    // Variables declaration - do not modify//GEN-BEGIN:variables
792
    private javax.swing.ButtonGroup buttonGroup1;
830
    private javax.swing.ButtonGroup buttonGroup1;
793
    private javax.swing.JComboBox cbJsfComponents;
794
    private javax.swing.JComboBox cbLibraries;
831
    private javax.swing.JComboBox cbLibraries;
795
    private javax.swing.JCheckBox cbPackageJars;
832
    private javax.swing.JCheckBox cbPackageJars;
796
    private javax.swing.JComboBox cbPreferredLang;
833
    private javax.swing.JComboBox cbPreferredLang;
797
    private javax.swing.JPanel componentsPanel;
834
    private javax.swing.JPanel componentsPanel;
798
    private javax.swing.JPanel confPanel;
835
    private javax.swing.JPanel confPanel;
799
    private javax.swing.JLabel jLabel1;
836
    private javax.swing.JLabel jLabel1;
800
    private javax.swing.JLabel jLabel2;
801
    private javax.swing.JLabel jLabel3;
802
    private javax.swing.JButton jbBrowse;
837
    private javax.swing.JButton jbBrowse;
838
    private javax.swing.JLabel jsfComponentsLabel;
839
    private javax.swing.JScrollPane jsfComponentsScrollPane;
840
    private javax.swing.JTable jsfComponentsTable;
803
    private javax.swing.JTabbedPane jsfTabbedPane;
841
    private javax.swing.JTabbedPane jsfTabbedPane;
804
    private javax.swing.JTextField jtFolder;
842
    private javax.swing.JTextField jtFolder;
805
    private javax.swing.JTextField jtNewLibraryName;
843
    private javax.swing.JTextField jtNewLibraryName;
Lines 900-907 Link Here
900
            }
938
            }
901
        }
939
        }
902
        if (!isServerRegistered(serverInstanceID)) {   //NOI18N
940
        if (!isServerRegistered(serverInstanceID)) {   //NOI18N
903
            controller.getProperties().setProperty(WizardDescriptor.PROP_INFO_MESSAGE, NbBundle.getMessage(JSFConfigurationPanelVisual.class, "ERR_MissingTargetServer"));
941
            controller.getProperties().setProperty(WizardDescriptor.PROP_INFO_MESSAGE, 
942
                    NbBundle.getMessage(JSFConfigurationPanelVisual.class, "ERR_MissingTargetServer")); //NOI18N
904
        }
943
        }
944
        
945
        // check all enabled JSF component libraries
946
        for (JsfComponentImplementation jsfComponentDescriptor : getActivedJsfDescriptors()) {
947
            if (jsfComponentDescriptor.getJsfComponentCustomizer(false, null) != null && 
948
                    !jsfComponentDescriptor.getJsfComponentCustomizer(false, null).isValid()) {
949
                controller.getProperties().setProperty(WizardDescriptor.PROP_INFO_MESSAGE, 
950
                        NbBundle.getMessage(JSFConfigurationPanelVisual.class, "LBL_JsfComponentNotValid", jsfComponentDescriptor.getName())); // NOI18N
951
                return false;
952
            }
953
        }
954
        
905
        controller.setErrorMessage(null);
955
        controller.setErrorMessage(null);
906
        return true;
956
        return true;
907
    }
957
    }
Lines 1087-1092 Link Here
1087
        tURLPattern.setText(pattern);
1137
        tURLPattern.setText(pattern);
1088
    }
1138
    }
1089
    
1139
    
1140
    public List<? extends JsfComponentImplementation> getActivedJsfDescriptors() {
1141
        List<JsfComponentImplementation> activatedDescriptors =  new ArrayList<JsfComponentImplementation>();
1142
        for (int i = 0; i < jsfComponentsTableModel.getRowCount(); i++) {
1143
            if (jsfComponentsTableModel.getItem(i).isSelected())
1144
                activatedDescriptors.add(jsfComponentsTableModel.getItem(i).getJsfComponent());
1145
        }
1146
        return activatedDescriptors;
1147
    }
1148
    
1090
    public boolean packageJars(){
1149
    public boolean packageJars(){
1091
        return cbPackageJars.isSelected();
1150
        return cbPackageJars.isSelected();
1092
    }
1151
    }
Lines 1135-1154 Link Here
1135
        updatePreferredLanguages();
1194
        updatePreferredLanguages();
1136
    }
1195
    }
1137
    private void updateJsfComponentsModel(JSFVersion version) {
1196
    private void updateJsfComponentsModel(JSFVersion version) {
1138
        List<ComponentsLibraryItem> componentsList = new ArrayList<ComponentsLibraryItem>();
1197
        List<JsfComponentImplementation> descriptors = componentsMap.get(version);
1139
        //Add empty default component
1198
        jsfComponentsTableModel.removeAllItems();
1140
        componentsList.add(new ComponentsLibraryItem(null));
1199
        if (descriptors != null) {
1141
        List<JsfComponentDescriptor> providers = componentsMap.get(version);
1200
            for (JsfComponentImplementation descriptor : descriptors) {
1142
        if (providers != null) {
1201
                addFrameworkToModel(descriptor);
1143
            for (JsfComponentDescriptor provider : providers) {
1144
                componentsList.add(new ComponentsLibraryItem(provider));
1145
            }
1202
            }
1146
        }
1203
        }
1147
        cbJsfComponents.setModel(new DefaultComboBoxModel(componentsList.toArray(new ComponentsLibraryItem[componentsList.size()])));
1204
       
1205
        jsfComponentsTable.setModel(jsfComponentsTableModel);
1148
    }
1206
    }
1149
1207
1150
    private void updateJsfComponents() {
1208
    private void updateJsfComponents() {
1151
        panel.setJsfComponentDescriptor(((ComponentsLibraryItem)cbJsfComponents.getSelectedItem()).getJsfComponentDescriptor());
1209
        if (currentJSFVersion != null && customizer) {
1210
           initJsfComponentLibraries(currentJSFVersion);
1211
        }
1152
    }
1212
    }
1153
1213
1154
    private void enableDefinedLibraryComponent(boolean enabled){
1214
    private void enableDefinedLibraryComponent(boolean enabled){
Lines 1193-1198 Link Here
1193
        return message;
1253
        return message;
1194
    }
1254
    }
1195
1255
1256
    private String getJsfComponentsLabelText() {
1257
        if (!customizer) {
1258
            return org.openide.util.NbBundle.getMessage(JSFConfigurationPanelVisual.class, "LBL_JSF_Components_Desc_New_Project"); //NOI18N
1259
        } else {
1260
            return org.openide.util.NbBundle.getMessage(JSFConfigurationPanelVisual.class, "LBL_JSF_Components_Desc_Customizer"); //NOI18N
1261
        }
1262
    }
1263
1196
    private static class LibraryItem {
1264
    private static class LibraryItem {
1197
        
1265
        
1198
        private Library library;
1266
        private Library library;
Lines 1309-1338 Link Here
1309
        }
1377
        }
1310
1378
1311
    }
1379
    }
1380
    
1381
    private void initJsfComponentLibraries(JSFVersion version) {
1382
        List<JsfComponentImplementation> descriptors = componentsMap.get(version);
1383
        for (int i = 0; i < descriptors.size(); i++) {
1384
            JsfComponentImplementation jsfComponentDescriptor = descriptors.get(i);
1385
            if (jsfComponentDescriptor.isInWebModule(panel.getWebModule())) {
1386
                jsfComponentsTable.setValueAt(true, i, 0);
1387
            }
1388
        }
1389
    }
1312
1390
1313
    private static class ComponentsLibraryItem {
1391
    private void initJsfComponentTableVisualProperties(JTable table) {
1314
        private JsfComponentDescriptor jsfComponentsProvider;
1392
        table.setRowSelectionAllowed(true);
1315
        private String defaultName = "None";
1393
        table.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
1394
        
1395
        table.setTableHeader(null);
1396
        
1397
        table.setRowHeight(jsfComponentsTable.getRowHeight() + 4);        
1398
        table.setIntercellSpacing(new java.awt.Dimension(0, 0));        
1399
        // set the color of the table's JViewport
1400
        table.getParent().setBackground(table.getBackground());
1401
        table.setShowHorizontalLines(false);
1402
        table.setShowVerticalLines(false);
1403
        
1404
        table.getColumnModel().getColumn(0).setMaxWidth(30);
1405
        table.getColumnModel().getColumn(2).setMaxWidth(100);
1406
        
1407
        if (customizer) {
1408
            table.setEnabled(false);
1409
        }
1410
    }
1411
    
1412
    private void addFrameworkToModel(JsfComponentImplementation component) {
1413
        jsfComponentsTableModel.addItem(new JSFComponentModelItem(component));
1414
    }
1415
    
1416
    private static void fireJsfDialogUpdate(JsfComponentCustomizer jsfComponentExtender, DialogDescriptor dialogDescriptor) {
1417
        if (jsfComponentExtender.getErrorMessage() != null) {
1418
            dialogDescriptor.getNotificationLineSupport().setErrorMessage(jsfComponentExtender.getErrorMessage());
1419
        } else if (jsfComponentExtender.getWarningMessage() != null) {
1420
            dialogDescriptor.getNotificationLineSupport().setWarningMessage(jsfComponentExtender.getWarningMessage());
1421
        } else {
1422
            dialogDescriptor.getNotificationLineSupport().clearMessages();
1423
        }
1424
        dialogDescriptor.setValid(jsfComponentExtender.isValid());
1425
    }
1426
    
1427
    public static class JsfComponentsTableCellRenderer extends DefaultTableCellRenderer {
1428
        
1429
        private TableCellRenderer jbuttonRenderer;
1430
        private TableCellRenderer booleanRenderer;
1431
        
1432
        @Override
1433
        public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
1434
            if (value instanceof JsfComponentImplementation) {
1435
                JsfComponentImplementation item = (JsfComponentImplementation) value;
1436
                Component comp = super.getTableCellRendererComponent(table, item.getName(), isSelected, false, row, column);
1437
                if (comp instanceof JComponent) {
1438
                    ((JComponent)comp).setOpaque(isSelected);
1439
                }
1440
                return comp;
1441
            } else if (value instanceof Boolean && booleanRenderer != null) {
1442
                    return booleanRenderer.getTableCellRendererComponent(table, value, isSelected, false, row, column);
1443
                    
1444
            } else {
1445
                if (value instanceof JButton && jbuttonRenderer != null) {
1446
                    return jbuttonRenderer.getTableCellRendererComponent(table, value, isSelected, false, row, column);
1447
                }
1448
                else {
1449
                    return super.getTableCellRendererComponent(table, value, isSelected, false, row, column);
1450
                }
1451
            }
1452
        }
1453
        
1454
        public void setBooleanRenderer(TableCellRenderer booleanRenderer) {
1455
            this.booleanRenderer = booleanRenderer;
1456
        }
1457
        
1458
        public void setJButtonRenderer(TableCellRenderer jbuttonRenderer) {
1459
            this.jbuttonRenderer = jbuttonRenderer;
1460
        }
1461
    }
1462
    
1463
    private static class JTableButtonRenderer implements TableCellRenderer {	
1464
        
1465
            @Override public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
1466
                JButton button = (JButton)value;
1467
                if (isSelected) {
1468
                    button.setForeground(table.getSelectionForeground());
1469
                    button.setBackground(table.getSelectionBackground());
1470
                } else {
1471
                    button.setForeground(table.getForeground());
1472
                    button.setBackground(UIManager.getColor("Button.background"));
1473
                }
1474
                return button;	
1475
            }
1476
    }
1477
    
1478
    private class JTableButtonMouseListener extends MouseAdapter {
1479
        
1480
        private final JTable table;
1316
1481
1317
        public ComponentsLibraryItem(JsfComponentDescriptor jsfComponentsProvider) {
1482
        public JTableButtonMouseListener(JTable table) {
1318
            this.jsfComponentsProvider = jsfComponentsProvider;
1483
            this.table = table;
1319
        }
1484
        }
1320
1485
1321
        public JsfComponentDescriptor getJsfComponentDescriptor() {
1486
        public void mouseClicked(MouseEvent e) {
1322
            return jsfComponentsProvider;
1487
            int column = table.getColumnModel().getColumnIndexAtX(e.getX());
1488
            int row = e.getY()/table.getRowHeight(); 
1489
1490
            if (row < table.getRowCount() && row >= 0 && column < table.getColumnCount() && column >= 0) {
1491
                Object value = table.getValueAt(row, column);
1492
                if (value instanceof JButton) {
1493
                    ((JButton)value).doClick();
1494
                } else if (value instanceof Boolean) {
1495
                    panel.fireChangeEvent();
1496
                }
1497
            }
1498
        }
1499
    }
1500
    
1501
    /** 
1502
     * Implements a TableModel.
1503
     */
1504
    public static final class JSFComponentsTableModel extends AbstractTableModel {
1505
        
1506
        private static final Class<?>[] COLUMN_TYPES = new Class<?>[] {Boolean.class, JsfComponentImplementation.class, JButton.class};
1507
        private DefaultListModel model;
1508
        private boolean inCustomizer;
1509
        
1510
        public JSFComponentsTableModel(boolean inCustomizer) {
1511
            model = new DefaultListModel();
1512
            this.inCustomizer = inCustomizer;
1513
        }
1514
        
1515
        public int getColumnCount() {
1516
            return COLUMN_TYPES.length;
1517
        }
1518
        
1519
        public int getRowCount() {
1520
            return model.size();
1521
        }
1522
        
1523
        public Class getColumnClass(int columnIndex) {
1524
            return COLUMN_TYPES[columnIndex];
1525
        }
1526
        
1527
        public boolean isCellEditable(int rowIndex, int columnIndex) {
1528
            return (columnIndex == 0);
1529
        }
1530
        
1531
        public Object getValueAt(final int row, int column) {
1532
            final JSFComponentModelItem item = getItem(row);
1533
            switch (column) {
1534
                case 0: return item.isSelected();
1535
                case 1: return item.getJsfComponent();
1536
                case 2: 
1537
                    if (item.isClickable()) {
1538
                        JButton button = new JButton("More...");
1539
                        if (!inCustomizer) {
1540
                            button.addActionListener(new JSFComponentModelActionListener(item.getJsfComponent()));
1541
                        }
1542
                        return button;
1543
                    } else {
1544
                        return null;
1545
                    }
1546
            }
1547
            return "";
1548
        }
1549
        
1550
        public void setValueAt(Object value, int row, int column) {
1551
            JSFComponentModelItem item = getItem(row);
1552
            switch (column) {
1553
                case 0: item.setSelected((Boolean) value);break;
1554
                case 1: item.setJsfComponent((JsfComponentImplementation) value);break;
1555
            }
1556
            fireTableCellUpdated(row, column);
1557
        }
1558
        
1559
        private JSFComponentModelItem getItem(int index) {
1560
            return (JSFComponentModelItem) model.get(index);
1561
        }
1562
        
1563
        public void addItem(JSFComponentModelItem item){
1564
            model.addElement(item);
1565
        }
1566
        
1567
        public void removeAllItems() {
1568
            if (!model.isEmpty()) {
1569
                model.removeAllElements();
1570
            }
1571
        }
1572
    }
1573
    
1574
    private static final class JSFComponentModelActionListener implements ActionListener {
1575
1576
        private JsfComponentImplementation jsfDescriptor;
1577
        private JSFComponentWindowChangeListener listener;
1578
1579
        public JSFComponentModelActionListener(JsfComponentImplementation jsfDescriptor) {
1580
            this.jsfDescriptor = jsfDescriptor;
1581
            listener = new JSFComponentWindowChangeListener();
1582
        }
1583
        
1584
        @Override
1585
        public void actionPerformed(ActionEvent e) {
1586
            final JsfComponentCustomizer jsfCustomizer = jsfDescriptor.getJsfComponentCustomizer(true, null);
1587
            jsfCustomizer.addChangeListener(listener);
1588
            
1589
            final DialogDescriptor dialogDescriptor = new DialogDescriptor(
1590
                    jsfCustomizer.getComponent(), 
1591
                    jsfDescriptor.getName(), true, null);
1592
            dialogDescriptor.createNotificationLineSupport();
1593
            
1594
            listener.setDialogDescriptor(dialogDescriptor);
1595
            listener.setJsfComponentExtender(jsfCustomizer);
1596
            
1597
            // OK button will save JSF extender configuration
1598
            ActionListener buttonsListener = new ActionListener() {
1599
1600
                @Override
1601
                public void actionPerformed(ActionEvent e) {
1602
                    if (e.getSource().equals(DialogDescriptor.OK_OPTION)) {
1603
                        jsfCustomizer.saveConfiguration();
1604
                    }
1605
                }
1606
            };
1607
            dialogDescriptor.setButtonListener(buttonsListener);
1608
            DialogDisplayer.getDefault().notify(dialogDescriptor);
1609
        }
1610
        
1611
    }
1612
    
1613
    private static final class JSFComponentWindowChangeListener implements ChangeListener {
1614
1615
        private DialogDescriptor dialogDescriptor;
1616
        private JsfComponentCustomizer jsfComponentExtender;
1617
1618
        public void setDialogDescriptor(DialogDescriptor dialogDescriptor) {
1619
            this.dialogDescriptor = dialogDescriptor;
1323
        }
1620
        }
1324
1621
1325
        public Library getLibrary() {
1622
        public void setJsfComponentExtender(JsfComponentCustomizer jsfComponentExtender) {
1326
            return jsfComponentsProvider!= null ? jsfComponentsProvider.getLibrary() : null;
1623
            this.jsfComponentExtender = jsfComponentExtender;
1327
        }
1328
1329
        public String getName() {
1330
            return jsfComponentsProvider!= null ? jsfComponentsProvider.getName() : defaultName;
1331
        }
1624
        }
1332
1625
1333
        @Override
1626
        @Override
1334
        public String toString() {
1627
        public void stateChanged(ChangeEvent e) {
1335
            return getName();
1628
            assert dialogDescriptor != null && jsfComponentExtender != null;
1629
            fireJsfDialogUpdate(jsfComponentExtender, dialogDescriptor);
1630
        }
1631
        
1632
    }
1633
1634
    private final class JSFComponentModelItem {
1635
        private JsfComponentImplementation component;
1636
        private Boolean selected;
1637
        
1638
        /** Creates a new instance of BeanFormProperty */
1639
        public JSFComponentModelItem(JsfComponentImplementation component) {
1640
            this.setJsfComponent(component);
1641
            setSelected(Boolean.FALSE);
1642
        }
1643
1644
        public JsfComponentImplementation getJsfComponent() {
1645
            return component;
1646
        }
1647
1648
        public void setJsfComponent(JsfComponentImplementation component) {
1649
            this.component = component;
1650
        }
1651
1652
        public Boolean isSelected() {
1653
            return selected;
1654
        }
1655
1656
        public void setSelected(Boolean selected) {
1657
            this.selected = selected;
1658
        }
1659
1660
        public Boolean isClickable() {
1661
            return component.getJsfComponentCustomizer(false, null) != null;
1336
        }
1662
        }
1337
    }
1663
    }
1338
}
1664
}
(-)a/web.jsf/test/unit/src/org/netbeans/modules/web/jsf/xdm/model/JSFConfigModelTest.java (-1 / +1 lines)
Lines 26-32 Link Here
26
import org.netbeans.modules.web.jsf.api.facesmodel.Description;
26
import org.netbeans.modules.web.jsf.api.facesmodel.Description;
27
import org.netbeans.modules.web.jsf.api.facesmodel.FacesConfig;
27
import org.netbeans.modules.web.jsf.api.facesmodel.FacesConfig;
28
import org.netbeans.modules.web.jsf.api.facesmodel.JSFConfigModel;
28
import org.netbeans.modules.web.jsf.api.facesmodel.JSFConfigModel;
29
import org.netbeans.modules.web.jsf.api.facesmodel.JSFVersion;
29
import org.netbeans.modules.web.jsfapi.api.JSFVersion;
30
import org.netbeans.modules.web.jsf.api.facesmodel.LocaleConfig;
30
import org.netbeans.modules.web.jsf.api.facesmodel.LocaleConfig;
31
import org.netbeans.modules.web.jsf.api.facesmodel.ManagedBean;
31
import org.netbeans.modules.web.jsf.api.facesmodel.ManagedBean;
32
import org.netbeans.modules.web.jsf.api.facesmodel.NavigationCase;
32
import org.netbeans.modules.web.jsf.api.facesmodel.NavigationCase;
(-)a/web.jsfapi/manifest.mf (-1 / +1 lines)
Lines 2-6 Link Here
2
AutoUpdate-Show-In-Client: false
2
AutoUpdate-Show-In-Client: false
3
OpenIDE-Module: org.netbeans.modules.web.jsfapi/1
3
OpenIDE-Module: org.netbeans.modules.web.jsfapi/1
4
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/web/jsfapi/Bundle.properties
4
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/web/jsfapi/Bundle.properties
5
OpenIDE-Module-Specification-Version: 1.6
5
OpenIDE-Module-Specification-Version: 1.7
6
6
(-)a/web.jsfapi/nbproject/project.xml (+29 lines)
Lines 6-11 Link Here
6
            <code-name-base>org.netbeans.modules.web.jsfapi</code-name-base>
6
            <code-name-base>org.netbeans.modules.web.jsfapi</code-name-base>
7
            <module-dependencies>
7
            <module-dependencies>
8
                <dependency>
8
                <dependency>
9
                    <code-name-base>org.netbeans.api.annotations.common</code-name-base>
10
                    <build-prerequisite/>
11
                    <compile-dependency/>
12
                    <run-dependency>
13
                        <release-version>1</release-version>
14
                        <specification-version>1.10</specification-version>
15
                    </run-dependency>
16
                </dependency>
17
                <dependency>
9
                    <code-name-base>org.netbeans.api.java.classpath</code-name-base>
18
                    <code-name-base>org.netbeans.api.java.classpath</code-name-base>
10
                    <build-prerequisite/>
19
                    <build-prerequisite/>
11
                    <compile-dependency/>
20
                    <compile-dependency/>
Lines 68-73 Link Here
68
                    </run-dependency>
77
                    </run-dependency>
69
                </dependency>
78
                </dependency>
70
                <dependency>
79
                <dependency>
80
                    <code-name-base>org.netbeans.modules.project.libraries</code-name-base>
81
                    <build-prerequisite/>
82
                    <compile-dependency/>
83
                    <run-dependency>
84
                        <release-version>1</release-version>
85
                        <specification-version>1.30</specification-version>
86
                    </run-dependency>
87
                </dependency>
88
                <dependency>
71
                    <code-name-base>org.netbeans.modules.projectapi</code-name-base>
89
                    <code-name-base>org.netbeans.modules.projectapi</code-name-base>
72
                    <build-prerequisite/>
90
                    <build-prerequisite/>
73
                    <compile-dependency/>
91
                    <compile-dependency/>
Lines 101-106 Link Here
101
                    </run-dependency>
119
                    </run-dependency>
102
                </dependency>
120
                </dependency>
103
                <dependency>
121
                <dependency>
122
                    <code-name-base>org.openide.util</code-name-base>
123
                    <build-prerequisite/>
124
                    <compile-dependency/>
125
                    <run-dependency>
126
                        <specification-version>8.16</specification-version>
127
                    </run-dependency>
128
                </dependency>
129
                <dependency>
104
                    <code-name-base>org.openide.util.lookup</code-name-base>
130
                    <code-name-base>org.openide.util.lookup</code-name-base>
105
                    <build-prerequisite/>
131
                    <build-prerequisite/>
106
                    <compile-dependency/>
132
                    <compile-dependency/>
Lines 114-122 Link Here
114
                <friend>org.netbeans.modules.web.freeform</friend>
140
                <friend>org.netbeans.modules.web.freeform</friend>
115
                <friend>org.netbeans.modules.web.jsf</friend>
141
                <friend>org.netbeans.modules.web.jsf</friend>
116
                <friend>org.netbeans.modules.web.jsf.editor</friend>
142
                <friend>org.netbeans.modules.web.jsf.editor</friend>
143
                <friend>org.netbeans.modules.web.jsf.richfaces</friend>
144
                <friend>org.netbeans.modules.web.primefaces</friend>
117
                <friend>org.netbeans.modules.web.project</friend>
145
                <friend>org.netbeans.modules.web.project</friend>
118
                <package>org.netbeans.modules.web.jsfapi.api</package>
146
                <package>org.netbeans.modules.web.jsfapi.api</package>
119
                <package>org.netbeans.modules.web.jsfapi.spi</package>
147
                <package>org.netbeans.modules.web.jsfapi.spi</package>
148
                <package>org.netbeans.modules.web.jsfapi.spi.components</package>
120
            </friend-packages>
149
            </friend-packages>
121
        </data>
150
        </data>
122
    </configuration>
151
    </configuration>
(-)b39c30857a82 (+53 lines)
Added Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 1997-2010 Oracle and/or its affiliates. All rights reserved.
5
 *
6
 * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
7
 * Other names may be trademarks of their respective owners.
8
 *
9
 * The contents of this file are subject to the terms of either the GNU
10
 * General Public License Version 2 only ("GPL") or the Common
11
 * Development and Distribution License("CDDL") (collectively, the
12
 * "License"). You may not use this file except in compliance with the
13
 * License. You can obtain a copy of the License at
14
 * http://www.netbeans.org/cddl-gplv2.html
15
 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
16
 * specific language governing permissions and limitations under the
17
 * License.  When distributing the software, include this License Header
18
 * Notice in each file and include the License file at
19
 * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
20
 * particular file as subject to the "Classpath" exception as provided
21
 * by Oracle in the GPL Version 2 section of the License file that
22
 * accompanied this code. If applicable, add the following below the
23
 * License Header, with the fields enclosed by brackets [] replaced by
24
 * your own identifying information:
25
 * "Portions Copyrighted [year] [name of copyright owner]"
26
 *
27
 * Contributor(s):
28
 *
29
 * The Original Software is NetBeans. The Initial Developer of the Original
30
 * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
31
 * Microsystems, Inc. All Rights Reserved.
32
 *
33
 * If you wish your version of this file to be governed by only the CDDL
34
 * or only the GPL Version 2, indicate your decision by adding
35
 * "[Contributor] elects to include this software in this distribution
36
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
37
 * single choice of license, a recipient has the option to distribute
38
 * your version of this file under either the CDDL, the GPL Version 2 or
39
 * to extend the choice of license to its licensees as provided above.
40
 * However, if you add GPL Version 2 code and therefore, elected the GPL
41
 * Version 2 license, then the option applies only if the new code is
42
 * made subject to such option by the copyright holder.
43
 */
44
45
package org.netbeans.modules.web.jsfapi.api;
46
47
/**
48
 *
49
 * @author Petr Pisl, ads
50
 */
51
public enum JSFVersion {
52
    JSF_1_0, JSF_1_1, JSF_1_2, JSF_2_0;
53
}
(-)b39c30857a82 (+127 lines)
Added Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 2011 Oracle and/or its affiliates. All rights reserved.
5
 *
6
 * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
7
 * Other names may be trademarks of their respective owners.
8
 *
9
 * The contents of this file are subject to the terms of either the GNU
10
 * General Public License Version 2 only ("GPL") or the Common
11
 * Development and Distribution License("CDDL") (collectively, the
12
 * "License"). You may not use this file except in compliance with the
13
 * License. You can obtain a copy of the License at
14
 * http://www.netbeans.org/cddl-gplv2.html
15
 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
16
 * specific language governing permissions and limitations under the
17
 * License.  When distributing the software, include this License Header
18
 * Notice in each file and include the License file at
19
 * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
20
 * particular file as subject to the "Classpath" exception as provided
21
 * by Oracle in the GPL Version 2 section of the License file that
22
 * accompanied this code. If applicable, add the following below the
23
 * License Header, with the fields enclosed by brackets [] replaced by
24
 * your own identifying information:
25
 * "Portions Copyrighted [year] [name of copyright owner]"
26
 *
27
 * If you wish your version of this file to be governed by only the CDDL
28
 * or only the GPL Version 2, indicate your decision by adding
29
 * "[Contributor] elects to include this software in this distribution
30
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
31
 * single choice of license, a recipient has the option to distribute
32
 * your version of this file under either the CDDL, the GPL Version 2 or
33
 * to extend the choice of license to its licensees as provided above.
34
 * However, if you add GPL Version 2 code and therefore, elected the GPL
35
 * Version 2 license, then the option applies only if the new code is
36
 * made subject to such option by the copyright holder.
37
 *
38
 * Contributor(s):
39
 *
40
 * Portions Copyrighted 2011 Sun Microsystems, Inc.
41
 */
42
package org.netbeans.modules.web.jsfapi.spi.components;
43
44
import javax.swing.JComponent;
45
import javax.swing.event.ChangeListener;
46
import org.netbeans.api.annotations.common.CheckForNull;
47
import org.netbeans.api.annotations.common.CheckReturnValue;
48
import org.netbeans.api.annotations.common.NonNull;
49
50
/**
51
 * Provides support for extending a JSF framework with a JSF component library.
52
 * It allows to modify the web module to make use of the JSF suite in JSF framework. 
53
 * 
54
 * @author Martin Fousek <marfous@netbeans.org>
55
 * 
56
 * @since 1.7
57
 */
58
public interface JsfComponentCustomizer {
59
60
    /**
61
     * Attaches a change listener that is to be notified of changes
62
     * in the customizer (e.g., the result of the {@link #isValid} method
63
     * has changed).
64
     *
65
     * @param  listener a listener.
66
     */
67
    public void addChangeListener(@NonNull ChangeListener listener);
68
69
    /**
70
     * Removes a change listener.
71
     *
72
     * @param  listener a listener.
73
     */    
74
    public void removeChangeListener(@NonNull ChangeListener listener);
75
76
    /**
77
     * Returns a UI component used to allow the user to update this customizer.
78
     *
79
     * @return a component. This method might be called more than once and it is 
80
     * expected to always return the same instance.
81
     */
82
    @NonNull
83
    @CheckReturnValue
84
    public JComponent getComponent();
85
86
    /**
87
     * Checks if this customizer is valid (e.g., if the configuration set
88
     * using the UI component returned by {@link #getComponent} is valid).
89
     * <p>
90
     *
91
     * @return {@code true} if the configuration is valid, {@code false} otherwise.
92
     * @see #getErrorMessage()
93
     * @see #getWarningMessage()
94
     */
95
    public boolean isValid();
96
97
    /**
98
     * Get error message or {@code null} if the {@link #getComponent component} is {@link #isValid() valid}.
99
     * 
100
     * @return error message or {@code null} if the {@link #getComponent component} is {@link #isValid() valid}
101
     * 
102
     * @see #isValid()
103
     * @see #getWarningMessage()
104
     */
105
    @CheckForNull
106
    public String getErrorMessage();
107
108
    /**
109
     * Get warning message that can be not {@code null} even for {@link #isValid() valid} customizer.
110
     * In other words, it is safe to extend web module even if this method returns a message.
111
     * 
112
     * @return warning message or {@code null}
113
     * 
114
     * @see #isValid()
115
     * @see #getErrorMessage()
116
     */
117
    @CheckForNull
118
    public String getWarningMessage();
119
120
    /**
121
     * Allow to save actual configuration of UI component. 
122
     * <p>
123
     * This method is called after closing component by OK button.
124
     */
125
    public void saveConfiguration();
126
127
}
(-)b39c30857a82 (+144 lines)
Added Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 2010 Oracle and/or its affiliates. All rights reserved.
5
 *
6
 * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
7
 * Other names may be trademarks of their respective owners.
8
 *
9
 * The contents of this file are subject to the terms of either the GNU
10
 * General Public License Version 2 only ("GPL") or the Common
11
 * Development and Distribution License("CDDL") (collectively, the
12
 * "License"). You may not use this file except in compliance with the
13
 * License. You can obtain a copy of the License at
14
 * http://www.netbeans.org/cddl-gplv2.html
15
 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
16
 * specific language governing permissions and limitations under the
17
 * License.  When distributing the software, include this License Header
18
 * Notice in each file and include the License file at
19
 * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
20
 * particular file as subject to the "Classpath" exception as provided
21
 * by Oracle in the GPL Version 2 section of the License file that
22
 * accompanied this code. If applicable, add the following below the
23
 * License Header, with the fields enclosed by brackets [] replaced by
24
 * your own identifying information:
25
 * "Portions Copyrighted [year] [name of copyright owner]"
26
 *
27
 * If you wish your version of this file to be governed by only the CDDL
28
 * or only the GPL Version 2, indicate your decision by adding
29
 * "[Contributor] elects to include this software in this distribution
30
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
31
 * single choice of license, a recipient has the option to distribute
32
 * your version of this file under either the CDDL, the GPL Version 2 or
33
 * to extend the choice of license to its licensees as provided above.
34
 * However, if you add GPL Version 2 code and therefore, elected the GPL
35
 * Version 2 license, then the option applies only if the new code is
36
 * made subject to such option by the copyright holder.
37
 *
38
 * Contributor(s):
39
 *
40
 * Portions Copyrighted 2010 Sun Microsystems, Inc.
41
 */
42
43
package org.netbeans.modules.web.jsfapi.spi.components;
44
45
import java.util.Set;
46
import org.netbeans.api.annotations.common.CheckForNull;
47
import org.netbeans.api.annotations.common.CheckReturnValue;
48
import org.netbeans.api.annotations.common.NonNull;
49
import org.netbeans.api.annotations.common.NullAllowed;
50
import org.netbeans.modules.web.api.webmodule.WebModule;
51
import org.netbeans.modules.web.jsfapi.api.JSFVersion;
52
import org.openide.filesystems.FileObject;
53
54
/**
55
 * This interface allows providing support for JSF component libraries. It can be used
56
 * to extend a web module and JSF framework with a JSF suite, to find out whether a web
57
 * module is already extended by a JSF component library, or to retrieve a JSF suite's
58
 * specific configuration thru the {@link JsfComponentCustomizer}.
59
 *
60
 * <p>Instances of this class are registered in the {@value 
61
 * org.netbeans.modules.web.jsfapi.spi.components.JsfComponentProvider#COMPONENTS_PATH}
62
 * in the module layer, see {@link Registration}.</p>
63
 * 
64
 * @author Martin Fousek <marfous@netbeans.org>
65
 */
66
public interface JsfComponentImplementation {
67
    
68
    /**
69
     * Returns the name of this JSF component library.
70
     *
71
     * @return the name; never {@code null}.
72
     */    
73
    @NonNull
74
    @CheckReturnValue
75
    public String getName();
76
77
    /**
78
     * Returns the description of this JSF component library.
79
     *
80
     * @return the description.
81
     */
82
    @NonNull
83
    @CheckReturnValue
84
    public String getDescription();
85
86
    /**
87
     * Called to extend the given web module and JSF framework with the JSF 
88
     * component library corresponding to this implementation.
89
     *
90
     * @param  webModule the web module to be extended; never null.
91
     * @return the set of newly created files in the web module which should be opened.
92
     */
93
    @NonNull
94
    @CheckReturnValue
95
    public Set<FileObject> extend(@NonNull WebModule webModule);
96
    
97
    /**
98
     * Returns for which version is the JSF component library designated. 
99
     * <p>
100
     * By creating new project and choosing JSF framework are JSF suites filtered 
101
     * out according to their {@link JSFVersion}.
102
     * 
103
     * @return {@link JSFVersion} suitable for this JSF component library.
104
     */
105
    @NonNull
106
    @CheckReturnValue
107
    public JSFVersion getJsfVersion();
108
    
109
110
    /**
111
     * Finds out if a given web module has already been extended with this JSF component library.
112
     * <p>
113
     * <b>This method should be as fast as possible.</b>
114
     *
115
     * @param webmodule the web module; never {@code null}.
116
     * @return {@code true} if the web module has already been extended with this JSF suite, 
117
     * {@code false} otherwise.
118
     */
119
    public boolean isInWebModule(@NonNull WebModule webModule);
120
121
    /**
122
     * Returns a {@link JsfComponentCustomizer} for this JSF component
123
     * library.
124
     * <p>
125
     * For new project is called with {@code null} parameter. In project customizer is called for 
126
     * given {@link WebModule}.
127
     * 
128
     * @param initialize says if the customizer should be initialized to IDE or project defaults
129
     * @param webmodule the web module for which should be customizer adapted; null if the 
130
     * project doesn't exist yet
131
     * @return a customizer; can be {@code null} if the JSF suite doesn't 
132
     * support that and no extending panel should be offered.
133
     */
134
    @CheckForNull
135
    public JsfComponentCustomizer getJsfComponentCustomizer(boolean initialize, @NullAllowed WebModule webModule);
136
137
    /**
138
     * Performs actions needed for removal JSF component library form the web module.
139
     *
140
     * @param webModule the web module from which should be JSF component library removed; never null.
141
     */
142
    public void remove(@NonNull WebModule webModule);
143
    
144
}
(-)b39c30857a82 (+77 lines)
Added Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 2011 Oracle and/or its affiliates. All rights reserved.
5
 *
6
 * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
7
 * Other names may be trademarks of their respective owners.
8
 *
9
 * The contents of this file are subject to the terms of either the GNU
10
 * General Public License Version 2 only ("GPL") or the Common
11
 * Development and Distribution License("CDDL") (collectively, the
12
 * "License"). You may not use this file except in compliance with the
13
 * License. You can obtain a copy of the License at
14
 * http://www.netbeans.org/cddl-gplv2.html
15
 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
16
 * specific language governing permissions and limitations under the
17
 * License.  When distributing the software, include this License Header
18
 * Notice in each file and include the License file at
19
 * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
20
 * particular file as subject to the "Classpath" exception as provided
21
 * by Oracle in the GPL Version 2 section of the License file that
22
 * accompanied this code. If applicable, add the following below the
23
 * License Header, with the fields enclosed by brackets [] replaced by
24
 * your own identifying information:
25
 * "Portions Copyrighted [year] [name of copyright owner]"
26
 *
27
 * If you wish your version of this file to be governed by only the CDDL
28
 * or only the GPL Version 2, indicate your decision by adding
29
 * "[Contributor] elects to include this software in this distribution
30
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
31
 * single choice of license, a recipient has the option to distribute
32
 * your version of this file under either the CDDL, the GPL Version 2 or
33
 * to extend the choice of license to its licensees as provided above.
34
 * However, if you add GPL Version 2 code and therefore, elected the GPL
35
 * Version 2 license, then the option applies only if the new code is
36
 * made subject to such option by the copyright holder.
37
 *
38
 * Contributor(s):
39
 *
40
 * Portions Copyrighted 2011 Sun Microsystems, Inc.
41
 */
42
43
package org.netbeans.modules.web.jsfapi.spi.components;
44
45
import java.util.Collection;
46
import java.util.Set;
47
import org.netbeans.api.annotations.common.CheckReturnValue;
48
import org.netbeans.api.annotations.common.NonNull;
49
50
/**
51
 * Provides all {@link JsfComponentImplementation}s in given {@link JsfComponentProvider}.
52
 * JSF Support searches in registered {@link JsfComponentProvider}s for all 
53
 * {@link JsfComponentImplementation}s to offer them as JSF component libraries.
54
 * 
55
 * <p>
56
 * Every JSF suite module should contain only one {@link JsfComponentProvider} which 
57
 * can return more {@link JsfComponentImplementation}s.
58
 * 
59
 * 
60
 * @author Martin Fousek <marfous@netbeans.org>
61
 * 
62
 * @since 1.7
63
 */
64
public interface JsfComponentProvider {
65
66
    public static final String COMPONENTS_PATH = "j2ee/jsf/components";    //NOI18N
67
    
68
    /**
69
     * Get all registered {@link JsfComponentImplementation}s  contained in the module.
70
     * 
71
     * @return a set of registered {@link JsfComponentImplementation}s; never null.
72
     */
73
    @NonNull
74
    @CheckReturnValue
75
    public Collection<JsfComponentImplementation> getJsfComponents();
76
    
77
}
(-)a/web.primefaces/nbproject/project.xml (-2 / +45 lines)
Lines 6-17 Link Here
6
            <code-name-base>org.netbeans.modules.web.primefaces</code-name-base>
6
            <code-name-base>org.netbeans.modules.web.primefaces</code-name-base>
7
            <module-dependencies>
7
            <module-dependencies>
8
                <dependency>
8
                <dependency>
9
                    <code-name-base>org.netbeans.modules.web.jsf</code-name-base>
9
                    <code-name-base>org.netbeans.api.java.classpath</code-name-base>
10
                    <build-prerequisite/>
10
                    <build-prerequisite/>
11
                    <compile-dependency/>
11
                    <compile-dependency/>
12
                    <run-dependency>
12
                    <run-dependency>
13
                        <release-version>1</release-version>
13
                        <release-version>1</release-version>
14
                        <specification-version>1.19</specification-version>
14
                        <specification-version>1.30</specification-version>
15
                    </run-dependency>
16
                </dependency>
17
                <dependency>
18
                    <code-name-base>org.netbeans.api.web.webmodule</code-name-base>
19
                    <build-prerequisite/>
20
                    <compile-dependency/>
21
                    <run-dependency>
22
                        <specification-version>1.24</specification-version>
23
                    </run-dependency>
24
                </dependency>
25
                <dependency>
26
                    <code-name-base>org.netbeans.modules.java.project</code-name-base>
27
                    <build-prerequisite/>
28
                    <compile-dependency/>
29
                    <run-dependency>
30
                        <release-version>1</release-version>
31
                        <specification-version>1.39</specification-version>
32
                    </run-dependency>
33
                </dependency>
34
                <dependency>
35
                    <code-name-base>org.netbeans.modules.project.libraries</code-name-base>
36
                    <build-prerequisite/>
37
                    <compile-dependency/>
38
                    <run-dependency>
39
                        <release-version>1</release-version>
40
                        <specification-version>1.30</specification-version>
15
                    </run-dependency>
41
                    </run-dependency>
16
                </dependency>
42
                </dependency>
17
                <dependency>
43
                <dependency>
Lines 21-26 Link Here
21
                    </run-dependency>
47
                    </run-dependency>
22
                </dependency>
48
                </dependency>
23
                <dependency>
49
                <dependency>
50
                    <code-name-base>org.netbeans.modules.web.jsfapi</code-name-base>
51
                    <build-prerequisite/>
52
                    <compile-dependency/>
53
                    <run-dependency>
54
                        <release-version>1</release-version>
55
                        <specification-version>1.7</specification-version>
56
                    </run-dependency>
57
                </dependency>
58
                <dependency>
59
                    <code-name-base>org.openide.filesystems</code-name-base>
60
                    <build-prerequisite/>
61
                    <compile-dependency/>
62
                    <run-dependency>
63
                        <specification-version>7.48</specification-version>
64
                    </run-dependency>
65
                </dependency>
66
                <dependency>
24
                    <code-name-base>org.openide.util</code-name-base>
67
                    <code-name-base>org.openide.util</code-name-base>
25
                    <build-prerequisite/>
68
                    <build-prerequisite/>
26
                    <compile-dependency/>
69
                    <compile-dependency/>
(-)b39c30857a82 (+124 lines)
Added Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 2011 Oracle and/or its affiliates. All rights reserved.
5
 *
6
 * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
7
 * Other names may be trademarks of their respective owners.
8
 *
9
 * The contents of this file are subject to the terms of either the GNU
10
 * General Public License Version 2 only ("GPL") or the Common
11
 * Development and Distribution License("CDDL") (collectively, the
12
 * "License"). You may not use this file except in compliance with the
13
 * License. You can obtain a copy of the License at
14
 * http://www.netbeans.org/cddl-gplv2.html
15
 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
16
 * specific language governing permissions and limitations under the
17
 * License.  When distributing the software, include this License Header
18
 * Notice in each file and include the License file at
19
 * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
20
 * particular file as subject to the "Classpath" exception as provided
21
 * by Oracle in the GPL Version 2 section of the License file that
22
 * accompanied this code. If applicable, add the following below the
23
 * License Header, with the fields enclosed by brackets [] replaced by
24
 * your own identifying information:
25
 * "Portions Copyrighted [year] [name of copyright owner]"
26
 *
27
 * If you wish your version of this file to be governed by only the CDDL
28
 * or only the GPL Version 2, indicate your decision by adding
29
 * "[Contributor] elects to include this software in this distribution
30
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
31
 * single choice of license, a recipient has the option to distribute
32
 * your version of this file under either the CDDL, the GPL Version 2 or
33
 * to extend the choice of license to its licensees as provided above.
34
 * However, if you add GPL Version 2 code and therefore, elected the GPL
35
 * Version 2 license, then the option applies only if the new code is
36
 * made subject to such option by the copyright holder.
37
 *
38
 * Contributor(s):
39
 *
40
 * Portions Copyrighted 2011 Sun Microsystems, Inc.
41
 */
42
package org.netbeans.modules.web.primefaces;
43
44
import java.io.IOException;
45
import java.util.Collections;
46
import java.util.Set;
47
import java.util.logging.Level;
48
import java.util.logging.Logger;
49
import javax.swing.event.ChangeListener;
50
import org.netbeans.api.java.classpath.ClassPath;
51
import org.netbeans.api.java.project.classpath.ProjectClassPathModifier;
52
import org.netbeans.api.project.libraries.Library;
53
import org.netbeans.api.project.libraries.LibraryManager;
54
import org.netbeans.modules.web.api.webmodule.WebModule;
55
import org.netbeans.modules.web.jsfapi.spi.components.JsfComponentImplementation;
56
import org.netbeans.modules.web.jsfapi.api.JSFVersion;
57
import org.netbeans.modules.web.jsfapi.spi.components.JsfComponentCustomizer;
58
import org.openide.filesystems.FileObject;
59
import org.openide.util.NbBundle;
60
61
/**
62
 *
63
 * @author Martin Fousek <marfous@netbeans.org>
64
 */
65
public class Primefaces2Implementation implements JsfComponentImplementation {
66
67
    private final String name;
68
    private final String description;
69
    
70
    private static final Logger LOGGER = Logger.getLogger(Primefaces2Implementation.class.getName());
71
    private static final String PRIMEFACES_SPECIFIC_CLASS = "org.primefaces.application.PrimeResource"; //NOI18N
72
    private static final String PRIMEFACES_LIBRARY_NAME = "primefaces"; //NOI18N
73
    
74
    public Primefaces2Implementation() {
75
        this.name = NbBundle.getMessage(PrimefacesProvider.class, "LBL_PrimeFaces");  //NOI18N
76
        this.description = NbBundle.getMessage(PrimefacesProvider.class, "LBL_PrimeFaces_Description"); //NOI18N
77
    }
78
79
    @Override
80
    public String getName() {
81
        return name;
82
    }
83
84
    @Override
85
    public String getDescription() {
86
        return description;
87
    }
88
89
    @Override
90
    public Set<FileObject> extend(WebModule webModule) {
91
        try {
92
            ProjectClassPathModifier.addLibraries(
93
                    new Library[]{ LibraryManager.getDefault().getLibrary(PRIMEFACES_LIBRARY_NAME) }, 
94
                    webModule.getJavaSources()[0], 
95
                    ClassPath.COMPILE);
96
        } catch (IOException ex) {
97
            LOGGER.log(Level.WARNING, "Exception during extending an web project", ex); //NOI18N
98
        } catch (UnsupportedOperationException ex) {
99
            LOGGER.log(Level.WARNING, "Exception during extending an web project", ex); //NOI18N
100
        }
101
        return Collections.<FileObject>emptySet();
102
    }
103
104
    @Override
105
    public JSFVersion getJsfVersion() {
106
        return JSFVersion.JSF_2_0;
107
    }
108
109
    @Override
110
    public boolean isInWebModule(WebModule webModule) {
111
        ClassPath classpath = ClassPath.getClassPath(webModule.getDocumentBase(), ClassPath.COMPILE);
112
        return classpath.findResource(PRIMEFACES_SPECIFIC_CLASS.replace('.', '/') + ".class") != null; //NOI18N
113
    }
114
115
    @Override
116
    public JsfComponentCustomizer getJsfComponentCustomizer(boolean initialize, WebModule webModule) {
117
        return null;
118
    }
119
120
    @Override
121
    public void remove(WebModule wm) {
122
    }
123
    
124
}
(-)a/web.primefaces/src/org/netbeans/modules/web/primefaces/PrimefacesProvider.java (-26 / +5 lines)
Lines 43-83 Link Here
43
43
44
import java.util.Collections;
44
import java.util.Collections;
45
import java.util.Set;
45
import java.util.Set;
46
import org.netbeans.modules.web.jsf.api.components.JsfComponentDescriptor;
46
import org.netbeans.modules.web.jsfapi.spi.components.JsfComponentImplementation;
47
import org.netbeans.modules.web.jsf.api.facesmodel.JSFVersion;
47
import org.netbeans.modules.web.jsfapi.spi.components.JsfComponentProvider;
48
import org.netbeans.modules.web.jsf.spi.components.JsfComponentProvider;
49
import org.openide.util.NbBundle;
50
48
51
/**
49
/**
52
 *
50
 *
53
 * @author alexey butenko
51
 * @author Martin Fousek <marfous@netbeans.org>
54
 */
52
 */
55
public class PrimefacesProvider implements JsfComponentProvider {
53
public class PrimefacesProvider implements JsfComponentProvider {
56
54
57
    private final static String NS_PREFIX = "p";    //NOI18N
58
    private final static String NAMESPACE = "http://primefaces.prime.com.tr/ui"; //NOI18N
59
55
60
    @Override
56
    @Override
61
    public Set<JsfComponentDescriptor> getComponents() {
57
    public Set<JsfComponentImplementation> getJsfComponents() {
62
        JsfComponentDescriptor descriptor = new JsfComponentDescriptor(NbBundle.getMessage(PrimefacesProvider.class, "LBL_Library_Name"),
58
        JsfComponentImplementation descriptor = new Primefaces2Implementation();
63
                NbBundle.getMessage(PrimefacesProvider.class, "LBL_PrimeFaces"), JSFVersion.JSF_2_0,
64
                NbBundle.getMessage(PrimefacesProvider.class, "LBL_PrimeFaces_Description"), getWelcomeMessageBody(), getNamespace(), getNsPrefix());
65
        return Collections.singleton(descriptor);
59
        return Collections.singleton(descriptor);
66
    }
60
    }
67
61
68
    private static String getWelcomeMessageBody() {
69
        String body = "<h:form><" + NS_PREFIX +":commandButton value=\"Hello from PrimeFaces\" onclick=\"dlg1.show();\" type=\"button\" />"
70
                + "<" + NS_PREFIX +":dialog header=\"PrimeFaces Dialog\" widgetVar=\"dlg1\" width=\"500\">"
71
                + "For more information visit <a href=\"http://primefaces.org\">http://primefaces.org</a>."
72
                + "</" + NS_PREFIX +":dialog></h:form>";
73
        return body;
74
    }
75
76
    private static String getNamespace() {
77
        return NAMESPACE; //NOI18N
78
    }
79
80
    private static String getNsPrefix() {
81
        return NS_PREFIX;
82
    }
83
}
62
}
(-)a/web.primefaces/src/org/netbeans/modules/web/primefaces/resources/Bundle.properties (-1 / +1 lines)
Lines 1-7 Link Here
1
OpenIDE-Module-Display-Category=Java Web and EE
1
OpenIDE-Module-Display-Category=Java Web and EE
2
OpenIDE-Module-Name=PrimeFaces
2
OpenIDE-Module-Name=PrimeFaces
3
OpenIDE-Module-Long-Description=\
3
OpenIDE-Module-Long-Description=\
4
    This module bundles PrimeFaces components, that can be used with JavaServer Faces.
4
        This module bundles PrimeFaces JSF suite, that can be used with JavaServer Faces.
5
OpenIDE-Module-Short-Description=PrimeFaces
5
OpenIDE-Module-Short-Description=PrimeFaces
6
6
7
# library display name
7
# library display name

Return to bug 200258