created a single window with a tabbed layout for a more fluid experience.
added an overwrite file dialog. added the customer country to the order object. updated .CSV export
This commit is contained in:
BIN
Order Processor/images/process.png
Normal file
BIN
Order Processor/images/process.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.6 KiB |
@@ -277,8 +277,8 @@ public class OrderDB {
|
||||
} else if (order.getItemName().equalsIgnoreCase(parts[i])
|
||||
|| (orderNumber > 0)
|
||||
&& (order.getGoogleOrderNumber() == orderNumber)
|
||||
|| order.getCustomerName().toLowerCase(Locale.ENGLISH)
|
||||
.contains(parts[i].toLowerCase(Locale.ENGLISH)))
|
||||
|| order.getCustomerName().toLowerCase(Locale.ENGLISH).contains(parts[i].toLowerCase(Locale.ENGLISH))
|
||||
|| order.getCustomerContry().toLowerCase(Locale.ENGLISH).contains(parts[i].toLowerCase(Locale.ENGLISH)))
|
||||
list.add(order);
|
||||
}
|
||||
ins.close();
|
||||
|
||||
@@ -23,6 +23,7 @@ public class Main {
|
||||
* @author ricky barrette
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
|
||||
new MainWindow();
|
||||
}
|
||||
|
||||
|
||||
@@ -6,11 +6,7 @@
|
||||
|
||||
package com.TwentyCodes.java.OrderProcessor;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Serializable;
|
||||
import java.io.StringReader;
|
||||
|
||||
import com.Ostermiller.util.CSVParser;
|
||||
|
||||
|
||||
/**
|
||||
@@ -29,35 +25,36 @@ public class Order implements Comparable<Order>, Serializable{
|
||||
private Status mFulfillmentStatus;
|
||||
private String mCustomerEmail;
|
||||
private String mCustomerName;
|
||||
private String mCustomerContry;
|
||||
|
||||
/**
|
||||
* Creates a new Order from a comma separated line from a *.csv file.
|
||||
*
|
||||
* Order ID,Merchant Order Number,Order Creation Date,Currency of Transaction,Order Amount,Amount Charged,Financial Status,Fulfillment Status,Link to Order,Total Tax,Total Shipping,Amount Refunded,Amount Charged Back,Chargeback Protection,Shipping Method,Email Marketing,Buyer Email Address,Buyer Name,Buyer Address 1,Buyer Address 2,Buyer City,Buyer State,Buyer Postal Code,Buyer Country,Buyer Phone Number,Tracking Data,Item 1 ID,Item 1 Name,Item 1 Description,Item 1 Price,Item 1 Quantity
|
||||
*
|
||||
* @param order
|
||||
* @author ricky barrette
|
||||
* @throws InvalidDateFormatException
|
||||
* @throws IOException
|
||||
*/
|
||||
public Order(String order) throws NumberFormatException, InvalidDateFormatException, IOException{
|
||||
if(Main.DEBUG)
|
||||
System.out.println("parsing in order: "+ order);
|
||||
|
||||
CSVParser parsedOrder = new CSVParser(new StringReader(order));
|
||||
String[] lineParts = parsedOrder.getLine();
|
||||
parsedOrder.close();
|
||||
|
||||
this.mGoogleOrderNumber = Long.parseLong(lineParts[0].split(" ")[1]);
|
||||
this.mOrderCreationDate = new Date(lineParts[2]);
|
||||
this.mOrderAmount = Float.parseFloat(lineParts[4]);
|
||||
this.mAmountCharged = Float.parseFloat(lineParts[5]);
|
||||
this.mFinancialStatus = Status.parseStatus(lineParts[6]);
|
||||
this.mFulfillmentStatus = Status.parseStatus(lineParts[7]);
|
||||
this.mCustomerEmail = lineParts[16];
|
||||
this.mCustomerName = lineParts[17];
|
||||
this.mItemName = lineParts[27];
|
||||
|
||||
// /**
|
||||
// * Creates a new Order from a comma separated line from a *.csv file.
|
||||
// *
|
||||
// * Order ID,Merchant Order Number,Order Creation Date,Currency of Transaction,Order Amount,Amount Charged,Financial Status,Fulfillment Status,Link to Order,Total Tax,Total Shipping,Amount Refunded,Amount Charged Back,Chargeback Protection,Shipping Method,Email Marketing,Buyer Email Address,Buyer Name,Buyer Address 1,Buyer Address 2,Buyer City,Buyer State,Buyer Postal Code,Buyer Country,Buyer Phone Number,Tracking Data,Item 1 ID,Item 1 Name,Item 1 Description,Item 1 Price,Item 1 Quantity
|
||||
// *
|
||||
// * @param order
|
||||
// * @author ricky barrette
|
||||
// * @throws InvalidDateFormatException
|
||||
// * @throws IOException
|
||||
// */
|
||||
// public Order(String order) throws NumberFormatException, InvalidDateFormatException, IOException{
|
||||
// if(Main.DEBUG)
|
||||
// System.out.println("parsing in order: "+ order);
|
||||
//
|
||||
// CSVParser parsedOrder = new CSVParser(new StringReader(order));
|
||||
// String[] lineParts = parsedOrder.getLine();
|
||||
// parsedOrder.close();
|
||||
//
|
||||
// this.mGoogleOrderNumber = Long.parseLong(lineParts[0].split(" ")[1]);
|
||||
// this.mOrderCreationDate = new Date(lineParts[2]);
|
||||
// this.mOrderAmount = Float.parseFloat(lineParts[4]);
|
||||
// this.mAmountCharged = Float.parseFloat(lineParts[5]);
|
||||
// this.mFinancialStatus = Status.parseStatus(lineParts[6]);
|
||||
// this.mFulfillmentStatus = Status.parseStatus(lineParts[7]);
|
||||
// this.mCustomerEmail = lineParts[16];
|
||||
// this.mCustomerName = lineParts[17];
|
||||
// this.mItemName = lineParts[27];
|
||||
//
|
||||
// String [] lineParts;
|
||||
// lineParts = order.split(",");
|
||||
// System.out.println(lineParts[0].split(" ")[1]);
|
||||
@@ -70,10 +67,10 @@ public class Order implements Comparable<Order>, Serializable{
|
||||
// this.mCustomerEmail = removeFistAndLastChar(lineParts[16]);
|
||||
// this.mCustomerName = removeFistAndLastChar(lineParts[17]);
|
||||
// this.mItemName = removeFistAndLastChar(lineParts[27]);
|
||||
|
||||
if (Main.DEBUG)
|
||||
System.out.println(this.toString());
|
||||
}
|
||||
//
|
||||
// if (Main.DEBUG)
|
||||
// System.out.println(this.toString());
|
||||
// }
|
||||
|
||||
// /**
|
||||
// * removes the last char from a string
|
||||
@@ -106,6 +103,7 @@ public class Order implements Comparable<Order>, Serializable{
|
||||
this.mCustomerEmail = lineParts[16];
|
||||
this.mCustomerName = lineParts[17];
|
||||
this.mItemName = lineParts[27];
|
||||
this.mCustomerContry = lineParts[23];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -116,7 +114,7 @@ public class Order implements Comparable<Order>, Serializable{
|
||||
*/
|
||||
@Override
|
||||
public String toString(){
|
||||
return this.mGoogleOrderNumber +", "+ this.mOrderCreationDate.toString() +", "+ this.mItemName +", "+ this.mOrderAmount +", "+ this.mAmountCharged +", "+ this.mFinancialStatus +", "+ this.mFulfillmentStatus +", "+ this.mCustomerName +", "+ this.mCustomerEmail;
|
||||
return this.mGoogleOrderNumber +", "+ this.mOrderCreationDate.toString() +", "+ this.mItemName +", "+ this.mOrderAmount +", "+ this.mAmountCharged +", "+ this.mFinancialStatus +", "+ this.mFulfillmentStatus +", "+ this.mCustomerName +", "+ this.mCustomerEmail +", "+ this.mCustomerContry;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -292,4 +290,20 @@ public class Order implements Comparable<Order>, Serializable{
|
||||
return mCustomerName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param customerContry the mCustomerContry to set
|
||||
* @author ricky barrette
|
||||
*/
|
||||
public void setCustomerContry(String customerContry) {
|
||||
this.mCustomerContry = customerContry;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the mCustomerContry
|
||||
* @author ricky barrette
|
||||
*/
|
||||
public String getCustomerContry() {
|
||||
return mCustomerContry;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
/**
|
||||
* ExceptionReportGUI.java
|
||||
* @date Jan 15, 2011
|
||||
* @author ricky barrette
|
||||
* @author Twenty Codes, LLC
|
||||
*/
|
||||
package com.TwentyCodes.java.OrderProcessor.UI;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.HeadlessException;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.JTextArea;
|
||||
|
||||
/**
|
||||
* this simple frame will be used to display exception reports to the user
|
||||
* @author ricky barrette
|
||||
*/
|
||||
public class ExceptionReportGUI extends JFrame implements ActionListener {
|
||||
|
||||
private static final long serialVersionUID = -4203182071311606914L;
|
||||
|
||||
/**
|
||||
* Creates a new ExceptionReportGUI
|
||||
* @throws HeadlessException
|
||||
* @author ricky barrette
|
||||
*/
|
||||
public ExceptionReportGUI(String report) {
|
||||
super();
|
||||
setTitle("We're Sorry....");
|
||||
setIconImage(new ImageIcon(getClass().getResource("/info.png")).getImage());
|
||||
|
||||
JButton ok = new JButton("Ok", new ImageIcon(getClass().getResource("/accept.png")));
|
||||
ok.addActionListener(this);
|
||||
|
||||
JScrollPane scrollPane = new JScrollPane();
|
||||
|
||||
final JTextArea results = new JTextArea();
|
||||
scrollPane.setViewportView(results);
|
||||
|
||||
results.setEditable(false);
|
||||
results.setText(report);
|
||||
|
||||
this.getContentPane().add(scrollPane, BorderLayout.CENTER);
|
||||
this.getContentPane().add(ok, BorderLayout.SOUTH);
|
||||
pack();
|
||||
setVisible(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent arg0) {
|
||||
this.dispose();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* @author Twenty Codes, LLC
|
||||
|
||||
* @author ricky barrette
|
||||
* @date Dec 18, 2010
|
||||
*/
|
||||
@@ -17,8 +17,10 @@ import javax.swing.ImageIcon;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JFileChooser;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JProgressBar;
|
||||
import javax.swing.JTabbedPane;
|
||||
|
||||
import com.TwentyCodes.java.OrderProcessor.FileFilter;
|
||||
import com.TwentyCodes.java.OrderProcessor.ProgressListener;
|
||||
@@ -30,8 +32,6 @@ import com.TwentyCodes.java.OrderProcessor.DB.OrderDB;
|
||||
*/
|
||||
public class MainWindow extends JFrame implements ActionListener, ProgressListener{
|
||||
|
||||
private JButton mSearchButton;
|
||||
private JButton mShowAllButton;
|
||||
private JButton mLoadFileButton;
|
||||
private JFileChooser fc;
|
||||
public static OrderDB db;
|
||||
@@ -39,6 +39,7 @@ public class MainWindow extends JFrame implements ActionListener, ProgressListen
|
||||
private JProgressBar mProgressBar;
|
||||
private String mCurrentFile;
|
||||
private UncaughtExceptionHandler mExceptionReport = new UncaughtExceptionHandler(this.getClass());
|
||||
private JLabel orderCountLabel;
|
||||
|
||||
/**
|
||||
* Creates a new MainWindow
|
||||
@@ -49,46 +50,62 @@ public class MainWindow extends JFrame implements ActionListener, ProgressListen
|
||||
Thread.setDefaultUncaughtExceptionHandler(mExceptionReport);
|
||||
this.setDefaultCloseOperation(EXIT_ON_CLOSE);
|
||||
|
||||
try {
|
||||
db = new OrderDB();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
fc = new JFileChooser();
|
||||
fc.setFileFilter(new FileFilter());
|
||||
|
||||
JTabbedPane tabbedPane = new JTabbedPane();
|
||||
|
||||
tabbedPane.addTab("Main", initializeMainPanel());
|
||||
tabbedPane.addTab("Search Orders", new SearchPanel(this));
|
||||
tabbedPane.addTab("Show All Orders", new ShowAllPanel(this));
|
||||
|
||||
this.getContentPane().add(tabbedPane, BorderLayout.CENTER);
|
||||
|
||||
this.setVisible(true);
|
||||
this.pack();
|
||||
}
|
||||
|
||||
/**
|
||||
* initializes the main layout
|
||||
*
|
||||
* @author ricky barrette
|
||||
*/
|
||||
private JPanel initializeMainPanel() {
|
||||
setTitle("Twenty Codes, LLC Order Database");
|
||||
setIconImage(new ImageIcon(getClass().getResource("/database.png")).getImage());
|
||||
|
||||
JPanel mainPanel = new JPanel(new BorderLayout());
|
||||
JPanel panel = new JPanel();
|
||||
mainPanel.add(panel);
|
||||
|
||||
getContentPane().add(panel);
|
||||
|
||||
//Search buttom
|
||||
mSearchButton = new JButton("Search", new ImageIcon(getClass().getResource("/database_search.png")));
|
||||
mSearchButton.addActionListener(this);
|
||||
panel.add(mSearchButton);
|
||||
|
||||
//show all button
|
||||
mShowAllButton = new JButton("Show All Orders", new ImageIcon(getClass().getResource("/database.png")));
|
||||
mShowAllButton.addActionListener(this);
|
||||
panel.add(mShowAllButton);
|
||||
|
||||
//load button
|
||||
mLoadFileButton = new JButton("Load File", new ImageIcon(getClass().getResource("/database_add.png")));
|
||||
mLoadFileButton.addActionListener(this);
|
||||
|
||||
//order count labels
|
||||
try {
|
||||
panel.add(new JLabel("Total Orders in the database:"));
|
||||
orderCountLabel = new JLabel(db.getCount()+"");
|
||||
panel.add(orderCountLabel);
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
panel.add(mLoadFileButton);
|
||||
|
||||
//progress bar
|
||||
mProgressBar = new JProgressBar();
|
||||
mProgressBar.setStringPainted(true);
|
||||
getContentPane().add(mProgressBar, BorderLayout.SOUTH);
|
||||
mainPanel.add(mProgressBar, BorderLayout.SOUTH);
|
||||
|
||||
setVisible(true);
|
||||
pack();
|
||||
|
||||
try {
|
||||
db = new OrderDB();
|
||||
} catch (Exception e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
|
||||
fc = new JFileChooser();
|
||||
fc.setFileFilter(new FileFilter());
|
||||
return mainPanel;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -98,13 +115,6 @@ public class MainWindow extends JFrame implements ActionListener, ProgressListen
|
||||
*/
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
if(e.getSource() == mShowAllButton){
|
||||
new ShowAllDialog();
|
||||
}
|
||||
|
||||
if (e.getSource() == mSearchButton) {
|
||||
new SearchDialog();
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepares the progress bar, and loads the file using an executer to prevent UI hangups
|
||||
@@ -121,6 +131,7 @@ public class MainWindow extends JFrame implements ActionListener, ProgressListen
|
||||
public void run() {
|
||||
try {
|
||||
db.load(fc.getSelectedFile());
|
||||
|
||||
} catch (FileNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
} catch (SQLException e) {
|
||||
@@ -140,9 +151,6 @@ public class MainWindow extends JFrame implements ActionListener, ProgressListen
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* called then the progress of the order db is updated
|
||||
* (non-Javadoc)
|
||||
@@ -151,16 +159,21 @@ public class MainWindow extends JFrame implements ActionListener, ProgressListen
|
||||
*/
|
||||
@Override
|
||||
public void onProgressUpdate(int progress, int max) {
|
||||
// progress++;
|
||||
mProgressBar.setMaximum(max);
|
||||
mProgressBar.setValue(progress);
|
||||
mProgressBar.setString(" "+mCurrentFile + " ~ Parsing Order: "+ progress +" of "+mProgressBar.getMaximum()+" ");
|
||||
mProgressBar.setString(mCurrentFile + " ~ Parsing Order: "+ progress +" of "+mProgressBar.getMaximum());
|
||||
if(mProgressBar.isIndeterminate()) {
|
||||
mProgressBar.setIndeterminate(false);
|
||||
pack();
|
||||
}
|
||||
if(progress >= mProgressBar.getMaximum())
|
||||
if(progress >= mProgressBar.getMaximum()){
|
||||
mLoadFileButton.setEnabled(true);
|
||||
try {
|
||||
orderCountLabel.setText(db.getCount()+"");
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -24,6 +24,7 @@ import javax.swing.JCheckBox;
|
||||
import javax.swing.JFileChooser;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JProgressBar;
|
||||
import javax.swing.JTextField;
|
||||
@@ -40,7 +41,7 @@ import com.TwentyCodes.java.OrderProcessor.ProgressListener;
|
||||
* This class will be the dialog that will ask the user for a specific make to show
|
||||
* @author ricky barrette
|
||||
*/
|
||||
public class SearchDialog extends JFrame implements ActionListener, ProgressListener, MouseListener, DatePickerListener {
|
||||
public class SearchPanel extends JPanel implements ActionListener, ProgressListener, MouseListener, DatePickerListener {
|
||||
|
||||
private static final long serialVersionUID = 1750326106927701404L;
|
||||
private static final int END_DATE_RESULT = 1;
|
||||
@@ -57,21 +58,24 @@ public class SearchDialog extends JFrame implements ActionListener, ProgressList
|
||||
private JButton mExportButton;
|
||||
private JFileChooser fc;
|
||||
private JCheckBox fcCheckBox;
|
||||
private JFrame mFrame;
|
||||
|
||||
/**
|
||||
* Creates a new ShowAllMakeDialog
|
||||
* @param frame
|
||||
*/
|
||||
public SearchDialog() {
|
||||
super();
|
||||
public SearchPanel(JFrame frame) {
|
||||
super(new BorderLayout());
|
||||
mFrame = frame;
|
||||
|
||||
setTitle("Search");
|
||||
setIconImage(new ImageIcon(getClass().getResource("/database_search.png")).getImage());
|
||||
// mFrame.setTitle("Search");
|
||||
// mFrame.setIconImage(new ImageIcon(getClass().getResource("/database_search.png")).getImage());
|
||||
|
||||
//create a JPanel to hold the text area and button
|
||||
JPanel panel = new JPanel();
|
||||
|
||||
//add the JPanel to the frame, and display
|
||||
getContentPane().add(panel, BorderLayout.NORTH);
|
||||
add(panel, BorderLayout.NORTH);
|
||||
|
||||
//search string
|
||||
panel.add(new JLabel("Enter a Product name, Customer Name, or Google Order Number:"));
|
||||
@@ -108,14 +112,13 @@ public class SearchDialog extends JFrame implements ActionListener, ProgressList
|
||||
panel.add(mExportButton);
|
||||
mExportButton.addActionListener(this);
|
||||
|
||||
//progress bar
|
||||
mProgressBar = new JProgressBar();
|
||||
getContentPane().add(mProgressBar, BorderLayout.SOUTH);
|
||||
|
||||
//output orderpane
|
||||
mOrderPanel = new OrderPane();
|
||||
this.getContentPane().add(mOrderPanel, BorderLayout.CENTER);
|
||||
add(mOrderPanel, BorderLayout.CENTER);
|
||||
|
||||
//progress bar
|
||||
mProgressBar = new JProgressBar();
|
||||
add(mProgressBar, BorderLayout.SOUTH);
|
||||
//file chooser
|
||||
fc = new JFileChooser();
|
||||
fc.setFileFilter(new FileFilter());
|
||||
@@ -123,7 +126,6 @@ public class SearchDialog extends JFrame implements ActionListener, ProgressList
|
||||
fcCheckBox.setSelected(true);
|
||||
fc.setAccessory(fcCheckBox);
|
||||
|
||||
pack();
|
||||
setVisible(true);
|
||||
}
|
||||
|
||||
@@ -154,9 +156,22 @@ public class SearchDialog extends JFrame implements ActionListener, ProgressList
|
||||
* @author ricky barrette
|
||||
*/
|
||||
private boolean exportToCSV() {
|
||||
if(fc.showDialog(SearchDialog.this, "Export") == JFileChooser.APPROVE_OPTION){
|
||||
if(fc.showDialog(SearchPanel.this, "Export") == JFileChooser.APPROVE_OPTION){
|
||||
int write = 0;
|
||||
|
||||
//file exists dialog
|
||||
if(fc.getSelectedFile().exists()){
|
||||
//default icon, custom title
|
||||
write = JOptionPane.showConfirmDialog(
|
||||
mFrame,
|
||||
"Do you want to overwrite"+ fc.getSelectedFile().toString(),
|
||||
"Overwrite?",
|
||||
JOptionPane.YES_NO_OPTION);
|
||||
}
|
||||
|
||||
if(write == 0){
|
||||
//prep the data for proper csv format
|
||||
StringBuffer sb = new StringBuffer("Order Number,Time & date,Product Name,Order Amount,Amount Charged,Financial Status,Fulfillment Status,Customer Name,Customer Email");
|
||||
StringBuffer sb = new StringBuffer("Order Number,Time & date,Product Name,Order Amount,Amount Charged,Financial Status,Fulfillment Status,Customer Name,Customer Email,Customer Country");
|
||||
Scanner scan = new Scanner(mOrderPanel.getText());
|
||||
String[] parts;
|
||||
String line;
|
||||
@@ -164,7 +179,7 @@ public class SearchDialog extends JFrame implements ActionListener, ProgressList
|
||||
line = scan.nextLine();
|
||||
parts = line.split(", ");
|
||||
try {
|
||||
sb.append(parts[0]+","+parts[1]+","+parts[2]+","+parts[3]+","+parts[4]+","+parts[5]+","+parts[6]+","+parts[7]+","+parts[8]+"\n");
|
||||
sb.append(parts[0]+","+parts[1]+","+parts[2]+","+parts[3]+","+parts[4]+","+parts[5]+","+parts[6]+","+parts[7]+","+parts[8]+","+parts[9]+"\n");
|
||||
} catch (Exception e) {
|
||||
sb.append(line+"\n");
|
||||
}
|
||||
@@ -185,6 +200,7 @@ public class SearchDialog extends JFrame implements ActionListener, ProgressList
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -200,7 +216,7 @@ public class SearchDialog extends JFrame implements ActionListener, ProgressList
|
||||
public void run() {
|
||||
mProgressBar.setString("Searching for: "+search);
|
||||
mProgressBar.setStringPainted(true);
|
||||
MainWindow.db.setOnProgressListerner(SearchDialog.this);
|
||||
MainWindow.db.setOnProgressListerner(SearchPanel.this);
|
||||
|
||||
ArrayList<Order> list = null;
|
||||
try {
|
||||
@@ -222,14 +238,14 @@ public class SearchDialog extends JFrame implements ActionListener, ProgressList
|
||||
mProgressBar.setMaximum(mProgressBar.getMaximum() + mListSize);
|
||||
isProcessing = true;
|
||||
mProgressBar.setString("Processing Order: "+ 1 +" of "+ mListSize);
|
||||
pack();
|
||||
mFrame.pack();
|
||||
|
||||
mOrderPanel.setOnProgressListerner(SearchDialog.this);
|
||||
mOrderPanel.setOnProgressListerner(SearchPanel.this);
|
||||
mOrderPanel.displayOrders(list);
|
||||
|
||||
isProcessing = false;
|
||||
|
||||
pack();
|
||||
mFrame.pack();
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -248,7 +264,7 @@ public class SearchDialog extends JFrame implements ActionListener, ProgressList
|
||||
progress++;
|
||||
if(mProgressBar.isIndeterminate()) {
|
||||
mProgressBar.setIndeterminate(false);
|
||||
pack();
|
||||
mFrame.pack();
|
||||
}
|
||||
if(isProcessing){
|
||||
mProgressBar.setString("Processing Order: "+ mListSize +" of "+ progress);
|
||||
@@ -15,41 +15,50 @@ import java.sql.SQLException;
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JProgressBar;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.JTextArea;
|
||||
|
||||
import com.TwentyCodes.java.OrderProcessor.ProgressListener;
|
||||
|
||||
/**
|
||||
* This panel will be used to display all Vehicles in the VechicleDB
|
||||
*/
|
||||
public class ShowAllDialog extends JFrame implements ActionListener, ProgressListener {
|
||||
public class ShowAllPanel extends JPanel implements ActionListener, ProgressListener {
|
||||
|
||||
private static final long serialVersionUID = -8416144493079733535L;
|
||||
private JProgressBar mProgressBar;
|
||||
private OrderPane mOutput;
|
||||
private JFrame mFrame;
|
||||
|
||||
/**
|
||||
* Creates a new ShowAllDialog
|
||||
*/
|
||||
public ShowAllDialog(){
|
||||
super();
|
||||
setTitle("Show All Orders");
|
||||
setIconImage(new ImageIcon(getClass().getResource("/database.png")).getImage());
|
||||
public ShowAllPanel(final JFrame frame){
|
||||
super(new BorderLayout());
|
||||
mFrame = frame;
|
||||
|
||||
JButton ok = new JButton("Ok", new ImageIcon(getClass().getResource("/accept.png")));
|
||||
// setTitle("Show All Orders");
|
||||
// setIconImage(new ImageIcon(getClass().getResource("/database.png")).getImage());
|
||||
|
||||
JButton ok = new JButton("Refresh", new ImageIcon(getClass().getResource("/process.png")));
|
||||
ok.addActionListener(this);
|
||||
mOutput = new OrderPane();
|
||||
mProgressBar = new JProgressBar();
|
||||
getContentPane().add(mProgressBar, BorderLayout.SOUTH);
|
||||
this.getContentPane().add(mOutput, BorderLayout.CENTER);
|
||||
this.getContentPane().add(ok, BorderLayout.NORTH);
|
||||
add(mProgressBar, BorderLayout.SOUTH);
|
||||
add(mOutput, BorderLayout.CENTER);
|
||||
add(ok, BorderLayout.NORTH);
|
||||
mProgressBar.setString("Loading from Database");
|
||||
mProgressBar.setStringPainted(true);
|
||||
MainWindow.db.setOnProgressListerner(this);
|
||||
pack();
|
||||
frame.pack();
|
||||
|
||||
|
||||
|
||||
setVisible(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent arg0) {
|
||||
java.util.concurrent.Executors.newSingleThreadExecutor().submit(new Runnable() {
|
||||
public void run() {
|
||||
try {
|
||||
@@ -64,42 +73,9 @@ public class ShowAllDialog extends JFrame implements ActionListener, ProgressLis
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
pack();
|
||||
mFrame.pack();
|
||||
}
|
||||
});
|
||||
|
||||
setVisible(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new ShowAllDialog
|
||||
*/
|
||||
public ShowAllDialog(String title, String body){
|
||||
super();
|
||||
setTitle(title);
|
||||
setIconImage(new ImageIcon(getClass().getResource("/info.png")).getImage());
|
||||
|
||||
JButton ok = new JButton("Ok", new ImageIcon(getClass().getResource("/accept.png")));
|
||||
ok.addActionListener(this);
|
||||
|
||||
JScrollPane scrollPane = new JScrollPane();
|
||||
|
||||
final JTextArea results = new JTextArea();
|
||||
scrollPane.setViewportView(results);
|
||||
|
||||
results.setEditable(false);
|
||||
results.setText(body);
|
||||
|
||||
this.getContentPane().add(scrollPane, BorderLayout.CENTER);
|
||||
this.getContentPane().add(ok, BorderLayout.SOUTH);
|
||||
pack();
|
||||
setVisible(true);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent arg0) {
|
||||
this.dispose();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -107,7 +83,7 @@ public class ShowAllDialog extends JFrame implements ActionListener, ProgressLis
|
||||
mProgressBar.setMaximum(max);
|
||||
mProgressBar.setValue(progress);
|
||||
if(progress >= mProgressBar.getMaximum()){
|
||||
this.pack();
|
||||
mFrame.pack();
|
||||
mProgressBar.setString("Done");
|
||||
}
|
||||
}
|
||||
@@ -6,7 +6,7 @@
|
||||
*/
|
||||
package com.TwentyCodes.java.OrderProcessor;
|
||||
|
||||
import com.TwentyCodes.java.OrderProcessor.UI.ShowAllDialog;
|
||||
import com.TwentyCodes.java.OrderProcessor.UI.ExceptionReportGUI;
|
||||
|
||||
/**
|
||||
* An exception handler used to help report bugs in our applications
|
||||
@@ -37,7 +37,7 @@ public class UncaughtExceptionHandler implements java.lang.Thread.UncaughtExcept
|
||||
*/
|
||||
@Override
|
||||
public void uncaughtException(Thread t, Throwable e) {
|
||||
new ShowAllDialog("We're Sorry....", getDebugReport(e));
|
||||
new ExceptionReportGUI(getDebugReport(e));
|
||||
mDefaultUEH.uncaughtException(t,e);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
1.0.0 b 28
|
||||
|
||||
fixed the .CSV file parsing with an external lib.
|
||||
|
||||
1.0.1 b 29
|
||||
|
||||
created a single window with a tabbed layout for a more fluid experience.
|
||||
added an overwrite file dialog.
|
||||
added the customer country to the order object.
|
||||
updated .CSV export
|
||||
|
||||
@@ -1 +1 @@
|
||||
0.12.0 b 27
|
||||
1.0.0 b 29
|
||||
Reference in New Issue
Block a user