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

import com.imyeyu.fx.ui.TimiFXUI;
import com.imyeyu.fx.ui.components.Hyperlink;
import com.imyeyu.fx.ui.components.TitleLabel;
import com.imyeyu.fx.ui.examples.component.AbstractDemoPane;
import com.imyeyu.fx.ui.examples.component.sidebar.SidebarItem;
import com.imyeyu.fx.utils.scroll.SmoothScroll;
import com.imyeyu.inject.annotation.Component;
import javafx.geometry.Insets;
import javafx.scene.control.ScrollPane;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.GridPane;
import javafx.scene.layout.VBox;

/**
 * 扩展类
 *
 * @author 夜雨
 * @since 2022-09-06 00:07
 */
@Component
public class ExtendDemo extends AbstractDemoPane {

	public ExtendDemo() {
		title.setText(SidebarItem.EXTEND_TOOLS.getText());
		document.sync("https://doc.imyeyu.net/timi-fx/net/imyeyu/timifx/extend/package-summary.html");
		source.sync("https://git.imyeyu.net/Timi/timi-fx/src/master/src/main/java/net/imyeyu/timifx/extend");
		tips.setText(TimiFXUI.MULTILINGUAL.text("fx.example.extend_tools.tips"));
		tips.setBorder(Stroke.BOTTOM);

		setCenter(new ScrollPane() {{
			setPadding(new Insets(20));
			setFitToWidth(true);
			setContent(new VBox() {{
				setPadding(new Insets(32, 20, 10, 20));
				setSpacing(6);
				getChildren().addAll(new Item() {{
					title.setText(TimiFXUI.MULTILINGUAL.text("fx.example.extend_tools.x_border"));
					document.sync("https://doc.imyeyu.net/timi-fx/net/imyeyu/timifx/extend/XBorder.html");
					source.sync("https://git.imyeyu.net/Timi/timi-fx/src/master/src/main/java/net/imyeyu/timifx/extend/XBorder.java");
				}}, new Item() {{
					title.setText(TimiFXUI.MULTILINGUAL.text("fx.example.extend_tools.bg_fill"));
					document.sync("https://doc.imyeyu.net/timi-fx/net/imyeyu/timifx/extend/BgFill.html");
					source.sync("https://git.imyeyu.net/Timi/timi-fx/src/master/src/main/java/net/imyeyu/timifx/extend/BgFill.java");
				}}, new Item() {{
					title.setText(TimiFXUI.MULTILINGUAL.text("fx.example.extend_tools.bg_image"));
					document.sync("https://doc.imyeyu.net/timi-fx/net/imyeyu/timifx/extend/BgImage.html");
					source.sync("https://git.imyeyu.net/Timi/timi-fx/src/master/src/main/java/net/imyeyu/timifx/extend/BgImage.java");
				}}, new Item() {{
					title.setText(TimiFXUI.MULTILINGUAL.text("fx.example.extend_tools.column"));
					document.sync("https://doc.imyeyu.net/timi-fx/net/imyeyu/timifx/extend/Column.html");
					source.sync("https://git.imyeyu.net/Timi/timi-fx/src/master/src/main/java/net/imyeyu/timifx/extend/Column.java");
				}}, new Item() {{
					title.setText(TimiFXUI.MULTILINGUAL.text("fx.example.extend_tools.row"));
					document.sync("https://doc.imyeyu.net/timi-fx/net/imyeyu/timifx/extend/Row.html");
					source.sync("https://git.imyeyu.net/Timi/timi-fx/src/master/src/main/java/net/imyeyu/timifx/extend/Row.java");
				}}, new Item() {{
					title.setText(TimiFXUI.MULTILINGUAL.text("fx.example.extend_tools.directory_selector"));
					document.sync("https://doc.imyeyu.net/timi-fx/net/imyeyu/timifx/extend/DirectorySelector.html");
					source.sync("https://git.imyeyu.net/Timi/timi-fx/src/master/src/main/java/net/imyeyu/timifx/extend/DirectorySelector.java");
				}}, new Item() {{
					title.setText(TimiFXUI.MULTILINGUAL.text("fx.example.extend_tools.file_selector"));
					document.sync("https://doc.imyeyu.net/timi-fx/net/imyeyu/timifx/extend/FileSelector.html");
					source.sync("https://git.imyeyu.net/Timi/timi-fx/src/master/src/main/java/net/imyeyu/timifx/extend/FileSelector.java");
				}}, new Item() {{
					title.setText(TimiFXUI.MULTILINGUAL.text("fx.example.extend_tools.logic_bindings"));
					document.sync("https://doc.imyeyu.net/timi-fx/net/imyeyu/timifx/extend/LogicBindings.html");
					source.sync("https://git.imyeyu.net/Timi/timi-fx/src/master/src/main/java/net/imyeyu/timifx/extend/LogicBindings.java");
				}}, new Item() {{
					title.setText(TimiFXUI.MULTILINGUAL.text("fx.example.extend_tools.no_selection_model"));
					document.sync("https://doc.imyeyu.net/timi-fx/net/imyeyu/timifx/extend/NoSelectionModel.html");
					source.sync("https://git.imyeyu.net/Timi/timi-fx/src/master/src/main/java/net/imyeyu/timifx/extend/NoSelectionModel.java");
				}}, new Item() {{
					title.setText(TimiFXUI.MULTILINGUAL.text("fx.example.extend_tools.text_flower"));
					document.sync("https://doc.imyeyu.net/timi-fx/net/imyeyu/timifx/extend/TextFlower.html");
					source.sync("https://git.imyeyu.net/Timi/timi-fx/src/master/src/main/java/net/imyeyu/timifx/extend/TextFlower.java");
				}}, new Item() {{
					title.setText(TimiFXUI.MULTILINGUAL.text("fx.example.extend_tools.x_anchor_pane"));
					document.sync("https://doc.imyeyu.net/timi-fx/net/imyeyu/timifx/extend/XAnchorPane.html");
					source.sync("https://git.imyeyu.net/Timi/timi-fx/src/master/src/main/java/net/imyeyu/timifx/extend/XAnchorPane.java");
				}});
			}});
			SmoothScroll.pane.install(this);
		}});
	}

	/**
	 * 列表项
	 *
	 * @author 夜雨
 * @since 2022-09-06 02:17
	 */
	private static class Item extends BorderPane {

		/** 标题 */
		final TitleLabel title = new TitleLabel();

		/** 文档 */
		final Hyperlink document = new Hyperlink();

		/** 源码 */
		final Hyperlink source = new Hyperlink();

		public Item() {
			setPadding(new Insets(0, 0, 32, 0));
			setTop(title);
			setCenter(new GridPane() {{
				setHgap(6);
				setVgap(4);
				setPadding(new Insets(10, 0, 10, 20));

				addRow(0, TimiFXUI.label(TimiFXUI.MULTILINGUAL.text("document")), document);
				addRow(1, TimiFXUI.label(TimiFXUI.MULTILINGUAL.text("source")), source);
			}});
		}
	}
}
