54 lines
1.5 KiB
Java
54 lines
1.5 KiB
Java
package ctbrec.ui.sites.showup;
|
|
|
|
import ctbrec.sites.showup.Showup;
|
|
import ctbrec.ui.settings.Sites;
|
|
import ctbrec.ui.settings.TabUtils;
|
|
import ctbrec.ui.sites.AbstractTabProvider;
|
|
import ctbrec.ui.tabs.ThumbOverviewTab;
|
|
import javafx.scene.Scene;
|
|
import javafx.scene.control.Tab;
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.HashMap;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
|
|
public class ShowupTabProvider extends AbstractTabProvider {
|
|
|
|
public ShowupTabProvider(Showup site) {
|
|
super(site);
|
|
}
|
|
|
|
@Override
|
|
protected List<Tab> getSiteTabs(Scene scene) {
|
|
List<Tab> tabs = new ArrayList<>();
|
|
|
|
Map<String, String> tabMap = new HashMap<>();
|
|
tabMap.put("female", "Women");
|
|
tabMap.put("male", "Men");
|
|
tabMap.put("all", "All");
|
|
List<String> enabledTabs = TabUtils.getEnabledTabs(Sites.SHOWUP);
|
|
for (String tab : enabledTabs) {
|
|
String title = tabMap.getOrDefault(tab, tab);
|
|
tabs.add(createTab(title, tab));
|
|
}
|
|
|
|
var showupFollowedTab = new ShowupFollowedTab("Favorites", (Showup) site);
|
|
showupFollowedTab.setRecorder(site.getRecorder());
|
|
tabs.add(showupFollowedTab);
|
|
return tabs;
|
|
}
|
|
|
|
@Override
|
|
public Tab getFollowedTab() {
|
|
return null;
|
|
}
|
|
|
|
private Tab createTab(String title, String category) {
|
|
var updateService = new ShowupUpdateService((Showup) site, category);
|
|
var tab = new ThumbOverviewTab(title, updateService, site);
|
|
tab.setRecorder(site.getRecorder());
|
|
return tab;
|
|
}
|
|
}
|