Added package batch file, configured application for building applications.
This commit is contained in:
parent
a9c335dcca
commit
cca7fc544a
|
@ -111,3 +111,4 @@ buildNumber.properties
|
|||
|
||||
.idea/
|
||||
clusters/
|
||||
output/
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
call mvn clean package
|
||||
call jpackage ^
|
||||
--type app-image ^
|
||||
--verbose ^
|
||||
--dest target\image ^
|
||||
--name CrystalKeep ^
|
||||
--icon src/main/resources/nl/andrewlalis/crystalkeep/ui/images/cluster_node_icon.png ^
|
||||
--module crystalkeep/nl.andrewlalis.crystalkeep.CrystalKeep ^
|
||||
--module-path target\modules ^
|
||||
--module-path target\classes ^
|
||||
--win-console ^
|
55
pom.xml
55
pom.xml
|
@ -6,7 +6,7 @@
|
|||
|
||||
<groupId>nl.andrewlalis</groupId>
|
||||
<artifactId>crystalkeep</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<version>0.0.1</version>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>11</maven.compiler.source>
|
||||
|
@ -14,23 +14,11 @@
|
|||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
<javafx.version>16</javafx.version>
|
||||
<project.mainClass>nl.andrewlalis.crystalkeep.CrystalKeep</project.mainClass>
|
||||
</properties>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.openjfx</groupId>
|
||||
<artifactId>javafx-maven-plugin</artifactId>
|
||||
<version>0.0.4</version>
|
||||
<configuration>
|
||||
<mainClass>nl.andrewlalis.crystalkeep.CrystalKeep</mainClass>
|
||||
<noManPages>true</noManPages>
|
||||
<stripDebug>true</stripDebug>
|
||||
<compress>2</compress>
|
||||
<noHeaderFiles>true</noHeaderFiles>
|
||||
<launcher>crystalkeep</launcher>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
|
@ -42,27 +30,36 @@
|
|||
<version>2.22.2</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-assembly-plugin</artifactId>
|
||||
<version>3.3.0</version>
|
||||
<groupId>org.openjfx</groupId>
|
||||
<artifactId>javafx-maven-plugin</artifactId>
|
||||
<version>0.0.4</version>
|
||||
<configuration>
|
||||
<archive>
|
||||
<manifest>
|
||||
<mainClass>nl.andrewlalis.crystalkeep.CrystalKeep</mainClass>
|
||||
</manifest>
|
||||
</archive>
|
||||
<descriptorRefs>
|
||||
<descriptorRef>jar-with-dependencies</descriptorRef>
|
||||
</descriptorRefs>
|
||||
<appendAssemblyId>true</appendAssemblyId>
|
||||
<source>${java.version}</source>
|
||||
<target>${java.version}</target>
|
||||
<release>${java.version}</release>
|
||||
<mainClass>${project.mainClass}</mainClass>
|
||||
<jlinkVerbose>true</jlinkVerbose>
|
||||
<jmodsPath>${project.build.directory}/modules</jmodsPath>
|
||||
<mainClass>${main.class}</mainClass>
|
||||
<stripDebug>true</stripDebug>
|
||||
<jlinkZipName>test</jlinkZipName>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<!-- Copies all dependencies into a target/modules directory so that jpackage can reference this. -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-dependency-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>make-assembly</id>
|
||||
<phase>package</phase>
|
||||
<id>copy-dependencies</id>
|
||||
<phase>prepare-package</phase>
|
||||
<goals>
|
||||
<goal>single</goal>
|
||||
<goal>copy-dependencies</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<includeScope>runtime</includeScope>
|
||||
<outputDirectory>${project.build.directory}/modules</outputDirectory>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
|
|
@ -6,11 +6,13 @@ import javafx.geometry.Pos;
|
|||
import javafx.scene.control.*;
|
||||
import javafx.scene.layout.VBox;
|
||||
import javafx.stage.FileChooser;
|
||||
import javafx.util.Duration;
|
||||
import nl.andrewlalis.crystalkeep.io.ClusterIO;
|
||||
import nl.andrewlalis.crystalkeep.model.*;
|
||||
import nl.andrewlalis.crystalkeep.view.ClusterTreeItem;
|
||||
import nl.andrewlalis.crystalkeep.view.CrystalItemTreeCell;
|
||||
import nl.andrewlalis.crystalkeep.view.ShardTreeItem;
|
||||
import org.controlsfx.control.Notifications;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.file.Path;
|
||||
|
@ -82,8 +84,11 @@ public class MainViewController implements ModelListener {
|
|||
this.model.setActiveClusterPassword(pw);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
new Alert(Alert.AlertType.WARNING, "Could not load cluster.").showAndWait();
|
||||
Notifications.create()
|
||||
.text("Could not load cluster. Check that your password is correct.")
|
||||
.hideAfter(Duration.seconds(3))
|
||||
.owner(this.shardDetailContainer.getScene().getWindow())
|
||||
.show();
|
||||
return;
|
||||
}
|
||||
model.setActiveCluster(cluster);
|
||||
|
@ -115,6 +120,8 @@ public class MainViewController implements ModelListener {
|
|||
chooser.setSelectedExtensionFilter(new FileChooser.ExtensionFilter("Cluster Files", "cts"));
|
||||
if (path != null) {
|
||||
chooser.setInitialDirectory(path.getParent().toFile());
|
||||
} else {
|
||||
chooser.setInitialDirectory(ClusterIO.CLUSTER_PATH.toFile());
|
||||
}
|
||||
File file = chooser.showSaveDialog(this.clusterTreeView.getScene().getWindow());
|
||||
if (file == null) return;
|
||||
|
@ -154,16 +161,27 @@ public class MainViewController implements ModelListener {
|
|||
pw = this.promptPassword().orElse(new char[0]);
|
||||
}
|
||||
ClusterIO loader = new ClusterIO();
|
||||
if (!path.getFileName().toString().trim().toLowerCase().endsWith(".cts")) {
|
||||
path = path.resolveSibling(path.getFileName() + ".cts");
|
||||
}
|
||||
try {
|
||||
if (pw.length == 0) {
|
||||
loader.saveUnencrypted(model.getActiveCluster(), path);
|
||||
} else {
|
||||
loader.save(model.getActiveCluster(), path, pw);
|
||||
}
|
||||
Notifications.create()
|
||||
.text("Cluster saved to " + path)
|
||||
.hideAfter(Duration.seconds(3))
|
||||
.owner(this.shardDetailContainer.getScene().getWindow())
|
||||
.show();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
var alert = new Alert(Alert.AlertType.ERROR, "Could not save cluster.");
|
||||
alert.showAndWait();
|
||||
Notifications.create()
|
||||
.text("Could not save cluster.")
|
||||
.hideAfter(Duration.seconds(3))
|
||||
.owner(this.shardDetailContainer.getScene().getWindow())
|
||||
.show();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,8 +33,15 @@ import java.security.spec.KeySpec;
|
|||
* @see nl.andrewlalis.crystalkeep.io.serialization.ClusterSerializer
|
||||
*/
|
||||
public class ClusterIO {
|
||||
public static final Path CLUSTER_PATH = Path.of("clusters");
|
||||
public static final Path CLUSTER_PATH = Path.of(System.getProperty("user.home"), ".crystalkeep", "clusters");
|
||||
public static final int FILE_VERSION = 1;
|
||||
static {
|
||||
try {
|
||||
Files.createDirectories(CLUSTER_PATH);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private final SecureRandom random;
|
||||
|
||||
|
|
|
@ -1,6 +1,13 @@
|
|||
package nl.andrewlalis.crystalkeep.util;
|
||||
|
||||
public class StringUtils {
|
||||
public static final String[] IMAGE_TYPES = {
|
||||
"png", "jpg", "jpeg", "gif"
|
||||
};
|
||||
public static final String[] PLAIN_TEXT_TYPES = {
|
||||
"txt"
|
||||
};
|
||||
|
||||
public static boolean endsWithAny(String s, String... suffixes) {
|
||||
for (String suffix : suffixes) {
|
||||
if (s.endsWith(suffix)) return true;
|
||||
|
|
|
@ -74,12 +74,18 @@ public class FileShardViewModel extends ShardViewModel<FileShard> {
|
|||
gp.add(extractFileButton, 1, 2);
|
||||
container.getChildren().add(gp);
|
||||
|
||||
if (StringUtils.endsWithAny(shard.getFileName().toLowerCase(), ".png", ".jpg", ".jpeg", ".gif")) {
|
||||
if (StringUtils.endsWithAny(shard.getFileName().toLowerCase(), StringUtils.IMAGE_TYPES)) {
|
||||
container.getChildren().add(new Separator(Orientation.HORIZONTAL));
|
||||
ImageView imageView = new ImageView(new Image(new ByteArrayInputStream(shard.getContents())));
|
||||
imageView.setPreserveRatio(true);
|
||||
ScrollPane scrollPane = new ScrollPane(imageView);
|
||||
container.getChildren().add(scrollPane);
|
||||
} else if (StringUtils.endsWithAny(shard.getFileName().toLowerCase(), StringUtils.PLAIN_TEXT_TYPES)) {
|
||||
container.getChildren().add(new Separator(Orientation.HORIZONTAL));
|
||||
TextArea textArea = new TextArea(new String(shard.getContents()));
|
||||
textArea.setEditable(false);
|
||||
textArea.setWrapText(true);
|
||||
container.getChildren().add(textArea);
|
||||
}
|
||||
|
||||
return container;
|
||||
|
|
Loading…
Reference in New Issue