Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
de85570e50
|
@ -0,0 +1,102 @@
|
|||
package org.cutem.cutecalendar.presenter.newitems;
|
||||
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.scene.control.ChoiceBox;
|
||||
import javafx.scene.control.TextField;
|
||||
import org.cutem.cutecalendar.model.TodoItem;
|
||||
import org.cutem.cutecalendar.model.TodoItemFactory;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class CourseTypeBuilder extends NewItemBuilder {
|
||||
|
||||
public static class Factory implements IFactory {
|
||||
@Override
|
||||
public String getTypeName() {
|
||||
return TYPE_NAME;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NewItemBuilder construct(@Nullable TodoItem parent) {
|
||||
return new CourseTypeBuilder(parent);
|
||||
}
|
||||
}
|
||||
|
||||
private static final String COURSE_TYPE_LAYOUT = "fxml/newitem_layouts/course_type_layout.fxml";
|
||||
|
||||
private static final int TYPE = TodoItem.COURSE;
|
||||
|
||||
private static final String TYPE_NAME = TodoItem.typeName(TYPE);
|
||||
|
||||
@FXML
|
||||
private TextField bgnTimeText;
|
||||
@FXML
|
||||
private TextField endTimeText;
|
||||
@FXML
|
||||
private TextField repeatText;
|
||||
@FXML
|
||||
private TextField titleText;
|
||||
@FXML
|
||||
private TextField contentText;
|
||||
@FXML
|
||||
private TextField locationText;
|
||||
@FXML
|
||||
private TextField descriptionText;
|
||||
|
||||
@FXML
|
||||
private ChoiceBox<String> priorityBox;
|
||||
@FXML
|
||||
private ChoiceBox<String> importanceBox;
|
||||
@FXML
|
||||
private ChoiceBox<String> alarmMethodBox;
|
||||
@FXML
|
||||
private TextField alarmStartText;
|
||||
@FXML
|
||||
private TextField alarmIntervalText;
|
||||
|
||||
|
||||
protected CourseTypeBuilder(TodoItem parent) {
|
||||
super(parent);
|
||||
loadLayout(COURSE_TYPE_LAYOUT);
|
||||
}
|
||||
|
||||
@FXML
|
||||
private void initialize() {
|
||||
addAutoCheckTime(bgnTimeText.textProperty(), endTimeText.textProperty());
|
||||
|
||||
addAutoSet(TodoItem.REPEAT_WEEKS, repeatText.textProperty(), "重复的周数不合法");
|
||||
addAutoSet(TodoItem.TITLE, titleText.textProperty(), "请填写课程名");
|
||||
addAutoSet("content", contentText.textProperty(), "请填写上课内容");
|
||||
addAutoSet(TodoItem.LOCATION, locationText.textProperty(), "请填写地点");
|
||||
addAutoSet(TodoItem.DESCRIPTION, descriptionText.textProperty(), "请填写备注");
|
||||
addAutoSet(TodoItem.ALARM_START, alarmStartText.textProperty(), "提醒的开始时间不合法");
|
||||
addAutoSet(TodoItem.ALARM_INTERVAL, alarmIntervalText.textProperty(), "提醒的间隔时间不合法");
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getTypeName() {
|
||||
return TYPE_NAME;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean check() {
|
||||
return autoCheck();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Object make() {
|
||||
TodoItemFactory fac = autoBuild();
|
||||
|
||||
String priority = priorityBox.getValue();
|
||||
String importance = importanceBox.getValue();
|
||||
String alarmMethod = alarmMethodBox.getValue();
|
||||
|
||||
return fac.type(TYPE)
|
||||
.stringProperties(TodoItem.PRIORITY, priority)
|
||||
.stringProperties(TodoItem.IMPORTANCE, importance)
|
||||
.stringProperties(TodoItem.ALARM_METHOD, alarmMethod)
|
||||
.build();
|
||||
}
|
||||
|
||||
|
||||
}
|
Loading…
Reference in New Issue