reorg of files and variables
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
/**
|
||||
* Main.java
|
||||
* @date Jan 6, 2011
|
||||
* @author ricky barrette
|
||||
* @author Twenty Codes, LLC
|
||||
*/
|
||||
package com.TwentyCodes.java.OrderProcessor;
|
||||
|
||||
import com.TwentyCodes.java.OrderProcessor.UI.MainWindow;
|
||||
|
||||
/**
|
||||
* Main class
|
||||
* @author ricky barrette
|
||||
*/
|
||||
public class Main {
|
||||
|
||||
|
||||
public static final boolean DEBUG = true;
|
||||
|
||||
/**
|
||||
* called when the application first starts
|
||||
* @param args
|
||||
* @author ricky barrette
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
new MainWindow();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -6,7 +6,6 @@
|
||||
|
||||
package com.TwentyCodes.java.OrderProcessor;
|
||||
|
||||
import com.TwentyCodes.java.OrderProcessor.UI.MainWindow;
|
||||
|
||||
/**
|
||||
* This class will represent a single order
|
||||
@@ -34,7 +33,7 @@ public class Order implements Comparable<Order>{
|
||||
* @throws InvalidDateFormatException
|
||||
*/
|
||||
public Order(String order) throws NumberFormatException, InvalidDateFormatException{
|
||||
if(MainWindow.DEBUG)
|
||||
if(Main.DEBUG)
|
||||
System.out.println("parsing in order: "+ order);
|
||||
|
||||
String [] lineParts;
|
||||
@@ -50,7 +49,7 @@ public class Order implements Comparable<Order>{
|
||||
this.mCustomerName = removeFistAndLastChar(lineParts[17]);
|
||||
this.mItemName = removeFistAndLastChar(lineParts[27]);
|
||||
|
||||
if (MainWindow.DEBUG)
|
||||
if (Main.DEBUG)
|
||||
System.out.println(this.toString());
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,6 @@ import java.util.Collections;
|
||||
import java.util.Locale;
|
||||
import java.util.Scanner;
|
||||
|
||||
import com.TwentyCodes.java.OrderProcessor.UI.MainWindow;
|
||||
|
||||
/**
|
||||
* This class will be a order database
|
||||
@@ -74,19 +73,19 @@ public class OrderDB {
|
||||
if(mListener != null)
|
||||
mListener.onProgressUpdate(line++);
|
||||
|
||||
if(MainWindow.DEBUG)
|
||||
if(Main.DEBUG)
|
||||
System.out.println("\non line: "+ line);
|
||||
|
||||
try {
|
||||
addOrder(new Order(scan.nextLine()));
|
||||
} catch (OrderExistsException e) {
|
||||
if(MainWindow.DEBUG)
|
||||
if(Main.DEBUG)
|
||||
e.printStackTrace();
|
||||
} catch (NumberFormatException e1){
|
||||
if(MainWindow.DEBUG)
|
||||
if(Main.DEBUG)
|
||||
e1.printStackTrace();
|
||||
} catch (InvalidDateFormatException e2) {
|
||||
if(MainWindow.DEBUG)
|
||||
if(Main.DEBUG)
|
||||
e2.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
*/
|
||||
package com.TwentyCodes.java.OrderProcessor;
|
||||
|
||||
import com.TwentyCodes.java.OrderProcessor.UI.MainWindow;
|
||||
|
||||
/**
|
||||
* This enum will represent statuses that are associated with an order
|
||||
@@ -48,7 +47,7 @@ public enum Status {
|
||||
* @author ricky barrette
|
||||
*/
|
||||
public static Status parseStatus(String s){
|
||||
if(MainWindow.DEBUG)
|
||||
if(Main.DEBUG)
|
||||
System.out.println("parsing status: "+ s);
|
||||
|
||||
if(s.equals("\""+ CHARGED.toString()+"\""))
|
||||
|
||||
@@ -23,6 +23,7 @@ import javax.swing.JProgressBar;
|
||||
|
||||
import com.TwentyCodes.java.OrderProcessor.OrderDB;
|
||||
import com.TwentyCodes.java.OrderProcessor.ProgressListener;
|
||||
import com.TwentyCodes.java.OrderProcessor.UncaughtExceptionHandler;
|
||||
|
||||
/**
|
||||
* this is the main window and class of this application
|
||||
@@ -35,7 +36,6 @@ public class MainWindow extends JFrame implements ActionListener, ProgressListen
|
||||
private JFileChooser fc;
|
||||
public static OrderDB db;
|
||||
private static final long serialVersionUID = 1841715561053331517L;
|
||||
public static final boolean DEBUG = true;
|
||||
private JProgressBar mProgressBar;
|
||||
private String mCurrentFile;
|
||||
private UncaughtExceptionHandler mExceptionReport = new UncaughtExceptionHandler(this.getClass());
|
||||
@@ -75,14 +75,6 @@ public class MainWindow extends JFrame implements ActionListener, ProgressListen
|
||||
db.setOnProgressListerner(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* main method, called when the application starts
|
||||
* @param args
|
||||
*/
|
||||
public static void main(String[] args){
|
||||
new MainWindow();
|
||||
}
|
||||
|
||||
/**
|
||||
* called when a button is clicked
|
||||
* (non-Javadoc)
|
||||
@@ -104,6 +96,7 @@ public class MainWindow extends JFrame implements ActionListener, ProgressListen
|
||||
if(e.getSource() == mLoadFileButton){
|
||||
try {
|
||||
if(fc.showOpenDialog(MainWindow.this) == JFileChooser.APPROVE_OPTION){
|
||||
mLoadFileButton.setEnabled(false);
|
||||
db.setOnProgressListerner(this);
|
||||
mProgressBar.setIndeterminate(true);
|
||||
mCurrentFile = fc.getSelectedFile().toString();
|
||||
@@ -122,6 +115,8 @@ public class MainWindow extends JFrame implements ActionListener, ProgressListen
|
||||
});
|
||||
|
||||
pack();
|
||||
} else {
|
||||
mProgressBar.setIndeterminate(false);
|
||||
}
|
||||
|
||||
} catch (FileNotFoundException e1) {
|
||||
@@ -166,6 +161,8 @@ public class MainWindow extends JFrame implements ActionListener, ProgressListen
|
||||
mProgressBar.setIndeterminate(false);
|
||||
pack();
|
||||
}
|
||||
if(progress >= mProgressBar.getMaximum())
|
||||
mLoadFileButton.setEnabled(true);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -26,6 +26,7 @@ import javax.swing.text.StyleConstants;
|
||||
import javax.swing.text.StyleContext;
|
||||
import javax.swing.text.StyledDocument;
|
||||
|
||||
import com.TwentyCodes.java.OrderProcessor.Main;
|
||||
import com.TwentyCodes.java.OrderProcessor.Order;
|
||||
import com.TwentyCodes.java.OrderProcessor.ProgressListener;
|
||||
import com.TwentyCodes.java.OrderProcessor.Status;
|
||||
@@ -198,7 +199,7 @@ public class SearchDialog extends JFrame implements ActionListener, ProgressList
|
||||
*/
|
||||
@Override
|
||||
public void onProgressUpdate(int progress) {
|
||||
if(MainWindow.DEBUG)
|
||||
if(Main.DEBUG)
|
||||
System.out.println("search progress = "+ progress);
|
||||
|
||||
progress++;
|
||||
|
||||
@@ -4,7 +4,9 @@
|
||||
* @author ricky barrette
|
||||
* @author Twenty Codes, LLC
|
||||
*/
|
||||
package com.TwentyCodes.java.OrderProcessor.UI;
|
||||
package com.TwentyCodes.java.OrderProcessor;
|
||||
|
||||
import com.TwentyCodes.java.OrderProcessor.UI.ShowAllDialog;
|
||||
|
||||
/**
|
||||
* An exception handler used to help report bugs in our applications
|
||||
@@ -56,7 +58,7 @@ public class UncaughtExceptionHandler implements java.lang.Thread.UncaughtExcept
|
||||
|
||||
report.append("--------- Application ---------\n\n");
|
||||
|
||||
report.append(mApp.getName());
|
||||
report.append(mApp.getPackage());
|
||||
|
||||
report.append(" generated the following exception:\n\n");
|
||||
|
||||
Reference in New Issue
Block a user