re-added the show all dialog.
MainWinod.java, reorganized the constructor so the progress bar will be indeterminate when connecting to the database
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
#---No Comment---
|
#---No Comment---
|
||||||
#Sat Jan 22 14:59:35 EST 2011
|
#Sat Jan 22 21:42:25 EST 2011
|
||||||
server_parrword=S35-2n6t
|
server_parrword=S35-2n6t
|
||||||
server_location=tcdevsvn1
|
|
||||||
use_remote_server=true
|
use_remote_server=true
|
||||||
|
server_location=tcdevsvn1
|
||||||
server_port_number=3306
|
server_port_number=3306
|
||||||
server_user_name=ricky.barrette
|
server_user_name=ricky.barrette
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ public class MainWindow extends JFrame implements ActionListener, ProgressListen
|
|||||||
private JFileChooser fc;
|
private JFileChooser fc;
|
||||||
public static OrderDB db;
|
public static OrderDB db;
|
||||||
private static final long serialVersionUID = 1841715561053331517L;
|
private static final long serialVersionUID = 1841715561053331517L;
|
||||||
private JProgressBar mProgressBar;
|
private static JProgressBar mProgressBar;
|
||||||
private String mCurrentFile;
|
private String mCurrentFile;
|
||||||
private UncaughtExceptionHandler mExceptionReport = new UncaughtExceptionHandler(this.getClass());
|
private UncaughtExceptionHandler mExceptionReport = new UncaughtExceptionHandler(this.getClass());
|
||||||
private static JLabel orderCountLabel;
|
private static JLabel orderCountLabel;
|
||||||
@@ -59,14 +59,17 @@ public class MainWindow extends JFrame implements ActionListener, ProgressListen
|
|||||||
|
|
||||||
tabbedPane.addTab("Main", initializeMainPanel());
|
tabbedPane.addTab("Main", initializeMainPanel());
|
||||||
tabbedPane.addTab("Search Orders", new SearchPanel(this));
|
tabbedPane.addTab("Search Orders", new SearchPanel(this));
|
||||||
// tabbedPane.addTab("Show All Orders", new ShowAllPanel(this));
|
tabbedPane.addTab("Show All Orders", new ShowAllPanel(this));
|
||||||
tabbedPane.addTab("Settings", new SettingsPanel());
|
tabbedPane.addTab("Settings", new SettingsPanel());
|
||||||
|
|
||||||
|
mProgressBar.setString(null);
|
||||||
|
mProgressBar.setIndeterminate(false);
|
||||||
this.getContentPane().add(tabbedPane, BorderLayout.CENTER);
|
this.getContentPane().add(tabbedPane, BorderLayout.CENTER);
|
||||||
|
|
||||||
this.setVisible(true);
|
this.setVisible(true);
|
||||||
this.pack();
|
this.pack();
|
||||||
|
|
||||||
|
loadDatabase();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -82,20 +85,16 @@ public class MainWindow extends JFrame implements ActionListener, ProgressListen
|
|||||||
JPanel panel = new JPanel();
|
JPanel panel = new JPanel();
|
||||||
mainPanel.add(panel);
|
mainPanel.add(panel);
|
||||||
|
|
||||||
|
|
||||||
//load button
|
//load button
|
||||||
mLoadFileButton = new JButton("Load File", new ImageIcon(getClass().getResource("/database_add.png")));
|
mLoadFileButton = new JButton("Load File", new ImageIcon(getClass().getResource("/database_add.png")));
|
||||||
mLoadFileButton.addActionListener(this);
|
mLoadFileButton.addActionListener(this);
|
||||||
|
|
||||||
|
|
||||||
mWarningLabel = new JLabel("");
|
mWarningLabel = new JLabel("");
|
||||||
orderCountLabel = new JLabel("");
|
orderCountLabel = new JLabel("");
|
||||||
|
|
||||||
panel.add(new JLabel("Total Orders in the database:"));
|
panel.add(new JLabel("Total Orders in the database:"));
|
||||||
panel.add(orderCountLabel);
|
panel.add(orderCountLabel);
|
||||||
|
|
||||||
loadDatabase();
|
|
||||||
|
|
||||||
panel.add(mLoadFileButton);
|
panel.add(mLoadFileButton);
|
||||||
|
|
||||||
panel.add(mWarningLabel);
|
panel.add(mWarningLabel);
|
||||||
@@ -103,17 +102,22 @@ public class MainWindow extends JFrame implements ActionListener, ProgressListen
|
|||||||
//progress bar
|
//progress bar
|
||||||
mProgressBar = new JProgressBar();
|
mProgressBar = new JProgressBar();
|
||||||
mProgressBar.setStringPainted(true);
|
mProgressBar.setStringPainted(true);
|
||||||
mainPanel.add(mProgressBar, BorderLayout.SOUTH);
|
|
||||||
|
|
||||||
|
mainPanel.add(mProgressBar, BorderLayout.SOUTH);
|
||||||
return mainPanel;
|
return mainPanel;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void loadDatabase() {
|
public static void loadDatabase() {
|
||||||
|
mProgressBar.setString("Connecting to database");
|
||||||
|
mProgressBar.setIndeterminate(true);
|
||||||
|
java.util.concurrent.Executors.newSingleThreadExecutor().submit(new Runnable() {
|
||||||
|
public void run() {
|
||||||
|
|
||||||
//order count labels
|
//order count labels
|
||||||
try {
|
try {
|
||||||
db = new OrderDB();
|
db = new OrderDB();
|
||||||
orderCountLabel.setText(db.getCount()+"");
|
orderCountLabel.setText(db.getCount()+"");
|
||||||
mWarningLabel.setText("");
|
mWarningLabel.setText(null);
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
mWarningLabel.setText(e.getMessage());
|
mWarningLabel.setText(e.getMessage());
|
||||||
@@ -125,10 +129,12 @@ public class MainWindow extends JFrame implements ActionListener, ProgressListen
|
|||||||
mWarningLabel.setText("Database not avilable");
|
mWarningLabel.setText("Database not avilable");
|
||||||
mWarningLabel.setVisible(true);
|
mWarningLabel.setVisible(true);
|
||||||
} catch (ClassNotFoundException e) {
|
} catch (ClassNotFoundException e) {
|
||||||
// TODO Auto-generated catch block
|
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
mProgressBar.setString(null);
|
||||||
|
mProgressBar.setIndeterminate(false);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -155,7 +161,6 @@ public class MainWindow extends JFrame implements ActionListener, ProgressListen
|
|||||||
public void run() {
|
public void run() {
|
||||||
try {
|
try {
|
||||||
db.load(fc.getSelectedFile());
|
db.load(fc.getSelectedFile());
|
||||||
|
|
||||||
} catch (FileNotFoundException e) {
|
} catch (FileNotFoundException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ public class OrderPane extends JScrollPane {
|
|||||||
|
|
||||||
for (int i = 0; i < list.size(); i++) {
|
for (int i = 0; i < list.size(); i++) {
|
||||||
if(mListener != null)
|
if(mListener != null)
|
||||||
mListener.onProgressUpdate("Processing Order: "+ (i+1) +" of "+ list.size(), false, i, list.size());
|
mListener.onProgressUpdate("Processing Order: "+ (i+1) +" of "+ list.size(), false, (i+1), list.size());
|
||||||
|
|
||||||
try {
|
try {
|
||||||
switch (list.get(i).getFulfillmentStatus()) {
|
switch (list.get(i).getFulfillmentStatus()) {
|
||||||
|
|||||||
@@ -49,33 +49,22 @@ public class ShowAllPanel extends JPanel implements ActionListener, ProgressList
|
|||||||
add(ok, BorderLayout.NORTH);
|
add(ok, BorderLayout.NORTH);
|
||||||
mProgressBar.setString("Loading from Database");
|
mProgressBar.setString("Loading from Database");
|
||||||
mProgressBar.setStringPainted(true);
|
mProgressBar.setStringPainted(true);
|
||||||
try {
|
|
||||||
MainWindow.db.setOnProgressListerner(this);
|
|
||||||
} catch (NullPointerException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
mOutput.setText("Database not initialized");
|
|
||||||
}
|
|
||||||
frame.pack();
|
frame.pack();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
setVisible(true);
|
setVisible(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent arg0) {
|
public void actionPerformed(ActionEvent arg0) {
|
||||||
|
MainWindow.db.setOnProgressListerner(this);
|
||||||
java.util.concurrent.Executors.newSingleThreadExecutor().submit(new Runnable() {
|
java.util.concurrent.Executors.newSingleThreadExecutor().submit(new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
try {
|
try {
|
||||||
mOutput.displayOrders(MainWindow.db.getAllOrders());
|
mOutput.displayOrders(MainWindow.db.getAllOrders());
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
// TODO Auto-generated catch block
|
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
// TODO Auto-generated catch block
|
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
} catch (ClassNotFoundException e) {
|
} catch (ClassNotFoundException e) {
|
||||||
// TODO Auto-generated catch block
|
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
mFrame.pack();
|
mFrame.pack();
|
||||||
|
|||||||
@@ -29,3 +29,7 @@ added the ability to remove existing orders if they are new, so they can be repl
|
|||||||
added the ability to print all new order in blue
|
added the ability to print all new order in blue
|
||||||
improved order pane processing
|
improved order pane processing
|
||||||
modified the date picker to be easier to use
|
modified the date picker to be easier to use
|
||||||
|
|
||||||
|
1.1.1 b 46
|
||||||
|
re-added the show all dialog.
|
||||||
|
MainWinod.java, reorganized the constructor so the progress bar will be indeterminate when connecting to the database
|
||||||
Reference in New Issue
Block a user