Compare commits
21 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2fc8a622ab | ||
|
|
3543f8acd3 | ||
|
|
96a58bcda5 | ||
|
|
34ddd6f26e | ||
|
|
38dc53b484 | ||
|
|
547c036cdb | ||
|
|
a69651447c | ||
|
|
f6189b1bf9 | ||
|
|
d139cbe3c5 | ||
|
|
5b7131febf | ||
|
|
a82844cf35 | ||
|
|
b48325cd63 | ||
|
|
7c807d4b39 | ||
|
|
119436dc3b | ||
|
|
5e60991bda | ||
|
|
5f9150b0f6 | ||
|
|
9a04efd84f | ||
|
|
d23cda4f47 | ||
|
|
54dc098123 | ||
|
|
3147d9f9b7 | ||
|
|
4e968bcd08 |
4
.gitignore
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
.idea
|
||||
*.iml
|
||||
**/*.log
|
||||
**/target
|
||||
@@ -1,24 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
|
||||
<component name="FacetManager">
|
||||
<facet type="Spring" name="Spring">
|
||||
<configuration />
|
||||
</facet>
|
||||
</component>
|
||||
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
|
||||
<output url="file://$MODULE_DIR$/target/classes" />
|
||||
<output-test url="file://$MODULE_DIR$/target/test-classes" />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/target" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" name="Maven: cglib:cglib:3.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.ow2.asm:asm:4.2" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: junit:junit:4.11" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest-core:1.3" level="project" />
|
||||
</component>
|
||||
</module>
|
||||
1325
README.en.md
|
After Width: | Height: | Size: 159 KiB |
|
After Width: | Height: | Size: 147 KiB |
|
Before Width: | Height: | Size: 451 KiB After Width: | Height: | Size: 451 KiB |
BIN
README.en/JavaFX-Plus_en.png
Normal file
|
After Width: | Height: | Size: 531 KiB |
BIN
README.en/Resizable_en.gif
Normal file
|
After Width: | Height: | Size: 5.1 MiB |
|
Before Width: | Height: | Size: 14 MiB After Width: | Height: | Size: 14 MiB |
BIN
README.en/bindhow.gif
Normal file
|
After Width: | Height: | Size: 175 KiB |
BIN
README.en/controllerConfig.png
Normal file
|
After Width: | Height: | Size: 33 KiB |
BIN
README.en/demo1.png
Normal file
|
After Width: | Height: | Size: 5.4 KiB |
BIN
README.en/draggable_en.gif
Normal file
|
After Width: | Height: | Size: 4.8 MiB |
BIN
README.en/expression.gif
Normal file
|
After Width: | Height: | Size: 104 KiB |
BIN
README.en/expressionV2V.gif
Normal file
|
After Width: | Height: | Size: 29 KiB |
BIN
README.en/helloWorldDemo.gif
Normal file
|
After Width: | Height: | Size: 191 KiB |
BIN
README.en/language_demo.gif
Normal file
|
After Width: | Height: | Size: 6.8 MiB |
BIN
README.en/language_demo_en.gif
Normal file
|
After Width: | Height: | Size: 6.8 MiB |
BIN
README.en/lifeDemo/lifeDemo_en.gif
Normal file
|
After Width: | Height: | Size: 12 MiB |
BIN
README.en/lifeDemo/lifeDemo_pkg_en.png
Normal file
|
After Width: | Height: | Size: 54 KiB |
BIN
README.en/lifeDemo/life_demo01_en.png
Normal file
|
After Width: | Height: | Size: 193 KiB |
BIN
README.en/lifeDemo/life_demo_en.png
Normal file
|
After Width: | Height: | Size: 69 KiB |
BIN
README.en/log_demo_en.png
Normal file
|
After Width: | Height: | Size: 34 KiB |
BIN
README.en/modulesAction.gif
Normal file
|
After Width: | Height: | Size: 512 KiB |
BIN
README.en/moveable.gif
Normal file
|
After Width: | Height: | Size: 977 KiB |
|
Before Width: | Height: | Size: 15 MiB After Width: | Height: | Size: 15 MiB |
|
Before Width: | Height: | Size: 5.9 MiB After Width: | Height: | Size: 5.9 MiB |
|
Before Width: | Height: | Size: 6.5 MiB After Width: | Height: | Size: 6.5 MiB |
BIN
README.en/redirect_with_data_en.gif
Normal file
|
After Width: | Height: | Size: 16 MiB |
BIN
README.en/resizeAble.gif
Normal file
|
After Width: | Height: | Size: 364 KiB |
BIN
README.en/template_en.png
Normal file
|
After Width: | Height: | Size: 526 KiB |
BIN
README.en/template_incude_en.png
Normal file
|
After Width: | Height: | Size: 210 KiB |
BIN
README.en/wrap_JavaBean.png
Normal file
|
After Width: | Height: | Size: 16 KiB |
BIN
README/JavaFX-Plus-LifeCycle/JavaFX-Plus-LifeCycle_01.png
Normal file
|
After Width: | Height: | Size: 168 KiB |
BIN
README/JavaFX-Plus-LifeCycle/JavaFX-Plus-LifeCycle_02.png
Normal file
|
After Width: | Height: | Size: 167 KiB |
BIN
README/JavaFX-Plus.png
Normal file
|
After Width: | Height: | Size: 451 KiB |
BIN
README/JavaFX-Plus_en.png
Normal file
|
After Width: | Height: | Size: 531 KiB |
BIN
README/Resizable.gif
Normal file
|
After Width: | Height: | Size: 5.1 MiB |
BIN
README/actionDemo/20191210-175409-actionDemo.gif
Normal file
|
After Width: | Height: | Size: 14 MiB |
BIN
README/bindhow.gif
Normal file
|
After Width: | Height: | Size: 175 KiB |
BIN
README/controllerConfig.png
Normal file
|
After Width: | Height: | Size: 33 KiB |
BIN
README/demo1.png
Normal file
|
After Width: | Height: | Size: 5.4 KiB |
BIN
README/draggable.gif
Normal file
|
After Width: | Height: | Size: 4.1 MiB |
BIN
README/expression.gif
Normal file
|
After Width: | Height: | Size: 104 KiB |
BIN
README/expressionV2V.gif
Normal file
|
After Width: | Height: | Size: 29 KiB |
BIN
README/helloWorldDemo.gif
Normal file
|
After Width: | Height: | Size: 191 KiB |
BIN
README/image-20200407003220469.png
Normal file
|
After Width: | Height: | Size: 1.8 MiB |
BIN
README/language_demo.gif
Normal file
|
After Width: | Height: | Size: 6.8 MiB |
BIN
README/lifeDemo/lifeDemo.gif
Normal file
|
After Width: | Height: | Size: 12 MiB |
BIN
README/lifeDemo/lifeDemo.png
Normal file
|
After Width: | Height: | Size: 60 KiB |
BIN
README/lifeDemo/lifeDemo_pkg.png
Normal file
|
After Width: | Height: | Size: 54 KiB |
BIN
README/lifeDemo/life_demo01.png
Normal file
|
After Width: | Height: | Size: 165 KiB |
BIN
README/log_demo.png
Normal file
|
After Width: | Height: | Size: 34 KiB |
BIN
README/modulesAction.gif
Normal file
|
After Width: | Height: | Size: 512 KiB |
BIN
README/moveable.gif
Normal file
|
After Width: | Height: | Size: 977 KiB |
BIN
README/mqDemo/20191208-194336-signalshow.gif
Normal file
|
After Width: | Height: | Size: 15 MiB |
BIN
README/redirectDemo/20191208-125511-not_close.gif
Normal file
|
After Width: | Height: | Size: 5.9 MiB |
BIN
README/redirectDemo/20191208-125739-close.gif
Normal file
|
After Width: | Height: | Size: 6.5 MiB |
BIN
README/redirect_with_data.gif
Normal file
|
After Width: | Height: | Size: 16 MiB |
BIN
README/resizeAble.gif
Normal file
|
After Width: | Height: | Size: 364 KiB |
BIN
README/template.png
Normal file
|
After Width: | Height: | Size: 526 KiB |
BIN
README/template_incude.png
Normal file
|
After Width: | Height: | Size: 210 KiB |
BIN
README/wrap_JavaBean.png
Normal file
|
After Width: | Height: | Size: 16 KiB |
BIN
doc/JavaFX-Plus-Introduction.xmind
Normal file
BIN
doc/JavaFX-Plus-Introduction_en.xmind
Normal file
BIN
doc/JavaFX-Plus-LifeCycle.pptx
Normal file
BIN
doc/JavaFX-Plus-LifeCycle_en.pptx
Normal file
BIN
javafx-plus-demo/logs/debug/javafxplus.log
Normal file
0
javafx-plus-demo/logs/error/javafxplus.log
Normal file
23
javafx-plus-demo/pom.xml
Normal file
@@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.gitee.Biubiuyuyu</groupId>
|
||||
<artifactId>javafx-plus-demo</artifactId>
|
||||
<version>1.3.0-SNAPSHOT</version>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>8</maven.compiler.source>
|
||||
<maven.compiler.target>8</maven.compiler.target>
|
||||
<javafx-plus.version>1.3.0-SNAPSHOT</javafx-plus.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.gitee.Biubiuyuyu</groupId>
|
||||
<artifactId>javafx-plus</artifactId>
|
||||
<version>${javafx-plus.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
@@ -0,0 +1,21 @@
|
||||
package cn.edu.scau.biubiusuisui.example.bindDemo;
|
||||
|
||||
import cn.edu.scau.biubiusuisui.annotation.FXScan;
|
||||
import cn.edu.scau.biubiusuisui.config.FXPlusApplication;
|
||||
import javafx.application.Application;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
/**
|
||||
* @author jack
|
||||
* @author suisui
|
||||
* @version 1.2
|
||||
* @date 2020/5/1 1:43
|
||||
* @since JavaFX2.0 JDK1.8
|
||||
*/
|
||||
@FXScan(base = "cn.edu.scau.biubiusuisui.example.bindDemo")
|
||||
public class BindDemo extends Application {
|
||||
@Override
|
||||
public void start(Stage primaryStage) throws Exception {
|
||||
FXPlusApplication.start(BindDemo.class);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,130 @@
|
||||
package cn.edu.scau.biubiusuisui.example.bindDemo;
|
||||
|
||||
import cn.edu.scau.biubiusuisui.annotation.FXBind;
|
||||
import cn.edu.scau.biubiusuisui.annotation.FXController;
|
||||
import cn.edu.scau.biubiusuisui.annotation.FXWindow;
|
||||
import cn.edu.scau.biubiusuisui.entity.FXBaseController;
|
||||
import javafx.beans.value.ChangeListener;
|
||||
import javafx.beans.value.ObservableValue;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.scene.control.*;
|
||||
|
||||
import java.net.URL;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
/**
|
||||
* @author jack
|
||||
* @author suisui
|
||||
* @version 1.2
|
||||
* @date 2020/5/1 1:43
|
||||
* @since JavaFX2.0 JDK1.8
|
||||
*/
|
||||
@FXController(path = "fxml/bindDemo/bindDemo.fxml")
|
||||
@FXWindow(title = "bindDemo", mainStage = true)
|
||||
// TODO 待完善
|
||||
public class MainController extends FXBaseController implements Initializable {
|
||||
// View bind to View
|
||||
@FXML
|
||||
@FXBind("text=${inputTF.text}")
|
||||
private Label inputLabel;
|
||||
|
||||
@FXML
|
||||
private TextField inputTF;
|
||||
|
||||
// View bind to a Java Bean
|
||||
@FXML
|
||||
private Label usernameLabel;
|
||||
|
||||
@FXML
|
||||
private Label userPswLabel;
|
||||
|
||||
@FXML
|
||||
private Label ageLabel;
|
||||
|
||||
@FXML
|
||||
private Label enableLabel;
|
||||
|
||||
@FXML
|
||||
private TextField usernameTF;
|
||||
|
||||
@FXML
|
||||
private PasswordField pswPF;
|
||||
|
||||
@FXML
|
||||
private TextField ageTF;
|
||||
|
||||
@FXML
|
||||
private ToggleGroup enableButtons;
|
||||
|
||||
//
|
||||
// @FXData
|
||||
// @FXBind({
|
||||
// "name=${usernameTF.text}",
|
||||
// "password=${pswPF.text}",
|
||||
// "age=${ageTF.text}",
|
||||
// "isEnable=${enableButtons.getSelectedToggle().getUserData()}"
|
||||
// })
|
||||
// private User user = new User();
|
||||
private UserPropertyEntity user = new UserPropertyEntity();
|
||||
|
||||
// View bind to Expression
|
||||
@FXML
|
||||
private TextField money;
|
||||
|
||||
@FXML
|
||||
@FXBind("text=${@toUs(money.text)}")
|
||||
private Label us;
|
||||
|
||||
@FXML
|
||||
@FXBind("text=${@toJp(money.text)}")
|
||||
private Label jp;
|
||||
|
||||
@FXML
|
||||
@FXBind("text=${@toUk(money.text)}")
|
||||
private Label uk;
|
||||
|
||||
@Override
|
||||
public void initialize(URL location, ResourceBundle resources) {
|
||||
money.setText("0");
|
||||
money.textProperty().addListener(new ChangeListener<String>() {
|
||||
@Override
|
||||
public void changed(ObservableValue<? extends String> observable, String oldValue, String newValue) {
|
||||
if (null == newValue || "".equals(newValue)) {
|
||||
money.setText("0");
|
||||
} else if (!newValue.matches("^[0-9]*$")) {
|
||||
money.setText(oldValue);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@FXML
|
||||
public void clickToShowInfo() {
|
||||
RadioButton button = (RadioButton) enableButtons.getSelectedToggle();
|
||||
System.out.println(button.getText());
|
||||
usernameLabel.setText(user.getName());
|
||||
userPswLabel.setText(user.getPassword());
|
||||
ageLabel.setText(Integer.toString(user.getAge()));
|
||||
enableLabel.setText(Boolean.toString(user.getEnable()));
|
||||
}
|
||||
|
||||
public String toUs(String value) {
|
||||
double money = Double.valueOf(value);
|
||||
double percent = 0.1454;
|
||||
return String.valueOf(money * percent);
|
||||
}
|
||||
|
||||
public String toJp(String value) {
|
||||
double money = Double.valueOf(value);
|
||||
double percent = 15.797;
|
||||
return String.valueOf(money * percent);
|
||||
}
|
||||
|
||||
public String toUk(String value) {
|
||||
double money = Double.valueOf(value);
|
||||
double percent = 0.1174;
|
||||
return String.valueOf(money * percent);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package cn.edu.scau.biubiusuisui.example.bindDemo;
|
||||
|
||||
/**
|
||||
* @author suisui
|
||||
* @version 1.2
|
||||
* @description 详细信息
|
||||
* @date 2020/4/6 00:29
|
||||
* @since JavaFX2.0 JDK1.8
|
||||
*/
|
||||
public class Profile {
|
||||
private String birthday;
|
||||
private String address;
|
||||
private String avatar;
|
||||
|
||||
public String getBirthday() {
|
||||
return birthday;
|
||||
}
|
||||
|
||||
public void setBirthday(String birthday) {
|
||||
this.birthday = birthday;
|
||||
}
|
||||
|
||||
public String getAddress() {
|
||||
return address;
|
||||
}
|
||||
|
||||
public void setAddress(String address) {
|
||||
this.address = address;
|
||||
}
|
||||
|
||||
public String getAvatar() {
|
||||
return avatar;
|
||||
}
|
||||
|
||||
public void setAvatar(String avatar) {
|
||||
this.avatar = avatar;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
package cn.edu.scau.biubiusuisui.example.bindDemo;
|
||||
|
||||
import cn.edu.scau.biubiusuisui.annotation.FXEntity;
|
||||
import cn.edu.scau.biubiusuisui.annotation.FXField;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author suisui
|
||||
* @version 1.2
|
||||
* @date 2020/4/5 12:19
|
||||
* @since JavaFX2.0 JDK1.8
|
||||
*/
|
||||
@FXEntity
|
||||
public class User {
|
||||
@FXField
|
||||
private String name;
|
||||
@FXField
|
||||
private String password;
|
||||
@FXField
|
||||
private Integer age;
|
||||
@FXField
|
||||
private List<Double> scores;
|
||||
@FXField
|
||||
private Double gpa;//平均分
|
||||
@FXField
|
||||
private Profile profile;
|
||||
@FXField
|
||||
private boolean isEnable;
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
public void setPassword(String password) {
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
public Integer getAge() {
|
||||
return age;
|
||||
}
|
||||
|
||||
public void setAge(Integer age) {
|
||||
this.age = age;
|
||||
}
|
||||
|
||||
public List<Double> getScores() {
|
||||
return scores;
|
||||
}
|
||||
|
||||
public void addScore(double score) {
|
||||
this.scores.add(score);
|
||||
}
|
||||
|
||||
public Profile getProfile() {
|
||||
return profile;
|
||||
}
|
||||
|
||||
public void setProfile(Profile profile) {
|
||||
this.profile = profile;
|
||||
}
|
||||
|
||||
public boolean isEnable() {
|
||||
return isEnable;
|
||||
}
|
||||
|
||||
public void setEnable(boolean enable) {
|
||||
isEnable = enable;
|
||||
}
|
||||
|
||||
public double getGpa() {
|
||||
double sum = 0;
|
||||
for (double score : scores) {
|
||||
sum += score;
|
||||
}
|
||||
gpa = sum / scores.size();
|
||||
return gpa;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,105 @@
|
||||
package cn.edu.scau.biubiusuisui.example.bindDemo;
|
||||
|
||||
import javafx.beans.property.*;
|
||||
import javafx.collections.ObservableList;
|
||||
|
||||
/**
|
||||
* @author suisui
|
||||
* @version 1.2
|
||||
* @description User的JavaFXBean
|
||||
* @date 2020/4/6 14:30
|
||||
* @since JavaFX2.0 JDK1.8
|
||||
*/
|
||||
public class UserPropertyEntity {
|
||||
private SimpleStringProperty name;
|
||||
private SimpleStringProperty password;
|
||||
private SimpleIntegerProperty age;
|
||||
private SimpleListProperty<Double> scores;
|
||||
private SimpleDoubleProperty gpa;//平均分
|
||||
private SimpleObjectProperty<Profile> profile;
|
||||
private SimpleBooleanProperty enable;
|
||||
|
||||
public String getName() {
|
||||
return name.get();
|
||||
}
|
||||
|
||||
public SimpleStringProperty nameProperty() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name.set(name);
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
return password.get();
|
||||
}
|
||||
|
||||
public SimpleStringProperty passwordProperty() {
|
||||
return password;
|
||||
}
|
||||
|
||||
public void setPassword(String password) {
|
||||
this.password.set(password);
|
||||
}
|
||||
|
||||
public int getAge() {
|
||||
return age.get();
|
||||
}
|
||||
|
||||
public SimpleIntegerProperty ageProperty() {
|
||||
return age;
|
||||
}
|
||||
|
||||
public void setAge(int age) {
|
||||
this.age.set(age);
|
||||
}
|
||||
|
||||
public ObservableList<Double> getScores() {
|
||||
return scores.get();
|
||||
}
|
||||
|
||||
public SimpleListProperty<Double> scoresProperty() {
|
||||
return scores;
|
||||
}
|
||||
|
||||
public void setScores(ObservableList<Double> scores) {
|
||||
this.scores.set(scores);
|
||||
}
|
||||
|
||||
public double getGpa() {
|
||||
return gpa.get();
|
||||
}
|
||||
|
||||
public SimpleDoubleProperty gpaProperty() {
|
||||
return gpa;
|
||||
}
|
||||
|
||||
public void setGpa(double gpa) {
|
||||
this.gpa.set(gpa);
|
||||
}
|
||||
|
||||
public Profile getProfile() {
|
||||
return profile.get();
|
||||
}
|
||||
|
||||
public SimpleObjectProperty<Profile> profileProperty() {
|
||||
return profile;
|
||||
}
|
||||
|
||||
public void setProfile(Profile profile) {
|
||||
this.profile.set(profile);
|
||||
}
|
||||
|
||||
public boolean getEnable() {
|
||||
return enable.get();
|
||||
}
|
||||
|
||||
public SimpleBooleanProperty enableProperty() {
|
||||
return enable;
|
||||
}
|
||||
|
||||
public void setEnable(boolean enable) {
|
||||
this.enable.set(enable);
|
||||
}
|
||||
}
|
||||
@@ -6,15 +6,17 @@ import javafx.application.Application;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
/**
|
||||
* @author suiyu_yang
|
||||
* @author jack
|
||||
* @author suisui
|
||||
* @version 1.0
|
||||
* @description 第一个示例
|
||||
* @date 2020/1/1 23:06
|
||||
* @email suiyu_yang@163.com
|
||||
* @since JavaFX2.0 JDK1.8
|
||||
*/
|
||||
@FXScan(base = {"cn.edu.scau.biubiusuisui.example.firstDemo"}) //会扫描带FXController和FXEntity的类进行初始化
|
||||
public class Demo extends Application {
|
||||
public class FirstDemo extends Application {
|
||||
@Override
|
||||
public void start(Stage primaryStage) throws Exception {
|
||||
FXPlusApplication.start(Demo.class); //其他配置和JavaFX相同,这里要调用FXPlusAppcalition的start方法,开始FX-plus加强
|
||||
FXPlusApplication.start(FirstDemo.class); //其他配置和JavaFX相同,这里要调用FXPlusAppcalition的start方法,开始FX-plus加强
|
||||
}
|
||||
}
|
||||
@@ -16,12 +16,14 @@ import java.net.URL;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
/**
|
||||
* @author suiyu_yang
|
||||
* @description
|
||||
* @author jack
|
||||
* @author suisui
|
||||
* @version 1.0
|
||||
* @description 示例的主窗口
|
||||
* @date 2020/1/1 23:06
|
||||
* @email suiyu_yang@163.com
|
||||
* @since JavaFX2.0 JDK1.8
|
||||
*/
|
||||
@FXController(path = "firstDemo/firstDemo.fxml")
|
||||
@FXController(path = "fxml/firstDemo/firstDemo.fxml")
|
||||
@FXWindow(title = "firstDemo", mainStage = true)
|
||||
public class MainController extends FXBaseController implements Initializable {
|
||||
|
||||
@@ -47,7 +49,7 @@ public class MainController extends FXBaseController implements Initializable {
|
||||
|
||||
@Override
|
||||
public void initialize(URL location, ResourceBundle resources) {
|
||||
student = (Student) FXEntityFactory.wrapFxBean(Student.class); // 从工厂中拿到将JavaBean转换得到的JavaFXBean
|
||||
student = (Student) FXEntityFactory.wrapFXBean(Student.class); // 从工厂中拿到将JavaBean转换得到的JavaFXBean
|
||||
Property listProperty = FXPlusContext.getEntityPropertyByName(student, "list");
|
||||
list.itemsProperty().bind(listProperty);
|
||||
}
|
||||
@@ -7,10 +7,11 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author suiyu_yang
|
||||
* @author suisui
|
||||
* @version 1.0
|
||||
* @description
|
||||
* @date 2020/1/1 23:07
|
||||
* @email suiyu_yang@163.com
|
||||
* @since JavaFX2.0 JDK1.8
|
||||
*/
|
||||
|
||||
@FXEntity
|
||||
@@ -0,0 +1,52 @@
|
||||
package cn.edu.scau.biubiusuisui.example.langDemo;
|
||||
|
||||
import cn.edu.scau.biubiusuisui.annotation.FXController;
|
||||
import cn.edu.scau.biubiusuisui.annotation.FXRedirect;
|
||||
import cn.edu.scau.biubiusuisui.annotation.FXWindow;
|
||||
import cn.edu.scau.biubiusuisui.entity.FXBaseController;
|
||||
import cn.edu.scau.biubiusuisui.entity.FXPlusLocale;
|
||||
import javafx.fxml.FXML;
|
||||
|
||||
|
||||
/**
|
||||
* @author suisui
|
||||
* @description 中文界面
|
||||
* @date 2020/5/3 16:23
|
||||
* @since JDK1.8
|
||||
*/
|
||||
@FXWindow(mainStage = true, title = "languageDemo")
|
||||
@FXController(path = "fxml/langDemo/langDemo.fxml", locale = FXPlusLocale.SIMPLIFIED_CHINESE)
|
||||
public class ChineseController extends FXBaseController {
|
||||
private String title = "languageDemo";
|
||||
private int count = 0;
|
||||
|
||||
@FXML
|
||||
public void clickToChinese() {
|
||||
redirect("ChineseController");
|
||||
}
|
||||
|
||||
@FXML
|
||||
public void clickToEnglish() {
|
||||
redirect("EnglishController");
|
||||
}
|
||||
|
||||
@FXML
|
||||
public void clickToKorean() {
|
||||
redirect("KoreanController");
|
||||
}
|
||||
|
||||
/**
|
||||
* 测试是否setWindowTitle接口
|
||||
*/
|
||||
@FXML
|
||||
public void changeTitleClick() {
|
||||
this.setWindowTitle(this.title + count);
|
||||
count++;
|
||||
}
|
||||
|
||||
@FXRedirect
|
||||
public String redirect(String name) {
|
||||
return name;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
package cn.edu.scau.biubiusuisui.example.langDemo;
|
||||
|
||||
import cn.edu.scau.biubiusuisui.annotation.FXController;
|
||||
import cn.edu.scau.biubiusuisui.annotation.FXRedirect;
|
||||
import cn.edu.scau.biubiusuisui.annotation.FXWindow;
|
||||
import cn.edu.scau.biubiusuisui.entity.FXBaseController;
|
||||
import cn.edu.scau.biubiusuisui.entity.FXPlusLocale;
|
||||
import javafx.fxml.FXML;
|
||||
|
||||
/**
|
||||
* @author suisui
|
||||
* @description 英文界面
|
||||
* @date 2020/5/3 19:54
|
||||
* @since JDK1.8
|
||||
*/
|
||||
@FXWindow(mainStage = false, title = "languageDemo")
|
||||
@FXController(path = "fxml/langDemo/langDemo.fxml", locale = FXPlusLocale.ENGLISH)
|
||||
public class EnglishController extends FXBaseController {
|
||||
private String title = "languageDemo";
|
||||
private int count = 0;
|
||||
|
||||
@FXML
|
||||
public void clickToChinese() {
|
||||
redirect("ChineseController");
|
||||
}
|
||||
|
||||
@FXML
|
||||
public void clickToEnglish() {
|
||||
redirect("EnglishController");
|
||||
}
|
||||
|
||||
@FXML
|
||||
public void clickToKorean() {
|
||||
redirect("KoreanController");
|
||||
}
|
||||
|
||||
/**
|
||||
* 测试是否setWindowTitle接口
|
||||
*/
|
||||
@FXML
|
||||
public void changeTitleClick() {
|
||||
this.setWindowTitle(this.title + count);
|
||||
count++;
|
||||
}
|
||||
|
||||
@FXRedirect
|
||||
public String redirect(String name) {
|
||||
return name;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package cn.edu.scau.biubiusuisui.example.langDemo;
|
||||
|
||||
import cn.edu.scau.biubiusuisui.annotation.FXController;
|
||||
import cn.edu.scau.biubiusuisui.annotation.FXRedirect;
|
||||
import cn.edu.scau.biubiusuisui.annotation.FXWindow;
|
||||
import cn.edu.scau.biubiusuisui.entity.FXBaseController;
|
||||
import cn.edu.scau.biubiusuisui.entity.FXPlusLocale;
|
||||
import javafx.fxml.FXML;
|
||||
|
||||
/**
|
||||
* @author suisui
|
||||
* @description 法语界面
|
||||
* @date 2020/5/4 14:01
|
||||
* @since JDK1.8
|
||||
*/
|
||||
@FXWindow(mainStage = false, title = "languageDemo")
|
||||
@FXController(path = "fxml/langDemo/langDemo.fxml", locale = FXPlusLocale.KOREAN)
|
||||
public class KoreanController extends FXBaseController {
|
||||
private String title = "languageDemo";
|
||||
private int count = 0;
|
||||
|
||||
@FXML
|
||||
public void clickToChinese() {
|
||||
redirect("ChineseController");
|
||||
}
|
||||
|
||||
@FXML
|
||||
public void clickToEnglish() {
|
||||
redirect("EnglishController");
|
||||
}
|
||||
|
||||
@FXML
|
||||
public void clickToKorean() {
|
||||
redirect("KoreanController");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 测试是否setWindowTitle接口
|
||||
*/
|
||||
@FXML
|
||||
public void changeTitleClick() {
|
||||
this.setWindowTitle(this.title + count);
|
||||
count++;
|
||||
}
|
||||
|
||||
@FXRedirect
|
||||
public String redirect(String name) {
|
||||
return name;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package cn.edu.scau.biubiusuisui.example.langDemo;
|
||||
|
||||
import cn.edu.scau.biubiusuisui.annotation.FXScan;
|
||||
import cn.edu.scau.biubiusuisui.config.FXPlusApplication;
|
||||
import javafx.application.Application;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
/**
|
||||
* @author suisui
|
||||
* @description 测试语言国际化的Demo
|
||||
* @date 2020/5/3 09:57
|
||||
* @since JDK1.8
|
||||
*/
|
||||
@FXScan(base = "cn.edu.scau.biubiusuisui.example.langDemo")
|
||||
public class LanguageDemo extends Application {
|
||||
@Override
|
||||
public void start(Stage primaryStage) throws Exception {
|
||||
FXPlusApplication.start(getClass());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
package cn.edu.scau.biubiusuisui.example.lifeDemo;
|
||||
|
||||
import cn.edu.scau.biubiusuisui.annotation.FXController;
|
||||
import cn.edu.scau.biubiusuisui.annotation.FXWindow;
|
||||
import cn.edu.scau.biubiusuisui.entity.FXBaseController;
|
||||
import cn.edu.scau.biubiusuisui.entity.FXPlusLocale;
|
||||
import cn.edu.scau.biubiusuisui.log.FXPlusLogger;
|
||||
import cn.edu.scau.biubiusuisui.log.FXPlusLoggerFactory;
|
||||
import cn.edu.scau.biubiusuisui.log.IFXPlusLogger;
|
||||
|
||||
/**
|
||||
* @author suisui
|
||||
* @version 1.2
|
||||
* @description 弹窗
|
||||
* @date 2020/5/1 13:49
|
||||
* @since JavaFX2.0 JDK1.8
|
||||
*/
|
||||
@FXWindow(title = "Dialog")
|
||||
@FXController(path = "fxml/lifeDemo/dialog.fxml", locale = FXPlusLocale.SIMPLIFIED_CHINESE)
|
||||
|
||||
public class DialogController extends FXBaseController {
|
||||
private static IFXPlusLogger logger = FXPlusLoggerFactory.getLogger(DialogController.class);
|
||||
|
||||
@Override
|
||||
public void initialize() throws Exception {
|
||||
logger.info("DialogController----initialize");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoad() throws Exception {
|
||||
logger.info("DialogController----onLoad");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onShow() throws Exception {
|
||||
logger.info("DialogController----onShow");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClose() throws Exception {
|
||||
logger.info("DialogController----onClose");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onHide() throws Exception {
|
||||
logger.info("DialogController----onHide");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package cn.edu.scau.biubiusuisui.example.lifeDemo;
|
||||
|
||||
import cn.edu.scau.biubiusuisui.annotation.FXScan;
|
||||
import cn.edu.scau.biubiusuisui.config.FXPlusApplication;
|
||||
import cn.edu.scau.biubiusuisui.log.FXPlusLoggerFactory;
|
||||
import cn.edu.scau.biubiusuisui.log.IFXPlusLogger;
|
||||
import cn.edu.scau.biubiusuisui.utils.LogUtil;
|
||||
import javafx.application.Application;
|
||||
import javafx.application.Platform;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
|
||||
/**
|
||||
* @author suisui
|
||||
* @version 1.2
|
||||
* @description 测试生命周期的Demo
|
||||
* @date 2020/5/1 11:50
|
||||
* @since JavaFX2.0 JDK1.8
|
||||
*/
|
||||
@FXScan(base = "cn.edu.scau.biubiusuisui.example.lifeDemo")
|
||||
public class LifeDemo extends Application {
|
||||
private static IFXPlusLogger logger = FXPlusLoggerFactory.getLogger(LifeDemo.class);
|
||||
|
||||
@Override
|
||||
public void start(Stage primaryStage) throws Exception {
|
||||
logger.info("LifeDemo---start");
|
||||
// Platform.setImplicitExit(false); //设置当关闭最后一个Stage时,JavaFX应用程序不会自动退出
|
||||
FXPlusApplication.start(getClass());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
logger.info("LifeDemo---init");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stop() throws Exception {
|
||||
logger.info("LifeDemo---stop");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
package cn.edu.scau.biubiusuisui.example.lifeDemo;
|
||||
|
||||
import cn.edu.scau.biubiusuisui.annotation.FXRedirect;
|
||||
import cn.edu.scau.biubiusuisui.annotation.FXWindow;
|
||||
import cn.edu.scau.biubiusuisui.annotation.FXController;
|
||||
import cn.edu.scau.biubiusuisui.entity.FXBaseController;
|
||||
import cn.edu.scau.biubiusuisui.entity.FXPlusLocale;
|
||||
import cn.edu.scau.biubiusuisui.log.FXPlusLoggerFactory;
|
||||
import cn.edu.scau.biubiusuisui.log.IFXPlusLogger;
|
||||
import javafx.fxml.FXML;
|
||||
|
||||
/**
|
||||
* @author suisui
|
||||
* @version 1.2
|
||||
* @description 主窗口
|
||||
* @date 2020/5/1 11:53
|
||||
* @since JavaFX2.0 JDK1.8
|
||||
*/
|
||||
@FXWindow(mainStage = true, title = "lifeDemo", icon = "image/icon.png")
|
||||
@FXController(path = "fxml/lifeDemo/lifeMain.fxml", locale = FXPlusLocale.SIMPLIFIED_CHINESE)
|
||||
public class MainController extends FXBaseController {
|
||||
private static IFXPlusLogger logger = FXPlusLoggerFactory.getLogger(FXBaseController.class);
|
||||
|
||||
@Override
|
||||
public void initialize() throws Exception {
|
||||
logger.info("MainController----initialize");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onShow() throws Exception {
|
||||
logger.info("MainController----onShow");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoad() throws Exception {
|
||||
logger.info("MainController----onLoad");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClose() throws Exception {
|
||||
logger.info("MainController----onClose");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onHide() throws Exception {
|
||||
logger.info("MainController----onHide");
|
||||
}
|
||||
|
||||
@FXML
|
||||
public void go() {
|
||||
redirectToDialog();
|
||||
}
|
||||
|
||||
@FXML
|
||||
public void goAndClose() {
|
||||
redirectToDialogAndClose();
|
||||
}
|
||||
|
||||
/**
|
||||
* 弹窗不关闭窗口
|
||||
*/
|
||||
@FXRedirect(close = false)
|
||||
public String redirectToDialog() {
|
||||
return "DialogController";
|
||||
}
|
||||
|
||||
/**
|
||||
* 弹窗并关闭本窗口
|
||||
*/
|
||||
@FXRedirect()
|
||||
public String redirectToDialogAndClose() {
|
||||
return "DialogController";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package cn.edu.scau.biubiusuisui.example.lifeDemo;
|
||||
|
||||
import cn.edu.scau.biubiusuisui.annotation.FXController;
|
||||
import cn.edu.scau.biubiusuisui.entity.FXBaseController;
|
||||
import cn.edu.scau.biubiusuisui.entity.FXPlusLocale;
|
||||
import cn.edu.scau.biubiusuisui.log.FXPlusLoggerFactory;
|
||||
import cn.edu.scau.biubiusuisui.log.IFXPlusLogger;
|
||||
|
||||
/**
|
||||
* @author suisui
|
||||
* @version 1.2
|
||||
* @description 子组件
|
||||
* @date 2020/5/1 13:48
|
||||
* @since JavaFX2.0 JDK1.8
|
||||
*/
|
||||
@FXController(path = "fxml/lifeDemo/subBar.fxml", locale = FXPlusLocale.SIMPLIFIED_CHINESE)
|
||||
public class SubController extends FXBaseController {
|
||||
private static IFXPlusLogger logger = FXPlusLoggerFactory.getLogger(SubController.class);
|
||||
|
||||
@Override
|
||||
public void initialize() throws Exception {
|
||||
logger.info("SubController----initialize");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onShow() throws Exception {
|
||||
logger.info("SubController----onShow");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoad() throws Exception {
|
||||
logger.info("SubController----onLoad");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClose() throws Exception {
|
||||
logger.info("SubController----onClose");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onHide() throws Exception {
|
||||
logger.info("SubController----onHide");
|
||||
}
|
||||
}
|
||||
@@ -6,13 +6,15 @@ import javafx.application.Application;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
/**
|
||||
* @Author jack
|
||||
* @Date:2019/7/27 1:43
|
||||
* @author jack
|
||||
* @version 1.0
|
||||
* @date 2019/7/27 1:43
|
||||
* @since JavaFX2.0 JDK1.8
|
||||
*/
|
||||
@FXScan(base = "cn.edu.scau.biubiusuisui.example.listDemo")
|
||||
public class Demo extends Application {
|
||||
public class ListDemo extends Application {
|
||||
@Override
|
||||
public void start(Stage primaryStage) throws Exception {
|
||||
FXPlusApplication.start(Demo.class);
|
||||
FXPlusApplication.start(getClass());
|
||||
}
|
||||
}
|
||||
@@ -10,13 +10,15 @@ import javafx.collections.ObservableList;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.scene.control.ListView;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author jack
|
||||
* @Date:2019/7/27 1:43
|
||||
* @author jack
|
||||
* @version 1.0
|
||||
* @date 2019/7/27 1:43
|
||||
* @since JavaFX2.0 JDK1.8
|
||||
*/
|
||||
@FXController(path = "listDemo/listDemo.fxml")
|
||||
@FXController(path = "fxml/listDemo/listDemo.fxml")
|
||||
@FXWindow(title = "listDemo", mainStage = true)
|
||||
public class MainController extends FXBaseController {
|
||||
|
||||
@@ -35,7 +37,7 @@ public class MainController extends FXBaseController {
|
||||
user.addNames("Jack\t" + (count++));
|
||||
}
|
||||
|
||||
public ObservableList toList(ArrayList list) {
|
||||
public ObservableList toList(List list) {
|
||||
if (list == null) {
|
||||
return null;
|
||||
}
|
||||
@@ -4,10 +4,13 @@ import cn.edu.scau.biubiusuisui.annotation.FXEntity;
|
||||
import cn.edu.scau.biubiusuisui.annotation.FXField;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author jack
|
||||
* @Date:2019/7/27 12:19
|
||||
* @author jack
|
||||
* @version 1.0
|
||||
* @date 2019/7/27 12:19
|
||||
* @since JavaFX2.0 JDK1.8
|
||||
*/
|
||||
@FXEntity
|
||||
public class User {
|
||||
@@ -18,7 +21,7 @@ public class User {
|
||||
private String password;
|
||||
|
||||
@FXField
|
||||
private ArrayList<String> names = new ArrayList<>();
|
||||
private List<String> names = new ArrayList<>();
|
||||
|
||||
|
||||
public User() {
|
||||
@@ -47,7 +50,7 @@ public class User {
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
public ArrayList<String> getNames() {
|
||||
public List<String> getNames() {
|
||||
return names;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
package cn.edu.scau.biubiusuisui.example.logDemo;
|
||||
|
||||
import cn.edu.scau.biubiusuisui.example.lifeDemo.LifeDemo;
|
||||
import cn.edu.scau.biubiusuisui.log.FXPlusLoggerFactory;
|
||||
import cn.edu.scau.biubiusuisui.log.IFXPlusLogger;
|
||||
import cn.edu.scau.biubiusuisui.utils.LogUtil;
|
||||
|
||||
/**
|
||||
* @author suisui
|
||||
* @description 测试日志的Demo
|
||||
* @date 2020/5/2 19:58
|
||||
* @since JDK1.8
|
||||
*/
|
||||
public class LogDemo {
|
||||
private static IFXPlusLogger logger = FXPlusLoggerFactory.getLogger(LogDemo.class);
|
||||
|
||||
public void testLogger() {
|
||||
logger.info("info");
|
||||
logger.error("error");
|
||||
logger.debug("debug");
|
||||
logger.warn("warn");
|
||||
}
|
||||
|
||||
public void testLogUtil() {
|
||||
LogUtil.info("info");
|
||||
LogUtil.error("error");
|
||||
LogUtil.debug("debug");
|
||||
LogUtil.warn("warn");
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
LogDemo demo = new LogDemo();
|
||||
demo.testLogger();
|
||||
demo.testLogUtil();
|
||||
}
|
||||
}
|
||||
@@ -6,15 +6,28 @@ import javafx.application.Application;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
/**
|
||||
* @author suiyu_yang
|
||||
* @author suisui
|
||||
* @version 1.1
|
||||
* @description
|
||||
* @date 2019/12/8 13:17
|
||||
* @email suiyu_yang@163.com
|
||||
* @since JavaFX2.0 JDK1.8
|
||||
*/
|
||||
@FXScan(base = "cn.edu.scau.biubiusuisui.example.mqDemo")
|
||||
public class MQDemo extends Application {
|
||||
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
System.out.println("application init");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start(Stage primaryStage) throws Exception {
|
||||
System.out.println("application start");
|
||||
FXPlusApplication.start(MQDemo.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stop() throws Exception {
|
||||
System.out.println("application stop");
|
||||
}
|
||||
}
|
||||
@@ -8,12 +8,13 @@ import javafx.fxml.FXML;
|
||||
import javafx.scene.control.TextArea;
|
||||
|
||||
/**
|
||||
* @author suiyu_yang
|
||||
* @author suisui
|
||||
* @version 1.2
|
||||
* @description 主界面
|
||||
* @date 2019/12/8 13:17
|
||||
* @email suiyu_yang@163.com
|
||||
* @since JavaFX2.0 JDK1.8
|
||||
*/
|
||||
@FXController(path = "mqDemo/main.fxml")
|
||||
@FXController(path = "fxml/mqDemo/main.fxml")
|
||||
@FXWindow(mainStage = true, title = "MQDemo")
|
||||
public class MainController extends FXBaseController {
|
||||
|
||||
@@ -28,9 +29,7 @@ public class MainController extends FXBaseController {
|
||||
*/
|
||||
@FXReceiver(name = "TopBarController:sendToMain")
|
||||
public void handleTopBar(String msg) {
|
||||
// TODO: 2019/12/8
|
||||
// 处理导航栏的点击事件
|
||||
outTA.appendText(msg + "\n");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -6,12 +6,13 @@ import cn.edu.scau.biubiusuisui.entity.FXBaseController;
|
||||
import javafx.fxml.FXML;
|
||||
|
||||
/**
|
||||
* @author suiyu_yang
|
||||
* @author suisui
|
||||
* @version 1.1
|
||||
* @description 导航栏示例
|
||||
* @date 2019/12/8 13:17
|
||||
* @email suiyu_yang@163.com
|
||||
* @since JavaFX2.0 JDK1.8
|
||||
*/
|
||||
@FXController(path = "mqDemo/topBar.fxml")
|
||||
@FXController(path = "fxml/mqDemo/topBar.fxml")
|
||||
public class TopBarController extends FXBaseController {
|
||||
|
||||
@FXML
|
||||
@@ -5,12 +5,14 @@ import cn.edu.scau.biubiusuisui.annotation.FXWindow;
|
||||
import cn.edu.scau.biubiusuisui.entity.FXBaseController;
|
||||
|
||||
/**
|
||||
* @author suiyu_yang
|
||||
* @author suisui
|
||||
* @version 1.1
|
||||
* @description
|
||||
* @date 2019/12/4 21:00
|
||||
* @email suiyu_yang@163.com
|
||||
* @since JavaFX2.0 JDK1.8
|
||||
*/
|
||||
@FXController(path = "redirectDemo/dialog.fxml")
|
||||
@FXController(path = "fxml/redirectDemo/dialog.fxml")
|
||||
@FXWindow(title = "弹窗")
|
||||
public class DialogController extends FXBaseController {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
package cn.edu.scau.biubiusuisui.example.redirectDemo;
|
||||
|
||||
import cn.edu.scau.biubiusuisui.annotation.FXController;
|
||||
import cn.edu.scau.biubiusuisui.annotation.FXRedirect;
|
||||
import cn.edu.scau.biubiusuisui.annotation.FXWindow;
|
||||
import cn.edu.scau.biubiusuisui.entity.FXBaseController;
|
||||
import cn.edu.scau.biubiusuisui.entity.FXRedirectParam;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.scene.control.PasswordField;
|
||||
import javafx.scene.control.TextField;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author suisui
|
||||
* @version 1.1
|
||||
* @description
|
||||
* @date 2019/12/3 11:53
|
||||
* @since JavaFX2.0 JDK1.8
|
||||
*/
|
||||
@FXController(path = "fxml/redirectDemo/login.fxml")
|
||||
@FXWindow(title = "redirectDemo", mainStage = true)
|
||||
public class LoginController extends FXBaseController {
|
||||
|
||||
@FXML
|
||||
private TextField usernameTF;
|
||||
|
||||
@FXML
|
||||
private PasswordField passwordPF;
|
||||
|
||||
@FXML
|
||||
public void registerClick() {
|
||||
redirectToRegister();
|
||||
}
|
||||
|
||||
@FXRedirect
|
||||
public String redirectToRegister() {
|
||||
return "RegisterController";
|
||||
}
|
||||
|
||||
@FXML
|
||||
@FXRedirect(close = false) //弹窗
|
||||
public String redirectToDialog() {
|
||||
return "DialogController";
|
||||
}
|
||||
|
||||
@FXML
|
||||
@FXRedirect //登录成功 Query方式
|
||||
public String redirectToSuccessWithQuery() {
|
||||
return "SuccessController?showType=0&username=" + usernameTF.getText() + "&password=" + passwordPF.getText();
|
||||
}
|
||||
|
||||
@FXML
|
||||
@FXRedirect //登录成功 Param方式
|
||||
public FXRedirectParam redirectToSuccessWithParam() {
|
||||
FXRedirectParam params = new FXRedirectParam("SuccessController");
|
||||
params.addParam("username", usernameTF.getText());
|
||||
params.addParam("password", passwordPF.getText());
|
||||
params.addQuery("showType", "0");
|
||||
return params;
|
||||
}
|
||||
|
||||
@FXML
|
||||
@FXRedirect
|
||||
public FXRedirectParam redirectToSuccessWithAll() {
|
||||
FXRedirectParam params = new FXRedirectParam("SuccessController");
|
||||
params.addParam("username", usernameTF.getText());
|
||||
params.addParam("password", passwordPF.getText());
|
||||
|
||||
params.addQuery("token", new Date().toString());
|
||||
params.addQuery("showType", "0");
|
||||
return params;
|
||||
}
|
||||
}
|
||||
@@ -6,13 +6,15 @@ import javafx.application.Application;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
/**
|
||||
* @author suiyu_yang
|
||||
* @author suisui
|
||||
* @version 1.1
|
||||
* @description 测试重定向功能的Application
|
||||
* @date 2019/12/3 11:52
|
||||
* @email suiyu_yang@163.com
|
||||
* @since JavaFX2.0 JDK1.8
|
||||
*/
|
||||
@FXScan(base = "cn.edu.scau.biubiusuisui.example.redirectDemo")
|
||||
public class RedirectDemo extends Application {
|
||||
|
||||
@Override
|
||||
public void start(Stage primaryStage) throws Exception {
|
||||
FXPlusApplication.start(RedirectDemo.class);
|
||||
@@ -0,0 +1,91 @@
|
||||
package cn.edu.scau.biubiusuisui.example.redirectDemo;
|
||||
|
||||
import cn.edu.scau.biubiusuisui.annotation.FXController;
|
||||
import cn.edu.scau.biubiusuisui.annotation.FXRedirect;
|
||||
import cn.edu.scau.biubiusuisui.annotation.FXWindow;
|
||||
import cn.edu.scau.biubiusuisui.entity.FXBaseController;
|
||||
import cn.edu.scau.biubiusuisui.entity.FXRedirectParam;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.scene.control.Alert;
|
||||
import javafx.scene.control.PasswordField;
|
||||
import javafx.scene.control.TextField;
|
||||
|
||||
/**
|
||||
* @author suisui
|
||||
* @version 1.1
|
||||
* @description
|
||||
* @date 2019/12/4 00:07
|
||||
* @since JavaFX2.0 JDK1.8
|
||||
*/
|
||||
@FXController(path = "fxml/redirectDemo/register.fxml")
|
||||
@FXWindow(title = "register")
|
||||
public class RegisterController extends FXBaseController {
|
||||
@FXML
|
||||
private TextField usernameTF;
|
||||
|
||||
@FXML
|
||||
private TextField emailTF;
|
||||
|
||||
@FXML
|
||||
private PasswordField passwordPF;
|
||||
|
||||
@FXML
|
||||
private PasswordField confirmPasswordPF;
|
||||
|
||||
@FXML
|
||||
public void registerClick() {
|
||||
if (validate()) {
|
||||
UserEntity userEntity = new UserEntity();
|
||||
userEntity.setUsername(usernameTF.getText());
|
||||
userEntity.setPassword(passwordPF.getText());
|
||||
userEntity.setEmail(emailTF.getText());
|
||||
redirectToRegisterSuccess(userEntity);
|
||||
}
|
||||
}
|
||||
|
||||
@FXML
|
||||
public void loginClick() {
|
||||
redirectToLogin();
|
||||
}
|
||||
|
||||
@FXRedirect
|
||||
public String redirectToLogin() {
|
||||
return "LoginController";
|
||||
}
|
||||
|
||||
@FXRedirect
|
||||
public FXRedirectParam redirectToRegisterSuccess(UserEntity userEntity) {
|
||||
FXRedirectParam fxRedirectParam = new FXRedirectParam("SuccessController");
|
||||
fxRedirectParam.addQuery("showType", "1");
|
||||
fxRedirectParam.addParam("user", userEntity);
|
||||
return fxRedirectParam;
|
||||
}
|
||||
|
||||
// 校验
|
||||
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,71 @@
|
||||
package cn.edu.scau.biubiusuisui.example.redirectDemo;
|
||||
|
||||
import cn.edu.scau.biubiusuisui.annotation.FXController;
|
||||
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.Label;
|
||||
|
||||
/**
|
||||
* @author suisui
|
||||
* @version 1.1
|
||||
* @description 登录成功的Controller
|
||||
* @date 2019/12/3 12:43
|
||||
* @since JavaFX2.0 JDK1.8
|
||||
*/
|
||||
@FXController(path = "fxml/redirectDemo/success.fxml")
|
||||
@FXWindow(title = "success")
|
||||
public class SuccessController extends FXBaseController {
|
||||
|
||||
@FXML
|
||||
private Label title;
|
||||
|
||||
@FXML
|
||||
private Label usernameLabel;
|
||||
|
||||
@FXML
|
||||
private Label passwordLabel;
|
||||
|
||||
@FXML
|
||||
private Label tokenLabel;
|
||||
|
||||
@FXML
|
||||
@FXRedirect
|
||||
public String redirectToLogin() {
|
||||
return "LoginController";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onShow() {
|
||||
try {
|
||||
super.onShow();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (this.getQuery().get("showType") != null) {
|
||||
String showType = (String) this.getQuery().get("showType");
|
||||
if (showType.equals("1")) { //注册
|
||||
title.setText("注册成功");
|
||||
if (this.getParam().get("user") != null) {
|
||||
UserEntity userEntity = (UserEntity) this.getParam().get("user");
|
||||
usernameLabel.setText(userEntity.getUsername());
|
||||
passwordLabel.setText(userEntity.getPassword());
|
||||
}
|
||||
} else { //登录
|
||||
title.setText("登录成功");
|
||||
// 此处为演示多种方式数据传递才进行多次赋值,实际应用时应根据数据API进行相应的数据获取操作
|
||||
if (this.getQuery().size() > 1) { //query方式传递
|
||||
usernameLabel.setText(String.valueOf(this.getQuery().get("username")));
|
||||
passwordLabel.setText(String.valueOf(this.getQuery().get("password")));
|
||||
tokenLabel.setText(String.valueOf(this.getQuery().get("token")));
|
||||
}
|
||||
if (this.getParam().size() > 1) { //param方式传递
|
||||
usernameLabel.setText(String.valueOf(this.getParam().get("username")));
|
||||
passwordLabel.setText(String.valueOf(this.getParam().get("password")));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package cn.edu.scau.biubiusuisui.example.redirectDemo;
|
||||
|
||||
/**
|
||||
* @author suisui
|
||||
* @version 1.1
|
||||
* @description 简单的用户实体
|
||||
* @date 2020/1/14 22:39
|
||||
* @since JavaFX2.0 JDK1.8
|
||||
*/
|
||||
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;
|
||||
}
|
||||
}
|
||||