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---
|
||||
#Sat Jan 22 14:59:35 EST 2011
|
||||
#Sat Jan 22 21:42:25 EST 2011
|
||||
server_parrword=S35-2n6t
|
||||
server_location=tcdevsvn1
|
||||
use_remote_server=true
|
||||
server_location=tcdevsvn1
|
||||
server_port_number=3306
|
||||
server_user_name=ricky.barrette
|
||||
|
||||
@@ -37,7 +37,7 @@ public class MainWindow extends JFrame implements ActionListener, ProgressListen
|
||||
private JFileChooser fc;
|
||||
public static OrderDB db;
|
||||
private static final long serialVersionUID = 1841715561053331517L;
|
||||
private JProgressBar mProgressBar;
|
||||
private static JProgressBar mProgressBar;
|
||||
private String mCurrentFile;
|
||||
private UncaughtExceptionHandler mExceptionReport = new UncaughtExceptionHandler(this.getClass());
|
||||
private static JLabel orderCountLabel;
|
||||
@@ -59,14 +59,17 @@ public class MainWindow extends JFrame implements ActionListener, ProgressListen
|
||||
|
||||
tabbedPane.addTab("Main", initializeMainPanel());
|
||||
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());
|
||||
|
||||
|
||||
mProgressBar.setString(null);
|
||||
mProgressBar.setIndeterminate(false);
|
||||
this.getContentPane().add(tabbedPane, BorderLayout.CENTER);
|
||||
|
||||
this.setVisible(true);
|
||||
this.pack();
|
||||
|
||||
loadDatabase();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -82,20 +85,16 @@ public class MainWindow extends JFrame implements ActionListener, ProgressListen
|
||||
JPanel panel = new JPanel();
|
||||
mainPanel.add(panel);
|
||||
|
||||
|
||||
//load button
|
||||
mLoadFileButton = new JButton("Load File", new ImageIcon(getClass().getResource("/database_add.png")));
|
||||
mLoadFileButton.addActionListener(this);
|
||||
|
||||
|
||||
mWarningLabel = new JLabel("");
|
||||
orderCountLabel = new JLabel("");
|
||||
|
||||
panel.add(new JLabel("Total Orders in the database:"));
|
||||
panel.add(orderCountLabel);
|
||||
|
||||
loadDatabase();
|
||||
|
||||
panel.add(mLoadFileButton);
|
||||
|
||||
panel.add(mWarningLabel);
|
||||
@@ -103,32 +102,39 @@ public class MainWindow extends JFrame implements ActionListener, ProgressListen
|
||||
//progress bar
|
||||
mProgressBar = new JProgressBar();
|
||||
mProgressBar.setStringPainted(true);
|
||||
|
||||
mainPanel.add(mProgressBar, BorderLayout.SOUTH);
|
||||
|
||||
return mainPanel;
|
||||
}
|
||||
|
||||
public static void loadDatabase() {
|
||||
//order count labels
|
||||
try {
|
||||
db = new OrderDB();
|
||||
orderCountLabel.setText(db.getCount()+"");
|
||||
mWarningLabel.setText("");
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
mWarningLabel.setText(e.getMessage());
|
||||
mWarningLabel.setVisible(true);
|
||||
} catch (SocketException e) {
|
||||
mWarningLabel.setText(e.getMessage());
|
||||
mWarningLabel.setVisible(true);
|
||||
} catch (NullPointerException e){
|
||||
mWarningLabel.setText("Database not avilable");
|
||||
mWarningLabel.setVisible(true);
|
||||
} catch (ClassNotFoundException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
mProgressBar.setString("Connecting to database");
|
||||
mProgressBar.setIndeterminate(true);
|
||||
java.util.concurrent.Executors.newSingleThreadExecutor().submit(new Runnable() {
|
||||
public void run() {
|
||||
|
||||
//order count labels
|
||||
try {
|
||||
db = new OrderDB();
|
||||
orderCountLabel.setText(db.getCount()+"");
|
||||
mWarningLabel.setText(null);
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
mWarningLabel.setText(e.getMessage());
|
||||
mWarningLabel.setVisible(true);
|
||||
} catch (SocketException e) {
|
||||
mWarningLabel.setText(e.getMessage());
|
||||
mWarningLabel.setVisible(true);
|
||||
} catch (NullPointerException e){
|
||||
mWarningLabel.setText("Database not avilable");
|
||||
mWarningLabel.setVisible(true);
|
||||
} catch (ClassNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
mProgressBar.setString(null);
|
||||
mProgressBar.setIndeterminate(false);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@@ -155,7 +161,6 @@ public class MainWindow extends JFrame implements ActionListener, ProgressListen
|
||||
public void run() {
|
||||
try {
|
||||
db.load(fc.getSelectedFile());
|
||||
|
||||
} catch (FileNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
} catch (SQLException e) {
|
||||
|
||||
@@ -58,7 +58,7 @@ public class OrderPane extends JScrollPane {
|
||||
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
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 {
|
||||
switch (list.get(i).getFulfillmentStatus()) {
|
||||
|
||||
@@ -49,33 +49,22 @@ public class ShowAllPanel extends JPanel implements ActionListener, ProgressList
|
||||
add(ok, BorderLayout.NORTH);
|
||||
mProgressBar.setString("Loading from Database");
|
||||
mProgressBar.setStringPainted(true);
|
||||
try {
|
||||
MainWindow.db.setOnProgressListerner(this);
|
||||
} catch (NullPointerException e) {
|
||||
e.printStackTrace();
|
||||
mOutput.setText("Database not initialized");
|
||||
}
|
||||
frame.pack();
|
||||
|
||||
|
||||
|
||||
setVisible(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent arg0) {
|
||||
MainWindow.db.setOnProgressListerner(this);
|
||||
java.util.concurrent.Executors.newSingleThreadExecutor().submit(new Runnable() {
|
||||
public void run() {
|
||||
try {
|
||||
mOutput.displayOrders(MainWindow.db.getAllOrders());
|
||||
} catch (SQLException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
} catch (IOException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
} catch (ClassNotFoundException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
mFrame.pack();
|
||||
|
||||
@@ -28,4 +28,8 @@ created statuss for NEW and CHARGABLE, and added the options to the order pane.
|
||||
added the ability to remove existing orders if they are new, so they can be replaced
|
||||
added the ability to print all new order in blue
|
||||
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