新增英文README,修正部分文件结构
This commit is contained in:
@@ -5,7 +5,7 @@ import java.lang.annotation.*;
|
||||
/**
|
||||
* @Author jack
|
||||
* @Date:2019/6/25 1:36
|
||||
*/
|
||||
*/
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(ElementType.FIELD)
|
||||
@Inherited
|
||||
|
||||
@@ -77,6 +77,9 @@ public class FXBaseController extends Pane {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 关闭舞台
|
||||
*/
|
||||
public void closeStage() {
|
||||
if (isWindow) {
|
||||
this.stage.close();
|
||||
|
||||
@@ -5,6 +5,7 @@ import cn.edu.scau.biubiusuisui.annotation.FXRedirect;
|
||||
import cn.edu.scau.biubiusuisui.annotation.FXWindow;
|
||||
import cn.edu.scau.biubiusuisui.entity.FXBaseController;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.scene.control.Alert;
|
||||
import javafx.scene.control.PasswordField;
|
||||
import javafx.scene.control.TextField;
|
||||
|
||||
@@ -30,6 +31,12 @@ public class RegisterController extends FXBaseController {
|
||||
|
||||
@FXML
|
||||
public void registerClick() {
|
||||
if (validate()) {
|
||||
UserEntity userEntity = new UserEntity();
|
||||
userEntity.setUsername(usernameTF.getText());
|
||||
userEntity.setPassword(passwordPF.getText());
|
||||
userEntity.setEmail(emailTF.getText());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -42,5 +49,33 @@ public class RegisterController extends FXBaseController {
|
||||
public String redirectToLogin() {
|
||||
return "LoginController";
|
||||
}
|
||||
|
||||
|
||||
// 校验
|
||||
private boolean validate() {
|
||||
boolean retCode = false;
|
||||
if (null != passwordPF.getText() && null != confirmPasswordPF.getText()) {
|
||||
if (!passwordPF.getText().equals(confirmPasswordPF.getText())) {
|
||||
retCode = false;
|
||||
new Alert(Alert.AlertType.ERROR, "两次密码不一致");
|
||||
} else {
|
||||
retCode = true;
|
||||
}
|
||||
} else if (null == usernameTF.getText()) {
|
||||
retCode = false;
|
||||
new Alert(Alert.AlertType.ERROR, "用户名不能为空");
|
||||
} else if (null == emailTF.getText()) {
|
||||
retCode = false;
|
||||
new Alert(Alert.AlertType.ERROR, "邮箱不能为空");
|
||||
}
|
||||
return retCode;
|
||||
}
|
||||
|
||||
private void clearAllInput() {
|
||||
usernameTF.setText("");
|
||||
emailTF.setText("");
|
||||
passwordPF.setText("");
|
||||
confirmPasswordPF.setText("");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
package cn.edu.scau.biubiusuisui.example.redirectDemo;
|
||||
|
||||
/**
|
||||
* @author suiyu_yang
|
||||
* @description 简单的用户实体
|
||||
* @date 2020/1/14 22:39
|
||||
* @email suiyu_yang@163.com
|
||||
*/
|
||||
public class UserEntity {
|
||||
private String username;
|
||||
private String password;
|
||||
private String email;
|
||||
|
||||
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
|
||||
public void setUsername(String username) {
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
public void setPassword(String password) {
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
public String getEmail() {
|
||||
return email;
|
||||
}
|
||||
|
||||
public void setEmail(String email) {
|
||||
this.email = email;
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package cn.edu.scau.biubiusuisui.stage;
|
||||
|
||||
import cn.edu.scau.biubiusuisui.entity.FXBaseController;
|
||||
|
||||
import java.util.ArrayDeque;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
@@ -15,10 +16,21 @@ public class StageManager {
|
||||
private static StageManager stageManager = null;
|
||||
private static Map<String, FXBaseController> windows = new ConcurrentHashMap<>(); //
|
||||
|
||||
/**
|
||||
* @author yangsuiyu
|
||||
* @description 1.2新增属性
|
||||
*/
|
||||
private static ArrayDeque<FXBaseController> windowsStack = new ArrayDeque<>();
|
||||
|
||||
private StageManager() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 单例
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static synchronized StageManager getInstance() {
|
||||
if (stageManager == null) {
|
||||
stageManager = new StageManager();
|
||||
@@ -28,7 +40,6 @@ public class StageManager {
|
||||
|
||||
public void registerWindow(FXBaseController fxBaseControllerProxy) {
|
||||
if (fxBaseControllerProxy.isWindow()) {
|
||||
// System.out.println("StageController: "+(fxBaseControllerProxy.getStage() == null));
|
||||
windows.put(fxBaseControllerProxy.getName(), fxBaseControllerProxy);
|
||||
}
|
||||
}
|
||||
@@ -37,8 +48,12 @@ public class StageManager {
|
||||
windows.get(controllerName).closeStage();
|
||||
}
|
||||
|
||||
/**
|
||||
* 无参数跳转
|
||||
*
|
||||
* @param controller
|
||||
*/
|
||||
public void redirectTo(Object controller) {
|
||||
// System.out.println("跳转->" + controller);
|
||||
windows.get(controller).showStage();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user