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

import com.imyeyu.fx.ui.TimiFXUI;
import com.imyeyu.fx.ui.components.Hyperlink;
import com.imyeyu.fx.ui.components.IconPicker;
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.layout.FlowPane;
import javafx.scene.layout.VBox;
import javafx.scene.text.TextFlow;

/**
 * 图标选择
 *
 * @author 夜雨
 * @since 2022-08-29 21:48
 */
@Component
public class IconPickerDemo extends AbstractDemoPane {

	public IconPickerDemo() {
		title.setText(SidebarItem.ICON_PICKER.getText());
		document.sync("https://doc.imyeyu.net/timi-fx/net/imyeyu/timifx/component/IconPicker.html");
		source.sync("https://git.imyeyu.net/Timi/timi-fx/src/master/src/main/java/net/imyeyu/timifx/component/IconPicker.java");

		// 图标主页
		Hyperlink index = new Hyperlink("https://www.imyeyu.net/article/public/aid119.html");

		if (getTop() instanceof VBox top) {
			top.getChildren().add(new TextFlow() {{
				setPadding(new Insets(3, 6, 3, 6));
				getChildren().addAll(TimiFXUI.label(TimiFXUI.MULTILINGUAL.text("fx.example.icon_picker.tips")), index);
			}});
		}

		// 选择器
		IconPicker picker = new IconPicker();
		picker.setPrefWidth(260);

		setCenter(new FlowPane() {{
			setPadding(new Insets(20));
			getChildren().add(picker);
		}});
	}
}
