You can subscribe to this list here.
2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(111) |
Jul
(258) |
Aug
(21) |
Sep
|
Oct
|
Nov
|
Dec
|
---|---|---|---|---|---|---|---|---|---|---|---|---|
2003 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <cry...@us...> - 2002-07-31 01:36:11
|
Update of /cvsroot/cdchamber/CDChamber/test/testcase In directory usw-pr-cvs1:/tmp/cvs-serv7228 Added Files: bad.zip Log Message: add bad.zip --- NEW FILE: bad.zip --- (This appears to be a binary file; contents omitted.) |
From: <cry...@us...> - 2002-07-31 01:34:31
|
Update of /cvsroot/cdchamber/CDChamber/test/src/org/cdchamber/elements In directory usw-pr-cvs1:/tmp/cvs-serv6907 Added Files: CompressedFileTypeTest.java Log Message: CompressedFileTypeTest added --- NEW FILE: CompressedFileTypeTest.java --- // $Id: CompressedFileTypeTest.java,v 1.1 2002/07/31 01:34:27 crystal_y Exp $ package org.cdchamber.elements; import junit.framework.*; import org.cdchamber.parser.FileParseException; import org.cdchamber.util.DirPath; public class CompressedFileTypeTest extends TestCase { public CompressedFileTypeTest(String name) { super(name); } public void setUp() { } public void tearDown() { } public void testJarFile() { try { CompressedFileType compressFile = new CompressedFileType(DirPath.TestCaseDir + DirPath.SEP + "testcase.jar"); assertEquals(4,compressFile.getFilesCount()); } catch (FileParseException e) { fail("there should be no exception throwed out"); } // end of try-catch } public void testZipFile() { try { CompressedFileType compressFile = new CompressedFileType(DirPath.TestCaseDir + DirPath.SEP + "testcase.zip"); assertEquals(3,compressFile.getFilesCount()); } catch (FileParseException e) { fail("there should be no exception throwed out"); } // end of try-catch } public void testBadCompressFile() { try { CompressedFileType compressFile = new CompressedFileType(DirPath.TestCaseDir + DirPath.SEP + "bad.zip"); } catch (FileParseException e) { return; } // end of try-catch fail("there should be one exception throwed out"); } } |
From: <sim...@us...> - 2002-07-30 12:51:15
|
Update of /cvsroot/cdchamber/CDChamber In directory usw-pr-cvs1:/tmp/cvs-serv26341 Modified Files: build.xml Log Message: Bug fix for file size sum. Index: build.xml =================================================================== RCS file: /cvsroot/cdchamber/CDChamber/build.xml,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** build.xml 30 Jul 2002 09:49:25 -0000 1.33 --- build.xml 30 Jul 2002 12:51:05 -0000 1.34 *************** *** 153,157 **** </java> </target> ! <target name="dist" depends="" description="Make the distributed version"> <zip destfile="${build.dir}/CDChamber.zip"> <zipfileset dir="${jar.dir}" includes="CDChamber.jar" fullpath="lib/CDChamber.jar"/> --- 153,157 ---- </java> </target> ! <target name="dist" depends="jar" description="Make the distributed version"> <zip destfile="${build.dir}/CDChamber.zip"> <zipfileset dir="${jar.dir}" includes="CDChamber.jar" fullpath="lib/CDChamber.jar"/> |
From: <sim...@us...> - 2002-07-30 12:51:14
|
Update of /cvsroot/cdchamber/CDChamber/aspect/gen/org/cdchamber/elements In directory usw-pr-cvs1:/tmp/cvs-serv26341/aspect/gen/org/cdchamber/elements Modified Files: DirectoryTypeWrapper.java Log Message: Bug fix for file size sum. Index: DirectoryTypeWrapper.java =================================================================== RCS file: /cvsroot/cdchamber/CDChamber/aspect/gen/org/cdchamber/elements/DirectoryTypeWrapper.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** DirectoryTypeWrapper.java 26 Jul 2002 13:17:20 -0000 1.4 --- DirectoryTypeWrapper.java 30 Jul 2002 12:51:05 -0000 1.5 *************** *** 17,21 **** File[] files = dir.listFiles(); ! int sumSize = 0; for ( int i=0; i<files.length; i++) { if ( !FileFilters.accept( files[i])) continue; --- 17,21 ---- File[] files = dir.listFiles(); ! long sumSize = 0; for ( int i=0; i<files.length; i++) { if ( !FileFilters.accept( files[i])) continue; |
From: <sim...@us...> - 2002-07-30 09:49:33
|
Update of /cvsroot/cdchamber/CDChamber In directory usw-pr-cvs1:/tmp/cvs-serv26346 Modified Files: build.xml Log Message: Add dist build target and lunch script for windows and linux. Index: build.xml =================================================================== RCS file: /cvsroot/cdchamber/CDChamber/build.xml,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** build.xml 30 Jul 2002 08:18:56 -0000 1.32 --- build.xml 30 Jul 2002 09:49:25 -0000 1.33 *************** *** 153,156 **** </java> </target> ! </project> --- 153,164 ---- </java> </target> ! <target name="dist" depends="" description="Make the distributed version"> ! <zip destfile="${build.dir}/CDChamber.zip"> ! <zipfileset dir="${jar.dir}" includes="CDChamber.jar" fullpath="lib/CDChamber.jar"/> ! <zipfileset dir="${basedir}/script/" includes="CDChamber.bat,CDChamber.sh"/> ! <zipfileset dir="${basedir}/images" prefix="images/"/> ! <zipfileset dir="${basedir}/lib" prefix="lib/" excludes="ant.jar,aspectj-ant.jar,aspectjrt.jar,aspectjtools.jar,junit.jar,optional.jar"/> ! <zipfileset dir="${basedir}" includes="NoSuchFile" prefix="data/"/> ! </zip> ! </target> </project> |
From: <sim...@us...> - 2002-07-30 09:49:32
|
Update of /cvsroot/cdchamber/CDChamber/script In directory usw-pr-cvs1:/tmp/cvs-serv26346/script Added Files: CDChamber.bat CDChamber.sh Log Message: Add dist build target and lunch script for windows and linux. --- NEW FILE: CDChamber.bat --- @echo off ::---------------------------------------------------------------------- :: CDChamber Startup Script :: $Id: CDChamber.bat,v 1.1 2002/07/30 09:49:25 simon_lei Exp $ ::---------------------------------------------------------------------- ::---------------------------------------------------------------------- :: Set the classpathes. ::---------------------------------------------------------------------- SET CLASSPATH=.\lib;%CLASSPATH%;.\lib\CDChamber.jar SET CLASSPATH=%CLASSPATH%;.\lib\castor-0.9.3.19.jar;.\lib\jazzlib0.04.jar SET CLASSPATH=%CLASSPATH%;.\lib\jcalendar.jar;.\lib\kunststoff.jar SET CLASSPATH=%CLASSPATH%;.\lib\xalan.jar;.\lib\xercesImpl.jar;.\lib\xmlParserAPIs.jar ::---------------------------------------------------------------------- :: Run CDChamber ::---------------------------------------------------------------------- java -classpath %CLASSPATH% org.cdchamber.gui.CDChamber --- NEW FILE: CDChamber.sh --- #!/bin/bash #---------------------------------------------------------------------- # CDChamber Startup Script # $Id: CDChamber.sh,v 1.1 2002/07/30 09:49:25 simon_lei Exp $ #---------------------------------------------------------------------- APP_DIR="." LIB_DIR="$APP_DIR/lib" #---------------------------------------------------------------------- # Set the classpathes. #---------------------------------------------------------------------- for c in $LIB_DIR/*.jar do CLASS_PATH="$CLASS_PATH:$c" done export CLASS_PATH="$LIB_DIR:$CLASS_PATH" #---------------------------------------------------------------------- # Run CDChamber #---------------------------------------------------------------------- java -classpath $CLASS_PATH org.cdchamber.gui.CDChamber |
From: <sim...@us...> - 2002-07-30 09:49:32
|
Update of /cvsroot/cdchamber/CDChamber/src/org/cdchamber/gui In directory usw-pr-cvs1:/tmp/cvs-serv26346/src/org/cdchamber/gui Modified Files: AboutDialog.java Log Message: Add dist build target and lunch script for windows and linux. Index: AboutDialog.java =================================================================== RCS file: /cvsroot/cdchamber/CDChamber/src/org/cdchamber/gui/AboutDialog.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** AboutDialog.java 30 Jul 2002 05:12:12 -0000 1.2 --- AboutDialog.java 30 Jul 2002 09:49:25 -0000 1.3 *************** *** 17,21 **** public class AboutDialog extends JDialog implements ActionListener, HyperlinkListener { ! String product = "CDChamber $Revision$"; String copyright = "Simon & Crystal Copyright (c) 2002"; String comments = "The CDChamber, manage your cdroms. <br>Contact us at <br><a href=\"http://www.sourceforge.net/projects/cdchamber/\">http://www.sourceforge.net/projects/cdchamber/</a>"; --- 17,21 ---- public class AboutDialog extends JDialog implements ActionListener, HyperlinkListener { ! String product = "CDChamber 1.0alpha"; String copyright = "Simon & Crystal Copyright (c) 2002"; String comments = "The CDChamber, manage your cdroms. <br>Contact us at <br><a href=\"http://www.sourceforge.net/projects/cdchamber/\">http://www.sourceforge.net/projects/cdchamber/</a>"; |
From: <sim...@us...> - 2002-07-30 08:23:34
|
Update of /cvsroot/cdchamber/CDChamber/images In directory usw-pr-cvs1:/tmp/cvs-serv25978/images Added Files: SortDown.gif SortUp.gif Log Message: Add the sort icon. --- NEW FILE: SortDown.gif --- (This appears to be a binary file; contents omitted.) --- NEW FILE: SortUp.gif --- (This appears to be a binary file; contents omitted.) |
From: <sim...@us...> - 2002-07-30 08:18:59
|
Update of /cvsroot/cdchamber/CDChamber In directory usw-pr-cvs1:/tmp/cvs-serv24038 Modified Files: build.xml Log Message: Clean the generated files in clean target of build.xml Index: build.xml =================================================================== RCS file: /cvsroot/cdchamber/CDChamber/build.xml,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** build.xml 29 Jul 2002 02:22:08 -0000 1.31 --- build.xml 30 Jul 2002 08:18:56 -0000 1.32 *************** *** 68,71 **** --- 68,72 ---- <target name="clean" description="Clean all build products"> <delete dir="${build.dir}"/> + <delete dir="${src.dir}/org/cdchamber/elements"/> </target> |
From: <sim...@us...> - 2002-07-30 08:05:39
|
Update of /cvsroot/cdchamber/CDChamber/test/src/org/cdchamber/gui In directory usw-pr-cvs1:/tmp/cvs-serv19597/test/src/org/cdchamber/gui Modified Files: CDCMainFrameTest.java Log Message: Let the testcase independs of os Index: CDCMainFrameTest.java =================================================================== RCS file: /cvsroot/cdchamber/CDChamber/test/src/org/cdchamber/gui/CDCMainFrameTest.java,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** CDCMainFrameTest.java 30 Jul 2002 06:00:14 -0000 1.15 --- CDCMainFrameTest.java 30 Jul 2002 08:05:36 -0000 1.16 *************** *** 108,112 **** assertEquals( "Root should be selected", 0, frame.directoryTree.getSelectionModel().getLeadSelectionRow()); ! assertEquals( "Second file in table be selected since the table sorted.", 1, frame.filesTable.getSelectedRow()); } --- 108,113 ---- assertEquals( "Root should be selected", 0, frame.directoryTree.getSelectionModel().getLeadSelectionRow()); ! FilesTableModel model = (FilesTableModel)frame.filesTable.getModel(); ! assertEquals( "Second file in table be selected since the table sorted.", selected, model.files.elementAt( frame.filesTable.getSelectedRow())); } |
From: <sim...@us...> - 2002-07-30 07:55:44
|
Update of /cvsroot/cdchamber/CDChamber/script In directory usw-pr-cvs1:/tmp/cvs-serv16479 Modified Files: continuousintegrate.sh Log Message: Use touch to let the files regerated. Index: continuousintegrate.sh =================================================================== RCS file: /cvsroot/cdchamber/CDChamber/script/continuousintegrate.sh,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** continuousintegrate.sh 30 Jul 2002 07:45:58 -0000 1.9 --- continuousintegrate.sh 30 Jul 2002 07:55:39 -0000 1.10 *************** *** 7,15 **** CLASSPATH=$PROJECT_LIB_DIR:$CLASSPATH ! export CLASSPATH BUILD_DIR cd $BUILD_DIR/CDChamber if [[ -n `cvs update -d 2>&1 | egrep -e '^U|^P|^A'` ]] then >${BUILD_DIR}/log/build.log #unit test will run because build.jar depends on build.test.run #while acceptance depends on jar file --- 7,17 ---- CLASSPATH=$PROJECT_LIB_DIR:$CLASSPATH ! export CLASSPATH BUILD_DIR cd $BUILD_DIR/CDChamber if [[ -n `cvs update -d 2>&1 | egrep -e '^U|^P|^A'` ]] then >${BUILD_DIR}/log/build.log + # Use touch to let the files re generated. + touch $BUILD_DIR/CDChamber/src/cdchamber.xsd #unit test will run because build.jar depends on build.test.run #while acceptance depends on jar file *************** *** 20,29 **** let build_number=$build_number+1 echo $build_number > $BUILD_DIR/log/build.number ! fi ! if [[ -n `grep 'BUILD FAILED' $BUILD_DIR/log/build.log` ]] ! then $BUILD_DIR/remote-mailx "Build Failed!" 2>&1 > /dev/null ! elif [[ -n `grep 'BUILD FAILED' $BUILD_DIR/log/build.log.old` ]] then $BUILD_DIR/remote-mailx "Build Fixed! Build Number:$build_number" 2>&1 > /dev/null --- 22,31 ---- let build_number=$build_number+1 echo $build_number > $BUILD_DIR/log/build.number ! fi ! if [[ -n `grep 'BUILD FAILED' $BUILD_DIR/log/build.log` ]] ! then $BUILD_DIR/remote-mailx "Build Failed!" 2>&1 > /dev/null ! elif [[ -n `grep 'BUILD FAILED' $BUILD_DIR/log/build.log.old` ]] then $BUILD_DIR/remote-mailx "Build Fixed! Build Number:$build_number" 2>&1 > /dev/null |
From: <cry...@us...> - 2002-07-30 07:46:01
|
Update of /cvsroot/cdchamber/CDChamber/script In directory usw-pr-cvs1:/tmp/cvs-serv14195 Modified Files: continuousintegrate.sh Log Message: total mistake\! Index: continuousintegrate.sh =================================================================== RCS file: /cvsroot/cdchamber/CDChamber/script/continuousintegrate.sh,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** continuousintegrate.sh 30 Jul 2002 05:40:24 -0000 1.8 --- continuousintegrate.sh 30 Jul 2002 07:45:58 -0000 1.9 *************** *** 12,21 **** then >${BUILD_DIR}/log/build.log - # delete one original files to make castor_gen and ajc_gen regenerate - mv -f $BUILD_DIR/CDChamber/src/cdchamber.xsd $BUILD_DIR/CDChamber/src/cdchamber.xsd.bak #unit test will run because build.jar depends on build.test.run #while acceptance depends on jar file $BUILD_DIR/acceptance.sh >> $BUILD_DIR/log/build.log - mv -f $BUILD_DIR/CDChamber/src/cdchamber.xsd.bak $BUILD_DIR/CDChamber/src/cdchamber.xsd if [[ -z `grep 'BUILD FAILED' $BUILD_DIR/log/build.log` ]] then --- 12,18 ---- |
From: <sim...@us...> - 2002-07-30 07:32:21
|
Update of /cvsroot/cdchamber/CDChamber/src In directory usw-pr-cvs1:/tmp/cvs-serv10505/src Modified Files: cdchamber.xsd Log Message: Let CDRomType be an element in xsd file. All data files saved as CDRomType Index: cdchamber.xsd =================================================================== RCS file: /cvsroot/cdchamber/CDChamber/src/cdchamber.xsd,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** cdchamber.xsd 26 Jul 2002 14:00:47 -0000 1.4 --- cdchamber.xsd 30 Jul 2002 07:32:18 -0000 1.5 *************** *** 23,25 **** --- 23,34 ---- </xs:complexContent> </xs:complexType> + <xs:element name="CDRomType"> + <xs:complexType> + <xs:complexContent> + <xs:extension base="DirectoryType"> + <xs:attribute name="dataFileName" type="xs:string" use="required"/> + </xs:extension> + </xs:complexContent> + </xs:complexType> + </xs:element> </xs:schema> |
From: <sim...@us...> - 2002-07-30 07:32:21
|
Update of /cvsroot/cdchamber/CDChamber/src/org/cdchamber/gui In directory usw-pr-cvs1:/tmp/cvs-serv10505/src/org/cdchamber/gui Modified Files: CDCMainFrameController.java Log Message: Let CDRomType be an element in xsd file. All data files saved as CDRomType Index: CDCMainFrameController.java =================================================================== RCS file: /cvsroot/cdchamber/CDChamber/src/org/cdchamber/gui/CDCMainFrameController.java,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** CDCMainFrameController.java 30 Jul 2002 05:12:13 -0000 1.20 --- CDCMainFrameController.java 30 Jul 2002 07:32:18 -0000 1.21 *************** *** 8,11 **** --- 8,12 ---- import org.cdchamber.elements.*; + import org.cdchamber.elements.CDRomType; import org.cdchamber.util.DirPath; import org.cdchamber.searcher.Searcher; *************** *** 44,49 **** if (rootFiles[i].isDirectory()) continue; try { ! DirectoryType vFiles = DirectoryType.unmarshalDirectoryType(new FileReader(rootFiles[i])); ! CDRomType cdrom = new CDRomType(vFiles); cdrom.setDataFileName(rootFiles[i].getAbsolutePath()); root.addFiles(cdrom); --- 45,49 ---- if (rootFiles[i].isDirectory()) continue; try { ! CDRomType cdrom = CDRomType.unmarshalCDRomType(new FileReader(rootFiles[i])); cdrom.setDataFileName(rootFiles[i].getAbsolutePath()); root.addFiles(cdrom); *************** *** 164,171 **** String dataFileName = DirPath.DataDir + DirPath.SEP + System.currentTimeMillis() + ".xml"; FileWriter out = new FileWriter(dataFileName); ! dirType.marshal(out); out.close(); ! roots.addFiles(new CDRomType(dirType, dataFileName)); frame.setDirectoryTreeModel(new FileTreeModel(roots)); } catch (Exception e1) { --- 164,172 ---- String dataFileName = DirPath.DataDir + DirPath.SEP + System.currentTimeMillis() + ".xml"; FileWriter out = new FileWriter(dataFileName); ! CDRomType cdrom = new CDRomType(dirType, dataFileName); ! cdrom.marshal(out); out.close(); ! roots.addFiles( cdrom); frame.setDirectoryTreeModel(new FileTreeModel(roots)); } catch (Exception e1) { *************** *** 192,199 **** String dataFileName = DirPath.DataDir + DirPath.SEP + System.currentTimeMillis() + ".xml"; FileWriter out = new FileWriter(dataFileName); ! dirType.marshal(out); out.close(); ! roots.addFiles(new CDRomType(dirType, dataFileName)); frame.setDirectoryTreeModel(new FileTreeModel(roots)); } catch (Exception e1) { --- 193,202 ---- String dataFileName = DirPath.DataDir + DirPath.SEP + System.currentTimeMillis() + ".xml"; FileWriter out = new FileWriter(dataFileName); ! ! CDRomType cdrom = new CDRomType(dirType, dataFileName); ! cdrom.marshal(out); out.close(); ! roots.addFiles(cdrom); frame.setDirectoryTreeModel(new FileTreeModel(roots)); } catch (Exception e1) { |
From: <sim...@us...> - 2002-07-30 07:32:21
|
Update of /cvsroot/cdchamber/CDChamber/aspect/gen/org/cdchamber/elements In directory usw-pr-cvs1:/tmp/cvs-serv10505/aspect/gen/org/cdchamber/elements Added Files: CDRomTypeWrapper.java Log Message: Let CDRomType be an element in xsd file. All data files saved as CDRomType --- NEW FILE: CDRomTypeWrapper.java --- /* * User: Simon * $Id: CDRomTypeWrapper.java,v 1.1 2002/07/30 07:32:18 simon_lei Exp $ */ package org.cdchamber.elements; import org.exolab.castor.xml.MarshalException; import org.exolab.castor.xml.ValidationException; import java.io.*; public aspect CDRomTypeWrapper { public void CDRomType.delete() { File dataFile = new File(getDataFileName()); dataFile.delete(); } public CDRomType.new( DirectoryType dir, String dataFileName) { this( dir); this.setDataFileName( dataFileName); } public CDRomType.new(DirectoryType dir) { super(); this.setContent(dir.getContent()); this.setDate(dir.getDate()); this.setDesc(dir.getDesc()); this.setFiles(dir.getFiles()); this.setName(dir.getName()); this.setSize(dir.getSize()); } public void CDRomType.marshal() throws MarshalException, ValidationException, IOException { Writer out = new FileWriter(getDataFileName()); marshal(out); out.close(); } } |
From: <sim...@us...> - 2002-07-30 07:32:21
|
Update of /cvsroot/cdchamber/CDChamber/src/org/cdchamber/elements In directory usw-pr-cvs1:/tmp/cvs-serv10505/src/org/cdchamber/elements Removed Files: CDRomType.java Log Message: Let CDRomType be an element in xsd file. All data files saved as CDRomType --- CDRomType.java DELETED --- |
From: <sim...@us...> - 2002-07-30 06:37:24
|
Update of /cvsroot/cdchamber/CDChamber/test/src/org/cdchamber/gui In directory usw-pr-cvs1:/tmp/cvs-serv25391/test/src/org/cdchamber/gui Added Files: FilesTableTest.java Log Message: Add testcases for FilesTable and TableModels. --- NEW FILE: FilesTableTest.java --- /* * User: Simon * $Id: FilesTableTest.java,v 1.1 2002/07/30 06:37:19 simon_lei Exp $ */ package org.cdchamber.gui; import junit.framework.TestCase; import org.cdchamber.elements.*; import org.cdchamber.elements.FileType; import javax.swing.tree.DefaultMutableTreeNode; public class FilesTableTest extends TestCase { private DirectoryType dir; private FileType vFile; private DirectoryType vDir; private CompressedFileType vCompress; private FilesTable filesTable; private FilesTableModel model; protected void setUp() throws Exception { super.setUp(); dir = new DirectoryType(); vFile = new FileType(); vFile.setName( "a"); vFile.setDate( 1); vFile.setSize( 1); vFile.setDesc( "d"); dir.addFiles( vFile); vDir = new DirectoryType(); vDir.setName( "c"); vDir.setDate( 3); vDir.setSize( 2); vDir.setDesc( "a"); dir.addFiles( vDir); vCompress = new CompressedFileType(); vCompress.setName( "b"); vCompress.setDate( 2); vCompress.setSize( 3); vCompress.setDesc( "b"); dir.addFiles( vCompress); filesTable = new FilesTable(); filesTable.setModel( new FilesTableModel( new DefaultMutableTreeNode(dir))); model = (FilesTableModel)filesTable.getModel(); } protected void tearDown() throws Exception { super.tearDown(); } public FilesTableTest(String s) { super(s); } public void testNameSort() { assertEquals( "0 should be compressed file", vCompress, model.files.get(0)); assertEquals( "1 should be dir file", vDir, model.files.get(1)); assertEquals( "2 should be common file", vFile, model.files.get(2)); } public void testDateSort() { model.sortCol = FilesTableModel.DATE; model.sortAsc = false; model.sortData(); assertEquals( "0 date1", vDir, model.files.get(0)); assertEquals( "1 date1", vCompress, model.files.get(1)); assertEquals( "2 date1", vFile, model.files.get(2)); model.sortAsc = true; model.sortData(); assertEquals( "2 date2", vDir, model.files.get(2)); assertEquals( "1 date2", vCompress, model.files.get(1)); assertEquals( "0 date2", vFile, model.files.get(0)); } public void testSizeSort() { model.sortCol = FilesTableModel.SIZE; model.sortAsc = true; model.sortData(); assertEquals( "0 size1", vFile, model.files.get(0)); assertEquals( "1 size1", vDir, model.files.get(1)); assertEquals( "2 size1", vCompress, model.files.get(2)); model.sortAsc = false; model.sortData(); assertEquals( "0 size2", vCompress, model.files.get(0)); assertEquals( "1 size2", vDir, model.files.get(1)); assertEquals( "2 size2", vFile, model.files.get(2)); } public void testDescSort() { model.sortCol = FilesTableModel.DESC; model.sortAsc = true; model.sortData(); assertEquals( "0 desc1", vDir, model.files.get(0)); assertEquals( "1 desc1", vCompress, model.files.get(1)); assertEquals( "2 desc1", vFile, model.files.get(2)); model.sortAsc = false; model.sortData(); assertEquals( "0 desc2", vFile, model.files.get(0)); assertEquals( "1 desc2", vCompress, model.files.get(1)); assertEquals( "2 desc2", vDir, model.files.get(2)); } } |
From: <sim...@us...> - 2002-07-30 06:00:18
|
Update of /cvsroot/cdchamber/CDChamber/test/src/org/cdchamber/gui In directory usw-pr-cvs1:/tmp/cvs-serv10905/test/src/org/cdchamber/gui Modified Files: CDCMainFrameTest.java Log Message: Minor bug fix at the testcase. Index: CDCMainFrameTest.java =================================================================== RCS file: /cvsroot/cdchamber/CDChamber/test/src/org/cdchamber/gui/CDCMainFrameTest.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** CDCMainFrameTest.java 30 Jul 2002 05:16:33 -0000 1.14 --- CDCMainFrameTest.java 30 Jul 2002 06:00:14 -0000 1.15 *************** *** 94,98 **** assertTrue( "Should have the TableMouseAdapter", num > 0); listeners[ num].mouseClicked( event); - // do not know howto test mouse double click event. :( assertTrue( "Selected row should not be 0 now" + frame.directoryTree.getSelectionRows()[0], frame.directoryTree.getSelectionRows()[0] != 0); } --- 94,97 ---- *************** *** 109,113 **** assertEquals( "Root should be selected", 0, frame.directoryTree.getSelectionModel().getLeadSelectionRow()); ! assertEquals( "First file in table be selected", 1, frame.filesTable.getSelectedRow()); } --- 108,112 ---- assertEquals( "Root should be selected", 0, frame.directoryTree.getSelectionModel().getLeadSelectionRow()); ! assertEquals( "Second file in table be selected since the table sorted.", 1, frame.filesTable.getSelectedRow()); } |
From: <cry...@us...> - 2002-07-30 05:40:33
|
Update of /cvsroot/cdchamber/CDChamber/script In directory usw-pr-cvs1:/tmp/cvs-serv5988 Modified Files: continuousintegrate.sh Log Message: move cdchamber.xsd instead of deleting it Index: continuousintegrate.sh =================================================================== RCS file: /cvsroot/cdchamber/CDChamber/script/continuousintegrate.sh,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** continuousintegrate.sh 29 Jul 2002 02:58:38 -0000 1.7 --- continuousintegrate.sh 30 Jul 2002 05:40:24 -0000 1.8 *************** *** 13,20 **** >${BUILD_DIR}/log/build.log # delete one original files to make castor_gen and ajc_gen regenerate ! rm -f $BUILD_DIR/CDChamber/src/cdchamber.xsd #unit test will run because build.jar depends on build.test.run #while acceptance depends on jar file $BUILD_DIR/acceptance.sh >> $BUILD_DIR/log/build.log if [[ -z `grep 'BUILD FAILED' $BUILD_DIR/log/build.log` ]] then --- 13,21 ---- >${BUILD_DIR}/log/build.log # delete one original files to make castor_gen and ajc_gen regenerate ! mv -f $BUILD_DIR/CDChamber/src/cdchamber.xsd $BUILD_DIR/CDChamber/src/cdchamber.xsd.bak #unit test will run because build.jar depends on build.test.run #while acceptance depends on jar file $BUILD_DIR/acceptance.sh >> $BUILD_DIR/log/build.log + mv -f $BUILD_DIR/CDChamber/src/cdchamber.xsd.bak $BUILD_DIR/CDChamber/src/cdchamber.xsd if [[ -z `grep 'BUILD FAILED' $BUILD_DIR/log/build.log` ]] then |
From: <sim...@us...> - 2002-07-30 05:16:36
|
Update of /cvsroot/cdchamber/CDChamber/test/src/org/cdchamber/gui In directory usw-pr-cvs1:/tmp/cvs-serv434/test/src/org/cdchamber/gui Modified Files: CDCMainFrameTest.java Log Message: Testcase refactored, since the table is sorted now. Index: CDCMainFrameTest.java =================================================================== RCS file: /cvsroot/cdchamber/CDChamber/test/src/org/cdchamber/gui/CDCMainFrameTest.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** CDCMainFrameTest.java 29 Jul 2002 08:42:36 -0000 1.13 --- CDCMainFrameTest.java 30 Jul 2002 05:16:33 -0000 1.14 *************** *** 109,113 **** assertEquals( "Root should be selected", 0, frame.directoryTree.getSelectionModel().getLeadSelectionRow()); ! assertEquals( "First file in table be selected", 0, frame.filesTable.getSelectedRow()); } --- 109,113 ---- assertEquals( "Root should be selected", 0, frame.directoryTree.getSelectionModel().getLeadSelectionRow()); ! assertEquals( "First file in table be selected", 1, frame.filesTable.getSelectedRow()); } |
Update of /cvsroot/cdchamber/CDChamber/src/org/cdchamber/gui In directory usw-pr-cvs1:/tmp/cvs-serv31847/src/org/cdchamber/gui Modified Files: AboutDialog.java CDCMainFrame.java CDCMainFrameController.java FilesTable.java FilesTableModel.java Log Message: Tables can sort now. Index: AboutDialog.java =================================================================== RCS file: /cvsroot/cdchamber/CDChamber/src/org/cdchamber/gui/AboutDialog.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** AboutDialog.java 30 Jul 2002 02:26:17 -0000 1.1 --- AboutDialog.java 30 Jul 2002 05:12:12 -0000 1.2 *************** *** 8,11 **** --- 8,13 ---- import javax.swing.*; + import javax.swing.event.HyperlinkListener; + import javax.swing.event.HyperlinkEvent; import java.awt.event.*; import java.awt.*; *************** *** 13,17 **** import java.io.IOException; ! public class AboutDialog extends JDialog implements ActionListener { String product = "CDChamber $Revision$"; --- 15,19 ---- import java.io.IOException; ! public class AboutDialog extends JDialog implements ActionListener, HyperlinkListener { String product = "CDChamber $Revision$"; *************** *** 27,31 **** JLabel imageLabel= new JLabel( new ImageIcon( DirPath.getIconPath( "about.jpg"))); JTextPane textPane = new JTextPane(); ! try { textPane.setContentType("text/html"); --- 29,33 ---- JLabel imageLabel= new JLabel( new ImageIcon( DirPath.getIconPath( "about.jpg"))); JTextPane textPane = new JTextPane(); ! //HTMLDocument doc = new HTMLDocument(); try { textPane.setContentType("text/html"); *************** *** 36,45 **** sb.append( "</body></html>"); textPane.read( new StringReader( sb.toString()), "About CDChamber"); ! } catch ( IOException e) { e.printStackTrace(); } ! textPane.setEnabled( false); this.setTitle("About CDChamber"); this.setModal( true); --- 38,52 ---- sb.append( "</body></html>"); + //doc.insertString( doc.getEndPosition().getOffset(), sb.toString(), null); + + //textPane.setDocument( doc); textPane.read( new StringReader( sb.toString()), "About CDChamber"); ! ! } catch ( Exception e) { e.printStackTrace(); } ! textPane.addHyperlinkListener( this); ! textPane.setEditable( false); this.setTitle("About CDChamber"); this.setModal( true); *************** *** 76,78 **** --- 83,99 ---- cancel(); } + + public void hyperlinkUpdate(HyperlinkEvent e) { + if ( e.getEventType() != HyperlinkEvent.EventType.ACTIVATED) return; + try { + Runtime.getRuntime().exec("start " + e.getURL()); + } catch (IOException e1) { + try { + Runtime.getRuntime().exec("cmd /c \"start " + e.getURL() + "\""); + } catch (IOException e2) { + e2.printStackTrace(); + } + } + } + } Index: CDCMainFrame.java =================================================================== RCS file: /cvsroot/cdchamber/CDChamber/src/org/cdchamber/gui/CDCMainFrame.java,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** CDCMainFrame.java 30 Jul 2002 02:26:17 -0000 1.23 --- CDCMainFrame.java 30 Jul 2002 05:12:12 -0000 1.24 *************** *** 199,202 **** --- 199,203 ---- public void setFilesTableModel(TableModel model) { filesTable.setModel( model); + mainPane.setDividerLocation( 0.3); } Index: CDCMainFrameController.java =================================================================== RCS file: /cvsroot/cdchamber/CDChamber/src/org/cdchamber/gui/CDCMainFrameController.java,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** CDCMainFrameController.java 30 Jul 2002 02:26:17 -0000 1.19 --- CDCMainFrameController.java 30 Jul 2002 05:12:13 -0000 1.20 *************** *** 130,134 **** if (e.getClickCount() >= 2) { FilesTableModel tableModel = (FilesTableModel) frame.getFilesTable().getModel(); ! FileType fileType = tableModel.dir.getFiles(frame.getFilesTable().getSelectedRow()); if (fileType instanceof DirectoryType) { Enumeration enu = selectedNode.children(); --- 130,134 ---- if (e.getClickCount() >= 2) { FilesTableModel tableModel = (FilesTableModel) frame.getFilesTable().getModel(); ! FileType fileType = (FileType)tableModel.files.elementAt(frame.getFilesTable().getSelectedRow()); if (fileType instanceof DirectoryType) { Enumeration enu = selectedNode.children(); Index: FilesTable.java =================================================================== RCS file: /cvsroot/cdchamber/CDChamber/src/org/cdchamber/gui/FilesTable.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** FilesTable.java 30 Jul 2002 02:26:17 -0000 1.1 --- FilesTable.java 30 Jul 2002 05:12:13 -0000 1.2 *************** *** 6,11 **** --- 6,14 ---- import javax.swing.*; + import javax.swing.event.TableModelEvent; import javax.swing.table.*; import java.awt.*; + import java.awt.event.MouseEvent; + import java.awt.event.MouseAdapter; public class FilesTable extends JTable { *************** *** 17,20 **** --- 20,28 ---- setRowHeight(18); + JTableHeader header = getTableHeader(); + header.setUpdateTableInRealTime(true); + header.addMouseListener(new ColumnListener( this)); + header.setReorderingAllowed(true); + } *************** *** 34,45 **** TypeIconCellRenderer typeRenderer = new TypeIconCellRenderer(); getColumn( FilesTableModel.columnHeads[0].title).setCellRenderer(typeRenderer); - - JTableHeader header = getTableHeader(); - header.setUpdateTableInRealTime(true); - // header.addMouseListener(new ColumnListener()); - header.setReorderingAllowed(true); - - // jTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); - } --- 42,45 ---- *************** *** 66,68 **** --- 66,103 ---- } + } + + class ColumnListener extends MouseAdapter { + + private JTable jTable; + public ColumnListener( JTable jTable) { + super(); + this.jTable = jTable; + } + + public void mouseClicked(MouseEvent e) { + if ( e.isConsumed()) return; + TableColumnModel colModel = jTable.getColumnModel(); + int columnModelIndex = colModel.getColumnIndexAtX(e.getX()); + int modelIndex = colModel.getColumn(columnModelIndex).getModelIndex(); + if (modelIndex < 0) return; + + FilesTableModel tmodel = (FilesTableModel) jTable.getModel(); + if (tmodel.sortCol == modelIndex) + tmodel.sortAsc = !tmodel.sortAsc; + else + tmodel.sortCol = modelIndex; + + for (int i = 0; i < tmodel.getColumnCount(); i++) { + TableColumn column = colModel.getColumn(i); + int index = column.getModelIndex(); + JLabel renderer = (JLabel) column.getHeaderRenderer(); + renderer.setIcon(tmodel.getColumnIcon(index)); + } + jTable.getTableHeader().repaint(); + + tmodel.sortData(); + jTable.tableChanged(new TableModelEvent(tmodel)); + jTable.repaint(); + } } Index: FilesTableModel.java =================================================================== RCS file: /cvsroot/cdchamber/CDChamber/src/org/cdchamber/gui/FilesTableModel.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** FilesTableModel.java 22 Jul 2002 01:31:25 -0000 1.7 --- FilesTableModel.java 30 Jul 2002 05:12:13 -0000 1.8 *************** *** 10,13 **** --- 10,14 ---- import org.cdchamber.elements.DirectoryType; import org.cdchamber.elements.FileType; + import org.cdchamber.util.DirPath; import javax.swing.table.AbstractTableModel; *************** *** 16,20 **** import java.text.NumberFormat; import java.text.DateFormat; ! import java.util.Date; public class FilesTableModel extends AbstractTableModel { --- 17,21 ---- import java.text.NumberFormat; import java.text.DateFormat; ! import java.util.*; public class FilesTableModel extends AbstractTableModel { *************** *** 23,27 **** --- 24,44 ---- } + public int sortCol=0; + public boolean sortAsc=true; + public static ImageIcon COLUMN_UP = new ImageIcon( DirPath.getIconPath("SortUp.gif")); + public static ImageIcon COLUMN_DOWN = new ImageIcon( DirPath.getIconPath("SortDown.gif")); + + public ImageIcon getColumnIcon(int column) { // NEW + if (column==sortCol) + return sortAsc ? COLUMN_UP : COLUMN_DOWN; + return null; + } + + public void sortData() { + Collections.sort( files, new FileTypeComparator( sortCol, sortAsc)); + } + DirectoryType dir; + Vector files; public DirectoryType getDir() { return this.dir; *************** *** 30,37 **** public FilesTableModel( DefaultMutableTreeNode node) { dir = (DirectoryType)node.getUserObject(); } public int getRowCount() { ! return dir.getFilesCount(); } --- 47,62 ---- public FilesTableModel( DefaultMutableTreeNode node) { dir = (DirectoryType)node.getUserObject(); + + files = new Vector(); + for ( int i=0; i<dir.getFilesCount(); i++) { + files.addElement( dir.getFiles(i)); + } + sortCol = FilesTableModel.NAME; + sortAsc = true; + sortData(); } public int getRowCount() { ! return files.size(); } *************** *** 58,63 **** public Object getValueAt(int rowIndex, int columnIndex) { ! if ( rowIndex <0 || rowIndex > dir.getFilesCount()-1) return null; ! FileType ft = (FileType) dir.getFiles( rowIndex); switch ( columnIndex) { case NAME: --- 83,88 ---- public Object getValueAt(int rowIndex, int columnIndex) { ! if ( rowIndex <0 || rowIndex > files.size()-1) return null; ! FileType ft = (FileType) files.elementAt( rowIndex); switch ( columnIndex) { case NAME: *************** *** 79,87 **** public void setValueAt(Object value, int row, int col) { - if ( row<0 || row > dir.getFilesCount()-1) return; if ( col != DESC) return; ! // TODO: Maybe not right after sort. ! FileType ft = dir.getFiles( row); ft.setDesc( value.toString()); fireTableCellUpdated(row, col); --- 104,111 ---- public void setValueAt(Object value, int row, int col) { if ( col != DESC) return; + if ( row<0 || row > files.size()-1) return; ! FileType ft = (FileType)files.elementAt( row); ft.setDesc( value.toString()); fireTableCellUpdated(row, col); *************** *** 113,114 **** --- 137,211 ---- } } + + class FileTypeComparator implements Comparator { + + protected int m_sortCol; + protected boolean m_sortAsc; + + public FileTypeComparator(int sortCol, boolean sortAsc) { + m_sortCol = sortCol; + m_sortAsc = sortAsc; + } + + private int commonStringCompare( String n1, String n2) { + if ( n1 == null) return -1; + if ( n2 == null) return 1; + return n1.compareToIgnoreCase(n2); + } + + private boolean isDir( FileType fileType) { + if ( fileType instanceof DirectoryType) return true; + return false; + } + + public int compare(Object o1, Object o2) { + + if(!(o1 instanceof FileType) || !(o2 instanceof FileType)) + return 0; + FileType s1 = (FileType)o1; + FileType s2 = (FileType)o2; + int result = 0; + switch (m_sortCol) { + case FilesTableModel.NAME: + if ( isDir( s1) && isDir(s2)) { + result = commonStringCompare( s1.getName(), s2.getName()); + break; + } + if ( !(isDir( s1) || isDir(s2))) { + result = commonStringCompare( s1.getName(), s2.getName()); + break; + } + if ( isDir(s1)) { + result = -1; + break; + } + result = 1; + break; + case FilesTableModel.SIZE: + result = s1.getSize()<s2.getSize() ? -1 : 1; + break; + case FilesTableModel.DATE: + result = s1.getDate()<s2.getDate() ? -1 : 1; + break; + case FilesTableModel.DESC: + result = commonStringCompare( s1.getDesc(), s2.getDesc()); + break; + default: + result =0; + } + + if (!m_sortAsc) + result = -result; + return result; + } + + public boolean equals(Object obj) { + if (obj instanceof FileTypeComparator) { + FileTypeComparator compObj = (FileTypeComparator)obj; + return (compObj.m_sortCol==m_sortCol) && + (compObj.m_sortAsc==m_sortAsc); + } + return false; + } + } + |
From: <sim...@us...> - 2002-07-30 05:12:17
|
Update of /cvsroot/cdchamber/CDChamber In directory usw-pr-cvs1:/tmp/cvs-serv31847 Modified Files: TODO.txt Log Message: Tables can sort now. Index: TODO.txt =================================================================== RCS file: /cvsroot/cdchamber/CDChamber/TODO.txt,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** TODO.txt 30 Jul 2002 02:26:16 -0000 1.16 --- TODO.txt 30 Jul 2002 05:12:12 -0000 1.17 *************** *** 15,18 **** x : Double click on files table should open the directory(If it is). x : GUI need to be made more beautiful and friendly. ! + : Let the table can be sorted. + : Release one alpha version --- 15,19 ---- x : Double click on files table should open the directory(If it is). x : GUI need to be made more beautiful and friendly. ! x : Let the table can be sorted. ! + : Add status bar. + : Release one alpha version |
From: <sim...@us...> - 2002-07-30 02:26:20
|
Update of /cvsroot/cdchamber/CDChamber/src/org/cdchamber/gui In directory usw-pr-cvs1:/tmp/cvs-serv17019/src/org/cdchamber/gui Modified Files: CDCMainFrame.java CDCMainFrameController.java CDChamber.java Added Files: AboutDialog.java DirTreeCellRenderer.java FilesTable.java TypeIconCellRenderer.java Log Message: Beautify the GUI --- NEW FILE: AboutDialog.java --- /* * User: Simon * $Id: AboutDialog.java,v 1.1 2002/07/30 02:26:17 simon_lei Exp $ */ package org.cdchamber.gui; import org.cdchamber.util.DirPath; import javax.swing.*; import java.awt.event.*; import java.awt.*; import java.io.StringReader; import java.io.IOException; public class AboutDialog extends JDialog implements ActionListener { String product = "CDChamber $Revision: 1.1 $"; String copyright = "Simon & Crystal Copyright (c) 2002"; String comments = "The CDChamber, manage your cdroms. <br>Contact us at <br><a href=\"http://www.sourceforge.net/projects/cdchamber/\">http://www.sourceforge.net/projects/cdchamber/</a>"; public AboutDialog(Frame parent) { super(parent); init(); pack(); } private void init() { JLabel imageLabel= new JLabel( new ImageIcon( DirPath.getIconPath( "about.jpg"))); JTextPane textPane = new JTextPane(); try { textPane.setContentType("text/html"); StringBuffer sb = new StringBuffer( "<html><body>"); sb.append( product).append( "<br>"); sb.append( copyright).append( "<br>"); sb.append( comments); sb.append( "</body></html>"); textPane.read( new StringReader( sb.toString()), "About CDChamber"); } catch ( IOException e) { e.printStackTrace(); } textPane.setEnabled( false); this.setTitle("About CDChamber"); this.setModal( true); this.setResizable(false); JButton okButton = new JButton( "Ok"); okButton.addActionListener( this); this.getRootPane().setDefaultButton( okButton); this.getContentPane().setLayout( new BorderLayout()); JPanel buttonPanel = new JPanel(); buttonPanel.add( okButton); this.getContentPane().add( buttonPanel, BorderLayout.SOUTH); JPanel mainPanel = new JPanel( new BorderLayout()); mainPanel.add( imageLabel, BorderLayout.WEST); mainPanel.add( textPane, BorderLayout.CENTER); this.getContentPane().add( mainPanel, BorderLayout.CENTER); } //Overridden so we can exit when window is closed protected void processWindowEvent(WindowEvent e) { if (e.getID() == WindowEvent.WINDOW_CLOSING) { cancel(); } super.processWindowEvent(e); } //Close the dialog void cancel() { dispose(); } //Close the dialog on a button event public void actionPerformed(ActionEvent e) { cancel(); } } --- NEW FILE: DirTreeCellRenderer.java --- /* * User: Simon * $Id: DirTreeCellRenderer.java,v 1.1 2002/07/30 02:26:17 simon_lei Exp $ */ package org.cdchamber.gui; import org.cdchamber.elements.*; import org.cdchamber.util.DirPath; import javax.swing.tree.*; import javax.swing.*; import java.awt.*; public class DirTreeCellRenderer extends DefaultTreeCellRenderer { private static ImageIcon zipFileIcon = new ImageIcon( DirPath.getIconPath("zipFile.jpg")); private static ImageIcon openFolderIcon = new ImageIcon( DirPath.getIconPath("openFolder.jpg")); private static ImageIcon closeFolderIcon = new ImageIcon( DirPath.getIconPath( "closedFolder.jpg")); private static ImageIcon fileIcon = new ImageIcon( DirPath.getIconPath( "file.jpg")); private static ImageIcon openZipFileIcon = new ImageIcon( DirPath.getIconPath( "openZipFile.jpg")); private static ImageIcon cdromIcon = new ImageIcon( DirPath.getIconPath( "cdrom.gif")); private static ImageIcon rootsIcon = new ImageIcon( DirPath.getIconPath( "roots.jpg")); public DirTreeCellRenderer() { } public Component getTreeCellRendererComponent( JTree tree, Object value, boolean sel, boolean expanded, boolean leaf, int row, boolean hasFocus) { super.getTreeCellRendererComponent( tree, value, sel, expanded, leaf, row, hasFocus); DefaultMutableTreeNode node = (DefaultMutableTreeNode)value; if ( node.isRoot()) { setIcon( rootsIcon); return this; } Object ft = node.getUserObject(); if ( ft instanceof CDRomType) { setIcon( cdromIcon); } else if ( ft instanceof CompressedFileType) { //if ( tree.isPathSelected( new TreePath(node.getPath()))) { if ( sel) { setIcon( openZipFileIcon); } else { setIcon( zipFileIcon); } } else if ( ft instanceof DirectoryType ) { if ( sel) { setIcon( openFolderIcon); } else { setIcon( closeFolderIcon); } } else { setIcon( fileIcon); } return this; } } --- NEW FILE: FilesTable.java --- /* * User: Simon * $Id: FilesTable.java,v 1.1 2002/07/30 02:26:17 simon_lei Exp $ */ package org.cdchamber.gui; import javax.swing.*; import javax.swing.table.*; import java.awt.*; public class FilesTable extends JTable { public FilesTable() { super(); // setAutoCreateColumnsFromModel(false); setShowGrid(false); setRowHeight(18); } public void setModel(TableModel dataModel) { super.setModel(dataModel); if (! (dataModel instanceof FilesTableModel)) return; for (int k = 0; k < dataModel.getColumnCount(); k++) { DefaultTableCellRenderer renderer = new DefaultTableCellRenderer(); ColumnData columnData = FilesTableModel.columnHeads[k]; renderer.setHorizontalAlignment( columnData.alignment); TableColumn column = getColumn( columnData.title); column.setWidth( columnData.width); column.setCellRenderer( renderer); column.setHeaderRenderer(createDefaultRenderer()); } TypeIconCellRenderer typeRenderer = new TypeIconCellRenderer(); getColumn( FilesTableModel.columnHeads[0].title).setCellRenderer(typeRenderer); JTableHeader header = getTableHeader(); header.setUpdateTableInRealTime(true); // header.addMouseListener(new ColumnListener()); header.setReorderingAllowed(true); // jTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); } protected TableCellRenderer createDefaultRenderer() { DefaultTableCellRenderer label = new DefaultTableCellRenderer() { public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { if (table != null) { JTableHeader header = table.getTableHeader(); if (header != null) { setForeground(header.getForeground()); setBackground(header.getBackground()); setFont(header.getFont()); } } setText((value == null) ? "" : value.toString()); setBorder(UIManager.getBorder("TableHeader.cellBorder")); return this; } }; label.setHorizontalAlignment(JLabel.CENTER); return label; } } --- NEW FILE: TypeIconCellRenderer.java --- /* * User: Simon * $Id: TypeIconCellRenderer.java,v 1.1 2002/07/30 02:26:17 simon_lei Exp $ */ package org.cdchamber.gui; import org.cdchamber.elements.*; import org.cdchamber.util.DirPath; import javax.swing.table.DefaultTableCellRenderer; import javax.swing.*; public class TypeIconCellRenderer extends DefaultTableCellRenderer { public void setValue(Object value) { if ( value instanceof FileType) { FileType ft = (FileType)value; this.setIcon( getTypeIcon( ft)); this.setText( ft.getName()); } else super.setValue( value); } public ImageIcon getTypeIcon( FileType fileType) { if ( fileType instanceof CDRomType) return new ImageIcon( DirPath.getIconPath("cdrom.gif")); if ( fileType instanceof CompressedFileType) return new ImageIcon( DirPath.getIconPath("zipFile.jpg")); if ( fileType instanceof DirectoryType) return new ImageIcon( DirPath.getIconPath("closedFolder.jpg")); return new ImageIcon( DirPath.getIconPath( "file.jpg")); } } Index: CDCMainFrame.java =================================================================== RCS file: /cvsroot/cdchamber/CDChamber/src/org/cdchamber/gui/CDCMainFrame.java,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** CDCMainFrame.java 29 Jul 2002 08:42:36 -0000 1.22 --- CDCMainFrame.java 30 Jul 2002 02:26:17 -0000 1.23 *************** *** 8,11 **** --- 8,12 ---- import org.cdchamber.searcher.Searcher; + import org.cdchamber.util.DirPath; import javax.swing.*; *************** *** 31,70 **** JSplitPane mainPane = new JSplitPane(); JTree directoryTree = new FileTree(); ! JTable filesTable = new JTable(); JList resultList = new JList(); JSplitPane realMainPane = new JSplitPane( JSplitPane.VERTICAL_SPLIT); CDCMainFrameController controller; - public String getUserChoosedDataFile() { - JFileChooser chooser = new JFileChooser(); - chooser.setFileSelectionMode( JFileChooser.FILES_ONLY); - chooser.setFileFilter( new XmlFileFilter()); - int retvalue = chooser.showOpenDialog( this); - if ( retvalue != JFileChooser.APPROVE_OPTION) return null; - return chooser.getSelectedFile().getAbsolutePath(); - } - - public String getUserChoosedDirectory() { - JFileChooser chooser = new JFileChooser(); - chooser.setFileSelectionMode( JFileChooser.DIRECTORIES_ONLY); - int retvalue = chooser.showOpenDialog( this); - if ( retvalue != JFileChooser.APPROVE_OPTION) return null; - return chooser.getSelectedFile().getAbsolutePath(); - } - - public void setDirectoryTreeModel(TreeModel model) { - directoryTree.setModel( model); - } - - public void setFilesTableModel(TableModel model) { - filesTable.setModel( model); - } - - public void dealWithActionException( String message, Exception exception) { - JOptionPane.showMessageDialog( this, message); - exception.printStackTrace(); - } - public CDCMainFrame() { super(); --- 32,42 ---- JSplitPane mainPane = new JSplitPane(); JTree directoryTree = new FileTree(); ! JTable filesTable = new FilesTable(); JList resultList = new JList(); JSplitPane realMainPane = new JSplitPane( JSplitPane.VERTICAL_SPLIT); + JToolBar toolBar = new JToolBar(); CDCMainFrameController controller; public CDCMainFrame() { super(); *************** *** 86,93 **** initMenuBar(); contentPane = (JPanel) this.getContentPane(); contentPane.setLayout(new BorderLayout()); ! contentPane.add( BorderLayout.CENTER, realMainPane); --- 58,66 ---- initMenuBar(); + initToolsBar(); contentPane = (JPanel) this.getContentPane(); contentPane.setLayout(new BorderLayout()); ! contentPane.add( toolBar, BorderLayout.NORTH); contentPane.add( BorderLayout.CENTER, realMainPane); *************** *** 107,110 **** --- 80,84 ---- mainPane.add( JSplitPane.RIGHT, jScrollPaneTable); + directoryTree.setCellRenderer( new DirTreeCellRenderer()); directoryTree.addTreeSelectionListener( controller); resultList.addListSelectionListener( controller); *************** *** 112,115 **** --- 86,114 ---- } + private void initToolsBar() { + toolBar.add( controller.getCreateNewCDRomAction()); + toolBar.add( controller.getImportCDRomAction()); + toolBar.add( controller.getSaveCDRomAction()); + toolBar.add( controller.getDeleteCDRomAction()); + toolBar.addSeparator(); + toolBar.add( controller.getSearchCDRomAction()); + toolBar.addSeparator(); + toolBar.add( new AboutAction()); + } + + class AboutAction extends AbstractAction { + public AboutAction() { + putValue(Action.NAME, "About"); + putValue(Action.MNEMONIC_KEY, new Integer('A')); + putValue( Action.SHORT_DESCRIPTION, "About CDChamber"); + putValue( Action.SMALL_ICON, new ImageIcon( DirPath.getIconPath( "helpAbout.png"))); + } + + public void actionPerformed(ActionEvent e) { + JDialog dialog = new AboutDialog( null); + CDChamber.showWinowAtCenter( dialog); + } + } + private void initMenuBar() { this.setJMenuBar(mainMenu); *************** *** 123,128 **** helpMenu.setMnemonic('H'); helpMenu.setText("Help"); ! helpAboutMenuItem.setMnemonic('A'); ! helpAboutMenuItem.setText("About"); cdromExitMenuItem.setMnemonic('X'); cdromExitMenuItem.setText("Exit"); --- 122,126 ---- helpMenu.setMnemonic('H'); helpMenu.setText("Help"); ! helpAboutMenuItem.setAction( new AboutAction()); cdromExitMenuItem.setMnemonic('X'); cdromExitMenuItem.setText("Exit"); *************** *** 175,178 **** --- 173,207 ---- public JTable getFilesTable() { return filesTable; + } + + public String getUserChoosedDataFile() { + JFileChooser chooser = new JFileChooser(); + chooser.setFileSelectionMode( JFileChooser.FILES_ONLY); + chooser.setFileFilter( new XmlFileFilter()); + int retvalue = chooser.showOpenDialog( this); + if ( retvalue != JFileChooser.APPROVE_OPTION) return null; + return chooser.getSelectedFile().getAbsolutePath(); + } + + public String getUserChoosedDirectory() { + JFileChooser chooser = new JFileChooser(); + chooser.setFileSelectionMode( JFileChooser.DIRECTORIES_ONLY); + int retvalue = chooser.showOpenDialog( this); + if ( retvalue != JFileChooser.APPROVE_OPTION) return null; + return chooser.getSelectedFile().getAbsolutePath(); + } + + public void setDirectoryTreeModel(TreeModel model) { + directoryTree.setModel( model); + directoryTree.setSelectionRow(0); + } + + public void setFilesTableModel(TableModel model) { + filesTable.setModel( model); + } + + public void dealWithActionException( String message, Exception exception) { + JOptionPane.showMessageDialog( this, message); + exception.printStackTrace(); } Index: CDCMainFrameController.java =================================================================== RCS file: /cvsroot/cdchamber/CDChamber/src/org/cdchamber/gui/CDCMainFrameController.java,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** CDCMainFrameController.java 29 Jul 2002 08:42:36 -0000 1.18 --- CDCMainFrameController.java 30 Jul 2002 02:26:17 -0000 1.19 *************** *** 78,81 **** --- 78,82 ---- JList list = (JList) e.getSource(); SearchResult result = (SearchResult) list.getSelectedValue(); + if ( result == null) return; DefaultMutableTreeNode node = (DefaultMutableTreeNode) frame.getDirectoryTree().getModel().getRoot(); DefaultMutableTreeNode[] nodes = new DefaultMutableTreeNode[result.getPathDepth()]; *************** *** 149,154 **** public class CreateNewCDRomAction extends AbstractAction { public CreateNewCDRomAction() { ! putValue(Action.NAME, "Create"); ! putValue(Action.MNEMONIC_KEY, new Integer('C')); } --- 150,157 ---- public class CreateNewCDRomAction extends AbstractAction { public CreateNewCDRomAction() { ! putValue( Action.NAME, "Create"); ! putValue( Action.MNEMONIC_KEY, new Integer('C')); ! putValue( Action.SHORT_DESCRIPTION, "Create a new CDRom"); ! putValue( Action.SMALL_ICON, new ImageIcon( DirPath.getIconPath( "createNewCDRom.png"))); } *************** *** 177,180 **** --- 180,185 ---- putValue(Action.NAME, "Import"); putValue(Action.MNEMONIC_KEY, new Integer('I')); + putValue( Action.SHORT_DESCRIPTION, "Import an exist CDRom"); + putValue( Action.SMALL_ICON, new ImageIcon( DirPath.getIconPath( "importCDRom.png"))); } *************** *** 202,205 **** --- 207,212 ---- putValue(Action.NAME, "Delete"); putValue(Action.MNEMONIC_KEY, new Integer('D')); + putValue( Action.SHORT_DESCRIPTION, "Delete the selected CDRom"); + putValue( Action.SMALL_ICON, new ImageIcon( DirPath.getIconPath( "deleteCDRom.png"))); } *************** *** 213,216 **** --- 220,224 ---- roots.removeFiles(cdrom); frame.setDirectoryTreeModel(new FileTreeModel(loadDataFiles())); + frame.setResultListData( new Vector()); } } *************** *** 220,223 **** --- 228,233 ---- putValue(Action.NAME, "Save"); putValue(Action.MNEMONIC_KEY, new Integer('S')); + putValue( Action.SHORT_DESCRIPTION, "Save the selected CDRom"); + putValue( Action.SMALL_ICON, new ImageIcon( DirPath.getIconPath( "saveCDRom.png"))); } *************** *** 240,243 **** --- 250,255 ---- putValue(Action.NAME, "Search"); putValue(Action.MNEMONIC_KEY, new Integer('e')); + putValue( Action.SHORT_DESCRIPTION, "Search files/directories in CDRoms"); + putValue( Action.SMALL_ICON, new ImageIcon( DirPath.getIconPath( "searchCDRom.png"))); } Index: CDChamber.java =================================================================== RCS file: /cvsroot/cdchamber/CDChamber/src/org/cdchamber/gui/CDChamber.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** CDChamber.java 19 Jul 2002 02:07:48 -0000 1.3 --- CDChamber.java 30 Jul 2002 02:26:17 -0000 1.4 *************** *** 14,18 **** public static void main(String[] args) { try { ! UIManager.setLookAndFeel( UIManager.getCrossPlatformLookAndFeelClassName()); } catch(Exception e) { e.printStackTrace(); --- 14,19 ---- public static void main(String[] args) { try { ! //UIManager.setLookAndFeel( UIManager.getCrossPlatformLookAndFeelClassName()); ! UIManager.setLookAndFeel(new com.incors.plaf.kunststoff.KunststoffLookAndFeel()); } catch(Exception e) { e.printStackTrace(); |
From: <sim...@us...> - 2002-07-30 02:26:20
|
Update of /cvsroot/cdchamber/CDChamber/lib In directory usw-pr-cvs1:/tmp/cvs-serv17019/lib Added Files: kunststoff.jar Log Message: Beautify the GUI --- NEW FILE: kunststoff.jar --- (This appears to be a binary file; contents omitted.) |
From: <sim...@us...> - 2002-07-30 02:26:20
|
Update of /cvsroot/cdchamber/CDChamber/test/src/org/cdchamber/elements In directory usw-pr-cvs1:/tmp/cvs-serv17019/test/src/org/cdchamber/elements Modified Files: FileFiltersTest.java Log Message: Beautify the GUI Index: FileFiltersTest.java =================================================================== RCS file: /cvsroot/cdchamber/CDChamber/test/src/org/cdchamber/elements/FileFiltersTest.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** FileFiltersTest.java 29 Jul 2002 09:42:46 -0000 1.2 --- FileFiltersTest.java 30 Jul 2002 02:26:17 -0000 1.3 *************** *** 28,34 **** assertEquals( "Should be 1 now", 1, FileFilters.filters.size()); FileFilters.addFilter( new BakFileFilter()); ! assertEquals( "Should be 1 now", 2, FileFilters.filters.size()); FileFilters.addFilter( new SwungDashFileFilter()); ! assertEquals( "Should be 1 now", 3, FileFilters.filters.size()); } --- 28,34 ---- assertEquals( "Should be 1 now", 1, FileFilters.filters.size()); FileFilters.addFilter( new BakFileFilter()); ! assertEquals( "Should be 2 now", 2, FileFilters.filters.size()); FileFilters.addFilter( new SwungDashFileFilter()); ! assertEquals( "Should be 3 now", 3, FileFilters.filters.size()); } |