Author: rfelden
Date: Tue Jun  5 17:43:00 2007
New Revision: 50

URL: https://svndev.jahia.net/websvn/listing.php?sc=3D1&rev=3D50&repname=3D=
jahia_upgrade
Log:
integrity update : fully featured AND beautiful svn integrity analyzer
    TODO : user manual (GUI is quite explicit though :-)

Added:
    trunk/integrity/lib/
    trunk/integrity/lib/mysql-connector-java-5.0.5-bin.jar   (with props)
    trunk/integrity/src/main/resources/org/
    trunk/integrity/src/main/resources/org/jahia/
    trunk/integrity/src/main/resources/org/jahia/integrity/
    trunk/integrity/src/main/resources/org/jahia/integrity/resources/
    trunk/integrity/src/main/resources/org/jahia/integrity/resources/missin=
g.png   (with props)
    trunk/integrity/src/main/resources/org/jahia/integrity/resources/ok.png=
   (with props)
    trunk/integrity/src/main/resources/org/jahia/integrity/resources/resolv=
ed.png   (with props)
Modified:
    trunk/integrity/pom.xml
    trunk/integrity/src/main/java/org/jahia/database/DBconnector.java
    trunk/integrity/src/main/java/org/jahia/integrity/controller/Controller=
.java
    trunk/integrity/src/main/java/org/jahia/integrity/model/Commit.java
    trunk/integrity/src/main/java/org/jahia/integrity/model/MyModel.java
    trunk/integrity/src/main/java/org/jahia/integrity/model/ResolvedCommit.=
java
    trunk/integrity/src/main/java/org/jahia/integrity/view/ArrayListRendere=
r.java
    trunk/integrity/src/main/java/org/jahia/integrity/view/CommitResolver.j=
ava
    trunk/integrity/src/main/java/org/jahia/integrity/view/MainPanel.form
    trunk/integrity/src/main/java/org/jahia/integrity/view/MainPanel.java
    trunk/integrity/src/main/java/org/jahia/integrity/view/MainWindow.java
    trunk/integrity/src/main/resources/META-INF/MANIFEST.MF

Added: trunk/integrity/lib/mysql-connector-java-5.0.5-bin.jar
URL: https://svndev.jahia.net/websvn/filedetails.php?path=3D/trunk/integrit=
y/lib/mysql-connector-java-5.0.5-bin.jar&rev=3D50&repname=3Djahia_upgrade
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
Binary file - no diff available.

Modified: trunk/integrity/pom.xml
URL: https://svndev.jahia.net/websvn/diff.php?path=3D/trunk/integrity/pom.x=
ml&rev=3D50&repname=3Djahia_upgrade
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/integrity/pom.xml (original)
+++ trunk/integrity/pom.xml Tue Jun  5 17:43:00 2007
@@ -55,6 +55,23 @@
           </archive>
         </configuration>
       </plugin>
+      <!-- TODO copy mysql jdbc connector along with the package process (=
not from the maven repository)
+      <plugin>
+        <artifactId>maven-assembly-plugin</artifactId>
+        <configuration>
+          <descriptorSourceDirectory>src/main/assembly</descriptorSourceDi=
rectory>
+        </configuration>
+        <executions>
+          <execution>
+          <id>mysql</id>
+          <phase>package</phase>
+            <goals>
+              <goal>attached</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+      -->
     </plugins>
   </build>
   =


Modified: trunk/integrity/src/main/java/org/jahia/database/DBconnector.java
URL: https://svndev.jahia.net/websvn/diff.php?path=3D/trunk/integrity/src/m=
ain/java/org/jahia/database/DBconnector.java&rev=3D50&repname=3Djahia_upgra=
de
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/integrity/src/main/java/org/jahia/database/DBconnector.java (orig=
inal)
+++ trunk/integrity/src/main/java/org/jahia/database/DBconnector.java Tue J=
un  5 17:43:00 2007
@@ -4,7 +4,6 @@
 =

 import java.sql.*;
 import java.util.ArrayList;
-import java.util.List;
 =

 /**
  * This is a database connector that works with MySQL Connector/J.
@@ -55,7 +54,6 @@
 =

         // store commit information
         String str =3D "insert into `" + com.getBranch() + "` (author, rev=
ision, reason, date) values (?, ?, ?, ?)";
-        System.err.println(str) ;
         PreparedStatement statement =3D conn.prepareStatement(str);
         statement.setString(1, com.getAuthor());
         statement.setLong(2, com.getRevision());

Modified: trunk/integrity/src/main/java/org/jahia/integrity/controller/Cont=
roller.java
URL: https://svndev.jahia.net/websvn/diff.php?path=3D/trunk/integrity/src/m=
ain/java/org/jahia/integrity/controller/Controller.java&rev=3D50&repname=3D=
jahia_upgrade
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/integrity/src/main/java/org/jahia/integrity/controller/Controller=
.java (original)
+++ trunk/integrity/src/main/java/org/jahia/integrity/controller/Controller=
.java Tue Jun  5 17:43:00 2007
@@ -37,7 +37,7 @@
         dataModel =3D new MyModel() ;
 =

         try {
-            db =3D new DBconnector("localhost", null, "jahia", "jahia") ;
+            db =3D new DBconnector("10.8.37.161", null, "jahia", "jahia") ;
         } catch (SQLException e) {
             e.printStackTrace();
         }
@@ -150,22 +150,33 @@
     public void resolveCommit(String author, String branch, String revisio=
n, String reason, String date) {
         if (!author.equals("<all>")) {
             try {
-                db.storeResolvedCommit(new ResolvedCommit(author, Date.val=
ueOf(date), Long.valueOf(revision), branch, reason)) ;
+                String[] splitted =3D StringUtils.split(revision, ",") ;
+                for (String rev : splitted) {
+                    db.storeResolvedCommit(new ResolvedCommit(author, Date=
.valueOf(date), Long.valueOf(rev), branch, reason)) ;
+                }
             } catch (SQLException e) {
                 e.printStackTrace();
             } catch (NumberFormatException e1) {
                 e1.printStackTrace();
             } catch(Exception e) {
                 e.printStackTrace();
+            } finally {
+                gui.onCommitsResolved(author) ;
             }
         }
     }
 =

-    public void saveLogToFile(File file, String content) {
+    /**
+     * This logs the displayed content into the provided file.
+     * @param file where to save
+     * @param author the author
+     * @param listToPrint the list : 0 is good commits, 1 is missing commi=
ts and 2 is resolved commits
+     */
+    public void saveLogToFile(File file, String author, int listToPrint) {
         try {
             file.createNewFile() ;
             PrintStream ps =3D new PrintStream(file) ;
-            ps.println(content) ;
+            ps.println(dataModel.extractFromList(author, listToPrint)) ;
             ps.close() ;
         } catch (IOException e) {
             gui.display(e.toString());

Modified: trunk/integrity/src/main/java/org/jahia/integrity/model/Commit.ja=
va
URL: https://svndev.jahia.net/websvn/diff.php?path=3D/trunk/integrity/src/m=
ain/java/org/jahia/integrity/model/Commit.java&rev=3D50&repname=3Djahia_upg=
rade
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/integrity/src/main/java/org/jahia/integrity/model/Commit.java (or=
iginal)
+++ trunk/integrity/src/main/java/org/jahia/integrity/model/Commit.java Tue=
 Jun  5 17:43:00 2007
@@ -94,8 +94,8 @@
     public String toString() {
         StringBuffer output =3D new StringBuffer() ;
         output.append("Author:\t").append(getAuthor()).append("\n");
-        output.append("Date:\t").append(getDate().toString()).append("\n");
-        output.append("Revision:\t").append(getRevision()).append("\n");
+        output.append("Date:\t").append(getDate().toString()).append("\t("=
).append(getRevision()).append(")\n");
+        output.append("Message:\t").append(getMessage()).append("\n");
         return output.toString() ;
     }
 =


Modified: trunk/integrity/src/main/java/org/jahia/integrity/model/MyModel.j=
ava
URL: https://svndev.jahia.net/websvn/diff.php?path=3D/trunk/integrity/src/m=
ain/java/org/jahia/integrity/model/MyModel.java&rev=3D50&repname=3Djahia_up=
grade
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/integrity/src/main/java/org/jahia/integrity/model/MyModel.java (o=
riginal)
+++ trunk/integrity/src/main/java/org/jahia/integrity/model/MyModel.java Tu=
e Jun  5 17:43:00 2007
@@ -10,7 +10,6 @@
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.Arrays;
-import java.util.List;
 import java.io.File;
 import java.io.IOException;
 =

@@ -26,7 +25,6 @@
     private File branchesHistory ;
 =

     private Pair<HashMap<String, ArrayList<Pair<Commit, Commit>>>, HashMap=
<String, ArrayList<Commit>>> lastReport ;
-    private HashMap<Query, Pair<HashMap<String, ArrayList<Pair<Commit, Com=
mit>>>, HashMap<String, ArrayList<Commit>>>> reports ;
     private ArrayList<ResolvedCommit> resolvedCommits ;
 =

     public MyModel() {
@@ -37,8 +35,6 @@
         }
 =

         resolvedCommits =3D new ArrayList<ResolvedCommit>() ;
-
-        reports =3D new HashMap<Query, Pair<HashMap<String, ArrayList<Pair=
<Commit, Commit>>>, HashMap<String, ArrayList<Commit>>>>() ;
     }
 =

     /**
@@ -46,11 +42,6 @@
      * @throws java.io.IOException issue
      */
     private void loadServersAndBranches() throws IOException {
-        File folder =3D new File("data") ;
-        if (!folder.exists()) {
-            folder.mkdirs() ;
-        }
-
         serversHistory =3D new File(Application.APP_DIR, "servers.txt") ;
         if (!serversHistory.exists()) {
             servers =3D new ArrayList<String>() ;
@@ -138,19 +129,10 @@
         }
         branches.add(branch) ;
 =

-        if (!reports.containsKey(query)) {
-            lastReport =3D CommitRetriever.checkCommitsImpl(query) ;
-            reports.put(query, lastReport) ;
-        }
-
-        // if data cached retrieve it
-        else {
-            lastReport =3D reports.get(query) ;
-        }
+        lastReport =3D CommitRetriever.checkCommitsImpl(query) ;
 =

         String[] authorsTemp =3D lastReport.second.keySet().toArray(new St=
ring[0]) ;
         Arrays.sort(authorsTemp);
-        //authors.addAll(lastReport.first.keySet()) ;
 =

         String[] authors ;
         if (authorsTemp.length > 0) {
@@ -180,21 +162,31 @@
             if (!author.equals("<all>")) {
                 ArrayList<Pair<Commit,Commit>> goodCommits =3D  lastReport=
.first.get(author) ;
                 ArrayList<Commit> badCommits =3D  lastReport.second.get(au=
thor) ;
+                ArrayList<Commit> badCommitsCleaned =3D new ArrayList<Comm=
it>() ;
+                badCommitsCleaned.addAll(badCommits) ;
+
+                // extract resolved commits for this author
+                ArrayList<ResolvedCommit> resolved =3D new ArrayList<Resol=
vedCommit>() ;
+                for (ResolvedCommit com : resolvedCommits) {
+                    if (com.getAuthor().equals(author) || com.getAuthor().=
equals("<all>")) {
+                        resolved.add(com) ;
+                    }
+                }
 =

                 // remove resolved bad commits
                 for (Commit badCom : badCommits) {
                     boolean found =3D false ;
-                    for (int i =3D 0; i < resolvedCommits.size() && !found=
 ; i++) {
-                        if (resolvedCommits.get(i).getRevision() =3D=3D ba=
dCom.getRevision()) {
-                            badCommits.remove(badCom) ;
+                    for (int i =3D 0; i < resolved.size() && !found ; i++)=
 {
+                        if (resolved.get(i).getRevision() =3D=3D badCom.ge=
tRevision()) {
+                            badCommitsCleaned.remove(badCom) ;
                             found =3D true ;
                         }
                     }
                 }
                 commitsRetrieved =3D new Trio<ArrayList<Pair<Commit, Commi=
t>>, ArrayList<Commit>, ArrayList<ResolvedCommit>>(
                         goodCommits ,
-                        badCommits ,
-                        resolvedCommits
+                        badCommitsCleaned ,
+                        resolved
                 ) ;
 =

             // every author
@@ -242,6 +234,68 @@
     }
 =

     /**
+     * Extract data from the given list corresponding to the given author.
+     * 0 : godd commits list
+     * 1 : bad commits list
+     * 2 : resolved commits list
+     * =

+     * @param author the author
+     * @param listToPrint the index of the list
+     * @return formatted data
+     */
+    public String extractFromList(String author, int listToPrint) {
+        StringBuffer result =3D new StringBuffer() ;
+        switch (listToPrint) {
+            case 0 :
+                ArrayList<Pair<Commit, Commit>> goodCommits ;
+                if (author.equals("<all>")) {
+                    goodCommits =3D new ArrayList<Pair<Commit, Commit>>() ;
+                    for (ArrayList<Pair<Commit, Commit>> good : lastReport=
.first.values()) {
+                        goodCommits.addAll(good) ;
+                    }
+                } else {
+                    goodCommits =3D  lastReport.first.get(author) ;
+                }
+                for (Pair<Commit,Commit> pair : goodCommits) {
+                        result.append(pair.first.toExtendedString()).appen=
d("-----------------\nin trunk:\n").append(pair.second.toExtendedString()).=
append("\n") ;
+                }
+                break ;
+            case 1 :
+                ArrayList<Commit> badCommits ;
+                if (author.equals("<all>")) {
+                    badCommits =3D new ArrayList<Commit>() ;
+                    for (ArrayList<Commit> bad : lastReport.second.values(=
)) {
+                        badCommits.addAll(bad) ;
+                    }
+                } else {
+                    badCommits =3D lastReport.second.get(author) ;
+                }
+                for (Commit com : badCommits) {
+                        result.append(com.toExtendedString()).append("\n")=
 ;
+                }
+                break ;
+            case 2 :
+                ArrayList<ResolvedCommit> resolvedOnes ;
+                if (author.equals("<all>")) {
+                    resolvedOnes =3D resolvedCommits ;
+                } else {
+                    resolvedOnes =3D new ArrayList<ResolvedCommit>() ;
+                    for (ResolvedCommit com : resolvedCommits) {
+                        if (com.getAuthor().equals(author) || com.getAutho=
r().equals("<all>")) {
+                            resolvedOnes.add(com) ;
+                        }
+                    }
+                }
+                for (ResolvedCommit com : resolvedOnes) {
+                        result.append(com.toExtendedString()).append("\n")=
 ;
+                }
+                break ;
+            default :
+        }
+        return result.toString() ;
+    }
+
+    /**
      * Save history.
      */
     public void saveHistory() {

Modified: trunk/integrity/src/main/java/org/jahia/integrity/model/ResolvedC=
ommit.java
URL: https://svndev.jahia.net/websvn/diff.php?path=3D/trunk/integrity/src/m=
ain/java/org/jahia/integrity/model/ResolvedCommit.java&rev=3D50&repname=3Dj=
ahia_upgrade
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/integrity/src/main/java/org/jahia/integrity/model/ResolvedCommit.=
java (original)
+++ trunk/integrity/src/main/java/org/jahia/integrity/model/ResolvedCommit.=
java Tue Jun  5 17:43:00 2007
@@ -58,8 +58,8 @@
     public String toString() {
         StringBuffer output =3D new StringBuffer() ;
         output.append("Author:\t").append(getAuthor()).append("\n");
-        output.append("Date:\t").append(getDate().toString()).append("\n");
-        output.append("Revision:\t").append(getRevision()).append("\n");
+        output.append("Date:\t").append(getDate().toString()).append("\t("=
).append(getRevision()).append(")\n");
+        output.append("Reason:\t").append(getReason()).append("\n");
         return output.toString() ;
     }
 =


Modified: trunk/integrity/src/main/java/org/jahia/integrity/view/ArrayListR=
enderer.java
URL: https://svndev.jahia.net/websvn/diff.php?path=3D/trunk/integrity/src/m=
ain/java/org/jahia/integrity/view/ArrayListRenderer.java&rev=3D50&repname=
=3Djahia_upgrade
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/integrity/src/main/java/org/jahia/integrity/view/ArrayListRendere=
r.java (original)
+++ trunk/integrity/src/main/java/org/jahia/integrity/view/ArrayListRendere=
r.java Tue Jun  5 17:43:00 2007
@@ -7,6 +7,8 @@
 =

 import javax.swing.*;
 import java.awt.*;
+import java.awt.event.MouseEvent;
+import java.awt.event.MouseAdapter;
 =

 /**
  * @author Romain
@@ -15,19 +17,45 @@
 public class ArrayListRenderer extends DefaultListCellRenderer {
 =

 =

+    public ArrayListRenderer() {
+    }
+
+    private JLabel getResolvedIcon() {
+        return new JLabel(new ImageIcon(getClass().getResource("/org/jahia=
/integrity/resources/resolved.png"))) ;
+    }
+
+    private JLabel getMissingIcon() {
+        return new JLabel(new ImageIcon(getClass().getResource("/org/jahia=
/integrity/resources/missing.png"))) ;
+    }
+
+    private JLabel getOkIcon() {
+        return new JLabel(new ImageIcon(getClass().getResource("/org/jahia=
/integrity/resources/ok.png"))) ;
+    }
+
+
     public Component getListCellRendererComponent(JList list, Object value=
, int index, boolean isSelected, boolean cellHasFocus) {
         if (value instanceof Commit) {
-            String tooltip =3D "<html>" + StringUtils.replaceAllTokens(((C=
ommit) value).toExtendedString(), "\n", "<P>") + "</html>" ;
-            String disp =3D StringUtils.replaceAllTokens(((Commit) value).=
toString(), "\n", "<P>") ;
-            JPanel pane =3D new JPanel(new BorderLayout()) ;
-            JLabel label =3D new JLabel("<html>" + disp + "<P></html>") ;
+            final Commit com =3D (Commit) value ;
+            String tooltip =3D "<html>" + StringUtils.replaceAllTokens(com=
.toExtendedString(), "\n", "<P>") + "</html>" ;
+            String disp =3D StringUtils.replaceAllTokens(com.toString(), "=
\n", "<P>") ;
+
+            FlowLayout lay =3D new FlowLayout() ;
+            lay.setAlignment(FlowLayout.LEFT);
+            JPanel pane =3D new JPanel(lay) ;
+            JLabel label =3D new JLabel("<html>" + disp + "</html>") ;
             if (isSelected) {
                 pane.setBackground(Color.LIGHT_GRAY);
+            } else if (index % 2 =3D=3D 1) {
+                pane.setBackground(new Color(240, 248, 255));
             } else {
                 pane.setBackground(Color.WHITE);
             }
             pane.setToolTipText(tooltip);
-            pane.add(label, BorderLayout.WEST) ;
+            =

+
+            pane.add(getMissingIcon()) ;
+            pane.add(label) ;
+
             return pane ;
         } else if (value instanceof Pair) {
             if (((Pair) value).first instanceof Commit) {
@@ -35,15 +63,23 @@
                 Commit trunkCom =3D (Commit) ((Pair) value).first ;
                 String tooltip =3D "<html>" + StringUtils.replaceAllTokens=
(goodCom.toExtendedString() + "-----------------\nin trunk:\n" + trunkCom.t=
oExtendedString(), "\n", "<P>") + "</html>" ;
                 String disp =3D StringUtils.replaceAllTokens(goodCom.toStr=
ing(), "\n", "<P>") ;
-                JLabel label =3D new JLabel("<html>" + disp + "<P></html>"=
) ;
-                JPanel pane =3D new JPanel(new BorderLayout()) ;
+                JLabel label =3D new JLabel("<html>" + disp + "</html>") ;
+                FlowLayout lay =3D new FlowLayout() ;
+                lay.setAlignment(FlowLayout.LEFT);
+                JPanel pane =3D new JPanel(lay) ;
                 if (isSelected) {
                     pane.setBackground(Color.LIGHT_GRAY);
+                } else if (index % 2 =3D=3D 1) {
+                    pane.setBackground(new Color(240, 248, 255));
                 } else {
                     pane.setBackground(Color.WHITE);
                 }
-                pane.add(label, BorderLayout.WEST) ;
+
+                pane.add(getOkIcon()) ;
+                pane.add(label) ;
                 pane.setToolTipText(tooltip);
+                =

+                =

                 return pane ;
             } else {
                 return new JLabel(value.toString()) ;
@@ -51,15 +87,20 @@
         } else if (value instanceof ResolvedCommit) {
             String tooltip =3D "<html>" + StringUtils.replaceAllTokens(((R=
esolvedCommit) value).toExtendedString(), "\n", "<P>") + "</html>" ;
             String disp =3D StringUtils.replaceAllTokens(((ResolvedCommit)=
 value).toString(), "\n", "<P>") ;
-            JPanel pane =3D new JPanel(new BorderLayout()) ;
-            JLabel label =3D new JLabel("<html>" + disp + "<P></html>") ;
+            FlowLayout lay =3D new FlowLayout() ;
+            lay.setAlignment(FlowLayout.LEFT);
+            JPanel pane =3D new JPanel(lay) ;
+            JLabel label =3D new JLabel("<html>" + disp + "</html>") ;
             if (isSelected) {
                 pane.setBackground(Color.LIGHT_GRAY);
+            } else if (index % 2 =3D=3D 1) {
+                pane.setBackground(new Color(240, 248, 255));
             } else {
                 pane.setBackground(Color.WHITE);
             }
             pane.setToolTipText(tooltip);
-            pane.add(label, BorderLayout.WEST) ;
+            pane.add(getResolvedIcon()) ;
+            pane.add(label) ;
             return pane ;
         } else {
             return new JLabel(value.toString()) ;

Modified: trunk/integrity/src/main/java/org/jahia/integrity/view/CommitReso=
lver.java
URL: https://svndev.jahia.net/websvn/diff.php?path=3D/trunk/integrity/src/m=
ain/java/org/jahia/integrity/view/CommitResolver.java&rev=3D50&repname=3Dja=
hia_upgrade
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/integrity/src/main/java/org/jahia/integrity/view/CommitResolver.j=
ava (original)
+++ trunk/integrity/src/main/java/org/jahia/integrity/view/CommitResolver.j=
ava Tue Jun  5 17:43:00 2007
@@ -18,7 +18,9 @@
     private JTextArea reason;
     private JTextField date;
 =

-    public CommitResolver(Controller ctrl, String author, String branch) {
+    public CommitResolver(JComponent comp, Controller ctrl, String author,=
 String branch, String commit, String date) {
+
+        setLocationRelativeTo(comp);
 =

         setTitle("Commit resolver");
 =

@@ -28,6 +30,13 @@
 =

         this.author.setText(author);
         this.branch.setText(branch);
+        this.commit.setText(commit);
+        this.date.setText(date);
+
+        this.author.setEnabled(false);
+        this.branch.setEnabled(false);
+        this.commit.setEnabled(false);
+        this.date.setEnabled(false);
 =

         setContentPane(contentPane);
         setModal(false);

Modified: trunk/integrity/src/main/java/org/jahia/integrity/view/MainPanel.=
form
URL: https://svndev.jahia.net/websvn/diff.php?path=3D/trunk/integrity/src/m=
ain/java/org/jahia/integrity/view/MainPanel.form&rev=3D50&repname=3Djahia_u=
pgrade
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/integrity/src/main/java/org/jahia/integrity/view/MainPanel.form (=
original)
+++ trunk/integrity/src/main/java/org/jahia/integrity/view/MainPanel.form T=
ue Jun  5 17:43:00 2007
@@ -186,22 +186,13 @@
               <text value=3D"Save displayed log"/>
             </properties>
           </component>
-          <component id=3D"93c70" class=3D"javax.swing.JButton" binding=3D=
"clearLogButton" default-binding=3D"true">
+          <component id=3D"7f716" class=3D"javax.swing.JButton" binding=3D=
"resolveCommitsButton" default-binding=3D"true">
             <constraints>
               <grid row=3D"0" column=3D"1" row-span=3D"1" col-span=3D"1" v=
size-policy=3D"0" hsize-policy=3D"3" anchor=3D"0" fill=3D"1" indent=3D"0" u=
se-parent-layout=3D"false"/>
-              <gridbag top=3D"0" left=3D"10" bottom=3D"0" right=3D"10" wei=
ghtx=3D"0.0" weighty=3D"0.0"/>
-            </constraints>
-            <properties>
-              <text value=3D"Clear logs"/>
-            </properties>
-          </component>
-          <component id=3D"4e2e8" class=3D"javax.swing.JButton" binding=3D=
"resolveCommitButton" default-binding=3D"true">
-            <constraints>
-              <grid row=3D"0" column=3D"2" row-span=3D"1" col-span=3D"1" v=
size-policy=3D"0" hsize-policy=3D"3" anchor=3D"0" fill=3D"1" indent=3D"0" u=
se-parent-layout=3D"false"/>
               <gridbag top=3D"0" left=3D"10" bottom=3D"0" right=3D"0" weig=
htx=3D"0.0" weighty=3D"0.0"/>
             </constraints>
             <properties>
-              <text value=3D"Resolve commit..."/>
+              <text value=3D"Resolve commits..."/>
             </properties>
           </component>
         </children>

Modified: trunk/integrity/src/main/java/org/jahia/integrity/view/MainPanel.=
java
URL: https://svndev.jahia.net/websvn/diff.php?path=3D/trunk/integrity/src/m=
ain/java/org/jahia/integrity/view/MainPanel.java&rev=3D50&repname=3Djahia_u=
pgrade
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/integrity/src/main/java/org/jahia/integrity/view/MainPanel.java (=
original)
+++ trunk/integrity/src/main/java/org/jahia/integrity/view/MainPanel.java T=
ue Jun  5 17:43:00 2007
@@ -20,6 +20,8 @@
  * @version May 22, 2007
  */
 public class MainPanel {
+    private Controller controller;
+
     private JPanel panel1;
     private JTextField start;
     private JTextField stop;
@@ -29,19 +31,26 @@
     private JList goodCommitsDisplay;
     private JTextField server;
     private JTextField branch;
-    private JButton clearLogButton;
     private JTabbedPane tabbedPane1;
     private JList badCommitsDisplay;
     private JComboBox authors;
     private JLabel queryTime;
-    private JButton resolveCommitButton;
     private JList resolvedCommitsDisplay;
+    private JButton resolveCommitsButton;
 =

     private ArrayListModel goodListModel =3D new ArrayListModel(null);
     private ArrayListModel badListModel =3D new ArrayListModel(null);
     private ArrayListModel resolvedListModel =3D new ArrayListModel(null);
 =

     public MainPanel(final Controller controller) {
+        this.controller =3D controller;
+
+        ListCellRenderer renderer =3D new ArrayListRenderer();
+
+        goodCommitsDisplay.setCellRenderer(renderer);
+        badCommitsDisplay.setCellRenderer(renderer);
+        resolvedCommitsDisplay.setCellRenderer(renderer);
+
         startQuery.addActionListener(new ActionListener() {
             public void actionPerformed(ActionEvent e) {
                 try {
@@ -60,9 +69,14 @@
         saveLog.addActionListener(new ActionListener() {
             public void actionPerformed(ActionEvent e) {
                 File saveFile =3D GUITools.selectSaveLocation(tabbedPane1,=
 "Select save location", "/", false);
-                if (saveFile !=3D null) {
-                    // TODO
-                    //controller.saveLogToFile(saveFile, badCommitsDisplay=
.isShowing() ? badCommitsDisplay.getText() : goodCommitsDisplay.getText());
+                if (saveFile !=3D null && authors.getItemCount() > 0) {
+                    int listToPrint =3D 0;
+                    if (badCommitsDisplay.isShowing()) {
+                        listToPrint =3D 1;
+                    } else if (resolvedCommitsDisplay.isShowing()) {
+                        listToPrint =3D 2;
+                    }
+                    controller.saveLogToFile(saveFile, authors.getSelected=
Item().toString(), listToPrint);
                 }
 =

             }
@@ -112,14 +126,27 @@
                 }
             }
         });
-        resolveCommitButton.addActionListener(new ActionListener() {
+        resolveCommitsButton.addActionListener(new ActionListener() {
             public void actionPerformed(ActionEvent e) {
-                if (authors.getItemCount() > 0)
-                    new CommitResolver(controller, authors.getSelectedItem=
().toString(), branch.getText()).setVisible(true);
+                if (badCommitsDisplay.isShowing() && authors.getItemCount(=
) > 0 && badCommitsDisplay.getSelectedIndices().length > 0) {
+                    resolveCommit(badCommitsDisplay.getSelectedIndices());
+                }
             }
         });
     }
 =

+    public void resolveCommit(int[] indices) {
+        StringBuffer commits =3D new StringBuffer();
+        for (int i =3D 0; i < indices.length; i++) {
+            Commit com =3D (Commit) badListModel.getElementAt(indices[i]);
+            commits.append(com.getRevision());
+            if (i < indices.length - 1) {
+                commits.append(",");
+            }
+        }
+        new CommitResolver(panel1, controller, authors.getSelectedItem().t=
oString(), branch.getText(), commits.toString(), new Date(System.currentTim=
eMillis()).toString()).setVisible(true);
+    }
+
     public void display(String message) {
         JOptionPane.showMessageDialog(swingComponent(), message, "Notifica=
tion", JOptionPane.INFORMATION_MESSAGE);
     }
@@ -150,8 +177,8 @@
      * @param commitsRetrieved the retrieved commits
      */
     public void onCommitsRetrieved(Trio<ArrayList<Pair<Commit, Commit>>, A=
rrayList<Commit>, ArrayList<ResolvedCommit>> commitsRetrieved) {
-        ArrayList<Commit> badCommits =3D commitsRetrieved.second;
         ArrayList<Pair<Commit, Commit>> goodCommits =3D commitsRetrieved.f=
irst;
+        ArrayList<Commit> badCommits =3D commitsRetrieved.second;
         ArrayList<ResolvedCommit> resolvedCommits =3D commitsRetrieved.thi=
rd;
 =

         badListModel.replaceElements(badCommits);
@@ -162,19 +189,17 @@
         resolvedListModel.fireContentChanged();
     }
 =

+    public void onCommitsResolved(String author) {
+        startQuery.doClick();
+        badCommitsDisplay.clearSelection();
+    }
+
     private void createUIComponents() {
         goodCommitsDisplay =3D new JList(goodListModel);
         badCommitsDisplay =3D new JList(badListModel);
         resolvedCommitsDisplay =3D new JList(resolvedListModel);
-        ListCellRenderer renderer =3D new ArrayListRenderer();
-        goodCommitsDisplay.setCellRenderer(renderer);
-        badCommitsDisplay.setCellRenderer(renderer);
-        resolvedCommitsDisplay.setCellRenderer(renderer);
-        goodCommitsDisplay.addMouseListener(new MouseAdapter() {
-            public void mousePressed(MouseEvent e) {
-                goodCommitsDisplay.validate();
-            }
-        });
+
+
     }
 =

     {
@@ -360,22 +385,14 @@
         gbc.fill =3D GridBagConstraints.HORIZONTAL;
         gbc.insets =3D new Insets(0, 0, 0, 10);
         panel3.add(saveLog, gbc);
-        clearLogButton =3D new JButton();
-        clearLogButton.setText("Clear logs");
+        resolveCommitsButton =3D new JButton();
+        resolveCommitsButton.setText("Resolve commits...");
         gbc =3D new GridBagConstraints();
         gbc.gridx =3D 1;
         gbc.gridy =3D 0;
         gbc.fill =3D GridBagConstraints.HORIZONTAL;
-        gbc.insets =3D new Insets(0, 10, 0, 10);
-        panel3.add(clearLogButton, gbc);
-        resolveCommitButton =3D new JButton();
-        resolveCommitButton.setText("Resolve commit...");
-        gbc =3D new GridBagConstraints();
-        gbc.gridx =3D 2;
-        gbc.gridy =3D 0;
-        gbc.fill =3D GridBagConstraints.HORIZONTAL;
         gbc.insets =3D new Insets(0, 10, 0, 0);
-        panel3.add(resolveCommitButton, gbc);
+        panel3.add(resolveCommitsButton, gbc);
         tabbedPane1 =3D new JTabbedPane();
         panel1.add(tabbedPane1, BorderLayout.CENTER);
         tabbedPane1.setBorder(BorderFactory.createTitledBorder(BorderFacto=
ry.createEmptyBorder(5, 0, 0, 0), null));

Modified: trunk/integrity/src/main/java/org/jahia/integrity/view/MainWindow=
.java
URL: https://svndev.jahia.net/websvn/diff.php?path=3D/trunk/integrity/src/m=
ain/java/org/jahia/integrity/view/MainWindow.java&rev=3D50&repname=3Djahia_=
upgrade
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/integrity/src/main/java/org/jahia/integrity/view/MainWindow.java =
(original)
+++ trunk/integrity/src/main/java/org/jahia/integrity/view/MainWindow.java =
Tue Jun  5 17:43:00 2007
@@ -57,4 +57,8 @@
         main.onCommitsRetrieved(commitsRetrieved);
     }
 =

+    public void onCommitsResolved(String author) {
+        main.onCommitsResolved(author);
+    }
+
 }

Modified: trunk/integrity/src/main/resources/META-INF/MANIFEST.MF
URL: https://svndev.jahia.net/websvn/diff.php?path=3D/trunk/integrity/src/m=
ain/resources/META-INF/MANIFEST.MF&rev=3D50&repname=3Djahia_upgrade
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/integrity/src/main/resources/META-INF/MANIFEST.MF (original)
+++ trunk/integrity/src/main/resources/META-INF/MANIFEST.MF Tue Jun  5 17:4=
3:00 2007
@@ -7,4 +7,4 @@
 Main-Class: org.jahia.integrity.Application
 mode: development
 url: http://www.jahia.net/jahia/page915.html
-Class-Path: lib/svnkit.jar
+Class-Path: lib/svnkit.jar lib/mysql-connector-java-5.0.5-bin.jar

Added: trunk/integrity/src/main/resources/org/jahia/integrity/resources/mis=
sing.png
URL: https://svndev.jahia.net/websvn/filedetails.php?path=3D/trunk/integrit=
y/src/main/resources/org/jahia/integrity/resources/missing.png&rev=3D50&rep=
name=3Djahia_upgrade
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
Binary file - no diff available.

Added: trunk/integrity/src/main/resources/org/jahia/integrity/resources/ok.=
png
URL: https://svndev.jahia.net/websvn/filedetails.php?path=3D/trunk/integrit=
y/src/main/resources/org/jahia/integrity/resources/ok.png&rev=3D50&repname=
=3Djahia_upgrade
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
Binary file - no diff available.

Added: trunk/integrity/src/main/resources/org/jahia/integrity/resources/res=
olved.png
URL: https://svndev.jahia.net/websvn/filedetails.php?path=3D/trunk/integrit=
y/src/main/resources/org/jahia/integrity/resources/resolved.png&rev=3D50&re=
pname=3Djahia_upgrade
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
Binary file - no diff available.

_______________________________________________
cvs_list mailing list
[email protected]
http://lists.jahia.org/cgi-bin/mailman/listinfo/cvs_list

Reply via email to