Author: jfuerth
Date: Fri Jun 12 09:49:22 2009
New Revision: 3087

Modified:
    trunk/src/ca/sqlpower/architect/swingui/ASUtils.java

Log:
Fixed bug reported by Benjamin in the forum: when you hit the Properties  
button on the forward engineering dialog then hit OK without renaming the  
data source, it tells you the data source already exists (and refuses to  
close the dialog).

Now it works as expected (it's not picky about the name).

I also cleaned up a generics warning in an unrelated method. (tsk tsk)

Modified: trunk/src/ca/sqlpower/architect/swingui/ASUtils.java
==============================================================================
--- trunk/src/ca/sqlpower/architect/swingui/ASUtils.java        (original)
+++ trunk/src/ca/sqlpower/architect/swingui/ASUtils.java        Fri Jun 12  
09:49:22 2009
@@ -163,7 +163,7 @@
              final ArchitectSwingSession session,
              final JComboBox targetDB) {

-        JDialog d = showDbcsDialog(parentWindow,  
session.getTargetDatabase().getDataSource(), null);
+        JDialog d = showDbcsDialog(parentWindow,  
session.getTargetDatabase().getDataSource(), null, false);

          d.addWindowListener(new WindowAdapter(){
                  public void windowClosed(WindowEvent e){
@@ -174,6 +174,26 @@
      }

      /**
+     * Works like the 4-argument version of showDbcsDialog where the last  
argument
+     * (enforceUniqueName) is true.
+     *
+     * @param parentWindow
+     *            The window that owns the dialog
+     * @param dataSource
+     *            the data source to edit (null not allowed)
+     * @param onAccept
+     *            this runnable will be invoked if the user OKs the dialog  
and
+     *            validation succeeds. If you don't need to do anything in  
this
+     *            situation, just pass in null for this parameter.
+     */
+    public static JDialog showDbcsDialog(
+            Window parentWindow,
+            JDBCDataSource dataSource,
+            final Runnable onAccept) {
+        return showDbcsDialog(parentWindow, dataSource, onAccept, true);
+    }
+
+    /**
       * Pops up a dialog box that lets the user inspect and change the  
given db's
       * connection spec.
       *
@@ -185,13 +205,19 @@
       *            this runnable will be invoked if the user OKs the dialog  
and
       *            validation succeeds. If you don't need to do anything in  
this
       *            situation, just pass in null for this parameter.
+     * @param enforceUniqueName
+     *            controls whether or not the dialog will apply its  
changes when
+     *            the new name for the data source is the same as some  
other
+     *            name in the session context's list of data sources. You  
almost always
+     *            want this to be true.
       */
      public static JDialog showDbcsDialog(
              Window parentWindow,
              JDBCDataSource dataSource,
-            final Runnable onAccept) {
-
-        final DataEntryPanel dbcsPanel =  
createDataSourceOptionsPanel(dataSource);
+            final Runnable onAccept,
+            boolean enforceUniqueName) {
+
+        final DataEntryPanel dbcsPanel =  
createDataSourceOptionsPanel(dataSource, enforceUniqueName);

          Callable<Boolean> okCall = new Callable<Boolean>() {
              public Boolean call() {
@@ -226,13 +252,20 @@
      }

      /**
-     * Creates a tabbed panel for editing various aspects of the given  
data source.
-     * Currently, the tabs are for General Options and Kettle Options.
+     * Creates a tabbed panel for editing various aspects of the given data
+     * source. Currently, the tabs are for General Options and Kettle  
Options.
       *
-     * @param ds The data source to edit
+     * @param ds
+     *            The data source to edit
+     * @param enforceUniqueName
+     *            controls whether or not the dialog will apply its  
changes when
+     *            the new name for the data source is the same as some  
other
+     *            name in the session context's list of data sources. You  
almost
+     *            always want this to be true.
       */
-    public static DataEntryPanel  
createDataSourceOptionsPanel(JDBCDataSource ds) {
+    public static DataEntryPanel  
createDataSourceOptionsPanel(JDBCDataSource ds, boolean enforceUniqueName) {
          final JDBCDataSourcePanel generalPanel = new  
JDBCDataSourcePanel(ds);
+        generalPanel.setEnforcingUniqueName(enforceUniqueName);
          final KettleDataSourceOptionsPanel kettlePanel = new  
KettleDataSourceOptionsPanel(ds);

          TabbedDataEntryPanel p = new TabbedDataEntryPanel();
@@ -256,11 +289,11 @@
        }

        /**
-        *
-        *
-        */
-       public static List <Point2D.Double> getIntersectPoints(Shape s1, Shape  
s2) {
-               List <Point2D.Double>list   = new ArrayList();
+     * Returns a list of all the points where line segments of the shapes  
s1 and
+     * s2 intersect.
+     */
+       public static List<Point2D.Double> getIntersectPoints(Shape s1, Shape 
s2)  
{
+               List<Point2D.Double> list = new ArrayList<Point2D.Double>();
                PathIterator myPI = s1.getPathIterator(null);
                Line2D.Double myLine = new Line2D.Double();
                float[] myCoords = new float[6];

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Architect Commits" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/architect-commits?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to