v1.2.0更新

1. 设计代码模块文件,导入IDE后可快速生成符合JavaFX-Plus编程规范的FXPlusController、FXPlusWindow、FXPlusApplication、FXPlusFXML文件
2. 完善多窗口切换功能,可携带数据跳转
3. 新增注解@FXWindow中的icon属性,传入String类型的图标URL,可为窗口标题栏增设图标
4. 完善JavaFX-Plus生命周期
5. 新增日志log模块
6. 新增语言国际化操作
7. 新增测试生命周期LifeDemo示例和测试国际化的LanguageDemo示例代码
8. 规范化代码和更新README
This commit is contained in:
yangsuiyu
2020-05-04 15:13:58 +08:00
parent 7c807d4b39
commit b48325cd63
147 changed files with 2888 additions and 456 deletions

View File

@@ -2,10 +2,13 @@ package cn.edu.scau.biubiusuisui.annotation;
import java.lang.annotation.*;
/**
* @version 1.0
* @since JavaFX2.0 JDK1.8
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.FIELD)
@Inherited
public @interface FXBind {
String [] value();
String[] value();
}

View File

@@ -1,17 +1,32 @@
package cn.edu.scau.biubiusuisui.annotation;
import cn.edu.scau.biubiusuisui.entity.FXPlusLocale;
import java.lang.annotation.*;
/**
* This is use for marking A controller as FX-Plus Controller
@Author jack
@Date:2019/6/25 1:34
*
* @author jack
* @author suisui
* @version 1.0
* @date 2019/6/25 1:34
* @since JavaFX2.0 JDK1.8
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
@Inherited
public @interface FXController {
String path();
double preWidth() default 0.0;
double preHeight() default 0.0;
/**
* @return
* @description 程序语言,默认不设置
* @version 1.2
*/
FXPlusLocale locale() default FXPlusLocale.NONE;
}

View File

@@ -3,9 +3,11 @@ package cn.edu.scau.biubiusuisui.annotation;
import java.lang.annotation.*;
/**
* @Author jack
* @Date:2019/6/25 1:36
*/
* @author jack
* @version 1.0
* @date 2019/6/25 1:36
* @since JavaFX2.0 JDK1.8
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.FIELD)
@Inherited

View File

@@ -3,8 +3,10 @@ package cn.edu.scau.biubiusuisui.annotation;
import java.lang.annotation.*;
/**
* @Author jack
* @Date:2019/6/25 1:35
* @author jack
* @version 1.0
* @date 2019/6/25 1:35
* @since JavaFX2.0 JDK1.8
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)

View File

@@ -6,8 +6,10 @@ import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* @Author jack
* @Date:2019/6/27 20:10
* @author jack
* @version 1.0
* @date 2019/6/27 20:10
* @since JavaFX2.0 JDK1.8
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.FIELD)

View File

@@ -3,8 +3,10 @@ package cn.edu.scau.biubiusuisui.annotation;
import java.lang.annotation.*;
/**
* @Author jack
* @Date:2019/6/25 13:06
* @author jack
* @version 1.0
* @date 2019/6/25 13:06
* @since JavaFX2.0 JDK1.8
*/
@Retention(RetentionPolicy.RUNTIME)
@Inherited

View File

@@ -3,10 +3,11 @@ package cn.edu.scau.biubiusuisui.annotation;
import java.lang.annotation.*;
/**
* @author suiyu_yang
* @author suisui
* @version 1.1
* @description 重定向的注解
* @date 2019/12/3 12:53
* @email suiyu_yang@163.com
* @since JavaFX2.0 JDK1.8
*/
@Retention(RetentionPolicy.RUNTIME)

View File

@@ -6,8 +6,9 @@ import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* @Author jack
* @Date:2019/6/25 2:55
* @author jack
* @date 2019/6/25 2:55
* @since JavaFX2.0 JDK1.8
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)

View File

@@ -11,28 +11,30 @@ import java.lang.annotation.Target;
* It is legal to use same method which has same name because JavaFX-Plus will identify a method with its full class name
* In addition ,name is optional , default name will be the class name and method name
* you can use this cn.edu.scau.biubiusuisui.annotation as the following cn.edu.scau.biubiusuisui.example
* @FXSernder
* public class A{
* public void test(){
*
* }
* }
* <p>
* \@FXSender
* public class A{
* public void test(){
* <p>
* }
* }
* name will be A.name(It will only contain base class name and this name)
* or you can use
* @FXSernder("testDemo")
* public class A{
* public void test(){
*
* }
* }
* name will be A.testDemo
*
* @Author jack
* @Date:2019/6/25 13:02
* @author jack
* @version 1.0
* @FXSernder("testDemo") public class A{
* public void test(){
* <p>
* }
* }
* name will be A.testDemo
* @date 2019/6/25 13:02
* @since JavaFX2.0 JDK1.8
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
public @interface FXSender {
String name()default "";
String name() default "";
}

View File

@@ -3,8 +3,10 @@ package cn.edu.scau.biubiusuisui.annotation;
import java.lang.annotation.*;
/**
* @Author jack
* @Date:2019/7/27 3:06
* @author jack
* @version 1.0
* @date 2019/7/27 3:06
* @since JavaFX2.0 JDK1.8
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.PARAMETER)

View File

@@ -1,24 +1,44 @@
package cn.edu.scau.biubiusuisui.annotation;
import cn.edu.scau.biubiusuisui.entity.FXPlusLocale;
import javafx.stage.StageStyle;
import java.lang.annotation.*;
import java.util.Locale;
/**
* @Author jack
* @Date:2019/6/25 1:36
* @author jack
* @author suisui
* @version 1.0
* @date 2019/6/25 1:36
* @since JavaFX2.0 JDK1.8
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
@Inherited
public @interface FXWindow {
double preWidth() default 0.0;
double preHeight()default 0.0;
double preHeight() default 0.0;
double minWidth() default 0.0;
double minHeight() default 0.0;
boolean resizable() default false;
boolean draggable() default false;
boolean mainStage() default false;
StageStyle style() default StageStyle.DECORATED;
String title () ;
String title();
/**
* @description 图标URL
* @version 1.2
*/
String icon() default "";
}

View File

@@ -58,29 +58,12 @@ import java.util.regex.Pattern;
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*/
/**
* Loads an object hierarchy from an XML document.
*
* @since JavaFX 2.0
* @since JavaFX2.0 JDK1.8
*/
public class FXMLLoaderPlus {

View File

@@ -6,7 +6,11 @@ import cn.edu.scau.biubiusuisui.factory.BeanBuilder;
import cn.edu.scau.biubiusuisui.factory.FXBuilder;
import cn.edu.scau.biubiusuisui.factory.FXControllerFactory;
import cn.edu.scau.biubiusuisui.function.FXWindowParser;
import cn.edu.scau.biubiusuisui.utils.ClassUtils;
import cn.edu.scau.biubiusuisui.log.FXPlusLoggerFactory;
import cn.edu.scau.biubiusuisui.log.IFXPlusLogger;
import cn.edu.scau.biubiusuisui.utils.ClassUtil;
import cn.edu.scau.biubiusuisui.utils.FileUtil;
import cn.edu.scau.biubiusuisui.utils.LogUtil;
import java.lang.annotation.Annotation;
import java.util.HashSet;
@@ -14,10 +18,14 @@ import java.util.List;
import java.util.Set;
/**
* @Author jack
* @Date:2019/6/25 2:54
* @author jack
* @version 1.0
* @date 2019/6/25 2:54
* @since JavaFX2.0 JDK1.8
*/
public class FXPlusApplication {
private static final IFXPlusLogger logger = FXPlusLoggerFactory.getLogger(FXPlusApplication.class);
// Application
private static FXWindowParser windowAnnotationParser = new FXWindowParser();
@@ -28,9 +36,15 @@ public class FXPlusApplication {
public static boolean IS_SCENE_BUILDER = true;
public static void start(Class clazz, BeanBuilder beanBuilder) {
logger.info("starting JavaFX-Plus Application");
logger.info("\n" + FileUtil.readFileFromResources("banner.txt"));
// 初始化日志路径
LogUtil.initLog4jBase();
IS_SCENE_BUILDER = false;
FXPlusApplication.beanBuilder = beanBuilder;
Annotation[] annotations = clazz.getDeclaredAnnotations();
logger.info("starting to scanning and registering controllers");
for (Annotation annotation : annotations) {
if (FXScan.class.equals(annotation.annotationType())) {
String[] dirs = ((FXScan) annotation).base();
@@ -40,12 +54,15 @@ public class FXPlusApplication {
}
Set<String> classNames = new HashSet<>();
for (String dir : sets) {
ClassUtils classUtils = new ClassUtils();
List<String> temps = classUtils.scanAllClassName(dir);
logger.info("scanning directory: " + dir);
ClassUtil classUtil = new ClassUtil();
List<String> temps = classUtil.scanAllClassName(dir);
for (String className : temps) {
try {
logger.info("loading class: " + className);
loadFXPlusClass(className, beanBuilder);
} catch (ClassNotFoundException e) {
logger.error(e.getMessage());
e.printStackTrace();
}
}
@@ -60,7 +77,9 @@ public class FXPlusApplication {
private static void loadFXPlusClass(String className, BeanBuilder beanBuilder) throws ClassNotFoundException {
Class clazz = Class.forName(className);
// 是窗口需要初始化Stage
if (clazz.getAnnotation(FXWindow.class) != null) {
logger.info("loading stage of class: " + className);
FXControllerFactory.loadStage(clazz, beanBuilder);
}
}

View File

@@ -4,21 +4,20 @@ 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.exception.NotFXWindowException;
import cn.edu.scau.biubiusuisui.utils.StringUtils;
import javafx.scene.Scene;
import cn.edu.scau.biubiusuisui.log.FXPlusLoggerFactory;
import cn.edu.scau.biubiusuisui.log.IFXPlusLogger;
import cn.edu.scau.biubiusuisui.utils.ResourceBundleUtil;
import cn.edu.scau.biubiusuisui.utils.StringUtil;
import javafx.scene.layout.Pane;
import javafx.stage.Stage;
import java.io.IOException;
import java.lang.annotation.Annotation;
import java.net.URL;
import java.util.HashMap;
import java.util.Map;
import java.util.ResourceBundle;
/**
* @Author jack
* @Date:2019/6/25 5:51
*/
/**
* In JavaFX-Plus Framework Controller
@@ -28,7 +27,16 @@ import java.util.Map;
* 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>
*/
/**
* @author jack
* @author suisui
* @version 1.0
* @date 2019/6/25 5:51
* @since JavaFX2.0 JDK1.8
*/
public class FXBaseController extends Pane {
private static IFXPlusLogger logger = FXPlusLoggerFactory.getLogger(FXBaseController.class);
protected String name = "";
private Stage stage;
@@ -37,8 +45,8 @@ public class FXBaseController extends Pane {
/**
* @Author: yangsuiyu
* @Descriptions: 用于携带信息数据
* @description 用于携带信息数据
* @version 1.2
*/
private Map<String, Object> query = new HashMap<>();
private Map<String, Object> param = new HashMap<>();
@@ -49,6 +57,7 @@ public class FXBaseController extends Pane {
public FXBaseController() {
FXController fxController = null;
FXWindow fxWindow = null;
Annotation[] annotations = getClass().getAnnotations();
// Find FXController cn.edu.scau.biubiusuisui.annotation
for (Annotation annotation : annotations) {
@@ -59,42 +68,119 @@ public class FXBaseController extends Pane {
}
// 添加赋予是否为窗口的逻辑
if (annotation.annotationType().equals(FXWindow.class)) {
fxWindow = (FXWindow) annotation;
isWindow = true;
}
}
//load fxml file to show panel in scene builder
if (isController && FXPlusApplication.IS_SCENE_BUILDER == true) {
FXMLLoaderPlus fxmlLoader = new FXMLLoaderPlus(getClass().getClassLoader().getResource(fxController.path()));
logger.info("loading the FXML file of " + this.getName());
URL location = getClass().getClassLoader().getResource(fxController.path());
String fxmlBaseName = StringUtil.getFilePathInResources(fxController.path());
ResourceBundle resourceBundle = ResourceBundleUtil.getResourceBundle(fxmlBaseName, fxController.locale());
FXMLLoaderPlus fxmlLoader = new FXMLLoaderPlus(location);
fxmlLoader.setRoot(this);
fxmlLoader.setController(this);
fxmlLoader.setShow(true);
fxmlLoader.setResources(resourceBundle);
try {
// 加载前
onLoad();
fxmlLoader.load();
} catch (IOException e) {
logger.error(e.getMessage());
e.printStackTrace();
} catch (Exception e) {
logger.error(e.getMessage());
e.printStackTrace();
}
}
}
public void initialize() {
/**
* @description 相当于onReady, 页面渲染完后的操作
* @version 1.2
*/
public void initialize() throws Exception {
}
/**
* 在显示Stage之前的操作
* @description 初始化onShow, onHide, onClose的生命周期
* @version 1.2
*/
public void beforeShowStage() {
public final void initLifeCycle() {
logger.info("init the life cycle of " + this.getName());
this.stage.setOnShowing(event -> {
try {
onShow();
} catch (Exception e) {
logger.error(e.getMessage());
e.printStackTrace();
}
});
this.stage.setOnCloseRequest(event -> {
try {
onClose();
} catch (Exception e) {
logger.error(e.getMessage());
e.printStackTrace();
}
});
// 监听最小化窗口
this.stage.iconifiedProperty().addListener((observable, oldValue, newValue) -> {
try {
if (newValue) { //最小化
onHide();
} else {
onShow(); //取消最小化
}
} catch (Exception e) {
logger.error(e.getMessage());
e.printStackTrace();
}
});
}
/**
* @description 在加载页面之前的操作
* @version 1.2
*/
public void onLoad() throws Exception {
}
/**
* @description 在显示页面之前的操作
* @version 1.2
*/
public void onShow() throws Exception {
}
/**
* @description 在关闭窗口之前的操作
* @version 1.2
*/
public void onClose() throws Exception {
}
/**
* @description 在隐藏窗口之前的操作
* @version 1.2
*/
public void onHide() throws Exception {
}
/**
* 唤起舞台
*/
public void showStage() {
this.beforeShowStage();
if (isWindow) {
this.stage.show();
}
}
public void showAndWait() {
if (isWindow) {
this.stage.showAndWait();
}
}
@@ -107,18 +193,21 @@ public class FXBaseController extends Pane {
}
}
public void showAndWait() {
this.beforeShowStage();
/**
* @description 最小化
* @version 1.2
*/
public void hideStage() {
if (isWindow) {
this.stage.showAndWait();
this.stage.setIconified(true);
}
}
public String getName() {
if ("".equals(name) || name == null) { // 原本无“name == null”判断条件会出错
return StringUtils.getBaseClassName(getClass().getSimpleName());
return StringUtil.getBaseClassName(getClass().getSimpleName());
} else {
return StringUtils.getBaseClassName(getClass().getSimpleName()) + "#" + name;
return StringUtil.getBaseClassName(getClass().getSimpleName()) + "#" + name;
}
}

View File

@@ -6,8 +6,10 @@ import javafx.beans.property.Property;
/**
* 将Controller中的JavaFX的field包装成FXFieldWrapper
*
* @Author jack
* @Date:2019/6/28 10:03
* @author jack
* @version 1.0
* @date 2019/6/28 10:03
* @since JavaFX2.0 JDK1.8
*/
public class FXFieldWrapper {

View File

@@ -5,8 +5,11 @@ import java.lang.reflect.Method;
/**
* This class is base cn.edu.scau.biubiusuisui.entity for queue message(or signal)
* you mush save the instance and method which means who will run this method
* @Author jack
* @Date:2019/6/26 15:39
*
* @author jack
* @version 1.0
* @date 2019/6/26 15:39
* @since JavaFX2.0 JDK1.8
*/
public class FXMethodEntity {

View File

@@ -12,8 +12,10 @@ import java.util.concurrent.ConcurrentHashMap;
* Context is use for storing Controller
* In addition,you can store an instance into Session to use it everywhere
*
* @Author jack
* @Date:2019/6/26 12:28
* @author jack
* @version 1.0
* @date 2019/6/26 12:28
* @since JavaFX2.0 JDK1.8
*/
public class FXPlusContext {

View File

@@ -0,0 +1,67 @@
package cn.edu.scau.biubiusuisui.entity;
/**
* @author suisui
* @version 1.2
* @description JavaFX的Locale枚举类型
* @date 2020/5/3 10:47
* @since JDK1.8 JavaFX2.0
*/
public enum FXPlusLocale {
/**
* 不设置
*/
NONE,
/**
* 简体中文
*/
SIMPLIFIED_CHINESE,
/**
* 繁体中文
*/
TRADITIONAL_CHINESE,
/**
* English 英语
*/
ENGLISH,
/**
* American 美语
*/
AMERICAN,
/**
* Le français 法语
*/
FRANCE,
/**
* Deutsch 德语
*/
GERMANY,
/**
* lingua italiana 意大利语
*/
ITALIAN,
/**
* 日本人 日语
*/
JAPANESE,
/**
* 한국어 韩语
*/
KOREAN,
}

View File

@@ -4,10 +4,11 @@ import java.util.HashMap;
import java.util.Map;
/**
* @author suiyu_yang
* @author suisui
* @version 1.2
* @description 跳转窗口携带的参数
* @date 2020/4/6 18:06
* @email suiyu_yang@163.com
* @since JavaFX2.0 JDK1.8
*/
public class FXRedirectParam {
private String toController;

View File

@@ -6,8 +6,11 @@ import javafx.application.Application;
import javafx.stage.Stage;
/**
* @Author jack
* @Date:2019/7/27 1:43
* @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 {

View File

@@ -14,11 +14,15 @@ import java.net.URL;
import java.util.ResourceBundle;
/**
* @Author jack
* @Date:2019/7/27 1:43
* @author jack
* @author suisui
* @version 1.2
* @date 2020/5/1 1:43
* @since JavaFX2.0 JDK1.8
*/
@FXController(path = "bindDemo/bindDemo.fxml")
@FXController(path = "fxml/bindDemo/bindDemo.fxml")
@FXWindow(title = "bindDemo", mainStage = true)
// TODO 待完善
public class MainController extends FXBaseController implements Initializable {
// View bind to View
@FXML

View File

@@ -1,10 +1,11 @@
package cn.edu.scau.biubiusuisui.example.bindDemo;
/**
* @author suiyu_yang
* @author suisui
* @version 1.2
* @description 详细信息
* @date 2020/4/6 00:29
* @email suiyu_yang@163.com
* @since JavaFX2.0 JDK1.8
*/
public class Profile {
private String birthday;

View File

@@ -6,8 +6,10 @@ import cn.edu.scau.biubiusuisui.annotation.FXField;
import java.util.List;
/**
* @Author yangsuiyu
* @Date:2020/4/5 12:19
* @author suisui
* @version 1.2
* @date 2020/4/5 12:19
* @since JavaFX2.0 JDK1.8
*/
@FXEntity
public class User {

View File

@@ -4,10 +4,11 @@ import javafx.beans.property.*;
import javafx.collections.ObservableList;
/**
* @author suiyu_yang
* @author suisui
* @version 1.2
* @description User的JavaFXBean
* @date 2020/4/6 14:30
* @email suiyu_yang@163.com
* @since JavaFX2.0 JDK1.8
*/
public class UserPropertyEntity {
private SimpleStringProperty name;

View File

@@ -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加强
}
}

View File

@@ -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 {

View File

@@ -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

View File

@@ -0,0 +1,39 @@
package cn.edu.scau.biubiusuisui.example.languageDemo;
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/languageDemo/languageDemo.fxml", locale = FXPlusLocale.SIMPLIFIED_CHINESE)
public class ChineseController extends FXBaseController {
@FXML
public void clickToChinese() {
redirect("ChineseController");
}
@FXML
public void clickToEnglish() {
redirect("EnglishController");
}
@FXML
public void clickToKorean() {
redirect("KoreanController");
}
@FXRedirect
public String redirect(String name) {
return name;
}
}

View File

@@ -0,0 +1,38 @@
package cn.edu.scau.biubiusuisui.example.languageDemo;
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/languageDemo/languageDemo.fxml", locale = FXPlusLocale.ENGLISH)
public class EnglishController extends FXBaseController {
@FXML
public void clickToChinese() {
redirect("ChineseController");
}
@FXML
public void clickToEnglish() {
redirect("EnglishController");
}
@FXML
public void clickToKorean() {
redirect("KoreanController");
}
@FXRedirect
public String redirect(String name) {
return name;
}
}

View File

@@ -0,0 +1,38 @@
package cn.edu.scau.biubiusuisui.example.languageDemo;
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/languageDemo/languageDemo.fxml", locale = FXPlusLocale.KOREAN)
public class KoreanController extends FXBaseController {
@FXML
public void clickToChinese() {
redirect("ChineseController");
}
@FXML
public void clickToEnglish() {
redirect("EnglishController");
}
@FXML
public void clickToKorean() {
redirect("KoreanController");
}
@FXRedirect
public String redirect(String name) {
return name;
}
}

View File

@@ -0,0 +1,20 @@
package cn.edu.scau.biubiusuisui.example.languageDemo;
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.languageDemo")
public class LanguageDemo extends Application {
@Override
public void start(Stage primaryStage) throws Exception {
FXPlusApplication.start(getClass());
}
}

View File

@@ -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");
}
}

View File

@@ -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");
}
}

View File

@@ -0,0 +1,75 @@
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;
import javafx.scene.input.Clipboard;
/**
* @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";
}
}

View File

@@ -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");
}
}

View File

@@ -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 ListDemo extends Application {
@Override
public void start(Stage primaryStage) throws Exception {
FXPlusApplication.start(ListDemo.class);
FXPlusApplication.start(getClass());
}
}

View File

@@ -10,14 +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 {

View File

@@ -7,8 +7,10 @@ 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 {

View File

@@ -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();
}
}

View File

@@ -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");
}
}

View File

@@ -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 {
@@ -31,5 +32,4 @@ public class MainController extends FXBaseController {
// 处理导航栏的点击事件
outTA.appendText(msg + "\n");
}
}

View File

@@ -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

View File

@@ -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 {
}

View File

@@ -10,16 +10,15 @@ import javafx.scene.control.PasswordField;
import javafx.scene.control.TextField;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
/**
* @author suiyu_yang
* @author suisui
* @version 1.1
* @description
* @date 2019/12/3 11:53
* @email suiyu_yang@163.com
* @since JavaFX2.0 JDK1.8
*/
@FXController(path = "redirectDemo/login.fxml")
@FXController(path = "fxml/redirectDemo/login.fxml")
@FXWindow(title = "redirectDemo", mainStage = true)
public class LoginController extends FXBaseController {

View File

@@ -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);

View File

@@ -11,12 +11,13 @@ import javafx.scene.control.PasswordField;
import javafx.scene.control.TextField;
/**
* @author suiyu_yang
* @author suisui
* @version 1.1
* @description
* @date 2019/12/4 00:07
* @email suiyu_yang@163.com
* @since JavaFX2.0 JDK1.8
*/
@FXController(path = "redirectDemo/register.fxml")
@FXController(path = "fxml/redirectDemo/register.fxml")
@FXWindow(title = "register")
public class RegisterController extends FXBaseController {
@FXML

View File

@@ -4,23 +4,19 @@ 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.exception.NotFXWindowException;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.Label;
import java.net.URL;
import java.util.ResourceBundle;
/**
* @author suiyu_yang
* @author suisui
* @version 1.1
* @description 登录成功的Controller
* @date 2019/12/3 12:43
* @email suiyu_yang@163.com
* @since JavaFX2.0 JDK1.8
*/
@FXController(path = "redirectDemo/success.fxml")
@FXController(path = "fxml/redirectDemo/success.fxml")
@FXWindow(title = "success")
public class SuccessController extends FXBaseController implements Initializable {
public class SuccessController extends FXBaseController {
@FXML
private Label title;
@@ -41,7 +37,12 @@ public class SuccessController extends FXBaseController implements Initializable
}
@Override
public void beforeShowStage() {
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")) { //注册
@@ -67,8 +68,4 @@ public class SuccessController extends FXBaseController implements Initializable
}
}
@Override
public void initialize(URL location, ResourceBundle resources) {
}
}

View File

@@ -1,10 +1,11 @@
package cn.edu.scau.biubiusuisui.example.redirectDemo;
/**
* @author suiyu_yang
* @author suisui
* @version 1.1
* @description 简单的用户实体
* @date 2020/1/14 22:39
* @email suiyu_yang@163.com
* @since JavaFX2.0 JDK1.8
*/
public class UserEntity {
private String username;

View File

@@ -7,12 +7,13 @@ import javafx.fxml.FXML;
import javafx.stage.StageStyle;
/**
* @author suiyu_yang
* @author suisui
* @version 1.2
* @description 主控制器
* @date 2020/4/5 00:05
* @email suiyu_yang@163.com
* @since JavaFX2.0 JDK1.8
*/
@FXController(path = "resizableDemo/resizableDemo.fxml")
@FXController(path = "fxml/resizableDemo/resizableDemo.fxml")
@FXWindow(mainStage = true, title = "resizableDemo", draggable = true, resizable = true, style = StageStyle.UNDECORATED)
public class MainController extends FXBaseController {

View File

@@ -6,15 +6,16 @@ import javafx.application.Application;
import javafx.stage.Stage;
/**
* @author suiyu_yang
* @author suisui
* @version 1.0
* @description 缩放和拖拽的示例
* @date 2020/4/5 00:04
* @email suiyu_yang@163.com
* @since JavaFX2.0 JDK1.8
*/
@FXScan(base = "cn.edu.scau.biubiusuisui.example.resizableDemo")
public class Demo extends Application {
public class ResizableDemo extends Application {
@Override
public void start(Stage primaryStage) throws Exception {
FXPlusApplication.start(Demo.class);
FXPlusApplication.start(ResizableDemo.class);
}
}

View File

@@ -1,10 +1,11 @@
package cn.edu.scau.biubiusuisui.exception;
/**
* @author suiyu_yang
* @author suisui
* @version 1.2
* @description 不合法URL
* @date 2020/4/6 15:59
* @email suiyu_yang@163.com
* @since JavaFX2.0 JDK1.8
*/
public class InvalidURLException extends Exception {
public InvalidURLException() {

View File

@@ -1,8 +1,10 @@
package cn.edu.scau.biubiusuisui.exception;
/**
* @Author jack
* @Date:2019/7/27 3:00
* @author jack
* @version 1.0
* @date 2019/7/27 3:00
* @since JavaFX2.0 JDK1.8
*/
public class NoSuchChangeMethod extends Exception {

View File

@@ -1,10 +1,11 @@
package cn.edu.scau.biubiusuisui.exception;
/**
* @author suiyu_yang
* @description 某Controller不是窗口
* @author suisui
* @version 1.2
* @description 某Controller不是窗口的错误
* @date 2020/4/6 17:10
* @email suiyu_yang@163.com
* @since JavaFX2.0 JDK1.8
*/
public class NotFXWindowException extends Exception {
public NotFXWindowException() {

View File

@@ -1,11 +1,13 @@
package cn.edu.scau.biubiusuisui.exception;
/**
* @Author jack
* @Date:2019/6/25 7:23
* @author jack
* @version 1.0
* @date 2019/6/25 7:23
* @since JavaFX2.0 JDK1.8
*/
public class ProtocolNotSupport extends Exception{
public ProtocolNotSupport(){
public class ProtocolNotSupport extends Exception {
public ProtocolNotSupport() {
super("protocolNotSupport");
}
}

View File

@@ -1,9 +1,11 @@
package cn.edu.scau.biubiusuisui.expression;
/**
* @Author jack
* @Date:2019/7/27 2:02
* @author jack
* @version 1.0
* @date 2019/7/27 2:02
* @since JavaFX2.0 JDK1.8
*/
public interface BindParser {
public void parse(Object target,String expression);
public void parse(Object target, String expression);
}

View File

@@ -3,8 +3,10 @@ package cn.edu.scau.biubiusuisui.expression.action;
import cn.edu.scau.biubiusuisui.expression.BindParser;
/**
* @Author jack
* @Date:2019/7/27 2:03
* @author jack
* @version 1.0
* @date 2019/7/27 2:03
* @since JavaFX2.0 JDK1.8
*/
public class ChangeParser implements BindParser {

View File

@@ -1,10 +1,12 @@
package cn.edu.scau.biubiusuisui.expression.data;
/**
* @Author jack
* @Date:2019/7/27 20:03
* @author jack
* @version 1.0
* @date 2019/7/27 20:03
* @since JavaFX2.0 JDK1.8
*/
@FunctionalInterface
public interface ExpFunction<T,U,R>{
public interface ExpFunction<T, U, R> {
R apply(T t, U u);
}

View File

@@ -27,8 +27,10 @@ import java.lang.reflect.Parameter;
* 最后
* left.bind(right)
*
* @Author jack
* @Date:2019/7/23 15:05
* @author jack
* @version 1.0
* @date 2019/7/23 15:05
* @since JavaFX2.0 JDK1.8
*/
public class ExpressionParser {

View File

@@ -9,8 +9,10 @@ import java.util.ArrayList;
import java.util.List;
/**
* @Author jack
* @Date:2019/7/27 20:00
* @author jack
* @version 1.0
* @date 2019/7/27 20:00
* @since JavaFX2.0 JDK1.8
*/
public class FunctionExpression extends Expression {

View File

@@ -7,8 +7,10 @@ import com.sun.javafx.fxml.BeanAdapter;
import javafx.beans.value.ObservableValue;
/**
* @Author jack
* @Date:2019/7/23 15:16
* @author jack
* @version 1.0
* @date 2019/7/23 15:16
* @since JavaFX2.0 JDK1.8
*/
public class MyBeanAdapter extends BeanAdapter {

View File

@@ -16,6 +16,11 @@ import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
/**
* @author jack
* @version 1.0
* @since JavaFX2.0 JDK1.8
*/
public class MyExpressionValue extends ObservableValueBase<Object> {
// Monitors a namespace for changes along a key path

View File

@@ -1,12 +1,15 @@
package cn.edu.scau.biubiusuisui.factory;
/**
* @Author jack
* @Date:2019/7/4 11:16
* @author jack
* @version 1.0
* @date 2019/7/4 11:16
* @since JavaFX2.0 JDK1.8
*/
public interface BeanBuilder {
/**
* 万能工厂方法
* 万能工厂方法
*
* @param type 类型
* @return 实例对象
*/

View File

@@ -1,18 +1,27 @@
package cn.edu.scau.biubiusuisui.factory;
import cn.edu.scau.biubiusuisui.log.FXPlusLoggerFactory;
import cn.edu.scau.biubiusuisui.log.IFXPlusLogger;
/**
* @Author jack
* @Date:2019/7/4 11:13
* @author jack
* @version 1.0
* @date 2019/7/4 11:13
* @since JavaFX2.0 JDK1.8
*/
public class FXBuilder implements BeanBuilder{
public class FXBuilder implements BeanBuilder {
private IFXPlusLogger logger = FXPlusLoggerFactory.getLogger(FXBuilder.class);
@Override
public Object getBean(Class type) {
Object object = null;
try {
object = type.newInstance();
} catch (InstantiationException e) {
logger.error(e.getMessage());
e.printStackTrace();
} catch (IllegalAccessException e) {
logger.error(e.getMessage());
e.printStackTrace();
}
return object;

View File

@@ -7,12 +7,17 @@ import cn.edu.scau.biubiusuisui.annotation.FXWindow;
import cn.edu.scau.biubiusuisui.config.FXMLLoaderPlus;
import cn.edu.scau.biubiusuisui.entity.FXBaseController;
import cn.edu.scau.biubiusuisui.entity.FXPlusContext;
import cn.edu.scau.biubiusuisui.entity.FXPlusLocale;
import cn.edu.scau.biubiusuisui.exception.NoSuchChangeMethod;
import cn.edu.scau.biubiusuisui.expression.data.ExpressionParser;
import cn.edu.scau.biubiusuisui.function.FXWindowParser;
import cn.edu.scau.biubiusuisui.log.FXPlusLoggerFactory;
import cn.edu.scau.biubiusuisui.log.IFXPlusLogger;
import cn.edu.scau.biubiusuisui.messageQueue.MessageQueue;
import cn.edu.scau.biubiusuisui.proxy.FXControllerProxy;
import cn.edu.scau.biubiusuisui.stage.StageManager;
import cn.edu.scau.biubiusuisui.utils.ResourceBundleUtil;
import cn.edu.scau.biubiusuisui.utils.StringUtil;
import javafx.collections.ObservableMap;
import javafx.scene.Scene;
import javafx.scene.layout.Pane;
@@ -21,12 +26,16 @@ import javafx.stage.Stage;
import java.io.IOException;
import java.lang.reflect.Field;
import java.net.URL;
import java.util.ResourceBundle;
/**
* @Author jack
* @Date:2019/6/25 8:12
* @author jack
* @version 1.0
* @date 2019/6/25 8:12
* @since JavaFX2.0 JDK1.8
*/
public class FXControllerFactory {
private static IFXPlusLogger logger = FXPlusLoggerFactory.getLogger(FXControllerFactory.class);
private static final BeanBuilder BEAN_BUILDER = new FXBuilder();
private static FXWindowParser fxWindowAnnotationParser = new FXWindowParser();
@@ -91,7 +100,11 @@ public class FXControllerFactory {
FXBaseController fxBaseController = null;
FXBaseController fxControllerProxy = null;
if (fxController != null) {
logger.info("loading the FXML file of " + clazz.getName());
String fxmlPathName = fxController.path();
String fxmlBaseName = StringUtil.getFilePathInResources(fxmlPathName);
FXPlusLocale fxPlusLocale = fxController.locale();
ResourceBundle resourceBundle = ResourceBundleUtil.getResourceBundle(fxmlBaseName, fxPlusLocale);
fxmlPath = clazz.getClassLoader().getResource(fxmlPathName);
FXMLLoaderPlus fxmlLoader = new FXMLLoaderPlus(fxmlPath);
// create a cn.edu.scau.biubiusuisui.proxy for monitoring methods
@@ -105,8 +118,13 @@ public class FXControllerFactory {
fxmlLoader.setRoot(fxControllerProxy);
fxmlLoader.setController(fxControllerProxy);
fxmlLoader.setBaseController(fxBaseController);
fxmlLoader.setResources(resourceBundle);
try {
fxControllerProxy.onLoad(); //页面加载
parent = fxmlLoader.load();
if (controllerName != null) {
fxControllerProxy.setName(controllerName);
fxBaseController.setName(controllerName);
@@ -118,7 +136,10 @@ public class FXControllerFactory {
scanBind(namespace, fxBaseController); //处理@FXBind
register(fxBaseController, fxControllerProxy);
} catch (IOException exception) {
logger.error(exception.getMessage());
throw new RuntimeException(exception);
} catch (Exception e) {
e.printStackTrace();
}
}
} else {
@@ -147,6 +168,7 @@ public class FXControllerFactory {
* @Description 为有FXWindow注解的类创建Stage
*/
private static Stage createWindow(FXWindow fxWindow, Class clazz, FXBaseController fxBaseControllerProxy) {
logger.info("creating window");
Stage stage = new Stage();
fxBaseControllerProxy.setStage(stage);
double preWidth = fxWindow.preWidth() == 0 ? fxBaseControllerProxy.getPrefWidth() : fxWindow.preWidth();
@@ -155,6 +177,9 @@ public class FXControllerFactory {
stage.setScene(scene);
fxWindowAnnotationParser.parse(stage, fxBaseControllerProxy, fxWindow);
// 此处设置生命周期中的onShow,onHide,onClose
fxBaseControllerProxy.initLifeCycle();
StageManager.getInstance().registerWindow(clazz, fxBaseControllerProxy); //注册舞台
if (fxWindow.mainStage() == true) { //当是主舞台时先show为敬
fxBaseControllerProxy.showStage();
@@ -253,6 +278,7 @@ public class FXControllerFactory {
Object fieldValueProxy = FXEntityFactory.wrapFXBean(fieldValue);
field.set(fxControllerObject, fieldValueProxy);
} catch (IllegalAccessException e) {
logger.error(e.getMessage());
e.printStackTrace();
}
}
@@ -277,6 +303,7 @@ public class FXControllerFactory {
Object fieldValue = field.get(object);
namespace.put(fx_id, fieldValue);
} catch (IllegalAccessException e) {
logger.error(e.getMessage());
e.printStackTrace();
}
}
@@ -303,8 +330,10 @@ public class FXControllerFactory {
expressionParser.parse(objectValue, e);
}
} catch (IllegalAccessException e) {
logger.error(e.getMessage());
e.printStackTrace();
} catch (NoSuchChangeMethod noSuchChangeMethod) {
logger.error(noSuchChangeMethod.getMessage());
noSuchChangeMethod.printStackTrace();
}
}

View File

@@ -4,7 +4,7 @@ import cn.edu.scau.biubiusuisui.annotation.FXField;
import cn.edu.scau.biubiusuisui.entity.FXFieldWrapper;
import cn.edu.scau.biubiusuisui.entity.FXPlusContext;
import cn.edu.scau.biubiusuisui.proxy.FXEntityProxy;
import cn.edu.scau.biubiusuisui.utils.ClassUtils;
import cn.edu.scau.biubiusuisui.utils.ClassUtil;
import javafx.beans.property.*;
import javafx.collections.FXCollections;
@@ -15,8 +15,10 @@ import java.util.List;
import java.util.Map;
/**
* @Author jack
* @Date:2019/6/28 1:12
* @author jack
* @version 1.0
* @date 2019/6/28 1:12
* @since JavaFX2.0 JDK1.8
*/
public class FXEntityFactory {
@@ -65,7 +67,7 @@ public class FXEntityFactory {
Map<String, FXFieldWrapper> fxFieldWrapperMap = new HashMap<>();
Field[] fields = entityObject.getClass().getDeclaredFields();
for (Field field : fields) {
Annotation annotation = ClassUtils.getAnnotationInList(FXField.class, field.getDeclaredAnnotations());
Annotation annotation = ClassUtil.getAnnotationInList(FXField.class, field.getDeclaredAnnotations());
if (annotation != null) {
Property property = null;
field.setAccessible(true);

View File

@@ -7,8 +7,10 @@ import javafx.scene.layout.Pane;
import javafx.stage.Stage;
/**
* @Author jack
* @Date:2019/6/30 10:11
* @author jack
* @version 1.0
* @date 2019/6/30 10:11
* @since JavaFX2.0 JDK1.8
*/
public class DragWindowHandlerImpl implements EventHandler<MouseEvent> {
//参考<a href="https://www.cnblogs.com/moonlightL/p/5982679.html"></a>

View File

@@ -1,8 +1,10 @@
package cn.edu.scau.biubiusuisui.function;
/**
* @Author jack
* @Date:2019/7/27 1:54
* @author jack
* @version 1.0
* @date 2019/7/27 1:54
* @since JavaFX2.0 JDK1.8
*/
public interface Draggale {

View File

@@ -1,33 +1,66 @@
package cn.edu.scau.biubiusuisui.function;
import cn.edu.scau.biubiusuisui.annotation.FXWindow;
import cn.edu.scau.biubiusuisui.entity.FXBaseController;
import cn.edu.scau.biubiusuisui.exception.ProtocolNotSupport;
import cn.edu.scau.biubiusuisui.log.FXPlusLoggerFactory;
import cn.edu.scau.biubiusuisui.log.IFXPlusLogger;
import cn.edu.scau.biubiusuisui.utils.FileUtil;
import cn.edu.scau.biubiusuisui.utils.StringUtil;
import javafx.event.EventHandler;
import javafx.scene.layout.Pane;
import javafx.scene.image.Image;
import javafx.stage.Stage;
import java.io.File;
import java.net.URL;
/**
* @Author jack
* @Date:2019/6/30 10:40
* @Description 解析@FXWindow
* @author jack
* @version 1.0
* @date 2019/6/30 10:40
* @description 解析@FXWindow
* @since JavaFX2.0 JDK1.8
*/
public class FXWindowParser {
private static IFXPlusLogger logger = FXPlusLoggerFactory.getLogger(FXWindowParser.class);
public void parse(Stage stage, Pane fxControllerProxy, FXWindow fxWindow) {
public void parse(Stage stage, FXBaseController fxControllerProxy, FXWindow fxWindow) {
logger.info("parsing @FXWindow of class: " + fxControllerProxy.getName());
// 处理 title
stage.setTitle(fxWindow.title());
// 处理 icon
if (!"".equals(fxWindow.icon())) {
try {
URL iconUrl = new FileUtil().getFilePathFromResources(fxWindow.icon());
if (iconUrl != null) {
if (new File(StringUtil.getRootPath(iconUrl)).exists()) {
stage.getIcons().add(new Image(fxWindow.icon()));
} else {
logger.warn("the icon file has not existed");
}
} else {
logger.warn("the icon file has not existed");
}
} catch (ProtocolNotSupport protocolNotSupport) {
logger.error(protocolNotSupport.getMessage(), protocolNotSupport);
protocolNotSupport.printStackTrace();
}
}
// fxWindow的resizable默认为false
if (fxWindow.resizable()) {
stage.setResizable(true);
}
// 处理draggable和resizable
if (fxWindow.draggable() || fxWindow.resizable()) {
EventHandler dragWindowHandler = new DragWindowHandlerImpl(stage, fxWindow.minWidth(), fxWindow.minHeight(), fxControllerProxy, fxWindow.draggable(), fxWindow.resizable());
fxControllerProxy.setOnMousePressed(dragWindowHandler);
fxControllerProxy.setOnMouseDragged(dragWindowHandler);
fxControllerProxy.setOnMouseMoved(dragWindowHandler);
}
// 处理style
stage.initStyle(fxWindow.style());
}
}

View File

@@ -0,0 +1,67 @@
package cn.edu.scau.biubiusuisui.log;
import org.apache.log4j.Level;
import org.apache.log4j.Logger;
/**
* @author suisui
* @version 1.2
* @description JavaPlus的日志类
* @date 2020/5/1 10:55
* @since JavaFX2.0 JDK1.8
*/
public class FXPlusLogger implements IFXPlusLogger {
private Logger logger;
private String FQCN;
public FXPlusLogger(Logger logger) {
this.FQCN = FXPlusLogger.class.getName();
this.logger = logger;
}
public FXPlusLogger(String fqcn, Logger logger) {
this.FQCN = fqcn;
this.logger = logger;
}
@Override
public void debug(Object message) {
logger.log(FQCN, Level.DEBUG, message, null);
}
@Override
public void debug(Object message, Throwable t) {
logger.log(FQCN, Level.DEBUG, message, t);
}
@Override
public void info(Object message) {
logger.log(FQCN, Level.INFO, message, null);
}
@Override
public void info(Object message, Throwable t) {
logger.log(FQCN, Level.INFO, message, t);
}
@Override
public void warn(Object message) {
logger.log(FQCN, Level.WARN, message, null);
}
@Override
public void warn(Object message, Throwable t) {
logger.log(FQCN, Level.WARN, message, t);
}
@Override
public void error(Object message) {
logger.log(FQCN, Level.ERROR, message, null);
}
@Override
public void error(Object message, Throwable t) {
logger.log(FQCN, Level.ERROR, message, t);
}
}

View File

@@ -0,0 +1,12 @@
package cn.edu.scau.biubiusuisui.log;
/**
* @author suisui
* @version 1.2
* @description 日志类上下文
* @date 2020/5/1 10:56
* @since JavaFX2.0 JDK1.8
*/
public class FXPlusLoggerContext {
}

View File

@@ -0,0 +1,25 @@
package cn.edu.scau.biubiusuisui.log;
import cn.edu.scau.biubiusuisui.utils.LogUtil;
import org.apache.log4j.Logger;
/**
* @author suisui
* @version 1.2
* @description 生成日志类的工厂
* @date 2020/5/1 10:56
* @since JavaFX2.0 JDK1.8
*/
public class FXPlusLoggerFactory {
private FXPlusLoggerFactory() {
}
public static IFXPlusLogger getLogger(Class<?> clazz) {
LogUtil.initLog4jBase();
Logger logger = Logger.getLogger(clazz);
return new FXPlusLogger(logger);
}
}

View File

@@ -0,0 +1,30 @@
package cn.edu.scau.biubiusuisui.log;
import org.slf4j.Logger;
/**
* @author suisui
* @version 1.2
* @description 日志接口
* @date 2020/5/1 10:54
* @since JavaFX2.0 JDK1.8
*/
public interface IFXPlusLogger {
void debug(Object message);
void debug(Object message, Throwable t);
void info(Object message);
void info(Object message, Throwable t);
void warn(Object message);
void warn(Object message, Throwable t);
void error(Object message);
void error(Object message, Throwable t);
}

View File

@@ -3,6 +3,8 @@ package cn.edu.scau.biubiusuisui.messageQueue;
import cn.edu.scau.biubiusuisui.annotation.FXReceiver;
import cn.edu.scau.biubiusuisui.entity.FXBaseController;
import cn.edu.scau.biubiusuisui.entity.FXMethodEntity;
import cn.edu.scau.biubiusuisui.log.FXPlusLoggerFactory;
import cn.edu.scau.biubiusuisui.log.IFXPlusLogger;
import java.lang.annotation.Annotation;
import java.lang.reflect.InvocationTargetException;
@@ -13,11 +15,14 @@ import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
/**
* @Author jack
* @Date:2019/6/25 12:24
* @author jack
* @version 1.0
* @date 2019/6/25 12:24
* @since JavaFX2.0 JDK1.8
*/
public class MessageQueue {
private IFXPlusLogger logger = FXPlusLoggerFactory.getLogger(MessageQueue.class);
private static Map<String, List<FXMethodEntity>> receivers = new ConcurrentHashMap<>(); //Map<主题,订阅了主题的所有方法>
@@ -45,6 +50,7 @@ public class MessageQueue {
Annotation[] annotations = method.getDeclaredAnnotations();
for (Annotation annotation : annotations) {
if (FXReceiver.class.equals(annotation.annotationType())) {
logger.info("registering consumer: " + fxBaseControllerProxy.getName());
// System.out.println("FXReceiver");
FXReceiver receiver = (FXReceiver) annotation;
FXMethodEntity fxMethodEntity = new FXMethodEntity(fxBaseControllerProxy, method);
@@ -75,8 +81,10 @@ public class MessageQueue {
try {
method.invoke(fxBaseController);
} catch (IllegalAccessException e) {
logger.error(e.getMessage());
e.printStackTrace();
} catch (InvocationTargetException e) {
logger.error(e.getMessage());
e.printStackTrace();
}
} else {
@@ -84,8 +92,10 @@ public class MessageQueue {
// obj the object the underlying method is invoked from
method.invoke(fxBaseController, msg);
} catch (IllegalAccessException e) {
logger.error(e.getMessage());
e.printStackTrace();
} catch (InvocationTargetException e) {
logger.error(e.getMessage());
e.printStackTrace();
}
}

View File

@@ -17,8 +17,10 @@ import java.lang.reflect.Method;
* This proxy class intercept Methods that has special annotation such as
* FXSender which is a mark for message queue
*
* @Author jack
* @Date:2019/6/25 2:03
* @author jack
* @version 1.0
* @date 2019/6/25 2:03
* @since JavaFX2.0 JDK1.8
*/
public class FXControllerProxy implements MethodInterceptor {

View File

@@ -1,7 +1,7 @@
package cn.edu.scau.biubiusuisui.proxy;
import cn.edu.scau.biubiusuisui.entity.FXFieldWrapper;
import cn.edu.scau.biubiusuisui.utils.StringUtils;
import cn.edu.scau.biubiusuisui.utils.StringUtil;
import javafx.beans.property.*;
import net.sf.cglib.proxy.Enhancer;
import net.sf.cglib.proxy.MethodInterceptor;
@@ -11,8 +11,10 @@ import java.lang.reflect.Method;
import java.util.Map;
/**
* @Author jack
* @Date:2019/6/27 18:47
* @author jack
* @version 1.0
* @date 2019/6/27 18:47
* @since JavaFX2.0 JDK1.8
*/
public class FXEntityProxy implements MethodInterceptor {
@@ -50,7 +52,7 @@ public class FXEntityProxy implements MethodInterceptor {
String methodName = method.getName();
String fieldName = null;
if (methodName.length() >= 3) {
fieldName = StringUtils.toInstanceName(methodName.substring(3)); // 该method有可能是getter和setter方法进行处理
fieldName = StringUtil.toInstanceName(methodName.substring(3)); // 该method有可能是getter和setter方法进行处理
} else {
return revokeResult;
}

View File

@@ -4,7 +4,8 @@ import cn.edu.scau.biubiusuisui.entity.FXBaseController;
import cn.edu.scau.biubiusuisui.entity.FXPlusContext;
import cn.edu.scau.biubiusuisui.entity.FXRedirectParam;
import cn.edu.scau.biubiusuisui.exception.InvalidURLException;
import cn.edu.scau.biubiusuisui.factory.FXControllerFactory;
import cn.edu.scau.biubiusuisui.log.FXPlusLoggerFactory;
import cn.edu.scau.biubiusuisui.log.IFXPlusLogger;
import java.util.ArrayDeque;
import java.util.List;
@@ -12,12 +13,15 @@ import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
/**
* @author suiyu_yang
* @author suisui
* @version 1.1
* @description 舞台管理器
* @date 2019/12/3 15:43
* @email suiyu_yang@163.com
* @since JavaFX2.0 JDK1.8
*/
public class StageManager {
private static IFXPlusLogger logger = FXPlusLoggerFactory.getLogger(StageManager.class);
private static StageManager stageManager = null;
private static Map<String, FXBaseController> initWindows = new ConcurrentHashMap<>();
private static Map<String, Class> windowClazz = new ConcurrentHashMap<>();
@@ -43,12 +47,23 @@ public class StageManager {
return stageManager;
}
/**
* 注册FXWindow注解的Controller
*
* @param clazz
* @param fxBaseControllerProxy
*/
public void registerWindow(Class clazz, FXBaseController fxBaseControllerProxy) {
fxBaseControllerProxy.getClass().getDeclaredAnnotations();
initWindows.put(fxBaseControllerProxy.getName(), fxBaseControllerProxy);
windowClazz.put(fxBaseControllerProxy.getName(), clazz);
}
/**
* 关闭窗口
*
* @param controllerName
*/
public void closeStage(String controllerName) {
if (initWindows.get(controllerName) != null) {
initWindows.get(controllerName).closeStage();
@@ -66,6 +81,7 @@ public class StageManager {
try {
fxRedirectParam = getQueryParamsFromURL((String) redirectParams);
} catch (InvalidURLException e) {
logger.error(e.getMessage());
e.printStackTrace();
}
} else { //无参数 return "SuccessController"
@@ -92,6 +108,7 @@ public class StageManager {
// toController = FXControllerFactory.getFXController(newController.getClass(), toControllerStr);
//// registerWindow(, toController);
// }
logger.debug("redirecting to " + toController.getName());
toController.setParam(fxRedirectParam.getParams());
toController.setQuery(fxRedirectParam.getQueryMap());
toController.showStage();

View File

@@ -5,9 +5,11 @@ import cn.edu.scau.biubiusuisui.proxy.FXEntityProxy;
import javafx.beans.property.Property;
/**
* @Author jack
* @author jack
* @version 1.0
* @Date:2019/7/28 1:52
* @Description:
* @since JavaFX2.0 JDK1.8
*/
public class BeanUtil {
public static Property getPropertyByName(Object entity, String fieldName) {

View File

@@ -10,24 +10,26 @@ import java.util.jar.JarEntry;
import java.util.jar.JarFile;
/**
* @Author jack
* @Date:2019/6/25 5:20
* @author jack
* @version 1.0
* @date 2019/6/25 5:20
* @since JavaFX2.0 JDK1.8
*/
public class ClassUtils {
public class ClassUtil {
private ClassLoader classLoader;
public ClassUtils() {
public ClassUtil() {
classLoader = getClass().getClassLoader();
}
private List<String> getAllFXControllerClassName(String base, List<String> nameList) {
String splashPath = StringUtils.dotToSplash(base);
String splashPath = StringUtil.dotToSplash(base);
URL url = classLoader.getResource(splashPath);
String filePath = StringUtils.getRootPath(url);
String filePath = StringUtil.getRootPath(url);
List<String> names = null;
if(filePath.endsWith("jar")){
nameList = readFromJarDirectory(filePath,base);
}else {
if (filePath.endsWith("jar")) {
nameList = readFromJarDirectory(filePath, base);
} else {
names = readFromDirectory(filePath);
for (String name : names) {
if (isClassFile(name)) {
@@ -47,7 +49,7 @@ public class ClassUtils {
private static String toFullyQualifiedName(String shortName, String basePackage) {
StringBuilder sb = new StringBuilder(basePackage);
sb.append('.');
sb.append(StringUtils.trimExtension(shortName));
sb.append(StringUtil.trimExtension(shortName));
return sb.toString();
}
@@ -64,7 +66,7 @@ public class ClassUtils {
return readFromFileDirectory(path);
}
private static List<String> readFromJarDirectory(String path,String packageName) {
private static List<String> readFromJarDirectory(String path, String packageName) {
JarFile jarFile = null;
try {
jarFile = new JarFile(path);
@@ -75,15 +77,15 @@ public class ClassUtils {
List<String> classNames = new ArrayList<>();
while (entrys.hasMoreElements()) {
JarEntry jarEntry = entrys.nextElement();
if(!jarEntry.getName().endsWith(".class"))continue;
if (!jarEntry.getName().endsWith(".class")) continue;
int packageNameIndex = jarEntry.getName().indexOf("/");
if("".equals(packageName)){
if ("".equals(packageName)) {
classNames.add(jarEntry.getName());
}else {
if(packageNameIndex == -1) continue;
} else {
if (packageNameIndex == -1) continue;
String baseName = jarEntry.getName().substring(0, packageNameIndex);
if (baseName.equals(packageName)) {
classNames.add(StringUtils.trimExtension(jarEntry.getName()).replaceAll("/","."));
classNames.add(StringUtil.trimExtension(jarEntry.getName()).replaceAll("/", "."));
}
}
}

View File

@@ -0,0 +1,83 @@
package cn.edu.scau.biubiusuisui.utils;
import cn.edu.scau.biubiusuisui.exception.ProtocolNotSupport;
import cn.edu.scau.biubiusuisui.log.FXPlusLoggerFactory;
import cn.edu.scau.biubiusuisui.log.IFXPlusLogger;
import java.io.*;
import java.net.URL;
/**
* @author jack
* @version 1.0
* @date 2019/6/25 7:01
* @since JavaFX2.0 JDK1.8
*/
public class FileUtil {
private static IFXPlusLogger logger = FXPlusLoggerFactory.getLogger(FileUtil.class);
/**
* @param filePath
* @return
* @throws ProtocolNotSupport
* @decription 从resources文件夹中读取File
* 输出如: file:/Users/suisui/workspace/Idea/JavaFX-Plus/target/classes/image/icon.png
* @version 1.0
*/
public URL getFilePathFromResources(String filePath) throws ProtocolNotSupport {
return FileUtil.class.getClassLoader().getResource(filePath);
}
/**
* @param filePath
* @return
* @description 读取resources文件夹下的file相对于resources的文件路径如 resources/config.conf 则只需 config.conf
*/
public static String readFileFromResources(String filePath) {
String path = StringUtil.getRootPath(FileUtil.class.getClassLoader().getResource(filePath));
return readFile(path);
}
/**
* @param filePath 绝对路径或相对路径
* @return
* @description 读取文件
*/
public static String readFile(String filePath) {
StringBuffer content = new StringBuffer();
try (FileReader reader = new FileReader(filePath);
BufferedReader br = new BufferedReader(reader) // 建立一个对象,它把文件内容转成计算机能读懂的语言
) {
String temp;
while ((temp = br.readLine()) != null) {
// 一次读入一行数据
content.append(temp + "\r\n");
}
} catch (IOException e) {
logger.error(e.getMessage());
e.printStackTrace();
}
return content.toString();
}
/**
* @param filePath
* @param content
* @description 写文件
*/
public static void writeFile(String filePath, String content) {
try {
File writeName = new File(filePath); // 相对路径如果没有则要建立一个新的output.txt文件
writeName.createNewFile(); // 创建新文件,有同名的文件的话直接覆盖
try (FileWriter writer = new FileWriter(writeName);
BufferedWriter out = new BufferedWriter(writer)
) {
out.write(content);
out.flush(); // 把缓存区内容压入文件
}
} catch (IOException e) {
logger.error(e.getMessage());
e.printStackTrace();
}
}
}

View File

@@ -1,17 +0,0 @@
package cn.edu.scau.biubiusuisui.utils;
import cn.edu.scau.biubiusuisui.exception.ProtocolNotSupport;
import java.net.URL;
/**
* @Author jack
* @Date:2019/6/25 7:01
*/
public class FileUtils {
public URL getFXMLFile(String fxmlFilePath) throws ProtocolNotSupport {
return this.getClass().getClassLoader().getResource(fxmlFilePath);
}
}

View File

@@ -0,0 +1,67 @@
package cn.edu.scau.biubiusuisui.utils;
import cn.edu.scau.biubiusuisui.log.FXPlusLogger;
import cn.edu.scau.biubiusuisui.log.IFXPlusLogger;
import org.apache.log4j.Logger;
/**
* @author suisui
* @version 1.2
* @description 日志工具类
* @date 2020/5/1 10:54
* @since JavaFX2.0 JDK1.8
*/
public class LogUtil {
private static final String FQCN = LogUtil.class.getName();
private static IFXPlusLogger logger;
static {
initLog4jBase();
logger = new FXPlusLogger(FQCN, Logger.getLogger(LogUtil.class));
}
public static void initLog4jBase() {
if (System.getProperty("log.base") == null) {
// 默认是当前目录下
String projectPath = PathUtil.getCurrentPath();
initLog4jBase(projectPath);
}
}
public static void initLog4jBase(String base) {
System.setProperty("log.base", base);
}
public static void debug(Object message) {
logger.debug(message);
}
public static void debug(Object message, Throwable t) {
logger.debug(message, t);
}
public static void info(Object message) {
logger.info(message);
}
public static void info(Object message, Throwable t) {
logger.debug(message, t);
}
public static void warn(Object message) {
logger.warn(message);
}
public static void warn(Object message, Throwable t) {
logger.warn(message, t);
}
public static void error(Object message) {
logger.error(message);
}
public static void error(Object message, Throwable t) {
logger.error(message, t);
}
}

View File

@@ -0,0 +1,14 @@
package cn.edu.scau.biubiusuisui.utils;
/**
* @author suisui
* @version 1.2
* @description 路径工具类
* @date 2020/5/2 14:43
* @since JDK1.8
*/
public class PathUtil {
public static String getCurrentPath() {
return System.getProperty("user.dir");
}
}

View File

@@ -0,0 +1,106 @@
package cn.edu.scau.biubiusuisui.utils;
import cn.edu.scau.biubiusuisui.entity.FXPlusLocale;
import cn.edu.scau.biubiusuisui.exception.ProtocolNotSupport;
import cn.edu.scau.biubiusuisui.log.FXPlusLoggerFactory;
import cn.edu.scau.biubiusuisui.log.IFXPlusLogger;
import java.io.File;
import java.util.Locale;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
/**
* @author suisui
* @version 1.2
* @description 语言国际化工具类
* @date 2020/5/1 11:15
* @since JavaFX2.0 JDK1.8
*/
public class ResourceBundleUtil {
private static final IFXPlusLogger logger = FXPlusLoggerFactory.getLogger(ResourceBundleUtil.class);
/**
* @param baseName
* @param fxPlusLocale
* @return
* @description 获取Java的ResourceBundle
*/
public static ResourceBundle getResourceBundle(String baseName, FXPlusLocale fxPlusLocale) {
baseName = StringUtil.trimExtension(baseName);
baseName = StringUtil.splashToDot(baseName);
Locale locale = ResourceBundleUtil.getLocale(fxPlusLocale);
// logger.info(baseName);
if (locale != null) {
return ResourceBundle.getBundle(baseName, locale);
}
return null;
}
/**
* @param fxPlusLocale
* @return
* @description 通过FXPlusLocale枚举类型获取Locale
*/
private static Locale getLocale(FXPlusLocale fxPlusLocale) {
switch (fxPlusLocale) {
case SIMPLIFIED_CHINESE:
return Locale.SIMPLIFIED_CHINESE;
case FRANCE:
return Locale.FRANCE;
case KOREAN:
return Locale.KOREAN;
case ENGLISH:
return Locale.UK;
case GERMANY:
return Locale.GERMANY;
case ITALIAN:
return Locale.ITALIAN;
case AMERICAN:
return Locale.US;
case JAPANESE:
return Locale.JAPAN;
case TRADITIONAL_CHINESE:
return Locale.TRADITIONAL_CHINESE;
default:
return null;
}
}
/**
* @param key
* @return
* @description 通过key获取String类型的value值失败或不存在返回空字符串
*/
public static String getStringValue(ResourceBundle resource, String key) {
if ("".equals(key) || null == key) {
return "";
}
try {
return resource.getString(key);
} catch (MissingResourceException | ClassCastException e) {
logger.error(e.getMessage());
// e.printStackTrace();
return "";
}
}
/**
* @param key
* @return
* @description 通过key获取Integer类型的value值失败或不存在返回-1
*/
public static Integer getIntegerValue(ResourceBundle resource, String key) {
if ("".equals(key) || null == key) {
return -1;
}
try {
return Integer.valueOf(resource.getString(key));
} catch (MissingResourceException | NumberFormatException e) {
logger.error(e.getMessage());
// e.printStackTrace();
return -1;
}
}
}

View File

@@ -1,19 +1,21 @@
package cn.edu.scau.biubiusuisui.utils;
/**
* @Author jack
* @Date:2019/6/25 3:46
*/
import cn.edu.scau.biubiusuisui.exception.InvalidURLException;
import cn.edu.scau.biubiusuisui.log.FXPlusLoggerFactory;
import cn.edu.scau.biubiusuisui.log.IFXPlusLogger;
import java.net.URL;
import java.util.HashMap;
import java.util.Map;
public class StringUtils {
/**
* @author jack
* @author suisui
* @version 1.0
* @date 2019/6/25 3:46
* @since JavaFX2.0 JDK1.8
*/
public class StringUtil {
private static IFXPlusLogger logger = FXPlusLoggerFactory.getLogger(StringUtil.class);
private StringUtils() {
private StringUtil() {
}
@@ -42,11 +44,22 @@ public class StringUtils {
return name.replaceAll("\\.", "/");
}
/**
* "cn/fh/lightning" -> "cn.fh.lightning"
*
* @param name
* @return
*/
public static String splashToDot(String name) {
return name.replaceAll("/", "\\.");
}
/**
* "Apple.class" -> "Apple"
*/
public static String trimExtension(String name) {
int pos = name.indexOf('.');
int pos = name.lastIndexOf('.');
if (-1 != pos) {
return name.substring(0, pos);
}
@@ -67,12 +80,18 @@ public class StringUtils {
return trimmed.substring(splashIndex);
}
/**
* MainController$receive -> MainController
*
* @param name
* @return
*/
public static String getBaseClassName(String name) {
int index = name.indexOf("$");
if (index == -1) {
return name;
}
// System.out.println(name.substring(0,index));
// System.out.println(name.substring(0, index));
return name.substring(0, index);
}
@@ -99,4 +118,38 @@ public class StringUtils {
return result;
}
/**
* cn/edu/scau/biubiusuisui/resources/fxml/languageDemo/languageDemo.fxml -> fxml/languageDemo/languageDemo.fxml
*
* @param name
* @return
* @description 获取相对于resources目录下的路径
*/
public static String getFilePathInResources(String name) {
String resources = "resources";
int resIdx = name.indexOf(resources);
if (resIdx == -1) {
return name;
}
return name.substring(resIdx + resources.length() + 1);
}
/**
* cn/edu/scau/biubiusuisui/resources/fxml/languageDemo/languageDemo.fxml -> languageDemo
*
* @param name 文件名
* @return
* @version 1.2
*/
public static String getFileBaseName(String name) {
String result = "";
String[] tempStrs = name.split("/");
if (1 == tempStrs.length) { //只有文件名即name: languageDemo.fxml
result = StringUtil.trimExtension(name);
} else {
result = StringUtil.trimExtension(tempStrs[tempStrs.length - 1]);
}
return result;
}
}

View File

@@ -0,0 +1,6 @@
_ ________ __ _____ _
| | | ____\ \ / / | __ \| |
| | __ ___ ____ _| |__ \ V / _____ | |__) | |_ _ ___
_ | |/ _` \ \ / / _` | __| > < _____ | ___/| | | | / __|
| |__| | (_| |\ V / (_| | | / . \ | | | | |_| \__ \
\____/ \__,_| \_/ \__,_|_| /_/ \_\ |_| |_|\__,_|___/

View File

@@ -1,138 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.PasswordField?>
<?import javafx.scene.control.RadioButton?>
<?import javafx.scene.control.Tab?>
<?import javafx.scene.control.TabPane?>
<?import javafx.scene.control.TextField?>
<?import javafx.scene.control.ToggleGroup?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.Pane?>
<?import javafx.scene.layout.VBox?>
<?import javafx.scene.text.Font?>
<?import javafx.scene.text.Text?>
<fx:root prefHeight="600.0" prefWidth="800.0" type="Pane" xmlns="http://javafx.com/javafx/8.0.171" xmlns:fx="http://javafx.com/fxml/1" fx:controller="cn.edu.scau.biubiusuisui.example.bindDemo.MainController">
<children>
<TabPane prefHeight="600.0" prefWidth="800.0">
<tabs>
<Tab text="View&amp;View">
<content>
<Pane prefHeight="200.0" prefWidth="200.0">
<children>
<TextField fx:id="inputTF" layoutX="250.0" layoutY="105.0" promptText="请输入" />
<Text layoutX="204.0" layoutY="123.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Name: " />
<Label fx:id="inputLabel" layoutX="457.0" layoutY="109.0" prefHeight="150.0" prefWidth="289.0" wrapText="true">
<font>
<Font size="16.0" />
</font>
</Label>
</children>
</Pane>
</content>
</Tab>
<Tab text="VIew&amp;Bean">
<content>
<Pane prefHeight="200.0" prefWidth="200.0">
<children>
<VBox layoutX="47.0" layoutY="154.0" prefHeight="229.0" prefWidth="353.0">
<children>
<HBox alignment="CENTER" prefHeight="60.0" prefWidth="800.0">
<children>
<Label prefWidth="40.0" text="用户名"/>
<TextField fx:id="usernameTF"/>
</children>
</HBox>
<HBox alignment="CENTER" prefHeight="60.0" prefWidth="800.0">
<children>
<Label prefWidth="40.0" text="密码"/>
<PasswordField fx:id="pswPF"/>
</children>
</HBox>
<HBox alignment="CENTER" prefHeight="60.0" prefWidth="800.0">
<children>
<Label prefWidth="40.0" text="年龄"/>
<TextField fx:id="ageTF"/>
</children>
</HBox>
<HBox alignment="CENTER" prefHeight="60.0" prefWidth="353.0" spacing="20.0">
<children>
<Label prefHeight="40.0" text="是否有效"/>
<RadioButton mnemonicParsing="false" text="是">
<toggleGroup>
<ToggleGroup fx:id="enableButtons"/>
</toggleGroup>
</RadioButton>
<RadioButton mnemonicParsing="false" text="否" toggleGroup="$enableButtons"/>
</children>
</HBox>
</children>
</VBox>
<VBox layoutX="381.0" layoutY="124.0" prefHeight="203.0" prefWidth="353.0" spacing="5.0">
<children>
<Label alignment="CENTER" prefHeight="26.0" prefWidth="359.0" text="输入的用户信息"
textAlignment="CENTER">
<font>
<Font size="20.0"/>
</font>
</Label>
<HBox alignment="CENTER_LEFT" prefHeight="60.0" prefWidth="800.0">
<children>
<Label prefWidth="60.0" text="用户名:"/>
<Label fx:id="usernameLabel"/>
</children>
</HBox>
<HBox alignment="CENTER_LEFT" prefHeight="60.0" prefWidth="800.0">
<children>
<Label prefWidth="60.0" text="密码:"/>
<Label fx:id="userPswLabel"/>
</children>
</HBox>
<HBox alignment="CENTER_LEFT" prefHeight="60.0" prefWidth="800.0">
<children>
<Label prefWidth="60.0" text="年龄:"/>
<Label fx:id="ageLabel"/>
</children>
</HBox>
<HBox alignment="CENTER_LEFT" prefHeight="60.0" prefWidth="800.0">
<children>
<Label fx:id="enableLabel" prefWidth="60.0" text="是否有效:"/>
<Label fx:id="userPswLabel2"/>
</children>
</HBox>
<HBox alignment="CENTER" prefHeight="100.0" prefWidth="200.0">
<children>
<Button mnemonicParsing="false" onAction="#clickToShowInfo" text="点击显示"/>
</children>
</HBox>
</children>
</VBox>
</children></Pane>
</content>
</Tab>
<Tab text="Expression2View">
<content>
<AnchorPane>
<children>
<Pane layoutX="128.0" layoutY="118.0">
<children>
<TextField fx:id="money" layoutX="54.0" layoutY="29.0" prefHeight="28.0" prefWidth="330.0" />
<Label fx:id="us" layoutX="108.0" layoutY="75.0" prefHeight="24.0" prefWidth="330.0" text="US:" />
<Label fx:id="jp" layoutX="108.0" layoutY="107.0" prefHeight="24.0" prefWidth="330.0" text="JP:" />
<Label fx:id="uk" layoutX="108.0" layoutY="142.0" prefHeight="24.0" prefWidth="330.0" text="UK:" />
<Label layoutX="67.0" layoutY="77.0" text="US" />
<Label layoutX="69.0" layoutY="109.0" text="JP" />
<Label layoutX="66.0" layoutY="144.0" text="UK" />
</children>
</Pane>
</children>
</AnchorPane>
</content>
</Tab>
</tabs>
</TabPane>
</children>
</fx:root>

View File

@@ -0,0 +1,149 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.PasswordField?>
<?import javafx.scene.control.RadioButton?>
<?import javafx.scene.control.Tab?>
<?import javafx.scene.control.TabPane?>
<?import javafx.scene.control.TextField?>
<?import javafx.scene.control.ToggleGroup?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.Pane?>
<?import javafx.scene.layout.VBox?>
<?import javafx.scene.text.Font?>
<?import javafx.scene.text.Text?>
<fx:root prefHeight="600.0" prefWidth="800.0" type="Pane" xmlns="http://javafx.com/javafx/8.0.171"
xmlns:fx="http://javafx.com/fxml/1" fx:controller="cn.edu.scau.biubiusuisui.example.bindDemo.MainController">
<children>
<TabPane prefHeight="600.0" prefWidth="800.0">
<tabs>
<Tab text="View&amp;View">
<content>
<Pane prefHeight="200.0" prefWidth="200.0">
<children>
<TextField fx:id="inputTF" layoutX="250.0" layoutY="105.0" promptText="请输入"/>
<Text layoutX="204.0" layoutY="123.0" strokeType="OUTSIDE" strokeWidth="0.0"
text="Name: "/>
<Label fx:id="inputLabel" layoutX="457.0" layoutY="109.0" prefHeight="150.0"
prefWidth="289.0" wrapText="true">
<font>
<Font size="16.0"/>
</font>
</Label>
</children>
</Pane>
</content>
</Tab>
<Tab text="VIew&amp;Bean">
<content>
<Pane prefHeight="200.0" prefWidth="200.0">
<children>
<VBox layoutX="47.0" layoutY="154.0" prefHeight="229.0" prefWidth="353.0">
<children>
<HBox alignment="CENTER" prefHeight="60.0" prefWidth="800.0">
<children>
<Label prefWidth="40.0" text="用户名"/>
<TextField fx:id="usernameTF"/>
</children>
</HBox>
<HBox alignment="CENTER" prefHeight="60.0" prefWidth="800.0">
<children>
<Label prefWidth="40.0" text="密码"/>
<PasswordField fx:id="pswPF"/>
</children>
</HBox>
<HBox alignment="CENTER" prefHeight="60.0" prefWidth="800.0">
<children>
<Label prefWidth="40.0" text="年龄"/>
<TextField fx:id="ageTF"/>
</children>
</HBox>
<HBox alignment="CENTER" prefHeight="60.0" prefWidth="353.0" spacing="20.0">
<children>
<Label prefHeight="40.0" text="是否有效"/>
<RadioButton mnemonicParsing="false" text="是">
<toggleGroup>
<ToggleGroup fx:id="enableButtons"/>
</toggleGroup>
</RadioButton>
<RadioButton mnemonicParsing="false" text="否"
toggleGroup="$enableButtons"/>
</children>
</HBox>
</children>
</VBox>
<VBox layoutX="381.0" layoutY="124.0" prefHeight="203.0" prefWidth="353.0"
spacing="5.0">
<children>
<Label alignment="CENTER" prefHeight="26.0" prefWidth="359.0" text="输入的用户信息"
textAlignment="CENTER">
<font>
<Font size="20.0"/>
</font>
</Label>
<HBox alignment="CENTER_LEFT" prefHeight="60.0" prefWidth="800.0">
<children>
<Label prefWidth="60.0" text="用户名:"/>
<Label fx:id="usernameLabel"/>
</children>
</HBox>
<HBox alignment="CENTER_LEFT" prefHeight="60.0" prefWidth="800.0">
<children>
<Label prefWidth="60.0" text="密码:"/>
<Label fx:id="userPswLabel"/>
</children>
</HBox>
<HBox alignment="CENTER_LEFT" prefHeight="60.0" prefWidth="800.0">
<children>
<Label prefWidth="60.0" text="年龄:"/>
<Label fx:id="ageLabel"/>
</children>
</HBox>
<HBox alignment="CENTER_LEFT" prefHeight="60.0" prefWidth="800.0">
<children>
<Label fx:id="enableLabel" prefWidth="60.0" text="是否有效:"/>
<Label fx:id="userPswLabel2"/>
</children>
</HBox>
<HBox alignment="CENTER" prefHeight="100.0" prefWidth="200.0">
<children>
<Button mnemonicParsing="false" onAction="#clickToShowInfo"
text="点击显示"/>
</children>
</HBox>
</children>
</VBox>
</children>
</Pane>
</content>
</Tab>
<Tab text="Expression2View">
<content>
<AnchorPane>
<children>
<Pane layoutX="128.0" layoutY="118.0">
<children>
<TextField fx:id="money" layoutX="54.0" layoutY="29.0" prefHeight="28.0"
prefWidth="330.0"/>
<Label fx:id="us" layoutX="108.0" layoutY="75.0" prefHeight="24.0"
prefWidth="330.0" text="US:"/>
<Label fx:id="jp" layoutX="108.0" layoutY="107.0" prefHeight="24.0"
prefWidth="330.0" text="JP:"/>
<Label fx:id="uk" layoutX="108.0" layoutY="142.0" prefHeight="24.0"
prefWidth="330.0" text="UK:"/>
<Label layoutX="67.0" layoutY="77.0" text="US"/>
<Label layoutX="69.0" layoutY="109.0" text="JP"/>
<Label layoutX="66.0" layoutY="144.0" text="UK"/>
</children>
</Pane>
</children>
</AnchorPane>
</content>
</Tab>
</tabs>
</TabPane>
</children>
</fx:root>

View File

@@ -0,0 +1,66 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.TextField?>
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.Pane?>
<?import javafx.scene.layout.VBox?>
<?import javafx.scene.text.Font?>
<?import javafx.scene.text.Text?>
<fx:root maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0"
prefWidth="600.0" type="Pane" xmlns="http://javafx.com/javafx/8.0.171" xmlns:fx="http://javafx.com/fxml/1">
<children>
<VBox prefHeight="400.0" prefWidth="600.0">
<children>
<HBox alignment="CENTER" prefHeight="50.0" prefWidth="200.0" spacing="10.0">
<children>
<Text strokeType="OUTSIDE" strokeWidth="0.0" text="%register">
<font>
<Font size="27.0"/>
</font>
</Text>
</children>
</HBox>
<HBox alignment="CENTER" prefHeight="50.0" prefWidth="200.0" spacing="10.0">
<children>
<Text strokeType="OUTSIDE" strokeWidth="0.0" text="%register.username"/>
<TextField/>
</children>
</HBox>
<HBox alignment="CENTER" prefHeight="50.0" prefWidth="200.0" spacing="10.0">
<children>
<Text strokeType="OUTSIDE" strokeWidth="0.0" text="%register.password"/>
<TextField/>
</children>
</HBox>
<HBox alignment="CENTER" prefHeight="50.0" prefWidth="200.0" spacing="10.0">
<children>
<Text strokeType="OUTSIDE" strokeWidth="0.0" text="%register.confirmPassword"/>
<TextField/>
</children>
</HBox>
<HBox alignment="CENTER" prefHeight="50.0" prefWidth="200.0" spacing="10.0">
<children>
<Text strokeType="OUTSIDE" strokeWidth="0.0" text="%register.email"/>
<TextField/>
</children>
</HBox>
<HBox alignment="CENTER" prefHeight="50.0" prefWidth="200.0" spacing="10.0">
<children>
<Text strokeType="OUTSIDE" strokeWidth="0.0" text="%register.phone"/>
<TextField/>
</children>
</HBox>
<HBox alignment="CENTER" prefHeight="50.0" prefWidth="200.0" spacing="10.0">
<children>
<Button mnemonicParsing="false" text="%register"/>
<Button mnemonicParsing="false" onAction="#clickToChinese" text="%chinese"/>
<Button mnemonicParsing="false" onAction="#clickToEnglish" text="%english"/>
<Button mnemonicParsing="false" onAction="#clickToKorean" text="%korean"/>
</children>
</HBox>
</children>
</VBox>
</children>
</fx:root>

View File

@@ -0,0 +1,16 @@
login=login
login.username=Username
login.password=Password
login.button=Login
register=Register
register.username=Username
register.password=password
register.confirmPassword=Confirm Password
register.phone=Phone
register.email=Email
password=Password
email=Email
phone=Phone
korean=\ud55c\uad6d\uc5b4
chinese=\u4e2d\u6587
english=English

View File

@@ -0,0 +1,32 @@
login=\ub85c\uadf8\uc778
login.username=\uc544\uc774\ub514
login.password=\ube44\ubc00\ubc88\ud638
login.button=\ub85c\uadf8\uc778
register=\uac00\uc785
register.username=\uc544\uc774\ub514
register.password=\ube44\ubc00\ubc88\ud638
register.confirmPassword=\ube44\ubc00\ubc88\ud638 \ud655\uc778
register.phone=\ud734\ub300 \uc804\ud654
register.email=\uc6b0\ud3b8\ud568
password=\ube44\ubc00\ubc88\ud638
email=\uc6b0\ud3b8\ud568
phone=\ud734\ub300 \uc804\ud654
korean=\ud55c\uad6d\uc5b4
chinese=\u4e2d\u6587
english=English
#login=로그인
#login.username=아이디
#login.password=비밀번호
#login.button=로그인
#register=가입
#register.username=아이디
#register.password=비밀번호
#register.confirmPassword=비밀번호 확인
#register.phone=휴대 전화
#register.email=우편함
#password=비밀번호
#email=우편함
#phone=휴대 전화
#korean=한국어
#chinese=中文
#english=English

View File

@@ -0,0 +1,16 @@
login=\u767b\u5f55
login.username=\u7528\u6237\u540d
login.password=\u5bc6\u7801
login.button=\u70b9\u51fb\u767b\u5f55
register=\u6ce8\u518c
register.username=\u7528\u6237\u540d
register.password=\u5bc6\u7801
register.confirmPassword=\u786e\u8ba4\u5bc6\u7801
register.email=\u90ae\u7bb1
register.phone=\u624b\u673a
password=\u5bc6\u7801
email=\u90ae\u7bb1
phone=\u624b\u673a
korean=\ud55c\uad6d\uc5b4
chinese=\u4e2d\u6587
english=English

View File

@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.layout.Pane?>
<?import javafx.scene.text.Font?>
<?import javafx.scene.text.Text?>
<fx:root maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0"
prefWidth="400.0" type="Pane" xmlns="http://javafx.com/javafx/8.0.171" xmlns:fx="http://javafx.com/fxml/1">
<children>
<Text layoutX="165.0" layoutY="192.0" strokeType="OUTSIDE" strokeWidth="0.0" text="%dialog">
<font>
<Font size="35.0"/>
</font>
</Text>
</children>
</fx:root>

View File

@@ -0,0 +1 @@
dialog=Dialog

View File

@@ -0,0 +1 @@
dialog=弹窗

View File

@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import cn.edu.scau.biubiusuisui.example.lifeDemo.*?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<?import javafx.scene.text.*?>
<fx:root maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0"
prefWidth="600.0" style="-fx-background-color: #905a3d;" type="Pane"
xmlns="http://javafx.com/javafx/10.0.2-internal" xmlns:fx="http://javafx.com/fxml/1"
fx:controller="cn.edu.scau.biubiusuisui.example.lifeDemo.MainController">
<children>
<SubController/>
<Text layoutY="221.0" strokeType="OUTSIDE" strokeWidth="0.0" text="%parentController" textAlignment="CENTER"
wrappingWidth="600.0">
<font>
<Font size="34.0"/>
</font>
</Text>
<Button layoutX="147.0" layoutY="338.0" mnemonicParsing="false" onAction="#go" prefHeight="29.0"
prefWidth="142.0" text="%button.go">
<font>
<Font size="15.0"/>
</font>
</Button>
<Button layoutX="318.0" layoutY="338.0" mnemonicParsing="false" onAction="#goAndClose"
text="%button.goAndClose">
<font>
<Font size="15.0"/>
</font>
</Button>
</children>
</fx:root>

Some files were not shown because too many files have changed in this diff Show More