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

import com.imyeyu.fx.ui.components.DateTimePicker;
import com.imyeyu.fx.ui.examples.component.AbstractDemoPane;
import com.imyeyu.fx.ui.examples.component.sidebar.SidebarItem;
import com.imyeyu.inject.annotation.Component;
import com.imyeyu.utils.Time;
import javafx.geometry.Insets;
import javafx.scene.layout.FlowPane;

/**
 * 时间日期选择器
 *
 * @author 夜雨
 * @since 2022-08-29 16:17
 */
@Component
public class DateTimePickerDemo extends AbstractDemoPane {

	private final DateTimePicker picker;

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

		picker = new DateTimePicker();

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

	@Override
	protected void onShow() {
		picker.setValue(Time.now());
	}
}
