Author: ms1279
Date: Mon Apr  6 08:10:44 2009
New Revision: 2974

Modified:
trunk/regress/ca/sqlpower/architect/swingui/TestingArchitectSwingSession.java
   trunk/src/ca/sqlpower/architect/swingui/ArchitectSwingSession.java
   trunk/src/ca/sqlpower/architect/swingui/ArchitectSwingSessionImpl.java
   trunk/src/ca/sqlpower/architect/swingui/BasicTablePaneUI.java
   trunk/src/ca/sqlpower/architect/swingui/PlayPen.java
   trunk/src/ca/sqlpower/architect/swingui/ProjectSettingsPanel.java
   trunk/src/ca/sqlpower/architect/swingui/SwingUIProject.java
   trunk/src/ca/sqlpower/architect/swingui/TableEditPanel.java
   trunk/src/ca/sqlpower/architect/swingui/TablePane.java
   trunk/src/ca/sqlpower/architect/swingui/messages.properties

Log:
Changed method and variable names from 'technical' and 'alias'
names to 'physical' and 'logical' names.

The project now remembers its logical or physical name display settings. New projects have it set by default to display the logical names. The playpen updates the table panes whenever the user changes his name display settings.

Modified: trunk/regress/ca/sqlpower/architect/swingui/TestingArchitectSwingSession.java
==============================================================================
--- trunk/regress/ca/sqlpower/architect/swingui/TestingArchitectSwingSession.java (original) +++ trunk/regress/ca/sqlpower/architect/swingui/TestingArchitectSwingSession.java Mon Apr 6 08:10:44 2009
@@ -79,7 +79,7 @@
     private boolean showFkTag = true;
     private boolean showAkTag = true;

-    private boolean usingAliasNames = false;
+    private boolean usingLogicalNames = false;

     private ColumnVisibility choice = ColumnVisibility.ALL;

@@ -345,12 +345,12 @@
return new DefaultUserPrompterFactory().createUserPrompter(question, responseType, optionType, defaultResponseType, defaultResponse, buttonNames);
     }

-    public boolean isUsingAliasNames() {
-       return usingAliasNames;
+    public boolean isUsingLogicalNames() {
+       return usingLogicalNames;
     }

-    public void setUsingAliasNames(boolean usingAliasNames) {
-        this.usingAliasNames = usingAliasNames;
+    public void setUsingLogicalNames(boolean usingLogicalNames) {
+        this.usingLogicalNames = usingLogicalNames;
     }

 }

Modified: trunk/src/ca/sqlpower/architect/swingui/ArchitectSwingSession.java
==============================================================================
--- trunk/src/ca/sqlpower/architect/swingui/ArchitectSwingSession.java (original) +++ trunk/src/ca/sqlpower/architect/swingui/ArchitectSwingSession.java Mon Apr 6 08:10:44 2009
@@ -192,16 +192,16 @@
     public void setRelationshipLinesDirect(boolean direct);

     /**
- * Boolean to decide whether to display the logical(alias) names or the physical(technical) names + * Boolean to decide whether to display the logical names or the physical names
      * for columns and tables.
      */
-    public boolean isUsingAliasNames();
+    public boolean isUsingLogicalNames();

     /**
- * To use alias names or not: True, if the alias names are to be displayed. False, if the
-     * technical names are to be displayed.
+ * To use logical names or not: True, if the logical names are to be displayed. False, if the
+     * physical names are to be displayed.
      */
-    public void setUsingAliasNames(boolean usingAliasNames);
+    public void setUsingLogicalNames(boolean usingLogicalNames);

     /**
      * Returns whether the PK Tags will be shown

Modified: trunk/src/ca/sqlpower/architect/swingui/ArchitectSwingSessionImpl.java
==============================================================================
--- trunk/src/ca/sqlpower/architect/swingui/ArchitectSwingSessionImpl.java (original) +++ trunk/src/ca/sqlpower/architect/swingui/ArchitectSwingSessionImpl.java Mon Apr 6 08:10:44 2009
@@ -141,7 +141,8 @@
     private ProjectModificationWatcher projectModificationWatcher;

     private boolean relationshipLinesDirect;
-    private boolean usingAliasNames;
+
+    private boolean usingLogicalNames = true;

     private boolean showPkTag = true;
     private boolean showFkTag = true;
@@ -827,12 +828,12 @@
         return relationshipLinesDirect;
     }

-    public boolean isUsingAliasNames() {
-        return usingAliasNames;
+    public boolean isUsingLogicalNames() {
+        return usingLogicalNames;
     }

-    public void setUsingAliasNames(boolean usingAliasNames) {
-        this.usingAliasNames = usingAliasNames;
+    public void setUsingLogicalNames(boolean usingLogicalNames) {
+        this.usingLogicalNames = usingLogicalNames;
         getPlayPen().repaint();
     }


Modified: trunk/src/ca/sqlpower/architect/swingui/BasicTablePaneUI.java
==============================================================================
--- trunk/src/ca/sqlpower/architect/swingui/BasicTablePaneUI.java       
(original)
+++ trunk/src/ca/sqlpower/architect/swingui/BasicTablePaneUI.java Mon Apr 6 08:10:44 2009
@@ -295,7 +295,11 @@
      */
        private String columnText(SQLColumn col) {
         StringBuilder displayName = new StringBuilder(50);
-        displayName.append(col.getName()).append(": ");
+        if (tablePane.isUsingLogicalNames()) {
+            displayName.append(col.getName()).append(": ");
+        } else {
+            displayName.append(col.getPhysicalName()).append(": ");
+        }
         displayName.append(ddlg.getColumnDataTypeName(col));
         displayName.append(getColumnTag(col));
         return displayName.toString();
@@ -465,10 +469,10 @@
             fqn.append(db);
             if (cat != null) fqn.append('.').append(cat);
             if (sch != null) fqn.append('.').append(sch);
-            fqn.append('.').append(tp.getModel().getName());
+ fqn.append('.').append(tp.isUsingLogicalNames()? tp.getModel().getName():tp.getModel().getPhysicalName());
             return fqn.toString();
         } else {
-            return tp.getModel().getName();
+ return tp.isUsingLogicalNames()? tp.getModel().getName():tp.getModel().getPhysicalName();
         }
     }


Modified: trunk/src/ca/sqlpower/architect/swingui/PlayPen.java
==============================================================================
--- trunk/src/ca/sqlpower/architect/swingui/PlayPen.java        (original)
+++ trunk/src/ca/sqlpower/architect/swingui/PlayPen.java Mon Apr 6 08:10:44 2009
@@ -1073,6 +1073,7 @@
                        if (c instanceof TablePane) {
                                // Makes drag and dropped tables show the 
proper columns
                                ((TablePane) c).updateHiddenColumns();
+                               ((TablePane) c).updateNameDisplay();
                        }
                } else {
throw new IllegalArgumentException("PlayPen can't contain components of type " //$NON-NLS-1$
@@ -3272,9 +3273,10 @@
         scrollRectToVisible(zoomRect(r));
     }

-    public void updateHiddenColumns() {
+    public void updateTablePanes() {
         for (TablePane tp : getTablePanes()) {
             tp.updateHiddenColumns();
+            tp.updateNameDisplay();
             tp.revalidate();
             tp.repaint();
         }

Modified: trunk/src/ca/sqlpower/architect/swingui/ProjectSettingsPanel.java
==============================================================================
--- trunk/src/ca/sqlpower/architect/swingui/ProjectSettingsPanel.java (original) +++ trunk/src/ca/sqlpower/architect/swingui/ProjectSettingsPanel.java Mon Apr 6 08:10:44 2009
@@ -71,8 +71,8 @@
     private JRadioButton showPkFk;
     private JRadioButton showPk;

-    private JRadioButton technicalName;
-    private JRadioButton aliasName;
+    private JRadioButton physicalNames;
+    private JRadioButton logicalNames;

        public ProjectSettingsPanel(ArchitectSwingSession session) {
                this.session = session;
@@ -116,15 +116,15 @@
         add(new JSeparator(), cc.xyw(1, row, 2));

         row++;
- add(new JLabel(Messages.getString("ProjectSettingsPanel.displayTechnicalOrAlias")), cc.xy(1, row)); //$NON-NLS-1$ - add(technicalName = new JRadioButton(Messages.getString("ProjectSettingsPanel.displayTechnicalNames")), cc.xy(2, row)); //$NON-NLS-1$ + add(new JLabel(Messages.getString("ProjectSettingsPanel.displayPhysicalOrLogical")), cc.xy(1, row)); //$NON-NLS-1$ + add(logicalNames = new JRadioButton(Messages.getString("ProjectSettingsPanel.displayLogicalNames")), cc.xy(2, row)); //$NON-NLS-1$

         row++;
         add(new JLabel(), cc.xy(1, row));
- add(aliasName = new JRadioButton(Messages.getString("ProjectSettingsPanel.displayAliasNames")), cc.xy(2, row)); //$NON-NLS-1$ + add(physicalNames = new JRadioButton(Messages.getString("ProjectSettingsPanel.displayPhysicalNames")), cc.xy(2, row)); //$NON-NLS-1$
         ButtonGroup nameDisplay = new ButtonGroup();
-        nameDisplay.add(technicalName);
-        nameDisplay.add(aliasName);
+        nameDisplay.add(logicalNames);
+        nameDisplay.add(physicalNames);

         row++;
         add(new JSeparator(), cc.xyw(1, row, 2));
@@ -168,6 +168,12 @@
         } else {
             rectilinearRelationships.setSelected(true);
         }
+        if (session.isUsingLogicalNames()) {
+            logicalNames.setSelected(true);
+        } else {
+            physicalNames.setSelected(true);
+        }
+
             showPkTag.setSelected(session.isShowPkTag());
             showFkTag.setSelected(session.isShowFkTag());
             showAkTag.setSelected(session.isShowAkTag());
@@ -212,6 +218,13 @@
         } else {
             session.setRelationshipLinesDirect(false);
         }
+
+        if (logicalNames.isSelected()) {
+            session.setUsingLogicalNames(true);
+        } else {
+            session.setUsingLogicalNames(false);
+        }
+
         session.setShowPkTag(showPkTag.isSelected());
         session.setShowFkTag(showFkTag.isSelected());
         session.setShowAkTag(showAkTag.isSelected());
@@ -233,7 +246,7 @@
         }

// XXX this refresh should be handled via a property change event on the session
-        session.getPlayPen().updateHiddenColumns();
+        session.getPlayPen().updateTablePanes();

         return true;
        }

Modified: trunk/src/ca/sqlpower/architect/swingui/SwingUIProject.java
==============================================================================
--- trunk/src/ca/sqlpower/architect/swingui/SwingUIProject.java (original)
+++ trunk/src/ca/sqlpower/architect/swingui/SwingUIProject.java Mon Apr 6 08:10:44 2009
@@ -322,6 +322,15 @@
             } else {
                 getSession().setShowAkTag(true);
             }
+
+ String usingLogicalNames = attributes.getValue("names-displayLogicalNames"); //$NON-NLS-1$
+            if (usingLogicalNames == null) {
+                getSession().setUsingLogicalNames(true);
+            } else if (!Boolean.valueOf(usingLogicalNames)) {
+                getSession().setUsingLogicalNames(false);
+            } else {
+                getSession().setUsingLogicalNames(true);
+            }
                
String relStyle = attributes.getValue("relationship-style"); //$NON-NLS-1$
             boolean direct;
@@ -963,6 +972,7 @@
             String relStyle = getSession().getRelationshipLinesDirect() ?
RELATIONSHIP_STYLE_DIRECT : RELATIONSHIP_STYLE_RECTILINEAR; tagText.append(" relationship-style=").append(quote(relStyle)); //$NON-NLS-1$ + tagText.append(" names-displayLogicalNames=\"").append(getSession().isUsingLogicalNames()).append("\""); //$NON-NLS-1$ tagText.append(" showPrimaryTag=\"").append(getSession().isShowPkTag()).append("\""); //$NON-NLS-1$ //$NON-NLS-2$ tagText.append(" showForeignTag=\"").append(getSession().isShowFkTag()).append("\""); //$NON-NLS-1$ //$NON-NLS-2$ tagText.append(" showAlternateTag=\"").append(getSession().isShowAkTag()).append("\""); //$NON-NLS-1$ //$NON-NLS-2$

Modified: trunk/src/ca/sqlpower/architect/swingui/TableEditPanel.java
==============================================================================
--- trunk/src/ca/sqlpower/architect/swingui/TableEditPanel.java (original)
+++ trunk/src/ca/sqlpower/architect/swingui/TableEditPanel.java Mon Apr 6 08:10:44 2009
@@ -68,9 +68,9 @@
                super(new FormLayout());
                this.session = session;
                this.tp = session.getPlayPen().findTablePane(t);
- add(new JLabel(Messages.getString("TableEditPanel.tableLogicalName"))); //$NON-NLS-1$ + add(new JLabel(Messages.getString("TableEditPanel.tableLogicalNameLabel"))); //$NON-NLS-1$
         add(logicalName = new JTextField("", 30)); //$NON-NLS-1$
- add(new JLabel(Messages.getString("TableEditPanel.tablePhysicalName"))); //$NON-NLS-1$ + add(new JLabel(Messages.getString("TableEditPanel.tablePhysicalNameLabel"))); //$NON-NLS-1$
         add(physicalName = new JTextField("", 30)); //$NON-NLS-1$
add(new JLabel(Messages.getString("TableEditPanel.primaryKeyNameLabel"))); //$NON-NLS-1$
                add(pkName = new JTextField("", 30)); //$NON-NLS-1$

Modified: trunk/src/ca/sqlpower/architect/swingui/TablePane.java
==============================================================================
--- trunk/src/ca/sqlpower/architect/swingui/TablePane.java      (original)
+++ trunk/src/ca/sqlpower/architect/swingui/TablePane.java Mon Apr 6 08:10:44 2009
@@ -97,6 +97,12 @@
         * Tracks which columns in this table are currently hidden.
         */
        protected Set<SQLColumn> hiddenColumns;
+       
+       /**
+        * Keeps tracks of whether the user wants to see the logical names or 
the
+        * physical names.
+        */
+       boolean usingLogicalNames;

        /**
         * Tracks current highlight colours of the columns in this table.
@@ -307,6 +313,7 @@
             } catch (SQLObjectException ex) {
                 throw new SQLObjectRuntimeException(ex);
             }
+//            updateNameDisplay();
             updateHiddenColumns();
             firePropertyChange("model.children", null, null); //$NON-NLS-1$
             //revalidate();
@@ -325,6 +332,7 @@
" oldVal="+e.getOldValue()+" newVal="+e.getNewValue() + //$NON-NLS-1$ //$NON-NLS-2$
                         " selectedItems=" + getSelectedItems());
             }
+//            updateNameDisplay();
             updateHiddenColumns();
firePropertyChange("model."+e.getPropertyName(), null, null); //$NON-NLS-1$
             //repaint();
@@ -419,6 +427,23 @@
                }
            }
        }
+       
+       public boolean isUsingLogicalNames() {
+           PlayPen pp = getPlayPen();
+           if (pp != null) {
+               ArchitectSwingSession session = pp.getSession();
+               if (session != null) {
+                   return session.isUsingLogicalNames();
+               }
+           }
+           return true;
+       }
+       
+       public void updateNameDisplay() {
+        ArchitectSwingSession session = getPlayPen().getSession();
+        usingLogicalNames = session.isUsingLogicalNames();
+
+    }

        // ------------------ utility methods ---------------------


Modified: trunk/src/ca/sqlpower/architect/swingui/messages.properties
==============================================================================
--- trunk/src/ca/sqlpower/architect/swingui/messages.properties (original)
+++ trunk/src/ca/sqlpower/architect/swingui/messages.properties Mon Apr 6 08:10:44 2009
@@ -271,9 +271,9 @@
 ProfileResultsViewer.search=Search:
 ProfileResultsViewer.tableViewTab=Table View
 ProjectSettingsPanel.directLineOption=Direct Lines
-ProjectSettingsPanel.displayAliasNames= Alias Names
-ProjectSettingsPanel.displayTechnicalNames= Technical Names
-ProjectSettingsPanel.displayTechnicalOrAlias= Display Tables and Columns With:
+ProjectSettingsPanel.displayLogicalNames= Logical Names
+ProjectSettingsPanel.displayPhysicalNames= Physical Names
+ProjectSettingsPanel.displayPhysicalOrLogical= Display Tables and Columns With: ProjectSettingsPanel.numCommonProfileValues=Number of Common Values in Profiles:
 ProjectSettingsPanel.profileMode=Profile Creator Mode:
 ProjectSettingsPanel.rectilinearLineOption=Rectilinear Lines
@@ -370,8 +370,8 @@
 TableEditPanel.remarksLabel=Remarks
 TableEditPanel.roundedCornersLabel=Rounded Corners
 TableEditPanel.tableColourLabel=Table Colour
-TableEditPanel.tablePhysicalName=Physical Name
-TableEditPanel.tableLogicalName= Logical Name
+TableEditPanel.tablePhysicalNameLabel=Physical Table Name
+TableEditPanel.tableLogicalNameLabel=Logical Table Name
 TableEditPanel.textColourLabel=Text Colour
 TablePane.alignTablesMenu=Align Tables
 TablePane.editIndexTooltip=Edit Index

Reply via email to