M src/main/java/com/ajtjp/gearcityuserinterface/Main.java +2 -3
@@ 62,7 62,7 @@ public class Main extends Application {
Parent root = fxml.load();
reportsController = fxml.getController();
- stage.setTitle("Gear City Executive Secretary 2022-09");
+ stage.setTitle("Gear City Executive Secretary 2023-06");
stage.setScene(new Scene(root));
@@ 136,7 136,7 @@ public class Main extends Application {
alert.showAndWait();
}
- theStage.setTitle("Gear City Executive Secretary" + " - " + file.getName());
+ theStage.setTitle("Gear City Executive Secretary 2023-06" + " - " + file.getName());
long end = System.nanoTime();
System.out.println("It took " + (end - start)/1000000 + " milliseconds to load the save and connect to the DB.");
@@ 191,7 191,6 @@ public class Main extends Application {
else {
Instant old = Instant.ofEpochMilli(lastModifiedList[0]);
Instant newInstant = Instant.ofEpochMilli(autosave.lastModified());
- System.out.println("Autosave time of " + newInstant + " is not newer than existing file of " + old);
}
}
}, fiveSeconds , fiveSeconds );
M src/main/java/com/ajtjp/gearcityuserinterface/controller/AcquisitionAdvisorController.java +42 -1
@@ 4,8 4,10 @@ package com.ajtjp.gearcityuserinterface.
import com.ajtjp.gearcitydata.BranchSummaryResult;
import com.ajtjp.gearcitydata.FactorySummaryResult;
import com.ajtjp.gearcitydata.SaveFile;
+import com.ajtjp.gearcitydata.StockMarketResult;
import com.ajtjp.gearcityuserinterface.cellFactory.CurrencyFactory;
import com.ajtjp.gearcityuserinterface.cellFactory.NumberFactory;
+import com.ajtjp.gearcityuserinterface.cellFactory.PercentFactory;
import com.ajtjp.gearcityuserinterface.customJFX.GUIUtils;
import com.ajtjp.gearcityuserinterface.data.AcquisitionAdvisorData;
import java.util.ArrayList;
@@ 79,7 81,30 @@ public class AcquisitionAdvisorControlle
});
branchesValue.setCellFactory(new CurrencyFactory());
- tblCompanies.getColumns().addAll(companyColumn, factoriesColumn, factoryLinesColumn, factoriesValue, branchesColumn, branchesValue);
+ TableColumn<AcquisitionAdvisorData, Integer> sharesAvailableColumn = new TableColumn<>();
+ sharesAvailableColumn.setText("Shares Available");
+ sharesAvailableColumn.setCellValueFactory(cellData -> {
+ return new ReadOnlyObjectWrapper(cellData.getValue().getSmr().getSharesAvailable());
+ });
+ sharesAvailableColumn.setCellFactory(new NumberFactory());
+
+ TableColumn<AcquisitionAdvisorData, Integer> percentAvailableColumn = new TableColumn<>();
+ percentAvailableColumn.setText("Percent Available");
+ percentAvailableColumn.setCellValueFactory(cellData -> {
+ return new ReadOnlyObjectWrapper(cellData.getValue().getSmr().getPercentAvailable());
+ });
+ percentAvailableColumn.setCellFactory(new PercentFactory());
+
+ TableColumn<AcquisitionAdvisorData, Integer> selfOwnedColumn = new TableColumn<>();
+ selfOwnedColumn.setText("Self Ownership");
+ selfOwnedColumn.setCellValueFactory(cellData -> {
+ return new ReadOnlyObjectWrapper(cellData.getValue().getSmr().getSelfOwnership());
+ });
+ selfOwnedColumn.setCellFactory(new PercentFactory());
+
+ tblCompanies.getColumns().addAll(companyColumn, factoriesColumn, factoryLinesColumn, factoriesValue,
+ branchesColumn, branchesValue,
+ sharesAvailableColumn, percentAvailableColumn, selfOwnedColumn);
tblCompanies.setRowFactory(tv -> {
TableRow<AcquisitionAdvisorData> row = new TableRow<>();
@@ 100,6 125,7 @@ public class AcquisitionAdvisorControlle
private void updateData() {
List<FactorySummaryResult> fsr = FactorySummaryResult.getFactorySummaries(SaveFile.getDBConn());
List<BranchSummaryResult> bsr = BranchSummaryResult.getBranchSummary(SaveFile.getDBConn());
+ List<StockMarketResult> smr = StockMarketResult.getStockMarketResults(SaveFile.getDBConn());
List<AcquisitionAdvisorData> aadList = new ArrayList<>();
factories: for (FactorySummaryResult factorySummary : fsr) {
@@ 122,6 148,21 @@ branches: for (BranchSummaryResult branc
}
aadList.add(new AcquisitionAdvisorData(new FactorySummaryResult(branchSummary.getCompanyName()), branchSummary));
}
+
+ for (AcquisitionAdvisorData aad : aadList) {
+ StockMarketResult stocks = smr.stream().filter(stock -> stock.getCompanyName().equals(aad.getFsr().getCompanyName())).findFirst().get();
+ aad.setStockMarketResult(stocks);
+ }
+
+ for (StockMarketResult stock : smr) {
+ if (aadList.stream().noneMatch(aad ->
+ (aad.getBsr().getCompanyName().equals(stock.getCompanyName()) &&
+ (aad.getFsr().getCompanyName().equals(stock.getCompanyName())))
+ )) {
+ AcquisitionAdvisorData aad = new AcquisitionAdvisorData(stock);
+ aadList.add(aad);
+ }
+ }
ObservableList ol = FXCollections.observableList(aadList);
M src/main/java/com/ajtjp/gearcityuserinterface/data/AcquisitionAdvisorData.java +16 -0
@@ 3,6 3,7 @@ package com.ajtjp.gearcityuserinterface.
import com.ajtjp.gearcitydata.BranchSummaryResult;
import com.ajtjp.gearcitydata.FactorySummaryResult;
+import com.ajtjp.gearcitydata.StockMarketResult;
/**
*
@@ 11,11 12,18 @@ import com.ajtjp.gearcitydata.FactorySum
public class AcquisitionAdvisorData {
private FactorySummaryResult fsr;
private BranchSummaryResult bsr;
+ private StockMarketResult smr;
public AcquisitionAdvisorData(FactorySummaryResult fsr, BranchSummaryResult bsr) {
this.fsr = fsr;
this.bsr = bsr;
}
+
+ public AcquisitionAdvisorData(StockMarketResult smr) {
+ this.smr = smr;
+ this.fsr = new FactorySummaryResult(smr.getCompanyName());
+ this.bsr = new BranchSummaryResult(smr.getCompanyName());
+ }
public FactorySummaryResult getFsr() {
return fsr;
@@ 24,4 32,12 @@ public class AcquisitionAdvisorData {
public BranchSummaryResult getBsr() {
return bsr;
}
+
+ public StockMarketResult getSmr() {
+ return smr;
+ }
+
+ public void setStockMarketResult(StockMarketResult smr) {
+ this.smr = smr;
+ }
}