Update of /cvsroot/jprojecttimer/jprojecttimer/de/cgarbs/apps/jprojecttimer
In directory usw-pr-cvs1:/tmp/cvs-serv8511/de/cgarbs/apps/jprojecttimer
Modified Files:
JProjectTimer.java
Log Message:
included patch by Tim:
- command line processing:
-projectxml <filename>
-projectfile <filename>
- JProjectTimer extends JFrame (100% JFC Swing components)
- removed the Look and Feel section that was commented out
Index: JProjectTimer.java
===================================================================
RCS file: /cvsroot/jprojecttimer/jprojecttimer/de/cgarbs/apps/jprojecttimer/JProjectTimer.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** JProjectTimer.java 2002/01/25 20:41:15 1.5
--- JProjectTimer.java 2002/01/27 18:38:09 1.6
***************
*** 3,6 ****
--- 3,7 ----
*
* 2001,2002 (C) by Christian Garbs <mi...@cg...>
+ * Tim O'Brien <to...@ie...>
*
* Licensed under GNU GPL (see COPYING for details)
***************
*** 12,40 ****
import de.cgarbs.util.Resource;
import de.cgarbs.swing.Localization;
- import java.applet.Applet;
- import javax.swing.UIManager;
! /** @author Christian Garbs <mi...@cg...>
* @version $Id$
*/
! public class JProjectTimer extends Applet
{
! public void init()
! {
! main(new String[0]);
! }
public static void main(String argv[])
{
! // Choose your Look and Feel
! /*
! try {
! //UIManager.setLookAndFeel("com.sun.java.swing.plaf.motif.metal.MetalLookAndFeel");
! UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
! //UIManager.setLookAndFeel("com.sun.java.swing.plaf.motif.MotifLookAndFeel");
! } catch (Exception e) {
! System.err.println(e);
! }
! */
// Localization
--- 13,39 ----
import de.cgarbs.util.Resource;
import de.cgarbs.swing.Localization;
! import java.util.Arrays;
! import java.util.Iterator;
! import java.util.List;
!
!
! import javax.swing.JFrame;
!
! /**
! * @author Christian Garbs <mi...@cg...>
! * @author Tim O'Brien <to...@ie...>
* @version $Id$
*/
! public class JProjectTimer extends JFrame
{
! // Name of file to read project from
! private String projectFile = null;
! private String fileType = null;
!
public static void main(String argv[])
{
! JProjectTimer projectTimer = new JProjectTimer();
// Localization
***************
*** 43,49 ****
Localization.localizeOptionPane();
Project p = new Project();
! p.readFromStream(new java.io.File("/home/mitch/DEMO1"));
new MainWindow(p);
}
}
--- 42,84 ----
Localization.localizeOptionPane();
+ projectTimer.processArguments( argv );
+
Project p = new Project();
! if( projectTimer.projectFile != null ) {
! if( projectTimer.fileType.equals("xml") ) {
! p.readFromXML(new java.io.File( projectTimer.projectFile ));
! } else if( projectTimer.fileType.equals("project") ) {
! p.readFromStream( new java.io.File( projectTimer.projectFile ));
! }
! }
new MainWindow(p);
+ }
+
+ private void processArguments(String[] args) {
+
+ String mode = null;
+ List argumentList = Arrays.asList( args );
+
+ Iterator i = argumentList.iterator();
+
+ // Iterate through the argument list to get the proper command line
+ // arguments.
+ while( i.hasNext() ) {
+
+ String currentArgument = (String) i.next();
+
+ // This doesn't have good error checking yet
+
+ if( currentArgument.equalsIgnoreCase("-projectxml") && i.hasNext() ) {
+ fileType = "xml";
+ projectFile = (String) i.next();
+ }
+
+ if( currentArgument.equalsIgnoreCase("-projectfile") && i.hasNext() ) {
+ fileType = "project";
+ projectFile = (String) i.next();
+ }
+ }
+
}
}
|