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

(-)139218b2d458 (+121 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
47
48
/**
49
 * Provides support for extending a JSF framework with a JSF component library.
50
 * It allows to modify the web module to make use of the JSF suite in JSF framework. 
51
 * 
52
 * @author Martin Fousek <marfous@netbeans.org>
53
 * 
54
 * @since 1.7
55
 */
56
public interface JsfComponentCustomizer {
57
58
    /**
59
     * Attaches a change listener that is to be notified of changes
60
     * in the customizer (e.g., the result of the {@link #isValid} method
61
     * has changed).
62
     *
63
     * @param  listener a listener.
64
     */
65
    public void addChangeListener(ChangeListener listener);
66
67
    /**
68
     * Removes a change listener.
69
     *
70
     * @param  listener a listener.
71
     */    
72
    public void removeChangeListener(ChangeListener listener);
73
74
    /**
75
     * Returns a UI component used to allow the user to update this customizer.
76
     *
77
     * @return a component. This method might be called more than once and it is 
78
     * expected to always return the same instance.
79
     */
80
    public JComponent getComponent();
81
82
    /**
83
     * Checks if this customizer is valid (e.g., if the configuration set
84
     * using the UI component returned by {@link #getComponent} is valid).
85
     * <p>
86
     *
87
     * @return {@code true} if the configuration is valid, {@code false} otherwise.
88
     * @see #getErrorMessage()
89
     * @see #getWarningMessage()
90
     */
91
    public boolean isValid();
92
93
    /**
94
     * Get error message or {@code null} if the {@link #getComponent component} is {@link #isValid() valid}.
95
     * 
96
     * @return error message or {@code null} if the {@link #getComponent component} is {@link #isValid() valid}
97
     * 
98
     * @see #isValid()
99
     * @see #getWarningMessage()
100
     */    
101
    public String getErrorMessage();
102
103
    /**
104
     * Get warning message that can be not {@code null} even for {@link #isValid() valid} customizer.
105
     * In other words, it is safe to extend web module even if this method returns a message.
106
     * 
107
     * @return warning message or {@code null}
108
     * 
109
     * @see #isValid()
110
     * @see #getErrorMessage()
111
     */    
112
    public String getWarningMessage();
113
114
    /**
115
     * Allow to save actual configuration of UI component. 
116
     * <p>
117
     * This method is called after closing component by OK button.
118
     */
119
    public void saveConfiguration();
120
121
}
(-)139218b2d458 (+130 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.modules.web.api.webmodule.WebModule;
47
import org.netbeans.modules.web.jsfapi.api.JSFVersion;
48
import org.openide.filesystems.FileObject;
49
50
/**
51
 * This interface allows providing support for JSF component libraries. It can be used
52
 * to extend a web module and JSF framework with a JSF suite, to find out whether a web
53
 * module is already extended by a JSF component library, or to retrieve a JSF suite's
54
 * specific configuration thru the {@link JsfComponentCustomizer}.
55
 *
56
 * <p>Instances of this class are registered in the {@value 
57
 * org.netbeans.modules.web.jsfapi.spi.components.JsfComponentProvider#COMPONENTS_PATH}
58
 * in the module layer, see {@link Registration}.</p>
59
 * 
60
 * @author Martin Fousek <marfous@netbeans.org>
61
 */
62
public interface JsfComponentImplementation {
63
    
64
    /**
65
     * Returns the name of this JSF component library.
66
     *
67
     * @return the name; never {@code null}.
68
     */    
69
    public String getName();
70
71
    /**
72
     * Returns the description of this JSF component library.
73
     *
74
     * @return the description.
75
     */
76
    public String getDescription();
77
78
    /**
79
     * Called to extend the given web module and JSF framework with the JSF 
80
     * component library corresponding to this implementation.
81
     *
82
     * @param  webModule the web module to be extended; never null.
83
     * @return the set of newly created files in the web module which should be opened.
84
     */
85
    public Set<FileObject> extend(WebModule webModule);
86
    
87
    /**
88
     * Returns for which version is the JSF component library designated. 
89
     * <p>
90
     * By creating new project and choosing JSF framework are JSF suites filtered 
91
     * out according to their {@link JSFVersion}.
92
     * 
93
     * @return {@link JSFVersion} suitable for this JSF component library.
94
     */
95
    public JSFVersion getJsfVersion();
96
    
97
98
    /**
99
     * Finds out if a given web module has already been extended with this JSF component library.
100
     * <p>
101
     * <b>This method should be as fast as possible.</b>
102
     *
103
     * @param webmodule the web module; never {@code null}.
104
     * @return {@code true} if the web module has already been extended with this JSF suite, 
105
     * {@code false} otherwise.
106
     */
107
    public boolean isInWebModule(WebModule webModule);
108
109
    /**
110
     * Creates a {@link JsfComponentCustomizer} for this JSF component
111
     * library.
112
     * <p>
113
     * For new project is called with {@code null} parameter. In project customizer is called for 
114
     * actual {@link WebModule}.
115
     * 
116
     * @param webmodule the web module for which should be customizer adapted; null if the 
117
     * project doesn't exist yet
118
     * @return a new customizer; can be <code>null</code> if the JSF suite doesn't 
119
     * support that and no extending panel should be offered.
120
     */
121
    public JsfComponentCustomizer createJsfComponentCustomizer(WebModule webModule);
122
123
    /**
124
     * Performs actions needed for removal JSF component library form the web module.
125
     *
126
     * @param webModule the web module from which should be JSF component library removed; never null.
127
     */
128
    public void remove(WebModule webModule);
129
    
130
}
(-)139218b2d458 (+72 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.Set;
46
47
/**
48
 * Provides all {@link JsfComponentImplementation}s in given {@link JsfComponentProvider}.
49
 * JSF Support searches in registered {@link JsfComponentProvider}s for all 
50
 * {@link JsfComponentImplementation}s to offer them as JSF component libraries.
51
 * 
52
 * <p>
53
 * Every JSF suite module should contain only one {@link JsfComponentProvider} which 
54
 * can return more {@link JsfComponentImplementation}s.
55
 * 
56
 * 
57
 * @author Martin Fousek <marfous@netbeans.org>
58
 * 
59
 * @since 1.7
60
 */
61
public interface JsfComponentProvider {
62
63
    public static final String COMPONENTS_PATH = "j2ee/jsf/components";    //NOI18N
64
    
65
    /**
66
     * Get all registered {@link JsfComponentImplementation}s  contained in the module.
67
     * 
68
     * @return a set of registered {@link JsfComponentImplementation}s; never null.
69
     */
70
    public Set<JsfComponentImplementation> getJsfDescriptors();
71
    
72
}

Return to bug 200258