Permalink
Browse files

adds new example files and refactors resources (#71)

  • Loading branch information...
bowring committed May 24, 2017
1 parent 485937e commit e0b1c223590d83ff804c331caff4543459a90f2e
View
@@ -32,8 +32,7 @@ core/private
# Resources
!core/src/main/resources/org/cirdles/calamari/prawn/*.xml
!core/src/main/resources/org/cirdles/calamari/prawn/*.txt
!app/src/main/resources/org/cirdles/calamari/version.txt
!appfx/src/main/resources/org/cirdles/calamari/version.txt
!core/src/main/resources/org/cirdles/calamari/core/version.txt
!core/src/test/resources/org/cirdles/calamari/core/*.csv
!web/src/test/resources/org/cirdles/calamari/core/*.csv
View
@@ -1,6 +1,3 @@
import java.text.SimpleDateFormat
import java.util.Date
import org.apache.tools.ant.filters.*
apply plugin: "application"
@@ -32,13 +29,3 @@ task fatJar(type: Jar) {
with jar
}
def timestamp() {
new SimpleDateFormat("dd MMMM yyyy").format(new Date())
}
processResources {
filter ReplaceTokens, tokens: [
"pom.version": version,
"timestamp": timestamp()
]
}
@@ -15,10 +15,8 @@
*/
package org.cirdles.calamari;
import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
import java.nio.charset.Charset;
import static java.nio.charset.StandardCharsets.ISO_8859_1;
import java.nio.file.Files;
import java.nio.file.Path;
@@ -37,39 +35,6 @@
*/
public class Calamari {
public static final String VERSION;
public static final String RELEASE_DATE;
static {
ResourceExtractor calamariResourceExtractor
= new ResourceExtractor(Calamari.class);
String version = "version";
String releaseDate = "date";
// get version number and release date written by pom.xml
Path resourcePath = calamariResourceExtractor.extractResourceAsPath("version.txt");
Charset charset = Charset.forName("US-ASCII");
try (BufferedReader reader = Files.newBufferedReader(resourcePath, charset)) {
String line = reader.readLine();
if (line != null) {
String[] versionText = line.split("=");
version = versionText[1];
}
line = reader.readLine();
if (line != null) {
String[] versionDate = line.split("=");
releaseDate = versionDate[1];
}
} catch (IOException x) {
System.err.format("IOException: %s%n", x);
}
VERSION = version;
RELEASE_DATE = releaseDate;
}
/**
* @param args the command line arguments
*/
@@ -113,7 +78,7 @@ public static void main(String args[]) {
}
// Set up default folder for reports
File defaultCalamariReportsFolder = new File("CalamariReports_v" + VERSION);
File defaultCalamariReportsFolder = new File("CalamariReports_v" + PrawnFileHandler.VERSION);
prawnFileHandler.getReportsEngine().setFolderToWriteCalamariReports(defaultCalamariReportsFolder);
if (!defaultCalamariReportsFolder.exists()) {
if (!defaultCalamariReportsFolder.mkdir()) {
@@ -19,6 +19,7 @@
import java.awt.Toolkit;
import javax.swing.JDialog;
import org.cirdles.calamari.Calamari;
import org.cirdles.calamari.core.PrawnFileHandler;
/**
*
@@ -43,8 +44,8 @@ private AboutBox(java.awt.Frame parent, boolean modal) {
private void initInstance() {
setSizeAndCenter(400, 400);
versionLabel.setText(Calamari.VERSION);
buildDateLabel.setText(Calamari.RELEASE_DATE);
versionLabel.setText(PrawnFileHandler.VERSION);
buildDateLabel.setText(PrawnFileHandler.RELEASE_DATE);
}
public static JDialog getInstance() {
@@ -84,7 +84,7 @@ private void initUI() {
this.setLocation(x, y);
this.setTitle("Calamari Raw Data Processing for SHRIMP");
calamariInfo.setText("Calamari version " + Calamari.VERSION + " built on " + Calamari.RELEASE_DATE);
calamariInfo.setText("Calamari version " + PrawnFileHandler.VERSION + " built on " + PrawnFileHandler.RELEASE_DATE);
updateCurrentPrawnFileLocation();
updateReportsFolderLocationText();
View
@@ -1,6 +1,3 @@
import java.text.SimpleDateFormat
import java.util.Date
import org.apache.tools.ant.filters.*
apply plugin: "application"
@@ -32,13 +29,3 @@ task fatFxJar(type: Jar) {
with jar
}
def timestamp() {
new SimpleDateFormat("dd MMMM yyyy").format(new Date())
}
processResources {
filter ReplaceTokens, tokens: [
"pom.version": version,
"timestamp": timestamp()
]
}
@@ -44,65 +44,15 @@
*/
public class Calamari extends Application {
public static final String VERSION;
public static final String RELEASE_DATE;
private static PrawnFileHandler prawnFileHandler;
static {
ResourceExtractor calamariResourceExtractor
= new ResourceExtractor(Calamari.class);
String version = "version";
String releaseDate = "date";
// get version number and release date written by pom.xml
Path resourcePath = calamariResourceExtractor.extractResourceAsPath("version.txt");
Charset charset = Charset.forName("US-ASCII");
try (BufferedReader reader = Files.newBufferedReader(resourcePath, charset)) {
String line = reader.readLine();
if (line != null) {
String[] versionText = line.split("=");
version = versionText[1];
}
line = reader.readLine();
if (line != null) {
String[] versionDate = line.split("=");
releaseDate = versionDate[1];
}
} catch (IOException x) {
System.err.format("IOException: %s%n", x);
}
VERSION = version;
RELEASE_DATE = releaseDate;
}
@Override
public void start(Stage primaryStage) throws Exception {
initCalamari();
primaryStage.setTitle("Squid 3.0 Explorations");
// ResourceExtractor prawnFileResourceExtractor
// = new ResourceExtractor(getClass());
// Path listOfPrawnFiles = prawnFileResourceExtractor.extractResourceAsPath("./images/SquidLogo.png");
// String newFileName = listOfPrawnFiles.getFileName().toString().replace(".tmp", ".png");
// Path newReportsZip = listOfPrawnFiles.resolveSibling(newFileName);
// Files.move(listOfPrawnFiles, newReportsZip);
// Image applicationIcon = new Image(newReportsZip.toString());// new Image(getClass().getResourceAsStream("./images/SquidLogo.png"));
// primaryStage.getIcons().add(applicationIcon);
////
// try {
// URL iconURL = getClass().getResource("./images/SquidLogo.png");
// java.awt.Image image = new ImageIcon(iconURL).getImage();
// com.apple.eawt.Application.getApplication().setDockIconImage(image);
// } catch (Exception e) {
// // Won't work on Windows or Linux.
// }
Parent root = FXMLLoader.load(getClass().getResource("FXMLDocument.fxml"));
Scene scene = new Scene(root);
@@ -162,7 +112,7 @@ private void initCalamari() {
}
}
File defaultCalamariReportsFolder = new File("CalamariReports_v" + Calamari.VERSION);
File defaultCalamariReportsFolder = new File("CalamariReports_v" + PrawnFileHandler.VERSION);
prawnFileHandler.getReportsEngine().setFolderToWriteCalamariReports(defaultCalamariReportsFolder);
if (!defaultCalamariReportsFolder.exists()) {
if (!defaultCalamariReportsFolder.mkdir()) {
@@ -28,6 +28,7 @@
import javafx.scene.web.WebView;
import javafx.stage.Stage;
import javax.swing.JOptionPane;
import org.cirdles.calamari.core.PrawnFileHandler;
import org.cirdles.calamari.shrimp.RawRatioNamesSHRIMP;
import org.cirdles.calamari.tasks.expressions.ExpressionTreeInterface;
import org.cirdles.calamari.tasks.expressions.ExpressionWriterMathML;
@@ -83,7 +84,7 @@
@Override
public void initialize(URL url, ResourceBundle rb) {
versionAndDateLabel.setText("Calamari version " + Calamari.VERSION + " built on " + Calamari.RELEASE_DATE);
versionAndDateLabel.setText("Calamari version " + PrawnFileHandler.VERSION + " built on " + PrawnFileHandler.RELEASE_DATE);
//initialize Calamari tab
try {

This file was deleted.

Oops, something went wrong.
View
@@ -6,7 +6,7 @@ subprojects {
apply plugin: "java"
group = "org.cirdles"
version = "1.4.7"
version = "1.4.8"
description = "Replacement for data reduction in Ludwig's Squid 2.50 for SHRIMP"
View
@@ -1,12 +1,14 @@
import java.text.SimpleDateFormat
import java.util.Date
import org.apache.tools.ant.filters.*
apply plugin: 'antlr'
dependencies {
compile "org.apache.commons:commons-math3:3.6.1"
compile "com.google.guava:guava:20.0"
compile "org.apache.commons:commons-math3:3.6.1"
compile "com.google.guava:guava:20.0"
compile "com.github.cirdles:LudwigLibrary:-SNAPSHOT"
compile "com.github.cirdles:Commons:-SNAPSHOT"
compile group: 'com.thoughtworks.xstream', name: 'xstream', version: '1.4.9'
antlr "org.antlr:antlr4:4.6"
@@ -17,7 +19,7 @@ dependencies {
configurations.all {
// Check for updates every build
// resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
}
sourceSets {
@@ -38,3 +40,14 @@ task fatJarCore(type: Jar) {
from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
with jar
}
def timestamp() {
new SimpleDateFormat("dd MMMM yyyy").format(new Date())
}
processResources {
filter ReplaceTokens, tokens: [
"pom.version": version,
"timestamp": timestamp()
]
}
Oops, something went wrong.

0 comments on commit e0b1c22

Please sign in to comment.