compress text files
This commit is contained in:
Generated
+6
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Encoding">
|
||||
<file url="file://$PROJECT_DIR$/data/colors.txt" charset="windows-1252" />
|
||||
</component>
|
||||
</project>
|
||||
@@ -17,6 +17,7 @@ import javafx.scene.control.Label;
|
||||
import javafx.scene.control.Menu;
|
||||
import javafx.scene.control.MenuBar;
|
||||
import javafx.scene.control.MenuItem;
|
||||
import javafx.scene.control.ScrollPane;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.scene.control.*;
|
||||
import javafx.scene.image.ImageView;
|
||||
@@ -31,7 +32,6 @@ import javafx.scene.text.Font;
|
||||
import javafx.scene.text.FontWeight;
|
||||
import javafx.stage.FileChooser;
|
||||
import javafx.stage.Stage;
|
||||
import javafx.scene.control.ScrollPane;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
import java.awt.*;
|
||||
|
||||
+74
-44
@@ -12,9 +12,12 @@ import javafx.scene.text.FontWeight;
|
||||
import javafx.scene.text.Text;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.HashMap;
|
||||
import java.util.Objects;
|
||||
import java.util.zip.GZIPInputStream;
|
||||
|
||||
public class C2 {
|
||||
public static final Color MouseSelectedColor = Color.RED;
|
||||
@@ -92,60 +95,87 @@ public class C2 {
|
||||
public static HashMap<String, InputStream> randomDataFiles = new HashMap<>();
|
||||
public static HashMap<String, BufferedReader> randomDataFilesExtern = new HashMap<>();
|
||||
|
||||
|
||||
public C2() {
|
||||
|
||||
alerterror.getStyleClass().add("alert.error.dialog-pane");
|
||||
alertinformation.getStyleClass().add("alert.error.dialog-pane");
|
||||
alertconfirmation.getStyleClass().add("alert.error.dialog-pane");
|
||||
|
||||
randomDataFiles.put("Random Color", decompress("colors"));
|
||||
randomDataFiles.put("Random Company", decompress("companies"));
|
||||
randomDataFiles.put("Random Country", decompress("countries"));
|
||||
randomDataFiles.put("Random Departmentname", decompress("departmentnames"));
|
||||
randomDataFiles.put("Random Firstname", decompress("firstnames"));
|
||||
randomDataFiles.put("Random Jobname", decompress("jobnames"));
|
||||
randomDataFiles.put("Random Language", decompress("languages"));
|
||||
randomDataFiles.put("Random Lastname", decompress("lastnames"));
|
||||
randomDataFiles.put("Random Mediacategory", decompress("mediacategories"));
|
||||
randomDataFiles.put("Random Mediapublisher", decompress("mediapublishers"));
|
||||
randomDataFiles.put("Random Mediatitle", decompress("mediatitles"));
|
||||
randomDataFiles.put("Random Mediatype", decompress("mediatypes"));
|
||||
randomDataFiles.put("Random Place", decompress("places"));
|
||||
randomDataFiles.put("Random Profession", decompress("professions"));
|
||||
randomDataFiles.put("Random Rentalequipment", decompress("rentalequipment"));
|
||||
randomDataFiles.put("Random Street", decompress("streets"));
|
||||
|
||||
String appImages = "/applicationimages/";
|
||||
String appData = "/data/";
|
||||
applicationImageIconAsICO = loadImage("erdlogo");
|
||||
attr_conn_attrImage = loadImage("attr_conn_attr");
|
||||
attr_conn_esImage = loadImage("attr_conn_es");
|
||||
attr_conn_rsImage = loadImage("attr_conn_rs");
|
||||
attr_derived_multi_valueImage = loadImage("attr_derived_multi_value");
|
||||
attr_derived_one_valueImage = loadImage("attr_derived_one_value");
|
||||
attr_key_valueImage = loadImage("attr_key_value");
|
||||
attr_multi_valueImage = loadImage("attr_multi_value");
|
||||
attr_one_valueImage = loadImage("attr_one_value");
|
||||
attr_weak_key_valueImage = loadImage("attr_weak_key_value");
|
||||
es_associativeImage = loadImage("es_associative");
|
||||
es_weakImage = loadImage("es_weak");
|
||||
esImage = loadImage("es");
|
||||
rs_conn_esImage = loadImage("rs_conn_es");
|
||||
rs_id_conn_es_weakImage = loadImage("rs_id_conn_es_weak");
|
||||
rs_id_conn_esImage = loadImage("rs_id_conn_es");
|
||||
rs_idImage = loadImage("rs_id");
|
||||
rs_isa_conn_general_esImage = loadImage("rs_isa_conn_general_es");
|
||||
rs_isa_conn_special_esImage = loadImage("rs_isa_conn_special_es");
|
||||
rs_isaImage = loadImage("rs_isa");
|
||||
rsImage = loadImage("rs");
|
||||
textImage = loadImage("text");
|
||||
textWithoutBorderImage = loadImage("text_without_border");
|
||||
treeOpenImage = loadImage("tree_open");
|
||||
treeCloseImage = loadImage("tree_close");
|
||||
}
|
||||
|
||||
private static InputStream decompress(String INPUT_FILE) {
|
||||
INPUT_FILE = "/compressed_data/" + INPUT_FILE + ".txt.gz";
|
||||
byte[] buffer = new byte[1024];
|
||||
try {
|
||||
GZIPInputStream is =
|
||||
new GZIPInputStream(Objects.requireNonNull(C2.class.getResourceAsStream(INPUT_FILE)));
|
||||
|
||||
randomDataFiles.put("Random Color", getClass().getResourceAsStream(appData + "colors.txt"));
|
||||
randomDataFiles.put("Random Company", getClass().getResourceAsStream(appData + "companies.txt"));
|
||||
randomDataFiles.put("Random Country", getClass().getResourceAsStream(appData + "countries.txt"));
|
||||
randomDataFiles.put("Random Departmentname", getClass().getResourceAsStream(appData + "departmentnames.txt"));
|
||||
randomDataFiles.put("Random Firstname", getClass().getResourceAsStream(appData + "firstnames.txt"));
|
||||
randomDataFiles.put("Random Jobname", getClass().getResourceAsStream(appData + "jobnames.txt"));
|
||||
randomDataFiles.put("Random Language", getClass().getResourceAsStream(appData + "languages.txt"));
|
||||
randomDataFiles.put("Random Lastname", getClass().getResourceAsStream(appData + "lastnames.txt"));
|
||||
randomDataFiles.put("Random Mediacategory", getClass().getResourceAsStream(appData + "mediacategories.txt"));
|
||||
randomDataFiles.put("Random Mediapublisher", getClass().getResourceAsStream(appData + "mediapublishers.txt"));
|
||||
randomDataFiles.put("Random Mediatitle", getClass().getResourceAsStream(appData + "mediatitles.txt"));
|
||||
randomDataFiles.put("Random Mediatype", getClass().getResourceAsStream(appData + "mediatypes.txt"));
|
||||
randomDataFiles.put("Random Place", getClass().getResourceAsStream(appData + "places.txt"));
|
||||
randomDataFiles.put("Random Profession", getClass().getResourceAsStream(appData + "professions.txt"));
|
||||
randomDataFiles.put("Random Rentalequipment", getClass().getResourceAsStream(appData + "rentalequipment.txt"));
|
||||
randomDataFiles.put("Random Street", getClass().getResourceAsStream(appData + "streets.txt"));
|
||||
StringBuilder out = new StringBuilder();
|
||||
|
||||
applicationImageIconAsICO = new Image(Objects.requireNonNull(getClass().getResourceAsStream(appImages + "erdlogo.png")));
|
||||
attr_conn_attrImage = new Image(Objects.requireNonNull(getClass().getResourceAsStream(appImages + "attr_conn_attr.png")));
|
||||
attr_conn_esImage = new Image(Objects.requireNonNull(getClass().getResourceAsStream(appImages + "attr_conn_es.png")));
|
||||
attr_conn_rsImage = new Image(Objects.requireNonNull(getClass().getResourceAsStream(appImages + "attr_conn_rs.png")));
|
||||
attr_derived_multi_valueImage = new Image(Objects.requireNonNull(getClass().getResourceAsStream(appImages + "attr_derived_multi_value.png")));
|
||||
attr_derived_one_valueImage = new Image(Objects.requireNonNull(getClass().getResourceAsStream(appImages + "attr_derived_one_value.png")));
|
||||
attr_key_valueImage = new Image(Objects.requireNonNull(getClass().getResourceAsStream(appImages + "attr_key_value.png")));
|
||||
attr_multi_valueImage = new Image(Objects.requireNonNull(getClass().getResourceAsStream(appImages + "attr_multi_value.png")));
|
||||
attr_one_valueImage = new Image(Objects.requireNonNull(getClass().getResourceAsStream(appImages + "attr_one_value.png")));
|
||||
attr_weak_key_valueImage = new Image(Objects.requireNonNull(getClass().getResourceAsStream(appImages + "attr_weak_key_value.png")));
|
||||
es_associativeImage = new Image(Objects.requireNonNull(getClass().getResourceAsStream(appImages + "es_associative.png")));
|
||||
es_weakImage = new Image(Objects.requireNonNull(getClass().getResourceAsStream(appImages + "es_weak.png")));
|
||||
esImage = new Image(Objects.requireNonNull(getClass().getResourceAsStream(appImages + "es.png")));
|
||||
rs_conn_esImage = new Image(Objects.requireNonNull(getClass().getResourceAsStream(appImages + "rs_conn_es.png")));
|
||||
rs_id_conn_es_weakImage = new Image(Objects.requireNonNull(getClass().getResourceAsStream(appImages + "rs_id_conn_es_weak.png")));
|
||||
rs_id_conn_esImage = new Image(Objects.requireNonNull(getClass().getResourceAsStream(appImages + "rs_id_conn_es.png")));
|
||||
rs_idImage = new Image(Objects.requireNonNull(getClass().getResourceAsStream(appImages + "rs_id.png")));
|
||||
rs_isa_conn_general_esImage = new Image(Objects.requireNonNull(getClass().getResourceAsStream(appImages + "rs_isa_conn_general_es.png")));
|
||||
rs_isa_conn_special_esImage = new Image(Objects.requireNonNull(getClass().getResourceAsStream(appImages + "rs_isa_conn_special_es.png")));
|
||||
rs_isaImage = new Image(Objects.requireNonNull(getClass().getResourceAsStream(appImages + "rs_isa.png")));
|
||||
rsImage = new Image(Objects.requireNonNull(getClass().getResourceAsStream(appImages + "rs.png")));
|
||||
textImage = new Image(Objects.requireNonNull(getClass().getResourceAsStream(appImages + "text.png")));
|
||||
textWithoutBorderImage = new Image(Objects.requireNonNull(getClass().getResourceAsStream(appImages + "text_without_border.png")));
|
||||
treeOpenImage = new Image(Objects.requireNonNull(getClass().getResourceAsStream(appImages + "tree_open.png")));
|
||||
treeCloseImage = new Image(Objects.requireNonNull(getClass().getResourceAsStream(appImages + "tree_close.png")));
|
||||
while (is.read(buffer) > 0) {
|
||||
for (byte b : buffer) {
|
||||
out.append((char) b);
|
||||
}
|
||||
}
|
||||
is.close();
|
||||
|
||||
System.out.println("File Successfully decompressed");
|
||||
|
||||
System.out.println(out);
|
||||
|
||||
return new ByteArrayInputStream(out.toString().getBytes());
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
private static Image loadImage(String FILE_NAME) {
|
||||
return new Image(Objects.requireNonNull(C2.class.getResourceAsStream("/applicationimages/" + FILE_NAME + ".png")));
|
||||
}
|
||||
|
||||
public static double computeTextWidth(String text, double wrappingWidth) {
|
||||
|
||||
@@ -74,8 +74,8 @@ public class C4 {
|
||||
public StringBuffer create_MS_SQL_Script(boolean createInsertStatements, boolean addCDToDBName, boolean singeInserts) throws ZZ20 {
|
||||
LocalDate today = LocalDate.now();
|
||||
String currentDate = today.getYear() + (
|
||||
(today.getMonthValue() < 10) ? ("0" + today.getMonthValue()) : "" + today.getMonthValue()) + (
|
||||
(today.getDayOfMonth() < 10) ? ("0" + today.getDayOfMonth()) : "" + today.getDayOfMonth());
|
||||
(today.getMonthValue() < 10) ? ("0" + today.getMonthValue()) : String.valueOf(today.getMonthValue())) + (
|
||||
(today.getDayOfMonth() < 10) ? ("0" + today.getDayOfMonth()) : String.valueOf(today.getDayOfMonth()));
|
||||
|
||||
|
||||
if (addCDToDBName) this.databaseName = this.databaseName + currentDate;
|
||||
@@ -207,8 +207,8 @@ public class C4 {
|
||||
public StringBuffer create_MySQL_Script(boolean createInsertStatements, boolean addCDToDBName, boolean singeInserts) throws ZZ20 {
|
||||
LocalDate today = LocalDate.now();
|
||||
String currentDate = today.getYear() + (
|
||||
(today.getMonthValue() < 10) ? ("0" + today.getMonthValue()) : "" + today.getMonthValue()) + (
|
||||
(today.getDayOfMonth() < 10) ? ("0" + today.getDayOfMonth()) : "" + today.getDayOfMonth());
|
||||
(today.getMonthValue() < 10) ? ("0" + today.getMonthValue()) : String.valueOf(today.getMonthValue())) + (
|
||||
(today.getDayOfMonth() < 10) ? ("0" + today.getDayOfMonth()) : String.valueOf(today.getDayOfMonth()));
|
||||
|
||||
|
||||
if (addCDToDBName) this.databaseName = currentDate + this.databaseName;
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -6,6 +6,7 @@
|
||||
<sourceFolder url="file://$MODULE_DIR$" isTestSource="false" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/lib" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/.idea" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/data" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
|
||||
Reference in New Issue
Block a user