package com.imyeyu.fx.ui.examples.view.pages.other;

import com.imyeyu.fx.task.RunAsync;
import com.imyeyu.fx.ui.ScreenIdentify;
import com.imyeyu.fx.ui.TimiFXUI;
import com.imyeyu.fx.ui.examples.component.AbstractDemoPane;
import com.imyeyu.fx.ui.examples.component.sidebar.SidebarItem;
import com.imyeyu.inject.annotation.Component;
import javafx.geometry.Insets;
import javafx.scene.control.Button;
import javafx.scene.layout.HBox;

/**
 * 多屏操作
 *
 * @author 夜雨
 * @since 2022-09-01 14:39
 */
@Component
public class ScreenFXDemo extends AbstractDemoPane {

	public ScreenFXDemo() {
		title.setText(SidebarItem.SCREEN.getText());
		document.sync("https://doc.imyeyu.net/timi-fx/net/imyeyu/timifx/util/ScreenFX.html");
		source.sync("https://git.imyeyu.net/Timi/timi-fx/src/master/src/main/java/net/imyeyu/timifx/util/ScreenFX.java");

		// 标识
		Button identify = new Button(TimiFXUI.MULTILINGUAL.text("fx.example.screen.show_identify"));

		setCenter(new HBox() {{
			setPadding(new Insets(20));
			getChildren().add(identify);
		}});

		// ---------- 事件 ----------

		// 显示标识
		identify.setOnAction(e -> {
			ScreenIdentify screenIdentify = new ScreenIdentify();
			screenIdentify.showIdentify();
			RunAsync.later(screenIdentify::hideIdentify, 4000);
		});
	}
}
