add all IoC

This commit is contained in:
hlq07 2018-05-29 15:59:47 +08:00
parent 507bd5cca8
commit adee2f5725
2 changed files with 28 additions and 24 deletions

View File

@ -8,9 +8,24 @@ import org.cutem.cutecalendar.model.TodoItemFactory;
import org.jetbrains.annotations.Nullable;
public class InterviewTypeNewItemBuilder extends NewItemBuilder {
public static class Factory implements IFactory {
@Override
public String getTypeName() {
return TYPE_NAME;
}
@Override
public NewItemBuilder construct(@Nullable TodoItem parent) {
return new InterviewTypeNewItemBuilder(parent);
}
}
private static final int TYPE = TodoItem.INTERVIEW;
private static final String TYPE_NAME = TodoItem.typeName(TYPE);
private static final String INTERVIEW_TYPE_LAYOUT = "fxml/newitem_layouts/interview_type_layout.fxml";
@FXML
private TextField bgnTimeText;
@FXML
@ -39,6 +54,17 @@ public class InterviewTypeNewItemBuilder extends NewItemBuilder {
loadLayout(INTERVIEW_TYPE_LAYOUT);
}
@FXML
private void initialize() {
addAutoCheckTime(bgnTimeText.textProperty(), endTimeText.textProperty());
addAutoSet(TodoItem.LOCATION, locationText.textProperty(), "请添加地点");
addAutoSet(TodoItem.TITLE, remarkText.textProperty(), "请填写备注");
addAutoSet("company", companyText.textProperty(), "请填写公司");
addAutoSet("岗位", companyText.textProperty(), "请填写岗位");
addAutoSet(TodoItem.ALARM_START, alarmStartText.textProperty(), "提醒的开始时间不合法");
addAutoSet(TodoItem.ALARM_INTERVAL, alarmIntervalText.textProperty(), "提醒的间隔时间不合法");
}
@Override
protected boolean check() {
return autoCheck();
@ -58,28 +84,4 @@ public class InterviewTypeNewItemBuilder extends NewItemBuilder {
.stringProperties(TodoItem.ALARM_METHOD, alarmMethod)
.build();
}
public static class Factory implements IFactory {
@Override
public String getTypeName() {
return TYPE_NAME;
}
@Override
public NewItemBuilder construct(@Nullable TodoItem parent) {
return new InterviewTypeNewItemBuilder(parent);
}
}
@FXML
private void initialize() {
addAutoCheckTime(bgnTimeText.textProperty(), endTimeText.textProperty());
addAutoSet(TodoItem.LOCATION, locationText.textProperty(), "请添加地点");
addAutoSet(TodoItem.TITLE, remarkText.textProperty(), "请填写备注");
addAutoSet("company", companyText.textProperty(), "请填写公司");
addAutoSet("岗位", companyText.textProperty(), "请填写岗位");
addAutoSet(TodoItem.ALARM_START, alarmStartText.textProperty(), "提醒的开始时间不合法");
addAutoSet(TodoItem.ALARM_INTERVAL, alarmIntervalText.textProperty(), "提醒的间隔时间不合法");
}
}

View File

@ -63,6 +63,8 @@ public class MainTest extends Application {
newItemStrategy.addFactory(new ConferenceTypeNewItemBuilder.Factory());
newItemStrategy.addFactory(new InterviewTypeNewItemBuilder.Factory());
newItemStrategy.addFactory(new AnniversaryTypeNewItemBuilder.Factory());
newItemStrategy.addFactory(new CourseTypeBuilder.Factory());
newItemStrategy.addFactory(new DateTypeBuilder.Factory());
mPresenter.goWork();
}