//========================================== // Creates the full alphabetical HTML //========================================== void makeAlphaSidebarHTML(EntryClass[] fullTopics) { // ArrayList for all the HTML strings ArrayList AZList = new ArrayList(); // Open HTML AZList.add(""); AZList.add(""); // Steps through the full topics array for (int i=0; i singleHTMLList = makeSingleEntryHTML(fullTopics[i]); // And adds it to the main ArrayList AZList.addAll(singleHTMLList); } // Close HTML AZList.add(""); String[] AZArray = AZList.toArray(new String[AZList.size()]); saveStrings("sidebar-alpha.HTML", AZArray); } //========================================== // Makes an ArrayList with the HTML string for a single entry //========================================== ArrayList makeSingleEntryHTML(EntryClass cEntry) { // String list for everything ArrayList cHTMLList = new ArrayList(); // entry class cHTMLList.add("
"); // h3 Title topic cHTMLList.add("

"); cHTMLList.add(""); // T/F for italic title formatting if (cEntry.title == false) { cHTMLList.add("" + cEntry.Topic + "

"); } else { cHTMLList.add("" + cEntry.Topic + ""); } // locations list cHTMLList.add(""); // close entry class cHTMLList.add("
"); cHTMLList.add(""); return(cHTMLList); } //========================================== // NEW // Makes Stacks + Categories HTML //========================================== void makeStackCategoriesSidebarHTML(EntryClass[] fullTopics) { int numStacks = 6; // List for HTML Strings ArrayList HTMLList = new ArrayList(); // Open HTML HTMLList.add(""); HTMLList.add(""); // Main loop for each stack for (int cStack=1; cStack<(numStacks+1); cStack++) { // Stack Heading HTMLList.add(""); //HTMLList.add("

Stack 0" + (cStack+1) + " Categories

"); HTMLList.add("

Stack 0" + (cStack) + " Categories

"); HTMLList.add(""); // Make an ArrayList for all the categories in the stack (in traversal order) ArrayList StackCats = new ArrayList(); for (TableRow row : table.rows()) { if (Integer.parseInt(row.getString("Stack")) == cStack) { String rowCat = row.getString("Topic Categories"); if (StackCats.contains(rowCat) == false) { StackCats.add(rowCat); } } } // Convert to StackCats an array for ease String[] StackCatsArray = StackCats.toArray(new String[0]); for (int cCat=0; cCat CatEntries = new ArrayList(); for (TableRow row : table.rows()) { // 1. If the row has the category if ((Integer.parseInt(row.getString("Stack")) == cStack) && (row.getString("Topic Categories").equals(StackCatsArray[cCat]))) { // 2. Get the current row location String cLoc = generateLocString(row); // 3. Loop through the master topics list // If the location matches, add it to the CatEntry list. for (int i=0; i"); HTMLList.add(""); HTMLList.add("" + StackCatsArray[cCat] + ""); // create category div HTMLList.add("
"); HTMLList.add(""); // Convert CatEntries to an array for ease EntryClass[] CatEntriesArray = CatEntries.toArray(new EntryClass[0]); for (int i=0; i singleHTMLList = makeSingleEntryHTML(CatEntriesArray[i]); // And adds it to the main ArrayList HTMLList.addAll(singleHTMLList); } // close category div HTMLList.add(""); HTMLList.add("
"); } // End Main Loop } // Close HTML HTMLList.add(""); String[] AZArray = HTMLList.toArray(new String[HTMLList.size()]); saveStrings("sidebar-stacks.HTML", AZArray); } //========================================== // OLD // This one takes the full A-Z list and divides it up via stacks //========================================== void makeStackSidebarHTML(EntryClass[] fullTopics) { // This could be hard-coded but let's make it a variable for cleanliness int numStacks = 6; int numBanks = 12; // Nested ArrayLists for holding entries belonging to each stack. // See here for Qs about nesting generics: https://stackoverflow.com/a/2992643/9012194 ArrayList> stackTopics2DList = new ArrayList>(); for (int i=0; i()); } for (int i=0; i AZList = new ArrayList(); // Open HTML AZList.add(""); AZList.add(""); // Loop through each List individually for (int i=0; i"); AZList.add("

Stack 0" + (i+1) + " Topics

"); AZList.add(""); for (int j=0; j singleEntryHTMLList = makeSingleEntryHTML(cEntry); AZList.addAll(singleEntryHTMLList); } } // Close HTML AZList.add(""); String[] AZArray = AZList.toArray(new String[AZList.size()]); saveStrings("sidebar-stacks.HTML", AZArray); } //========================================== // OLD // This one takes the full A-Z list and divides it up via stacks and banks //========================================== void makeStackBankSidebarHTML(EntryClass[] fullTopics) { // This could be hard-coded but let's make it a variable for cleanliness int numStacks = 6; int numBanks = 12; // Nested ArrayLists for holding entries belonging to each stack. // See here for Qs about nesting generics: https://stackoverflow.com/a/2992643/9012194 ArrayList> stackTopics2DList = new ArrayList>(); for (int i=0; i()); } for (int i=0; i AZList = new ArrayList(); // Open HTML AZList.add(""); AZList.add(""); // Loop through each List individually for (int i=0; i"); AZList.add("

Stack 0" + (i+1) + " Topics

"); AZList.add(""); for (int j=0; j singleEntryHTMLList = makeSingleEntryHTML(cEntry); AZList.addAll(singleEntryHTMLList); } } // Close HTML AZList.add(""); String[] AZArray = AZList.toArray(new String[AZList.size()]); saveStrings("sidebar-stacks.HTML", AZArray); }