forked from j62/ctbrec
Introduced tab for LiveJasmin to force logins
This commit is contained in:
parent
9ceec96195
commit
d46e4be450
|
@ -0,0 +1,54 @@
|
||||||
|
package ctbrec.ui.sites.jasmin;
|
||||||
|
|
||||||
|
import ctbrec.sites.Site;
|
||||||
|
import ctbrec.ui.FollowedTab;
|
||||||
|
import ctbrec.ui.PaginatedScheduledService;
|
||||||
|
import ctbrec.ui.ThumbOverviewTab;
|
||||||
|
import javafx.concurrent.WorkerStateEvent;
|
||||||
|
import javafx.scene.Scene;
|
||||||
|
import javafx.scene.control.Label;
|
||||||
|
import javafx.scene.input.KeyCode;
|
||||||
|
import javafx.scene.input.KeyEvent;
|
||||||
|
|
||||||
|
public class LiveJasminTab extends ThumbOverviewTab implements FollowedTab {
|
||||||
|
private Label status;
|
||||||
|
|
||||||
|
public LiveJasminTab(String title, PaginatedScheduledService updateService, Site site) {
|
||||||
|
super(title, updateService, site);
|
||||||
|
status = new Label("Logging in...");
|
||||||
|
grid.getChildren().add(status);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void createGui() {
|
||||||
|
super.createGui();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onSuccess() {
|
||||||
|
grid.getChildren().remove(status);
|
||||||
|
super.onSuccess();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onFail(WorkerStateEvent event) {
|
||||||
|
status.setText("Login failed");
|
||||||
|
super.onFail(event);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void selected() {
|
||||||
|
status.setText("Logging in...");
|
||||||
|
super.selected();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setScene(Scene scene) {
|
||||||
|
scene.addEventFilter(KeyEvent.KEY_PRESSED, event -> {
|
||||||
|
if(this.isSelected()) {
|
||||||
|
if(event.getCode() == KeyCode.DELETE) {
|
||||||
|
follow(selectedThumbCells, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -42,7 +42,7 @@ public class LiveJasminTabProvider extends TabProvider {
|
||||||
|
|
||||||
private ThumbOverviewTab createTab(String title, String url) {
|
private ThumbOverviewTab createTab(String title, String url) {
|
||||||
LiveJasminUpdateService s = new LiveJasminUpdateService(liveJasmin, url);
|
LiveJasminUpdateService s = new LiveJasminUpdateService(liveJasmin, url);
|
||||||
ThumbOverviewTab tab = new ThumbOverviewTab(title, s, liveJasmin);
|
LiveJasminTab tab = new LiveJasminTab(title, s, liveJasmin);
|
||||||
tab.setRecorder(liveJasmin.getRecorder());
|
tab.setRecorder(liveJasmin.getRecorder());
|
||||||
s.setPeriod(Duration.seconds(60));
|
s.setPeriod(Duration.seconds(60));
|
||||||
return tab;
|
return tab;
|
||||||
|
|
Loading…
Reference in New Issue