1. 新增了多窗口切换功能
2. 新增多个example示例可供使用参考 3. 修正信号收发机制的bug 4. 规范化部分代码,并加以部分注释 5. 修改README
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
package cn.edu.scau.biubiusuisui.entity;
|
||||
|
||||
import cn.edu.scau.biubiusuisui.annotation.FXController;
|
||||
import cn.edu.scau.biubiusuisui.annotation.FXWindow;
|
||||
import cn.edu.scau.biubiusuisui.config.FXMLLoaderPlus;
|
||||
import cn.edu.scau.biubiusuisui.config.FXPlusApplication;
|
||||
import cn.edu.scau.biubiusuisui.utils.StringUtils;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.layout.Pane;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
@@ -17,31 +17,25 @@ import java.lang.annotation.Annotation;
|
||||
*/
|
||||
|
||||
/**
|
||||
* In JavaFX-Plus Framework Controller
|
||||
* We use MVC model
|
||||
* V means view which stand for fxml
|
||||
* C means controller which stand for FXBaseController instance
|
||||
* M means model which is base cn.edu.scau.biubiusuisui.entity in your program
|
||||
* Every BaseController has a name which is used for identifying different <strong>instance</strong>
|
||||
*
|
||||
* In JavaFX-Plus Framework Controller
|
||||
* We use MVC model
|
||||
* V means view which stand for fxml
|
||||
* C means controller which stand for FXBaseController instance
|
||||
* M means model which is base cn.edu.scau.biubiusuisui.entity in your program
|
||||
* Every BaseController has a name which is used for identifying different <strong>instance</strong>
|
||||
*/
|
||||
public class FXBaseController extends Pane {
|
||||
public class FXBaseController extends Pane {
|
||||
|
||||
protected String name = "";
|
||||
|
||||
|
||||
private Stage stage;
|
||||
|
||||
|
||||
private boolean isController = false;
|
||||
private boolean isWindow = false;
|
||||
|
||||
private boolean isWindows = false;
|
||||
|
||||
public FXBaseController(String name){
|
||||
public FXBaseController(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public FXBaseController(){
|
||||
public FXBaseController() {
|
||||
FXController fxController = null;
|
||||
Annotation[] annotations = getClass().getAnnotations();
|
||||
// Find FXController cn.edu.scau.biubiusuisui.annotation
|
||||
@@ -50,36 +44,52 @@ public class FXBaseController extends Pane {
|
||||
fxController = (FXController) annotation;
|
||||
isController = true;
|
||||
}
|
||||
// 添加赋予是否为窗口的逻辑
|
||||
if (annotation.annotationType().equals(FXWindow.class)) {
|
||||
isWindow = true;
|
||||
}
|
||||
}
|
||||
//load fxml file to show panel in scene builder
|
||||
if(isController && FXPlusApplication.IS_SCENE_BUILDER == true) {
|
||||
if (isController && FXPlusApplication.IS_SCENE_BUILDER == true) {
|
||||
FXMLLoaderPlus fxmlLoader = new FXMLLoaderPlus(getClass().getClassLoader().getResource(fxController.path()));
|
||||
fxmlLoader.setRoot(this);
|
||||
fxmlLoader.setController(this);
|
||||
fxmlLoader.setShow(true);
|
||||
System.out.println("?");
|
||||
// System.out.println("?");
|
||||
try {
|
||||
fxmlLoader.load();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void initialize() {
|
||||
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
if("".equals(name)){
|
||||
return StringUtils.getBaseClassName(getClass().getSimpleName());
|
||||
}else{
|
||||
return StringUtils.getBaseClassName(getClass().getSimpleName()) +"#"+name;
|
||||
/**
|
||||
* 唤起舞台
|
||||
*/
|
||||
public void showStage() {
|
||||
if (isWindow) {
|
||||
this.stage.show();
|
||||
}
|
||||
}
|
||||
|
||||
public void closeStage() {
|
||||
if (isWindow) {
|
||||
this.stage.close();
|
||||
}
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
if ("".equals(name) || name == null) { // 原本无“name == null”判断条件,会出错
|
||||
return StringUtils.getBaseClassName(getClass().getSimpleName());
|
||||
} else {
|
||||
return StringUtils.getBaseClassName(getClass().getSimpleName()) + "#" + name;
|
||||
}
|
||||
}
|
||||
public void doInit(){}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
@@ -93,12 +103,12 @@ public class FXBaseController extends Pane {
|
||||
isController = controller;
|
||||
}
|
||||
|
||||
public boolean isWindows() {
|
||||
return isWindows;
|
||||
public boolean isWindow() {
|
||||
return isWindow;
|
||||
}
|
||||
|
||||
public void setWindows(boolean windows) {
|
||||
isWindows = windows;
|
||||
public void setWindow(boolean window) {
|
||||
isWindow = window;
|
||||
}
|
||||
|
||||
public Stage getStage() {
|
||||
|
||||
@@ -4,10 +4,11 @@ import cn.edu.scau.biubiusuisui.annotation.FXField;
|
||||
import javafx.beans.property.Property;
|
||||
|
||||
/**
|
||||
* 将Controller中的JavaFX的field包装成FXFieldWrapper
|
||||
* @Author jack
|
||||
* @Date:2019/6/28 10:03
|
||||
*/
|
||||
public class FXFieldWarpper {
|
||||
public class FXFieldWrapper {
|
||||
|
||||
private FXField fxField;
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package cn.edu.scau.biubiusuisui.entity;
|
||||
|
||||
import cn.edu.scau.biubiusuisui.proxy.FXEntityProxy;
|
||||
import javafx.beans.property.Property;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
@@ -44,5 +43,4 @@ public class FXPlusContext {
|
||||
public static void setProxyByBeanObject(Object object,FXEntityProxy fxEntityProxy){
|
||||
beanMap.put(object,fxEntityProxy);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user