Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates for External Files, Menus, and custom fields #2

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,6 @@
hs_err_pid*
docs/_site
Gemfile.lock

.DS_Store
src/main/resources
1 change: 0 additions & 1 deletion NOTICE
Original file line number Diff line number Diff line change
Expand Up @@ -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)

64 changes: 46 additions & 18 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

<groupId>org.apereo.application</groupId>
<artifactId>ImageQuiz</artifactId>
<version>1.0-SNAPSHOT</version>
<version>1.0.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>ImageQuiz</name>
<url>https://github.com/Jasig/ImageQuiz</url>
Expand Down Expand Up @@ -81,32 +81,60 @@
</archive>
</configuration>
</plugin>
<plugin>
<groupId>sh.tak.appbundler</groupId>
<artifactId>appbundle-maven-plugin</artifactId>
<version>1.0.4</version>
<configuration>
<mainClass>scripteditor.MainForm</mainClass>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>bundle</goal>
</goals>
</execution>
</executions>
</plugin>

<plugin>
<groupId>com.jolira</groupId>
<artifactId>onejar-maven-plugin</artifactId>
<version>1.4.4</version>
<executions>
<execution>
<configuration>
<mainClass>scripteditor.MainForm</mainClass>
<onejarVersion>0.97</onejarVersion>
<attachToBuild>true</attachToBuild>
</configuration>
<goals>
<goal>one-jar</goal>
</goals>
</execution>
</executions>
</plugin>

<plugin>
<groupId>sh.tak.appbundler</groupId>
<artifactId>appbundle-maven-plugin</artifactId>
<version>1.0.4</version>
<configuration>
<mainClass>scripteditor.MainForm</mainClass>
<!--jrePath>/Library/Java/JavaVirtualMachines/jdk1.8.0_91.jdk</jrePath-->
<!--iconFile>icn.icns</iconFile-->
</configuration>
<executions>
<execution>
<phase>none</phase>
<goals>
<goal>bundle</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

<pluginRepositories>
<pluginRepository>
<id>onejar-maven-plugin.googlecode.com</id>
<url>http://onejar-maven-plugin.googlecode.com/svn/mavenrepo</url>
</pluginRepository>
</pluginRepositories>

<repositories>
<!--These are needed for Swing/Netbeans -->
<repository>
<id>maven2-repository.netbeans.maven2</id>
<name>Netbeans Maven Repository</name>
<url>http://bits.netbeans.org/maven2/</url>
<layout>default</layout>
</repository>
</repository>
</repositories>
</project>
13 changes: 5 additions & 8 deletions src/main/java/scripteditor/CheckBoxTable.java
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand All @@ -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;
}

Expand Down Expand Up @@ -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;
}
Expand Down
43 changes: 34 additions & 9 deletions src/main/java/scripteditor/ConfigFileReader.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.


*/
package scripteditor;

Expand All @@ -27,25 +29,48 @@


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 {
byte dataArray[];
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;
Expand Down
35 changes: 17 additions & 18 deletions src/main/java/scripteditor/Configuration.java
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -96,7 +95,7 @@ public static String getDatabaseFolderPath() {
else
return line;
}

private static BufferedReader getReader(String path){
FileReader inFile = null;
//String currentDirectory = Configuration.ApplicationPath();
Expand All @@ -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);
Expand All @@ -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) {
Expand All @@ -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 "";
Expand All @@ -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();
Expand All @@ -177,22 +182,16 @@ 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
public static int ProgressRecords() {
return 1000;
}
}


Loading