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

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