/** * Utilizes add function of TreeSet. If successful, selected item for combo- box implementation is * updated to item just added. Event will not be added if a duplicate event is found * * <p>Model is saved to file after Event is added * * @param o the event to be added to this implementation * @return true if item successfully added (TreeSet parent class' add function returns true). * False otherwise. */ @Override public boolean add(T1 o) // Modify to take in Authenication ID for future logging function { if (super.add(o)) { comboBoxModelSelectedItem = o; modelListenersNotify(); ViewerController.saveModel(); return true; } return false; }
/** * Utilizes TreeSet parent's remove function. If it returns true, item is removed and, if item is * selected in combobox model, selected model is updated to first item if size > 0, null * otherwise. * * <p>Model is saved after item is removed * * @param o the object to be removed from the set * @return true if parent class successfully removes the object. false otherwise */ @Override public boolean remove(Object o) // Modify to take in Authenication ID for future logging function { if (super.remove(o)) { if (comboBoxModelSelectedItem.equals(o)) comboBoxModelSelectedItem = ((this.size() > 0) ? this.first() : null); modelListenersNotify(); ViewerController.saveModel(); return true; } return false; }
/** * Utilizes TreeSet parent's addAll function. If parent function returns true, the set has changed * and, as a result, selected item is updated to first item in list and the model is saved to * file. * * @param c Collection of events to be added to model * @return true if the set has changed as a result of this call, false if otherwise */ @Override public boolean addAll( Collection<? extends T1> c) // Modify to take in Authenication ID for future logging function { if (super.addAll(c)) { comboBoxModelSelectedItem = this.first(); modelListenersNotify(); ViewerController.saveModel(); return true; } return false; }