Revision: 3390
Author: silva.josemanuel1
Date: Mon Mar 22 09:39:58 2010
Log: Fixed broken revision list UI.
Added isInteresting tags to UI component and project settings properties.
http://code.google.com/p/power-architect/source/detail?r=3390
Added:
/trunk/src/ca/sqlpower/architect/swingui/PatternFinder.java
Modified:
/trunk/src/ca/sqlpower/architect/ProjectSettings.java
/trunk/src/ca/sqlpower/architect/enterprise/ArchitectClientSideSession.java
/trunk/src/ca/sqlpower/architect/swingui/PlayPenComponent.java
/trunk/src/ca/sqlpower/architect/swingui/Relationship.java
/trunk/src/ca/sqlpower/architect/swingui/enterprise/RevisionListPanel.java
=======================================
--- /dev/null
+++ /trunk/src/ca/sqlpower/architect/swingui/PatternFinder.java Mon Mar 22
09:39:58 2010
@@ -0,0 +1,111 @@
+/*
+ * Copyright (c) 2010, SQL Power Group Inc.
+ *
+ * This file is part of Power*Architect.
+ *
+ * Power*Architect is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Power*Architect is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+package ca.sqlpower.architect.swingui;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * This class allows objects to be added to it,
+ * and checks at each addition if the entire list
+ * fits a pattern that repeats at least once.
+ * Objects can be continually added, and this object
+ * may go back and forth between a valid repeating pattern.
+ *
+ * @param <T>
+ */
+public class PatternFinder<T> {
+
+ /**
+ * This stores all the items in the list that have been
+ * checked and determined to either have a pattern or not
+ * (as dictated by the pattern field)
+ */
+ List<T> checkedSequence = new ArrayList<T>();
+
+ /**
+ * This is a list of objects that have been recently added,
+ * and could potentially match an existing pattern in the list,
+ * or be the first repeating term of a pattern.
+ */
+ List<T> uncheckedSequence = new ArrayList<T>();
+
+ /**
+ * This stores the largest list of items that the
+ * overall list repeats at least once. It is empty
+ * if the overall list has no repeating pattern.
+ */
+ List<T> pattern = new ArrayList<T>();
+
+ boolean redundancyCheck = true;
+
+ public boolean newItem(T item) {
+
+ /**
+ * This list is the shortest non-repeating sequence, which is
+ * either the determined repeating pattern sequence, or the entire
+ * checkedSequence in the event of no repeating pattern.
+ */
+ List<T> compareAgainst;
+
+ if (pattern.size() > 0) {
+ compareAgainst = pattern;
+ } else if (checkedSequence.size() > 0) {
+ compareAgainst = checkedSequence;
+ } else {
+ checkedSequence.add(item);
+ return false;
+ }
+
+ if (!item.equals(compareAgainst.get(uncheckedSequence.size()))) {
+ // There is no pattern. Forfeit this possiblePattern
+ // by moving it all to the non-patterned sequence
+ checkedSequence.addAll(uncheckedSequence);
+ checkedSequence.add(item);
+ uncheckedSequence.clear();
+ pattern.clear();
+ return false;
+ } else {
+ uncheckedSequence.add(item);
+ if (compareAgainst.size() == uncheckedSequence.size()) {
+ // This is a double-check, and should always be true at
this point.
+ if (!redundancyCheck ||
compareAgainst.equals(uncheckedSequence)) {
+ checkedSequence.addAll(uncheckedSequence);
+ if (pattern.size() == 0) {
+ pattern.addAll(uncheckedSequence);
+ System.out.println(pattern);
+ }
+ uncheckedSequence.clear();
+ return true;
+ }
+ }
+ return isRepeatingPattern();
+ }
+ }
+
+ public boolean isRepeatingPattern() {
+ return pattern.size() > 0;
+ }
+
+ public List<T> getPattern() {
+ return pattern;
+ }
+
+}
=======================================
--- /trunk/src/ca/sqlpower/architect/ProjectSettings.java Wed Mar 17
14:29:59 2010
+++ /trunk/src/ca/sqlpower/architect/ProjectSettings.java Mon Mar 22
09:39:58 2010
@@ -70,7 +70,7 @@
setName("Project Settings");
}
- @Accessor
+ @Accessor(isInteresting=true)
public boolean isSavingEntireSource() {
return savingEntireSource;
}
@@ -82,7 +82,7 @@
firePropertyChange("savingEntireSource", oldValue,
savingEntireSource);
}
- @Accessor
+ @Accessor(isInteresting=true)
public boolean isDisplayRelationshipLabel() {
return displayRelationshipLabel;
}
@@ -94,7 +94,7 @@
firePropertyChange("displayRelationshipLabel", oldValue,
displayRelationshipLabel);
}
- @Accessor
+ @Accessor(isInteresting=true)
public boolean isRelationshipLinesDirect() {
return relationshipLinesDirect;
}
@@ -106,7 +106,7 @@
firePropertyChange("relationshipLinesDirect", oldValue,
relationshipLinesDirect);
}
- @Accessor
+ @Accessor(isInteresting=true)
public boolean isUsingLogicalNames() {
return usingLogicalNames;
}
@@ -118,7 +118,7 @@
firePropertyChange("usingLogicalNames", oldValue,
usingLogicalNames);
}
- @Accessor
+ @Accessor(isInteresting=true)
public boolean isShowPkTag() {
return showPkTag;
}
@@ -130,7 +130,7 @@
firePropertyChange("showPkTag", oldValue, showPkTag);
}
- @Accessor
+ @Accessor(isInteresting=true)
public boolean isShowFkTag() {
return showFkTag;
}
@@ -142,7 +142,7 @@
firePropertyChange("showFkTag", oldValue, showFkTag);
}
- @Accessor
+ @Accessor(isInteresting=true)
public boolean isShowAkTag() {
return showAkTag;
}
@@ -154,7 +154,7 @@
firePropertyChange("showAkTag", oldValue, showAkTag);
}
- @Accessor
+ @Accessor(isInteresting=true)
public ColumnVisibility getColumnVisibility() {
return columnVisibility;
}
=======================================
---
/trunk/src/ca/sqlpower/architect/enterprise/ArchitectClientSideSession.java
Thu Mar 18 10:14:14 2010
+++
/trunk/src/ca/sqlpower/architect/enterprise/ArchitectClientSideSession.java
Mon Mar 22 09:39:58 2010
@@ -119,14 +119,6 @@
private DataSourceCollection <JDBCDataSource> dataSourceCollection;
- // -
-
- /**
- * The revision this project is currently at. This will be updated as
- * changes come in from the server.
- */
- int currentRevision = 0;
-
public ArchitectClientSideSession(ArchitectSessionContext context,
String name, ProjectLocation projectLocation) throws SQLObjectException
{
super(context, name);
@@ -368,7 +360,7 @@
transactions.add(transaction);
}
-
+
return transactions;
} finally {
@@ -470,11 +462,7 @@
httpClient.getConnectionManager().shutdown();
}
}
-
- public int getLocalRevisionNo() {
- return currentRevision;
- }
-
+
/**
* Gets a list of DiffChunks representing the differences between the
two revisions from the server.
*/
=======================================
--- /trunk/src/ca/sqlpower/architect/swingui/PlayPenComponent.java Mon Mar
22 07:16:15 2010
+++ /trunk/src/ca/sqlpower/architect/swingui/PlayPenComponent.java Mon Mar
22 09:39:58 2010
@@ -260,7 +260,7 @@
return r;
}
- @Transient @Accessor
+ @Transient @Accessor(isInteresting=true)
public Dimension getSize() {
return new Dimension(bounds.width, bounds.height);
}
@@ -275,7 +275,7 @@
return getLocation();
}
- @Transient @Accessor
+ @Transient @Accessor(isInteresting=true)
public Point getLocation() {
return getLocation(null);
}
@@ -409,7 +409,7 @@
owner.repaint(x1, y1, (x2 - x1), (y2 - y1));
}
- @Accessor
+ @Accessor(isInteresting=true)
public boolean isOpaque() {
return opaque;
}
@@ -422,7 +422,7 @@
}
}
- @Accessor
+ @Accessor(isInteresting=true)
public Color getBackgroundColor() {
if (backgroundColor == null) {
return getPlayPen().getBackground();
@@ -437,7 +437,7 @@
firePropertyChange("backgroundColor", oldColor, backgroundColor);
}
- @Accessor
+ @Accessor(isInteresting=true)
public Color getForegroundColor() {
if (foregroundColor == null && getPlayPen() != null) {
return getPlayPen().getForeground();
@@ -503,7 +503,7 @@
return getUI().getPreferredSize();
}
- @Accessor
+ @Accessor(isInteresting=true)
public abstract Object getModel();
/**
@@ -582,6 +582,7 @@
throw new IllegalArgumentException("This class does not allow
children");
}
+ @Override
@Accessor
public PlayPenContentPane getParent() {
return (PlayPenContentPane) super.getParent();
=======================================
--- /trunk/src/ca/sqlpower/architect/swingui/Relationship.java Mon Mar 22
07:16:15 2010
+++ /trunk/src/ca/sqlpower/architect/swingui/Relationship.java Mon Mar 22
09:39:58 2010
@@ -366,12 +366,12 @@
return fkTable;
}
- @Accessor
+ @Accessor(isInteresting=true)
public Point getPkConnectionPoint() {
return new Point(pkConnectionPoint);
}
- @Accessor
+ @Accessor(isInteresting=true)
public Point getFkConnectionPoint() {
return new Point(fkConnectionPoint);
}
@@ -382,7 +382,7 @@
* value is a bitmask of the constants
* (PARENT|CHILD)_FACES_(LEFT|RIGHT|TOP|BOTTOM).
*/
- @Accessor
+ @Accessor(isInteresting=true)
public int getOrientation() {
return orientation;
}
=======================================
---
/trunk/src/ca/sqlpower/architect/swingui/enterprise/RevisionListPanel.java
Fri Feb 26 12:26:46 2010
+++
/trunk/src/ca/sqlpower/architect/swingui/enterprise/RevisionListPanel.java
Mon Mar 22 09:39:58 2010
@@ -118,7 +118,7 @@
boolean filterChange = fromVersion.update() ||
toVersion.update();
- int difference = session.getLocalRevisionNo() - currentVersion;
+ int difference = session.getUpdater().getRevision() -
currentVersion;
if (difference > 0) currentVersion += difference;
String message = null;
@@ -251,7 +251,7 @@
"pref, 2dlu, default:grow"));
- int currentRevision = session.getLocalRevisionNo();
+ int currentRevision = session.getUpdater().getRevision();
long from = currentRevision - 100;
if (from <= 0) from = 1;
fromVersion = new JLongField(from);
To unsubscribe from this group, send email to
architect-commits+unsubscribegooglegroups.com or reply to this email with the words
"REMOVE ME" as the subject.