/** * Updates the GUI sections labels on the left side of the GUI with the currently selected Item */ private void updateOverview() { // check if anything is selected if (!listView.getSelectionModel().isEmpty()) { ItemBox itemBox = listView.getSelectionModel().getSelectedItem(); nameLabel.setText(itemBox.getName()); amountLabel.setText(String.valueOf(itemBox.getAmount()) + "x"); gtinLabel.setText(itemBox.getGtin()); categoriesLabel.setText(itemBox.getCategoriesText("long")); attributesLabel.setText(itemBox.getAttributes()); log.info("Overview set to " + itemBox.getName()); } }
/** * Updates the Item in the ItemBox itemBox * * @param itemBox */ private void updateItem(ItemBox itemBox) { try { Item temp = getNewItem(itemBox.getGtin()); // checks if the currently fetched temp Item is the still the same // item as the one online if (!temp.equals(itemBox.getItem())) { log.info(temp.name + " unequal to " + itemBox.getItem().name); itemBox.setItem(temp); log.info("Changed to " + temp.name); } } catch (Exception e1) { log.error("Error updating Item " + itemBox.getName() + " - " + e1.getMessage()); } }