Class_DNDView - GensokyoGears/itemsets GitHub Wiki
DNDView.java
This is the main class used for creating the Item Sets. We are declaring the following elements:
- private List item - list of items
- private List droppedItems - list of dropped items into drop area
- private List submitedItems - list of submited items
- private List allItems - list os all items (filled from the database)
- private Item selectedItem - currently selected item
- private List blockList - list of submited blocks
- public ItemSet itemSet - ItemSet object
- public Block block - block object
- ArrayList championList - list of champions
- String search - string used for items filtering
- String username - name of the current ItemSet creator
- public Integer selectedChampion - id of selected champion
Functions:
-
init() function - The first part of the function inserts default values into the variables. The second part (in the try{}), is used to fill our championList from the database.
-
select function - used to filter items visible when creating the Item Set.
-
submitItemSet function - inserts the created Item Set into the itemsets table in our database.
-
createJson function - checks if all required fields are filled and then (if everything is ok) it creates the item set .json file form submited blocks and data. It also initializes the submitItemSet function and initiates the download of the .json file.
-
onItemDrop function - adds items to the blocks itemlist that are dragged and dropped into the block, when creating the Item Set.
-
submitBlock function - checks if all required information in current block are filled, and then it adds this new block int the submited block list.
-
deleteItem function - deletes the item form the current block.
-
deleteBlock function - deletes a block from the submited block list.
-
showMessage function - is a function that displays messages for the user.