Compare commits
45 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f6189b1bf9 | ||
|
|
d139cbe3c5 | ||
|
|
5b7131febf | ||
|
|
a82844cf35 | ||
|
|
b48325cd63 | ||
|
|
7c807d4b39 | ||
|
|
119436dc3b | ||
|
|
5e60991bda | ||
|
|
5f9150b0f6 | ||
|
|
9a04efd84f | ||
|
|
d23cda4f47 | ||
|
|
54dc098123 | ||
|
|
3147d9f9b7 | ||
|
|
4e968bcd08 | ||
|
|
9a542c6caa | ||
|
|
1eb81ed37e | ||
|
|
3c3c556a19 | ||
|
|
6d5f97767d | ||
|
|
8c264a6100 | ||
|
|
c0684c7501 | ||
|
|
5cc7e57a88 | ||
|
|
2596af27ed | ||
|
|
4c1cc13601 | ||
|
|
f731b73207 | ||
|
|
c74ea3039f | ||
|
|
bc421b87b9 | ||
|
|
dcf02d6565 | ||
|
|
986f43ad6d | ||
|
|
cacb8b154b | ||
|
|
7b5e56d6f7 | ||
|
|
48889c54a9 | ||
|
|
f715cced3d | ||
|
|
fcf17ac57f | ||
|
|
34ae7db92f | ||
|
|
6fcd94e94b | ||
|
|
7ce75c9206 | ||
|
|
deb5e7f3e8 | ||
|
|
bb53425b43 | ||
|
|
573f3e1c70 | ||
|
|
40b81fa8d8 | ||
|
|
5cd92e9e8f | ||
|
|
efd34fb512 | ||
|
|
059c5c8193 | ||
|
|
953c6b16ad | ||
|
|
a50ec834d1 |
1
.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
.idea
|
||||
12
.idea/artifacts/JavaFx_Plus_jar.xml
generated
@@ -1,12 +0,0 @@
|
||||
<component name="ArtifactManager">
|
||||
<artifact type="jar" name="JavaFx-Plus:jar">
|
||||
<output-path>$PROJECT_DIR$/out/artifacts/JavaFx_Plus_jar</output-path>
|
||||
<root id="archive" name="JavaFx-Plus.jar">
|
||||
<element id="module-output" name="JavaFx-Plus" />
|
||||
<element id="extracted-dir" path="$MAVEN_REPOSITORY$/cglib/cglib/3.1/cglib-3.1.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$MAVEN_REPOSITORY$/org/ow2/asm/asm/4.2/asm-4.2.jar" path-in-jar="/" />
|
||||
<element id="library" level="project" name="Maven: cglib:cglib:3.1" />
|
||||
<element id="library" level="project" name="Maven: org.ow2.asm:asm:4.2" />
|
||||
</root>
|
||||
</artifact>
|
||||
</component>
|
||||
16
.idea/compiler.xml
generated
@@ -1,16 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="CompilerConfiguration">
|
||||
<annotationProcessing>
|
||||
<profile name="Maven default annotation processors profile" enabled="true">
|
||||
<sourceOutputDir name="target/generated-sources/annotations" />
|
||||
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
|
||||
<outputRelativeToContentRoot value="true" />
|
||||
<module name="JavaFx-Plus" />
|
||||
</profile>
|
||||
</annotationProcessing>
|
||||
<bytecodeTargetLevel>
|
||||
<module name="JavaFx-Plus" target="1.8" />
|
||||
</bytecodeTargetLevel>
|
||||
</component>
|
||||
</project>
|
||||
13
.idea/libraries/Maven__cglib_cglib_3_1.xml
generated
@@ -1,13 +0,0 @@
|
||||
<component name="libraryTable">
|
||||
<library name="Maven: cglib:cglib:3.1">
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/cglib/cglib/3.1/cglib-3.1.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/cglib/cglib/3.1/cglib-3.1-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/cglib/cglib/3.1/cglib-3.1-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
||||
13
.idea/libraries/Maven__junit_junit_4_11.xml
generated
@@ -1,13 +0,0 @@
|
||||
<component name="libraryTable">
|
||||
<library name="Maven: junit:junit:4.11">
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/junit/junit/4.11/junit-4.11.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/junit/junit/4.11/junit-4.11-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/junit/junit/4.11/junit-4.11-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
||||
@@ -1,13 +0,0 @@
|
||||
<component name="libraryTable">
|
||||
<library name="Maven: org.hamcrest:hamcrest-core:1.3">
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
||||
13
.idea/libraries/Maven__org_ow2_asm_asm_4_2.xml
generated
@@ -1,13 +0,0 @@
|
||||
<component name="libraryTable">
|
||||
<library name="Maven: org.ow2.asm:asm:4.2">
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/ow2/asm/asm/4.2/asm-4.2.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/ow2/asm/asm/4.2/asm-4.2-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/ow2/asm/asm/4.2/asm-4.2-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
||||
13
.idea/misc.xml
generated
@@ -1,13 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="MavenProjectsManager">
|
||||
<option name="originalFiles">
|
||||
<list>
|
||||
<option value="$PROJECT_DIR$/pom.xml" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
</project>
|
||||
8
.idea/modules.xml
generated
@@ -1,8 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/JavaFx-Plus.iml" filepath="$PROJECT_DIR$/JavaFx-Plus.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
||||
124
.idea/uiDesigner.xml
generated
@@ -1,124 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Palette2">
|
||||
<group name="Swing">
|
||||
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
|
||||
</item>
|
||||
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.png" removable="false" auto-create-binding="false" can-attach-label="true">
|
||||
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
|
||||
<initial-values>
|
||||
<property name="text" value="Button" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="RadioButton" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="CheckBox" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="Label" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||
<preferred-size width="200" height="200" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||
<preferred-size width="200" height="200" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
|
||||
<preferred-size width="-1" height="20" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
|
||||
</item>
|
||||
</group>
|
||||
</component>
|
||||
</project>
|
||||
1409
.idea/workspace.xml
generated
@@ -1,19 +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="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>
|
||||
21
LICENSE
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2019 Biubiu
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
1325
README.en.md
|
After Width: | Height: | Size: 159 KiB |
|
After Width: | Height: | Size: 147 KiB |
BIN
README.en/JavaFX-Plus.png
Normal file
|
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 |
BIN
README.en/actionDemo/20191210-175409-actionDemo.gif
Normal file
|
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 |
BIN
README.en/mqDemo/20191208-194336-signalshow.gif
Normal file
|
After Width: | Height: | Size: 15 MiB |
BIN
README.en/redirectDemo/20191208-125511-not_close.gif
Normal file
|
After Width: | Height: | Size: 5.9 MiB |
BIN
README.en/redirectDemo/20191208-125739-close.gif
Normal file
|
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
162
pom.xml
@@ -3,19 +3,42 @@
|
||||
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>
|
||||
<name>javafx-plus</name>
|
||||
|
||||
<groupId>groupId</groupId>
|
||||
<artifactId>JavaFx-Plus</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<groupId>com.gitee.Biubiuyuyu</groupId>
|
||||
<artifactId>javafx-plus</artifactId>
|
||||
<version>1.2.0-RELEASE</version>
|
||||
<!-- packaging为pom时,不会加载resources 故注释-->
|
||||
<!-- <packaging>pom</packaging>-->
|
||||
|
||||
<parent>
|
||||
<groupId>org.sonatype.oss</groupId>
|
||||
<artifactId>oss-parent</artifactId>
|
||||
<version>7</version>
|
||||
</parent>
|
||||
|
||||
<description>this is javafx framework that simplified coding</description>
|
||||
|
||||
<distributionManagement>
|
||||
<repository>
|
||||
<id>javafx-plus</id>
|
||||
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
|
||||
</repository>
|
||||
<snapshotRepository>
|
||||
<id>javafx-plus</id>
|
||||
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
|
||||
</snapshotRepository>
|
||||
</distributionManagement>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<!-- 第三方动态代理库 -->
|
||||
<dependency>
|
||||
<groupId>cglib</groupId>
|
||||
<artifactId>cglib</artifactId>
|
||||
<version>3.1</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Junit单元测试 -->
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
@@ -23,20 +46,147 @@
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!-- log4j 日志 -->
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-log4j12</artifactId>
|
||||
<version>1.7.21</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.tomcat.embed</groupId>
|
||||
<artifactId>tomcat-embed-core</artifactId>
|
||||
<version>9.0.29</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<!--配置Maven 对resource文件 过滤 -->
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src/main/resources</directory>
|
||||
</resource>
|
||||
<resource>
|
||||
<directory>src/main/java</directory>
|
||||
<includes>
|
||||
<include>**/*.properties</include>
|
||||
<include>**/*.xml</include>
|
||||
<include>**/*.fxml</include>
|
||||
</includes>
|
||||
<filtering>true</filtering>
|
||||
</resource>
|
||||
</resources>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.6.1</version>
|
||||
<configuration>
|
||||
<source>1.8</source>
|
||||
<target>1.8</target>
|
||||
<encoding>UTF-8</encoding>
|
||||
<compilerArgs>
|
||||
<!-- 过期的方法的警告-->
|
||||
<arg>-Xlint:deprecation</arg>
|
||||
</compilerArgs>
|
||||
<compilerArguments>
|
||||
<!-- 是否输出所有的编译信息(包括类的加载等)-->
|
||||
<!--<verbose />-->
|
||||
<!-- 解决maven命令编译报错,因为rt.jar 和jce.jar在jre的lib下面,不在jdk的lib下面,
|
||||
导致maven找不到(java7以后会出现这个问题),将这2个jar包拷贝到jdk的lib下面估计也好使-->
|
||||
<bootclasspath>${java.home}/lib/rt.jar:${java.home}/lib/jce.jar</bootclasspath>
|
||||
</compilerArguments>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-assembly-plugin</artifactId>
|
||||
<configuration>
|
||||
<descriptorRefs>
|
||||
<descriptorRef>jar-with-dependencies</descriptorRef>
|
||||
</descriptorRefs>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>release</id>
|
||||
<build>
|
||||
<plugins>
|
||||
<!-- Source -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-source-plugin</artifactId>
|
||||
<version>2.2.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>jar-no-fork</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<!-- Javadoc -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
<version>2.9.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>jar</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<additionalparam>-Xdoclint:none</additionalparam>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<!-- GPG -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-gpg-plugin</artifactId>
|
||||
<version>1.5</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>sign-artifacts</id>
|
||||
<phase>verify</phase>
|
||||
<goals>
|
||||
<goal>sign</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
</profiles>
|
||||
|
||||
<licenses>
|
||||
<license>
|
||||
<name>GNU Lesser General Public License Version 3</name>
|
||||
<url>http://www.gnu.org/licenses/lgpl.txt</url>
|
||||
<distribution>repo</distribution>
|
||||
</license>
|
||||
</licenses>
|
||||
<scm>
|
||||
<tag>master</tag>
|
||||
<url>https://gitee.com/Biubiuyuyu/JavaFX-Plus.git</url>
|
||||
<connection>scm:git:https://gitee.com/Biubiuyuyu/JavaFX-Plus.git</connection>
|
||||
<developerConnection>scm:git:https://gitee.com/Biubiuyuyu/JavaFX-Plus.git</developerConnection>
|
||||
</scm>
|
||||
<developers>
|
||||
<developer>
|
||||
<name>Zhu zhanbiao</name>
|
||||
<email>747441355@qq.com</email>
|
||||
<organization>cn.edu.scau</organization>
|
||||
</developer>
|
||||
|
||||
<developer>
|
||||
<name>Yang suiyu</name>
|
||||
<email>498870048@qq.com</email>
|
||||
<organization>cn.edu.scau</organization>
|
||||
</developer>
|
||||
</developers>
|
||||
</project>
|
||||
@@ -0,0 +1,14 @@
|
||||
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();
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
package cn.edu.scau.biubiusuisui.annotation;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
/**
|
||||
* @author jack
|
||||
* @version 1.0
|
||||
* @date 2019/6/25 1:36
|
||||
* @since JavaFX2.0 JDK1.8
|
||||
*/
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(ElementType.FIELD)
|
||||
@Inherited
|
||||
public @interface FXData {
|
||||
String fx_id() default "";
|
||||
}
|
||||
@@ -1,15 +1,15 @@
|
||||
package cn.edu.scau.biubiusuisui.annotation;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
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)
|
||||
@Inherited
|
||||
public @interface FXEntity {
|
||||
}
|
||||
|
||||
@@ -6,15 +6,21 @@ 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)
|
||||
public @interface FXField {
|
||||
boolean readOnly() default false;
|
||||
|
||||
String setter() default "";
|
||||
|
||||
String add() default "";
|
||||
|
||||
String delete() default "";
|
||||
|
||||
String edit() default "";
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
package cn.edu.scau.biubiusuisui.annotation;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
/**
|
||||
* @author suisui
|
||||
* @version 1.1
|
||||
* @description 重定向的注解
|
||||
* @date 2019/12/3 12:53
|
||||
* @since JavaFX2.0 JDK1.8
|
||||
*/
|
||||
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(ElementType.METHOD)
|
||||
@Inherited
|
||||
public @interface FXRedirect {
|
||||
boolean close() default true;
|
||||
}
|
||||
@@ -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)
|
||||
|
||||
@@ -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 "";
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
package cn.edu.scau.biubiusuisui.annotation;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
/**
|
||||
* @author jack
|
||||
* @version 1.0
|
||||
* @date 2019/7/27 3:06
|
||||
* @since JavaFX2.0 JDK1.8
|
||||
*/
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(ElementType.PARAMETER)
|
||||
@Inherited
|
||||
public @interface FXValue {
|
||||
String value();
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
package cn.edu.scau.biubiusuisui.annotation;
|
||||
|
||||
/**
|
||||
* @Author jack
|
||||
* @Date:2019/6/25 1:36
|
||||
*/
|
||||
public @interface FXView {
|
||||
|
||||
}
|
||||
@@ -1,16 +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;
|
||||
String title () ;
|
||||
|
||||
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();
|
||||
|
||||
/**
|
||||
* @description 图标URL
|
||||
* @version 1.2
|
||||
*/
|
||||
String icon() default "";
|
||||
|
||||
}
|
||||
|
||||
@@ -1,60 +1,17 @@
|
||||
package cn.edu.scau.biubiusuisui.config;
|
||||
|
||||
import javafx.fxml.*;
|
||||
|
||||
/*
|
||||
* Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
import cn.edu.scau.biubiusuisui.entity.FXBaseController;
|
||||
import cn.edu.scau.biubiusuisui.expression.data.MyBeanAdapter;
|
||||
import cn.edu.scau.biubiusuisui.expression.data.MyExpressionValue;
|
||||
import cn.edu.scau.biubiusuisui.factory.FXControllerFactory;
|
||||
import com.sun.javafx.beans.IDProperty;
|
||||
import com.sun.javafx.fxml.BeanAdapter;
|
||||
import com.sun.javafx.fxml.LoadListener;
|
||||
import com.sun.javafx.fxml.ParseTraceElement;
|
||||
import com.sun.javafx.fxml.PropertyNotFoundException;
|
||||
import com.sun.javafx.fxml.expression.Expression;
|
||||
import com.sun.javafx.fxml.expression.KeyPath;
|
||||
import com.sun.javafx.util.Logging;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.lang.reflect.Array;
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.lang.reflect.ParameterizedType;
|
||||
import java.lang.reflect.Type;
|
||||
import java.net.URL;
|
||||
import java.nio.charset.Charset;
|
||||
import java.security.AllPermission;
|
||||
import java.util.AbstractMap;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.ResourceBundle;
|
||||
import java.util.Set;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import javafx.beans.DefaultProperty;
|
||||
import javafx.beans.InvalidationListener;
|
||||
import javafx.beans.property.Property;
|
||||
@@ -63,45 +20,50 @@ import javafx.beans.value.ObservableValue;
|
||||
import javafx.collections.*;
|
||||
import javafx.event.Event;
|
||||
import javafx.event.EventHandler;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.fxml.JavaFXBuilderFactory;
|
||||
import javafx.fxml.LoadException;
|
||||
import javafx.util.Builder;
|
||||
import javafx.util.BuilderFactory;
|
||||
import javafx.util.Callback;
|
||||
|
||||
import javax.script.Bindings;
|
||||
import javax.script.ScriptContext;
|
||||
import javax.script.ScriptEngine;
|
||||
import javax.script.ScriptEngineManager;
|
||||
import javax.script.ScriptException;
|
||||
import javax.script.SimpleBindings;
|
||||
import javax.xml.stream.XMLInputFactory;
|
||||
import javax.xml.stream.XMLStreamConstants;
|
||||
import javax.xml.stream.XMLStreamException;
|
||||
import javax.xml.stream.XMLStreamReader;
|
||||
import javax.xml.stream.util.StreamReaderDelegate;
|
||||
|
||||
import com.sun.javafx.beans.IDProperty;
|
||||
import com.sun.javafx.fxml.BeanAdapter;
|
||||
import com.sun.javafx.fxml.LoadListener;
|
||||
import com.sun.javafx.fxml.ParseTraceElement;
|
||||
import com.sun.javafx.fxml.PropertyNotFoundException;
|
||||
import com.sun.javafx.fxml.expression.Expression;
|
||||
import com.sun.javafx.fxml.expression.ExpressionValue;
|
||||
import com.sun.javafx.fxml.expression.KeyPath;
|
||||
import java.net.MalformedURLException;
|
||||
import java.security.AccessController;
|
||||
import java.security.PrivilegedAction;
|
||||
import java.util.EnumMap;
|
||||
import java.util.Locale;
|
||||
import java.util.StringTokenizer;
|
||||
import sun.reflect.CallerSensitive;
|
||||
import sun.reflect.Reflection;
|
||||
import sun.reflect.misc.ConstructorUtil;
|
||||
import sun.reflect.misc.MethodUtil;
|
||||
import sun.reflect.misc.ReflectUtil;
|
||||
|
||||
import javax.script.*;
|
||||
import javax.xml.stream.XMLInputFactory;
|
||||
import javax.xml.stream.XMLStreamConstants;
|
||||
import javax.xml.stream.XMLStreamException;
|
||||
import javax.xml.stream.XMLStreamReader;
|
||||
import javax.xml.stream.util.StreamReaderDelegate;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.lang.reflect.*;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.nio.charset.Charset;
|
||||
import java.security.AccessController;
|
||||
import java.security.AllPermission;
|
||||
import java.security.PrivilegedAction;
|
||||
import java.util.*;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/*
|
||||
* Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Loads an object hierarchy from an XML document.
|
||||
* @since JavaFX 2.0
|
||||
*
|
||||
* @since JavaFX2.0 JDK1.8
|
||||
*/
|
||||
public class FXMLLoaderPlus {
|
||||
|
||||
@@ -109,6 +71,16 @@ public class FXMLLoaderPlus {
|
||||
private static final RuntimePermission GET_CLASSLOADER_PERMISSION =
|
||||
new RuntimePermission("getClassLoader");
|
||||
|
||||
private boolean show = false;
|
||||
|
||||
public boolean isShow() {
|
||||
return show;
|
||||
}
|
||||
|
||||
public void setShow(boolean show) {
|
||||
this.show = show;
|
||||
}
|
||||
|
||||
// Abstract base class for elements
|
||||
private abstract class Element {
|
||||
public final cn.edu.scau.biubiusuisui.config.FXMLLoaderPlus.Element parent;
|
||||
@@ -152,14 +124,14 @@ public class FXMLLoaderPlus {
|
||||
// to that (coerce to the appropriate type)
|
||||
List<Object> list;
|
||||
if (value instanceof List<?>) {
|
||||
list = (List<Object>)value;
|
||||
list = (List<Object>) value;
|
||||
} else {
|
||||
Class<?> type = value.getClass();
|
||||
DefaultProperty defaultProperty = type.getAnnotation(DefaultProperty.class);
|
||||
String defaultPropertyName = defaultProperty.value();
|
||||
|
||||
// Get the list value
|
||||
list = (List<Object>)getProperties().get(defaultPropertyName);
|
||||
list = (List<Object>) getProperties().get(defaultPropertyName);
|
||||
|
||||
// Coerce the element to the list item type
|
||||
if (!Map.class.isAssignableFrom(type)) {
|
||||
@@ -205,7 +177,7 @@ public class FXMLLoaderPlus {
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public Map<String, Object> getProperties() {
|
||||
return (isTyped()) ? getValueAdapter() : (Map<String, Object>)value;
|
||||
return (isTyped()) ? getValueAdapter() : (Map<String, Object>) value;
|
||||
}
|
||||
|
||||
public void processStartElement() throws IOException {
|
||||
@@ -241,7 +213,7 @@ public class FXMLLoaderPlus {
|
||||
}
|
||||
|
||||
public void processAttribute(String prefix, String localName, String value)
|
||||
throws IOException{
|
||||
throws IOException {
|
||||
if (prefix == null) {
|
||||
// Add the attribute to the appropriate list
|
||||
if (localName.startsWith(EVENT_HANDLER_PREFIX)) {
|
||||
@@ -314,12 +286,12 @@ public class FXMLLoaderPlus {
|
||||
expression = Expression.valueOf(value);
|
||||
|
||||
// Create the binding
|
||||
BeanAdapter targetAdapter = new BeanAdapter(this.value);
|
||||
MyBeanAdapter targetAdapter = new MyBeanAdapter(this.value);
|
||||
ObservableValue<Object> propertyModel = targetAdapter.getPropertyModel(attribute.name);
|
||||
Class<?> type = targetAdapter.getType(attribute.name);
|
||||
|
||||
if (propertyModel instanceof Property<?>) {
|
||||
((Property<Object>) propertyModel).bind(new ExpressionValue(namespace, expression, type));
|
||||
((Property<Object>) propertyModel).bind(new MyExpressionValue(namespace, expression, type));
|
||||
}
|
||||
}
|
||||
} else if (isBidirectionalBindingExpression(value)) {
|
||||
@@ -454,7 +426,7 @@ public class FXMLLoaderPlus {
|
||||
* the array becomes relative to document location.
|
||||
*/
|
||||
private Object populateArrayFromString(
|
||||
Class<?>type,
|
||||
Class<?> type,
|
||||
String stringValue) throws LoadException {
|
||||
|
||||
Object propertyValue = null;
|
||||
@@ -485,22 +457,22 @@ public class FXMLLoaderPlus {
|
||||
String listPropertyName,
|
||||
String stringValue) throws LoadException {
|
||||
// Split the string and add the values to the list
|
||||
List<Object> list = (List<Object>)valueAdapter.get(listPropertyName);
|
||||
List<Object> list = (List<Object>) valueAdapter.get(listPropertyName);
|
||||
Type listType = valueAdapter.getGenericType(listPropertyName);
|
||||
Type itemType = (Class<?>)BeanAdapter.getGenericListItemType(listType);
|
||||
Type itemType = (Class<?>) BeanAdapter.getGenericListItemType(listType);
|
||||
|
||||
if (itemType instanceof ParameterizedType) {
|
||||
itemType = ((ParameterizedType)itemType).getRawType();
|
||||
itemType = ((ParameterizedType) itemType).getRawType();
|
||||
}
|
||||
|
||||
if (stringValue.length() > 0) {
|
||||
String[] values = stringValue.split(ARRAY_COMPONENT_DELIMITER);
|
||||
|
||||
for (String aValue: values) {
|
||||
for (String aValue : values) {
|
||||
aValue = aValue.trim();
|
||||
list.add(
|
||||
BeanAdapter.coerce(resolvePrefixedValue(aValue),
|
||||
(Class<?>)itemType));
|
||||
(Class<?>) itemType));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -518,7 +490,7 @@ public class FXMLLoaderPlus {
|
||||
}
|
||||
}
|
||||
|
||||
private Object getExpressionObject(String handlerValue) throws LoadException{
|
||||
private Object getExpressionObject(String handlerValue) throws LoadException {
|
||||
if (handlerValue.startsWith(EXPRESSION_PREFIX)) {
|
||||
handlerValue = handlerValue.substring(EXPRESSION_PREFIX.length());
|
||||
|
||||
@@ -535,13 +507,13 @@ public class FXMLLoaderPlus {
|
||||
return null;
|
||||
}
|
||||
|
||||
private <T> T getExpressionObjectOfType(String handlerValue, Class<T> type) throws LoadException{
|
||||
private <T> T getExpressionObjectOfType(String handlerValue, Class<T> type) throws LoadException {
|
||||
Object expression = getExpressionObject(handlerValue);
|
||||
if (expression != null) {
|
||||
if (type.isInstance(expression)) {
|
||||
return (T) expression;
|
||||
}
|
||||
throw constructLoadException("Error resolving \"" + handlerValue +"\" expression."
|
||||
throw constructLoadException("Error resolving \"" + handlerValue + "\" expression."
|
||||
+ "Does not point to a " + type.getName());
|
||||
}
|
||||
return null;
|
||||
@@ -625,7 +597,7 @@ public class FXMLLoaderPlus {
|
||||
}
|
||||
|
||||
private void processObservableListHandler(String handlerValue) throws LoadException {
|
||||
ObservableList list = (ObservableList)value;
|
||||
ObservableList list = (ObservableList) value;
|
||||
if (handlerValue.startsWith(CONTROLLER_METHOD_PREFIX)) {
|
||||
cn.edu.scau.biubiusuisui.config.FXMLLoaderPlus.MethodHandler handler = getControllerMethodHandle(handlerValue, cn.edu.scau.biubiusuisui.config.FXMLLoaderPlus.SupportedType.LIST_CHANGE_LISTENER);
|
||||
if (handler != null) {
|
||||
@@ -647,7 +619,7 @@ public class FXMLLoaderPlus {
|
||||
}
|
||||
|
||||
private void processObservableMapHandler(String handlerValue) throws LoadException {
|
||||
ObservableMap map = (ObservableMap)value;
|
||||
ObservableMap map = (ObservableMap) value;
|
||||
if (handlerValue.startsWith(CONTROLLER_METHOD_PREFIX)) {
|
||||
cn.edu.scau.biubiusuisui.config.FXMLLoaderPlus.MethodHandler handler = getControllerMethodHandle(handlerValue, cn.edu.scau.biubiusuisui.config.FXMLLoaderPlus.SupportedType.MAP_CHANGE_LISTENER);
|
||||
if (handler != null) {
|
||||
@@ -669,7 +641,7 @@ public class FXMLLoaderPlus {
|
||||
}
|
||||
|
||||
private void processObservableSetHandler(String handlerValue) throws LoadException {
|
||||
ObservableSet set = (ObservableSet)value;
|
||||
ObservableSet set = (ObservableSet) value;
|
||||
if (handlerValue.startsWith(CONTROLLER_METHOD_PREFIX)) {
|
||||
cn.edu.scau.biubiusuisui.config.FXMLLoaderPlus.MethodHandler handler = getControllerMethodHandle(handlerValue, cn.edu.scau.biubiusuisui.config.FXMLLoaderPlus.SupportedType.SET_CHANGE_LISTENER);
|
||||
if (handler != null) {
|
||||
@@ -747,7 +719,8 @@ public class FXMLLoaderPlus {
|
||||
super.processStartElement();
|
||||
|
||||
updateValue(constructValue());
|
||||
|
||||
//如果是FXBaseController对象需要注入fxml
|
||||
//因为如果只是单纯反射不具有FXPlus功能只有FX功能
|
||||
if (value instanceof Builder<?>) {
|
||||
processInstancePropertyAttributes();
|
||||
} else {
|
||||
@@ -761,8 +734,9 @@ public class FXMLLoaderPlus {
|
||||
super.processEndElement();
|
||||
|
||||
// Build the value, if necessary
|
||||
|
||||
if (value instanceof Builder<?>) {
|
||||
Builder<Object> builder = (Builder<Object>)value;
|
||||
Builder<Object> builder = (Builder<Object>) value;
|
||||
updateValue(builder.build());
|
||||
|
||||
processValue();
|
||||
@@ -804,10 +778,10 @@ public class FXMLLoaderPlus {
|
||||
Type itemType = BeanAdapter.getGenericListItemType(listType);
|
||||
|
||||
if (itemType instanceof ParameterizedType) {
|
||||
itemType = ((ParameterizedType)itemType).getRawType();
|
||||
itemType = ((ParameterizedType) itemType).getRawType();
|
||||
}
|
||||
|
||||
value = BeanAdapter.coerce(value, (Class<?>)itemType);
|
||||
value = BeanAdapter.coerce(value, (Class<?>) itemType);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -878,7 +852,7 @@ public class FXMLLoaderPlus {
|
||||
|
||||
if (valueAdapter.isReadOnly(defaultPropertyName)
|
||||
&& List.class.isAssignableFrom(valueAdapter.getType(defaultPropertyName))) {
|
||||
List<Object> list = (List<Object>)valueAdapter.get(defaultPropertyName);
|
||||
List<Object> list = (List<Object>) valueAdapter.get(defaultPropertyName);
|
||||
list.add(getListValue(this, defaultPropertyName, text));
|
||||
} else {
|
||||
valueAdapter.put(defaultPropertyName, text.trim());
|
||||
@@ -890,7 +864,7 @@ public class FXMLLoaderPlus {
|
||||
|
||||
@Override
|
||||
public void processAttribute(String prefix, String localName, String value)
|
||||
throws IOException{
|
||||
throws IOException {
|
||||
if (prefix != null
|
||||
&& prefix.equals(FX_NAMESPACE_PREFIX)) {
|
||||
if (localName.equals(FX_ID_ATTRIBUTE)) {
|
||||
@@ -988,13 +962,13 @@ public class FXMLLoaderPlus {
|
||||
} else if (factory != null) {
|
||||
Method factoryMethod;
|
||||
try {
|
||||
factoryMethod = MethodUtil.getMethod(type, factory, new Class[] {});
|
||||
factoryMethod = MethodUtil.getMethod(type, factory, new Class[]{});
|
||||
} catch (NoSuchMethodException exception) {
|
||||
throw constructLoadException(exception);
|
||||
}
|
||||
|
||||
try {
|
||||
value = MethodUtil.invoke(factoryMethod, null, new Object [] {});
|
||||
value = MethodUtil.invoke(factoryMethod, null, new Object[]{});
|
||||
} catch (IllegalAccessException exception) {
|
||||
throw constructLoadException(exception);
|
||||
} catch (InvocationTargetException exception) {
|
||||
@@ -1009,12 +983,17 @@ public class FXMLLoaderPlus {
|
||||
|
||||
if (value == null) {
|
||||
try {
|
||||
value = ReflectUtil.newInstance(type);
|
||||
if (FXBaseController.class.isAssignableFrom(type)) {
|
||||
value = FXControllerFactory.getFXController(type, fx_id);
|
||||
} else {
|
||||
value = type.newInstance();
|
||||
}
|
||||
} catch (InstantiationException exception) {
|
||||
throw constructLoadException(exception);
|
||||
} catch (IllegalAccessException exception) {
|
||||
throw constructLoadException(exception);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1163,6 +1142,9 @@ public class FXMLLoaderPlus {
|
||||
if (fields != null) {
|
||||
try {
|
||||
for (Field f : fields) {
|
||||
if (baseController != null) {
|
||||
f.set(baseController, value);
|
||||
}
|
||||
f.set(controller, value);
|
||||
}
|
||||
} catch (IllegalAccessException exception) {
|
||||
@@ -1247,7 +1229,7 @@ public class FXMLLoaderPlus {
|
||||
|
||||
Constructor<?> constructor = null;
|
||||
try {
|
||||
constructor = ConstructorUtil.getConstructor(sourceValueType, new Class[] { sourceValueType });
|
||||
constructor = ConstructorUtil.getConstructor(sourceValueType, new Class[]{sourceValueType});
|
||||
} catch (NoSuchMethodException exception) {
|
||||
// No-op
|
||||
}
|
||||
@@ -1552,7 +1534,7 @@ public class FXMLLoaderPlus {
|
||||
try {
|
||||
scriptReader = new InputStreamReader(location.openStream(), charset);
|
||||
engine.eval(scriptReader);
|
||||
} catch(ScriptException exception) {
|
||||
} catch (ScriptException exception) {
|
||||
exception.printStackTrace();
|
||||
} finally {
|
||||
if (scriptReader != null) {
|
||||
@@ -1572,7 +1554,7 @@ public class FXMLLoaderPlus {
|
||||
if (value != null && !staticLoad) {
|
||||
// Evaluate the script
|
||||
try {
|
||||
scriptEngine.eval((String)value);
|
||||
scriptEngine.eval((String) value);
|
||||
} catch (ScriptException exception) {
|
||||
System.err.println(exception.getMessage());
|
||||
}
|
||||
@@ -1629,7 +1611,7 @@ public class FXMLLoaderPlus {
|
||||
|
||||
@Override
|
||||
public void processAttribute(String prefix, String localName, String value)
|
||||
throws LoadException{
|
||||
throws LoadException {
|
||||
throw constructLoadException("Element does not support attributes.");
|
||||
}
|
||||
}
|
||||
@@ -1683,7 +1665,7 @@ public class FXMLLoaderPlus {
|
||||
// Execute the script
|
||||
try {
|
||||
scriptEngine.eval(script);
|
||||
} catch (ScriptException exception){
|
||||
} catch (ScriptException exception) {
|
||||
throw new RuntimeException(exception);
|
||||
}
|
||||
|
||||
@@ -1771,7 +1753,7 @@ public class FXMLLoaderPlus {
|
||||
if (type != cn.edu.scau.biubiusuisui.config.FXMLLoaderPlus.SupportedType.PARAMETERLESS) {
|
||||
MethodUtil.invoke(method, controller, params);
|
||||
} else {
|
||||
MethodUtil.invoke(method, controller, new Object[] {});
|
||||
MethodUtil.invoke(method, controller, new Object[]{});
|
||||
}
|
||||
} catch (InvocationTargetException exception) {
|
||||
throw new RuntimeException(exception);
|
||||
@@ -1788,11 +1770,21 @@ public class FXMLLoaderPlus {
|
||||
|
||||
private Object root = null;
|
||||
private Object controller = null;
|
||||
private Object baseController = null;
|
||||
|
||||
private BuilderFactory builderFactory;
|
||||
|
||||
private Callback<Class<?>, Object> controllerFactory;
|
||||
private Charset charset;
|
||||
|
||||
public Object getBaseController() {
|
||||
return baseController;
|
||||
}
|
||||
|
||||
public void setBaseController(Object baseController) {
|
||||
this.baseController = baseController;
|
||||
}
|
||||
|
||||
private final LinkedList<cn.edu.scau.biubiusuisui.config.FXMLLoaderPlus> loaders;
|
||||
|
||||
private ClassLoader classLoader = null;
|
||||
@@ -1849,6 +1841,7 @@ public class FXMLLoaderPlus {
|
||||
public static final String FX_VALUE_ATTRIBUTE = "value";
|
||||
/**
|
||||
* The tag name of 'fx:constant'
|
||||
*
|
||||
* @since JavaFX 2.2
|
||||
*/
|
||||
public static final String FX_CONSTANT_ATTRIBUTE = "constant";
|
||||
@@ -1903,11 +1896,13 @@ public class FXMLLoaderPlus {
|
||||
|
||||
/**
|
||||
* The tag name of <fx:root>
|
||||
*
|
||||
* @since JavaFX 2.2
|
||||
*/
|
||||
public static final String ROOT_TAG = "root";
|
||||
/**
|
||||
* <fx:root> 'type' attribute
|
||||
*
|
||||
* @since JavaFX 2.2
|
||||
*/
|
||||
public static final String ROOT_TYPE_ATTRIBUTE = "type";
|
||||
@@ -1944,6 +1939,7 @@ public class FXMLLoaderPlus {
|
||||
* Escape prefix for escaping special characters inside attribute values.
|
||||
* Serves as an escape for {@link #ESCAPE_PREFIX}, {@link #RELATIVE_PATH_PREFIX},
|
||||
* {@link #RESOURCE_KEY_PREFIX, {@link #EXPRESSION_PREFIX}, {@link #BI_DIRECTIONAL_BINDING_PREFIX}
|
||||
*
|
||||
* @since JavaFX 2.1
|
||||
*/
|
||||
public static final String ESCAPE_PREFIX = "\\";
|
||||
@@ -1970,29 +1966,34 @@ public class FXMLLoaderPlus {
|
||||
|
||||
/**
|
||||
* Prefix for bidirectional-binding expression resolution
|
||||
*
|
||||
* @since JavaFX 2.1
|
||||
*/
|
||||
public static final String BI_DIRECTIONAL_BINDING_PREFIX = "#{";
|
||||
/**
|
||||
* Suffix for bidirectional-binding expression resolution
|
||||
*
|
||||
* @since JavaFX 2.1
|
||||
*/
|
||||
public static final String BI_DIRECTIONAL_BINDING_SUFFIX = "}";
|
||||
|
||||
/**
|
||||
* Delimiter for arrays as values
|
||||
*
|
||||
* @since JavaFX 2.1
|
||||
*/
|
||||
public static final String ARRAY_COMPONENT_DELIMITER = ",";
|
||||
|
||||
/**
|
||||
* A key for location URL in namespace map
|
||||
*
|
||||
* @see #getNamespace()
|
||||
* @since JavaFX 2.2
|
||||
*/
|
||||
public static final String LOCATION_KEY = "location";
|
||||
/**
|
||||
* A key for ResourceBundle in namespace map
|
||||
*
|
||||
* @see #getNamespace()
|
||||
* @since JavaFX 2.2
|
||||
*/
|
||||
@@ -2004,6 +2005,7 @@ public class FXMLLoaderPlus {
|
||||
public static final String CONTROLLER_METHOD_PREFIX = "#";
|
||||
/**
|
||||
* A key for controller in namespace map
|
||||
*
|
||||
* @see #getNamespace()
|
||||
* @since JavaFX 2.1
|
||||
*/
|
||||
@@ -2011,6 +2013,7 @@ public class FXMLLoaderPlus {
|
||||
/**
|
||||
* A suffix for controllers of included fxml files.
|
||||
* The full key is stored in namespace map.
|
||||
*
|
||||
* @see #getNamespace()
|
||||
* @since JavaFX 2.2
|
||||
*/
|
||||
@@ -2018,18 +2021,21 @@ public class FXMLLoaderPlus {
|
||||
|
||||
/**
|
||||
* The name of initialize method
|
||||
*
|
||||
* @since JavaFX 2.2
|
||||
*/
|
||||
public static final String INITIALIZE_METHOD_NAME = "initialize";
|
||||
|
||||
/**
|
||||
* Contains the current javafx version
|
||||
*
|
||||
* @since JavaFX 8.0
|
||||
*/
|
||||
public static final String JAVAFX_VERSION;
|
||||
|
||||
/**
|
||||
* Contains the current fx namepsace version
|
||||
*
|
||||
* @since JavaFX 8.0
|
||||
*/
|
||||
public static final String FX_NAMESPACE_VERSION = "1";
|
||||
@@ -2047,7 +2053,7 @@ public class FXMLLoaderPlus {
|
||||
* Creates a new FXMLLoader instance.
|
||||
*/
|
||||
public FXMLLoaderPlus() {
|
||||
this((URL)null);
|
||||
this((URL) null);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2093,7 +2099,7 @@ public class FXMLLoaderPlus {
|
||||
* @since JavaFX 2.1
|
||||
*/
|
||||
public FXMLLoaderPlus(URL location, ResourceBundle resources, BuilderFactory builderFactory,
|
||||
Callback<Class<?>, Object> controllerFactory) {
|
||||
Callback<Class<?>, Object> controllerFactory) {
|
||||
this(location, resources, builderFactory, controllerFactory, Charset.forName(DEFAULT_CHARSET_NAME));
|
||||
}
|
||||
|
||||
@@ -2117,7 +2123,7 @@ public class FXMLLoaderPlus {
|
||||
* @since JavaFX 2.1
|
||||
*/
|
||||
public FXMLLoaderPlus(URL location, ResourceBundle resources, BuilderFactory builderFactory,
|
||||
Callback<Class<?>, Object> controllerFactory, Charset charset) {
|
||||
Callback<Class<?>, Object> controllerFactory, Charset charset) {
|
||||
this(location, resources, builderFactory, controllerFactory, charset,
|
||||
new LinkedList<cn.edu.scau.biubiusuisui.config.FXMLLoaderPlus>());
|
||||
}
|
||||
@@ -2134,8 +2140,8 @@ public class FXMLLoaderPlus {
|
||||
* @since JavaFX 2.1
|
||||
*/
|
||||
public FXMLLoaderPlus(URL location, ResourceBundle resources, BuilderFactory builderFactory,
|
||||
Callback<Class<?>, Object> controllerFactory, Charset charset,
|
||||
LinkedList<cn.edu.scau.biubiusuisui.config.FXMLLoaderPlus> loaders) {
|
||||
Callback<Class<?>, Object> controllerFactory, Charset charset,
|
||||
LinkedList<cn.edu.scau.biubiusuisui.config.FXMLLoaderPlus> loaders) {
|
||||
setLocation(location);
|
||||
setResources(resources);
|
||||
setBuilderFactory(builderFactory);
|
||||
@@ -2189,7 +2195,7 @@ public class FXMLLoaderPlus {
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public <T> T getRoot() {
|
||||
return (T)root;
|
||||
return (T) root;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2198,8 +2204,7 @@ public class FXMLLoaderPlus {
|
||||
* must be called prior to loading the document when using
|
||||
* <tt><fx:root></tt>.
|
||||
*
|
||||
* @param root
|
||||
* The root of the object hierarchy.
|
||||
* @param root The root of the object hierarchy.
|
||||
* @since JavaFX 2.2
|
||||
*/
|
||||
public void setRoot(Object root) {
|
||||
@@ -2209,7 +2214,7 @@ public class FXMLLoaderPlus {
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj instanceof cn.edu.scau.biubiusuisui.config.FXMLLoaderPlus) {
|
||||
cn.edu.scau.biubiusuisui.config.FXMLLoaderPlus loader = (cn.edu.scau.biubiusuisui.config.FXMLLoaderPlus)obj;
|
||||
cn.edu.scau.biubiusuisui.config.FXMLLoaderPlus loader = (cn.edu.scau.biubiusuisui.config.FXMLLoaderPlus) obj;
|
||||
if (location == null || loader.location == null) {
|
||||
return loader.location == location;
|
||||
}
|
||||
@@ -2236,7 +2241,7 @@ public class FXMLLoaderPlus {
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public <T> T getController() {
|
||||
return (T)controller;
|
||||
return (T) controller;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2246,8 +2251,7 @@ public class FXMLLoaderPlus {
|
||||
* controller event handlers when an <tt>fx:controller</tt> attribute is not
|
||||
* specified in the document.
|
||||
*
|
||||
* @param controller
|
||||
* The controller to associate with the root object.
|
||||
* @param controller The controller to associate with the root object.
|
||||
* @since JavaFX 2.2
|
||||
*/
|
||||
public void setController(Object controller) {
|
||||
@@ -2280,6 +2284,7 @@ public class FXMLLoaderPlus {
|
||||
|
||||
/**
|
||||
* Returns the controller cn.edu.scau.biubiusuisui.factory used by this serializer.
|
||||
*
|
||||
* @since JavaFX 2.1
|
||||
*/
|
||||
public Callback<Class<?>, Object> getControllerFactory() {
|
||||
@@ -2319,6 +2324,7 @@ public class FXMLLoaderPlus {
|
||||
|
||||
/**
|
||||
* Returns the classloader used by this serializer.
|
||||
*
|
||||
* @since JavaFX 2.1
|
||||
*/
|
||||
@CallerSensitive
|
||||
@@ -2365,7 +2371,6 @@ public class FXMLLoaderPlus {
|
||||
* Sets the static load flag.
|
||||
*
|
||||
* @param staticLoad
|
||||
*
|
||||
* @treatAsPrivate
|
||||
* @deprecated
|
||||
*/
|
||||
@@ -2389,7 +2394,6 @@ public class FXMLLoaderPlus {
|
||||
* Sets this loader's load listener.
|
||||
*
|
||||
* @param loadListener
|
||||
*
|
||||
* @treatAsPrivate
|
||||
* @deprecated
|
||||
*/
|
||||
@@ -2403,8 +2407,7 @@ public class FXMLLoaderPlus {
|
||||
* the document will be loaded must have been set by a prior call to
|
||||
* {@link #setLocation(URL)}.
|
||||
*
|
||||
* @return
|
||||
* The loaded object hierarchy.
|
||||
* @return The loaded object hierarchy.
|
||||
* @since JavaFX 2.1
|
||||
*/
|
||||
@CallerSensitive
|
||||
@@ -2417,11 +2420,8 @@ public class FXMLLoaderPlus {
|
||||
/**
|
||||
* Loads an object hierarchy from a FXML document.
|
||||
*
|
||||
* @param inputStream
|
||||
* An input stream containing the FXML data to load.
|
||||
*
|
||||
* @return
|
||||
* The loaded object hierarchy.
|
||||
* @param inputStream An input stream containing the FXML data to load.
|
||||
* @return The loaded object hierarchy.
|
||||
*/
|
||||
@CallerSensitive
|
||||
public <T> T load(InputStream inputStream) throws IOException {
|
||||
@@ -2451,7 +2451,7 @@ public class FXMLLoaderPlus {
|
||||
return value;
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "dep-ann", "unchecked" })
|
||||
@SuppressWarnings({"dep-ann", "unchecked"})
|
||||
private <T> T loadImpl(InputStream inputStream,
|
||||
Class<?> callerClass) throws IOException {
|
||||
if (inputStream == null) {
|
||||
@@ -2548,30 +2548,32 @@ public class FXMLLoaderPlus {
|
||||
|
||||
if (controller != null) {
|
||||
if (controller instanceof Initializable) {
|
||||
((Initializable)controller).initialize(location, resources);
|
||||
((Initializable) controller).initialize(location, resources);
|
||||
} else {
|
||||
// Inject controller fields
|
||||
Map<String, List<Field>> controllerFields =
|
||||
controllerAccessor.getControllerFields();
|
||||
if (!show) {
|
||||
Map<String, List<Field>> controllerFields =
|
||||
controllerAccessor.getControllerFields();
|
||||
|
||||
injectFields(LOCATION_KEY, location);
|
||||
injectFields(LOCATION_KEY, location);
|
||||
|
||||
injectFields(RESOURCES_KEY, resources);
|
||||
injectFields(RESOURCES_KEY, resources);
|
||||
|
||||
// Initialize the controller
|
||||
Method initializeMethod = controllerAccessor
|
||||
.getControllerMethods()
|
||||
.get(cn.edu.scau.biubiusuisui.config.FXMLLoaderPlus.SupportedType.PARAMETERLESS)
|
||||
.get(INITIALIZE_METHOD_NAME);
|
||||
// Initialize the controller
|
||||
Method initializeMethod = controllerAccessor
|
||||
.getControllerMethods()
|
||||
.get(cn.edu.scau.biubiusuisui.config.FXMLLoaderPlus.SupportedType.PARAMETERLESS)
|
||||
.get(INITIALIZE_METHOD_NAME);
|
||||
|
||||
if (initializeMethod != null) {
|
||||
try {
|
||||
MethodUtil.invoke(initializeMethod, controller, new Object [] {});
|
||||
} catch (IllegalAccessException exception) {
|
||||
// TODO Throw when Initializable is deprecated/removed
|
||||
// throw constructLoadException(cn.edu.scau.biubiusuisui.exception);
|
||||
} catch (InvocationTargetException exception) {
|
||||
throw constructLoadException(exception);
|
||||
if (initializeMethod != null) {
|
||||
try {
|
||||
MethodUtil.invoke(initializeMethod, controller, new Object[]{});
|
||||
} catch (IllegalAccessException exception) {
|
||||
// TODO Throw when Initializable is deprecated/removed
|
||||
// throw constructLoadException(cn.edu.scau.biubiusuisui.exception);
|
||||
} catch (InvocationTargetException exception) {
|
||||
throw constructLoadException(exception);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2588,7 +2590,7 @@ public class FXMLLoaderPlus {
|
||||
xmlStreamReader = null;
|
||||
}
|
||||
|
||||
return (T)root;
|
||||
return (T) root;
|
||||
}
|
||||
|
||||
private void clearImports() {
|
||||
@@ -2596,7 +2598,7 @@ public class FXMLLoaderPlus {
|
||||
classes.clear();
|
||||
}
|
||||
|
||||
private LoadException constructLoadException(String message){
|
||||
private LoadException constructLoadException(String message) {
|
||||
return new LoadException(message + constructFXMLTrace());
|
||||
}
|
||||
|
||||
@@ -2604,7 +2606,7 @@ public class FXMLLoaderPlus {
|
||||
return new LoadException(constructFXMLTrace(), cause);
|
||||
}
|
||||
|
||||
private LoadException constructLoadException(String message, Throwable cause){
|
||||
private LoadException constructLoadException(String message, Throwable cause) {
|
||||
return new LoadException(message + constructFXMLTrace(), cause);
|
||||
}
|
||||
|
||||
@@ -2628,8 +2630,8 @@ public class FXMLLoaderPlus {
|
||||
* Returns the current line number.
|
||||
*
|
||||
* @treatAsPrivate
|
||||
* @deprecated
|
||||
* @since JavaFX 2.2
|
||||
* @deprecated
|
||||
*/
|
||||
public int impl_getLineNumber() {
|
||||
return xmlStreamReader.getLocation().getLineNumber();
|
||||
@@ -2639,8 +2641,8 @@ public class FXMLLoaderPlus {
|
||||
* Returns the current parse trace.
|
||||
*
|
||||
* @treatAsPrivate
|
||||
* @deprecated
|
||||
* @since JavaFX 2.1
|
||||
* @deprecated
|
||||
*/
|
||||
// SB-dependency: RT-21475 has been filed to track this
|
||||
public ParseTraceElement[] impl_getParseTrace() {
|
||||
@@ -2921,7 +2923,6 @@ public class FXMLLoaderPlus {
|
||||
|
||||
private static enum SupportedType {
|
||||
PARAMETERLESS {
|
||||
|
||||
@Override
|
||||
protected boolean methodIsOfType(Method m) {
|
||||
return m.getParameterTypes().length == 0;
|
||||
@@ -2929,7 +2930,6 @@ public class FXMLLoaderPlus {
|
||||
|
||||
},
|
||||
EVENT {
|
||||
|
||||
@Override
|
||||
protected boolean methodIsOfType(Method m) {
|
||||
return m.getParameterTypes().length == 1 &&
|
||||
@@ -2938,7 +2938,6 @@ public class FXMLLoaderPlus {
|
||||
|
||||
},
|
||||
LIST_CHANGE_LISTENER {
|
||||
|
||||
@Override
|
||||
protected boolean methodIsOfType(Method m) {
|
||||
return m.getParameterTypes().length == 1 &&
|
||||
@@ -2947,7 +2946,6 @@ public class FXMLLoaderPlus {
|
||||
|
||||
},
|
||||
MAP_CHANGE_LISTENER {
|
||||
|
||||
@Override
|
||||
protected boolean methodIsOfType(Method m) {
|
||||
return m.getParameterTypes().length == 1 &&
|
||||
@@ -2956,7 +2954,6 @@ public class FXMLLoaderPlus {
|
||||
|
||||
},
|
||||
SET_CHANGE_LISTENER {
|
||||
|
||||
@Override
|
||||
protected boolean methodIsOfType(Method m) {
|
||||
return m.getParameterTypes().length == 1 &&
|
||||
@@ -2965,7 +2962,6 @@ public class FXMLLoaderPlus {
|
||||
|
||||
},
|
||||
PROPERTY_CHANGE_LISTENER {
|
||||
|
||||
@Override
|
||||
protected boolean methodIsOfType(Method m) {
|
||||
return m.getParameterTypes().length == 3 &&
|
||||
@@ -3001,9 +2997,7 @@ public class FXMLLoaderPlus {
|
||||
*
|
||||
* @param packageName
|
||||
* @param className
|
||||
*
|
||||
* @deprecated
|
||||
* This method now delegates to {@link #getDefaultClassLoader()}.
|
||||
* @deprecated This method now delegates to {@link #getDefaultClassLoader()}.
|
||||
*/
|
||||
public static Class<?> loadType(String packageName, String className) throws ClassNotFoundException {
|
||||
return loadType(packageName + "." + className.replace('.', '$'));
|
||||
@@ -3013,9 +3007,7 @@ public class FXMLLoaderPlus {
|
||||
* Loads a type using the default class loader.
|
||||
*
|
||||
* @param className
|
||||
*
|
||||
* @deprecated
|
||||
* This method now delegates to {@link #getDefaultClassLoader()}.
|
||||
* @deprecated This method now delegates to {@link #getDefaultClassLoader()}.
|
||||
*/
|
||||
public static Class<?> loadType(String className) throws ClassNotFoundException {
|
||||
ReflectUtil.checkPackageAccess(className);
|
||||
@@ -3060,6 +3052,7 @@ public class FXMLLoaderPlus {
|
||||
|
||||
/**
|
||||
* Returns the default class loader.
|
||||
*
|
||||
* @since JavaFX 2.1
|
||||
*/
|
||||
@CallerSensitive
|
||||
@@ -3074,8 +3067,7 @@ public class FXMLLoaderPlus {
|
||||
/**
|
||||
* Sets the default class loader.
|
||||
*
|
||||
* @param defaultClassLoader
|
||||
* The default class loader to use when loading classes.
|
||||
* @param defaultClassLoader The default class loader to use when loading classes.
|
||||
* @since JavaFX 2.1
|
||||
*/
|
||||
public static void setDefaultClassLoader(ClassLoader defaultClassLoader) {
|
||||
@@ -3124,7 +3116,7 @@ public class FXMLLoaderPlus {
|
||||
|
||||
private static <T> T loadImpl(URL location, ResourceBundle resources,
|
||||
Class<?> callerClass) throws IOException {
|
||||
return loadImpl(location, resources, null,
|
||||
return loadImpl(location, resources, null,
|
||||
callerClass);
|
||||
}
|
||||
|
||||
@@ -3219,10 +3211,11 @@ public class FXMLLoaderPlus {
|
||||
|
||||
/**
|
||||
* Utility method for comparing two JavaFX version strings (such as 2.2.5, 8.0.0-ea)
|
||||
*
|
||||
* @param rtVer String representation of JavaFX runtime version, including - or _ appendix
|
||||
* @param nsVer String representation of JavaFX version to compare against runtime version
|
||||
* @return number < 0 if runtime version is lower, 0 when both versions are the same,
|
||||
* number > 0 if runtime is higher version
|
||||
* number > 0 if runtime is higher version
|
||||
*/
|
||||
static int compareJFXVersions(String rtVer, String nsVer) {
|
||||
|
||||
@@ -3367,7 +3360,7 @@ public class FXMLLoaderPlus {
|
||||
Map<cn.edu.scau.biubiusuisui.config.FXMLLoaderPlus.SupportedType, Map<String, Method>> getControllerMethods() {
|
||||
if (controllerMethods == null) {
|
||||
controllerMethods = new EnumMap<>(cn.edu.scau.biubiusuisui.config.FXMLLoaderPlus.SupportedType.class);
|
||||
for (cn.edu.scau.biubiusuisui.config.FXMLLoaderPlus.SupportedType t: cn.edu.scau.biubiusuisui.config.FXMLLoaderPlus.SupportedType.values()) {
|
||||
for (cn.edu.scau.biubiusuisui.config.FXMLLoaderPlus.SupportedType t : cn.edu.scau.biubiusuisui.config.FXMLLoaderPlus.SupportedType.values()) {
|
||||
controllerMethods.put(t, new HashMap<String, Method>());
|
||||
}
|
||||
|
||||
|
||||
@@ -1,39 +1,68 @@
|
||||
package cn.edu.scau.biubiusuisui.config;
|
||||
|
||||
import cn.edu.scau.biubiusuisui.annotation.FXScan;
|
||||
import cn.edu.scau.biubiusuisui.factory.FXFactory;
|
||||
import cn.edu.scau.biubiusuisui.utils.ClassUtils;
|
||||
|
||||
import java.util.List;
|
||||
import cn.edu.scau.biubiusuisui.annotation.FXWindow;
|
||||
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.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;
|
||||
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
|
||||
|
||||
public class FXPlusApplication {
|
||||
private static FXWindowParser windowAnnotationParser = new FXWindowParser();
|
||||
|
||||
public static void start(Class clazz){
|
||||
Annotation []annotations = clazz.getDeclaredAnnotations();
|
||||
for(Annotation annotation : annotations){
|
||||
if(FXScan.class.equals(annotation.annotationType())){
|
||||
String []dirs = ((FXScan)annotation).base();
|
||||
private static BeanBuilder DEFAULT_BEAN_FACTORY = new FXBuilder();
|
||||
|
||||
private static BeanBuilder beanBuilder;
|
||||
|
||||
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();
|
||||
Set<String> sets = new HashSet<>();
|
||||
for(String dir : dirs){
|
||||
for (String dir : dirs) {
|
||||
sets.add(dir);
|
||||
}
|
||||
Set<String> classNames = new HashSet<>();
|
||||
for(String dir:sets){
|
||||
ClassUtils classUtils = new ClassUtils();
|
||||
List<String> temps = classUtils.scanAllClassName(dir);
|
||||
for(String className:temps){
|
||||
for (String dir : sets) {
|
||||
logger.info("scanning directory: " + dir);
|
||||
ClassUtil classUtil = new ClassUtil();
|
||||
List<String> temps = classUtil.scanAllClassName(dir);
|
||||
for (String className : temps) {
|
||||
try {
|
||||
loadFXPlusClass(className);
|
||||
logger.info("loading class: " + className);
|
||||
loadFXPlusClass(className, beanBuilder);
|
||||
} catch (ClassNotFoundException e) {
|
||||
logger.error(e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
@@ -42,8 +71,16 @@ public class FXPlusApplication {
|
||||
}
|
||||
}
|
||||
|
||||
private static void loadFXPlusClass(String className) throws ClassNotFoundException {
|
||||
public static void start(Class clazz) {
|
||||
start(clazz, DEFAULT_BEAN_FACTORY);
|
||||
}
|
||||
|
||||
private static void loadFXPlusClass(String className, BeanBuilder beanBuilder) throws ClassNotFoundException {
|
||||
Class clazz = Class.forName(className);
|
||||
FXFactory.loadFXController(clazz);
|
||||
// 是窗口,需要初始化Stage
|
||||
if (clazz.getAnnotation(FXWindow.class) != null) {
|
||||
logger.info("loading stage of class: " + className);
|
||||
FXControllerFactory.loadStage(clazz, beanBuilder);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,79 +1,289 @@
|
||||
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 javafx.fxml.Initializable;
|
||||
import cn.edu.scau.biubiusuisui.config.FXPlusApplication;
|
||||
import cn.edu.scau.biubiusuisui.exception.ProtocolNotSupport;
|
||||
import cn.edu.scau.biubiusuisui.function.DragWindowHandlerImpl;
|
||||
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.ResourceBundleUtil;
|
||||
import cn.edu.scau.biubiusuisui.utils.StringUtil;
|
||||
import javafx.event.EventHandler;
|
||||
import javafx.scene.image.Image;
|
||||
import javafx.scene.layout.Pane;
|
||||
import cn.edu.scau.biubiusuisui.utils.StringUtils;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
import java.io.File;
|
||||
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
|
||||
* 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>
|
||||
*
|
||||
* @author jack
|
||||
* @author suisui
|
||||
* @version 1.0
|
||||
* @date 2019/6/25 5:51
|
||||
* @since JavaFX2.0 JDK1.8
|
||||
*/
|
||||
public class FXBaseController extends Pane {
|
||||
public class FXBaseController extends Pane {
|
||||
private static final IFXPlusLogger logger = FXPlusLoggerFactory.getLogger(FXBaseController.class);
|
||||
|
||||
protected String name = "";
|
||||
|
||||
private Stage stage;
|
||||
private boolean isController = false;
|
||||
private boolean isWindow = false;
|
||||
|
||||
private boolean isWindows = false;
|
||||
|
||||
public FXBaseController(String name){
|
||||
/**
|
||||
* <p>description 用于携带信息数据</p>
|
||||
*
|
||||
* @version 1.2
|
||||
*/
|
||||
private Map<String, Object> query = new HashMap<>();
|
||||
private Map<String, Object> param = new HashMap<>();
|
||||
|
||||
public FXBaseController(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public FXBaseController(){
|
||||
public FXBaseController() {
|
||||
FXController fxController = null;
|
||||
FXWindow fxWindow = null;
|
||||
Annotation[] annotations = getClass().getAnnotations();
|
||||
// Find FXController cn.edu.scau.biubiusuisui.annotation
|
||||
for (Annotation annotation : annotations) {
|
||||
// 是否Controller
|
||||
if (annotation.annotationType().equals(FXController.class)) {
|
||||
fxController = (FXController) annotation;
|
||||
isController = true;
|
||||
}
|
||||
// 添加赋予是否为窗口的逻辑
|
||||
if (annotation.annotationType().equals(FXWindow.class)) {
|
||||
fxWindow = (FXWindow) annotation;
|
||||
this.isWindow = true;
|
||||
}
|
||||
}
|
||||
//load fxml file to show panel in scene builder
|
||||
if(isController) {
|
||||
FXMLLoaderPlus fxmlLoader = new FXMLLoaderPlus(getClass().getClassLoader().getResource(fxController.path()));
|
||||
if (isController && FXPlusApplication.IS_SCENE_BUILDER == true) {
|
||||
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 {
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
if("".equals(name)){
|
||||
return StringUtils.getBaseClassName(getClass().getSimpleName());
|
||||
}else{
|
||||
return StringUtils.getBaseClassName(getClass().getSimpleName()) +"#"+name;
|
||||
/**
|
||||
* @description 初始化onShow, onHide, onClose的生命周期
|
||||
* @version 1.2
|
||||
*/
|
||||
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() {
|
||||
if (this.isWindow) {
|
||||
this.stage.show();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 显示并等待
|
||||
*/
|
||||
public void showAndWait() {
|
||||
if (this.isWindow) {
|
||||
this.stage.showAndWait();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 关闭舞台
|
||||
*/
|
||||
public void closeStage() {
|
||||
if (this.isWindow) {
|
||||
this.stage.close();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 最小化
|
||||
* @version 1.2
|
||||
*/
|
||||
public void hideStage() {
|
||||
if (this.isWindow) {
|
||||
this.stage.setIconified(true);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>description: 开放设置窗口标题 </p>
|
||||
*
|
||||
* @param title 标题
|
||||
* @return true--修改标题成功 false--修改失败
|
||||
* @version 1.3
|
||||
*/
|
||||
public final void setWindowTitle(String title) {
|
||||
if (this.isWindow) {
|
||||
this.stage.setTitle(title);
|
||||
logger.info("setting title of window");
|
||||
} else {
|
||||
logger.warn("the controller is not window");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>description: 开放设置窗口图标</p>
|
||||
*
|
||||
* @param icon String 图标URL地址,需要放在resources文件下或项目根目录下
|
||||
*/
|
||||
public final void setIcon(String icon) {
|
||||
if (this.isWindow) {
|
||||
if (!"".equals(icon)) {
|
||||
try {
|
||||
URL iconUrl = new FileUtil().getFilePathFromResources(icon);
|
||||
if (iconUrl != null) {
|
||||
if (new File(StringUtil.getRootPath(iconUrl)).exists()) {
|
||||
this.stage.getIcons().clear();
|
||||
this.stage.getIcons().add(new Image(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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>Description 开放是否允许窗口可拖拽和缩放的接口</p>
|
||||
*
|
||||
* @param draggable 可拖拽
|
||||
* @param resizable 可缩放
|
||||
*/
|
||||
public final void setDragAndResize(boolean draggable, boolean resizable) {
|
||||
this.stage.setResizable(resizable);
|
||||
if (draggable || resizable) {
|
||||
EventHandler dragWindowHandler = new DragWindowHandlerImpl(stage, this, draggable, resizable);
|
||||
this.setOnMousePressed(dragWindowHandler);
|
||||
this.setOnMouseDragged(dragWindowHandler);
|
||||
this.setOnMouseMoved(dragWindowHandler);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取Controller名字
|
||||
*
|
||||
* @return name
|
||||
*/
|
||||
public String getName() {
|
||||
if ("".equals(name) || name == null) { // 原本无“name == null”判断条件,会出错
|
||||
return StringUtil.getBaseClassName(getClass().getSimpleName());
|
||||
} else {
|
||||
return StringUtil.getBaseClassName(getClass().getSimpleName()) + "#" + name;
|
||||
}
|
||||
}
|
||||
public void doInit(){}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
@@ -87,11 +297,35 @@ public class FXBaseController extends Pane {
|
||||
isController = controller;
|
||||
}
|
||||
|
||||
public boolean isWindows() {
|
||||
return isWindows;
|
||||
public boolean isWindow() {
|
||||
return this.isWindow;
|
||||
}
|
||||
|
||||
public void setWindows(boolean windows) {
|
||||
isWindows = windows;
|
||||
public void setWindow(boolean window) {
|
||||
this.isWindow = window;
|
||||
}
|
||||
|
||||
public Stage getStage() {
|
||||
return stage;
|
||||
}
|
||||
|
||||
public void setStage(Stage stage) {
|
||||
this.stage = stage;
|
||||
}
|
||||
|
||||
public Map<String, Object> getQuery() {
|
||||
return query;
|
||||
}
|
||||
|
||||
public Map<String, Object> getParam() {
|
||||
return param;
|
||||
}
|
||||
|
||||
public void setQuery(Map<String, Object> query) {
|
||||
this.query = query;
|
||||
}
|
||||
|
||||
public void setParam(Map<String, Object> param) {
|
||||
this.param = param;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
package cn.edu.scau.biubiusuisui.entity;
|
||||
|
||||
import javafx.beans.property.Property;
|
||||
import javafx.beans.value.ObservableValue;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
/**
|
||||
* @Author jack
|
||||
* @Date:2019/6/28 10:03
|
||||
*/
|
||||
public class FXFieldViewFieldMapping {
|
||||
|
||||
private boolean readOnly;
|
||||
private Class type;
|
||||
|
||||
|
||||
public boolean isReadOnly() {
|
||||
return readOnly;
|
||||
}
|
||||
|
||||
public void setReadOnly(boolean readOnly) {
|
||||
this.readOnly = readOnly;
|
||||
}
|
||||
|
||||
public Class getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(Class type) {
|
||||
this.type = type;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package cn.edu.scau.biubiusuisui.entity;
|
||||
|
||||
import cn.edu.scau.biubiusuisui.annotation.FXField;
|
||||
import javafx.beans.property.Property;
|
||||
|
||||
/**
|
||||
* 将Controller中的JavaFX的field包装成FXFieldWrapper
|
||||
*
|
||||
* @author jack
|
||||
* @version 1.0
|
||||
* @date 2019/6/28 10:03
|
||||
* @since JavaFX2.0 JDK1.8
|
||||
*/
|
||||
public class FXFieldWrapper {
|
||||
|
||||
private FXField fxField;
|
||||
private Class type;
|
||||
|
||||
private Property property;
|
||||
|
||||
public FXFieldWrapper() {
|
||||
}
|
||||
|
||||
public FXFieldWrapper(FXField fxField, Class type) {
|
||||
this.fxField = fxField;
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public Class getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(Class type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public FXField getFxField() {
|
||||
return fxField;
|
||||
}
|
||||
|
||||
public void setFxField(FXField fxField) {
|
||||
this.fxField = fxField;
|
||||
}
|
||||
|
||||
public Property getProperty() {
|
||||
return property;
|
||||
}
|
||||
|
||||
public void setProperty(Property property) {
|
||||
this.property = property;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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 {
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package cn.edu.scau.biubiusuisui.entity;
|
||||
|
||||
import cn.edu.scau.biubiusuisui.proxy.classProxy.FXEntityProxy;
|
||||
import cn.edu.scau.biubiusuisui.proxy.FXEntityProxy;
|
||||
import javafx.beans.property.Property;
|
||||
|
||||
import java.util.LinkedList;
|
||||
@@ -9,71 +9,46 @@ import java.util.Map;
|
||||
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 {
|
||||
|
||||
private FXPlusContext(){}
|
||||
private FXPlusContext() {
|
||||
}
|
||||
|
||||
private static Map<String, List<FXBaseController>> controllerContext = new ConcurrentHashMap<>(); //FXController控制器注册表
|
||||
|
||||
private static Map<Object, FXEntityProxy> beanProxyMap = new ConcurrentHashMap<>(); // Object注册为FXEntityObject
|
||||
private static Map<Object, FXEntityProxy> beanMap = new ConcurrentHashMap<>(); // Object注册为FXEntityObject
|
||||
|
||||
public static Property getEntityPropertyByName(Object object, String fieldName){
|
||||
FXEntityProxy fxEntityProxy = FXPlusContext.getProryByBeanObject(object);
|
||||
if(fxEntityProxy == null){
|
||||
return null;
|
||||
}
|
||||
return fxEntityProxy.getStringPropertyMap().get(fieldName);
|
||||
}
|
||||
|
||||
private static Map<String, Object> session = new ConcurrentHashMap<>();
|
||||
|
||||
public static void addController(FXBaseController fxBaseController){
|
||||
public static void registerController(FXBaseController fxBaseController) {
|
||||
List<FXBaseController> controllers = controllerContext.get(fxBaseController.getName());
|
||||
if(controllers == null){
|
||||
if (controllers == null) {
|
||||
controllers = new LinkedList<>();
|
||||
}
|
||||
controllers.add(fxBaseController);
|
||||
}
|
||||
|
||||
public static List<FXBaseController> getControllers(String key){
|
||||
|
||||
public static FXEntityProxy getProxyByBeanObject(Object object) {
|
||||
return beanMap.get(object);
|
||||
}
|
||||
|
||||
public static void setProxyByBeanObject(Object object, FXEntityProxy fxEntityProxy) {
|
||||
beanMap.put(object, fxEntityProxy);
|
||||
}
|
||||
|
||||
public static List<FXBaseController> getControllers(String key) {
|
||||
return controllerContext.get(key);
|
||||
}
|
||||
|
||||
public static FXEntityProxy getProryByBeanObject(Object object){
|
||||
return beanProxyMap.get(object);
|
||||
}
|
||||
|
||||
public static void setProxyByBeanObject(Object object,FXEntityProxy fxEntityProxy){
|
||||
beanProxyMap.put(object,fxEntityProxy);
|
||||
}
|
||||
public static Map<Object, FXEntityProxy> getBeanProxyMap() {
|
||||
return beanProxyMap;
|
||||
}
|
||||
|
||||
public static void setBeanProxyMap(Map<Object, FXEntityProxy> beanProxyMap) {
|
||||
FXPlusContext.beanProxyMap = beanProxyMap;
|
||||
}
|
||||
|
||||
public static Map<String, List<FXBaseController>> getControllerContext() {
|
||||
return controllerContext;
|
||||
}
|
||||
|
||||
public static void setControllerContext(Map<String, List<FXBaseController>> controllerContext) {
|
||||
FXPlusContext.controllerContext = controllerContext;
|
||||
}
|
||||
|
||||
public static Map<String, Object> getSession() {
|
||||
return session;
|
||||
}
|
||||
|
||||
public static void setSession(Map<String, Object> session) {
|
||||
FXPlusContext.session = session;
|
||||
public static Property getEntityPropertyByName(Object object, String fieldName) {
|
||||
return getProxyByBeanObject(object).getPropertyByFieldName(fieldName);
|
||||
}
|
||||
}
|
||||
|
||||