Permalink
Browse files

Finished initial implementation of cliOutput.properties file for prom…

…pts, killed off ConsoleOutput class
  • Loading branch information...
1 parent a6fbf33 commit 50b0c247860a429ad3970e1824a5858a9232173f @nathanh89 nathanh89 committed Nov 10, 2012
View
@@ -14,4 +14,6 @@ badPathInput = That's not a valid path, yo. Enter y for the default or enter a p
notEvenANumberGenius = That's...not a number. Try again!
thatsNotAChoice = That's not one you can choose from, yo. WTF? Try again!
wTF = Something has gone wrong. ABORT THE BABIES!"
-adios = Budget saved! Adios, amigo.
+adios = Budget saved! Adios, amigo.
+savedInDefault = Where is the budget saved? The default directory is:
+whereSaved = Enter y for the default, or enter path below:
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.
@@ -14,4 +14,6 @@ badPathInput = That's not a valid path, yo. Enter y for the default or enter a p
notEvenANumberGenius = That's...not a number. Try again!
thatsNotAChoice = That's not one you can choose from, yo. WTF? Try again!
wTF = Something has gone wrong. ABORT THE BABIES!"
-adios = Budget saved! Adios, amigo.
+adios = Budget saved! Adios, amigo.
+savedInDefault = Where is the budget saved? The default directory is:
+whereSaved = Enter y for the default, or enter path below:
@@ -1,30 +0,0 @@
-package com.VSSBudgetBoss.cli;
-
-import com.VSSBudgetBoss.main.BudgetBoss;
-
-public class ConsoleOutput {
-
- public static void creatingBudget(String name){
- System.out.println("Creating budget " + name + "...");
- }
-
- public static void getLoadDirectoryPath(){
- System.out.println("Where is the budget saved? The default directory is:");
- System.out.println(BudgetBoss.getDefaultDirectory());
- System.out.println("Enter y for the default, or enter path below:");
- }
-
- public static void giveDefaultDir(){
- System.out.println("(" + defaultDirectory + " is the default)");
- }
-
- public static void pathToSalvationCheck(String defaultDirectory){
- System.out.println("Save in " + defaultDirectory + "? (y/n)");
- }
-
- public static void openingSelectedBudget(String name) {
- System.out.println("Opening " + name);
- }
-
-}
-
@@ -13,7 +13,7 @@ public String listenForInput(){
try {
desiredInput = listener.readLine();
} catch (IOException e) {
- System.out.println("You fucked up. Un-Bosslike.");
+ System.out.println("You fucked up. I mean, it wasn't me. Un-Bosslike.");
}
return desiredInput;
}
@@ -30,22 +30,24 @@ else if(validateUserPath(toCheck)){
BudgetBoss.setDefaultDirectory(toCheck);
return toCheck;
}
- else
- ConsoleOutput.badPathInput(defaultDirectory);
+ else{
+ BudgetBoss.printPrompt("badPathInput");
+ System.out.println("The default directory is " + defaultDirectory);
return "ERROR";
+ }
}
public boolean validateBudgetSelection(String toCheck, File[] foundBudgets){
try{
Integer.parseInt(toCheck);
}catch(NumberFormatException e){
- ConsoleOutput.NotEvenANumberGenius();
+ BudgetBoss.printPrompt("notEvenANumberGenius");
return false;
}
int highestSelection = foundBudgets.length;
int userSelection = Integer.valueOf(toCheck);
if(userSelection > highestSelection){
- ConsoleOutput.ThatsNotAChoice();
+ BudgetBoss.printPrompt("thatsNotAChoice");
return false;
}
else
@@ -8,7 +8,7 @@
public class Opener {
- private boolean promptNeedsToClear = true;
+ private boolean promptCleared = true;
public void askToOpenBudget(String defaultDirectory){
InputValidator validator = new InputValidator();
@@ -19,7 +19,7 @@ public void askToOpenBudget(String defaultDirectory){
getUserDirectoryPath(defaultDirectory);
else if(validatedInput.equals("n")){
BudgetBoss.printPrompt("dontSearchBudgets");
- promptNeedsToClear = false;
+ promptCleared = false;
}
else
BudgetBoss.printPrompt("invalidEntryYN");
@@ -28,7 +28,9 @@ else if(validatedInput.equals("n")){
private void getUserDirectoryPath(String defaultDirectory){
String validatedPath = "ERROR";
BudgetFinder finder = new BudgetFinder();
- ConsoleOutput.getLoadDirectoryPath();
+ BudgetBoss.printPrompt("savedInDefault");
+ System.out.println(BudgetBoss.getDefaultDirectory());
+ BudgetBoss.printPrompt("whereSaved");
while(validatedPath.equals("ERROR")){
InputValidator validator = new InputValidator();
InputListener listener = new InputListener();
@@ -43,11 +45,11 @@ private void getUserDirectoryPath(String defaultDirectory){
int index = -1;
while(index < 0)
index = getBudgetNumberToOpen(foundBudgets);
- ConsoleOutput.openingSelectedBudget(foundBudgets[index].getName());
+ System.out.println("Opening " + foundBudgets[index].getName());
BudgetBoss.setCurrentBudget(loadBudget(index, foundBudgets));
BudgetBoss.setDefaultDirectory(validatedPath);
TheCreator.notStillBudgetless();
- promptNeedsToClear = false;
+ promptCleared = false;
}
else
BudgetBoss.printPrompt("noBudgetFound");
@@ -94,6 +96,6 @@ private Budget loadBudget(int index, File[] foundBudgets){
}
public boolean promptNeedsToClear(){
- return promptNeedsToClear;
+ return promptCleared;
}
}
@@ -3,17 +3,15 @@
import java.io.*;
import com.VSSBudgetBoss.budget.Budget;
-import com.VSSBudgetBoss.cli.InputListener;
-import com.VSSBudgetBoss.cli.InputValidator;
-import com.VSSBudgetBoss.cli.ConsoleOutput;
+import com.VSSBudgetBoss.cli.*;
import com.VSSBudgetBoss.main.BudgetBoss;
public class Salvation {
public void autoSave(String fileName, Budget budget, String pathToSalvation){
InputValidator validator = new InputValidator();
InputListener listener = new InputListener();
- ConsoleOutput.pathToSalvationCheck(pathToSalvation);
+ System.out.println("Save in " + pathToSalvation + "? (y/n)");
String validatedInput = validator.inputIsEitherYOrN(listener.listenForInput());
if(validatedInput.equals("y"))
writeBudgetToDisk(fileName, budget, pathToSalvation);
@@ -27,7 +27,7 @@ private void getBudgetName(){
InputListener listener = new InputListener();
BudgetBoss.printPrompt("getBudgetName");
String desiredName = listener.listenForInput();
- ConsoleOutput.creatingBudget(desiredName);
+ System.out.println("Creating budget " + desiredName + "...");
Budget newBudget = new Budget(desiredName);
BudgetBoss.setCurrentBudget(newBudget);
budgetless = false;
@@ -46,6 +46,8 @@ public static void main(String args[]){
savior.autoSave(currentBudget.getName(), currentBudget, defaultDirectory);
}catch (NullPointerException e){
System.out.println(cliOutput.getString("noBudgetToSave"));
+ //Theres a better way to do this but I'm too tired. Add a paramter to check paths that make sure they end in a slash
+ //or else your filenames get all wonkified when they save.
}
}
}

0 comments on commit 50b0c24

Please sign in to comment.