package no.hioa.dape1400.s236758.HelperTools;

/**
 * Created by dags on 20.08.15.
 */
public class ConsoleMenuHelper {
    private int nextMenuID ;

    public ConsoleMenuHelper() {
        this.nextMenuID = 1 ;
    }

    public int getNextMenuID() {
        return this.nextMenuID;
    }

    public int getPreviousMenuID() {
        return this.getNextMenuID() - 1;
    }

    private void increaseNextMenuID() {
        this.nextMenuID ++;
    }

    public String nextItem(String itemText) {
        String returnItem = "\t" + this.getNextMenuID() + ") " + itemText + "\n";
        this.increaseNextMenuID();
        return returnItem;
    }
}

@@ -40,16 +40,46 @@
 Tools;%0A%0A
+import java.util.ArrayList;%0A%0A%0A
 /**%0A * C
@@ -171,16 +171,125 @@
 MenuID ;
+%0A    private ArrayList%3CRunnable%3E methods ;%0A    private int methodSize ;%0A    private StringBuilder dashboard ;
 %0A%0A    pu
@@ -311,16 +311,31 @@
 uHelper(
+String menuName
 ) %7B%0A    
@@ -347,95 +347,637 @@
 his.
-nextMenuID = 1 ;%0A    %7D%0A%0A    public int getNextMenuID() %7B%0A        return this.nextMenuID
+dashboard = new StringBuilder().append(menuName).append(%22%5Cn%22);%0A        this.methods = new ArrayList%3C%3E() ;%0A        this.nextMenuID = 1 ;%0A    %7D%0A%0A    public void addItem(String menuText, Runnable methodName) %7B%0A        this.dashboard.append(menuItemText(menuText)) ;%0A        this.methods.add(this.getNextMenuID(), methodName);%0A        this.increaseNextMenuID();%0A    %7D%0A%0A    public int getNextMenuID() %7B%0A        return this.nextMenuID;%0A    %7D%0A%0A    public int getMethodSize() %7B%0A        this.methodSize = this.methods.size() ;%0A        return methodSize ;%0A    %7D%0A    public Runnable getMethod(int index) %7B%0A        return methods.get(index) 
 ;%0A  
@@ -1163,16 +1163,20 @@
 ing 
-nextItem
+menuItemText
 (Str
@@ -1203,142 +1203,73 @@
     
-String returnItem = %22%5Ct%22 + this.getNextMenuID() + %22) %22 + itemText + %22%5Cn%22;%0A        this.increaseNextMenuID();%0A        return returnItem
+return String.format(%22%5Ct%25d) %25s%5Cn%22,this.getNextMenuID(), itemText)
 ;%0A  

change CMH to allow for less code in main classes when creating menus