package ctbrec.ui.sites.fc2live;

import ctbrec.sites.fc2live.Fc2Live;
import ctbrec.ui.FollowedTab;
import ctbrec.ui.ThumbOverviewTab;
import javafx.geometry.Insets;
import javafx.scene.control.RadioButton;
import javafx.scene.control.ToggleGroup;
import javafx.scene.layout.HBox;

public class Fc2FollowedTab extends ThumbOverviewTab implements FollowedTab {

    public Fc2FollowedTab(Fc2Live fc2live) {
        super("Followed", new Fc2FollowedUpdateService(fc2live), fc2live);
    }

    @Override
    protected void createGui() {
        super.createGui();
        //addOnlineOfflineSelector();
    }

    @SuppressWarnings("unused")
    private void addOnlineOfflineSelector() {
        ToggleGroup group = new ToggleGroup();
        RadioButton online = new RadioButton("online");
        online.setToggleGroup(group);
        RadioButton offline = new RadioButton("offline");
        offline.setToggleGroup(group);
        pagination.getChildren().add(online);
        pagination.getChildren().add(offline);
        HBox.setMargin(online, new Insets(5,5,5,40));
        HBox.setMargin(offline, new Insets(5,5,5,5));
        online.setSelected(true);
        group.selectedToggleProperty().addListener((e) -> {
            ((Fc2FollowedUpdateService)updateService).setShowOnline(online.isSelected());
            queue.clear();
            updateService.restart();
        });
    }
}
