Please use the Apache issue tracking system for new NetBeans issues (https://issues.apache.org/jira/projects/NETBEANS0/issues) !!
Bug 125070 - SpringWebFrameworkProvider uses deprecated code
SpringWebFrameworkProvider uses deprecated code
Status: RESOLVED FIXED
Product: javaee
Classification: Unclassified
Component: Spring
5.x
All All
: P2 (vote)
: 6.x
Assigned To: John Baker
issues@javaee
:
Depends on:
Blocks: 123600
  Show dependency treegraph
 
Reported: 2008-01-10 22:55 UTC by John Baker
Modified: 2008-01-14 07:25 UTC (History)
0 users

See Also:
Issue Type: ENHANCEMENT
:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description John Baker 2008-01-10 22:55:27 UTC
FrameworkConfigurationPanel and getConfiguration are deprecated.

Instead use WebModuleExtender APIs through the SpringConfigPanel

This will require some rearchitecture of SpringWebFrameworkProvider, SpringConfigPanel, SpringConfigPanelVisual

The first part will be to update the framework provider to use the current APIs and setup the correct constructor for 
SpringConfigPanelVisual.
Remaining work on the framework provider (support JSTL and Help, ...)  will be covered by the task 125069
Comment 1 John Baker 2008-01-14 06:52:43 UTC
Fixed.  I'll add the changelog once available
Comment 2 John Baker 2008-01-14 07:25:27 UTC
changes:

Directory: /web/spring/webmvc/src/org/netbeans/modules/spring/webmvc/
=====================================================================

File [changed]: SpringConfigPanel.java
Url:
http://web.netbeans.org/source/browse/web/spring/webmvc/src/org/netbeans/modules/spring/webmvc/SpringConfigPanel.java?r1=1.7&r2=1.8
Delta lines:  +29 -5
--------------------
--- SpringConfigPanel.java	12 Jan 2008 16:28:01 -0000	1.7
+++ SpringConfigPanel.java	14 Jan 2008 06:45:24 -0000	1.8
@@ -43,10 +43,13 @@
 
 package org.netbeans.modules.spring.webmvc;
 
-import java.awt.Component;
+import java.util.Set;
 import javax.swing.event.ChangeEvent;
 import javax.swing.event.ChangeListener;
-import org.netbeans.modules.web.spi.webmodule.FrameworkConfigurationPanel;
+import org.netbeans.modules.web.api.webmodule.ExtenderController;
+import org.netbeans.modules.web.api.webmodule.WebModule;
+import org.netbeans.modules.web.spi.webmodule.WebModuleExtender;
+import org.openide.filesystems.FileObject;
 import org.openide.util.HelpCtx;
 
 /**
@@ -54,12 +57,22 @@
  *
  * @author Craig MacKay
  */
-public class SpringConfigPanel implements FrameworkConfigurationPanel, ChangeListener {
+public class SpringConfigPanel extends WebModuleExtender implements ChangeListener {
 
     private SpringConfigPanelVisual frameworkPanelVisual;
-
+    private final SpringWebFrameworkProvider framework;
+    private final ExtenderController controller;
     private String dispatcherName = "dispatcher"; // NOI18N
     private String dispatcherMapping = "*.htm"; // NOI18N
+    private boolean customizer;
+    
+     /** Creates a new instance of JSFConfigurationPanel */
+    public SpringConfigPanel(SpringWebFrameworkProvider framework, ExtenderController controller, boolean customizer) {
+        this.framework = framework;
+        this.controller = controller;
+        this.customizer = customizer;
+        getComponent();
+    }
 
     public String getDispatcherName() {
         return dispatcherName;
@@ -75,7 +88,7 @@
         }
     }
 
-    public Component getComponent() {
+    public SpringConfigPanelVisual getComponent() {
         if (frameworkPanelVisual == null) {
             frameworkPanelVisual = new SpringConfigPanelVisual(this);
         }
@@ -106,4 +119,15 @@
         dispatcherName = frameworkPanelVisual.getDispatcherName();
         dispatcherMapping = frameworkPanelVisual.getDispatcherMapping();
     }
+    
+    @Override
+    public void update() {
+       // not used yet
+    }
+
+    @Override
+    public Set<FileObject> extend(WebModule webModule) {
+        return framework.extendImpl(webModule);
+    }
+   
 }

File [changed]: SpringWebFrameworkProvider.java
Url:
http://web.netbeans.org/source/browse/web/spring/webmvc/src/org/netbeans/modules/spring/webmvc/SpringWebFrameworkProvider.java?r1=1.8&r2=1.9
Delta lines:  +17 -23
---------------------
--- SpringWebFrameworkProvider.java	13 Jan 2008 20:07:08 -0000	1.8
+++ SpringWebFrameworkProvider.java	14 Jan 2008 06:45:24 -0000	1.9
@@ -68,9 +68,10 @@
 import org.netbeans.modules.j2ee.dd.api.web.ServletMapping;
 import org.netbeans.modules.j2ee.dd.api.web.WebApp;
 import org.netbeans.modules.j2ee.dd.api.web.WelcomeFileList;
+import org.netbeans.modules.web.api.webmodule.ExtenderController;
 import org.netbeans.modules.web.api.webmodule.WebModule;
-import org.netbeans.modules.web.spi.webmodule.FrameworkConfigurationPanel;
 import org.netbeans.modules.web.spi.webmodule.WebFrameworkProvider;
+import org.netbeans.modules.web.spi.webmodule.WebModuleExtender;
 import org.openide.ErrorManager;
 import org.openide.filesystems.FileLock;
 import org.openide.filesystems.FileObject;
@@ -98,20 +99,20 @@
         super(NbBundle.getMessage(SpringWebFrameworkProvider.class, "LBL_FrameworkName"),
NbBundle.getMessage(SpringWebFrameworkProvider.class, "LBL_FrameworkDescription"));
     }
 
-    @Override
-    public Set extend(WebModule webModule) {
-        EnableFrameworkAction enableFrameworkAction = new EnableFrameworkAction(webModule,
getSpringConfigPanel(webModule));
+    // not named extend() so as to avoid implementing WebFrameworkProvider.extend()
+    public Set<FileObject> extendImpl(WebModule webModule) {
+        CreateSpringConfig createSpringConfig = new CreateSpringConfig(webModule);
         FileObject webInf = webModule.getWebInf();
         if (webInf != null) {
             try {
                 FileSystem fs = webInf.getFileSystem();
-                fs.runAtomicAction(enableFrameworkAction);
+                fs.runAtomicAction(createSpringConfig);
             } catch (IOException e) {
                 ErrorManager.getDefault().notify(e);
                 return null;
             }
         }        
-        return enableFrameworkAction.getFilesToOpen();
+        return createSpringConfig.getFilesToOpen();
     }
 
     @Override
@@ -143,15 +144,10 @@
         return files.toArray(new java.io.File[0]);
     }
 
-    @Override
-    public FrameworkConfigurationPanel getConfigurationPanel(WebModule webModule) {
-        return getSpringConfigPanel(webModule);
-    }
-
-    protected SpringConfigPanel getSpringConfigPanel(WebModule webModule) {
-        if (panel == null) {
-            panel = new SpringConfigPanel();
-        }
+    public WebModuleExtender createWebModuleExtender(WebModule webModule, ExtenderController controller) {
+        boolean defaultValue = (webModule == null || !isInWebModule(webModule));
+        panel = new SpringConfigPanel(this, controller, !defaultValue);
+        // may need to use panel for setting an extended configuration
         return panel;
     }
 
@@ -163,15 +159,13 @@
         return DDProvider.getDefault().getDDRootCopy(webModule.getDeploymentDescriptor());
     }
 
-    private class EnableFrameworkAction implements FileSystem.AtomicAction {
+    private class CreateSpringConfig implements FileSystem.AtomicAction {
 
         private Set<FileObject> filesToOpen = new LinkedHashSet<FileObject>();
         private WebModule webModule;
-        private SpringConfigPanel frameworkPanel;
 
-        public EnableFrameworkAction(WebModule webModule, SpringConfigPanel frameworkPanel) {
+        public CreateSpringConfig(WebModule webModule) {
             this.webModule = webModule;
-            this.frameworkPanel = frameworkPanel;
         }
 
         public void run() throws IOException {
@@ -180,7 +174,7 @@
             WebApp ddRoot = DDProvider.getDefault().getDDRoot(dd);
             addContextParam(ddRoot, "contextConfigLocation", "/WEB-INF/applicationContext.xml"); // NOI18N
             addListener(ddRoot, CONTEXT_LOADER);
-            addServlet(ddRoot, frameworkPanel.getDispatcherName(), DISPATCHER_SERVLET,
frameworkPanel.getDispatcherMapping(), "2"); // NOI18N
+            addServlet(ddRoot, panel.getDispatcherName(), DISPATCHER_SERVLET, panel.getDispatcherMapping(), "2"); // NOI18N
             WelcomeFileList welcomeFiles = ddRoot.getSingleWelcomeFileList();
             if (welcomeFiles == null) {
                 try {
@@ -209,7 +203,7 @@
             copyResource("footer.jsp", FileUtil.createData(jsp, "footer.jsp")); // NOI18N
             copyResource("jdbc.properties", FileUtil.createData(webInf, "jdbc.properties")); // NOI18N
             addFileToOpen(copyResource("applicationContext.xml", FileUtil.createData(webInf,
"applicationContext.xml"))); // NOI18N
-            addFileToOpen(copyResource("dispatcher-servlet.xml", FileUtil.createData(webInf,
frameworkPanel.getDispatcherName() + "-servlet.xml"))); // NOI18N
+            addFileToOpen(copyResource("dispatcher-servlet.xml", FileUtil.createData(webInf, panel.getDispatcherName()
+ "-servlet.xml"))); // NOI18N
 
             // MODIFY EXISTING INDEX.JSP
             FileObject documentBase = webModule.getDocumentBase();




By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo