Skip to content

Commit

Permalink
Configure travis
Browse files Browse the repository at this point in the history
  • Loading branch information
florin141 committed May 14, 2019
1 parent 77c7e08 commit e457c7c
Show file tree
Hide file tree
Showing 8 changed files with 150 additions and 74 deletions.
69 changes: 69 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf

# Generated files
.idea/**/contentModel.xml

# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml

# Gradle
.idea/**/gradle.xml
.idea/**/libraries

# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn. Uncomment if using
# auto-import.
# .idea/modules.xml
# .idea/*.iml
# .idea/modules
*.iml
# *.ipr

# CMake
cmake-build-*/

# Mongo Explorer plugin
.idea/**/mongoSettings.xml

# File-based project format
*.iws

# IntelliJ
out/
.idea/

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Cursive Clojure plugin
.idea/replstate.xml

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties

# Editor-based Rest Client
.idea/httpRequests

# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser
23 changes: 15 additions & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
language: java
before_install:
- chmod +x gradlew
script:
- ./gradlew assemble --no-daemon
language:
java
jdk:
- oraclejdk8
os:
- linux
- oraclejdk8
script:
- ./gradlew build --no-daemon
before_deploy:
- export RELEASE_JAR_FILE=$(ls build/libs/*.jar)
deploy:
provider: releases
api_key: '$API_KEY'
file_glob: true
file: "${RELEASE_JAR_FILE}"
skip_cleanup: true
on:
tags: true
14 changes: 12 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,9 +1,19 @@
version '1.0'

apply plugin: 'java'

version '1.0.0'
sourceCompatibility = 1.8
targetCompatibility = 1.8

repositories {
mavenCentral()
}

dependencies {
testCompile 'junit:junit:4.12'
}

jar {
manifest {
attributes 'Main-Class': 'com.loan.Main'
}
}
12 changes: 6 additions & 6 deletions src/main/java/com/loan/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
import javafx.stage.Stage;

public class Main extends Application {
private static final double LAT = 1280 - 2; /* latimea */
private static final double LUN = 720 - 32; /* lungimea */
private static final double WIDTH = 1280 - 2; /* default window width */
private static final double HEIGHT = 720 - 32; /* default window height */

public static void main(String[] args) {
launch(args);
Expand All @@ -21,9 +21,9 @@ public void start(Stage fereastra) {
LoanView view = new LoanView(model); /* creaza interfata */
LoanController controller = new LoanController(view);

Scene scena = new Scene(view, LAT, LUN); /* creează scena */
fereastra.setScene(scena); /* setează scena */
fereastra.setTitle("Loan Calculator"); /* setează titlul */
fereastra.show(); /* afiseaza fereastra */
Scene scena = new Scene(view, WIDTH, HEIGHT);
fereastra.setScene(scena);
fereastra.setTitle("Loan Calculator");
fereastra.show();
}
}
8 changes: 3 additions & 5 deletions src/main/java/com/loan/controller/LoanController.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,16 @@ public LoanController(LoanView view) {

/* se inregistreaza metodele de tratare a evenimentelor*/
view.butGraficRamb().setOnMouseClicked(this::afiseazaGraficRamb);
view.butRezumat().setOnMouseClicked(this::afiseazaRezumat);
}

private void afiseazaGraficRamb(Event event) {
if (!view.getCenter().equals(view.loanTableView())) {
view.setCenter(view.loanTableView());
view.butGraficRamb().setText("Hide amortization schedule");
}
}

private void afiseazaRezumat(Event event) {
if (!view.getCenter().equals(view.summaryView())) {
else if (!view.getCenter().equals(view.summaryView())) {
view.setCenter(view.summaryView());
view.butGraficRamb().setText("Show amortization schedule");
}
}
}
15 changes: 9 additions & 6 deletions src/main/java/com/loan/model/TableDataUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
import javafx.scene.control.TableCell;
import javafx.scene.control.TableColumn;

import java.text.NumberFormat;
import java.util.Locale;

public class TableDataUtil {

private static final String FORMAT = "%.2f";
Expand Down Expand Up @@ -44,7 +47,7 @@ public static ObservableList<TableData> getTableData(LoanModel model) {

/* Returns Amortization Payment TableColumn */
public static TableColumn<TableData, String> colLuna() {
TableColumn<TableData, String> colLuna = new TableColumn<>("Luna");
TableColumn<TableData, String> colLuna = new TableColumn<>("Payment");
colLuna.setCellValueFactory(colData -> {
return colData.getValue().lunaProperty().asString();
});
Expand All @@ -55,7 +58,7 @@ public static TableColumn<TableData, String> colLuna() {
/* Returns Amortization Beginning Balance TableColumn */
public static TableColumn<TableData, String> colSoldCreditA() {
TableColumn<TableData, String> soldCreditA =
new TableColumn<>("Sold Credit Inceput");
new TableColumn<>("Beginning Balance");
soldCreditA.setCellValueFactory(colData -> {
return colData.getValue().soldCreditAProperty().asString(FORMAT);
});
Expand All @@ -66,7 +69,7 @@ public static TableColumn<TableData, String> colSoldCreditA() {
/* Returns Amortization Interest TableColumn */
public static TableColumn<TableData, String> colDobandaLunara() {
TableColumn<TableData, String> dobandaLunara =
new TableColumn<>("Dobanda Lunara");
new TableColumn<>("Interest");
dobandaLunara.setCellValueFactory(colData -> {
return colData.getValue().dobandaLunaraProperty()
.asString(FORMAT);
Expand All @@ -78,7 +81,7 @@ public static TableColumn<TableData, String> colDobandaLunara() {
/* Returns Amortization Principal TableColumn */
public static TableColumn<TableData, String> colRataCredit() {
TableColumn<TableData, String> rataCredit =
new TableColumn<>("Rata Credit");
new TableColumn<>("Principal");
rataCredit.setCellValueFactory(colData -> {

return colData.getValue().rataCreditProperty().asString(FORMAT);
Expand All @@ -90,7 +93,7 @@ public static TableColumn<TableData, String> colRataCredit() {
/* Returns Amortization Monthly Payment TableColumn */
public static TableColumn<TableData, String> colRataLunara() {
TableColumn<TableData, String> rataLunara =
new TableColumn<>("Rata Lunara");
new TableColumn<>("Payment");
rataLunara.setCellValueFactory(colData -> {

return colData.getValue().rataLunaraProperty().asString(FORMAT);
Expand All @@ -102,7 +105,7 @@ public static TableColumn<TableData, String> colRataLunara() {
/* Returns Amortization Principal TableColumn */
public static TableColumn<TableData, String> colSoldCreditB() {
TableColumn<TableData, String> soldCreditSfarsit =
new TableColumn<>("Sold Credit Sfarsit");
new TableColumn<>("Ending Balance");
soldCreditSfarsit.setCellValueFactory(colData -> {
return colData.getValue().soldCreditBProperty().asString(FORMAT);
});
Expand Down
39 changes: 14 additions & 25 deletions src/main/java/com/loan/view/LoanView.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,27 +20,23 @@
public class LoanView extends BorderPane {
private LoanModel model;

/* CONSTANTE */
/** Constants */
private static final double INALTIME_PREF_SUS = 80;
private static final double INALTIME_PREF_JOS = 80;
public static final Color COL = Color.ROYALBLUE;
public static final Insets INS = Insets.EMPTY;
public static final CornerRadii RAD = CornerRadii.EMPTY;
public static final BackgroundFill FUNDAL_UMP = new BackgroundFill(COL, RAD, INS);
private static final Background BACKGROUND = new Background(new BackgroundFill(Color.ROYALBLUE, CornerRadii.EMPTY, Insets.EMPTY));

/** TOP */
/** Top */
private TextField cdtValoareImp = new TextField();
private final Label etcValoareImp = new Label("Valoare Credit");
private final Label etcValoareImp = new Label("Loan Amount");
private TextField cdtNrLuni = new TextField();
private final Label etcNrLuni = new Label("Numar Luni");
private final Label etcNrLuni = new Label("Loan Term (months)");
private TextField cdtDobanda = new TextField();
private final Label etcDobanda = new Label("Dobanda Anuala");
private final Label etcDobanda = new Label("Annual Interest Rate (%)");

/** BOTTOM */
private final Button butGraficRamb = new Button("Grafic Rambursare");
private final Button butRezumat = new Button("Rezumat");
private final Button btnAmortizationToggle = new Button("Show amortization schedule");

/** CENTER */
/** Center */
private SummaryView summaryView;
private LoanTableView loanTableView;

Expand Down Expand Up @@ -75,7 +71,7 @@ private HBox contSus() {
set(etcDobanda, cdtDobanda);

contSus.setSpacing(20);
contSus.setBackground(new Background(FUNDAL_UMP));
contSus.setBackground(BACKGROUND);
contSus.setPrefHeight(INALTIME_PREF_SUS);
contSus.setMinHeight(USE_PREF_SIZE);
contSus.setMaxHeight(USE_PREF_SIZE);
Expand All @@ -88,14 +84,11 @@ private HBox contSus() {
private HBox contJos() {
HBox contJos = new HBox(20);

butGraficRamb.setFont(Font.font(null, FontWeight.BOLD, 12));
butRezumat.setFont(Font.font(null, FontWeight.BOLD, 12));
btnAmortizationToggle.setFont(Font.font(null, FontWeight.BOLD, 12));
btnAmortizationToggle.setPrefSize(200, 25);

butGraficRamb.setPrefSize(200, 25);
butRezumat.setPrefSize(200, 25);

contJos.getChildren().addAll(butRezumat, butGraficRamb);
contJos.setBackground(new Background(FUNDAL_UMP));
contJos.getChildren().addAll(btnAmortizationToggle);
contJos.setBackground(BACKGROUND);
contJos.setPrefHeight(INALTIME_PREF_JOS);
contJos.setMinHeight(USE_PREF_SIZE);
contJos.setMaxHeight(USE_PREF_SIZE);
Expand All @@ -114,11 +107,7 @@ private void set(Label lbl, TextField tf) {
}

public Button butGraficRamb() {
return butGraficRamb;
}

public Button butRezumat() {
return butRezumat;
return btnAmortizationToggle;
}

public LoanTableView loanTableView() {
Expand Down
44 changes: 22 additions & 22 deletions src/main/java/com/loan/view/SummaryView.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@
public class SummaryView extends VBox {
private LoanModel model;

private final Label etcRataLunara = new Label("RATA LUNARA");
private final Label etcRataLunara = new Label("MONTHLY PAYMENT");
private Text textRataLunara = new Text();
private final Label etcTotalPlata = new Label("TOTAL DE PLATA");
private final Label etcTotalPlata = new Label("TOTAL PAYMENT");
private Text textTotalPlata = new Text();
private final Label etcDobandaT = new Label("DOBANDA TOTALA");
private final Label etcDobandaT = new Label("TOTAL INTEREST");
private Text textDobandaT = new Text();
private PieChart diagram = new PieChart();
private PieChart chart = new PieChart();

public SummaryView(LoanModel model) {
this.model = model;
Expand All @@ -34,33 +34,33 @@ private void init() {
textRataLunara.textProperty().bind(model.rataLunaProperty().asString("$%.2f"));
textDobandaT.textProperty().bind(model.totalDobandaProperty().asString("$%.2f"));

Group stanga = obtGrup(textTotalPlata, etcTotalPlata);
Group centru = obtGrup(textRataLunara, etcRataLunara);
Group dreapta = obtGrup(textDobandaT, etcDobandaT);
Group totalPaymentGroup = getGroup(textTotalPlata, etcTotalPlata);
Group monthlyPaymentGroup = getGroup(textRataLunara, etcRataLunara);
Group totalInterestGroup = getGroup(textDobandaT, etcDobandaT);

HBox contInfo = new HBox(80);
contInfo.getChildren().addAll(stanga, centru, dreapta);
contInfo.getChildren().addAll(totalPaymentGroup, monthlyPaymentGroup, totalInterestGroup);

diagram.getData().setAll(
new PieChart.Data("Credit", 0.0),
new PieChart.Data("Dobanda", 0.0));
diagram.setStartAngle(90);
diagram.getData().get(0).pieValueProperty().bind(model.valoareProperty());
diagram.getData().get(1).pieValueProperty().bind(model.totalDobandaProperty());
diagram.setLabelsVisible(true);
diagram.setClockwise(false);
chart.getData().setAll(
new PieChart.Data("Principal", 0.0),
new PieChart.Data("Interest", 0.0));
chart.setStartAngle(90);
chart.getData().get(0).pieValueProperty().bind(model.valoareProperty());
chart.getData().get(1).pieValueProperty().bind(model.totalDobandaProperty());
chart.setLabelsVisible(true);
chart.setClockwise(false);

setAlignment(Pos.CENTER);
VBox.setVgrow(diagram, Priority.ALWAYS);
getChildren().addAll(new Group(contInfo), diagram);
VBox.setVgrow(chart, Priority.ALWAYS);
getChildren().addAll(new Group(contInfo), chart);
}

private Group obtGrup(Text textTotalPlata, Label etcTotalPlata) {
private Group getGroup(Text amount, Label description) {
VBox cont = new VBox(-3);
cont.setAlignment(Pos.CENTER);
textTotalPlata.setFont(Font.font(null, FontWeight.BOLD, 52));
etcTotalPlata.setFont(Font.font(null, 24));
cont.getChildren().addAll(textTotalPlata, etcTotalPlata);
amount.setFont(Font.font(null, FontWeight.BOLD, 52));
description.setFont(Font.font(null, 24));
cont.getChildren().addAll(amount, description);
return new Group(cont);
}
}

0 comments on commit e457c7c

Please sign in to comment.