Source:
<code>protected WidgetGroup topWidget(Vector2 viewport, I18N i18n, Skin skin, Controller controller) { String search = i18n.m("general.gallery.search"); TextField searchTf = new TextField("", skin); searchTf.setMessageText(search); searchTf.setMaxLength(search.length()); final String none = i18n.m("general.gallery.sort"), nameaz = i18n .m("general.gallery.nameAZ"), nameza = i18n .m("general.gallery.nameZA"); this.comparators = new ObjectMap<String, Comparator<T>>(8); this.comparators.put(nameaz, new Comparator<T>() { @Override public int compare(T o1, T o2) { return o1.getTitle().compareTo(o2.getTitle()); } }); this.comparators.put(nameza, new Comparator<T>() { @Override public int compare(T o1, T o2) { return o2.getTitle().compareTo(o1.getTitle()); } }); final Array<String> orders = new Array<String>(false, 4, String.class); orders.add(none); orders.add(nameaz); orders.add(nameza); <START> addShortingsAndComparators(orders, this.comparators, i18n); <END> this.orderingBox = new SelectBox<String>(skin); this.orderingBox.setItems(orders); this.orderingBox.addListener(new ChangeListener() { @Override public void changed(ChangeEvent event, Actor actor) { final String selectedOrdering = orderingBox.getSelected(); if (currentOrdering.equals(selectedOrdering)) return; currentOrdering = selectedOrdering; shortGalleryElements(); } }); this.currentOrdering = this.orderingBox.getSelected(); this.elements = new Array<T>(false, 10, GalleryEntity.class); ToolBar topBar = new ToolBar(viewport, skin); topBar.debug(); topBar.add(topLeftButton(viewport, skin, controller)).left().expandX(); topBar.right(); topBar.add(searchTf, this.orderingBox); return topBar; }</code><technical_language>Small typo: short -> sort</technical_language>

Target:
protected WidgetGroup topWidget(Vector2 viewport, I18N i18n, Skin skin, Controller controller) { String search = i18n.m("general.gallery.search"); TextField searchTf = new TextField("", skin); searchTf.setMessageText(search); searchTf.setMaxLength(search.length()); final String none = i18n.m("general.gallery.sort"), nameaz = i18n .m("general.gallery.nameAZ"), nameza = i18n .m("general.gallery.nameZA"); this.comparators = new ObjectMap<String, Comparator<T>>(8); this.comparators.put(nameaz, new Comparator<T>() { @Override public int compare(T o1, T o2) { return o1.getTitle().compareTo(o2.getTitle()); } }); this.comparators.put(nameza, new Comparator<T>() { @Override public int compare(T o1, T o2) { return o2.getTitle().compareTo(o1.getTitle()); } }); final Array<String> orders = new Array<String>(false, 4, String.class); orders.add(none); orders.add(nameaz); orders.add(nameza); addSortingsAndComparators(orders, this.comparators, i18n); this.orderingBox = new SelectBox<String>(skin); this.orderingBox.setItems(orders); this.orderingBox.addListener(new ChangeListener() { @Override public void changed(ChangeEvent event, Actor actor) { final String selectedOrdering = orderingBox.getSelected(); if (currentOrdering.equals(selectedOrdering)) return; currentOrdering = selectedOrdering; shortGalleryElements(); } }); this.currentOrdering = this.orderingBox.getSelected(); this.elements = new Array<T>(false, 10, GalleryEntity.class); ToolBar topBar = new ToolBar(viewport, skin); topBar.debug(); topBar.add(topLeftButton(viewport, skin, controller)).left().expandX(); topBar.right(); topBar.add(searchTf, this.orderingBox); return topBar; }