Revision: 3215
Author: [email protected]
Date: Wed Dec 16 15:37:42 2009
Log: Changed some classes to refer to the new SQLImportedKey class.
Changed SwingUIProject to save (or not save, more accurately)
SQLImportedKeys.
http://code.google.com/p/power-architect/source/detail?r=3215
Modified:
/branches/sqlobject-spobject-model/regress/ca/sqlpower/architect/swingui/TestPlayPen.java
/branches/sqlobject-spobject-model/regress/ca/sqlpower/architect/swingui/TestPlayPenComponent.java
/branches/sqlobject-spobject-model/src/ca/sqlpower/architect/diff/CompareSQL.java
/branches/sqlobject-spobject-model/src/ca/sqlpower/architect/swingui/ColumnMappingPanel.java
/branches/sqlobject-spobject-model/src/ca/sqlpower/architect/swingui/SwingUIProject.java
/branches/sqlobject-spobject-model/src/ca/sqlpower/architect/swingui/TablePane.java
=======================================
---
/branches/sqlobject-spobject-model/regress/ca/sqlpower/architect/swingui/TestPlayPen.java
Fri May 29 07:57:16 2009
+++
/branches/sqlobject-spobject-model/regress/ca/sqlpower/architect/swingui/TestPlayPen.java
Wed Dec 16 15:37:42 2009
@@ -245,7 +245,7 @@
for (SQLTable t: pp.getTables()) {
List<SQLRelationship> exportedKeys = t.getExportedKeys();
- List<SQLRelationship> importedKeys = t.getImportedKeys();
+ List<SQLRelationship> importedKeys =
SQLRelationship.getExportedKeys(t.getImportedKeys());
assertEquals("Expected only one exported key in table", 1,
exportedKeys.size());
assertEquals("Expected only one imported key in table", 1,
importedKeys.size());
=======================================
---
/branches/sqlobject-spobject-model/regress/ca/sqlpower/architect/swingui/TestPlayPenComponent.java
Thu Jan 29 12:02:55 2009
+++
/branches/sqlobject-spobject-model/regress/ca/sqlpower/architect/swingui/TestPlayPenComponent.java
Wed Dec 16 15:37:42 2009
@@ -293,335 +293,6 @@
return newVal;
}
- //TODO Add test cases for these functions
- /*
- * Test method
for 'ca.sqlpower.architect.swingui.PlayPenComponent.getUI()'
- */
- public void testGetUI() {
-
-
- }
-
- /*
- * Test method
for 'ca.sqlpower.architect.swingui.PlayPenComponent.setUI(PlayPenComponentUI)'
- */
- public void testSetUI() {
-
- }
-
- /*
- * Test method
for 'ca.sqlpower.architect.swingui.PlayPenComponent.showPopup(JPopupMenu,
Point)'
- */
- public void testShowPopup() {
-
- }
-
- /*
- * Test method
for 'ca.sqlpower.architect.swingui.PlayPenComponent.revalidate()'
- */
- public void testRevalidate() {
-
- }
-
- /*
- * Test method
for 'ca.sqlpower.architect.swingui.PlayPenComponent.setBounds(int, int,
int, int)'
- */
- public void testSetBounds() {
-
- }
-
- /*
- * Test method
for 'ca.sqlpower.architect.swingui.PlayPenComponent.getBounds()'
- */
- public void testGetBounds() {
-
- }
-
- /*
- * Test method
for 'ca.sqlpower.architect.swingui.PlayPenComponent.getBounds(Rectangle)'
- */
- public void testGetBoundsRectangle() {
-
- }
-
- /*
- * Test method
for 'ca.sqlpower.architect.swingui.PlayPenComponent.getSize()'
- */
- public void testGetSize() {
-
- }
-
- /*
- * Test method
for 'ca.sqlpower.architect.swingui.PlayPenComponent.getPreferredLocation()'
- */
- public void testGetPreferredLocation() {
-
- }
-
- /*
- * Test method
for 'ca.sqlpower.architect.swingui.PlayPenComponent.getLocation()'
- */
- public void testGetLocation() {
-
- }
-
- /*
- * Test method
for 'ca.sqlpower.architect.swingui.PlayPenComponent.getLocation(Point)'
- */
- public void testGetLocationPoint() {
-
- }
-
- /*
- * Test method
for 'ca.sqlpower.architect.swingui.PlayPenComponent.setLocation(Point)'
- */
- public void testSetLocationPoint() {
-
- }
-
- /*
- * Test method
for 'ca.sqlpower.architect.swingui.PlayPenComponent.setLocation(int, int)'
- */
- public void testSetLocationIntInt() {
-
- }
-
- /*
- * Test method
for 'ca.sqlpower.architect.swingui.PlayPenComponent.repaint()'
- */
- public void testRepaint() {
-
- }
-
- /*
- * Test method
for 'ca.sqlpower.architect.swingui.PlayPenComponent.repaint(Rectangle)'
- */
- public void testRepaintRectangle() {
-
- }
-
- /*
- * Test method
for 'ca.sqlpower.architect.swingui.PlayPenComponent.getName()'
- */
- public void testGetName() {
-
- }
-
- /*
- * Test method
for 'ca.sqlpower.architect.swingui.PlayPenComponent.setName(String)'
- */
- public void testSetName() {
-
- }
-
- /*
- * Test method
for 'ca.sqlpower.architect.swingui.PlayPenComponent.addPropertyChangeListener(PropertyChangeListener)'
- */
- public void testAddPropertyChangeListener() {
-
- }
-
- /*
- * Test method
for 'ca.sqlpower.architect.swingui.PlayPenComponent.removePropertyChangeListener(PropertyChangeListener)'
- */
- public void testRemovePropertyChangeListener() {
-
- }
-
- /*
- * Test method
for 'ca.sqlpower.architect.swingui.PlayPenComponent.firePropertyChange(String,
Object, Object)'
- */
- public void testFirePropertyChangeStringObjectObject() {
-
- }
-
- /*
- * Test method
for 'ca.sqlpower.architect.swingui.PlayPenComponent.firePropertyChange(String,
int, int)'
- */
- public void testFirePropertyChangeStringIntInt() {
-
- }
-
- /*
- * Test method
for 'ca.sqlpower.architect.swingui.PlayPenComponent.addPlayPenComponentListener(PlayPenComponentListener)'
- */
- public void testAddPlayPenComponentListener() {
-
- }
-
- /*
- * Test method
for 'ca.sqlpower.architect.swingui.PlayPenComponent.removePlayPenComponentListener(PlayPenComponentListener)'
- */
- public void testRemovePlayPenComponentListener() {
-
- }
-
- /*
- * Test method
for 'ca.sqlpower.architect.swingui.PlayPenComponent.firePlayPenComponentMoved(Point,
Point)'
- */
- public void testFirePlayPenComponentMoved() {
-
- }
-
- /*
- * Test method
for 'ca.sqlpower.architect.swingui.PlayPenComponent.firePlayPenComponentResized()'
- */
- public void testFirePlayPenComponentResized() {
-
- }
-
- /*
- * Test method for
'ca.sqlpower.architect.swingui.PlayPenComponent.getX()'
- */
- public void testGetX() {
-
- }
-
- /*
- * Test method for
'ca.sqlpower.architect.swingui.PlayPenComponent.getY()'
- */
- public void testGetY() {
-
- }
-
- /*
- * Test method
for 'ca.sqlpower.architect.swingui.PlayPenComponent.getWidth()'
- */
- public void testGetWidth() {
-
- }
-
- /*
- * Test method
for 'ca.sqlpower.architect.swingui.PlayPenComponent.getHeight()'
- */
- public void testGetHeight() {
-
- }
-
- /*
- * Test method
for 'ca.sqlpower.architect.swingui.PlayPenComponent.getInsets()'
- */
- public void testGetInsets() {
-
- }
-
- /*
- * Test method
for 'ca.sqlpower.architect.swingui.PlayPenComponent.setInsets(Insets)'
- */
- public void testSetInsets() {
-
- }
-
- /*
- * Test method
for 'ca.sqlpower.architect.swingui.PlayPenComponent.repaint(long, int, int,
int, int)'
- */
- public void testRepaintLongIntIntIntInt() {
-
- }
-
- /*
- * Test method
for 'ca.sqlpower.architect.swingui.PlayPenComponent.isOpaque()'
- */
- public void testIsOpaque() {
-
- }
-
- /*
- * Test method
for 'ca.sqlpower.architect.swingui.PlayPenComponent.setOpaque(boolean)'
- */
- public void testSetOpaque() {
-
- }
-
- /*
- * Test method
for 'ca.sqlpower.architect.swingui.PlayPenComponent.getBackground()'
- */
- public void testGetBackground() {
-
- }
-
- /*
- * Test method
for 'ca.sqlpower.architect.swingui.PlayPenComponent.setBackground(Color)'
- */
- public void testSetBackground() {
-
- }
-
- /*
- * Test method
for 'ca.sqlpower.architect.swingui.PlayPenComponent.getForeground()'
- */
- public void testGetForeground() {
-
- }
-
- /*
- * Test method
for 'ca.sqlpower.architect.swingui.PlayPenComponent.setForeground(Color)'
- */
- public void testSetForeground() {
-
- }
-
- /*
- * Test method
for 'ca.sqlpower.architect.swingui.PlayPenComponent.getToolTipText()'
- */
- public void testGetToolTipText() {
-
- }
-
- /*
- * Test method
for 'ca.sqlpower.architect.swingui.PlayPenComponent.setToolTipText(String)'
- */
- public void testSetToolTipText() {
-
- }
-
- /*
- * Test method
for 'ca.sqlpower.architect.swingui.PlayPenComponent.getFont()'
- */
- public void testGetFont() {
-
- }
-
- /*
- * Test method
for 'ca.sqlpower.architect.swingui.PlayPenComponent.getFontMetrics(Font)'
- */
- public void testGetFontMetrics() {
-
- }
-
- /*
- * Test method
for 'ca.sqlpower.architect.swingui.PlayPenComponent.getFontRenderContext()'
- */
- public void testGetFontRenderContext() {
-
- }
-
- /*
- * Test method
for 'ca.sqlpower.architect.swingui.PlayPenComponent.contains(Point)'
- */
- public void testContains() {
-
- }
-
- /*
- * Test method
for 'ca.sqlpower.architect.swingui.PlayPenComponent.paint(Graphics2D)'
- */
- public void testPaint() {
-
- }
-
- /*
- * Test method
for 'ca.sqlpower.architect.swingui.PlayPenComponent.getPreferredSize()'
- */
- public void testGetPreferredSize() {
-
- }
-
- /*
- * Test method
for 'ca.sqlpower.architect.swingui.PlayPenComponent.setSize(Dimension)'
- */
- public void testSetSize() {
-
- }
+ //TODO Add test cases for other functions
}
=======================================
---
/branches/sqlobject-spobject-model/src/ca/sqlpower/architect/diff/CompareSQL.java
Fri Apr 24 14:13:08 2009
+++
/branches/sqlobject-spobject-model/src/ca/sqlpower/architect/diff/CompareSQL.java
Wed Dec 16 15:37:42 2009
@@ -281,14 +281,14 @@
for (SQLTable t : sourceTables) {
incProgress(1, t, null);
if (t.getImportedKeys() != null){
- sourceRels.addAll(t.getImportedKeys());
+
sourceRels.addAll(SQLRelationship.getExportedKeys(t.getImportedKeys()));
}
}
for (SQLTable t : targetTables) {
incProgress(1, null, t);
if (t.getImportedKeys() != null){
- targetRels.addAll(t.getImportedKeys());
+
targetRels.addAll(SQLRelationship.getExportedKeys(t.getImportedKeys()));
}
}
=======================================
---
/branches/sqlobject-spobject-model/src/ca/sqlpower/architect/swingui/ColumnMappingPanel.java
Tue Dec 1 14:35:17 2009
+++
/branches/sqlobject-spobject-model/src/ca/sqlpower/architect/swingui/ColumnMappingPanel.java
Wed Dec 16 15:37:42 2009
@@ -43,6 +43,7 @@
import ca.sqlpower.sqlobject.SQLColumn;
import ca.sqlpower.sqlobject.SQLRelationship;
import ca.sqlpower.sqlobject.SQLTable;
+import ca.sqlpower.sqlobject.SQLRelationship.SQLImportedKey;
import ca.sqlpower.swingui.DataEntryPanel;
/**
@@ -346,7 +347,8 @@
private void colourOtherRelationships() {
try {
SQLTable t = rhsTable.getModel();
- for (SQLRelationship r : t.getImportedKeys()) {
+ for (SQLImportedKey k : t.getImportedKeys()) {
+ SQLRelationship r = k.getRelationship();
if (r == this.r) continue;
for (SQLRelationship.ColumnMapping cm : r.getChildren(
SQLRelationship.ColumnMapping.class)) {
=======================================
---
/branches/sqlobject-spobject-model/src/ca/sqlpower/architect/swingui/SwingUIProject.java
Mon Dec 14 09:10:07 2009
+++
/branches/sqlobject-spobject-model/src/ca/sqlpower/architect/swingui/SwingUIProject.java
Wed Dec 16 15:37:42 2009
@@ -1203,6 +1203,11 @@
* property manually.
*/
private void saveSQLObject(PrintWriter out, SQLObject o) throws
IOException, SQLObjectException {
+ if (o instanceof SQLRelationship.SQLImportedKey) {
+ // ImportedKeys only store the fkTable for a SQLRelationship,
which
+ // is saved with the relationship for forward compatability.
+ return;
+ }
String id = sqlObjectSaveIdMap.get(o);
if (id != null) {
ioo.println(out, "<reference
ref-id=\""+SQLPowerUtils.escapeXML(id)+"\" />"); //$NON-NLS-1$ //$NON-NLS-2$
=======================================
---
/branches/sqlobject-spobject-model/src/ca/sqlpower/architect/swingui/TablePane.java
Mon Dec 14 13:14:06 2009
+++
/branches/sqlobject-spobject-model/src/ca/sqlpower/architect/swingui/TablePane.java
Wed Dec 16 15:37:42 2009
@@ -755,7 +755,7 @@
//Check to see if the drag and drop will change the current
relationship
- List<SQLRelationship> importedKeys =
getModel().getImportedKeys();
+ List<SQLRelationship> importedKeys =
SQLRelationship.getExportedKeys(getModel().getImportedKeys());
boolean newColumnsInPk = false;
if (insertionPoint == TablePane.COLUMN_INDEX_END_OF_PK) {
@@ -891,7 +891,7 @@
public List<LayoutEdge> getInboundEdges() {
try {
- List<SQLRelationship> relationships =
getModel().getImportedKeys();
+ List<SQLRelationship> relationships =
SQLRelationship.getExportedKeys(getModel().getImportedKeys());
List<LayoutEdge> edges = new ArrayList<LayoutEdge>();
for (SQLRelationship r : relationships) {
edges.add(getPlayPen().findRelationship(r));