#12 ominaisuus valmis
This commit is contained in:
@@ -4,9 +4,11 @@ import fi.lpam.gui.Asiakashallinta;
|
||||
import fi.lpam.gui.Kierroshallinta;
|
||||
import fi.lpam.gui.KuljetusRaportit;
|
||||
import fi.lpam.gui.KuljetusListat;
|
||||
import fi.lpam.gui.elementit.MuutosIlmoitus;
|
||||
import javafx.application.Application;
|
||||
import javafx.geometry.Side;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.control.Alert;
|
||||
import javafx.scene.control.Tab;
|
||||
import javafx.scene.control.TabPane;
|
||||
import javafx.scene.image.Image;
|
||||
@@ -63,5 +65,7 @@ public class App extends Application {
|
||||
primaryStage.setMaximized(true);
|
||||
primaryStage.show();
|
||||
primaryStage.getIcons().add(new Image(Objects.requireNonNull(Main.class.getClassLoader().getResourceAsStream("kuljetusruokalaatikko.jpg"))));
|
||||
|
||||
if (!Main.properties.getProperty("version").equals(Main.properties.getProperty("viimeisinVersio"))) new MuutosIlmoitus();
|
||||
}
|
||||
}
|
||||
@@ -21,8 +21,9 @@ public class Main {
|
||||
}
|
||||
|
||||
try {
|
||||
properties = new Properties();
|
||||
properties.load(Main.class.getClassLoader().getResourceAsStream("defaults.properties"));
|
||||
Properties defaults = new Properties();
|
||||
defaults.load(Main.class.getClassLoader().getResourceAsStream("defaults.properties"));
|
||||
properties = new Properties(defaults);
|
||||
properties.load(new FileInputStream(asetustiedosto));
|
||||
}
|
||||
catch (IOException e) {
|
||||
@@ -30,9 +31,8 @@ public class Main {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
properties.forEach((key, value) -> {
|
||||
System.out.println(key + ": " + value);
|
||||
});
|
||||
System.out.println(properties.getProperty("version"));
|
||||
System.out.println(properties.getProperty("viimeisinVersio"));
|
||||
|
||||
App.main();
|
||||
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
package fi.lpam.gui.elementit;
|
||||
|
||||
import fi.lpam.Main;
|
||||
import javafx.geometry.Pos;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.layout.*;
|
||||
import javafx.scene.paint.Color;
|
||||
import javafx.stage.Stage;
|
||||
import one.jpro.platform.mdfx.MarkdownView;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.util.Objects;
|
||||
|
||||
public class MuutosIlmoitus extends Stage {
|
||||
public MuutosIlmoitus() {
|
||||
super();
|
||||
VBox root = new VBox();
|
||||
root.setBorder(new Border(new BorderStroke(Color.BLACK, BorderStrokeStyle.SOLID, CornerRadii.EMPTY, BorderWidths.DEFAULT)));
|
||||
root.setPadding(TabPohja.oletusInsets);
|
||||
root.setStyle(TabPohja.oletusStyle);
|
||||
root.setAlignment(Pos.CENTER);
|
||||
root.setSpacing(10);
|
||||
|
||||
String md;
|
||||
try (InputStreamReader isr = new InputStreamReader(Objects.requireNonNull(Main.class.getClassLoader().getResourceAsStream("CHANGELOG.md")))) {
|
||||
md = isr.readAllAsString();
|
||||
int toinenMerkintä = md.indexOf("# ", 1);
|
||||
int kolmasMerkintä = md.indexOf("# ", toinenMerkintä + 1);
|
||||
int endIndex = md.indexOf("# ", kolmasMerkintä + 1);
|
||||
md = md.substring(0, endIndex);
|
||||
}
|
||||
catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
md = "# Virhe versiolokin haussa";
|
||||
}
|
||||
|
||||
MarkdownView markdownView = new MarkdownView(md);
|
||||
root.getChildren().add(markdownView);
|
||||
|
||||
Button ok = new Button("OK");
|
||||
ok.setFont(TabPohja.buttonFont);
|
||||
ok.setOnAction(e -> this.close());
|
||||
root.getChildren().add(ok);
|
||||
|
||||
Scene scene = new Scene(root);
|
||||
this.setScene(scene);
|
||||
this.setTitle("Uusi versio, katso muutokset alta!");
|
||||
this.setResizable(false);
|
||||
this.show();
|
||||
|
||||
Main.properties.setProperty("viimeisinVersio", Main.properties.getProperty("version"));
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,7 @@ module fi.lpam.ruokamanageri {
|
||||
requires java.desktop;
|
||||
requires org.apache.pdfbox;
|
||||
requires org.apache.commons.lang3;
|
||||
requires one.jpro.platform.mdfx;
|
||||
|
||||
opens fi.lpam.dataluokat to javafx.base;
|
||||
exports fi.lpam;
|
||||
|
||||
Reference in New Issue
Block a user