@Override public void elementRemoved(ListEvent<CompanionFacade> e) { String type = e.getElement().getCompanionType(); int index = Collections.binarySearch(types, type, Comparators.toStringIgnoreCaseCollator()); CompanionTypeNode child = (CompanionTypeNode) getChildAt(index); child.removeCompanion(e.getElement()); }
private void addCompanion(CompanionFacade companion, boolean silently) { String type = companion.getCompanionType(); int index = Collections.binarySearch(types, type, Comparators.toStringIgnoreCaseCollator()); if (index < 0) { Logging.errorPrint( "Unable to add companion " + companion + " as the type " + type + " could not be found."); return; } CompanionTypeNode child = (CompanionTypeNode) getChildAt(index); child.addCompanion(companion, silently); }