diff --git a/.gitignore b/.gitignore
index 71f0ca1..8efce3b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -13,3 +13,6 @@
hs_err_pid*
docs/_site
Gemfile.lock
+
+.DS_Store
+src/main/resources
diff --git a/NOTICE b/NOTICE
index b16a73c..b48124f 100644
--- a/NOTICE
+++ b/NOTICE
@@ -20,4 +20,3 @@ This project includes:
JUnit under Common Public License Version 1.0
Maven definition for AbsoluteLayout.jar - external part of NetBeans module. under Sun Public License Version 1.0
Swing Layout Extensions under Lesser General Public License (LGPL)
-
diff --git a/pom.xml b/pom.xml
index 7c9600d..29cc5b9 100644
--- a/pom.xml
+++ b/pom.xml
@@ -30,7 +30,7 @@
org.apereo.application
ImageQuiz
- 1.0-SNAPSHOT
+ 1.0.0-SNAPSHOT
jar
ImageQuiz
https://github.com/Jasig/ImageQuiz
@@ -81,25 +81,53 @@
-
- sh.tak.appbundler
- appbundle-maven-plugin
- 1.0.4
-
- scripteditor.MainForm
-
-
-
- package
-
- bundle
-
-
-
-
+
+
+ com.jolira
+ onejar-maven-plugin
+ 1.4.4
+
+
+
+ scripteditor.MainForm
+ 0.97
+ true
+
+
+ one-jar
+
+
+
+
+
+
+ sh.tak.appbundler
+ appbundle-maven-plugin
+ 1.0.4
+
+ scripteditor.MainForm
+
+
+
+
+
+ none
+
+ bundle
+
+
+
+
+
+
+ onejar-maven-plugin.googlecode.com
+ http://onejar-maven-plugin.googlecode.com/svn/mavenrepo
+
+
+
@@ -107,6 +135,6 @@
Netbeans Maven Repository
http://bits.netbeans.org/maven2/
default
-
+
diff --git a/src/main/java/scripteditor/CheckBoxTable.java b/src/main/java/scripteditor/CheckBoxTable.java
index 5dcc590..1841325 100755
--- a/src/main/java/scripteditor/CheckBoxTable.java
+++ b/src/main/java/scripteditor/CheckBoxTable.java
@@ -309,8 +309,7 @@ else if (value instanceof String) {
value = "0";
Integer.parseInt(value.toString());
} catch (Exception e) {
- JOptionPane.showMessageDialog(this.jtable.getParent(),
- "Invalid Number");
+ Utilities.MessageDialog(this.jtable.getParent(), "Invalid Number");
return;
}
} else if (((String) numberconstraints.elementAt(nCol))
@@ -323,8 +322,7 @@ else if (value instanceof String) {
.elementAt(nCol)).intValue(),
BigDecimal.ROUND_HALF_UP)).toString();
} catch (Exception e) {
- JOptionPane.showMessageDialog(this.jtable.getParent(),
- "Invalid Number");
+ Utilities.MessageDialog(this.jtable.getParent(), "Invalid Number");
return;
}
@@ -385,13 +383,12 @@ public Vector deleteSelectedRow(int pos) {
int messageint = pos + 1;
if (messageint == 0) {
- JOptionPane.showMessageDialog(this.jtable.getParent(),
- "No rows selected");
+ Utilities.MessageDialog(this.jtable.getParent(), "No rows selected");
return null;
}
- int optionstatus = JOptionPane.showConfirmDialog(this.jtable
- .getParent(), "Do you want to delete " + messageint + " row");
+
+ int optionstatus = Utilities.ConfirmDialog(this.jtable.getParent(), "Do you want to delete " + messageint + " row", "Delete Row?");
if (optionstatus != 0) {
return null;
}
diff --git a/src/main/java/scripteditor/ConfigFileReader.java b/src/main/java/scripteditor/ConfigFileReader.java
index f1d3a18..3cd276d 100755
--- a/src/main/java/scripteditor/ConfigFileReader.java
+++ b/src/main/java/scripteditor/ConfigFileReader.java
@@ -19,6 +19,8 @@
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
+
+
*/
package scripteditor;
@@ -27,14 +29,14 @@
public class ConfigFileReader {
-
- public static String getProjectName()
+
+ public static String getProjectName()
{
-
- String returnString = "Visual Learning – Plant Identification";
-
+
+ String returnString = "Visual Learning"; //default string
+
File file = new File(Configuration.ApplicationPath()+File.separator+"Graphics"+File.separator+"name.txt");
-
+
if(file.exists())
{
try {
@@ -42,10 +44,33 @@ public static String getProjectName()
FileInputStream fileInputStream = new FileInputStream(file);
dataArray = new byte[fileInputStream.available()];
fileInputStream.read(dataArray);
- returnString = new String(dataArray);
- }
+ returnString = new String(dataArray);
+ }
catch (Exception ex) {
-
+
+ }
+ }
+ return returnString;
+ }
+
+ public static String getWelcomeText()
+ {
+
+ String returnString = ""; //default string
+
+ File file = new File(Configuration.ApplicationPath()+File.separator+"Graphics"+File.separator+"welcome.txt");
+
+ if(file.exists())
+ {
+ try {
+ byte dataArray[];
+ FileInputStream fileInputStream = new FileInputStream(file);
+ dataArray = new byte[fileInputStream.available()];
+ fileInputStream.read(dataArray);
+ returnString = new String(dataArray);
+ }
+ catch (Exception ex) {
+
}
}
return returnString;
diff --git a/src/main/java/scripteditor/Configuration.java b/src/main/java/scripteditor/Configuration.java
index d9d006f..4113dfb 100755
--- a/src/main/java/scripteditor/Configuration.java
+++ b/src/main/java/scripteditor/Configuration.java
@@ -40,8 +40,7 @@
* @author Administrator
*/
public class Configuration {
-
- static int OS = 1; // Windows OS = 0 and MAC OS = 1
+
static String mDBPath = "DBPath.txt";
public static String DataBaseName() {
return "database.csv";
@@ -96,7 +95,7 @@ public static String getDatabaseFolderPath() {
else
return line;
}
-
+
private static BufferedReader getReader(String path){
FileReader inFile = null;
//String currentDirectory = Configuration.ApplicationPath();
@@ -111,7 +110,7 @@ private static BufferedReader getReader(String path){
return null;
}
return new BufferedReader(inFile);
-
+
}
public static void setDatabaseFolderPath(String path_to_db){
PrintWriter pw = getPrintWriter(ApplicationPath() + "\\" + mDBPath);
@@ -122,7 +121,7 @@ public static void setDatabaseFolderPath(String path_to_db){
} catch (Exception e) {
String err = e.getMessage();
}
-
+
}
private static PrintWriter getPrintWriter(String filename) {
@@ -149,10 +148,16 @@ private static PrintWriter getPrintWriter(String filename) {
return diskfile;
}
+
public static String ApplicationPath() {
File myFile = new File("");
try {
- return myFile.getCanonicalPath();
+ if(!Utilities.IsWindows()) {
+ //if (OSType.compareToIgnoreCase("MAC") == 0) {
+ return myFile.getCanonicalPath() + "/..";
+ } else {
+ return myFile.getCanonicalPath() + "/";
+ }
} catch (IOException ex) {
Logger.getLogger(Configuration.class.getName()).log(Level.SEVERE, null, ex);
return "";
@@ -161,11 +166,11 @@ public static String ApplicationPath() {
public static void CreateGradesFolder() {
// String path = UserPath() + "Grades/";
- String path = ApplicationPath() + "Grades/";//commented by preethy on 16-03-2012
+ String path = ApplicationPath() + "/Grades/";
boolean success = (new File(path)).mkdirs();
}
- public static String UserPath() {
+ /*public static String UserPath() {
//if(OS == 0){
JFileChooser fr = new JFileChooser();
javax.swing.filechooser.FileSystemView fw = fr.getFileSystemView();
@@ -177,16 +182,12 @@ public static String UserPath() {
// }
// else
// return "OS not found";
-
- }
- /* public static String ApplicationName() {
- return "WPSEUS-LTD";
}*/
-
- public static String ApplicationName() {
- return "VL-APR";
- }
+
+ /*public static String ApplicationName() {
+ return "Visual Learning";
+ }*/
// Tell program how many user records to hold before deleteing old records
// View Progress Records
@@ -194,5 +195,3 @@ public static int ProgressRecords() {
return 1000;
}
}
-
-
diff --git a/src/main/java/scripteditor/HelpPopup.form b/src/main/java/scripteditor/HelpPopup.form
index 5b7c8f5..9b72a3b 100755
--- a/src/main/java/scripteditor/HelpPopup.form
+++ b/src/main/java/scripteditor/HelpPopup.form
@@ -31,24 +31,27 @@
-
+
-
-
+
+
+
+
+
-
+
-
-
+
+
-
+
@@ -81,51 +84,31 @@
-
+
-
-
-
-
+
+
+
+
+
+
-
-
-
+
+
+
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -143,11 +126,34 @@
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/main/java/scripteditor/HelpPopup.java b/src/main/java/scripteditor/HelpPopup.java
index 60b4e4f..e72dbca 100755
--- a/src/main/java/scripteditor/HelpPopup.java
+++ b/src/main/java/scripteditor/HelpPopup.java
@@ -38,17 +38,17 @@ public class HelpPopup extends javax.swing.JDialog {
private String mName;
private String mFirstLine;
private ActionListener myListener;
-
+
/** Creates new form HelpPopup */
public HelpPopup(String name, String firstLine, ActionListener al) {
mName = name;
mFirstLine = firstLine;
myListener = al;
initComponents();
- addEscapeListener(this);//Added by preethy
-//
+ addEscapeListener(this);//Added by preethy
+//
}
-
+
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
@@ -59,8 +59,9 @@ private void initComponents() {
chkShowOnStartUp = new javax.swing.JCheckBox();
jPanel1 = new javax.swing.JPanel();
- jLabel2 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
+ jScrollPane1 = new javax.swing.JScrollPane();
+ jTextArea1 = new javax.swing.JTextArea();
setTitle("Visual Learning:");
setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
@@ -86,25 +87,6 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
jPanel1.setBackground(new java.awt.Color(255, 255, 255));
- jLabel2.setBackground(new java.awt.Color(255, 255, 255));
- jLabel2.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
- jLabel2.setForeground(new java.awt.Color(0, 51, 204));
- jLabel2.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
- jLabel2.setText(" An introduction to the Image Quiz Family of Programs");
- jLabel2.setDebugGraphicsOptions(javax.swing.DebugGraphics.NONE_OPTION);
- jLabel2.setOpaque(true);
- jLabel2.addMouseListener(new java.awt.event.MouseAdapter() {
- public void mouseEntered(java.awt.event.MouseEvent evt) {
- jLabel2MouseEntered(evt);
- }
- public void mouseExited(java.awt.event.MouseEvent evt) {
- jLabel2MouseExited(evt);
- }
- public void mouseReleased(java.awt.event.MouseEvent evt) {
- jLabel2MouseReleased(evt);
- }
- });
-
jLabel3.setBackground(new java.awt.Color(255, 255, 255));
jLabel3.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jLabel3.setForeground(new java.awt.Color(0, 51, 204));
@@ -113,36 +95,45 @@ public void mouseReleased(java.awt.event.MouseEvent evt) {
jLabel3.setDebugGraphicsOptions(javax.swing.DebugGraphics.NONE_OPTION);
jLabel3.setOpaque(true);
jLabel3.addMouseListener(new java.awt.event.MouseAdapter() {
- public void mouseEntered(java.awt.event.MouseEvent evt) {
- jLabel3MouseEntered(evt);
+ public void mouseReleased(java.awt.event.MouseEvent evt) {
+ jLabel3MouseReleased(evt);
}
public void mouseExited(java.awt.event.MouseEvent evt) {
jLabel3MouseExited(evt);
}
- public void mouseReleased(java.awt.event.MouseEvent evt) {
- jLabel3MouseReleased(evt);
+ public void mouseEntered(java.awt.event.MouseEvent evt) {
+ jLabel3MouseEntered(evt);
}
});
+ jScrollPane1.setBorder(null);
+
+ jTextArea1.setColumns(20);
+ jTextArea1.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
+ jTextArea1.setRows(5);
+ jScrollPane1.setViewportView(jTextArea1);
+
org.jdesktop.layout.GroupLayout jPanel1Layout = new org.jdesktop.layout.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
- .add(jPanel1Layout.createSequentialGroup()
+ .add(org.jdesktop.layout.GroupLayout.TRAILING, jPanel1Layout.createSequentialGroup()
.addContainerGap()
- .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
- .add(jLabel2)
- .add(jLabel3, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
+ .add(jLabel3, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addContainerGap())
+ .add(org.jdesktop.layout.GroupLayout.TRAILING, jPanel1Layout.createSequentialGroup()
+ .addContainerGap(18, Short.MAX_VALUE)
+ .add(jScrollPane1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 510, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
+ .add(19, 19, 19))
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(jPanel1Layout.createSequentialGroup()
- .addContainerGap()
- .add(jLabel2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 35, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
- .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
+ .addContainerGap(17, Short.MAX_VALUE)
+ .add(jScrollPane1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 170, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
.add(jLabel3, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 36, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
- .addContainerGap(33, Short.MAX_VALUE))
+ .addContainerGap())
);
org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
@@ -152,46 +143,34 @@ public void mouseReleased(java.awt.event.MouseEvent evt) {
.add(layout.createSequentialGroup()
.addContainerGap()
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
- .add(chkShowOnStartUp)
- .add(jPanel1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
- .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
+ .add(jPanel1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .add(layout.createSequentialGroup()
+ .add(chkShowOnStartUp)
+ .add(0, 0, Short.MAX_VALUE)))
+ .addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(layout.createSequentialGroup()
- .add(19, 19, 19)
- .add(jPanel1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
+ .addContainerGap()
+ .add(jPanel1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(chkShowOnStartUp)
- .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
+ .addContainerGap())
);
pack();
}// //GEN-END:initComponents
private void jLabel3MouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel3MouseReleased
-
+
this.setVisible(false);
-
+
myListener.actionPerformed(new ActionEvent(this, 1, "Tutorial"));
-
+
//this.dispose();
}//GEN-LAST:event_jLabel3MouseReleased
- private void jLabel2MouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel2MouseReleased
-
- this.setVisible(false);
- myListener.actionPerformed(new ActionEvent(this, 1, "Intro"));
- // this.dispose();
- }//GEN-LAST:event_jLabel2MouseReleased
-
- private void jLabel2MouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel2MouseExited
-// TODO add your handling code here:
-// jLabel2.setBackground(new Color(255,255,255)) ;
- jLabel2.setBorder(null);
-// jLabel2.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(0, 0, 0), 1, true));
- }//GEN-LAST:event_jLabel2MouseExited
-
private void jLabel3MouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel3MouseExited
// TODO add your handling code here:
jLabel3.setBorder(null);
@@ -199,17 +178,17 @@ private void jLabel3MouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:even
}//GEN-LAST:event_jLabel3MouseExited
private void formWindowClosing(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowClosing
-
+
mFirstLine = mFirstLine.substring(0, mFirstLine.length()-1);
-
- if(!chkShowOnStartUp.isSelected()){
+
+ if(!chkShowOnStartUp.isSelected()){
mFirstLine = mFirstLine + "0";
}
else
mFirstLine = mFirstLine + "1";
-
+
FileWriter myFileWriter = null;
-
+
// String path = Configuration.UserPath();
String path = Configuration.ApplicationPath();
String filename = path + "/UserFiles/" + mName + ".csv";
@@ -217,16 +196,16 @@ private void formWindowClosing(java.awt.event.WindowEvent evt) {//GEN-FIRST:even
try{
myFileWriter = new FileWriter(filename);
} catch(IOException ioe){
-
+
}
-
+
PrintWriter diskfile = new PrintWriter(myFileWriter);
diskfile.println(mFirstLine);// 1 is a flag for the help Popup
-
+
diskfile.close();
-
-
+
+
}//GEN-LAST:event_formWindowClosing
private void jLabel3MouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel3MouseEntered
@@ -235,37 +214,35 @@ private void jLabel3MouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:eve
jLabel3.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(0, 0, 0), 1, true));
}//GEN-LAST:event_jLabel3MouseEntered
- private void jLabel2MouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel2MouseEntered
-// jLabel2.setBackground(this.getBackground());
- jLabel2.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(0, 0, 0), 1, true));
- }//GEN-LAST:event_jLabel2MouseEntered
-
private void chkShowOnStartUpActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_chkShowOnStartUpActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_chkShowOnStartUpActionPerformed
private void formWindowOpened(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowOpened
this.setTitle(ConfigFileReader.getProjectName());
+ jTextArea1.setText(ConfigFileReader.getWelcomeText());
+
}//GEN-LAST:event_formWindowOpened
-
- public static void addEscapeListener(final JDialog dialog) {
- ActionListener escListener = new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
+
+ public static void addEscapeListener(final JDialog dialog) {
+ ActionListener escListener = new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
// esc=true;
- dialog.setVisible(false); } };
+ dialog.setVisible(false); } };
dialog.getRootPane().registerKeyboardAction(escListener,KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0),JComponent.WHEN_IN_FOCUSED_WINDOW);
}
/**
* @param args the command line arguments
*/
-
-
+
+
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JCheckBox chkShowOnStartUp;
- private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JPanel jPanel1;
+ private javax.swing.JScrollPane jScrollPane1;
+ private javax.swing.JTextArea jTextArea1;
// End of variables declaration//GEN-END:variables
-
+
}
diff --git a/src/main/java/scripteditor/IQImageComparison.java b/src/main/java/scripteditor/IQImageComparison.java
index b3b9f1c..ad8f669 100755
--- a/src/main/java/scripteditor/IQImageComparison.java
+++ b/src/main/java/scripteditor/IQImageComparison.java
@@ -40,10 +40,10 @@
public class IQImageComparison {
-
+
//*********************************************************
// Member Variables
-
+
String[][] mResults;
ImageCollection myCollection;
int mMode;
@@ -67,11 +67,11 @@ public class IQImageComparison {
boolean fontItalic=false;//Added by preethy on 21-04-2012
//
//**********************************************************
-
+
/** Creates a new instance of ImageComparison */
public IQImageComparison(Component parentForm, JLabel displayLabel, String[][] fileNames, double delay, String taxLevel,
String[] taxa, JPanel p, ActionListener al, String name, boolean test_mode, ImageCollection ic, ProgressClass pc) {
-
+
mResults = fileNames;
mPic = displayLabel;
mParent = parentForm;
@@ -87,30 +87,30 @@ public IQImageComparison(Component parentForm, JLabel displayLabel, String[][] f
myCollection.sortForComparisons();
mScaler = new ImageScaler();
if(mTaxLevel.equals("Genus")||(mTaxLevel.equals("Species"))){
- fontItalic=true;
+ fontItalic=true;
}
Main();
mScaler = null;
-
+
}
-
-
+
+
// Main loop for an Image Comparison Run!
private void Main() {
// Checks to see if more than 2 taxa are selected
if (mTaxa.length < 2) {
- JOptionPane.showMessageDialog(mParent, "There must be more than one taxa selected for Image Comparison.");
-
+ Utilities.MessageDialog(mParent, "There must be more than one taxa selected for Image Comparison.");
+
return;
}
-
+
if (mTestMode)
mGrade = GradeImageComparisonFactory.GetGradeInstance(GradeImageComparisonFactory.ImageComparisonTest, new QuizResultClass(6, mResults.length, SessionInfo.SpellingValue, mDelay),fontItalic);
else
mGrade = GradeImageComparisonFactory.GetGradeInstance(GradeImageComparisonFactory.ImageComparisonQuiz, new QuizResultClass(3, mResults.length, SessionInfo.SpellingValue, mDelay),fontItalic);
-
+
//Display 2 imagees side by side and compare
// Move leftPictureBox to left and dynamically create another pictureBox
// for the right image to compare.
@@ -133,7 +133,7 @@ private void Main() {
rightPictureBox.setHorizontalAlignment(JLabel.LEFT);
rightPictureBox.setVisible(true);
mPanel.validate();
-
+
Image left = ImageScaler.VerifyImageSize(myCollection.getCurrentImage().getImage(), pbWidth, pbHeight, mPic);
Image right;
leftAnswer = parseString(myCollection.getImageName());
@@ -143,13 +143,13 @@ private void Main() {
if ((int) (lastIndex % 2) == 1) {
lastIndex -= 1;
}
-
+
for (int i = 0; i < lastIndex; i += 2) {
mGrade.getGradeInstance().BeginQuestion();
mPanel.setVisible(false);
//Get Second Image (right-side)
retVal = myCollection.MoveNext();
-
+
right = myCollection.getCurrentImage().getImage();
right = ImageScaler.VerifyImageSize(myCollection.getCurrentImage().getImage(), pbWidth, pbHeight, mPic);
rightAnswer = parseString(myCollection.getImageName());
@@ -157,7 +157,7 @@ private void Main() {
rightPictureBox.setIcon(new ImageIcon(right));
while (true) {
-
+
////////////////////////////////////////////////
////// FIX IMAGE DISPLAY FOR FIRST IMAGE //////
answer = null;
@@ -201,7 +201,7 @@ private void Main() {
if(mGrade.Grade(answer, leftAnswer, rightAnswer,mTaxLevel)==true){
break; } //Go to next question.
} else {
-
+
if (mGrade.Grade(answer, leftAnswer, rightAnswer,mTaxLevel) == true) {
break; //Go to next question
}
@@ -231,14 +231,14 @@ private void Main() {
mPanel.invalidate();
mProgress.StoreResult(mGrade.getGradeInstance().getQuizResult(), String.valueOf(DecimalFormat.getPercentInstance().format(mGrade.getGradeInstance().NumberOfRightAnswers()/(double)(myCollection.NumberOfImages()/2))),fontItalic); // Adds the relust to the progress
}
-
+
public void SaveResult(){
ScriptResult rs;
if(mTestMode){
rs = new ScriptResult("Test-Image Comparison", mTaxLevel, mTaxa, mUserName,
mGrade.getGradeInstance().FinalGrade(), "n/a", "n/a", mGrade.getGradeInstance().TotalQuestions(),
myCollection.NumberOfImages()/ 2, null);
-
+
} else{
rs = new ScriptResult("Quiz-Image Comparison", mTaxLevel, mTaxa, mUserName,
mGrade.getGradeInstance().FinalGrade(),
@@ -250,14 +250,14 @@ public void SaveResult(){
rs.writeResults(false);
}
-
+
// This function will take a string and take off all begining words and return the last
//example takes (Hello how are you) and returns (you)
private String parseString(String name){
// Don't need tofix string in Comparison'
return name.trim();
}
-
+
// If paused this function will stop the progress of the test or quiz
// until mPaused or Running is set to false.
private void PauseAndRun(){
@@ -265,9 +265,9 @@ private void PauseAndRun(){
try{
Thread.sleep(100);
} catch(InterruptedException e){}
- }
+ }
}
-
+
// A basic delay function. Pass in the amount of seconds to pause.
private void JCDelay(double de) {
de = de * 1000;
@@ -279,7 +279,7 @@ private void JCDelay(double de) {
} catch(InterruptedException e){}
}
}
-
+
// Shows the try again dialog box to ask if the user would like to try again.
public static int ShowTryAgainDialog(){
dlgTryAgain dlg = new dlgTryAgain();
@@ -295,5 +295,5 @@ public static int ShowAgainDialog(){
return tf.getResponse();
}
/***/
-
+
}
diff --git a/src/main/java/scripteditor/IQImageVerification.java b/src/main/java/scripteditor/IQImageVerification.java
index 58b3dbc..e6cbda1 100755
--- a/src/main/java/scripteditor/IQImageVerification.java
+++ b/src/main/java/scripteditor/IQImageVerification.java
@@ -49,21 +49,21 @@ public IQImageVerification(SessionInfo session,boolean fontItalic){
mSessionInfo = session;
mScaler = new ImageScaler();
italic=fontItalic;
- ImageVerification();
+ ImageVerification();
mScaler = null;
-
-
+
+
}
-
+
private void ImageVerification(){
-
+
if(mSessionInfo.mTaxa.length < 2){
- JOptionPane.showMessageDialog(mSessionInfo.mParentForm, "There must be more than one taxa selected for Image Verification.");
+ Utilities.MessageDialog(mSessionInfo.mParentForm, "There must be more than one taxa selected for Image Verification.");
return;
}
-
-
+
+
// // Clear point-accumulating variables if not in testmode
// if (!mSessionInfo.mIsTest) {
// mGrade = new GradeImageVerificationQuiz(new QuizResultClass(4));
@@ -96,14 +96,14 @@ private void ImageVerification(){
String answer; // response from user
dlgResponse.setLocationRelativeTo(mSessionInfo.mParentForm);
AddNameLabel();
-
+
mNameLabel.setVisible(false);
ImageIcon tempIcon = new ImageIcon(image);
for(int i = 0; i < mSessionInfo.mFileNames.length; i++){
//// Use the mNameLabel as the fixation point
/// Never set mSessionInfo.mDisplayLabel to null. Always have image loaded.
/// Just set visable or not
-
+
mGrade.getGradeInstance().BeginQuestion();
while(true){
answer = null;
@@ -116,7 +116,7 @@ private void ImageVerification(){
mNameLabel.setVisible(true);
JCDelay(1); // name shown for only 1 second!
mNameLabel.setVisible(false);
-
+
if(!Running){
break;
}
@@ -137,21 +137,21 @@ private void ImageVerification(){
}
}
}
-
+
if (!Running) {
mGrade.getGradeInstance().QuitEarly();
break;
}
-
+
// Update progress class.
-
+
//
mSessionInfo.mImageCollection.MoveNext();
image = ImageScaler.VerifyImageSize(mSessionInfo.mImageCollection.getCurrentImage().getImage(), mSessionInfo.mDisplayLabel.getWidth(), mSessionInfo.mDisplayLabel.getHeight(), mSessionInfo.mDisplayLabel);
tempIcon = new ImageIcon(image);
realName = getParsedName(mSessionInfo.mImageCollection.getImageName());
randomName = getParsedName(mSessionInfo.mTaxa[generator.nextInt(seed)]);
-
+
while(realName.compareTo(randomName) == 0){
randomName = getParsedName(mSessionInfo.mTaxa[generator.nextInt(seed)]);
}
@@ -161,7 +161,7 @@ private void ImageVerification(){
}
mSessionInfo.mProgress.StoreResult(mGrade.getGradeInstance().getQuizResult(), String.valueOf(DecimalFormat.getPercentInstance().format(mGrade.getGradeInstance().NumberOfRightAnswers()/(double)mSessionInfo.mImageCollection.NumberOfImages())),italic); // Adds the result to the progress
}
-
+
// public void SaveResult() {
// if(mSessionInfo.mIsTest){
// Results rs = new Results("Test", "Image Verification", mSessionInfo.mTaxaLevel, mSessionInfo.mTaxa, mSessionInfo.mUserName, String.valueOf(mRightAnswers) + "/" + String.valueOf(mTotal), mDelay, mSessionInfo.mFixationTime);
@@ -191,9 +191,9 @@ public void SaveResult(){
private void AddNameLabel(){
mNameLabel = new JLabel();
mNameLabel.setHorizontalAlignment(JLabel.CENTER);
-
+
if(italic){
- mNameLabel.setFont(new Font("Tahoma", Font.ITALIC, 30));
+ mNameLabel.setFont(new Font("Tahoma", Font.ITALIC, 30));
}else{
mNameLabel.setFont(new Font("Tahoma", Font.BOLD, 30));
}
@@ -205,14 +205,14 @@ private void AddNameLabel(){
private String getParsedName(String temp){
int index = 0;
-
+
if(mSessionInfo.mTaxaLevel.compareTo("Family") != 0){
index = temp.indexOf(' ');
temp = temp.substring(index + 1, temp.length());
}
return temp;
}
-
+
private void JCDelay(double de) {
de = de * 1000;
double startTime = System.currentTimeMillis();
@@ -229,7 +229,7 @@ private void ShowFixation(){
JCDelay(mSessionInfo.mFixationTime);
mSessionInfo.mDisplayLabel.setText("");
}
-
+
public static int ShowTryAgainDialog(){
dlgTryAgain dlg = new dlgTryAgain();
dlg.setLocationRelativeTo(mSessionInfo.mParentForm);
@@ -244,6 +244,6 @@ public static int ShowAgainDialog(){
return tf.getResponse();
}
/***/
-
-
+
+
}
diff --git a/src/main/java/scripteditor/ImageCountClass.java b/src/main/java/scripteditor/ImageCountClass.java
index 590ab10..ae79bdb 100755
--- a/src/main/java/scripteditor/ImageCountClass.java
+++ b/src/main/java/scripteditor/ImageCountClass.java
@@ -88,7 +88,7 @@ private ArrayList resizeList(String taxaset, ArrayList list, int
} else if (list.size() > size) {
// Randomly take away from the list
- // #1 put list into
+ // #1 put list into
for (int i = 0; i < size; i++) {
randomnumber = myRandom.nextInt(list.size() - 1);
@@ -101,7 +101,7 @@ private ArrayList resizeList(String taxaset, ArrayList list, int
ArrayList tempArray = new ArrayList();
String temp;
if (size > allfiles.length) {
- JOptionPane.showMessageDialog(this, "The max quantity for " + taxaset + " is " + allfiles.length + ". Please select a lower quantity.");
+ Utilities.MessageDialog(this, "The max quantity for " + taxaset + " is " + allfiles.length + ". Please select a lower quantity.");
return null;
}
@@ -305,14 +305,14 @@ private void jButton2MouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:e
maxsize = getFileList(items.get(0)).length; // gets first element max
} catch (FileNotFoundException ex) {
- JOptionPane.showMessageDialog(this, ex.getMessage());
+ Utilities.MessageDialog(this, ex.getMessage());
Logger.getLogger(ImageCountClass.class.getName()).log(Level.SEVERE, null, ex);
}
for (int i = 1; i < items.size(); i++) {
try {
currentsize = getFileList(items.get(i)).length;
} catch (FileNotFoundException ex) {
- JOptionPane.showMessageDialog(this, ex.getMessage());
+ Utilities.MessageDialog(this, ex.getMessage());
Logger.getLogger(ImageCountClass.class.getName()).log(Level.SEVERE, null, ex);
}
if (currentsize < maxsize) {
@@ -343,7 +343,7 @@ private void jButton2MouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:e
tempPartNames = resizeList(temp, tempPartNames, maxsize);
} catch (FileNotFoundException ex) {
- JOptionPane.showMessageDialog(this, ex.getMessage());
+ Utilities.MessageDialog(this, ex.getMessage());
Logger.getLogger(ImageCountClass.class.getName()).log(Level.SEVERE, null, ex);
}
tempfnames = new String[tempPartNames.size() + tempMainNames.size()];
@@ -390,7 +390,7 @@ private void jButton1MouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:e
temp = this.tfSelected.getText();
//temp = temp.replace(" ", "");
if (temp.compareTo("") == 0) {
- JOptionPane.showMessageDialog(this, "Please select an item from the list.");
+ Utilities.MessageDialog(this, "Please select an item from the list.");
return;
}
for (int i = 0; i < mFileNames.length; i++) {
@@ -408,7 +408,7 @@ private void jButton1MouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:e
tempPartNames = resizeList(selectedtext, tempPartNames, intQty);
} catch (FileNotFoundException ex) {
- JOptionPane.showMessageDialog(this, ex.getMessage());
+ Utilities.MessageDialog(this, ex.getMessage());
Logger.getLogger(ImageCountClass.class.getName()).log(Level.SEVERE, null, ex);
}
if (tempPartNames == null) {
@@ -449,12 +449,12 @@ private void listImagesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FI
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_jButton1ActionPerformed
-
+
/**
* @param args the command line arguments
*/
-
-
+
+
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton jButton1;
private javax.swing.JButton jButton2;
@@ -465,5 +465,5 @@ private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRS
private javax.swing.JTextField tfQTY;
private javax.swing.JTextField tfSelected;
// End of variables declaration//GEN-END:variables
-
+
}
diff --git a/src/main/java/scripteditor/ImageSelectionClass.java b/src/main/java/scripteditor/ImageSelectionClass.java
index 31eb840..e1e3878 100755
--- a/src/main/java/scripteditor/ImageSelectionClass.java
+++ b/src/main/java/scripteditor/ImageSelectionClass.java
@@ -37,7 +37,7 @@
public class ImageSelectionClass extends javax.swing.JFrame {
-
+
private String mTaxaLevel; // The Taxonomic Level eg. Family Genus or Species
private String[] mFileNames; // The File names of the images to view
private DataBaseDriver db;
@@ -50,8 +50,8 @@ public class ImageSelectionClass extends javax.swing.JFrame {
private ArrayList myArray = new ArrayList();
private boolean SSave = false;
//private boolean useSize = false;
-
-
+
+
/** Creates new form ImageSelectionClass */
public ImageSelectionClass(String taxaLevel, String[] filenames, ActionListener al, JFrame main, int width, int height, int lx, int ly, DataBaseDriver db_driver) {
initComponents();
@@ -59,14 +59,14 @@ public ImageSelectionClass(String taxaLevel, String[] filenames, ActionListener
//GraphicsDevice gd = this.getGraphicsConfiguration().getDevice();
//this.setSize(new Dimension(gd.getDisplayMode().getWidth(), gd.getDisplayMode().getHeight()));
//this.setLocationRelativeTo(null);
-
+
//if(height == -1){
this.setExtendedState(MAXIMIZED_BOTH);
// }
// else{
-
+
// this.setLocation(lx, ly);
- // this.setSize(width, height);
+ // this.setSize(width, height);
// this.setExtendedState(NORMAL);
// }
@@ -89,10 +89,10 @@ public ImageSelectionClass(String taxaLevel, String[] filenames, ActionListener
// Add Action Listner here to Image Viewer
this.setVisible(true);
-
-
+
+
}
-
+
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
@@ -362,16 +362,16 @@ private void jButton5MouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:e
// This will set images according to the user defined settings!
if (db.DataBaseExists() == false) {
- JOptionPane.showMessageDialog(this, "The database file " + Configuration.DataBaseName() + " cannot be found!");
+ Utilities.MessageDialog(this, "The database file " + Configuration.DataBaseName() + " cannot be found!");
return;
}
String[] tempArray = new String[myArray.size()];
- for(int i = 0; i < myArray.size(); i++){
+ for(int i = 0; i < myArray.size(); i++){
tempArray[i] = myArray.get(i).toString();
}
mFileNames = tempArray;
-
-
+
+
ImageCountClass myQtys = new ImageCountClass(mFileNames, mTaxaLevel, db);
myQtys.setLocationRelativeTo(this);
myQtys.setModal(true);
@@ -385,13 +385,13 @@ private void jButton5MouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:e
}
}
jList1.setListData(myArray.toArray());
-
+
// TODO add your handling code here:
}//GEN-LAST:event_jButton5MouseReleased
private void formWindowClosing(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowClosing
mMain.setVisible(true);
-
+
/* if(this.getExtendedState() == super.MAXIMIZED_BOTH){
mMain.imageselectionHeight = -1;
mMain.imageselectionWidth = -1;
@@ -404,7 +404,7 @@ private void formWindowClosing(java.awt.event.WindowEvent evt) {//GEN-FIRST:even
mMain.imageselectionXlocation = this.getLocation().x;
mMain.imageselectionYlocation = this.getLocation().y;
}*/
- mAL.actionPerformed(new ActionEvent(this, 1, "ImageSelectionClass"));
+ mAL.actionPerformed(new ActionEvent(this, 1, "ImageSelectionClass"));
this.dispose();
}//GEN-LAST:event_formWindowClosing
@@ -421,7 +421,7 @@ private void listFamilyKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:even
}//GEN-LAST:event_listFamilyKeyPressed
private void listFamilyPropertyChange(java.beans.PropertyChangeEvent evt) {//GEN-FIRST:event_listFamilyPropertyChange
-
+
}//GEN-LAST:event_listFamilyPropertyChange
private void listSpeciesMouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_listSpeciesMouseReleased
@@ -452,9 +452,9 @@ private void thumbnailViewerMouseReleased(java.awt.event.MouseEvent evt) {//GEN-
}//GEN-LAST:event_thumbnailViewerMouseReleased
private void jButton7MouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jButton7MouseReleased
-
+
// Build Header!!
-
+
String header = listFamily.getSelectedItem();
if(listGenus.getSelectedItem() != null && mTaxaLevel.compareTo("Common Name") != 0 ){
header = header + " | " + listGenus.getSelectedItem();
@@ -462,20 +462,20 @@ private void jButton7MouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:e
if(listSpecies.getSelectedItem() != null){
header = header + " | " + listSpecies.getSelectedItem();
}
-
+
//int[] indexes = thumbnailViewer.getSelectedIndices();
-
-
- mapFilenames();
+
+
+ mapFilenames();
for(int i = 0; i < mMappedFileNames.length; i++){
if(!ImageExistInList(header + " | " + mMappedFileNames[i])){
- myArray.add(header + " | " + mMappedFileNames[i]);
+ myArray.add(header + " | " + mMappedFileNames[i]);
}
}
jList1.setListData(myArray.toArray());
thumbnailViewer.clearSelection();
-
-
+
+
}//GEN-LAST:event_jButton7MouseReleased
private void thumbnailViewerMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_thumbnailViewerMouseClicked
@@ -494,7 +494,7 @@ private void jButton6MouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:e
private void jButton4MouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jButton4MouseReleased
Object[] indexes = jList1.getSelectedValues();//listFileNames.getSelectedIndexes();
-
+
for(int i=0; i < indexes.length; i++){
myArray.remove(indexes[i]);
}
@@ -515,30 +515,30 @@ private void AddSelected(){
if(listSpecies.getSelectedItem() != null){
header = header + " | " + listSpecies.getSelectedItem();
}
-
+
int index = thumbnailViewer.getSelectedIndex();
//for(int i = 0; i < indexes.length; i++){
- if(!ImageExistInList(header + " | " + mMappedFileNames[index])){
- myArray.add(header + " | " + mMappedFileNames[index]);
+ if(!ImageExistInList(header + " | " + mMappedFileNames[index])){
+ myArray.add(header + " | " + mMappedFileNames[index]);
}
-
+
jList1.setListData(myArray.toArray());
- thumbnailViewer.clearSelection();
+ thumbnailViewer.clearSelection();
}
-
-
+
+
private boolean ImageExistInList(String img){
for(int i = 0; i < myArray.size(); i++){
if(img.compareTo(myArray.get(i)) == 0){
return true;
- }
- }
+ }
+ }
return false;
}
-
+
private void listGenusMouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_listGenusMouseReleased
if (db.DataBaseExists() == false) {
- JOptionPane.showMessageDialog(this, "The database file " + Configuration.DataBaseName() + " cannot be found!");
+ Utilities.MessageDialog(this, "The database file " + Configuration.DataBaseName() + " cannot be found!");
return;
}
thumbnailViewer.setListData(new ImageIcon[0]);
@@ -546,25 +546,25 @@ private void listGenusMouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:
return;
else if(mTaxaLevel.compareTo("Genus") == 0)
return;
-
+
String[] s;
if(mTaxaLevel.compareTo("Common Name")==0){
//Load species
s = db.getCommonName(this.listGenus.getSelectedItem());
} else{
- s = db.getSpecies(this.listGenus.getSelectedItem());
+ s = db.getSpecies(this.listGenus.getSelectedItem());
}
listSpecies.removeAll();
// if(this.list4.isEnabled())
// list4.removeAll();
for(int i = 0; i < s.length; i++)
this.listSpecies.add(s[i]);
-
+
}//GEN-LAST:event_listGenusMouseReleased
private void listFamilyMouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_listFamilyMouseReleased
-
-
+
+
thumbnailViewer.setListData(new ImageIcon[0]);
if(mTaxaLevel.compareTo("Family") != 0)
{
@@ -578,11 +578,11 @@ private void listFamilyMouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST
}//GEN-LAST:event_listFamilyMouseReleased
private void listFamilyActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_listFamilyActionPerformed
-
+
}//GEN-LAST:event_listFamilyActionPerformed
private void jButton2MouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jButton2MouseReleased
- mAL.actionPerformed(new ActionEvent(this, 1, "ImageSelectionClass"));
+ mAL.actionPerformed(new ActionEvent(this, 1, "ImageSelectionClass"));
mMain.setVisible(true);
this.dispose();
}//GEN-LAST:event_jButton2MouseReleased
@@ -590,25 +590,25 @@ private void jButton2MouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:e
public String[] getFileNames(){
return mFileNames;
}
-
-
+
+
private void jButton1MouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jButton1MouseReleased
SSave = true;
- // Save File Names Selected
+ // Save File Names Selected
String[] tempArray = new String[myArray.size()];
- for(int i = 0; i < myArray.size(); i++){
+ for(int i = 0; i < myArray.size(); i++){
tempArray[i] = myArray.get(i).toString();
}
mFileNames = tempArray;
- mAL.actionPerformed(new ActionEvent(this, 1, "ImageSelectionClass"));
+ mAL.actionPerformed(new ActionEvent(this, 1, "ImageSelectionClass"));
this.setVisible(false);
mMain.setVisible(true);
}//GEN-LAST:event_jButton1MouseReleased
-
+
private void mapFilenames(){
if (db.DataBaseExists() == false) {
- JOptionPane.showMessageDialog(this, "The database file " + Configuration.DataBaseName() + " cannot be found!");
+ Utilities.MessageDialog(this, "The database file " + Configuration.DataBaseName() + " cannot be found!");
return;
}
String[] temp = new String[1];
@@ -620,21 +620,21 @@ private void mapFilenames(){
temp[0] = listFamily.getSelectedItem() + " " +listGenus.getSelectedItem() + " " + listSpecies.getSelectedItem();
else
temp[0] = listFamily.getSelectedItem() + " " + listSpecies.getSelectedItem();
-
+
String[][] files = db.getFileNames(mTaxaLevel, temp, false, 0);
-
+
String[] mappedFileNames = new String[files.length];
-
+
for(int i = 0; i < files.length; i++){
- mappedFileNames[i] = files[i][0];
+ mappedFileNames[i] = files[i][0];
}
- mMappedFileNames = mappedFileNames;
+ mMappedFileNames = mappedFileNames;
}
-
-
+
+
private void populateViewer(){
if (db.DataBaseExists() == false) {
- JOptionPane.showMessageDialog(this, "The database file " + Configuration.DataBaseName() + " cannot be found!");
+ Utilities.MessageDialog(this, "The database file " + Configuration.DataBaseName() + " cannot be found!");
return;
}
double rows;
@@ -651,10 +651,10 @@ private void populateViewer(){
temp[0] = listFamily.getSelectedItem() + " " +listGenus.getSelectedItem() + " " + listSpecies.getSelectedItem();
else
temp[0] = listFamily.getSelectedItem() + " " + listSpecies.getSelectedItem();
-
+
String[][] files = db.getFileNames(mTaxaLevel, temp, false, 0);
String st;
-
+
mm = new ImageIcon[files.length];
String[] mappedFileNames = new String[files.length];
jProgressBar1.setMaximum(files.length);
@@ -671,19 +671,19 @@ private void populateViewer(){
rows = thumbnailViewer.getHeight() / 100;
thumbnailViewer.setVisibleRowCount((int)rows);
thumbnailViewer.setListData(mm);
-
+
}
-
+
public boolean ShouldSave(){
return SSave;
}
-
-
-
+
+
+
private void LoadGenus(String family)
- {
+ {
if (db.DataBaseExists() == false) {
- JOptionPane.showMessageDialog(this, "The database file " + Configuration.DataBaseName() + " cannot be found!");
+ Utilities.MessageDialog(this, "The database file " + Configuration.DataBaseName() + " cannot be found!");
return;
}
String[] genus = db.getGenus(family);
@@ -693,8 +693,8 @@ private void LoadGenus(String family)
/**
* @param args the command line arguments
*/
-
-
+
+
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton jButton1;
private javax.swing.JButton jButton2;
@@ -718,9 +718,9 @@ private void LoadGenus(String family)
private javax.swing.ButtonGroup taxaLevelGroup;
private javax.swing.JList thumbnailViewer;
// End of variables declaration//GEN-END:variables
-
+
// addListSelectionListener
-//
+//
// public void valueChanged(ListSelectionEvent e) {
// if (e.getValueIsAdjusting() == false) {
//
@@ -736,18 +736,18 @@ private void LoadGenus(String family)
//}
//
-
-
-
+
+
+
}
/*class ComboBoxRenderer extends JLabel implements ListCellRenderer {
-
+
private ThumbNailClass thumbnail = new ThumbNailClass();
-
+
public ComboBoxRenderer() {
setOpaque(true);
setHorizontalAlignment(CENTER);
@@ -786,11 +786,9 @@ public Component getListCellRendererComponent(
setText(pet);
setFont(list.getFont());
} else {
-
+
}
return this;
}
}*/
-
-
diff --git a/src/main/java/scripteditor/LoginDialog.java b/src/main/java/scripteditor/LoginDialog.java
index 052c343..5103ca8 100755
--- a/src/main/java/scripteditor/LoginDialog.java
+++ b/src/main/java/scripteditor/LoginDialog.java
@@ -45,38 +45,38 @@ public class LoginDialog extends javax.swing.JDialog {
public String mUserName;
public boolean closeMain = true;
UserClass user;
- String savedTaxaSetsPath = null;//added by anurag
- PropertyFileReader propertyFileReader = null;
+ String savedTaxaSetsPath = null;//added by anurag
+ //PropertyFileReader propertyFileReader = null;
/** Creates new form LoginDialog */
public LoginDialog(Component form, UserClass Uzer) {
mForm = form;
user = Uzer;
initComponents();
-
- try {
- propertyFileReader = new PropertyFileReader();
- this.savedTaxaSetsPath = propertyFileReader.getPropertyValue("savedTaxaSetsFolderName");
+
+ /*try {
+ //propertyFileReader = new PropertyFileReader();
+ //this.savedTaxaSetsPath = propertyFileReader.getPropertyValue("savedTaxaSetsFolderName");
} catch (FileNotFoundException ex) {
Logger.getLogger(MainForm.class.getName()).log(Level.SEVERE, null, ex);
} catch (IOException ex) {
Logger.getLogger(MainForm.class.getName()).log(Level.SEVERE, null, ex);
- }
-
+ }*/
+
//The following code was originally set from MainForm
this.setModal(true);
this.setLocationRelativeTo(this);
this.setVisible(true);
this.requestFocus();
-
+
//Original Code.
//In MainForm
// dlgLogin.setModal(true);
// dlgLogin.setLocationRelativeTo(this);
// dlgLogin.setVisible(true);
// dlgLogin.requestFocus();
-
+
}
-
+
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
@@ -267,7 +267,7 @@ public void mouseReleased(java.awt.event.MouseEvent evt) {
private void tfCreateUserKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_tfCreateUserKeyPressed
int keyCode = evt.getKeyCode();
// Login user if Enter is pressed!!
- if( keyCode == KeyEvent.VK_ENTER) {
+ if( keyCode == KeyEvent.VK_ENTER) {
createUser();
}
}//GEN-LAST:event_tfCreateUserKeyPressed
@@ -275,7 +275,7 @@ private void tfCreateUserKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:ev
private void btCreateUserKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_btCreateUserKeyPressed
int keyCode = evt.getKeyCode();
// Login user if Enter is pressed!!
- if( keyCode == KeyEvent.VK_ENTER) {
+ if( keyCode == KeyEvent.VK_ENTER) {
createUser();
}
}//GEN-LAST:event_btCreateUserKeyPressed
@@ -283,7 +283,7 @@ private void btCreateUserKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:ev
private void jButton1KeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jButton1KeyPressed
int keyCode = evt.getKeyCode();
// Login user if Enter is pressed!!
- if( keyCode == KeyEvent.VK_ENTER) {
+ if( keyCode == KeyEvent.VK_ENTER) {
loginUser();
}
}//GEN-LAST:event_jButton1KeyPressed
@@ -291,13 +291,13 @@ private void jButton1KeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_
private void tfUserKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_tfUserKeyPressed
int keyCode = evt.getKeyCode();
// Login user if Enter is pressed!!
- if( keyCode == KeyEvent.VK_ENTER) {
+ if( keyCode == KeyEvent.VK_ENTER) {
loginUser();
}
}//GEN-LAST:event_tfUserKeyPressed
private void formKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_formKeyPressed
-
+
}//GEN-LAST:event_formKeyPressed
private void btCreateUserMouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btCreateUserMouseReleased
@@ -308,20 +308,19 @@ private void jButton1MouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:e
loginUser();
}//GEN-LAST:event_jButton1MouseReleased
-
-
-
+
+
+
private void loginUser(){
String response;
response = user.login(tfUser.getText(), "NotRequired");//tfPassword.getPassword());
if(response == "AccessGranted"){
- //JOptionPane.showMessageDialog(mForm, "Login Successful! \n\r Welcome to Image Quiz " + tfUser.getText() + ".");
mUserName = tfUser.getText();
closeMain = false;
this.hide();
}
else if(response == "FileNotFound"){
- JOptionPane.showMessageDialog(mForm, "Your file was not found. If you do not have a file please create one \n\rby using the create new user box on the right.");
+ Utilities.MessageDialog(mForm, "Your file was not found. If you do not have a file please create one \n\rby using the create new user box on the right.");
//tfPassword.setText("");
}
else if(response == "CantReadLine"){
@@ -329,55 +328,54 @@ else if(response == "CantReadLine"){
//File is corrupt!
}
else{
- JOptionPane.showMessageDialog(mForm, "AccessDenied.");
- //JOptionPane.showMessageDialog(mForm, "The password did not match the username! Please try the password again.");
+ Utilities.MessageDialog(mForm, "Access Denied.");
//tfPassword.setText("");
//AccessDenied. Invalid Password
}
-
-
+
+
}
-
+
private void createUser(){
String response;
if(tfCreateUser.getText().length() < 4){
- JOptionPane.showMessageDialog(mForm, "Username must have a least four characters!");
+ Utilities.MessageDialog(mForm, "Username must have a least four characters!");
tfCreateUser.setText("");
//tfCreatePassword.setText("");
} //else if(tfCreatePassword.getPassword().length < 4) {
- // JOptionPane.showMessageDialog(mForm, "Password must have a least four characters!");
// tfCreatePassword.setText("");
- // }
+ // }
else{
response = user.createNewUser(tfCreateUser.getText(), "Not Required");//tfCreatePassword.getPassword());
if(response == "UserAlreadyExists"){
- JOptionPane.showMessageDialog(mForm, "The username already exists. Please use another username.");
+ Utilities.MessageDialog(mForm, "The username already exists. Please use another username.");
tfCreateUser.setText("");
//tfCreatePassword.setText("");
} else if(response == "CanNotCreateUser"){
- JOptionPane.showMessageDialog(mForm, "Can not create a new user! Please make sure you have \n\rwrite permissions on the current drive.");
+ Utilities.MessageDialog(mForm, "Can not create a new user! Please make sure you have \n\rwrite permissions on the current drive.");
//tfCreatePassword.setText("");
} else{
MYFolderCheck();
- JOptionPane.showMessageDialog(mForm, "Username (" + tfCreateUser.getText() + ") has been created. Please remember your \n\rnew Username.");// and Password.");
+ Utilities.MessageDialog(mForm, "Username (" + tfCreateUser.getText() + ") has been created. Please remember your \n\rnew Username.");
mUserName = tfCreateUser.getText();
closeMain = false;
this.hide();
}
}
-
+
}
-
+
private void MYFolderCheck() {
- File toWork = new File(Configuration.ApplicationPath() + "/" + savedTaxaSetsPath);
+ File toWork = new File(Configuration.ApplicationPath() + "/Saved Taxa Sets");
+ //File toWork = new File(Configuration.ApplicationPath() + "/" + savedTaxaSetsPath);
if (toWork.exists() == false) {
toWork.mkdir();
}
}
-
+
private void formMouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_formMouseReleased
-
+
// TODO add your handling code here:
}//GEN-LAST:event_formMouseReleased
@@ -385,9 +383,9 @@ private void formWindowOpened(java.awt.event.WindowEvent evt) {//GEN-FIRST:event
MYFolderCheck();
this.setTitle(ConfigFileReader.getProjectName());
}//GEN-LAST:event_formWindowOpened
-
-
-
+
+
+
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton btCreateUser;
private javax.swing.JButton jButton1;
@@ -401,5 +399,5 @@ private void formWindowOpened(java.awt.event.WindowEvent evt) {//GEN-FIRST:event
private javax.swing.JTextField tfCreateUser;
private javax.swing.JTextField tfUser;
// End of variables declaration//GEN-END:variables
-
+
}
diff --git a/src/main/java/scripteditor/MainForm.java b/src/main/java/scripteditor/MainForm.java
index 2f60b80..7d10379 100755
--- a/src/main/java/scripteditor/MainForm.java
+++ b/src/main/java/scripteditor/MainForm.java
@@ -40,7 +40,7 @@
public class MainForm extends javax.swing.JFrame {
-
+
//String userPath = System.getenv("USERPROFILE");
int sqORt; // Identifies to the program if Study Quiz or Test has been selected. 1 = Study 2 = Quiz 3 = Test
boolean showProgressQuiz = false; // shows progress to user after a quiz has finished
@@ -89,7 +89,7 @@ public class MainForm extends javax.swing.JFrame {
boolean selScientificName = false;
boolean btnOkClicked = false;
public boolean isFromTexaSelect=false;
-
+
/***/
//////////////////////////////////////////////////////////////////
/// SCRIPT DATA MEMBERS !!!
@@ -100,54 +100,55 @@ public class MainForm extends javax.swing.JFrame {
int mGlobalSessionIndex = 0; // Index for which session from script mode to run..
File ScriptDirectory = null;
public boolean inSession = true; // Tells the Script results writer if it needs to create a new file or add to the existion one.
-
- String savedTaxaSetsPath = null;//added by anurag
+
+ //String savedTaxaSetsPath = null;//"Saved Taxa Sets";//added by anurag
//private Image image;
/**
* Creates new form MainForm
*/
- PropertyFileReader propertyFileReader = null;
- //private Image image;
-
+ //PropertyFileReader propertyFileReader = null;
+
+ //class variables
+ private String appDisplayName;
+ private ImageIcon dialogIcon = null;
+
/** Creates new form MainForm */
-
+
public MainForm() {
-
-
+
+
initComponents();
-
-
- try {
- propertyFileReader = new PropertyFileReader();
- this.savedTaxaSetsPath = propertyFileReader.getPropertyValue("savedTaxaSetsFolderName");
+
+ /*try {
+ //propertyFileReader = new PropertyFileReader();
+ //this.savedTaxaSetsPath = propertyFileReader.getPropertyValue("savedTaxaSetsFolderName");
} catch (FileNotFoundException ex) {
Logger.getLogger(MainForm.class.getName()).log(Level.SEVERE, null, ex);
} catch (IOException ex) {
Logger.getLogger(MainForm.class.getName()).log(Level.SEVERE, null, ex);
- }
+ }*/
+
-
UIManager.put("Button.defaultButtonFollowsFocus", Boolean.TRUE);
Image image=null;
try {
- // image=new ImageIcon(Configuration.ApplicationPath() + "/Graphics/icon.jpg");
- //image=ImageIO.read(new File(Configuration.ApplicationPath() + "/Graphics/icon.icon"));
- image=ImageIO.read(new File(Configuration.ApplicationPath() + "/Graphics/icon.png"));
- //image=ImageIO.read(new File(Configuration.UserPath() + "/Graphics/icon.jpg"));
+ image = ImageIO.read(new File(Configuration.ApplicationPath() + "/Graphics/icon.png"));
+ dialogIcon = new ImageIcon(Configuration.ApplicationPath() + "/Graphics/icon.png");
+ appDisplayName = ConfigFileReader.getProjectName();
} catch (Exception ex) {
Logger.getLogger(MainForm.class.getName()).log(Level.SEVERE, null, ex);
Image icon = new BufferedImage(1, 1, BufferedImage.TYPE_INT_ARGB_PRE);
setIconImage(icon);
}
setIconImage(image);
-
+
// Image icon = new BufferedImage(1, 1, BufferedImage.TYPE_INT_ARGB_PRE);
// setIconImage(icon);
-
+
// setExtendedState(MAXIMIZED_BOTH);
GraphicsDevice gd = this.getGraphicsConfiguration().getDevice();
this.setSize(new Dimension(gd.getDisplayMode().getWidth(), gd.getDisplayMode().getHeight()));
-
+
mnuFile.setMnemonic(java.awt.event.KeyEvent.VK_F);
mnuLoadScript.setMnemonic(java.awt.event.KeyEvent.VK_L);
//mnuLoadScript.setAccelerator();
@@ -163,13 +164,13 @@ public MainForm() {
mnuHelp.setMnemonic(java.awt.event.KeyEvent.VK_H);
//mnuHelpTopics.setMnemonic(java.awt.event.KeyEvent.VK_H);
//mnuAbout.setMnemonic(java.awt.event.KeyEvent.VK_A);
-
-
+
+
showSplashScreen();
JCDelay(3); // Delay time for the splash screen to be shown!!
EventQueue.invokeLater( new SplashScreenCloser() );
-
-
+
+
this.showLoginScreen();
// // Test validation of database
// if (DataBaseCheckEnabled) {
@@ -181,17 +182,17 @@ public MainForm() {
// }
// objVerifyDB = null;
// }
-
+
if(closeMainF){
System.exit(0);
}
-
+
// FolderCheck();//Commented by preethy on 16-05-2012
-
+
/// Set the main help Popup from user file if needing to display
FileReader myReader;
// String path = Configuration.UserPath();//getApplicationPath(false);
- String path = Configuration.ApplicationPath();//getApplicationPath(false);
+ String path = Configuration.ApplicationPath();
try{
myReader = new FileReader(path + "/UserFiles/" + mUserName + ".csv");
BufferedReader inputfile = new BufferedReader(myReader);
@@ -200,44 +201,44 @@ public MainForm() {
firstLine = inputfile.readLine();
userFirstLine = firstLine;
firstLine = firstLine.substring(firstLine.length()-1);
- int flag;
+ int flag;
flag = Integer.parseInt(firstLine);
if(flag == 0){
showHelp = false;
}
} catch(IOException ioe){
-
+
}
-
- } catch(FileNotFoundException fnf){ }
-
-
+
+ } catch(FileNotFoundException fnf){ }
+
+
setButtonIcons(); // set the menu buttons for main screen
setProgress(); // reads from user file and sets View Progress!!
-
+
// Call a paint method here!!
this.getContentPane().update(this.getGraphics());
-
+
}
-
+
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
//
-
-
+
+
//Splash Screen Code
private static SplashScreen fSplashScreen;
-
+
private static void showSplashScreen(){
fSplashScreen = new SplashScreen();
fSplashScreen.splash();
-
-
+
+
}
-
+
private static final class SplashScreenCloser implements Runnable {
@Override
public void run(){
@@ -245,7 +246,7 @@ public void run(){
}
}
private void setButtonIcons(){
-
+
File dir = new File(".");
Image tempIcon = null;
try {
@@ -272,28 +273,28 @@ private void setButtonIcons(){
ex.printStackTrace();
}
this.btTest.setRolloverIcon(new ImageIcon(tempIcon));
-
+
try {
tempIcon = ImageIO.read(new File(Configuration.ApplicationPath() + "/Graphics/myButton2.jpg"));
} catch (IOException ex) {
ex.printStackTrace();
}
this.btStudy.setIcon(new ImageIcon(tempIcon));
-
+
try {
tempIcon = ImageIO.read(new File(Configuration.ApplicationPath() + "/Graphics/myButton2Roll.jpg"));
} catch (IOException ex) {
ex.printStackTrace();
}
this.btStudy.setRolloverIcon(new ImageIcon(tempIcon));
-
+
try {
tempIcon = ImageIO.read(new File(Configuration.ApplicationPath() + "/Graphics/myButton1.jpg"));
} catch (IOException ex) {
ex.printStackTrace();
}
this.btTaxaSelect.setIcon(new ImageIcon(tempIcon));
-
+
try {
tempIcon = ImageIO.read(new File(Configuration.ApplicationPath() + "/Graphics/button1RollOver.jpg"));
} catch (IOException ex) {
@@ -307,7 +308,7 @@ private void setButtonIcons(){
ex.printStackTrace();
}
this.btScript.setIcon(new ImageIcon(tempIcon));
-
+
try {
tempIcon = ImageIO.read(new File(Configuration.ApplicationPath() + "/Graphics/r1RollOver.jpg"));
} catch (IOException ex) {
@@ -320,7 +321,7 @@ private void setButtonIcons(){
ex.printStackTrace();
}
this.btSpecies.setIcon(new ImageIcon(tempIcon));
-
+
try {
tempIcon = ImageIO.read(new File(Configuration.ApplicationPath() + "/Graphics/sp1RollOver.jpg"));
} catch (IOException ex) {
@@ -333,7 +334,7 @@ private void setButtonIcons(){
ex.printStackTrace();
}
this.btSearch.setIcon(new ImageIcon(tempIcon));
-
+
try {
tempIcon = ImageIO.read(new File(Configuration.ApplicationPath() + "/Graphics/sr1RollOver.jpg"));
} catch (IOException ex) {
@@ -346,7 +347,7 @@ private void setButtonIcons(){
ex.printStackTrace();
}
this.btSelectByGroup.setIcon(new ImageIcon(tempIcon));
-
+
try {
tempIcon = ImageIO.read(new File(Configuration.ApplicationPath() + "/Graphics/GpselRollOver.jpg"));
} catch (IOException ex) {
@@ -355,7 +356,7 @@ private void setButtonIcons(){
this.btSelectByGroup.setRolloverIcon(new ImageIcon(tempIcon));
//***//
}
-
+
// private void showMenuButtons(){//commented by preethy
public void showMenuButtons(){
this.remove(jPanel1);
@@ -373,8 +374,8 @@ public void showMenuButtons(){
btSearch.repaint();
btSelectByGroup.repaint();
/****/
- }
-
+ }
+
private void setWorkingState(){
jMenuBar1.setVisible(false);
this.validate();
@@ -386,81 +387,81 @@ private void setWorkingState(){
lbPictureBox.setLocation(0,0);
lbPictureBox.setSize(jPanel1.getWidth(), jPanel1.getHeight());
jPanel1.setVisible(true);
-
-
-
+
+
+
}
-
+
private void mnuQuizActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
takeQuiz();
}
-
+
private void mnuStudyActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
studyImages();
}
-
+
private void mnuAboutMouseReleased(java.awt.event.MouseEvent evt) {
// TODO add your handling code here:
getAbout();
}
-
+
private void mnuHelpTopicsMouseReleased(java.awt.event.MouseEvent evt) {
-// TODO add your handling code here:
-
+// TODO add your handling code here:
+
}
-
+
private void mnuOptionTaxaSelectionMouseReleased(java.awt.event.MouseEvent evt) {
- /*
+ /*
DataBaseDriver db = new DataBaseDriver(Configuration.DataBaseName());
*/
/* if (db.DataBaseExists() == false) {
JOptionPane.showMessageDialog(this, "You must select an image package to continue the program.");
return;
}*/
-
+
/* panelMenuButtons.setVisible(false);
selectTaxa(db);
panelMenuButtons.setVisible(true);
db = null;*/
}
-
+
private void mnuOptionStudyMouseReleased(java.awt.event.MouseEvent evt) {
// TODO add your handling code here:
showStudyOptions();
//setStudy();
}
-
+
private void mnuTestMouseReleased(java.awt.event.MouseEvent evt) {
// TODO add your handling code here:
//takeTest();
}
-
+
private void mnuQuizMouseReleased(java.awt.event.MouseEvent evt) {
// TODO add your handling code here:
//takeQuiz();
}
-
+
private void mnuStudyMouseReleased(java.awt.event.MouseEvent evt) {
// TODO add your handling code here:
//studyImages();
}
-
+
private void mnuViewProgressMouseReleased(java.awt.event.MouseEvent evt) {
-
+
// TODO add your handling code here:
/* progress.setModal(true);
progress.setLocationRelativeTo(this);
progress.ShowResults();
progress.setVisible(true);*/
-
+
}
-
+
private void mnuResetActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
-
+
private void mnuOpenActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
@@ -468,15 +469,15 @@ private void mnuOpenActionPerformed(java.awt.event.ActionEvent evt) {
private void mnuResetMouseReleased(java.awt.event.MouseEvent evt) {
// clearScriptFile();
}
-
+
private void mnuResetMouseClicked(java.awt.event.MouseEvent evt) {
// TODO add your handling code here:
}
-
+
private void mnuResetKeyReleased(java.awt.event.KeyEvent evt) {
// TODO add your handling code here:
}
-
+
private void formKeyPressed(java.awt.event.KeyEvent evt) {
//System.out.println("key presses......."+evt.getKeyCode()+": "+programState);
if (mKeyBusy == true) {
@@ -484,7 +485,7 @@ private void formKeyPressed(java.awt.event.KeyEvent evt) {
}
mKeyBusy = true;
int keyCode = evt.getKeyCode();
-
+
if (programState == 0) {
if (keyCode == KeyEvent.VK_O && evt.isControlDown()) {
//openScriptFile();
@@ -522,7 +523,7 @@ private void formKeyPressed(java.awt.event.KeyEvent evt) {
} else if (keyCode == KeyEvent.VK_F1) {
getMainHelp();
}
- //Added by Preethy on 19-01-2012
+ //Added by Preethy on 19-01-2012
else if (keyCode == KeyEvent.VK_B && evt.isControlDown()) {
selectSpecies();
} else if (keyCode == KeyEvent.VK_F && evt.isControlDown()) {
@@ -536,39 +537,38 @@ else if (keyCode == KeyEvent.VK_S && evt.isAltDown()) {
else if (keyCode == KeyEvent.VK_L && evt.isAltDown()) {
jMenuItem7ActionPerformed(null);
}
-
+
/*****/
} else if (programState == 1) { // WHEN IN STUDY MODE
-
- if ((keyCode == KeyEvent.VK_DOWN || keyCode == KeyEvent.VK_RIGHT) && !mAutoImageDisplay)
+
+ if ((keyCode == KeyEvent.VK_DOWN || keyCode == KeyEvent.VK_RIGHT) && !mAutoImageDisplay)
{
if (!mStudyClass.nextImage()) {
- JOptionPane.showMessageDialog(this, "No more images. \n\r Press CTRL + E or ESCAPE to Exit");
+ Utilities.MessageDialog(this, "No more images. \n\r Press CTRL + E or ESCAPE to Exit");
}
- }
- else if ((keyCode == KeyEvent.VK_UP || keyCode == KeyEvent.VK_LEFT) && !mAutoImageDisplay)
+ }
+ else if ((keyCode == KeyEvent.VK_UP || keyCode == KeyEvent.VK_LEFT) && !mAutoImageDisplay)
{
mStudyClass.prevImage();
- }
- else if ((keyCode == KeyEvent.VK_E && evt.isControlDown()) || keyCode == KeyEvent.VK_ESCAPE)
+ }
+ else if ((keyCode == KeyEvent.VK_E && evt.isControlDown()) || keyCode == KeyEvent.VK_ESCAPE)
{
-
+
mStudyClass.paused(true);
-
- if(JOptionPane.showConfirmDialog(this, "Are you sure you wish to quit this study session?",
- "Exit to Main Menu?", JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {
-
+
+ if(Utilities.ConfirmDialog(this, "Are you sure you wish to quit this study session?", "Exit to Main Menu?") == JOptionPane.YES_OPTION) {
+
mStudyClass.mDisplayLabel.setIcon(null);
mStudyClass.mDisplayLabel.setText("");
mStudyClass.mDisplayLabel.removeAll();
mStudyClass.stopStudying();
} else {
-
-
+
+
mStudyClass.paused(false);
}
-
+
}
if (mKeyToContinue && keyCode != KeyEvent.VK_CONTROL) {
@@ -601,29 +601,29 @@ else if ((keyCode == KeyEvent.VK_E && evt.isControlDown()) || keyCode == KeyEven
// }
mKeyBusy = false;
}
-
+
private void formKeyReleased(java.awt.event.KeyEvent evt){
-
+
}
// This is the Open Menu Item...
private void mnuOpenMouseReleased(java.awt.event.MouseEvent evt) {
// openScriptFile(); For other versions of IQ
-
+
}
// This is the Exit Menu Item ...
private void mnuExitMouseReleased(java.awt.event.MouseEvent evt) {
//exitFunction();
// TODO add your handling code here:
}
-
+
private void studyImages() {
DataBaseDriver db = new DataBaseDriver(Configuration.DataBaseName());
- db.isFromTexaSelect = this.isFromTexaSelect;
+ db.isFromTexaSelect = this.isFromTexaSelect;
/* if (db.DataBaseExists() == false) {
JOptionPane.showMessageDialog(this, "You must select an image package to continue the program.");
return;
}*/
-
+
setWorkingState();
// if(!group){
@@ -635,14 +635,14 @@ private void studyImages() {
} else showMenuButtons();
db = null;
return;*/
- JOptionPane.showMessageDialog(this, "There are no taxa selected.\n\r Press OK to be returned to the Main Screen\n where you can add taxa to the study set.");
+ Utilities.MessageDialog(this, "There are no taxa selected.\n\r Press OK to be returned to the Main Screen\n where you can add taxa to the study set.");
showMenuButtons();
db = null;
return;
- }
-
+ }
+
//}
-
+
if(showStudyOptions() == 1){
programState = 1;
String[][] fileNames;
@@ -655,29 +655,29 @@ private void studyImages() {
if(taxonomicLevel.equals("Family")){
// fileNames = db.getFileNames2(sel, taxonomicLevel, mTaxa, false, 0);
if(group)
- fileNames=db.getGroupFileNames(sel, taxonomicLevel,false, 0);
+ fileNames=db.getGroupFileNames(sel, taxonomicLevel,false, 0);
else
fileNames = db.getFileNames(taxonomicLevel, mTaxa, false, 0);
}
else{
if(!group){
if(taxanull || selctfamilyTaxanull){
-
- fileNames=db.getFileNamesSearch(taxonomicLevel, mTaxa, false, 0);
+
+ fileNames=db.getFileNamesSearch(taxonomicLevel, mTaxa, false, 0);
}else{
-
+
fileNames=db.getFileNamesSearch(taxonomicLevel, mTaxa, false, 0);
//fileNames=db.getFileNames3(sel, taxonomicLevel, mTaxa, false, 0);
}
}else{
-
- fileNames=db.getGroupFileNames(sel, taxonomicLevel,false, 0);
+
+ fileNames=db.getGroupFileNames(sel, taxonomicLevel,false, 0);
}
-
+
}
//Added by preethy on 26-01-2012
if(fileNames.length==0){
- JOptionPane.showMessageDialog(this, "No images selected.");
+ Utilities.MessageDialog(this, "No images selected.");
showMenuButtons();
}
/***/
@@ -696,7 +696,7 @@ private void studyImages() {
//jMenuBar1.setVisible(false);
mStudyClass.start();}
} else{
-
+
showMenuButtons();
}
db = null;
@@ -716,7 +716,7 @@ private int showOptions()// runMode tells if the RUN Menu has been selected
return retVal;
}
private int showStudyOptions() {
-
+
// Show the StudySettingsDialog!!!
int retVal = 0;
StudySettings dlgStudy = new StudySettings(delayQT, scriptMode,taxonomicLevel, mShowFamilyName, mKeyToContinue );
@@ -726,7 +726,7 @@ private int showStudyOptions() {
dlgStudy.setShowImageWithName(mShowImageWithName);
dlgStudy.setLocationRelativeTo(this);
dlgStudy.setVisible(true);
-
+
if(dlgStudy.getContinue()){
retVal = 1;
mAutoImageDisplay = dlgStudy.getAutoImageDisplay();
@@ -735,20 +735,20 @@ private int showStudyOptions() {
mShowFamilyName = dlgStudy.getShowFamilyName();
mKeyToContinue = dlgStudy.getKeyPress();
if(mAutoImageDisplay){
-
+
delayQT = dlgStudy.getDelayTimeStudy();
}
}
-
-
+
+
return retVal;
}
-
+
public void quitStudyImages(ActionEvent avt){
//This function is called by StudyImagesClass, QuizClass and TestClass when they close.
//Whatever needs to happen after those classes can
//happen here.
-
+
if(programState == 2 && showProgressQuiz){
if(!prgres){
progress.setModal(true);
@@ -772,17 +772,17 @@ public void quitStudyImages(ActionEvent avt){
Thread.sleep(50);
} catch (InterruptedException ex) {
ex.printStackTrace();
- }
+ }
if(scriptMode == true){
mGlobalSessionIndex = mGlobalSessionIndex + 1;
if(this.studying == false){
inSession = true;
}
-
+
startScript();
}
}
-
+
private void takeQuiz() {
DataBaseDriver db = new DataBaseDriver(Configuration.DataBaseName());
/* if (db.DataBaseExists() == false) {
@@ -802,7 +802,7 @@ private void takeQuiz() {
}
db = null;
return;*/
- JOptionPane.showMessageDialog(this, "There are no taxa selected.\n\r Press OK to be returned to the Main Screen\n where you can add taxa to the study set.");
+ Utilities.MessageDialog(this, "There are no taxa selected.\n\r Press OK to be returned to the Main Screen\n where you can add taxa to the study set.");
showMenuButtons();
db = null;
return;
@@ -821,35 +821,35 @@ private void takeQuiz() {
//String[][] fileNames = db.getFileNames(taxonomicLevel, mTaxa, true, maxImages);//Commented by preethy on 12-01-2012
if(!group){//if select by group is not selected
if(taxanull || selctfamilyTaxanull){
-
- fileNames = db.getFileNamesSearch(taxonomicLevel, mTaxa, false, maxImages);
+
+ fileNames = db.getFileNamesSearch(taxonomicLevel, mTaxa, false, maxImages);
}else{
-
+
fileNames=db.getFileNamesSearch(taxonomicLevel, mTaxa, false, maxImages);
// fileNames = db.getFileNames(taxonomicLevel, mTaxa, true, maxImages);
-
+
//fileNames = db.getFileNames2(sel, taxonomicLevel, mTaxa, true, maxImages);//Added by preethy on 12-01-2012
}
}else{
-
- fileNames=db.getGroupFileNames(sel, taxonomicLevel,false, maxImages);
+
+ fileNames=db.getGroupFileNames(sel, taxonomicLevel,false, maxImages);
}
-
+
if(mTaxa.length<2){
prgres=true;
}else
prgres=false;
ActionListener al = new ActionListener() {
-
+
public void actionPerformed(ActionEvent evt) {
-
+
quitStudyImages(evt);
}
};
-
+
//Added by preethy on 26-01-2012
if(fileNames.length==0){
- JOptionPane.showMessageDialog(this, "No images selected.");
+ Utilities.MessageDialog(this, "No images selected.");
showMenuButtons();
}
else{
@@ -862,7 +862,7 @@ public void actionPerformed(ActionEvent evt) {
}//Added by preethy
db = null;
}
-
+
private void takeTest() {
DataBaseDriver db = new DataBaseDriver(Configuration.DataBaseName());
@@ -882,7 +882,7 @@ private void takeTest() {
}
db = null;
return;*/
- JOptionPane.showMessageDialog(this, "There are no taxa selected.\n\r Press OK to be returned to the Main Screen\n where you can add taxa to the study set.");
+ Utilities.MessageDialog(this, "There are no taxa selected.\n\r Press OK to be returned to the Main Screen\n where you can add taxa to the study set.");
showMenuButtons();
db = null;
return;
@@ -902,21 +902,21 @@ private void takeTest() {
// String[][] fileNames = db.getFileNames(taxonomicLevel, mTaxa, true, maxImages);//Commented by preethy on 12-01-2012
if(!group){
if(taxanull || selctfamilyTaxanull){ //Added by preethy
-
- fileNames = db.getFileNames(taxonomicLevel, mTaxa, true, maxImages);
+
+ fileNames = db.getFileNames(taxonomicLevel, mTaxa, true, maxImages);
}else{
-
+
fileNames=db.getFileNamesSearch(taxonomicLevel, mTaxa, false, maxImages);
- //fileNames = db.getFileNames(taxonomicLevel, mTaxa, true, maxImages);
+ //fileNames = db.getFileNames(taxonomicLevel, mTaxa, true, maxImages);
//fileNames = db.getFileNames2(sel ,taxonomicLevel, mTaxa, true, maxImages);//Added by preethy on 12-01-2012
}
}else{
-
- fileNames=db.getGroupFileNames(sel, taxonomicLevel,false, maxImages);
+
+ fileNames=db.getGroupFileNames(sel, taxonomicLevel,false, maxImages);
}
//Added by preethy on 26-01-2012
if(fileNames.length==0){
- JOptionPane.showMessageDialog(this, "No images selected.");
+ Utilities.MessageDialog(this, "No images selected.");
showMenuButtons();
}
else{
@@ -931,17 +931,16 @@ private void takeTest() {
}//Added by preethy
db = null;
}
-
+
private void exitFunction() {
- int retVal;
- retVal = JOptionPane.showConfirmDialog(this,"Are you sure you wish to quit?", "Exit?",JOptionPane.YES_NO_OPTION);
+ int retVal = Utilities.ConfirmDialog(this, "Are you sure you wish to quit?", "Exit?");
if(retVal == JOptionPane.YES_OPTION) {
// TODO: need to save progress to user file
WriteProgressString(progress.getProgressArray(), mUserName);
System.exit(0);
}
}
-
+
// private void openScriptFile() {
// JFileChooser myFileBrowser = new JFileChooser();
// myFileBrowser.setFileSelectionMode(JFileChooser.FILES_ONLY);
@@ -957,7 +956,7 @@ private void exitFunction() {
//
// }
// }
-
+
// private void clearScriptFile() {
// int retVal;
// retVal = JOptionPane.showConfirmDialog(this,"Are you sure you wish to unload the script file? \n\r Settings will be set back to default.", "Unload Script File?",JOptionPane.YES_NO_OPTION);
@@ -967,33 +966,33 @@ private void exitFunction() {
// scriptMode = false;
// }// TODO add your handling code here:
// }
-
+
private void getHelp() {
- String path = getApplicationPath(true);
+ String path = Configuration.ApplicationPath();
boolean exists = (new File(path + "/HelpFiles/taxa.pdf")).exists();
-
+
if(!exists){
- JOptionPane.showMessageDialog(this, "The file taxa.pdf could not be found.");
+ Utilities.MessageDialog(this, "The file taxa.pdf could not be found.");
return;
}
-
+
try {
// Runtime.getRuntime().exec("cmd /c start HelpFiles/taxa.pdf");
- Utilities.OpenExternalFile(Configuration.ApplicationPath()+"/HelpFiles/taxa.pdf");
+ Utilities.OpenExternalFile(Configuration.ApplicationPath()+"/HelpFiles/taxa.pdf");
} catch (IOException ex) {
ex.printStackTrace();
}
}
-
+
private void getAbout() {
// This is the about info HERE!!!
about = new AboutClass();
about.setLocationRelativeTo(this);
about.setVisible(true);
-
- }
-
+
+ }
+
private void JCDelay(double de) {
de = de * 1000;
double startTime = System.currentTimeMillis();
@@ -1002,10 +1001,10 @@ private void JCDelay(double de) {
try{
Thread.sleep(20);
} catch(InterruptedException e){}
-
+
}
}
-
+
private void showLoginScreen(){
UserClass user = new UserClass();
LoginDialog dlgLogin = new LoginDialog(this, user);
@@ -1018,9 +1017,9 @@ private void showLoginScreen(){
mFixationTime = user.fixation_time;
maxImages = user.max_images;
}
-
+
}
-
+
private void selectTaxa(DataBaseDriver db){
//If not database path exists, inform user!
@@ -1030,19 +1029,19 @@ private void selectTaxa(DataBaseDriver db){
if(path.compareTo("") == 0)
{
//display error mesage.
- JOptionPane.showMessageDialog(this, "There is no package selected for this session.");
+ Utilities.MessageDialog(this, "There is no package selected for this session.");
return;
}
-
+
if (!VerifyDatabase()){
return;
}
-
+
String taxonomicLevelTemp = taxonomicLevel;
if(taxonomicLevel == null)
taxonomicLevelTemp = "";
//Start selection of taxa to study!!!
-
+
if(scriptMode == false){
//Added by preethy on 6-01-2012
// SelectImage selImage=new SelectImage(db);
@@ -1053,41 +1052,41 @@ private void selectTaxa(DataBaseDriver db){
sel=selImage.db.selectedRow;
if(selImage.esc==true)
{
-
+
sel=new ArrayList();
}*/
-
+
//***//
//
// CHOOSE TAXA LEVEL
//
-
+
// if(selImage.close==false && sel.size()!=0 && selImage.esc==false)
// {
- SelectTaxaLevel select = new SelectTaxaLevel(this, true);
+ SelectTaxaLevel select = new SelectTaxaLevel(this, true);
select.esc = false;
select.setLocationRelativeTo(this);
select.setVisible(true);
select.setModal(true);
-
+
if(select.cancelled || select.esc)
return;
taxonomicLevel = select.getTaxaLevel();
selCname = select.getUseCommonNames();
-
+
//
// CHOOSE TAXA NAMES
//
SelectTaxa dlg;
-
+
if(taxonomicLevel.compareTo("Species") == 0 && select.getUseCommonNames()){
if(taxonomicLevelTemp.compareTo(taxonomicLevel) == 0){
-
+
dlg = new SelectTaxa(taxonomicLevel, true, mTaxa, db,maxImages);
-
+
}
else
-
+
dlg = new SelectTaxa(taxonomicLevel, true, null, db,maxImages);
} else {
if(taxonomicLevelTemp.compareTo(taxonomicLevel) == 0){
@@ -1097,24 +1096,24 @@ private void selectTaxa(DataBaseDriver db){
dlg = new SelectTaxa(taxonomicLevel, false, null, db,maxImages);
}
}
-
+
dlg.setLocationRelativeTo(this);
dlg.setModal(true);
dlg.setVisible(true);
if(dlg.bCancel || dlg.esc){
-
+
mTaxa = null; // These are the taxa that will be studied.
taxonomicLevel = null; // This is the level that will be studied.
} else {
-
- mTaxa = dlg.getItems();
+
+ mTaxa = dlg.getItems();
isFromTexaSelect=true;
}
// }
-
+
}
}
-
+
private void advancedOptions(){
AdvancedOptions dlgStudy = new AdvancedOptions(SessionInfo.SpellingValue, showProgressQuiz, showProgressTest, mFixationTime, maxImages);
dlgStudy.setModal(true);
@@ -1127,11 +1126,11 @@ private void advancedOptions(){
SessionInfo.SpellingValue = dlgStudy.getSpelling();
mFixationTime = dlgStudy.getFixationTime();
maxImages = dlgStudy.getNumberofImages();
-
+
}
-
+
}
-
+
private void selectRandomTaxa(DataBaseDriver db){
RandomSelectDialog randomDlg = new RandomSelectDialog(taxonomicLevel, mCommonNamesRandom, numTaxaRandom);
@@ -1142,7 +1141,7 @@ private void selectRandomTaxa(DataBaseDriver db){
randomDlg.setVisible(false);
if(retVal == 1) {
// Set Random Taxa HERE!!!
-
+
taxonomicLevel = randomDlg.getTaxaLevel();
int modeType = randomDlg.getMode();
numTaxaRandom = randomDlg.getTaxaCount();
@@ -1157,7 +1156,7 @@ private void selectRandomTaxa(DataBaseDriver db){
mTaxa = myRandomTaxa.getTaxa();
wait.setVisible(false);
wait.dispose();
-
+
if(modeType == 1){ // Study
studyImages();
} else if(modeType == 2){
@@ -1167,18 +1166,18 @@ private void selectRandomTaxa(DataBaseDriver db){
} else{
randomDlg.setVisible(false);
}
-
+
} else{
randomDlg.setVisible(false);
}
panelMenuButtons.setVisible(true);
}
-
+
public void setMenuVisible(boolean bool){
// jMenuBar1.setVisible(bool);
}
-
+
private void showHelpPopup(){
HelpPopup help = new HelpPopup(mUserName, userFirstLine, new ActionListener() {
public void actionPerformed(ActionEvent evt) {
@@ -1188,15 +1187,15 @@ public void actionPerformed(ActionEvent evt) {
help.setModal(true);
help.setVisible(true);
helpPop = true;
-
+
}
-
+
private void setMousePointer(ActionEvent avt){
- if(avt.getActionCommand().compareTo("Tutorial") == 0){
+ if(avt.getActionCommand().compareTo("Tutorial") == 0){
LaunchPDF("Tutorial.html");
}
- else if (avt.getActionCommand().compareTo("Intro") == 0){
+ else if (avt.getActionCommand().compareTo("Intro") == 0){
LaunchPDF("Intro.pdf");
}
}
@@ -1210,7 +1209,7 @@ private void setProgress(){
try{
myReader = new FileReader(path + "/UserFiles/" + mUserName + ".csv");
BufferedReader inputfile = new BufferedReader(myReader);
-
+
try{
temp = inputfile.readLine(); // Is user name and pass (Throw away)
String line = "";
@@ -1250,13 +1249,13 @@ private void setProgress(){
} catch(IOException ioe){
}
} catch(FileNotFoundException fnf){
-
+
}
if(myArray.size() > 0){
progress.setResults(myArray);
}
}
-
+
private void WriteProgressString(ArrayList myArray, String id){
//Read the first line from the file and do not change.
// It contains the hash of their user password and what-nots.
@@ -1269,23 +1268,23 @@ private void WriteProgressString(ArrayList myArray, String id){
try{
myReader = new FileReader(path + "/UserFiles/" + id + ".csv");
BufferedReader inputfile = new BufferedReader(myReader);
-
+
try{
firstLine = inputfile.readLine();
inputfile.close();
} catch(IOException ioe){
-
+
}
-
+
} catch(FileNotFoundException fnf){
-
+
}
-
+
FileWriter myFileWriter = null;
try{
myFileWriter = new FileWriter(path + "/UserFiles/" + id + ".csv");
} catch(IOException ioe){
-
+
}
//
//Write out first line and second line-advanced options.
@@ -1299,7 +1298,7 @@ private void WriteProgressString(ArrayList myArray, String id){
advanced_options += Double.toString(mFixationTime) + ";";
advanced_options += Integer.toString(maxImages);
diskfile.println(advanced_options); //Writeout Advanced Options.
-
+
// Write Progress results.
for(int i = 0; i < myArray.size(); i++){
String tempString = myArray.get(i).toString();
@@ -1319,11 +1318,11 @@ public void run() {
}
});
}
-
+
// Variables declaration - do not modify
-
-
+
+
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JMenuItem advancedOptions;
private javax.swing.JButton btQuiz;
@@ -1335,7 +1334,7 @@ public void run() {
private javax.swing.JButton btStudy;
private javax.swing.JButton btTaxaSelect;
private javax.swing.JButton btTest;
- private javax.swing.JMenuItem introMenuItem;
+ //private javax.swing.JMenuItem introMenuItem;
private javax.swing.JDialog jDialog1;
private javax.swing.JLabel jLabel1;
private javax.swing.JMenuBar jMenuBar1;
@@ -1412,7 +1411,7 @@ private void initComponents() {
mnuHelp = new javax.swing.JMenu();
jMenuItem1 = new javax.swing.JMenuItem();
jMenuItem2 = new javax.swing.JMenuItem();
- introMenuItem = new javax.swing.JMenuItem();
+ //introMenuItem = new javax.swing.JMenuItem();
tutorialMenuItem = new javax.swing.JMenuItem();
openingScreen = new javax.swing.JMenuItem();
@@ -1431,7 +1430,7 @@ private void initComponents() {
btScript1.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
- setTitle(ConfigFileReader.getProjectName());
+ setTitle(appDisplayName);
setResizable(false);
addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseReleased(java.awt.event.MouseEvent evt) {
@@ -1697,7 +1696,7 @@ public void vetoableChange(java.beans.PropertyChangeEvent evt)throws java.beans.
mnuFile.add(mnuLoadScript);
mnuFile.add(jSeparator5);
- mnuaddimages.setText("Install New Database and Images");
+ /*mnuaddimages.setText("Install New Database and Images");
mnuaddimages.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseReleased(java.awt.event.MouseEvent evt) {
mnuaddimagesMouseReleased(evt);
@@ -1708,8 +1707,9 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
mnuaddimagesActionPerformed(evt);
}
});
+ mnuaddimages.setEnabled(false);
mnuFile.add(mnuaddimages);
- mnuFile.add(jSeparator6);
+ mnuFile.add(jSeparator6);*/
jMenuItem6.setFont(new java.awt.Font("Microsoft Sans Serif", 0, 12)); // NOI18N
jMenuItem6.setText("Save Taxa Set Alt+S");
@@ -2008,7 +2008,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
});
mnuHelp.add(jMenuItem2);
- introMenuItem.setFont(new java.awt.Font("Microsoft Sans Serif", 0, 12)); // NOI18N
+ /*introMenuItem.setFont(new java.awt.Font("Microsoft Sans Serif", 0, 12)); // NOI18N
introMenuItem.setText("The Image Quiz Family of Programs");
introMenuItem.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseReleased(java.awt.event.MouseEvent evt) {
@@ -2029,7 +2029,7 @@ public void menuKeyReleased(javax.swing.event.MenuKeyEvent evt) {
public void menuKeyTyped(javax.swing.event.MenuKeyEvent evt) {
}
});
- mnuHelp.add(introMenuItem);
+ mnuHelp.add(introMenuItem);*/
tutorialMenuItem.setFont(new java.awt.Font("Microsoft Sans Serif", 0, 12)); // NOI18N
tutorialMenuItem.setText("Tutorial");
@@ -2112,15 +2112,15 @@ private void mnuLoadScriptActionPerformed(java.awt.event.ActionEvent evt) {//GEN
}//GEN-LAST:event_mnuLoadScriptActionPerformed
private void mnuLoadScriptInputMethodTextChanged(java.awt.event.InputMethodEvent evt) {//GEN-FIRST:event_mnuLoadScriptInputMethodTextChanged
-
+
}//GEN-LAST:event_mnuLoadScriptInputMethodTextChanged
private void mnuLoadScriptKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_mnuLoadScriptKeyReleased
-
+
}//GEN-LAST:event_mnuLoadScriptKeyReleased
private void mnuLoadScriptVetoableChange(java.beans.PropertyChangeEvent evt)throws java.beans.PropertyVetoException {//GEN-FIRST:event_mnuLoadScriptVetoableChange
-
+
}//GEN-LAST:event_mnuLoadScriptVetoableChange
private void mnuLoadScriptKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_mnuLoadScriptKeyTyped
@@ -2131,28 +2131,28 @@ private void mnuLoadScriptKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:eve
}//GEN-LAST:event_mnuLoadScriptKeyTyped
private void openingScreenMenuKeyPressed(javax.swing.event.MenuKeyEvent evt) {//GEN-FIRST:event_openingScreenMenuKeyPressed
-
+
// int keyCode = evt.getKeyCode();
// if(keyCode == KeyEvent.VK_ENTER){
- // showHelpPopup();
- // }
-
+ // showHelpPopup();
+ // }
+
}//GEN-LAST:event_openingScreenMenuKeyPressed
private void tutorialMenuItemMenuKeyPressed(javax.swing.event.MenuKeyEvent evt) {//GEN-FIRST:event_tutorialMenuItemMenuKeyPressed
// int keyCode = evt.getKeyCode();
// if(keyCode == KeyEvent.VK_ENTER){
- // showTutorial();
- // }
-
+ // showTutorial();
+ // }
+
}//GEN-LAST:event_tutorialMenuItemMenuKeyPressed
private void introMenuItemMenuKeyPressed(javax.swing.event.MenuKeyEvent evt) {//GEN-FIRST:event_introMenuItemMenuKeyPressed
// int keyCode = evt.getKeyCode();
// if(keyCode == KeyEvent.VK_ENTER){
// showIntro();
- // }
-
+ // }
+
}//GEN-LAST:event_introMenuItemMenuKeyPressed
private void jMenuItem1MenuKeyPressed(javax.swing.event.MenuKeyEvent evt) {//GEN-FIRST:event_jMenuItem1MenuKeyPressed
@@ -2162,7 +2162,7 @@ private void jMenuItem1MenuKeyPressed(javax.swing.event.MenuKeyEvent evt) {//GEN
// setCursor(hourglassCursor);
// getMainHelp();
// }
-
+
}//GEN-LAST:event_jMenuItem1MenuKeyPressed
private void advancedOptionsMenuKeyPressed(javax.swing.event.MenuKeyEvent evt) {//GEN-FIRST:event_advancedOptionsMenuKeyPressed
@@ -2192,7 +2192,7 @@ private void mnuQuizMenuKeyPressed(javax.swing.event.MenuKeyEvent evt) {//GEN-FI
// if(keyCode == KeyEvent.VK_ENTER){
// takeQuiz();
// }
-
+
}//GEN-LAST:event_mnuQuizMenuKeyPressed
private void mnuStudyMenuKeyPressed(javax.swing.event.MenuKeyEvent evt) {//GEN-FIRST:event_mnuStudyMenuKeyPressed
@@ -2200,7 +2200,7 @@ private void mnuStudyMenuKeyPressed(javax.swing.event.MenuKeyEvent evt) {//GEN-F
// if(keyCode == KeyEvent.VK_ENTER){
// studyImages();
// }
-
+
}//GEN-LAST:event_mnuStudyMenuKeyPressed
private void mnuExitMenuKeyPressed(javax.swing.event.MenuKeyEvent evt) {//GEN-FIRST:event_mnuExitMenuKeyPressed
@@ -2208,7 +2208,7 @@ private void mnuExitMenuKeyPressed(javax.swing.event.MenuKeyEvent evt) {//GEN-FI
// if(keyCode == KeyEvent.VK_ENTER){
// exitFunction();
// }
-
+
}//GEN-LAST:event_mnuExitMenuKeyPressed
private void mnuOptionTaxaSelectionMenuKeyPressed(javax.swing.event.MenuKeyEvent evt) {//GEN-FIRST:event_mnuOptionTaxaSelectionMenuKeyPressed
@@ -2218,8 +2218,8 @@ private void mnuOptionTaxaSelectionMenuKeyPressed(javax.swing.event.MenuKeyEvent
// selectTaxa();
// panelMenuButtons.setVisible(true);
// }
-
-
+
+
}//GEN-LAST:event_mnuOptionTaxaSelectionMenuKeyPressed
private void mnuLoadScriptMenuKeyPressed(javax.swing.event.MenuKeyEvent evt) {//GEN-FIRST:event_mnuLoadScriptMenuKeyPressed
@@ -2274,7 +2274,7 @@ private void openScript() {
File tempFile = myFileBrowser.getSelectedFile();
String temp = tempFile.getAbsolutePath();
ScriptDirectory = tempFile;
-
+
// JOptionPane.showMessageDialog(this,temp);
this.loadScriptFile(temp);
// Call The Load Script Function
@@ -2282,16 +2282,16 @@ private void openScript() {
// }
}
-
+
private void mnuLoadScriptMouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_mnuLoadScriptMouseReleased
-
+
//openScript();
-
+
}//GEN-LAST:event_mnuLoadScriptMouseReleased
private void openingScreenMouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_openingScreenMouseReleased
- //showHelpPopup();
+ //showHelpPopup();
}//GEN-LAST:event_openingScreenMouseReleased
private void formWindowGainedFocus(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowGainedFocus
@@ -2309,37 +2309,38 @@ private void introMenuItemMouseReleased(java.awt.event.MouseEvent evt) {//GEN-FI
}//GEN-LAST:event_introMenuItemMouseReleased
private void LaunchPDF(String fileName){
-
- String path = getApplicationPath(true);
+
+ String path = Configuration.ApplicationPath();
boolean exists = (new File(path + "/HelpFiles/" + fileName)).exists();
+
if (!exists) {
- JOptionPane.showMessageDialog(this, "The file " + fileName + " could not be found.");
+ Utilities.MessageDialog(this, "The file " + fileName + " could not be found.");
return;
}
+
try {
- // Probably will not work on a mac
- //Runtime.getRuntime().exec("cmd /c start HelpFiles/" + fileName);
- Utilities.OpenExternalFile(Configuration.ApplicationPath()+"/HelpFiles/"+fileName);
+ //Utilities.OpenExternalFile(Configuration.ApplicationPath()+"/HelpFiles/"+fileName);
+ Utilities.OpenExternalFile(path+"/HelpFiles/"+fileName);
} catch (IOException ex) {
ex.printStackTrace();
- }
+ }
}
-
-
+
+
private void tutorialMenuItemMouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tutorialMenuItemMouseReleased
// TODO add your handling code here:
//LaunchPDF("Tutorial.html");
}//GEN-LAST:event_tutorialMenuItemMouseReleased
-
+
private void formWindowActivated(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowActivated
-
+
this.requestFocus(); // Gives focus to the main windows so shourtcut keys will work..
if(showHelp == true){
showHelp = false;
showHelpPopup();
}
-
+
}//GEN-LAST:event_formWindowActivated
private void formKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_formKeyTyped
@@ -2358,13 +2359,13 @@ private String getApplicationPath(boolean showCursor) {
return "";
}
}
-
+
private void getMainHelp() {
- String path = getApplicationPath(true);
-
+ String path = Configuration.ApplicationPath();
+
boolean exists = (new File(path + "/HelpFiles/HelpFiles.html")).exists();
if (!exists) {
- JOptionPane.showMessageDialog(this, "The file HelpFiles.html could not be found.");
+ Utilities.MessageDialog(this, "The file HelpFiles.html could not be found.");
return;
}
@@ -2377,13 +2378,13 @@ private void getMainHelp() {
}
}
-
+
private void openFiles(String filename){
- String path = getApplicationPath(true);
-
+ String path = Configuration.ApplicationPath();
+
boolean exists = (new File(path + "/HelpFiles/" + filename)).exists();
if (!exists) {
- JOptionPane.showMessageDialog(this, "The file " + filename + " could not be found.");
+ Utilities.MessageDialog(this, "The file " + filename + " could not be found.");
return;
}
try {
@@ -2393,20 +2394,20 @@ private void openFiles(String filename){
} catch (IOException ex) {
ex.printStackTrace();
}
-
+
}
-
+
private void jMenuItem1MouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jMenuItem1MouseReleased
/*Cursor hourglassCursor = new Cursor(Cursor.WAIT_CURSOR);
setCursor(hourglassCursor);
getMainHelp();*/
}//GEN-LAST:event_jMenuItem1MouseReleased
-
+
private void formWindowClosing(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowClosing
//TODO: need to save progress to user file
WriteProgressString(progress.getProgressArray(), mUserName);
}//GEN-LAST:event_formWindowClosing
-
+
private void mnuOptionRandomTaxaMouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_mnuOptionRandomTaxaMouseReleased
/* DataBaseDriver db = new DataBaseDriver(Configuration.DataBaseName());
@@ -2419,24 +2420,24 @@ private void mnuOptionRandomTaxaMouseReleased(java.awt.event.MouseEvent evt) {//
selectRandomTaxa(db);
db = null;*/
}//GEN-LAST:event_mnuOptionRandomTaxaMouseReleased
-
+
private void btTestMouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btTestMouseReleased
-
+
takeTest();// TODO add your handling code here:
}//GEN-LAST:event_btTestMouseReleased
-
+
private void btQuizMouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btQuizMouseReleased
-
+
takeQuiz();// TODO add your handling code here:
}//GEN-LAST:event_btQuizMouseReleased
-
+
private void btStudyMouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btStudyMouseReleased
-
+
studyImages();
}//GEN-LAST:event_btStudyMouseReleased
-
+
private void btTaxaSelectMouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btTaxaSelectMouseReleased
-
+
DataBaseDriver db = new DataBaseDriver(Configuration.DataBaseName());
/* if (db.DataBaseExists() == false) {
JOptionPane.showMessageDialog(this, "You must select an image package to continue the program.");
@@ -2447,46 +2448,46 @@ private void btTaxaSelectMouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIR
db = null;
panelMenuButtons.setVisible(true);
}//GEN-LAST:event_btTaxaSelectMouseReleased
-
+
private void formWindowOpened(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowOpened
- this.setTitle(ConfigFileReader.getProjectName());
+ this.setTitle(appDisplayName);
showMenuButtons(); // Show Menu Buttons on startup!!
-
+
}//GEN-LAST:event_formWindowOpened
-
+
private void formWindowStateChanged(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowStateChanged
-
+
}//GEN-LAST:event_formWindowStateChanged
-
+
private void formMouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_formMouseReleased
-
+
}//GEN-LAST:event_formMouseReleased
-
+
private void advancedOptionsMouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_advancedOptionsMouseReleased
//advancedOptions();// TODO add your handling code here:
}//GEN-LAST:event_advancedOptionsMouseReleased
-
+
private void mnuOptionTaxaSelectionMenuKeyReleased(javax.swing.event.MenuKeyEvent evt) {//GEN-FIRST:event_mnuOptionTaxaSelectionMenuKeyReleased
-
+
}//GEN-LAST:event_mnuOptionTaxaSelectionMenuKeyReleased
-
+
private void mnuOptionTaxaSelectionKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_mnuOptionTaxaSelectionKeyTyped
// TODO add your handling code here:
-
+
}//GEN-LAST:event_mnuOptionTaxaSelectionKeyTyped
-
+
private void mnuOptionTaxaSelectionKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_mnuOptionTaxaSelectionKeyPressed
// TODO add your handling code here:
-
+
}//GEN-LAST:event_mnuOptionTaxaSelectionKeyPressed
-
+
private void mnuOptionTaxaSelectionKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_mnuOptionTaxaSelectionKeyReleased
// TODO add your handling code here:
-
+
}//GEN-LAST:event_mnuOptionTaxaSelectionKeyReleased
-
+
private void mnuFileKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_mnuFileKeyPressed
-
+
}//GEN-LAST:event_mnuFileKeyPressed
private void btTaxaSelectActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btTaxaSelectActionPerformed
@@ -2504,9 +2505,9 @@ private void btScriptActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRS
private void btSpeciesMouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btSpeciesMouseReleased
// TODO add your handling code here:
-
+
selectSpecies(); //Added by preethy on 17-01-2012
-
+
}//GEN-LAST:event_btSpeciesMouseReleased
private void btSearchMouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btSearchMouseReleased
@@ -2514,12 +2515,12 @@ private void btSearchMouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:e
panelMenuButtons.setVisible(false);
search();
panelMenuButtons.setVisible(true);
-
+
}//GEN-LAST:event_btSearchMouseReleased
private void mnuRunMouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_mnuRunMouseReleased
// TODO add your handling code here:
-
+
}//GEN-LAST:event_mnuRunMouseReleased
private void jMenuItem4MouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jMenuItem4MouseReleased
@@ -2533,7 +2534,7 @@ private void jMenuItem3MouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST
}//GEN-LAST:event_jMenuItem3MouseReleased
private void mnuaddimagesMouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_mnuaddimagesMouseReleased
-
+
}//GEN-LAST:event_mnuaddimagesMouseReleased
private void mnuaddimagesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuaddimagesActionPerformed
@@ -2541,7 +2542,7 @@ private void mnuaddimagesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-
Object source = evt.getSource();
if (source == mnuaddimages) {
-
+
try {
try {
// TODO add your handling code here:
@@ -2552,7 +2553,7 @@ private void mnuaddimagesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-
} catch (IOException ex) {
Logger.getLogger(MainForm.class.getName()).log(Level.SEVERE, null, ex);
}
- }
+ }
}//GEN-LAST:event_mnuaddimagesActionPerformed
@@ -2580,13 +2581,13 @@ private void jMenuItem5MouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST
private void mnuOptionTaxaSelectionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuOptionTaxaSelectionActionPerformed
// TODO add your handling code here:
-
+
DataBaseDriver db = new DataBaseDriver(Configuration.DataBaseName());
/* if (db.DataBaseExists() == false) {
JOptionPane.showMessageDialog(this, "You must select an image package to continue the program.");
return;
}*/
-
+
panelMenuButtons.setVisible(false);
selectTaxa(db);
panelMenuButtons.setVisible(true);
@@ -2600,7 +2601,7 @@ private void mnuTestActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST
private void jMenuItem3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem3ActionPerformed
// TODO add your handling code here:
- selectSpecies();
+ selectSpecies();
}//GEN-LAST:event_jMenuItem3ActionPerformed
private void jMenuItem5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem5ActionPerformed
@@ -2649,10 +2650,10 @@ private void jMenuItem2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FI
dlgCut.setVisible(true);
}//GEN-LAST:event_jMenuItem2ActionPerformed
-private void introMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_introMenuItemActionPerformed
+/*private void introMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_introMenuItemActionPerformed
// TODO add your handling code here:
LaunchPDF("Intro.pdf");
-}//GEN-LAST:event_introMenuItemActionPerformed
+}*/ //GEN-LAST:event_introMenuItemActionPerformed
private void tutorialMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_tutorialMenuItemActionPerformed
// TODO add your handling code here:
@@ -2661,7 +2662,7 @@ private void tutorialMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//
private void openingScreenActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_openingScreenActionPerformed
// TODO add your handling code here:
- showHelpPopup();
+ showHelpPopup();
}//GEN-LAST:event_openingScreenActionPerformed
private void mnuViewProgressActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuViewProgressActionPerformed
@@ -2670,25 +2671,24 @@ private void mnuViewProgressActionPerformed(java.awt.event.ActionEvent evt) {//G
progress.setLocationRelativeTo(this);
progress.ShowResults();
progress.setVisible(true);
-
+
}//GEN-LAST:event_mnuViewProgressActionPerformed
private void mnuExitActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuExitActionPerformed
// TODO add your handling code here:
- exitFunction();
+ exitFunction();
}//GEN-LAST:event_mnuExitActionPerformed
private void jMenuItem6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem6ActionPerformed
if (taxonomicLevel == null || mTaxa == null || mTaxa.length == 0) {
- JOptionPane.showMessageDialog(this, "There are no taxa selected.\n\r Press OK to be returned to the Main Screen.");
+ Utilities.MessageDialog(this, "There are no taxa selected.\n\r Press OK to be returned to the Main Screen\n where you can add taxa to the study set.");
return;
- }
+ }
try {
saveTexaSet();
- //JOptionPane.showMessageDialog(this,"File Saved Successfuly!");
} catch (IOException ex) {
- JOptionPane.showMessageDialog(this, "Some problem occout while processing you request.Please try again!");
+ Utilities.MessageDialog(this, "Some problem occout while processing you request.Please try again!");
}
}//GEN-LAST:event_jMenuItem6ActionPerformed
@@ -2697,7 +2697,7 @@ private void jMenuItem7ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FI
}//GEN-LAST:event_jMenuItem7ActionPerformed
private void loadScriptFile(String filename) {
-
+
scriptMode = true;
inSession = false;
GlobalVariableClass gvClass = new GlobalVariableClass();
@@ -2719,12 +2719,12 @@ private void loadScriptFile(String filename) {
mScriptFileName = findScriptFileName();
mSessionCount = gvClass.getSessionCount();
mySessionsArray = new SessionClass[mSessionCount];
-
+
for (int i = 0; i < mSessionCount; i++) {
try {
mySessionsArray[i] = (SessionClass) in.readObject();
-
-
+
+
} catch (ClassNotFoundException ex) {
ex.printStackTrace();
} catch (IOException ex) {
@@ -2737,7 +2737,7 @@ private void loadScriptFile(String filename) {
startScript();
}
-
+
private String Wrap(String msg, int lineLength){
if(msg.length() <= lineLength)
return msg;
@@ -2750,18 +2750,18 @@ private String Wrap(String msg, int lineLength){
newMsg = msg.substring(0, i) + "\n";
return newMsg + Wrap(msg.substring(i + 1, msg.length()), lineLength);
}
-
+
private void startScript(){
// Begin Main Scripting loop
-
+
String sessionType;
String StudentMessage = "";
String tempMess;
dlgSessionCommand dlgSC = new dlgSessionCommand();
-
+
// Check if there are any more sessions to execute...
if(mSessionCount == mGlobalSessionIndex){ // Then there are no more sessions
- JOptionPane.showMessageDialog(this,"All sessions have been completed for this script.");
+ Utilities.MessageDialog(this, "All sessions have been completed for this script.");
taxonomicLevel = null;
mTaxa = null;
scriptMode = false;
@@ -2770,29 +2770,28 @@ private void startScript(){
}
// If there is a student message display it!!!
StudentMessage = mySessionsArray[mGlobalSessionIndex].getMessage();
-
+
//StudentMessage = "If there is a student message, you need to talk to you teacher about receiving an F-";
tempMess = StudentMessage.replaceAll(" ", "");
// say about 60
StudentMessage = StudentMessage.replace("\n", " ");
StudentMessage = Wrap(StudentMessage, 60);
-
+
if(tempMess.compareTo("") != 0){
- JOptionPane.showMessageDialog(this, StudentMessage);
-
+ Utilities.MessageDialog(this, StudentMessage);
+
}
-
+
dlgSC.setModal(true);
-
-
+
+
dlgSC.setText("Would you like to run the session " + mySessionsArray[mGlobalSessionIndex].getSessionName() + "?");
dlgSC.setLocationRelativeTo(this);
dlgSC.setVisible(true);
-
+
int res = dlgSC.getResponse();
-
- //int res = JOptionPane.showConfirmDialog(this, "Would you like to run the session " + mySessionsArray[mGlobalSessionIndex].getSessionName() + "?", "Run Session?", JOptionPane.YES_NO_CANCEL_OPTION);
-
+
+
// Closes the Script File and Exits to main menu
if(res == 2){
scriptMode = false;
@@ -2801,34 +2800,34 @@ private void startScript(){
mTaxa = null;
return;
}
-
+
// Skips the currect Session to the next
if (res == 1) {
sessionType = mySessionsArray[mGlobalSessionIndex].getmType();
if (sessionType.compareTo("study") != 0) {// Don't record a grade for a study session
- JOptionPane.showMessageDialog(this, "Session " + mySessionsArray[mGlobalSessionIndex].getSessionName() + " has been skipped.\nA zero has been recorded for this session.");
+ Utilities.MessageDialog(this, "Session " + mySessionsArray[mGlobalSessionIndex].getSessionName() + " has been skipped.\nA zero has been recorded for this session.");
recordZeroForSession();
}
else{
- JOptionPane.showMessageDialog(this, "Session " + mySessionsArray[mGlobalSessionIndex].getSessionName() + " has been skipped.");
+ Utilities.MessageDialog(this, "Session " + mySessionsArray[mGlobalSessionIndex].getSessionName() + " has been skipped.");
}
-
+
// Suppress the show progress if session is skipped!!
showProgressQuiz = false;
showProgressTest = false;
-
-
+
+
quitStudyImages(null);
} else {
sessionType = mySessionsArray[mGlobalSessionIndex].getmType();
if (sessionType.compareTo("study") == 0) { // must be study mode
-
+
studyScripting();
} else if (sessionType.compareTo("quiz") == 0) {
-
+
takeQuizScripting();
} else {
-
+
testScripting();
}
}
@@ -2843,7 +2842,7 @@ private void recordZeroForSession(){
rs.writeResults();
};
-
+
private ActionListener quitStudyImagesCallback(){
@@ -2854,7 +2853,7 @@ public void actionPerformed(ActionEvent evt) {
}
};
}
-
+
private void FolderCheck() {
// File toWork = new File(Configuration.UserPath() + "Grades");
@@ -2868,17 +2867,17 @@ private void FolderCheck() {
toWork.mkdir();
}
}
-
+
private void studyScripting(){
executeScript("Study");
}
-
+
private String[][] getFileNames(){
String levels;
String fileN;
ArrayList myAlist = new ArrayList();
String[] imgTemp = mySessionsArray[mGlobalSessionIndex].getImages();
-
+
String[][] fileNames = new String[imgTemp.length][2];
for (int k = 0; k < imgTemp.length; k++) {
imgTemp[k] = imgTemp[k].trim();
@@ -2886,11 +2885,11 @@ private String[][] getFileNames(){
levels = imgTemp[k].substring(0, imgTemp[k].lastIndexOf(" ") - 1);
levels = levels.replace("|", " ");
levels = levels.trim();
-
+
fileNames[k][0] = fileN;
fileNames[k][1] = levels;
}
-
+
// MUST SET TAXA HERE
for (int i = 0; i < imgTemp.length; i++) {
if (!stringExistInArray(myAlist, fileNames[i][1])) {
@@ -2904,15 +2903,15 @@ private String[][] getFileNames(){
}
return fileNames;
}
-
+
private void executeScript(String scriptType) {
-
+
studying = (scriptType.compareTo("Study") == 0);
if (studying) {
programState = 1;
} else {
programState = 2;
- JOptionPane.showMessageDialog(this, "You are about to start a " + scriptType + " from a script. Make sure you have time to complete it.\nThe session will start immediately, after clicking on OK.");
+ Utilities.MessageDialog(this, "You are about to start a " + scriptType + " from a script. Make sure you have time to complete it.\nThe session will start immediately, after clicking on OK.");
}
setWorkingState();
@@ -2930,7 +2929,7 @@ private void executeScript(String scriptType) {
mode = mySessionsArray[mGlobalSessionIndex].getModeQuiz() + 1;
}
}
-
+
delayQT = mySessionsArray[mGlobalSessionIndex].getDelayTime();
mFixationTime = mySessionsArray[mGlobalSessionIndex].getFixation();
@@ -2947,12 +2946,12 @@ private void executeScript(String scriptType) {
}
}
}
-
+
private void runQuizScript(String[][] fileNames) {
SessionInfo session = new SessionInfo(this, lbPictureBox, fileNames, delayQT,
taxonomicLevel, mTaxa, this.jPanel1, quitStudyImagesCallback(), mUserName,
false, null, mFixationTime, progress, mScriptName, mySessionsArray[mGlobalSessionIndex].getSessionName(), mScriptFileName);
-
+
// quiz = new QuizClass(session, mode, SessionInfo.SpellingValue, inSession,taxonomicLevel);
quiz = new QuizClass(session, mode, SessionInfo.SpellingValue, inSession,taxonomicLevel, this);
// jMenuBar1.setVisible(false);
@@ -2963,16 +2962,16 @@ private void runStudyScript(String[][] fileNames) {
mKeyToContinue = mySessionsArray[mGlobalSessionIndex].getStopUntilKeyPress();
mAutoImageDisplay = !mySessionsArray[mGlobalSessionIndex].getUseArrowKeys();
mShowImageWithName = !mySessionsArray[mGlobalSessionIndex].getImageOnly();
-
+
//mStudyClass = new StudyImageClass(this, lbPictureBox, mySessionsArray[mGlobalSessionIndex].getRandomize(),
// quitStudyImagesCallback(), fileNames, mShowFamilyName, taxonomicLevel,this,this.jPanel1); // this,this.jPanel1 Added by preethy on 28-01-2012
-
+
/**
* following constructor call is added by anurag to provide alphabatical sorting for study scripting functionality
**/
mStudyClass = new StudyImageClass(this, lbPictureBox, mySessionsArray[mGlobalSessionIndex].getRandomize(),
- quitStudyImagesCallback(), fileNames, mShowFamilyName, taxonomicLevel,this,this.jPanel1, true);
-
+ quitStudyImagesCallback(), fileNames, mShowFamilyName, taxonomicLevel,this,this.jPanel1, true);
+
mStudyClass.setDisplayTime(delayQT);
mStudyClass.setFixationTime(mFixationTime);
mStudyClass.setKeyToContinue(mKeyToContinue);
@@ -2989,7 +2988,7 @@ private void runTestScript(String[][] fileNames) {
//jMenuBar1.setVisible(false);
test.start();
}
-
+
private void testScripting() {
executeScript("Test");
}
@@ -3014,7 +3013,7 @@ private String getCurrentDateString() {
}
private String findScriptFileName() {
-
+
// String path = Configuration.UserPath();
String path = Configuration.ApplicationPath();
FileWriter myFileWriter = null;
@@ -3023,39 +3022,39 @@ private String findScriptFileName() {
int filenamenumber = 1;
filename = CSVFileName(path, getCurrentDateString(), filenamenumber);
-
+
fileExists = (new File(filename)).exists();
while (fileExists) {
filenamenumber++;
filename = CSVFileName(path, getCurrentDateString(), filenamenumber);
fileExists = (new File(filename)).exists();
-
+
}
-
+
return filename;
}
private String CSVFileName(String path, String date, int FileNameNumber) {
return path + "/Grades/" + mScriptName + "_" + mUserName + "_" + date.replace('/', '-') + "_" + String.valueOf(FileNameNumber) + ".csv";
}
-
-
+
+
private boolean VerifyDatabase(){
-
+
// Test validation of database
if (DataBaseCheckEnabled) {
VerifyDatabase objVerifyDB = new VerifyDatabase(Configuration.DataBaseName(), Configuration.DataBaseHashValue());
-
+
if (!objVerifyDB.IsOK()) {
- JOptionPane.showMessageDialog(this, "The DataBase has been modified. Please reinstall the program or replace the database with the original file.");
+ Utilities.MessageDialog(this, "The DataBase has been modified. Please reinstall the program or replace the database with the original file.");
return false;
}
-
+
}
return true;
-
+
}
//Added by preethy on 17-01-2012
private void selectSpecies() {
@@ -3064,7 +3063,7 @@ private void selectSpecies() {
JOptionPane.showMessageDialog(this, "You must select an image package to continue the program.");
return;
}*/
-
+
SelectSpecies selSpecies=new SelectSpecies(db,maxImages);
selSpecies.setLocationRelativeTo(this);
selSpecies.setVisible(true);
@@ -3078,35 +3077,35 @@ private void selectSpecies() {
selctfamilyTaxanull=true;
}
taxonomicLevel=selSpecies.getTaxaLevel();//selected taxa level from select species
-
- mTaxa = selSpecies.getItems(); //selected taxa
+
+ mTaxa = selSpecies.getItems(); //selected taxa
selCname=selSpecies.CommonNames;//if common name is selected or not
-
+
if (!selCname) {
selScientificName = false;
}
-
+
group=false;//Addedd by preethy on 12-07-2012
sel=new ArrayList();// afer selecting select species by family already selcted filenames initialized to zero
isFromTexaSelect = false;
}
}
private void search() {
-
+
Search_table pr=new Search_table(mTaxa,taxonomicLevel,this,maxImages);
pr.setLocationRelativeTo(this);
pr.setVisible(true);
-
+
/* if(pr.close==true){
showMenuButtons();
-
+
}*/
}
private void addImagesAndDatabase() throws IOException, InterruptedException {
-
-
+
+
String desktopStr=System.getProperty("user.home");
-
+
JFileChooser chooser = new JFileChooser();
chooser.setCurrentDirectory(new File(desktopStr+"/Desktop"));
chooser.setFileFilter(new FileFilter() {
@@ -3124,47 +3123,47 @@ public String getDescription() {
if (r== JFileChooser.APPROVE_OPTION) {
File tempFile = chooser.getSelectedFile();//select zip file
String temp = tempFile.getAbsolutePath();
-
+
int size=temp.lastIndexOf("\\");
String zip= temp.substring(size+1);
-
+
ZipInputStream in = null;
int i=0;
copyFilesThread cp;
if(zip.endsWith("zip"))
{
- int retVal = JOptionPane.showConfirmDialog(this, "The old database and images will be erased, and the new\n\r database and images in "+zip+" will be installed in their place.\n\rAre you sure you want to continue?", "No Taxa Selected!", JOptionPane.OK_CANCEL_OPTION);
+ int retVal = Utilities.ConfirmDialog(this, "The old database and images will be erased, and the new\n\r database and images in "+zip+" will be installed in their place.\n\rAre you sure you want to continue?", "No Taxa Selected!");
- if(retVal == JOptionPane.OK_OPTION)
+ if(retVal == JOptionPane.YES_OPTION)
{
cp = new copyFilesThread(this,temp);//this thred extrcts and copy the contents of zip files correct location
cp.start();
-
+
}
}else {
- JOptionPane.showMessageDialog(this, "Please select zip files only");
+ Utilities.MessageDialog(this, "Please select zip files only.");
}
-
+
}
}
private void selectByGroup() {
-
+
DataBaseDriver db = new DataBaseDriver(Configuration.DataBaseName());
SelectImage2 selImage=new SelectImage2(db,maxImages);
- selImage.esc=false;//whether esc key pressed or not
+ selImage.esc=false;//whether esc key pressed or not
selImage.setLocationRelativeTo(this);
selImage.setVisible(true);
sel=selImage.db.selectedRow;//this array list contains the rows of csv file, selected through select by group
-
+
for(int i=0;i | ");
+ Utilities.MessageDialog(this, "File names cannnot contain / \\ : * ? \" < > | ");
return;
}
}
@@ -3264,7 +3264,7 @@ private void saveTexaSet() throws IOException {
if (isValidFileName(tempFile)) {
saveTexaFile(path, tempFile);
} else {
- JOptionPane.showMessageDialog(this, "File names cannnot contain / \\ : * ? \" < > | ");
+ Utilities.MessageDialog(this, "File names cannnot contain / \\ : * ? \" < > | ");
return;
}
}
@@ -3274,8 +3274,8 @@ private void saveTexaSet() throws IOException {
public boolean saveTexaFile(String filePath, String fileName) {
boolean status = false;
-
-
+
+
String selectBy = null;
if (selCname) {
@@ -3293,7 +3293,7 @@ public boolean saveTexaFile(String filePath, String fileName) {
bean.setGroup(group);
bean.setTaxanull(taxanull);
bean.setSelctfamilyTaxanull(selctfamilyTaxanull);
-
+
try {
OutputStream os = new FileOutputStream(filePath + File.separator + fileName);
@@ -3304,21 +3304,21 @@ public boolean saveTexaFile(String filePath, String fileName) {
os.close();
return true;
} catch (Exception e) {
- //JOptionPane.showMessageDialog(this, e);
}
finally{
-
+
}
return status;
}
-
+
private void MYFolderCheck() {
- File toWork = new File(Configuration.ApplicationPath() + "/" + savedTaxaSetsPath);
+ File toWork = new File(Configuration.ApplicationPath() + "/Saved Taxa Sets");
+ //File toWork = new File(Configuration.ApplicationPath() + "/" + savedTaxaSetsPath);
if (toWork.exists() == false) {
toWork.mkdir();
}
}
-
+
public boolean isValidFileName(String name) {
if (name.indexOf("\"") > 0) {
@@ -3350,19 +3350,19 @@ public boolean isValidFileName(String name) {
}
return true;
}
-
+
private boolean loadTexa(String filePath) {
-
+
InputStream is = null;
ObjectInputStream inputStream = null;
-
+
try {
is = new FileInputStream(filePath);
inputStream = new ObjectInputStream(is);
UserDataBean dataBean = (UserDataBean) inputStream.readObject();
-
+
this.btnOkClicked = false;
-
+
CurrentTexaInformationDialog informationDialog = new CurrentTexaInformationDialog(this, true,"Load Saved Taxa Set");
informationDialog.setCmnName(dataBean.getSelectBy());
informationDialog.setmTaxa(dataBean.getmTaxa());
@@ -3370,7 +3370,7 @@ private boolean loadTexa(String filePath) {
informationDialog.setLocationRelativeTo(this);
informationDialog.setModal(true);
informationDialog.setVisible(true);
-
+
if(this.btnOkClicked) {
this.mTaxa = dataBean.getmTaxa();
this.taxonomicLevel = dataBean.getTaxonomicLevel();
@@ -3405,7 +3405,8 @@ private boolean openTexaFile() {
myFileBrowser.setDialogTitle("Load Saved Taxa Set");
File f = null;
try {
- f = new File(Configuration.ApplicationPath() + "/" + savedTaxaSetsPath);
+ f = new File(Configuration.ApplicationPath() + "/Saved Taxa Sets");
+ //f = new File(Configuration.ApplicationPath() + "/" + savedTaxaSetsPath);
myFileBrowser.setCurrentDirectory(f);
} catch (Exception ex) {
ex.printStackTrace();
@@ -3426,4 +3427,4 @@ private boolean openTexaFile() {
}
return status;
}
-}
\ No newline at end of file
+}
diff --git a/src/main/java/scripteditor/PropertyFileReader.java b/src/main/java/scripteditor/PropertyFileReader.java
index 0a3fb19..1806100 100755
--- a/src/main/java/scripteditor/PropertyFileReader.java
+++ b/src/main/java/scripteditor/PropertyFileReader.java
@@ -32,16 +32,18 @@
/**
*
* @author Anurag
+
+ * this class is currently obsolete
*/
public class PropertyFileReader {
-
+
java.util.Properties properties = new Properties();
public PropertyFileReader() throws FileNotFoundException, IOException {
InputStream inputStream = new FileInputStream(Configuration.ApplicationPath()+File.separator+"application.properties");
properties.load(inputStream);
}
-
+
public String getPropertyValue(String key)
{
if(properties==null){
@@ -50,6 +52,6 @@ public String getPropertyValue(String key)
}
return null;
}
-
-
+
+
}
diff --git a/src/main/java/scripteditor/QuizClass.java b/src/main/java/scripteditor/QuizClass.java
index 68f6208..e16cf8c 100755
--- a/src/main/java/scripteditor/QuizClass.java
+++ b/src/main/java/scripteditor/QuizClass.java
@@ -59,7 +59,7 @@ public QuizClass(SessionInfo session, int mode, int spell,MainForm obj) {
mSpellVal = spell;
mForm=obj;//Added by preethy on 28-01-2012
if(mForm.taxonomicLevel.equals("Genus")||(mForm.taxonomicLevel.equals("Species"))){
- fontItalic=true;
+ fontItalic=true;
}
taxonomicLevel= mForm.taxonomicLevel;
}
@@ -80,18 +80,18 @@ public void run() {
String currentDirectory = Configuration.ApplicationPath() + "/images";
// String currentDirectory = Configuration.UserPath() + "/images";
String[] info = new String[mSessionInfo.mFileNames.length];
-
+
for (int i = 0; i < info.length; i++) {
info[i] = mSessionInfo.mFileNames[i][0] + ";" + mSessionInfo.mFileNames[i][1]; // Concats example ( 01332.jpg;Acer )
-
+
}
try{ //Added by preethy 0n 28-01-2012
mSessionInfo.mImageCollection = new ImageCollection(info, currentDirectory, true);
mSessionInfo.mImageCollection.start();
-
+
// }
switch (mMode) {
-
+
case 1:
// if(mScriptMode){
// ScriptImageNaming(true);
@@ -112,7 +112,7 @@ public void run() {
LaunchImageVerification();
break;
default:
-
+
//
}//end switch
mSessionInfo.mImageCollection.quit();
@@ -122,18 +122,18 @@ public void run() {
catch(Exception e){
if(info.length>0)
{
-
- JOptionPane.showMessageDialog(mSessionInfo.mPanel, "Images specified in the database are missing in images folder. Add images to continue.");
+
+ Utilities.MessageDialog(mSessionInfo.mPanel, "Images specified in the database are missing in images folder. Add images to continue.");
mForm.showMenuButtons();
}
-
+
}
/**/
}//end StartQuiz
private void ImageNaming(boolean showPrompt) {
ImageNamingQuiz2 quiz = new ImageNamingQuiz2(mSessionInfo, mMode, mScriptMode,taxonomicLevel);
-
+
// ImageNamingQuiz quiz=new ImageNamingQuiz( mSessionInfo, mMode, mScriptMode);//Commented by preethy on 19-01-2012
if(showPrompt)
quiz.RunWithPrompt();
@@ -153,7 +153,7 @@ private void LaunchImageComparison() {
ic = new IQImageComparison(mSessionInfo.mParentForm, mSessionInfo.mDisplayLabel, mSessionInfo.mFileNames, mSessionInfo.mDelay,
mSessionInfo.mTaxaLevel, mSessionInfo.mTaxa, mSessionInfo.mPanel, mSessionInfo.mCallback, mSessionInfo.mUserName, false,
mSessionInfo.mImageCollection, mSessionInfo.mProgress);
-
+
}
if(mSessionInfo.mTaxa.length > 1 ){
ic.SaveResult();
@@ -173,8 +173,8 @@ private void LaunchImageVerification() {
if(mSessionInfo.mTaxa.length > 1 ){
iv.SaveResult();
}
-
+
}
-
+
}
diff --git a/src/main/java/scripteditor/QuizResponseDialog.java b/src/main/java/scripteditor/QuizResponseDialog.java
index fceb4b5..1f5aea6 100755
--- a/src/main/java/scripteditor/QuizResponseDialog.java
+++ b/src/main/java/scripteditor/QuizResponseDialog.java
@@ -46,7 +46,7 @@ public class QuizResponseDialog extends javax.swing.JDialog {
String mTaxaLevel;
Clipboard clip;
StringSelection mySelection = new StringSelection("");
-
+
public boolean mRunning = true;
public boolean close=false;//Added by preethy on 28-01-2012;
public boolean no=false;//Added by preethy on 28-01-2012;
@@ -61,18 +61,18 @@ public QuizResponseDialog(String taxaLevel, boolean comp) {
} catch (IOException ex) {
Logger.getLogger(QuizResponseDialog.class.getName()).log(Level.SEVERE, null, ex);
}
-
+
setIconImage(image);
this.addWindowListener(EXIT_ON_CLOSE);
this.setModal(true);
if(comp == true){
- lbMessage.setText("Same " + taxaLevel + "?" + " (Y/N)");
+ lbMessage.setText("Same " + taxaLevel + "?" + " (Y/N)");
}
else
lbMessage.setText("Enter " + taxaLevel + ":");
-
+
}
-
+
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
@@ -169,32 +169,32 @@ public void keyPressed(java.awt.event.KeyEvent evt) {
}// //GEN-END:initComponents
private void formWindowClosing(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowClosing
-
+
ok();
//close=true;
// stop();
//addWindowListener(0);
/// TODO add your handling code here:
-
+
}//GEN-LAST:event_formWindowClosing
private void jButton1KeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jButton1KeyPressed
-
+
stop();
}//GEN-LAST:event_jButton1KeyPressed
private void btOKKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_btOKKeyPressed
-
+
ok();
}//GEN-LAST:event_btOKKeyPressed
private void formWindowActivated(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowActivated
tfResponse.requestFocus();
try {
-
+
clip = Toolkit.getDefaultToolkit().getSystemClipboard();
} catch (HeadlessException ex) {
- JOptionPane.showMessageDialog(this, "Problem");
+ Utilities.MessageDialog(this, "Problem");
}
clip.setContents(mySelection, mySelection);// TODO add your handling code here:
}//GEN-LAST:event_formWindowActivated
@@ -213,39 +213,39 @@ private void tfResponseKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:even
btOKMouseReleased(null);
}
}//GEN-LAST:event_tfResponseKeyPressed
-
+
public String getResponse(){
-
+
return mResponse;
}
public void resetResponse(){
mResponse = "";
}
public void forCloseResponse(){
-
+
mResponse = null;
}
public void stop(){
- int ret = JOptionPane.showConfirmDialog(this, "Are you sure you want to quit?", "Quit?", JOptionPane.YES_NO_OPTION);
+ int ret = Utilities.ConfirmDialog(this, "Are you sure you want to quit?", "Quit?");
if(ret == JOptionPane.YES_OPTION)
{
mRunning = false;
this.hide();
-
+
}else{
no=true;
this.show();
}
}
-
+
public void ok(){
mResponse = tfResponse.getText();
this.hide();
tfResponse.setText("");
}
-
-
+
+
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton btOK;
private javax.swing.JButton jButton1;
@@ -253,13 +253,13 @@ public void ok(){
private javax.swing.JTextField tfResponse;
// End of variables declaration//GEN-END:variables
- private void addWindowListener(int param)
+ private void addWindowListener(int param)
{
- if(param == 0)
+ if(param == 0)
{
-
- int ret = JOptionPane.showConfirmDialog(this, "Are you sure you want to quit?", "Quit?", JOptionPane.YES_NO_OPTION);
+
+ int ret = Utilities.ConfirmDialog(this, "Are you sure you want to quit?", "Quit?");
if(ret == JOptionPane.YES_OPTION)
{
mRunning = false;
@@ -267,11 +267,11 @@ private void addWindowListener(int param)
}
else
{
-
+
}
}
}
-
+
}
diff --git a/src/main/java/scripteditor/RandomResponse.java b/src/main/java/scripteditor/RandomResponse.java
index 1eba1fc..cf287fc 100755
--- a/src/main/java/scripteditor/RandomResponse.java
+++ b/src/main/java/scripteditor/RandomResponse.java
@@ -34,7 +34,7 @@
*/
public class RandomResponse {
-
+
public static void ShowPositiveResponse(Component mParentForm) {
Random generator = new Random();
String msg = "";
@@ -67,7 +67,7 @@ public static void ShowPositiveResponse(Component mParentForm) {
msg = "Excellent!";
break;
}
- JOptionPane.showMessageDialog(mParentForm, msg);
+ Utilities.MessageDialog(mParentForm, msg);
}
}
diff --git a/src/main/java/scripteditor/RandomSelectDialog.java b/src/main/java/scripteditor/RandomSelectDialog.java
index a8a18c4..bccb3ea 100755
--- a/src/main/java/scripteditor/RandomSelectDialog.java
+++ b/src/main/java/scripteditor/RandomSelectDialog.java
@@ -42,16 +42,16 @@
* @author Moz123
*/
public class RandomSelectDialog extends javax.swing.JDialog {
-
+
private String mTaxaLevel; // Taxa Level
private int mNumberTaxa; // Number of taxa to use
// private int mNumberImages; // number of Images per Taxa
private boolean mCommonNames; // use Common Names when true
private int mResult; // Return result for Continue and Cancel buttons
private int mMode; // Study Quiz or Test modes study = 1, quiz = 2 and test = 3
-
-
-
+
+
+
/** Creates new form RandomSelectDialog */
public RandomSelectDialog(String taxaLevel, boolean commonNames, int numTaxa) {
initComponents();
@@ -85,10 +85,10 @@ public RandomSelectDialog(String taxaLevel, boolean commonNames, int numTaxa) {
if(taxaLevel.compareTo("Common Name") == 0)
dropTaxaLevel.setSelectedIndex(4);
}
-
+
dropNumberTaxa.setSelectedIndex(numTaxa - 1);
}
-
+
public static void addEscapeListener(final JDialog dialog)
{
ActionListener escListner = new ActionListener() {
@@ -102,7 +102,7 @@ public void actionPerformed(ActionEvent e) {
KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE,0),
JComponent.WHEN_IN_FOCUSED_WINDOW);
}
-
+
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
@@ -286,7 +286,7 @@ public void mouseReleased(java.awt.event.MouseEvent evt) {
}// //GEN-END:initComponents
private void dropTaxaLevelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_dropTaxaLevelActionPerformed
-
+
if(dropTaxaLevel.getSelectedIndex() == 4){
chkCommonNames.setEnabled(true);
}
@@ -299,23 +299,23 @@ private void btCancelMouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:e
this.hide();
}//GEN-LAST:event_btCancelMouseReleased
-
+
private void btContinueMouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btContinueMouseReleased
if(this.dropTaxaLevel.getSelectedIndex() < 2){
- JOptionPane.showMessageDialog(this, "Please select a taxonomic level", "No Taxonomic Level Selected", JOptionPane.OK_OPTION);
+ Utilities.MessageDialog(this, "Please select a taxonomic level");
return;
}
else{
-
-
+
+
mTaxaLevel = this.dropTaxaLevel.getSelectedItem().toString();
if(mTaxaLevel.compareTo("Species") == 0 && chkCommonNames.isSelected() == true){
mTaxaLevel = "Common Name";
}
-
-
-
+
+
+
mNumberTaxa = this.dropNumberTaxa.getSelectedIndex() + 1;
// mNumberImages = this.dropNumberImages.getSelectedIndex() + 1;
mCommonNames = this.chkCommonNames.isSelected();
@@ -335,36 +335,36 @@ else if(jRadioButton3.isSelected()){
this.setVisible(false);
}
}//GEN-LAST:event_btContinueMouseReleased
-
+
public String getTaxaLevel(){
return mTaxaLevel;
}
-
+
// public int getImageCount(){
// return mNumberImages;
// }
-
+
public int getTaxaCount(){
return mNumberTaxa;
}
-
+
public boolean getUseCommonNames(){
return mCommonNames;
}
-
+
public int getResults(){
return mResult;
}
-
+
public int getMode(){
return mMode;
}
-
+
/**
* @param args the command line arguments
*/
-
-
+
+
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.ButtonGroup bgButtonGroup;
private javax.swing.JButton btCancel;
@@ -381,5 +381,5 @@ public int getMode(){
private javax.swing.JRadioButton jRadioButton3;
private javax.swing.JRadioButton jRadioButton4;
// End of variables declaration//GEN-END:variables
-
+
}
diff --git a/src/main/java/scripteditor/SearchRes.java b/src/main/java/scripteditor/SearchRes.java
index 27dcf23..8be015b 100755
--- a/src/main/java/scripteditor/SearchRes.java
+++ b/src/main/java/scripteditor/SearchRes.java
@@ -75,7 +75,7 @@ public SearchRes(String[] PrevTaxa,String taxal) {
this.searchLevel=Srchlevel;
this.level=level;
this.exist=exist;
-
+
// throw new UnsupportedOperationException("Not yt eimplemented");
}
@@ -196,27 +196,27 @@ private void list2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:e
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
// TODO add your handling code here:
-
+
}//GEN-LAST:event_jButton1ActionPerformed
private void jButton2MouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jButton2MouseReleased
// TODO add your handling code here:
bt1=true;
-
+
mainF.mTaxa =null;
mainF.taxonomicLevel=searchLevel;
-
-
+
+
if(Items2!=null){
- mainF.mTaxa=Items2;
+ mainF.mTaxa=Items2;
}
//else{ //Commented by preethy on 19-06-2012
// mainF.mTaxa=Items;
// }
-
+
mainF.group=false;
this.setVisible(false);
- prj.setVisible(false);
+ prj.setVisible(false);
}//GEN-LAST:event_jButton2MouseReleased
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
@@ -225,13 +225,13 @@ private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRS
private void jButton3MousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jButton3MousePressed
// TODO add your handling code here:
-
+
}//GEN-LAST:event_jButton3MousePressed
private void jButton3MouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jButton3MouseReleased
// TODO add your handling code here:
this.setVisible(false);
-
+
}//GEN-LAST:event_jButton3MouseReleased
private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
@@ -242,8 +242,8 @@ private void formWindowOpened(java.awt.event.WindowEvent evt) {//GEN-FIRST:event
// TODO add your handling code here:
if(mainF.mTaxa==null || mainF.mTaxa.length==0)
{
- list2.add("No taxa are currently selected.");
-
+ list2.add("No taxa are currently selected.");
+
jButton2.setEnabled(false);
}
else
@@ -252,7 +252,7 @@ private void formWindowOpened(java.awt.event.WindowEvent evt) {//GEN-FIRST:event
list2.add(StudySet[i]);
}
}
-
+
}//GEN-LAST:event_formWindowOpened
private void jButton1MouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jButton1MouseReleased
@@ -260,30 +260,30 @@ private void jButton1MouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:e
if(mainF.mTaxa!=null){
if(level.equals("Family"))
{
- JOptionPane.showMessageDialog(this,"We are sorry; you cannot add the selected taxa to the study set\n because the current study set consists of families and the selected \n taxa are at the " +searchLevel+ " level. Please select a different option.");
+ Utilities.MessageDialog(this, "We are sorry; you cannot add the selected taxa to the study set\n because the current study set consists of families and the selected \n taxa are at the " +searchLevel+ " level. Please select a different option.");
}else if((!searchLevel.equalsIgnoreCase(level)) && (level.equals("Common Name") ) ){
- JOptionPane.showMessageDialog(this,"We are sorry; you cannot add the selected taxa to the study set because\n the current study set consists of species (selected by common name) and\n the selected taxa are at the generic level. Please select a different option.");
+ Utilities.MessageDialog(this, "We are sorry; you cannot add the selected taxa to the study set because\n the current study set consists of species (selected by common name) and\n the selected taxa are at the generic level. Please select a different option.");
}else if((!searchLevel.equalsIgnoreCase(level)) && (level.equals("Genus") ) ){
- JOptionPane.showMessageDialog(this,"We are sorry; you cannot add the selected taxa to the study set\n because the current study set consists of genera and the selected \n taxa are at the species level. Please select a different option.");
+ Utilities.MessageDialog(this, "We are sorry; you cannot add the selected taxa to the study set\n because the current study set consists of genera and the selected \n taxa are at the species level. Please select a different option.");
}else if((!searchLevel.equalsIgnoreCase(level)) && (level.equals("Species")) && (searchLevel.equals("Genus")) ){
- JOptionPane.showMessageDialog(this,"We are sorry; you cannot add the selected taxa to the study set\n because the current study set consists of species selected by \n their scientific names, and the selected taxa are at the genus level.\n Please select a different option.");
+ Utilities.MessageDialog(this, "We are sorry; you cannot add the selected taxa to the study set\n because the current study set consists of species selected by \n their scientific names, and the selected taxa are at the genus level.\n Please select a different option.");
}else if((!searchLevel.equalsIgnoreCase(level)) && (level.equals("Species")) && (searchLevel.equals("Common Name")) ){
- JOptionPane.showMessageDialog(this,"We are sorry; you cannot add the selected taxa to the study because the current \nstudy set consists of species selected by their scientific names, and the selected taxa \nare at the species level, selected by common name. Please select a different option.");
+ Utilities.MessageDialog(this, "We are sorry; you cannot add the selected taxa to the study because the current \nstudy set consists of species selected by their scientific names, and the selected taxa \nare at the species level, selected by common name. Please select a different option.");
}else if(exist){
- JOptionPane.showMessageDialog(this,"We are sorry; you cannot add the selected taxa to the study set\n because these taxa are already selected.");
+ Utilities.MessageDialog(this, "We are sorry; you cannot add the selected taxa to the study set\n because these taxa are already selected.");
}
else
{
- mainF.group=false;
+ mainF.group=false;
bt1=true;
int k=mainF.mTaxa.length;
-
-
+
+
String [] mainItems = mainF.mTaxa;
String [] temp = new String[k+Items.length];
for(int i=0;i0){//maxImage is the no of images selected in the advanced options
jLabel1.setText("Advanced Options set, number of images selected: "+maxImages);
- jLabel1.setForeground(Color.red);
+ jLabel1.setForeground(Color.red);
}
/* TableColumn column = null;
for (int i = 0; i < 6; i++) {
column = jTable1.getColumnModel().getColumn(i);
-
+
if (i == 0) {
- column.setPreferredWidth(30);
+ column.setPreferredWidth(30);
} else if (i == 1) {
- column.setPreferredWidth(150);
+ column.setPreferredWidth(150);
}
else {
column.setPreferredWidth(50);
}
- }*/
+ }*/
}
private void initTable(){
-
+
setTitle("Search");
setResizable(false);
jLabel5= new javax.swing.JLabel("Search Item");
jLabel1 = new javax.swing.JLabel();
jTextField1 = new javax.swing.JTextField(10);
-
+
jButton1 = new javax.swing.JButton();
jButton5 = new javax.swing.JButton();
jButton3 = new javax.swing.JButton();
@@ -153,31 +153,31 @@ public void windowClosing(java.awt.event.WindowEvent evt) {
formWindowClosing(evt);
}
});
-
+
jButton1.setText("Search");
jButton5.setText("Add Selected Taxa");
buttonGroup1.add(ch1);
ch1.setText("Genus");
buttonGroup1.add(ch2);
- ch2.setText("Common Name");
+ ch2.setText("Common Name");
jLabel1.setText("");
jButton1.addActionListener(this);
jButton5.addActionListener(this);
jButton3.addActionListener(this);
-
+
jTextField1.setText("");
jTextField1.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyPressed(java.awt.event.KeyEvent evt) {
formKeyPressed(evt);
}
- });
-
+ });
+
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
- jScrollPane1 = new JScrollPane(jTable1);
- add(jScrollPane1);
-
+ jScrollPane1 = new JScrollPane(jTable1);
+ add(jScrollPane1);
+
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
@@ -227,7 +227,7 @@ public void keyPressed(java.awt.event.KeyEvent evt) {
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel1))
);
-
+
pack();
}
@@ -279,16 +279,16 @@ public void windowOpened(java.awt.event.WindowEvent evt) {
private void formWindowOpened(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowOpened
// TODO add your handling code here:
- jTable1.setVisible(false);
+ jTable1.setVisible(false);
}//GEN-LAST:event_formWindowOpened
private void formWindowClosing(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowClosing
// TODO add your handling code here:
-
+
close=true;
this.setVisible(false);
//mainF.showMenuButtons();
-
+
}//GEN-LAST:event_formWindowClosing
private void jTextField2MouseReleased(java.awt.event.MouseEvent evt) {
// TODO add your handling code here:
@@ -300,32 +300,32 @@ private void jTextField1MouseReleased(java.awt.event.MouseEvent evt) {
}
private void formKeyPressed(java.awt.event.KeyEvent evt) {
// TODO add your handling code here:
-
+
int keyCode = evt.getKeyCode();
if (keyCode == KeyEvent.VK_ENTER)
{
String genus="";
String cName="";
if(ch1.isSelected()){
- genus=jTextField1.getText().trim();
+ genus=jTextField1.getText().trim();
}else{
- cName= jTextField1.getText().trim();
+ cName= jTextField1.getText().trim();
}
-
+
try{
if((!ch1.isSelected()) && (!ch2.isSelected()))
{
- JOptionPane.showMessageDialog(this, "Please select one of the check boxes.");
-
+ Utilities.MessageDialog(this, "Please select one of the check boxes.");
+
}
if((genus.isEmpty())&&(cName.isEmpty())) {
-
- JOptionPane.showMessageDialog(this,"Please enter values in the text box.");
+
+ Utilities.MessageDialog(this, "Please enter values in the text box.");
}
else if(ch1.isSelected()&& !genus.isEmpty()) {
search=true;
serchItem(genus);//search by genus
-
+
} else if(ch2.isSelected() && (!cName.isEmpty())) {
search=true;
searchCname(cName);//search by common name
@@ -335,10 +335,10 @@ else if(ch1.isSelected()&& !genus.isEmpty()) {
search=true;
searchCname(cName);
}*/
-
+
}catch(Exception ex){}
-
-
+
+
}
getRootPane().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).
put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE,0), "Cancel");
@@ -350,25 +350,25 @@ public void actionPerformed(ActionEvent e)
}
});
}
-
+
/**
* @param args the command line arguments
*/private void fun(String[] list,String name){
-
-
+
+
for (int i = 0; i < model.getRowCount(); i++) {
-
+
}
for (int i = 0; i < list.length; i++) {
-
+
model.insertRow(i,new Object[] {false,"", list[i],name});//inserting search values to jtable
-
+
}
-
+
}
-
-
+
+
@Override
public void actionPerformed(ActionEvent e) {
@@ -378,25 +378,25 @@ public void actionPerformed(ActionEvent e) {
String genus = "";
String cName = "";
if(ch1.isSelected()){
- genus=jTextField1.getText().trim();
+ genus=jTextField1.getText().trim();
}else{
- cName= jTextField1.getText().trim();
+ cName= jTextField1.getText().trim();
}
-
-
-
+
+
+
try{
if((!ch1.isSelected()) && (!ch2.isSelected()))
{
- JOptionPane.showMessageDialog(this, "Please select one of the check boxes.");
-
+ Utilities.MessageDialog(this, "Please select one of the check boxes.");
+
}else if((genus.isEmpty())&&(cName.isEmpty())) {
- JOptionPane.showMessageDialog(this,"Please enter values in the text box.");
+ Utilities.MessageDialog(this, "Please enter values in the text box.");
}
else if((!genus.isEmpty())&&(cName.isEmpty())) {
search=true;
serchItem(genus);//`search by genus
-
+
} else if((genus.isEmpty())&&(!cName.isEmpty())) {
search=true;
searchCname(cName);//search by common name
@@ -406,50 +406,50 @@ else if((!genus.isEmpty())&&(cName.isEmpty())) {
search=true;
searchCname(cName);
}*/
-
+
}catch(Exception ex){}
-
+
}
else if(e.getSource()==jButton5){
-
+
boolean flag=false;
ArrayList val=new ArrayList();
exist=false;
if(mTaxa !=null)
{
-
+
//if((ch1.isSelected())&&(!jTextField1.getText().isEmpty()))
- if(ch1.isSelected())
- {
+ if(ch1.isSelected())
+ {
searchLevel="Genus";
val=new ArrayList();
for(int i = 0; i < model.getRowCount(); i++) {
if((Boolean)model.getValueAt(i, 0)==true){
-
+
String str=(String)model.getValueAt(i,2 )+" "+(String)model.getValueAt(i,3 );
val.add(str);
boolean isexist = false;
for(int j=0;j0)
+ if(taxa.size()>0)
{
String[] list= db.treeToList(taxa);
addSelectedTaxa(list,taxaLevel,list2);
}else if(search==false)
{
- JOptionPane.showMessageDialog(this,"Cannot add taxa.");
- }else if(val.size()==0)
+ Utilities.MessageDialog(this, "Cannot add taxa.");
+ }else if(val.size()==0)
{
- JOptionPane.showMessageDialog(this,"Please make any selections to add taxa.");
+ Utilities.MessageDialog(this, "Please make any selections to add taxa.");
}
-
+
else if((taxa.size()==0) && (search==true) &&(flag==true)){
-
+
exist=true;
-
+
addSelectedTaxa(list,taxaLevel,list2);
-
+
}
-
+
}
else{
-
+
int count=0;
for(int i = 0; i < model.getRowCount(); i++) {
if((Boolean)model.getValueAt(i, 0)==true){
@@ -530,61 +530,61 @@ else if((taxa.size()==0) && (search==true) &&(flag==true)){
}
if(search==false)
{
- JOptionPane.showMessageDialog(this,"Cannot add taxa.");
+ Utilities.MessageDialog(this, "Cannot add taxa.");
}else if((count==0)){
- JOptionPane.showMessageDialog(this,"Please make any selections to add taxa.");
+ Utilities.MessageDialog(this, "Please make any selections to add taxa.");
}
else{
if(ch1.isSelected())
- {
+ {
searchLevel="Genus";
val=new ArrayList();
for(int i = 0; i < model.getRowCount(); i++) {
-
+
if((Boolean)model.getValueAt(i, 0)==true){
-
+
String str=(String)model.getValueAt(i,2 )+" "+(String)model.getValueAt(i,3 );
val.add(str);
taxa.add(str);
-
+
}
}
} else if(ch2.isSelected())
- {
-
+ {
+
searchLevel="Common Name";
val=new ArrayList();
for(int i = 0; i < model.getRowCount(); i++) {
if((Boolean)model.getValueAt(i, 0)==true){
-
+
String str1=(String)model.getValueAt(i,2 )+" "+(String)model.getValueAt(i,1);
val.add(str1);
-
+
taxa.add(str1);
}
-
- }
+
+ }
}
else{
-
+
searchLevel="Common Name";
val=new ArrayList();
for(int i = 0; i < model.getRowCount(); i++) {
if((Boolean)model.getValueAt(i, 0)==true){
-
+
String str1=(String)model.getValueAt(i,2 )+" "+(String)model.getValueAt(i,1);
val.add(str1);
taxa.add(str1);
-
+
+ }
+
}
-
- }
}
- if(taxa.size()>0)
+ if(taxa.size()>0)
{
- String[] list= db.treeToList(taxa);
+ String[] list= db.treeToList(taxa);
String[] list2= db.treeToList(grptaxa);
-
+
addSelectedTaxa(list,taxaLevel,list2);
mainF.isFromTexaSelect = false;
}
@@ -592,11 +592,11 @@ else if((taxa.size()==0) && (search==true) &&(flag==true)){
}
}
else if(e.getSource()==jButton3){
-
+
this.setVisible(false);
}
-
-
+
+
}
private void addSelectedTaxa(String[] list,String level,String[] list2){
SearchRes rs=new SearchRes(this.mainF,this,searchLevel,level,exist);
@@ -605,145 +605,145 @@ private void addSelectedTaxa(String[] list,String level,String[] list2){
rs.setItems2(list2);
rs.setLocationRelativeTo(this);
rs.setVisible(true);
-
+
}
public String[] returntaxa()
- {
- return txasel;
-
+ {
+ return txasel;
+
}
private void Cnfun(String[] family, String[] list, String[] species,String[] CN1, String[] CN2, String[] CN3, String[] CN4,String com) {
-
+
Object[] columns = new Object[] {"Select","CommonName", "Family","Genus","Species","CommonName2"};
-
+
TableColumn column = null;
for (int i = 0; i < 6; i++) {
column = jTable1.getColumnModel().getColumn(i);
-
+
if (i == 0) {
- column.setPreferredWidth(30);
+ column.setPreferredWidth(30);
} else if (i == 1) {
- column.setPreferredWidth(90);
+ column.setPreferredWidth(90);
}else if (i == 4) {
- column.setPreferredWidth(70);
+ column.setPreferredWidth(70);
}else if (i == 5) {
- column.setPreferredWidth(60);
+ column.setPreferredWidth(60);
}
else {
column.setPreferredWidth(50);
}
}
-
+
for (int i = 0; i < list.length; i++) {
if(list[i]!=null){
/* if(com.equals("Com3")){
- model.insertRow(i,new Object[] {false,CN1[i], family[i],list[i],species[i],CN3[i]});
+ model.insertRow(i,new Object[] {false,CN1[i], family[i],list[i],species[i],CN3[i]});
}
else if(com.equals("Com4")){
- model.insertRow(i,new Object[] {false,CN1[i], family[i],list[i],species[i],CN4[i]});
+ model.insertRow(i,new Object[] {false,CN1[i], family[i],list[i],species[i],CN4[i]});
}else*/
model.insertRow(i,new Object[] {false,CN1[i], family[i],list[i],species[i],CN2[i]});
}
}
-
+
}
-
+
void AddSelected(String[] mTaxa,String taxal) {
// throw new UnsupportedOperationException("Not yet implemented");
if(taxal!=null){
for(int i=0;i=0; i--) {
model.removeRow(i);
-
- }
+
+ }
model.getDataVector().removeAllElements();
-
- model.fireTableDataChanged();
-
+
+ model.fireTableDataChanged();
+
jTable1.repaint();
- JOptionPane.showMessageDialog(this,"No matching item found.");
+ Utilities.MessageDialog(this, "No matching item found.");
}
else
{
try{
for (int i = model.getRowCount()-1; i >=0; i--) {
model.removeRow(i);
- }
+ }
model.getDataVector().removeAllElements();
-
- model.fireTableDataChanged();
-
+
+ model.fireTableDataChanged();
+
jTable1.repaint();
-
- String[] name = db.treeToList(gList);
-
+
+ String[] name = db.treeToList(gList);
+
for( int i=0;i=0; i--) {
model.removeRow(i);
-
- }
+
+ }
model.getDataVector().removeAllElements();
-
- model.fireTableDataChanged();
-
+
+ model.fireTableDataChanged();
+
jTable1.repaint();
- JOptionPane.showMessageDialog(this, "No matching item found.");
+ Utilities.MessageDialog(this, "No matching item found.");
}
else{
-
-
+
+
try{
for (int i = model.getRowCount()-1; i >=0; i--) {
model.removeRow(i);
- }
+ }
model.getDataVector().removeAllElements();
- model = new DefaultTableModel(data, columns);
- model.fireTableDataChanged();
-
- jTable1.setModel(model);
- tc = jTable1.getColumnModel().getColumn(0);
- tc.setCellEditor(jTable1.getDefaultEditor(Boolean.class));
+ model = new DefaultTableModel(data, columns);
+ model.fireTableDataChanged();
+
+ jTable1.setModel(model);
+ tc = jTable1.getColumnModel().getColumn(0);
+ tc.setCellEditor(jTable1.getDefaultEditor(Boolean.class));
tc.setCellRenderer(jTable1.getDefaultRenderer(Boolean.class));
jTable1.repaint();
-
+
int p=0;int idx=0,cn1,cn2=0,cn3=0,cn4=0; int count=0;
- String[] name = db.treeToList(cList);
+ String[] name = db.treeToList(cList);
cn1=db.GetIndex2("common name");
cn2=db.GetIndex2("common name 2");
cn3=db.GetIndex2("common name 3");
cn4=db.GetIndex2("common name 4");
-
+
if(AndFlag){
//selected common name size is stored in count
if(c1)
@@ -1135,46 +1135,46 @@ else if(single){
if(c3)
count=count+cList.size();
if(c4)
- count=count+cList.size();
-
+ count=count+cList.size();
+
}
- else if(one){
-
+ else if(one){
+
if(c1){
count=count+cList.size();
- name = db.treeToList(cList);
+ name = db.treeToList(cList);
}
if(c2){
count=count+cList2.size();
- name = db.treeToList(cList2);
+ name = db.treeToList(cList2);
}
if(c3){
count=count+cList3.size();
- name = db.treeToList(cList3);
+ name = db.treeToList(cList3);
}
if(c4){
count=count+cList4.size();
- name = db.treeToList(cList4);
+ name = db.treeToList(cList4);
}
} else if(many){
count=total;//if search result is many then total is assigned to count
}
else{
-
+
count=name.length;}
-
- String[] genlist = new String[count];
+
+ String[] genlist = new String[count];
String[] species=new String[count];
- String[] family=new String[count];
+ String[] family=new String[count];
String[] CN2=new String[count];
String[] CN1=new String[count];
String[] CN3=new String[count];
String[] CN4=new String[count];
-
+
String com="";
-
+
if(AndFlag){
-
+
ArrayList a1=new ArrayList();
ArrayList a2=new ArrayList();
ArrayList a3=new ArrayList();
@@ -1183,30 +1183,30 @@ else if(one){
ArrayList a6=new ArrayList();
ArrayList a7=new ArrayList();
int j=0;
-
+
if(c1){
-
+
// idx=-15;
idx=cn1;
String[] name1 = db.treeToList(cList);
j=name1.length;
ArrayList sel=new ArrayList();
-
+
for(int i=0;i 5) {
this.setSize(1000, 537);
jButton1.setBounds(501, 460, 60, 35);
- jScrollPaneGroups.setSize(980, 280);
+ jScrollPaneGroups.setSize(980, 280);
}
for (int j = 0; j < header.size(); j++) {
if (j == 0) {
@@ -345,7 +344,7 @@ private ArrayList getGroupValues(JList groupList) {
}
return selection;
}
-
+
public void calcTotalImage(JList hh, ArrayList header) {
int total = 0;
int j = 0;
@@ -532,7 +531,7 @@ public void calcTotalImage(JList hh, ArrayList header) {
modelAddAlpha(currentModel, newData, numChecked, currentModel.getSize() - 1);
}
}
-
+
}
// Now that only the appropriate values are being shown, check to
@@ -561,7 +560,7 @@ public void calcTotalImage(JList hh, ArrayList header) {
for (Object diffObj : diffResults) {
diff = (ArrayList) diffObj;
diffVals = diff.get(1).toString();
- diffMessage += (String) diff.get(0) + ": " + diffVals.substring(1, diffVals.length() - 1) + "\n";
+ diffMessage += (String) diff.get(0) + ": " + diffVals.substring(1, diffVals.length() - 1) + "\n";
}
JDialog diffDialog = new DiffDialog((Dialog) this, true, diffMessage);
diffDialog.setLocationRelativeTo(this);
@@ -624,7 +623,7 @@ private void LoadExtraGroup(String header, JList groupList) {
groupList.setVisible(true);
groupList.validate();
}
-
+
private void LoadSubject(String header) {
DefaultListModel listModel = new DefaultListModel();
String[] subject = db.getValues(header);
@@ -735,37 +734,37 @@ private void LoadPhoto_type(String header) {
}
/*private void LoadSubject()
{
- DefaultListModel listModel = new DefaultListModel();
+ DefaultListModel listModel = new DefaultListModel();
String[] subject = db.getValues("subject");
for(int i = 0; i < subject.length; i++)
- {
- listModel.addElement(new InstallData(subject[i]));
-
+ {
+ listModel.addElement(new InstallData(subject[i]));
+
}
- this.list1.setModel(listModel);
+ this.list1.setModel(listModel);
CheckListCellRenderer renderer = new CheckListCellRenderer();
list1.setCellRenderer(renderer);
list1.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
CheckListener lst = new CheckListener(this,list1);
list1.addMouseListener(lst);
- list1.addKeyListener(lst);
-
+ list1.addKeyListener(lst);
+
}
private void LoadGroup()
{
- DefaultListModel listModel = new DefaultListModel();
+ DefaultListModel listModel = new DefaultListModel();
String[] group = db.getValues("Group");
for(int i = 0; i < group.length; i++)
{
- listModel.addElement(new InstallData(group[i]));
+ listModel.addElement(new InstallData(group[i]));
}
- this.list2.setModel(listModel);
+ this.list2.setModel(listModel);
CheckListCellRenderer renderer = new CheckListCellRenderer();
list2.setCellRenderer(renderer);
list2.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
CheckListener lst = new CheckListener(this,list2);
list2.addMouseListener(lst);
- list2.addKeyListener(lst);
+ list2.addKeyListener(lst);
}
private void LoadOrigin()
{
@@ -773,15 +772,15 @@ private void LoadOrigin()
String[] origin = db.getValues("origin");
for(int i = 0; i < origin.length; i++)
{
- listModel.addElement(new InstallData(origin[i]));
+ listModel.addElement(new InstallData(origin[i]));
}
- this.list3.setModel(listModel);
+ this.list3.setModel(listModel);
CheckListCellRenderer renderer = new CheckListCellRenderer();
list3.setCellRenderer(renderer);
list3.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
CheckListener lst = new CheckListener(this,list3);
list3.addMouseListener(lst);
- list3.addKeyListener(lst);
+ list3.addKeyListener(lst);
}
private void LoadForm()
{
@@ -789,15 +788,15 @@ private void LoadForm()
String[] form = db.getValues("form");
for(int i = 0; i < form.length; i++)
{
- listModel.addElement(new InstallData(form[i]));
+ listModel.addElement(new InstallData(form[i]));
}
- this.list4.setModel(listModel);
+ this.list4.setModel(listModel);
CheckListCellRenderer renderer = new CheckListCellRenderer();
list4.setCellRenderer(renderer);
list4.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
CheckListener lst = new CheckListener(this,list4);
list4.addMouseListener(lst);
- list4.addKeyListener(lst);
+ list4.addKeyListener(lst);
}
private void LoadUse()
{
@@ -805,9 +804,9 @@ private void LoadUse()
String[] use = db.getValues("use");
for(int i = 0; i < use.length; i++)
{
- listModel.addElement(new InstallData(use[i]));
+ listModel.addElement(new InstallData(use[i]));
}
- this.list5.setModel(listModel);
+ this.list5.setModel(listModel);
CheckListCellRenderer renderer = new CheckListCellRenderer();
list5.setCellRenderer(renderer);
list5.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
@@ -821,15 +820,15 @@ private void LoadPhoto_type()
String[] phototype = db.getValues("Photo-Type");
for(int i = 0; i < phototype.length; i++)
{
- listModel.addElement(new InstallData(phototype[i]));
+ listModel.addElement(new InstallData(phototype[i]));
}
- this.list6.setModel(listModel);
+ this.list6.setModel(listModel);
CheckListCellRenderer renderer = new CheckListCellRenderer();
list6.setCellRenderer(renderer);
list6.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
CheckListener lst = new CheckListener(this,list6);
list6.addMouseListener(lst);
- list6.addKeyListener(lst);
+ list6.addKeyListener(lst);
}*/
/**
@@ -1078,7 +1077,7 @@ public void valueChanged(javax.swing.event.ListSelectionEvent evt) {
private void jButton1KeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jButton1KeyPressed
// TODO add your handling code here:
if (imageCount == 0) {
- JOptionPane.showMessageDialog(this, "There are currently no images selected.");
+ Utilities.MessageDialog(this, "There are currently no images selected.");
return;
} else {
this.setVisible(false);
@@ -1092,12 +1091,12 @@ private void jButton1MouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:e
imagecountLabel.setText("Total number of images selected: ");
count.setText("0");
count.setForeground(Color.red);
- JOptionPane.showMessageDialog(this, "There are currently no images selected. \n Press escape to close the dialogue box without saving your selections.");
+ Utilities.MessageDialog(this, "There are currently no images selected. \n Press escape to close the dialogue box without saving your selections.");
//this.setVisible(false);
return;
} else if ((!ch1.isSelected()) && (!ch2.isSelected()) && (!ch3.isSelected()) && (!ch4.isSelected())) {
- JOptionPane.showMessageDialog(this, "Please select one of the \"Select by\" check boxes below to determine what you'll be quizzed on.");
+ Utilities.MessageDialog(this, "Please select one of the \"Select by\" check boxes below to determine what you'll be quizzed on.");
} else {
select = true;
@@ -1152,7 +1151,7 @@ private void formKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_form
private void extraListValueChanged(javax.swing.event.ListSelectionEvent evt, JList currList) {
list1.getCellRenderer().getListCellRendererComponent(currList, currList.getSelectedValue(), currList.getSelectedIndex(), true, true);
}
-
+
private void list1ValueChanged(javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_list1ValueChanged
// TODO add your handling code here:
list1.getCellRenderer().getListCellRendererComponent(list1, list1.getSelectedValue(), list1.getSelectedIndex(), true, true);
@@ -1273,7 +1272,7 @@ private int getCheckedCount(DefaultListModel model) {
}
return total;
}
-
+
protected void doCheck() {
int min, max;
int index = m_list.getSelectedIndex();
@@ -1283,9 +1282,9 @@ protected void doCheck() {
DefaultListModel model = (DefaultListModel) m_list.getModel();
InstallData data = (InstallData) model.getElementAt(index);
data.invertSelected();
-
+
model.remove(index);
-
+
if (data.m_selected) {
min = 0;
max = getCheckedCount(model) - 1;
@@ -1300,7 +1299,7 @@ protected void doCheck() {
index = model.indexOf(data);
m_list.ensureIndexIsVisible(index);
}
-
+
m_list.repaint();
}
}
diff --git a/src/main/java/scripteditor/SelectSpecies.java b/src/main/java/scripteditor/SelectSpecies.java
index da17518..2baa133 100755
--- a/src/main/java/scripteditor/SelectSpecies.java
+++ b/src/main/java/scripteditor/SelectSpecies.java
@@ -40,10 +40,10 @@
*
* @author Preethy
* This dialog box is used to select species based on family names.
- *
+ *
*/
public class SelectSpecies extends javax.swing.JDialog {
-
+
String mTaxaLevel;
DataBaseDriver db;
ArrayList families = new ArrayList();
@@ -53,17 +53,17 @@ public class SelectSpecies extends javax.swing.JDialog {
public boolean CommonNames=false;
public static boolean esc=false;
String [] genus;
-
+
String[][] fileNames;
int adv_options=0;
public SelectSpecies(DataBaseDriver db_driver,int maxImages){
-
+
initComponents();//two hidden list boxes list3 and listSelections
addEscapeListener(this);
this.list1.setMultipleMode(true);
LoadFamilies();
adv_options=maxImages;
-
+
if(adv_options>0){
label_advanced_optns.setText("Advanced Options set, number of images selected: "+adv_options);
label_advanced_optns.setForeground(Color.red);
@@ -76,12 +76,12 @@ private void LoadFamilies()
for(int i = 0; i < families.length; i++)
list1.add(families[i]);
}
-
+
private String[] LoadGenus(String[] family)
{
DataBaseDriver db = new DataBaseDriver(Configuration.DataBaseName());
String[] genus = db.getGenus2(family);
-
+
for(int i = 0; i < genus.length; i++)
fm=db.fm;
return genus;
@@ -96,7 +96,7 @@ private void LoadSpecies(String[] family,String[] genus){
if(ch2.isSelected())
{
CommonNames=true;
- s = db.getCommonName2(genus);
+ s = db.getCommonName2(genus);
}
gen=db.gen;
list3.removeAll();
@@ -106,16 +106,16 @@ private void LoadSpecies(String[] family,String[] genus){
public String[] getItems()
{
String[] items = listSelections.getItems();
-
+
return items;//return selected taxa
}
public String getTaxaLevel(){
if(ch1.isSelected())
return "Species";
- else
+ else
return "Common Name";
}
-
+
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
@@ -293,11 +293,11 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
pack();
}// //GEN-END:initComponents
-
+
private void ch1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_ch1MouseClicked
// TODO add your handling code here:
// String[] mTaxa;
- // String taxonomicLevel;
+ // String taxonomicLevel;
if(ch1.isSelected())
{
list3.removeAll();
@@ -315,7 +315,7 @@ private void ch1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_c
private void ch2MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_ch2MouseClicked
// TODO add your handling code here:
// String[] mTaxa;
- // String taxonomicLevel;
+ // String taxonomicLevel;
if(ch2.isSelected())
{
list3.removeAll();
@@ -328,60 +328,60 @@ private void ch2MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_c
// fileNames=db.getFileNames(taxonomicLevel, mTaxa, false, 0);
// image_count.setText("Total number of images selected :"+fileNames.length);
// image_count.setForeground(Color.red);
-
+
}//GEN-LAST:event_ch2MouseClicked
private void ch1ItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_ch1ItemStateChanged
// TODO add your handling code here:
-
+
}//GEN-LAST:event_ch1ItemStateChanged
private void list1MouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_list1MouseReleased
// TODO add your handling code here:
list3.removeAll();
genus= LoadGenus(list1.getSelectedItems());
-
+
}//GEN-LAST:event_list1MouseReleased
private void formWindowOpened(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowOpened
// TODO add your handling code here:
-
+
}//GEN-LAST:event_formWindowOpened
private void ch2StateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_ch2StateChanged
// TODO add your handling code here:
-
+
}//GEN-LAST:event_ch2StateChanged
private void ch1StateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_ch1StateChanged
// TODO add your handling code here:
-
+
}//GEN-LAST:event_ch1StateChanged
private void jButton1MouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jButton1MouseReleased
// TODO add your handling code here:
if((!ch1.isSelected()) && (!ch2.isSelected()))
{
- JOptionPane.showMessageDialog(this, "Please select one of the check boxes.");
-
+ Utilities.MessageDialog(this, "Please select one of the check boxes.");
+
}if(((ch1.isSelected()) || (ch2.isSelected())) && (list1.getSelectedItems().length==0))
{
- JOptionPane.showMessageDialog(this, "Please make any selections.");
+ Utilities.MessageDialog(this, "Please make any selections.");
}
- else if(((ch1.isSelected()) || (ch2.isSelected())) && (list1.getSelectedItems().length!=0))
+ else if(((ch1.isSelected()) || (ch2.isSelected())) && (list1.getSelectedItems().length!=0))
{
LoadSpecies(list1.getSelectedItems(),genus);
addFromList(list3);
this.setVisible(false);
}
-
+
}//GEN-LAST:event_jButton1MouseReleased
private void countImage(){
- if(((ch1.isSelected()) || (ch2.isSelected())) && (list1.getSelectedItems().length!=0))
+ if(((ch1.isSelected()) || (ch2.isSelected())) && (list1.getSelectedItems().length!=0))
{
LoadSpecies(list1.getSelectedItems(),genus);
addFromList(list3);
-
+
}
}
private void addFromList(java.awt.List list)
@@ -389,7 +389,7 @@ private void addFromList(java.awt.List list)
String selectedSpecies = "";
String cname="";
String[] selections = list.getItems();
-
+
for(int i = 0; i < selections.length; i++){
for(int j=0;j0)
{
- JOptionPane.showMessageDialog(mPanel, "Images specified in the database are missing in images folder. Add images to continue.");
+ Utilities.MessageDialog(mPanel, "Images specified in the database are missing in images folder. Add images to continue.");
mForm2.showMenuButtons();
}
-
+
}
/**/
}
-
+
public void setDisplayTime(double t){
imageDisplayTime = t;
}
-
+
public void setFixationTime(double t){
mFixationTime = t;
}
-
+
public void setImageWithName(boolean b){
imageWithName = b;
}
-
+
public void setAutoRun(boolean b){
autoRun = b;
}
-
+
public void stopStudying(){
Running = false;
mDisplayLabel.setIcon(null);
mDisplayLabel.setText("");
mDisplayLabel.removeAll();
}
-
+
public void keyHit(){
mNaiContinue = true;
}
-
+
public boolean nextImage(){// Returns a boolean telling if there are anymore next Images.
boolean isMore = false;
try {
isMore = myCollection.MoveNext();
-
+
} catch(Exception npe) {
//npe.printStackTrace();
String retmsg = npe.toString();
String msg = npe.getMessage();
if(retmsg.contains("NullPointerException"))
msg = "Images specified in the database are missing in images folder. Add images to continue.";
- JOptionPane.showMessageDialog(mForm, msg);
+ Utilities.MessageDialog(mForm, msg);
return false;
}
Image tempImage;
if(isMore == true){
-
+
tempImage = ImageScaler.VerifyImageSize(myCollection.getCurrentImage().getImage(), (int) ddd.getWidth(), (int) ddd.getHeight(), mDisplayLabel);
mDisplayLabel.setIcon(new ImageIcon(tempImage));
-
-
+
+
if(autoRun || (!autoRun && imageWithName)){
-
+
setImageName(mNameLabel, getParsedName(getImageName()), mNameLabelY);
}
if(mShowFamily){
-
+
String temp = getImageName();
setImageName(mFamilyLabel, temp.substring(0, temp.indexOf(' ')), mFamilyLabelY);
if(imageWithName){
@@ -220,15 +220,15 @@ public void setImageName(JLabel lbl, String txt, int labelY){
int width = (int)(3 * lbl.getFont().getSize() / 5.0 * (txt.length() + 4));
lbl.setLocation(xCenter - width/2, labelY);
lbl.setSize(width, mNameLabelHeight);
-
+
lbl.setText(txt);
-
+
}
-
+
public String getImageName(){
return myCollection.getImageName();
}
-
+
public void prevImage(){
boolean isMore = myCollection.MovePrevious();
Image tempImage;
@@ -236,17 +236,17 @@ public void prevImage(){
tempImage = ImageScaler.VerifyImageSize(myCollection.getCurrentImage().getImage(), (int) ddd.getWidth(), (int) ddd.getHeight(), mDisplayLabel);
mDisplayLabel.setIcon(new ImageIcon(tempImage));
if(imageWithName){
-
+
setImageName(mNameLabel, getParsedName(getImageName()), mNameLabelY);
}
if(mShowFamily){
-
+
String temp = getImageName();
setImageName(mFamilyLabel, temp.substring(0, temp.indexOf(' ')), mFamilyLabelY);
}
}
}
-
+
@SuppressWarnings("empty-statement")
private void JCDelay(double de) {
de = de * 1000;
@@ -257,13 +257,13 @@ private void JCDelay(double de) {
if(mPaused == true)
break;
-
+
}
}
-
-
+
+
private void AutoRunning(){
//Load name label
//Add to DisplayLabel
@@ -286,7 +286,7 @@ private void AutoRunning(){
mFamilyLabel.setHorizontalAlignment(JLabel.CENTER);
Font myFont2 = new Font("Tahoma", Font.BOLD, 30);
mFamilyLabel.setFont(myFont2);
-
+
String temp = getImageName();
mFamilyLabel.setSize(mForm.getWidth(), 30);
// depending on the mode put the Family name up of center
@@ -295,13 +295,13 @@ private void AutoRunning(){
}
else
mFamilyLabelY = (int)(dd.getHeight() / 2) - mNameLabel.getHeight();
-
-
-
+
+
+
mFamilyLabel.setOpaque(true);
mDisplayLabel.add(mFamilyLabel);
setImageName(mFamilyLabel, temp.substring(0, temp.indexOf(' ')), mFamilyLabelY);
- }
+ }
mDisplayLabel.setHorizontalAlignment(JLabel.CENTER);
mDisplayLabel.setText("+");
JCDelay(mFixationTime);
@@ -309,7 +309,7 @@ private void AutoRunning(){
mDisplayLabel.setVisible(false); //////// Optimizing
tempImage = ImageScaler.VerifyImageSize(myCollection.getCurrentImage().getImage(), (int) ddd.getWidth(), (int) ddd.getHeight(), mDisplayLabel);
mDisplayLabel.setIcon(new ImageIcon(tempImage));
-
+
String tempName = myCollection.getImageName();
int idx = tempName.indexOf(' ');
// Need if Statement here for NameLabel;
@@ -318,7 +318,7 @@ private void AutoRunning(){
// }
// else
setImageName(mNameLabel, getParsedName(tempName), mNameLabelY);
-
+
if(imageWithName){
mNameLabel.setVisible(true);
}
@@ -326,7 +326,7 @@ private void AutoRunning(){
setImageName(mFamilyLabel, tempName.substring(0, idx), mFamilyLabelY);
mFamilyLabel.setVisible(true);
}
- mDisplayLabel.setVisible(true);
+ mDisplayLabel.setVisible(true);
JCDelay(imageDisplayTime);
mDisplayLabel.setIcon(null);
if(mShowFamily && imageWithName){
@@ -363,8 +363,8 @@ private void AutoRunning(){
//System.out.println("run :"+Running);
while(Running)
{
-
- // System.out.println("while======");
+
+ // System.out.println("while======");
// Fixation Point
while(mPaused == true && Running == true)
{
@@ -372,15 +372,15 @@ private void AutoRunning(){
StudyImageClass.sleep(10);
} catch(InterruptedException e){}
}
-
-
+
+
if(Running == false)
break;
mDisplayLabel.setIcon(null);
if(mShowFamily && imageWithName){
mFamilyLabel.setVisible(false);
}
-
+
mDisplayLabel.setText("");
mDisplayLabel.setText("+");
JCDelay(mFixationTime);
@@ -390,7 +390,7 @@ private void AutoRunning(){
if(Running == false){
break;
}
-
+
if(imageWithName){
mNameLabel.setVisible(true);
}
@@ -400,7 +400,7 @@ private void AutoRunning(){
if(imageWithName){
mNameLabel.setVisible(false);
}
-
+
if(imageWithName == false){
//mDisplayLabel.setIcon(null); //clear the image
if(mShowFamily){// && imageWithName){
@@ -420,7 +420,7 @@ private void AutoRunning(){
try{
StudyImageClass.sleep(10);
} catch(InterruptedException e){}
- }
+ }
}
mNaiContinue = false;
if(mShowFamily){
@@ -428,7 +428,7 @@ private void AutoRunning(){
}
mNameLabel.setVisible(false);
}
-
+
try {
Thread.sleep(10);
} catch (InterruptedException e){ }
@@ -436,24 +436,24 @@ private void AutoRunning(){
mDisplayLabel.removeAll();
mDisplayLabel.setVisible(true);
}
-
+
public boolean nextImageQ(){// Returns a boolean telling if there are anymore next Images.
boolean isMore = false;
try {
isMore = myCollection.MoveNext();
-
+
} catch(NullPointerException npe) {
String msg = npe.getMessage();
- JOptionPane.showMessageDialog(mForm, msg);
+ Utilities.MessageDialog(mForm, msg);
return false;
}
Image tempImage;
if(isMore == true){
tempImage = ImageScaler.VerifyImageSize(myCollection.getCurrentImage().getImage(), (int) ddd.getWidth(), (int) ddd.getHeight(), mDisplayLabel);
mDisplayLabel.setIcon(new ImageIcon(tempImage));
-
+
setImageName(mNameLabel, getParsedName(getImageName()), mNameLabelY);
-
+
String temp = getImageName();
setImageName(mFamilyLabel, temp.substring(0, temp.indexOf(' ')), mFamilyLabelY);
return true;
@@ -480,7 +480,7 @@ private void AutoRunningQ() {
mFamilyLabel.setHorizontalAlignment(JLabel.CENTER);
Font myFont2 = new Font("Tahoma", Font.BOLD, 30);
mFamilyLabel.setFont(myFont2);
-
+
String temp = getImageName();
mFamilyLabel.setSize(mForm.getWidth(), 30);
// depending on the mode put the Family name up of center
@@ -496,7 +496,7 @@ private void AutoRunningQ() {
mDisplayLabel.setVisible(false); //////// Optimizing
tempImage = ImageScaler.VerifyImageSize(myCollection.getCurrentImage().getImage(), (int) ddd.getWidth(), (int) ddd.getHeight(), mDisplayLabel);
mDisplayLabel.setIcon(new ImageIcon(tempImage));
-
+
String tempName = myCollection.getImageName();
int idx = tempName.indexOf(' ');
setImageName(mNameLabel, getParsedName(tempName), mNameLabelY);
@@ -557,14 +557,14 @@ private void AutoRunningQ() {
mDisplayLabel.setVisible(true);
}
-
+
private void setStandardNameLabel(){
mNameLabel = new JLabel();
mNameLabel.setVisible(false);
mNameLabel.setHorizontalAlignment(JLabel.CENTER);
Font myFont;
if(mTlevel.equals("Genus")||(mTlevel.equals("Species"))){
- myFont = new Font("Tahoma", Font.ITALIC, 30);
+ myFont = new Font("Tahoma", Font.ITALIC, 30);
}else{
myFont = new Font("Tahoma", Font.BOLD, 30);
}
@@ -574,7 +574,7 @@ private void setStandardNameLabel(){
mNameLabel.setOpaque(true);
mDisplayLabel.add(mNameLabel);
}
-
+
private void ManuelRun(){
Image tempImage;
if(imageWithName){
@@ -584,7 +584,7 @@ private void ManuelRun(){
dd = mDisplayLabel.getSize();
mNameLabelY = 200 + (int)ddd.getHeight() / 2;
xCenter = (int)dd.getWidth() / 2;
-
+
setImageName(mNameLabel, getParsedName(getImageName()), mNameLabelY);
mNameLabel.setVisible(true);
// Label for Family name at top of screen
@@ -594,7 +594,7 @@ private void ManuelRun(){
mFamilyLabel.setHorizontalAlignment(JLabel.CENTER);
Font myFont2 = new Font("Tahoma", Font.BOLD, 30);
mFamilyLabel.setFont(myFont2);
-
+
String temp = getImageName();
mFamilyLabel.setSize(mForm.getWidth(), 30);
mFamilyLabel.setOpaque(true);
@@ -615,18 +615,18 @@ private void ManuelRun(){
if(mShowFamily)
mDisplayLabel.remove(mFamilyLabel);
}
-
+
public void paused(boolean pause){
mPaused = pause;
}
-
+
public void setKeyToContinue(boolean temp){
mKeyToContinue = temp;
}
-
+
private String getParsedName(String temp){
int index = 0;
-
+
if(mTlevel.compareTo("Family") != 0){
index = temp.indexOf(' ');
temp = temp.substring(index + 1, temp.length());
@@ -634,5 +634,3 @@ private String getParsedName(String temp){
return temp;
}
}
-
-
diff --git a/src/main/java/scripteditor/Utilities.java b/src/main/java/scripteditor/Utilities.java
index 60f2d87..4054283 100755
--- a/src/main/java/scripteditor/Utilities.java
+++ b/src/main/java/scripteditor/Utilities.java
@@ -27,20 +27,29 @@
import java.io.FileNotFoundException;
import java.io.IOException;
+import javax.swing.*;
+import java.awt.*;
+
/**
*
* @author bpurcell
*/
public class Utilities {
- static String OSType = "MAC"; //"MAC" "PC"
+ //static String OSType = "MAC"; //"MAC" "PC"
+
+ public static boolean IsWindows() {
+ String os = System.getProperty("os.name").toLowerCase();
+ return os.contains("win");
+ }
public static void OpenExternalFile(String path) throws IOException {
- String cmd = "";
- if (OSType.compareToIgnoreCase("MAC") == 0) {
- cmd = "open ".concat(path);
+ String cmd[];
+ //if (OSType.compareToIgnoreCase("MAC") == 0) {
+ if(!IsWindows()) {
+ cmd = new String[] {"open", path};
} else {
- cmd = "cmd /c start ".concat(path);
+ cmd = new String[] {"cmd", "/c", "start \"\" \"" + path + "\""};
}
if (new File(path).exists() == false) {
@@ -51,4 +60,18 @@ public static void OpenExternalFile(String path) throws IOException {
Runtime.getRuntime().exec(cmd);
}
+
+ public static void MessageDialog(Component component, String message) {
+ ImageIcon dialogIcon = new ImageIcon(Configuration.ApplicationPath() + "/Graphics/icon.png");
+ String appDisplayName = ConfigFileReader.getProjectName();
+
+ JOptionPane.showMessageDialog(component, message, appDisplayName, JOptionPane.INFORMATION_MESSAGE, dialogIcon);
+ }
+
+ public static int ConfirmDialog(Component component, String message, String title) {
+ ImageIcon dialogIcon = new ImageIcon(Configuration.ApplicationPath() + "/Graphics/icon.png");
+
+ return JOptionPane.showConfirmDialog(component, message, title, JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, dialogIcon);
+ }
+
}
diff --git a/src/main/java/scripteditor/dlgEqualize.java b/src/main/java/scripteditor/dlgEqualize.java
index b79fe2b..08d8b37 100755
--- a/src/main/java/scripteditor/dlgEqualize.java
+++ b/src/main/java/scripteditor/dlgEqualize.java
@@ -29,23 +29,23 @@
* @author Ben
*/
public class dlgEqualize extends javax.swing.JDialog {
-
+
int mMax;
int mPsize = -1;
-
-
+
+
/** Creates new form dlgEqualize */
public dlgEqualize() {
initComponents();
-
+
}
-
+
public void setMax(int max){
mMax = max;
this.jLabel2.setText("The maximum number that can be entered is " + String.valueOf(mMax));
}
-
-
+
+
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
@@ -135,32 +135,32 @@ public void mouseReleased(java.awt.event.MouseEvent evt) {
}// //GEN-END:initComponents
private void formWindowClosing(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowClosing
-
+
}//GEN-LAST:event_formWindowClosing
private void jButton1MouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jButton1MouseReleased
String temp = jTextField1.getText();
mPsize = Integer.parseInt(temp);
if(mPsize > mMax){
- javax.swing.JOptionPane.showMessageDialog(this, "The value entered is over the max allowed.");
+ Utilities.MessageDialog(this, "The value entered is over the max allowed.");
return;
}
-
+
this.setVisible(false);
}//GEN-LAST:event_jButton1MouseReleased
private void jButton2MouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jButton2MouseReleased
this.setVisible(false);
}//GEN-LAST:event_jButton2MouseReleased
-
+
public int getPsize(){
return mPsize;
}
/**
* @param args the command line arguments
*/
-
-
+
+
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton jButton1;
private javax.swing.JButton jButton2;
@@ -169,5 +169,5 @@ public int getPsize(){
private javax.swing.JLabel jLabel3;
private javax.swing.JTextField jTextField1;
// End of variables declaration//GEN-END:variables
-
+
}
diff --git a/src/main/java/scripteditor/dlgEqualize_1.java b/src/main/java/scripteditor/dlgEqualize_1.java
index 3068995..61eac87 100755
--- a/src/main/java/scripteditor/dlgEqualize_1.java
+++ b/src/main/java/scripteditor/dlgEqualize_1.java
@@ -29,23 +29,23 @@
* @author Ben
*/
public class dlgEqualize_1 extends javax.swing.JDialog {
-
+
int mMax;
int mPsize = -1;
-
-
+
+
/** Creates new form dlgEqualize */
public dlgEqualize_1() {
initComponents();
-
+
}
-
+
public void setMax(int max){
mMax = max;
this.jLabel2.setText("The maximum number that can be entered is " + String.valueOf(mMax));
}
-
-
+
+
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
@@ -135,32 +135,32 @@ public void mouseReleased(java.awt.event.MouseEvent evt) {
}// //GEN-END:initComponents
private void formWindowClosing(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowClosing
-
+
}//GEN-LAST:event_formWindowClosing
private void jButton1MouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jButton1MouseReleased
String temp = jTextField1.getText();
mPsize = Integer.parseInt(temp);
if(mPsize > mMax){
- javax.swing.JOptionPane.showMessageDialog(this, "The value entered is over the max allowed.");
+ Utilities.MessageDialog(this, "The value entered is over the max allowed.");
return;
}
-
+
this.setVisible(false);
}//GEN-LAST:event_jButton1MouseReleased
private void jButton2MouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jButton2MouseReleased
this.setVisible(false);
}//GEN-LAST:event_jButton2MouseReleased
-
+
public int getPsize(){
return mPsize;
}
/**
* @param args the command line arguments
*/
-
-
+
+
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton jButton1;
private javax.swing.JButton jButton2;
@@ -169,5 +169,5 @@ public int getPsize(){
private javax.swing.JLabel jLabel3;
private javax.swing.JTextField jTextField1;
// End of variables declaration//GEN-END:variables
-
+
}
diff --git a/src/main/java/scripteditor/dlgSessionCommand.java b/src/main/java/scripteditor/dlgSessionCommand.java
index 111fbcf..04b1a94 100755
--- a/src/main/java/scripteditor/dlgSessionCommand.java
+++ b/src/main/java/scripteditor/dlgSessionCommand.java
@@ -43,17 +43,17 @@ public dlgSessionCommand() {
Image image=null;
try {
image=ImageIO.read(new File(Configuration.ApplicationPath() + "/Graphics/icon.jpg"));
- // image=ImageIO.read(new File(Configuration.UserPath() + "/Graphics/icon.jpg"));
+ // image=ImageIO.read(new File(Configuration.UserPath() + "/Graphics/icon.jpg"));
} catch (IOException ex) {
Logger.getLogger(dlgSessionCommand.class.getName()).log(Level.SEVERE, null, ex);
}
setIconImage(image);
//this.requestFocusInWindow();
jButton1.requestFocus();
-
-
+
+
}
-
+
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
@@ -180,14 +180,13 @@ private void jButton1KeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jB
private void jButton3MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jButton3MouseClicked
- int res;
- res = JOptionPane.showConfirmDialog(this, "Are you sure you want to quit? If you select yes the script will\nterminate and no data will be recorded. You can run the script again\nby loading the same script file.", "Quit Session?", JOptionPane.YES_NO_OPTION);
+ int res = Utilities.ConfirmDialog(this, "Are you sure you want to quit? If you select yes the script will\nterminate and no data will be recorded. You can run the script again\nby loading the same script file.", "Quit Session?");
if(res == JOptionPane.YES_OPTION){
response = 2; // Quit
this.setVisible(false);
-
+
}
-
+
}//GEN-LAST:event_jButton3MouseClicked
private void jButton2MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jButton2MouseClicked
@@ -202,35 +201,34 @@ private void jButton1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:ev
private void formWindowClosing(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowClosing
// TODO add your handling code here:
- int res;
- res = JOptionPane.showConfirmDialog(this, "Are you sure you want to quit? If you select yes the script will\nterminate and no data will be recorded. You can run the script again\nby loading the same script file.", "Quit Session?", JOptionPane.YES_NO_OPTION);
- if(res == JOptionPane.YES_OPTION){
- response = 2; // Quit
- this.setVisible(false);
-
- }
-
+ int res = Utilities.ConfirmDialog(this, "Are you sure you want to quit? If you select yes the script will\nterminate and no data will be recorded. You can run the script again\nby loading the same script file.", "Quit Session?");
+ if(res == JOptionPane.YES_OPTION){
+ response = 2; // Quit
+ this.setVisible(false);
+
+ }
+
}//GEN-LAST:event_formWindowClosing
private void formKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_formKeyPressed
// TODO add your handling code here:
-
-
+
+
}//GEN-LAST:event_formKeyPressed
-
+
public void setText(String text){
jTextArea1.setText(text);
-
+
}
-
+
public int getResponse(){
return response;
}
-
-
-
-
-
+
+
+
+
+
/**
* @param args the command line arguments
*/
@@ -241,7 +239,7 @@ public int getResponse(){
// }
// });
// }
-
+
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton jButton1;
private javax.swing.JButton jButton2;
@@ -249,5 +247,5 @@ public int getResponse(){
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JTextArea jTextArea1;
// End of variables declaration//GEN-END:variables
-
+
}