Skip to content

Commit

Permalink
Merge branch 'rc3'
Browse files Browse the repository at this point in the history
  • Loading branch information
plastboks committed May 17, 2015
2 parents ea5017d + dc04bd5 commit 51a905c
Show file tree
Hide file tree
Showing 15 changed files with 96 additions and 85 deletions.
2 changes: 1 addition & 1 deletion release/create.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ TMP=$APP_NAME.$DATE.$1
mkdir $TMP
mkdir $TMP/data
mkdir $TMP/preferences
mkdir $TMP/uploads

cp ../data/demodata.dat $TMP/data/demodata.dat
cp -r ../languages $TMP/
cp -r ../src $TMP/
cp -r ../uploads $TMP/
cp -r ../resources $TMP/
cp ../out/artifacts/$APP_NAME/$APP_NAME.jar $TMP/$APP_NAME.$1.jar

Expand Down
6 changes: 3 additions & 3 deletions src/main/controller/adapter/claim/ClaimAdapter.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ public abstract class ClaimAdapter<T extends Claim> implements Formable<T>
protected T claim;
protected boolean editMode = false;

private final int standardYear = 2014;
private final int standardMonth = 01;
private final int standardDay = 01;
private static final int standardYear = 2014;
private static final int standardMonth = 01;
private static final int standardDay = 01;

/**
* The Call back event.
Expand Down
2 changes: 2 additions & 0 deletions src/main/model/Storage.java
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ public void read() throws IOException, ClassNotFoundException
new FileInputStream(filename));

data = (Map) handle.readObject();

handle.close();
}

/**
Expand Down
8 changes: 4 additions & 4 deletions src/main/preference/XMLParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@
*/
class XMLParser
{
private final String mainFile = "preferences/main.xml";
private final String rootLevel = "preferences";
private final String childLevel = "string";
private final String childAttributeName = "name";
private static final String mainFile = "preferences/main.xml";
private static final String rootLevel = "preferences";
private static final String childLevel = "string";
private static final String childAttributeName = "name";

private Map<String, String> preferences;
private DocumentBuilderFactory dbf;
Expand Down
2 changes: 1 addition & 1 deletion src/main/view/concrete/AboutView.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
public class AboutView extends StandardGridPane
{
private int rowNum = 0;
private final int spaceCount = 5;
private static final int spaceCount = 5;

/**
* Instantiates a new About view.
Expand Down
2 changes: 1 addition & 1 deletion src/main/view/concrete/statistics/ClaimStatisticsView.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public class ClaimStatisticsView extends StandardGridPane
private int lowerBound;
private int upperBound;

private final int cellGap = 5;
private static final int cellGap = 5;
private int rowNum = 0;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public class InsuranceStatisticsView extends StandardGridPane
private final int lowerBound;
private final int upperBound;

private final int cellGap = 5;
private static final int cellGap = 5;
private int rowNum = 0;

/**
Expand Down
1 change: 1 addition & 0 deletions src/main/view/form/Form.java
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ public void validate()
// switch on because each node might have different behaviours
switch (fn.getType()) {
case VALUE:
default:
// check if required or value is not blank
if (fn.getRequired() || !fn.getValue().equals("")) {
FormValueNode fvn = (FormValueNode) fn;
Expand Down
2 changes: 1 addition & 1 deletion src/main/view/form/node/FormCheckBoxesNode.java
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public Builder remove(E... removed)
*/
public Builder lastOneActive(boolean val)
{
this.lastOneActive = lastOneActive;
this.lastOneActive = val;
return this;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,123 +1,130 @@
package main.view.menubar;

import javafx.scene.control.Menu;
import javafx.scene.control.MenuItem;
import javafx.scene.control.SeparatorMenuItem;
import javafx.scene.control.*;
import javafx.scene.control.MenuBar;
import javafx.scene.input.KeyCombination;
import main.controller.*;
import main.localization.Loc;

/**
* MenuBar.java
*/
public class MenuBar extends javafx.scene.control.MenuBar
public class MainMenuBar extends MenuBar
{
private Menu fileMenu, statisticsMenu, reportMenu, newMenu, aboutMenu;

private MenuItem fileSave, closeProject, fileExit, fileRestart,
customerStatistics, insuranceStatistics, claimStatistics,
customerReport, insuranceReport, claimReport,
customer, search, aboutUs;

/**
* Instantiates a new Menu bar.
*/
public MenuBar()
public MainMenuBar()
{
/* Menus */
fileMenu = new Menu(Loc.c("menu_group_file"));

statisticsMenu = new Menu(Loc.c("menu_group_statistics"));

aboutMenu = new Menu(Loc.c("menu_group_about"));

newMenu = new Menu(Loc.c("new"));

reportMenu = new Menu(Loc.c("report"));

/* Menu items */
setupFile();
setupNew();
setupStatistics();
setupReport();
setupAbout();
}

// about
aboutUs = new MenuItem(Loc.c("menu_about"));
aboutUs.setAccelerator(KeyCombination.keyCombination("SHORTCUT + A"));
aboutUs.setOnAction(e -> Mediator.inst.router(Signal.ABOUT, null));
private void setupFile()
{
Menu fileMenu = new Menu(Loc.c("menu_group_file"));

// file
fileSave = new MenuItem(Loc.c("menu_file_save"));
MenuItem fileSave = new MenuItem(Loc.c("menu_file_save"));
fileSave.setOnAction(e -> Mediator.inst.router(Signal.FILE,
new Payload(main.controller.MenuBar.Type.SAVE)));

closeProject = new MenuItem(Loc.c("menu_close_project"));
MenuItem closeProject = new MenuItem(Loc.c("menu_close_project"));
closeProject.setOnAction(e -> Mediator.inst.router(Signal.FILE,
new Payload(main.controller.MenuBar.Type.NEW_PROJECT)));

fileRestart = new MenuItem(Loc.c("restart"));
MenuItem fileRestart = new MenuItem(Loc.c("restart"));
fileRestart.setOnAction(e -> Mediator.inst.router(Signal.FILE,
new Payload(main.controller.MenuBar.Type.RESTART)));

fileExit = new MenuItem(Loc.c("menu_file_exit"));
MenuItem fileExit = new MenuItem(Loc.c("menu_file_exit"));
fileExit.setAccelerator(KeyCombination.keyCombination("SHORTCUT + X"));
fileExit.setOnAction(e -> Mediator.inst.router(Signal.FILE,
new Payload(main.controller.MenuBar.Type.CLOSE)));

// statistics
customerStatistics = new MenuItem(Loc.c("menu_customer_statistics"));
fileMenu.getItems().addAll(closeProject,
new SeparatorMenuItem(),
fileSave,
new SeparatorMenuItem(),
fileRestart, fileExit);

getMenus().add(fileMenu);
}

private void setupStatistics()
{
Menu statisticsMenu = new Menu(Loc.c("menu_group_statistics"));

MenuItem customerStatistics = new MenuItem(Loc.c("menu_customer_statistics"));
customerStatistics.setOnAction(e -> Mediator.inst.router(Signal.STATISTICS,
new Payload(StatisticsController.Type.PERSON)));

insuranceStatistics = new MenuItem(Loc.c("menu_insurance_statistics"));
MenuItem insuranceStatistics = new MenuItem(Loc.c("menu_insurance_statistics"));
insuranceStatistics.setOnAction(e -> Mediator.inst.router(Signal.STATISTICS,
new Payload(StatisticsController.Type.INSURANCE)));

claimStatistics = new MenuItem(Loc.c("menu_claim_statistics"));
MenuItem claimStatistics = new MenuItem(Loc.c("menu_claim_statistics"));
claimStatistics.setOnAction(e -> Mediator.inst.router(Signal.STATISTICS,
new Payload(StatisticsController.Type.CLAIM)));

// reports
customerReport = new MenuItem(Loc.c("menu_customer_report"));
statisticsMenu.getItems().addAll(customerStatistics,
insuranceStatistics, claimStatistics);

getMenus().add(statisticsMenu);
}

private void setupAbout()
{
Menu aboutMenu = new Menu(Loc.c("menu_group_about"));

MenuItem aboutUs = new MenuItem(Loc.c("menu_about"));
aboutUs.setAccelerator(KeyCombination.keyCombination("SHORTCUT + A"));
aboutUs.setOnAction(e -> Mediator.inst.router(Signal.ABOUT, null));

aboutMenu.getItems().addAll(aboutUs);

getMenus().add(aboutMenu);
}

private void setupReport()
{
Menu reportMenu = new Menu(Loc.c("report"));

MenuItem customerReport = new MenuItem(Loc.c("menu_customer_report"));
customerReport.setOnAction(e -> Mediator.inst.router(Signal.REPORT,
new Payload(ReportController.Type.PERSON)));

insuranceReport = new MenuItem(Loc.c("menu_insurance_report"));
MenuItem insuranceReport = new MenuItem(Loc.c("menu_insurance_report"));
insuranceReport.setOnAction(e -> Mediator.inst.router(Signal.REPORT,
new Payload(ReportController.Type.INSURANCE)));

claimReport = new MenuItem(Loc.c("menu_claim_report"));
MenuItem claimReport = new MenuItem(Loc.c("menu_claim_report"));
claimReport.setOnAction(e -> Mediator.inst.router(Signal.REPORT,
new Payload(ReportController.Type.CLAIM)));

// new
customer = new MenuItem(Loc.c("customer"));
customer.setAccelerator(KeyCombination.keyCombination("SHORTCUT + C"));
reportMenu.getItems().addAll(customerReport,
insuranceReport, claimReport);

getMenus().add(reportMenu);
}

private void setupNew()
{
Menu newMenu = new Menu(Loc.c("new"));

MenuItem customer = new MenuItem(Loc.c("customer"));
customer.setAccelerator(KeyCombination.keyCombination("SHORTCUT + C"));
customer.setOnAction(e -> Mediator.inst.router(Signal.FILE,
new Payload(main.controller.MenuBar.Type.NEW_CUSTOMER)));

search = new MenuItem(Loc.c("search"));
MenuItem search = new MenuItem(Loc.c("search"));
search.setAccelerator(KeyCombination.keyCombination("SHORTCUT + S"));
search.setOnAction(e -> Mediator.inst.router(Signal.SEARCH, null));


// Add to menus
fileMenu.getItems().addAll(
closeProject,
new SeparatorMenuItem(),
fileSave,
new SeparatorMenuItem(),
fileRestart,
fileExit);

newMenu.getItems().addAll(search, customer);

statisticsMenu.getItems().addAll(customerStatistics,
insuranceStatistics, claimStatistics);

reportMenu.getItems().addAll(customerReport,
insuranceReport, claimReport);

aboutMenu.getItems().addAll(aboutUs);

getMenus().addAll(fileMenu, newMenu, statisticsMenu,
reportMenu, aboutMenu);
getMenus().add(newMenu);
}
}
4 changes: 2 additions & 2 deletions src/main/view/scene/MainScene.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import javafx.scene.layout.BorderPane;
import main.config.Config;
import main.view.Resources;
import main.view.menubar.MenuBar;
import main.view.menubar.MainMenuBar;

/**
* MainScene.java
Expand All @@ -21,7 +21,7 @@ public MainScene()
{
bp = new BorderPane();

bp.setTop(new MenuBar());
bp.setTop(new MainMenuBar());
bp.setCenter(Resources.inst.getStackPane());
bp.setBottom(Resources.inst.getInfoBar().getMain());

Expand Down
2 changes: 1 addition & 1 deletion src/main/view/scene/ProjectDialogScene.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public class ProjectDialogScene

private Image openExistingIcon, createNewIcon;
private ImageView openExistingImageView, createNewImageView;
private Button openExisting, createNew, langEN, langNO, langIT, langFR;
private Button openExisting, createNew;

private int linesGap = 10, btnSize = 80,
appNameSize = 20, appNamePadding = 5,
Expand Down
1 change: 1 addition & 0 deletions src/main/view/table/SugarTable.java
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ private HBox generateLinks()
Loc.c("insurance_report")));
break;
case CLAIM:
default:
convert = new LinkedList<Claim>();
table.getItems().stream().forEach(convert::add);
statistics.setOnAction(e ->
Expand Down
10 changes: 5 additions & 5 deletions src/test/StorageTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public class StorageTest
/**
* The constant firstnames.
*/
public static final String[] firstnames = {
private static final String[] firstnames = {
"Jonas", "Mathias", "Mattis", "Alexander", "Hans",
"Petter", "Hans-Petter", "Hans Christian", "Andreas",
"Elias", "Kristian", "Christian", "Sebastian", "Stian",
Expand All @@ -50,7 +50,7 @@ public class StorageTest
/**
* The constant lastnames.
*/
public static final String[] lastnames = {
private static final String[] lastnames = {
"Olsen", "Hansen", "Johnsen", "Johansen", "Larsen",
"Andreasen", "Pedersen", "Nilsen", "Kristiansen", "Jensen",
"Karlsen", "Pettersen", "Eriksen", "Berg", "Haugen", "Hagen",
Expand All @@ -63,7 +63,7 @@ public class StorageTest
/**
* The constant cities.
*/
public static final String[] cities = {
private static final String[] cities = {
"Alta", "Arendal", "Askim", "Bergen", "Brekstad", "Brevik",
"Brumunddal", "Bryne", "Drammen", "Egersund", "Elverum",
"Fagernes", "Fauske", "Flekkefjord", "Fredrikstad", "Grimstad",
Expand All @@ -78,7 +78,7 @@ public class StorageTest
/**
* The constant domains.
*/
public static final String[] domains = {
private static final String[] domains = {
"email", "yahoo", "google", "hotmail", "outlook",
"generell-skade", "vannskade", "kollisjon", "steinras",
"storm", "kuvelting", "natur-katastrofe", "vulkan"
Expand All @@ -87,7 +87,7 @@ public class StorageTest
/**
* The constant streetType.
*/
public static final String[] streetType = {
private static final String[] streetType = {
"Vei", "Gate", "Bru", "Sted", "Plass", "Krysset"
};

Expand Down
Binary file removed uploads/Claim-1-car.jpg
Binary file not shown.

0 comments on commit 51a905c

Please sign in to comment.