1.1 --- a/sql.wizard/src/org/netbeans/modules/jdbcwizard/wizards/JNDINameFinishPanel.java Thu Feb 12 17:33:14 2009 +0100
1.2 +++ b/sql.wizard/src/org/netbeans/modules/jdbcwizard/wizards/JNDINameFinishPanel.java Thu Feb 12 17:12:53 2009 +0100
1.3 @@ -13,13 +13,13 @@
1.4 * "Portions Copyrighted [year] [name of copyright owner]"
1.5 *
1.6 * The Original Software is NetBeans. The Initial Developer of the Original
1.7 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
1.8 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2009 Sun
1.9 * Microsystems, Inc. All Rights Reserved.
1.10 */
1.11
1.12 /*
1.13 *
1.14 - * Copyright 2005 Sun Microsystems, Inc.
1.15 + * Copyright 2009 Sun Microsystems, Inc.
1.16 *
1.17 * Licensed under the Apache License, Version 2.0 (the "License");
1.18 * you may not use this file except in compliance with the License.
1.19 @@ -38,7 +38,6 @@
1.20
1.21 import org.openide.WizardDescriptor;
1.22
1.23 -import javax.swing.event.ChangeListener;
1.24
1.25 /**
1.26 * Extends JNDINameFinishPanel, implementing the interface WizardDescriptor.FinishPanel to allows
1.27 @@ -57,38 +56,6 @@
1.28 super(title);
1.29 }
1.30
1.31 - public void addChangeListener(final ChangeListener l) {
1.32 - super.addChangeListener(l);
1.33 - }
1.34 -
1.35 - /**
1.36 - * @see org.openide.WizardDescriptor.Panel#isValid
1.37 - */
1.38 - public boolean isValid() {
1.39 - return true;
1.40 - }
1.41 -
1.42 - /**
1.43 - * @see JNDINameFinishPanel#readSettings
1.44 - */
1.45 - public void readSettings(final Object settings) {
1.46 - super.readSettings(settings);
1.47 - }
1.48 -
1.49 - /**
1.50 - * @see JNDINameFinishPanel#removeChangeListener
1.51 - */
1.52 - public void removeChangeListener(final ChangeListener l) {
1.53 - super.removeChangeListener(l);
1.54 - }
1.55 -
1.56 - /**
1.57 - * @see JNDINameFinishPanel#storeSettings
1.58 - */
1.59 - public void storeSettings(final Object settings) {
1.60 - super.storeSettings(settings);
1.61 - }
1.62 -
1.63 /**
1.64 * @return
1.65 */
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2.2 +++ b/sql.wizard/src/org/netbeans/modules/jdbcwizard/wizards/JNDINameFinishPanelUI.java Thu Feb 12 17:12:53 2009 +0100
2.3 @@ -0,0 +1,65 @@
2.4 +/*
2.5 + * The contents of this file are subject to the terms of the Common Development
2.6 + * and Distribution License (the License). You may not use this file except in
2.7 + * compliance with the License.
2.8 + *
2.9 + * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
2.10 + * or http://www.netbeans.org/cddl.txt.
2.11 + *
2.12 + * When distributing Covered Code, include this CDDL Header Notice in each file
2.13 + * and include the License file at http://www.netbeans.org/cddl.txt.
2.14 + * If applicable, add the following below the CDDL Header, with the fields
2.15 + * enclosed by brackets [] replaced by your own identifying information:
2.16 + * "Portions Copyrighted [year] [name of copyright owner]"
2.17 + *
2.18 + * The Original Software is NetBeans. The Initial Developer of the Original
2.19 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2009 Sun
2.20 + * Microsystems, Inc. All Rights Reserved.
2.21 + */
2.22 +
2.23 +/*
2.24 + *
2.25 + * Copyright 2009 Sun Microsystems, Inc.
2.26 + *
2.27 + * Licensed under the Apache License, Version 2.0 (the "License");
2.28 + * you may not use this file except in compliance with the License.
2.29 + * You may obtain a copy of the License at
2.30 + *
2.31 + * http://www.apache.org/licenses/LICENSE-2.0
2.32 + *
2.33 + * Unless required by applicable law or agreed to in writing, software
2.34 + * distributed under the License is distributed on an "AS IS" BASIS,
2.35 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2.36 + * See the License for the specific language governing permissions and
2.37 + * limitations under the License.
2.38 + *
2.39 + */
2.40 +package org.netbeans.modules.jdbcwizard.wizards;
2.41 +
2.42 +import org.openide.WizardDescriptor;
2.43 +
2.44 +
2.45 +/**
2.46 + * Extends JNDINameFinishPanel, implementing the interface WizardDescriptor.FinishPanel to allows
2.47 + * its containing wizard to enable the "Finish" button.
2.48 + *
2.49 + * @author npedapudi
2.50 + */
2.51 +public class JNDINameFinishPanelUI extends JNDINamePanel implements WizardDescriptor.FinishablePanel {
2.52 +
2.53 + /**
2.54 + *
2.55 + */
2.56 + private static final long serialVersionUID = 1L;
2.57 +
2.58 + public JNDINameFinishPanelUI(final String title) {
2.59 + super(title);
2.60 + }
2.61 +
2.62 + /**
2.63 + * @return
2.64 + */
2.65 + public boolean isFinishPanel() {
2.66 + return true;
2.67 + }
2.68 +}
3.1 --- a/sql.wizard/src/org/netbeans/modules/jdbcwizard/wizards/JNDINamePanel.java Thu Feb 12 17:33:14 2009 +0100
3.2 +++ b/sql.wizard/src/org/netbeans/modules/jdbcwizard/wizards/JNDINamePanel.java Thu Feb 12 17:12:53 2009 +0100
3.3 @@ -13,13 +13,13 @@
3.4 * "Portions Copyrighted [year] [name of copyright owner]"
3.5 *
3.6 * The Original Software is NetBeans. The Initial Developer of the Original
3.7 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
3.8 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2009 Sun
3.9 * Microsystems, Inc. All Rights Reserved.
3.10 */
3.11
3.12 /*
3.13 *
3.14 - * Copyright 2005 Sun Microsystems, Inc.
3.15 + * Copyright 2009 Sun Microsystems, Inc.
3.16 *
3.17 * Licensed under the Apache License, Version 2.0 (the "License");
3.18 * you may not use this file except in compliance with the License.
3.19 @@ -38,27 +38,21 @@
3.20 package org.netbeans.modules.jdbcwizard.wizards;
3.21
3.22 import java.awt.Component;
3.23 -import java.awt.Dimension;
3.24 -import java.awt.FlowLayout;
3.25 import java.util.HashSet;
3.26 import java.util.Iterator;
3.27 import java.util.List;
3.28 import java.util.Set;
3.29 import java.util.Arrays;
3.30 import java.io.File;
3.31 -import java.io.FileOutputStream;
3.32
3.33 import javax.swing.event.ChangeListener;
3.34 import javax.swing.event.ChangeEvent;
3.35 -import javax.swing.SwingConstants;
3.36
3.37 import org.openide.NotifyDescriptor;
3.38 import org.openide.WizardDescriptor;
3.39 import org.openide.util.HelpCtx;
3.40
3.41 -import org.openide.util.NbBundle;
3.42
3.43 -import org.netbeans.modules.jdbcwizard.builder.dbmodel.DBColumn;
3.44 import org.netbeans.modules.jdbcwizard.builder.dbmodel.DBTable;
3.45 import org.netbeans.modules.jdbcwizard.builder.util.XMLCharUtil;
3.46 import org.netbeans.modules.jdbcwizard.builder.wsdl.GenerateWSDL;
3.47 @@ -70,52 +64,35 @@
3.48 /**
3.49 * @author npedapudi
3.50 */
3.51 -public class JNDINamePanel extends javax.swing.JPanel implements WizardDescriptor.Panel {
3.52 +public class JNDINamePanel implements WizardDescriptor.Panel {
3.53
3.54 /**
3.55 *
3.56 */
3.57 private static final long serialVersionUID = 1L;
3.58
3.59 - protected final Set listeners = new HashSet(1);
3.60 + protected final Set<ChangeListener> listeners = new HashSet<ChangeListener>(1);
3.61
3.62 private static final String XSD_EXT = ".xsd";
3.63
3.64 - private static final boolean enableNext = false;
3.65 + static final String JNDI_DEFAULT_NAME = "jdbc/__defaultDS";
3.66
3.67 - private static final String JNDI_DEFAULT_NAME = "jdbc/__defaultDS";
3.68 -
3.69 - private static final String CONNECTION_INFO_FILE = "config\\ConnectionInfo.xml";
3.70 + private JNDINamePanelUI comp;
3.71 + private String title;
3.72
3.73 /** Creates new form JNDINamePanel */
3.74 public JNDINamePanel(final String title) {
3.75 - if (title != null && title.trim().length() != 0) {
3.76 - this.setName(title);
3.77 - }
3.78 - this.initComponents();
3.79 - }
3.80 -
3.81 - /**
3.82 - * intializes the components
3.83 - */
3.84 - private void initComponents() {
3.85 - this.jLabel1 = new javax.swing.JLabel();
3.86 - this.jTextField1 = new javax.swing.JTextField();
3.87 - this.jTextField1.setText(JNDINamePanel.JNDI_DEFAULT_NAME);
3.88 - this.jLabel1.setText(NbBundle.getMessage(JDBCWizardTablePanel.class,"LBL_JNDI_NAME"));
3.89 - this.jLabel1.setHorizontalAlignment(SwingConstants.RIGHT);
3.90 -
3.91 - this.setLayout(new FlowLayout());
3.92 - this.add(jLabel1);
3.93 - this.add(jTextField1);
3.94 - //this.jTextField1.setPreferredSize(new Dimension((3*jLabel1.getWidth()),jLabel1.getHeight()));
3.95 + this.title = title;
3.96 }
3.97
3.98 /**
3.99 * @return
3.100 */
3.101 public Component getComponent() {
3.102 - return this;
3.103 + if (comp == null) {
3.104 + comp = new JNDINamePanelUI (title);
3.105 + }
3.106 + return comp;
3.107 }
3.108
3.109 /**
3.110 @@ -174,7 +151,10 @@
3.111 if (isAdvancingPanel) {
3.112 final Object[] listObj = (Object[]) wd.getProperty(JDBCWizardContext.SELECTEDTABLES);
3.113 final List list = Arrays.asList(listObj);
3.114 - final String jndiName = this.jTextField1.getText().trim();
3.115 + if (comp == null) {
3.116 + getComponent ();
3.117 + }
3.118 + final String jndiName = comp.jTextField1.getText().trim();
3.119 try {
3.120 final XSDGenerator xsdGen = new XSDGenerator();
3.121 final String targetFolderPath = (String) wd.getProperty(JDBCWizardContext.TARGETFOLDER_PATH);
3.122 @@ -238,7 +218,7 @@
3.123 Iterator it;
3.124
3.125 synchronized (this.listeners) {
3.126 - it = new HashSet(this.listeners).iterator();
3.127 + it = new HashSet<ChangeListener>(this.listeners).iterator();
3.128 }
3.129
3.130 final ChangeEvent ev = new ChangeEvent(this);
3.131 @@ -251,17 +231,7 @@
3.132 * @see org.openide.WizardDescriptor.Panel#isValid
3.133 */
3.134 public boolean isValid() {
3.135 - if (this.enableNext) {
3.136 - return true;
3.137 - }
3.138 -
3.139 - return super.isValid();
3.140 + return true;
3.141 }
3.142
3.143 - // Variables declaration - do not modify
3.144 - private javax.swing.JLabel jLabel1;
3.145 -
3.146 - private javax.swing.JTextField jTextField1;
3.147 - // End of variables declaration
3.148 -
3.149 }
4.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
4.2 +++ b/sql.wizard/src/org/netbeans/modules/jdbcwizard/wizards/JNDINamePanelUI.java Thu Feb 12 17:12:53 2009 +0100
4.3 @@ -0,0 +1,99 @@
4.4 +/*
4.5 + * The contents of this file are subject to the terms of the Common Development
4.6 + * and Distribution License (the License). You may not use this file except in
4.7 + * compliance with the License.
4.8 + *
4.9 + * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
4.10 + * or http://www.netbeans.org/cddl.txt.
4.11 + *
4.12 + * When distributing Covered Code, include this CDDL Header Notice in each file
4.13 + * and include the License file at http://www.netbeans.org/cddl.txt.
4.14 + * If applicable, add the following below the CDDL Header, with the fields
4.15 + * enclosed by brackets [] replaced by your own identifying information:
4.16 + * "Portions Copyrighted [year] [name of copyright owner]"
4.17 + *
4.18 + * The Original Software is NetBeans. The Initial Developer of the Original
4.19 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2009 Sun
4.20 + * Microsystems, Inc. All Rights Reserved.
4.21 + */
4.22 +
4.23 +/*
4.24 + *
4.25 + * Copyright 2009 Sun Microsystems, Inc.
4.26 + *
4.27 + * Licensed under the Apache License, Version 2.0 (the "License");
4.28 + * you may not use this file except in compliance with the License.
4.29 + * You may obtain a copy of the License at
4.30 + *
4.31 + * http://www.apache.org/licenses/LICENSE-2.0
4.32 + *
4.33 + * Unless required by applicable law or agreed to in writing, software
4.34 + * distributed under the License is distributed on an "AS IS" BASIS,
4.35 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4.36 + * See the License for the specific language governing permissions and
4.37 + * limitations under the License.
4.38 + *
4.39 + */
4.40 +
4.41 +package org.netbeans.modules.jdbcwizard.wizards;
4.42 +
4.43 +import java.awt.FlowLayout;
4.44 +
4.45 +import javax.swing.SwingConstants;
4.46 +
4.47 +import org.openide.util.HelpCtx;
4.48 +
4.49 +import org.openide.util.NbBundle;
4.50 +
4.51 +
4.52 +
4.53 +
4.54 +/**
4.55 + * @author npedapudi
4.56 + */
4.57 +public class JNDINamePanelUI extends javax.swing.JPanel {
4.58 +
4.59 + /**
4.60 + *
4.61 + */
4.62 + private static final long serialVersionUID = 1L;
4.63 +
4.64 + /** Creates new form JNDINamePanel */
4.65 + public JNDINamePanelUI(final String title) {
4.66 + if (title != null && title.trim().length() != 0) {
4.67 + this.setName(title);
4.68 + }
4.69 + this.initComponents();
4.70 + }
4.71 +
4.72 + /**
4.73 + * intializes the components
4.74 + */
4.75 + private void initComponents() {
4.76 + this.jLabel1 = new javax.swing.JLabel();
4.77 + this.jTextField1 = new javax.swing.JTextField();
4.78 + this.jTextField1.setText(JNDINamePanel.JNDI_DEFAULT_NAME);
4.79 + this.jLabel1.setText(NbBundle.getMessage(JDBCWizardTablePanel.class,"LBL_JNDI_NAME"));
4.80 + this.jLabel1.setHorizontalAlignment(SwingConstants.RIGHT);
4.81 +
4.82 + this.setLayout(new FlowLayout());
4.83 + this.add(jLabel1);
4.84 + this.add(jTextField1);
4.85 + //this.jTextField1.setPreferredSize(new Dimension((3*jLabel1.getWidth()),jLabel1.getHeight()));
4.86 + }
4.87 +
4.88 + /**
4.89 + * @return
4.90 + */
4.91 + public HelpCtx getHelp() {
4.92 + // Show no Help button for this panel:
4.93 + return new HelpCtx(JNDINamePanelUI.class);
4.94 + }
4.95 +
4.96 + // Variables declaration - do not modify
4.97 + javax.swing.JLabel jLabel1;
4.98 +
4.99 + javax.swing.JTextField jTextField1;
4.100 + // End of variables declaration
4.101 +
4.102 +}