JavaFX-Plus v1.beta
This commit is contained in:
12
.idea/artifacts/JavaFx_Plus_jar.xml
generated
Normal file
12
.idea/artifacts/JavaFx_Plus_jar.xml
generated
Normal file
@@ -0,0 +1,12 @@
|
||||
<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
Normal file
16
.idea/compiler.xml
generated
Normal file
@@ -0,0 +1,16 @@
|
||||
<?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
Normal file
13
.idea/libraries/Maven__cglib_cglib_3_1.xml
generated
Normal file
@@ -0,0 +1,13 @@
|
||||
<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
Normal file
13
.idea/libraries/Maven__junit_junit_4_11.xml
generated
Normal file
@@ -0,0 +1,13 @@
|
||||
<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>
|
||||
13
.idea/libraries/Maven__org_hamcrest_hamcrest_core_1_3.xml
generated
Normal file
13
.idea/libraries/Maven__org_hamcrest_hamcrest_core_1_3.xml
generated
Normal file
@@ -0,0 +1,13 @@
|
||||
<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
Normal file
13
.idea/libraries/Maven__org_ow2_asm_asm_4_2.xml
generated
Normal file
@@ -0,0 +1,13 @@
|
||||
<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
Normal file
13
.idea/misc.xml
generated
Normal file
@@ -0,0 +1,13 @@
|
||||
<?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
Normal file
8
.idea/modules.xml
generated
Normal file
@@ -0,0 +1,8 @@
|
||||
<?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
Normal file
124
.idea/uiDesigner.xml
generated
Normal file
@@ -0,0 +1,124 @@
|
||||
<?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>
|
||||
1247
.idea/workspace.xml
generated
Normal file
1247
.idea/workspace.xml
generated
Normal file
File diff suppressed because it is too large
Load Diff
19
JavaFx-Plus.iml
Normal file
19
JavaFx-Plus.iml
Normal file
@@ -0,0 +1,19 @@
|
||||
<?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>
|
||||
BIN
out/artifacts/JavaFx_Plus_jar/JavaFx-Plus.jar
Normal file
BIN
out/artifacts/JavaFx_Plus_jar/JavaFx-Plus.jar
Normal file
Binary file not shown.
42
pom.xml
Normal file
42
pom.xml
Normal file
@@ -0,0 +1,42 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>groupId</groupId>
|
||||
<artifactId>JavaFx-Plus</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<dependency>
|
||||
<groupId>cglib</groupId>
|
||||
<artifactId>cglib</artifactId>
|
||||
<version>3.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>4.11</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<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>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
@@ -0,0 +1,17 @@
|
||||
package cn.edu.scau.biubiusuisui.annotation;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
/**
|
||||
* This is use for marking A controller as FX-Plus Controller
|
||||
* @Author jack
|
||||
* @Date:2019/6/25 1:34
|
||||
*/
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(ElementType.TYPE)
|
||||
@Inherited
|
||||
public @interface FXController {
|
||||
String path();
|
||||
double preWidth() default 0.0;
|
||||
double preHeight() default 0.0;
|
||||
}
|
||||
@@ -0,0 +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;
|
||||
|
||||
/**
|
||||
* @Author jack
|
||||
* @Date:2019/6/25 1:35
|
||||
*/
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(ElementType.TYPE)
|
||||
public @interface FXEntity {
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
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;
|
||||
|
||||
/**
|
||||
* @Author jack
|
||||
* @Date:2019/6/27 20:10
|
||||
*/
|
||||
@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 "";
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package cn.edu.scau.biubiusuisui.annotation;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
/**
|
||||
* @Author jack
|
||||
* @Date:2019/6/25 13:06
|
||||
*/
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Inherited
|
||||
@Target(ElementType.METHOD)
|
||||
public @interface FXReceiver {
|
||||
String name();
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
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;
|
||||
|
||||
/**
|
||||
* @Author jack
|
||||
* @Date:2019/6/25 2:55
|
||||
*/
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(ElementType.TYPE)
|
||||
public @interface FXScan {
|
||||
String[] base() default ".";
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
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;
|
||||
|
||||
/**
|
||||
* This cn.edu.scau.biubiusuisui.annotation is used for a method which can send a signal to all consumer
|
||||
* And FXSender has a name which is used for identifying different method
|
||||
* 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(){
|
||||
*
|
||||
* }
|
||||
* }
|
||||
* 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
|
||||
*/
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(ElementType.METHOD)
|
||||
public @interface FXSender {
|
||||
String name()default "";
|
||||
}
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
package cn.edu.scau.biubiusuisui.annotation;
|
||||
|
||||
/**
|
||||
* @Author jack
|
||||
* @Date:2019/6/25 1:36
|
||||
*/
|
||||
public @interface FXView {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package cn.edu.scau.biubiusuisui.annotation;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
/**
|
||||
* @Author jack
|
||||
* @Date:2019/6/25 1:36
|
||||
*/
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(ElementType.TYPE)
|
||||
@Inherited
|
||||
public @interface FXWindow {
|
||||
double preWidth() default 0.0;
|
||||
double preHeight()default 0.0;
|
||||
String title () ;
|
||||
}
|
||||
3533
src/main/java/cn/edu/scau/biubiusuisui/config/FXMLLoaderPlus.java
Normal file
3533
src/main/java/cn/edu/scau/biubiusuisui/config/FXMLLoaderPlus.java
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,49 @@
|
||||
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 java.lang.annotation.Annotation;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @Author jack
|
||||
* @Date:2019/6/25 2:54
|
||||
*/
|
||||
|
||||
public class FXPlusApplication {
|
||||
|
||||
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();
|
||||
Set<String> sets = new HashSet<>();
|
||||
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){
|
||||
try {
|
||||
loadFXPlusClass(className);
|
||||
} catch (ClassNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void loadFXPlusClass(String className) throws ClassNotFoundException {
|
||||
Class clazz = Class.forName(className);
|
||||
FXFactory.loadFXController(clazz);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
package cn.edu.scau.biubiusuisui.entity;
|
||||
|
||||
import cn.edu.scau.biubiusuisui.annotation.FXController;
|
||||
import cn.edu.scau.biubiusuisui.config.FXMLLoaderPlus;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.scene.layout.Pane;
|
||||
import cn.edu.scau.biubiusuisui.utils.StringUtils;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.lang.annotation.Annotation;
|
||||
import java.net.URL;
|
||||
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>
|
||||
*
|
||||
*/
|
||||
public class FXBaseController extends Pane {
|
||||
|
||||
protected String name = "";
|
||||
|
||||
private boolean isController = false;
|
||||
|
||||
private boolean isWindows = false;
|
||||
|
||||
public FXBaseController(String name){
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public FXBaseController(){
|
||||
FXController fxController = null;
|
||||
Annotation[] annotations = getClass().getAnnotations();
|
||||
// Find FXController cn.edu.scau.biubiusuisui.annotation
|
||||
for (Annotation annotation : annotations) {
|
||||
if (annotation.annotationType().equals(FXController.class)) {
|
||||
fxController = (FXController) annotation;
|
||||
isController = true;
|
||||
}
|
||||
}
|
||||
//load fxml file to show panel in scene builder
|
||||
if(isController) {
|
||||
FXMLLoaderPlus fxmlLoader = new FXMLLoaderPlus(getClass().getClassLoader().getResource(fxController.path()));
|
||||
fxmlLoader.setRoot(this);
|
||||
fxmlLoader.setController(this);
|
||||
try {
|
||||
fxmlLoader.load();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void initialize() {
|
||||
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
if("".equals(name)){
|
||||
return StringUtils.getBaseClassName(getClass().getSimpleName());
|
||||
}else{
|
||||
return StringUtils.getBaseClassName(getClass().getSimpleName()) +"#"+name;
|
||||
}
|
||||
}
|
||||
public void doInit(){}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public boolean isController() {
|
||||
return isController;
|
||||
}
|
||||
|
||||
public void setController(boolean controller) {
|
||||
isController = controller;
|
||||
}
|
||||
|
||||
public boolean isWindows() {
|
||||
return isWindows;
|
||||
}
|
||||
|
||||
public void setWindows(boolean windows) {
|
||||
isWindows = windows;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package cn.edu.scau.biubiusuisui.entity;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
/**
|
||||
* @Author jack
|
||||
* @Date:2019/6/28 10:03
|
||||
*/
|
||||
public class FXFieldMethodMapping {
|
||||
|
||||
private Method setMethod ;
|
||||
private Method addMethod ;
|
||||
private Method delMethod;
|
||||
|
||||
public Method getSetMethod() {
|
||||
return setMethod;
|
||||
}
|
||||
|
||||
public void setSetMethod(Method setMethod) {
|
||||
this.setMethod = setMethod;
|
||||
}
|
||||
|
||||
public Method getAddMethod() {
|
||||
return addMethod;
|
||||
}
|
||||
|
||||
public void setAddMethod(Method addMethod) {
|
||||
this.addMethod = addMethod;
|
||||
}
|
||||
|
||||
public Method getDelMethod() {
|
||||
return delMethod;
|
||||
}
|
||||
|
||||
public void setDelMethod(Method delMethod) {
|
||||
this.delMethod = delMethod;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package cn.edu.scau.biubiusuisui.entity;
|
||||
|
||||
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
|
||||
*/
|
||||
public class FXMethodEntity {
|
||||
|
||||
private FXBaseController fxBaseController;
|
||||
|
||||
private Method method;
|
||||
|
||||
public FXMethodEntity(FXBaseController fxBaseController, Method method) {
|
||||
this.fxBaseController = fxBaseController;
|
||||
this.method = method;
|
||||
}
|
||||
|
||||
public FXBaseController getFxBaseController() {
|
||||
return fxBaseController;
|
||||
}
|
||||
|
||||
public void setFxBaseController(FXBaseController fxBaseController) {
|
||||
this.fxBaseController = fxBaseController;
|
||||
}
|
||||
|
||||
public Method getMethod() {
|
||||
return method;
|
||||
}
|
||||
|
||||
public void setMethod(Method method) {
|
||||
this.method = method;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package cn.edu.scau.biubiusuisui.entity;
|
||||
|
||||
import cn.edu.scau.biubiusuisui.proxy.classProxy.FXEntityProxy;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
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
|
||||
*/
|
||||
public class FXPlusContext {
|
||||
|
||||
private FXPlusContext(){}
|
||||
|
||||
private static Map<String, List<FXBaseController>> controllerContext = new ConcurrentHashMap<>();
|
||||
|
||||
private static Map<Object, FXEntityProxy> beanProxyMap = new ConcurrentHashMap<>();
|
||||
|
||||
public static void addController(FXBaseController fxBaseController){
|
||||
List<FXBaseController> controllers = controllerContext.get(fxBaseController.getName());
|
||||
if(controllers == null){
|
||||
controllers = new LinkedList<>();
|
||||
}
|
||||
controllers.add(fxBaseController);
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
18
src/main/java/cn/edu/scau/biubiusuisui/example/Demo.java
Normal file
18
src/main/java/cn/edu/scau/biubiusuisui/example/Demo.java
Normal file
@@ -0,0 +1,18 @@
|
||||
package cn.edu.scau.biubiusuisui.example;
|
||||
|
||||
import cn.edu.scau.biubiusuisui.annotation.FXScan;
|
||||
import cn.edu.scau.biubiusuisui.config.FXPlusApplication;
|
||||
import javafx.application.Application;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
/**
|
||||
* @Author jack
|
||||
* @Date:2019/6/25 7:05
|
||||
*/
|
||||
@FXScan(base = {"cn.edu.scau.biubiusuisui.example"})
|
||||
public class Demo extends Application {
|
||||
@Override
|
||||
public void start(Stage primaryStage) throws Exception {
|
||||
FXPlusApplication.start(Demo.class);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
package cn.edu.scau.biubiusuisui.example;
|
||||
|
||||
import cn.edu.scau.biubiusuisui.annotation.*;
|
||||
import cn.edu.scau.biubiusuisui.entity.FXBaseController;
|
||||
import cn.edu.scau.biubiusuisui.entity.FXPlusContext;
|
||||
import cn.edu.scau.biubiusuisui.factory.FXEntityFactory;
|
||||
import cn.edu.scau.biubiusuisui.factory.FXFactory;
|
||||
import cn.edu.scau.biubiusuisui.proxy.classProxy.FXEntityProxy;
|
||||
import javafx.beans.property.Property;
|
||||
import javafx.beans.property.SimpleStringProperty;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.Label;
|
||||
|
||||
import java.net.URL;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
/**
|
||||
* @Author jack
|
||||
* @Date:2019/6/25 1:47
|
||||
*/
|
||||
@FXController(path = "Main.fxml")
|
||||
@FXWindow(title = "demo1")
|
||||
public class MainController extends FXBaseController{
|
||||
|
||||
@FXML
|
||||
Button btn;
|
||||
|
||||
@FXML
|
||||
Label label;
|
||||
|
||||
Student student;
|
||||
|
||||
int count = 1;
|
||||
|
||||
@Override
|
||||
public void initialize() {
|
||||
|
||||
student = (Student) FXEntityFactory.getInstance().createJavaBeanProxy(Student.class); //工厂产生一个学生
|
||||
student.setName("Jack"); //设置学生姓名
|
||||
FXEntityProxy fxEntityProxy = FXPlusContext.getProryByBeanObject(student); //获取学生代理
|
||||
Property nameProperty = fxEntityProxy.getPropertyByFieldName("name"); //获取Bean对应的Property
|
||||
label.textProperty().bind(nameProperty); //属性绑定
|
||||
}
|
||||
|
||||
@FXML
|
||||
@FXSender
|
||||
public String send(){
|
||||
student.setName("Jack :" + count);
|
||||
count++;
|
||||
return "sending msg";
|
||||
}
|
||||
|
||||
}
|
||||
53
src/main/java/cn/edu/scau/biubiusuisui/example/Student.java
Normal file
53
src/main/java/cn/edu/scau/biubiusuisui/example/Student.java
Normal file
@@ -0,0 +1,53 @@
|
||||
package cn.edu.scau.biubiusuisui.example;
|
||||
|
||||
import cn.edu.scau.biubiusuisui.annotation.FXEntity;
|
||||
import cn.edu.scau.biubiusuisui.annotation.FXField;
|
||||
|
||||
/**
|
||||
* @Author jack
|
||||
* @Date:2019/6/27 20:02
|
||||
*/
|
||||
@FXEntity
|
||||
public class Student {
|
||||
|
||||
@FXField
|
||||
private String name;
|
||||
|
||||
private int age;
|
||||
|
||||
private String gender;
|
||||
|
||||
private String code;
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public int getAge() {
|
||||
return age;
|
||||
}
|
||||
|
||||
public void setAge(int age) {
|
||||
this.age = age;
|
||||
}
|
||||
|
||||
public String getGender() {
|
||||
return gender;
|
||||
}
|
||||
|
||||
public void setGender(String gender) {
|
||||
this.gender = gender;
|
||||
}
|
||||
|
||||
public String getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(String code) {
|
||||
this.code = code;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package cn.edu.scau.biubiusuisui.exception;
|
||||
|
||||
/**
|
||||
* @Author jack
|
||||
* @Date:2019/6/25 7:23
|
||||
*/
|
||||
public class ProtocolNotSupport extends Exception{
|
||||
public ProtocolNotSupport(){
|
||||
super("protocolNotSupport");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,186 @@
|
||||
package cn.edu.scau.biubiusuisui.factory;
|
||||
|
||||
import cn.edu.scau.biubiusuisui.annotation.FXField;
|
||||
import cn.edu.scau.biubiusuisui.entity.FXPlusContext;
|
||||
import cn.edu.scau.biubiusuisui.function.DefaultEventFunction;
|
||||
import cn.edu.scau.biubiusuisui.proxy.classProxy.FXEntityProxy;
|
||||
import cn.edu.scau.biubiusuisui.utils.ClassUtils;
|
||||
import javafx.beans.property.*;
|
||||
import javafx.beans.value.ChangeListener;
|
||||
|
||||
import java.lang.annotation.Annotation;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Author jack
|
||||
* @Date:2019/6/28 1:12
|
||||
*/
|
||||
public class FXEntityFactory {
|
||||
|
||||
private FXEntityFactory(){}
|
||||
|
||||
private static FXEntityFactory instance = null;
|
||||
|
||||
ChangeListener propertyChangeEvent = new DefaultEventFunction();
|
||||
|
||||
public synchronized static FXEntityFactory getInstance() {
|
||||
if(instance == null){
|
||||
instance = new FXEntityFactory();
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
public Object createJavaBeanProxy(Class clazz) {
|
||||
Object object = null;
|
||||
try {
|
||||
object = clazz.newInstance();
|
||||
} catch (InstantiationException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return createJavaBeanProxy(object);
|
||||
}
|
||||
|
||||
public Object createJavaBeanProxy(Object object){
|
||||
FXEntityProxy fxEntityProxy = new FXEntityProxy();
|
||||
Object objectProxy = null;
|
||||
try {
|
||||
|
||||
objectProxy = fxEntityProxy.getInstance(object);
|
||||
Map<String, Property> stringPropertyMap = FXEntityFactory.getInstance().getEntityProperty(object,objectProxy);
|
||||
fxEntityProxy.setStringPropertyMap(stringPropertyMap);
|
||||
|
||||
FXPlusContext.setProxyByBeanObject(objectProxy, fxEntityProxy);
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return objectProxy;
|
||||
}
|
||||
|
||||
|
||||
public Map<String, Property> getEntityProperty(Object entity,Object proxy) throws IllegalAccessException {
|
||||
Map<String, Property> stringPropertyMap = new HashMap<>();
|
||||
Field []fields = entity.getClass().getDeclaredFields();
|
||||
for(Field field:fields){
|
||||
Annotation annotation = ClassUtils.getAnnotationInList( FXField.class,field.getDeclaredAnnotations());
|
||||
if(annotation != null){
|
||||
Property property;
|
||||
field.setAccessible(true);
|
||||
FXField fxField = (FXField)annotation;
|
||||
if(field.get(entity) == null){
|
||||
if(fxField.readOnly()){
|
||||
property = getReadOnlyFieldDefalutProperty(field);
|
||||
}else{
|
||||
property = getFieldDefalutProperty(field);
|
||||
}
|
||||
|
||||
}else{
|
||||
|
||||
if(fxField.readOnly()){
|
||||
property = getReadOnlyProperty(entity,field);
|
||||
}else{
|
||||
property = getFieldProperty(entity, field);
|
||||
}
|
||||
}
|
||||
if(property !=null) {
|
||||
//添加时间;
|
||||
property.addListener((object,oldVal,newVal)->{
|
||||
|
||||
try {
|
||||
field.set(proxy, newVal);
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
});
|
||||
stringPropertyMap.put(field.getName(), property);
|
||||
}
|
||||
}
|
||||
}
|
||||
return stringPropertyMap;
|
||||
}
|
||||
|
||||
private static Property getFieldProperty(Object object,Field field) throws IllegalAccessException {
|
||||
Class type = field.getType();
|
||||
Object value = field.get(object);
|
||||
Property property = null;
|
||||
if(Boolean.class.equals(type)){
|
||||
property = new SimpleBooleanProperty((Boolean) value);
|
||||
}else if(Double.class.equals(type)){
|
||||
property = new SimpleDoubleProperty((Double) value);
|
||||
}else if (Float.class.equals(type)){
|
||||
property = new SimpleFloatProperty((Float) value);
|
||||
}else if(Integer.class.equals(type)){
|
||||
property = new SimpleIntegerProperty((Integer) value);
|
||||
}else if(Long.class.equals(type)){
|
||||
property = new SimpleLongProperty((Long) value);
|
||||
}else if(String.class.equals(type)){
|
||||
property = new SimpleStringProperty((String) value);
|
||||
}
|
||||
return property;
|
||||
}
|
||||
private static Property getFieldDefalutProperty(Field field) throws IllegalAccessException{
|
||||
Class type = field.getType();
|
||||
Property property = null;
|
||||
if(Boolean.class.equals(type)){
|
||||
property = new SimpleBooleanProperty();
|
||||
}else if(Double.class.equals(type)){
|
||||
property = new SimpleDoubleProperty();
|
||||
}else if (Float.class.equals(type)){
|
||||
property = new SimpleFloatProperty();
|
||||
}else if(Integer.class.equals(type)){
|
||||
property = new SimpleIntegerProperty();
|
||||
}else if(Long.class.equals(type)){
|
||||
property = new SimpleLongProperty();
|
||||
}else if(String.class.equals(type)){
|
||||
property = new SimpleStringProperty();
|
||||
}
|
||||
return property;
|
||||
}
|
||||
private static Property getReadOnlyFieldDefalutProperty(Field field) throws IllegalAccessException{
|
||||
Class type = field.getType();
|
||||
Property property = null;
|
||||
if(Boolean.class.equals(type)){
|
||||
property = new ReadOnlyBooleanWrapper();
|
||||
}else if(Double.class.equals(type)){
|
||||
property = new ReadOnlyDoubleWrapper();
|
||||
}else if (Float.class.equals(type)){
|
||||
property = new ReadOnlyFloatWrapper();
|
||||
}else if(Integer.class.equals(type)){
|
||||
property = new ReadOnlyIntegerWrapper();
|
||||
}else if(Long.class.equals(type)){
|
||||
property = new ReadOnlyLongWrapper();
|
||||
}else if(String.class.equals(type)){
|
||||
property = new ReadOnlyStringWrapper();
|
||||
}
|
||||
return property;
|
||||
}
|
||||
private static Property getReadOnlyProperty(Object object,Field field) throws IllegalAccessException {
|
||||
Class type = field.getType();
|
||||
Object value = field.get(object);
|
||||
Property property = null;
|
||||
if(Boolean.class.equals(type)){
|
||||
property = new ReadOnlyBooleanWrapper((Boolean) value);
|
||||
}else if(Double.class.equals(type)){
|
||||
property = new ReadOnlyDoubleWrapper((Double) value);
|
||||
}else if (Float.class.equals(type)){
|
||||
property = new ReadOnlyFloatWrapper((Float) value);
|
||||
}else if(Integer.class.equals(type)){
|
||||
property = new ReadOnlyIntegerWrapper((Integer) value);
|
||||
}else if(Long.class.equals(type)){
|
||||
property = new ReadOnlyLongWrapper((Long) value);
|
||||
}else if(String.class.equals(type)){
|
||||
property = new ReadOnlyStringWrapper((String) value);
|
||||
}
|
||||
return property;
|
||||
}
|
||||
|
||||
private static Method getFieldMethodMapping(Object object ,Field field){
|
||||
Class clazz = object.getClass();
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
117
src/main/java/cn/edu/scau/biubiusuisui/factory/FXFactory.java
Normal file
117
src/main/java/cn/edu/scau/biubiusuisui/factory/FXFactory.java
Normal file
@@ -0,0 +1,117 @@
|
||||
package cn.edu.scau.biubiusuisui.factory;
|
||||
|
||||
import cn.edu.scau.biubiusuisui.annotation.FXController;
|
||||
import cn.edu.scau.biubiusuisui.annotation.FXWindow;
|
||||
import cn.edu.scau.biubiusuisui.config.FXMLLoaderPlus;
|
||||
import cn.edu.scau.biubiusuisui.entity.FXBaseController;
|
||||
import cn.edu.scau.biubiusuisui.entity.FXPlusContext;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.layout.Pane;
|
||||
import javafx.stage.Stage;
|
||||
import cn.edu.scau.biubiusuisui.messageQueue.MessageQueue;
|
||||
import cn.edu.scau.biubiusuisui.proxy.classProxy.FXControllerProxy;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.lang.annotation.Annotation;
|
||||
import java.net.URL;
|
||||
|
||||
/**
|
||||
* @Author jack
|
||||
* @Date:2019/6/25 8:12
|
||||
*/
|
||||
public class FXFactory {
|
||||
|
||||
|
||||
private FXFactory() {
|
||||
}
|
||||
|
||||
|
||||
public static void loadFXController(Class clazz) {
|
||||
getFXController(clazz, "");
|
||||
}
|
||||
|
||||
public static FXBaseController getFXController(Class clazz) {
|
||||
FXBaseController fxBaseController = getFXController(clazz, "");
|
||||
return fxBaseController;
|
||||
}
|
||||
|
||||
public static FXBaseController getFXController(Class clazz, String controllerName) {
|
||||
FXBaseController fxBaseController = getFxBaseController(clazz, controllerName);
|
||||
return fxBaseController;
|
||||
}
|
||||
|
||||
private static void register(FXBaseController fxBaseController, FXBaseController fxBaseControllerProxy) {
|
||||
FXPlusContext.addController(fxBaseController);
|
||||
MessageQueue.getInstance().registerCosumer(fxBaseController, fxBaseControllerProxy);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param clazz instance that extends by FXBaseController
|
||||
* @param controllerName
|
||||
* @return
|
||||
*/
|
||||
private static FXBaseController getFxBaseController(Class clazz, String controllerName) {
|
||||
Annotation[] annotations = clazz.getAnnotations();
|
||||
Boolean isController = false;
|
||||
URL fxmlPath;
|
||||
Boolean isWindow = false;
|
||||
FXWindow fxWindow = null;
|
||||
FXController fxController = null;
|
||||
//reflect and get FXController cn.edu.scau.biubiusuisui.annotation
|
||||
for (Annotation annotation : annotations) {
|
||||
if (annotation.annotationType().equals(FXController.class)) {
|
||||
fxController = (FXController) annotation;
|
||||
isController = true;
|
||||
} else if (annotation.annotationType().equals(FXWindow.class)) {
|
||||
fxWindow = (FXWindow) annotation;
|
||||
isWindow = true;
|
||||
}
|
||||
}
|
||||
|
||||
Pane parent = null;
|
||||
|
||||
FXBaseController fxControllerProxy = null;
|
||||
FXBaseController fxBaseController = null;
|
||||
|
||||
if (isController) {
|
||||
String name = fxController.path();
|
||||
fxmlPath = clazz.getClassLoader().getResource(name);
|
||||
FXMLLoaderPlus fxmlLoader = new FXMLLoaderPlus(fxmlPath);
|
||||
try {
|
||||
// create a cn.edu.scau.biubiusuisui.proxy for monitoring methods
|
||||
fxBaseController = (FXBaseController) clazz.newInstance();
|
||||
FXControllerProxy controllerProxy = new FXControllerProxy();
|
||||
fxControllerProxy = (FXBaseController) controllerProxy.getInstance(fxBaseController);
|
||||
fxControllerProxy.setName(controllerName);
|
||||
fxBaseController.setName(controllerName);
|
||||
|
||||
} catch (InstantiationException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
fxmlLoader.setRoot(fxControllerProxy);
|
||||
fxmlLoader.setController(fxControllerProxy);
|
||||
try {
|
||||
parent = fxmlLoader.load();
|
||||
} catch (IOException exception) {
|
||||
throw new RuntimeException(exception);
|
||||
}
|
||||
}else{
|
||||
return null;
|
||||
}
|
||||
//register
|
||||
register(fxBaseController, fxControllerProxy);
|
||||
if (isWindow) {
|
||||
Stage stage = new Stage();
|
||||
double preWidth = fxWindow.preWidth() == 0 ? parent.getPrefWidth() : fxWindow.preWidth();
|
||||
double preHeight = fxWindow.preHeight() == 0 ? parent.getPrefWidth() : fxWindow.preHeight();
|
||||
Scene scene = new Scene(fxControllerProxy, preWidth, preHeight);
|
||||
stage.setScene(scene);
|
||||
stage.setTitle(fxWindow.title());
|
||||
stage.show();
|
||||
}
|
||||
return fxControllerProxy;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package cn.edu.scau.biubiusuisui.function;
|
||||
|
||||
import javafx.beans.value.ChangeListener;
|
||||
import javafx.beans.value.ObservableValue;
|
||||
|
||||
/**
|
||||
* @Author jack
|
||||
* @Date:2019/6/28 15:57
|
||||
*/
|
||||
|
||||
public class DefaultEventFunction implements ChangeListener {
|
||||
|
||||
public DefaultEventFunction() {}
|
||||
|
||||
@Override
|
||||
public void changed(ObservableValue observable, Object oldValue, Object newValue) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
package cn.edu.scau.biubiusuisui.messageQueue;
|
||||
|
||||
import cn.edu.scau.biubiusuisui.annotation.FXReceiver;
|
||||
import cn.edu.scau.biubiusuisui.entity.FXBaseController;
|
||||
import cn.edu.scau.biubiusuisui.entity.FXMethodEntity;
|
||||
|
||||
import java.lang.annotation.Annotation;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
/**
|
||||
* @Author jack
|
||||
* @Date:2019/6/25 12:24
|
||||
*/
|
||||
|
||||
public class MessageQueue {
|
||||
|
||||
|
||||
private static Map<String, List<FXMethodEntity>> receivers = new ConcurrentHashMap<>();
|
||||
|
||||
private static MessageQueue messageQueue = null;
|
||||
|
||||
private MessageQueue(){ }
|
||||
|
||||
public static synchronized MessageQueue getInstance(){
|
||||
if(messageQueue == null){
|
||||
messageQueue = new MessageQueue();
|
||||
}
|
||||
return messageQueue;
|
||||
}
|
||||
|
||||
public void registerCosumer(FXBaseController fxBaseController,FXBaseController fxBaseControllerProxy){
|
||||
Class clazz = fxBaseController.getClass();
|
||||
Method [] methods = clazz.getDeclaredMethods();
|
||||
for(Method method : methods){
|
||||
Annotation[]annotations = method.getDeclaredAnnotations();
|
||||
for(Annotation annotation : annotations){
|
||||
if(FXReceiver.class.equals(annotation.annotationType())){
|
||||
FXReceiver receiver = (FXReceiver)annotation;
|
||||
FXMethodEntity fxMethodEntity = new FXMethodEntity(fxBaseControllerProxy,method);
|
||||
List<FXMethodEntity> fxMethodEntities = receivers.get(receiver.name());
|
||||
if(fxMethodEntities == null){
|
||||
fxMethodEntities = new ArrayList<>();
|
||||
}
|
||||
fxMethodEntities.add(fxMethodEntity);
|
||||
receivers.put(receiver.name(), fxMethodEntities);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void sendMsg(String id,Object msg) {
|
||||
List<FXMethodEntity> lists = receivers.get(id);
|
||||
if (lists != null) {
|
||||
for (FXMethodEntity fxMethodEntity : lists) {
|
||||
Method method = fxMethodEntity.getMethod();
|
||||
FXBaseController fxBaseController = fxMethodEntity.getFxBaseController();
|
||||
if (method.getParameterCount() == 0) {
|
||||
try {
|
||||
method.invoke(fxBaseController);
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
} catch (InvocationTargetException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
method.invoke(fxBaseController, msg);
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
} catch (InvocationTargetException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package cn.edu.scau.biubiusuisui.proxy.classProxy;
|
||||
|
||||
import cn.edu.scau.biubiusuisui.annotation.FXSender;
|
||||
import cn.edu.scau.biubiusuisui.entity.FXBaseController;
|
||||
import cn.edu.scau.biubiusuisui.messageQueue.MessageQueue;
|
||||
import net.sf.cglib.proxy.Enhancer;
|
||||
import net.sf.cglib.proxy.MethodInterceptor;
|
||||
import net.sf.cglib.proxy.MethodProxy;
|
||||
|
||||
import java.lang.annotation.Annotation;
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
/**
|
||||
*
|
||||
* This proxy class intercept Methods that has special annotation such as
|
||||
* FXSender which is a mark for message queue
|
||||
*
|
||||
* @Author jack
|
||||
* @Date:2019/6/25 2:03
|
||||
*/
|
||||
public class FXControllerProxy implements MethodInterceptor {
|
||||
|
||||
|
||||
FXBaseController target;
|
||||
|
||||
public Object getInstance(FXBaseController target) {
|
||||
this.target = target;
|
||||
Enhancer enhancer = new Enhancer();
|
||||
enhancer.setSuperclass(this.target.getClass());
|
||||
enhancer.setCallback(this);
|
||||
return enhancer.create();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object intercept(Object o, Method method, Object[] objects, MethodProxy methodProxy) throws Throwable {
|
||||
Object o1 = methodProxy.invokeSuper(o, objects);
|
||||
Annotation []annotations = method.getDeclaredAnnotations();
|
||||
for(Annotation annotation : annotations){
|
||||
if(FXSender.class.equals(annotation.annotationType())){
|
||||
FXSender fxSender = (FXSender)annotation;
|
||||
String name = target.getName() +":";
|
||||
if("".equals(fxSender.name())){
|
||||
name += method.getName();
|
||||
}else{
|
||||
name += fxSender.name();
|
||||
}
|
||||
|
||||
MessageQueue.getInstance().sendMsg(name,o1);
|
||||
}
|
||||
}
|
||||
return o1;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
package cn.edu.scau.biubiusuisui.proxy.classProxy;
|
||||
|
||||
import cn.edu.scau.biubiusuisui.entity.FXFieldMethodMapping;
|
||||
import cn.edu.scau.biubiusuisui.utils.StringUtils;
|
||||
import javafx.beans.property.ListProperty;
|
||||
import javafx.beans.property.Property;
|
||||
import javafx.beans.property.SimpleStringProperty;
|
||||
import net.sf.cglib.proxy.Enhancer;
|
||||
import net.sf.cglib.proxy.MethodInterceptor;
|
||||
import net.sf.cglib.proxy.MethodProxy;
|
||||
|
||||
import java.lang.annotation.Annotation;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Author jack
|
||||
* @Date:2019/6/27 18:47
|
||||
*/
|
||||
public class FXEntityProxy implements MethodInterceptor {
|
||||
|
||||
Object target;
|
||||
|
||||
private Map<String, Property> stringPropertyMap;
|
||||
private Map<String, FXFieldMethodMapping> stringFXFieldMethodMappingMap;
|
||||
|
||||
public Object getInstance(Object target) {
|
||||
this.target = target;
|
||||
Enhancer enhancer = new Enhancer();
|
||||
enhancer.setSuperclass(this.target.getClass());
|
||||
enhancer.setCallback(this);
|
||||
return enhancer.create();
|
||||
}
|
||||
|
||||
/**
|
||||
* intercept get and set method and
|
||||
*
|
||||
* @param o
|
||||
* @param method
|
||||
* @param objects
|
||||
* @param methodProxy
|
||||
* @return
|
||||
* @throws Throwable
|
||||
*/
|
||||
@Override
|
||||
public Object intercept(Object o, Method method, Object[] objects, MethodProxy methodProxy) throws Throwable {
|
||||
Object o1 = methodProxy.invokeSuper(o, objects);
|
||||
|
||||
String methodName = method.getName();
|
||||
String fieldName = null;
|
||||
if (methodName.length() >= 3) {
|
||||
fieldName = StringUtils.toInstanceName(methodName.substring(3));
|
||||
} else {
|
||||
return o1;
|
||||
}
|
||||
|
||||
|
||||
SimpleStringProperty property = (SimpleStringProperty) stringPropertyMap.get(fieldName);
|
||||
|
||||
if (methodName.startsWith("set")) {
|
||||
property.set((String) objects[0]);
|
||||
}
|
||||
//修改
|
||||
return o1;
|
||||
}
|
||||
|
||||
public Object getTarget() {
|
||||
return target;
|
||||
}
|
||||
|
||||
public void setTarget(Object target) {
|
||||
this.target = target;
|
||||
}
|
||||
|
||||
public Property getPropertyByFieldName(String name) {
|
||||
return stringPropertyMap.get(name);
|
||||
}
|
||||
|
||||
public Map<String, Property> getStringPropertyMap() {
|
||||
return stringPropertyMap;
|
||||
}
|
||||
|
||||
public void setStringPropertyMap(Map<String, Property> stringPropertyMap) {
|
||||
this.stringPropertyMap = stringPropertyMap;
|
||||
}
|
||||
}
|
||||
100
src/main/java/cn/edu/scau/biubiusuisui/utils/ClassUtils.java
Normal file
100
src/main/java/cn/edu/scau/biubiusuisui/utils/ClassUtils.java
Normal file
@@ -0,0 +1,100 @@
|
||||
package cn.edu.scau.biubiusuisui.utils;
|
||||
|
||||
import java.io.File;
|
||||
import java.lang.annotation.Annotation;
|
||||
import java.net.URL;
|
||||
import java.util.Arrays;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author jack
|
||||
* @Date:2019/6/25 5:20
|
||||
*/
|
||||
public class ClassUtils {
|
||||
private ClassLoader cl;
|
||||
|
||||
public ClassUtils() {
|
||||
cl = getClass().getClassLoader();
|
||||
}
|
||||
|
||||
private List<String> getAllFXControllerClassName(String base, List<String> nameList) {
|
||||
String splashPath = StringUtils.dotToSplash(base);
|
||||
URL url = cl.getResource(splashPath);
|
||||
String filePath = StringUtils.getRootPath(url);
|
||||
List<String> names = null;
|
||||
names = readFromDirectory(filePath);
|
||||
for (String name : names) {
|
||||
if (isClassFile(name)) {
|
||||
nameList.add(toFullyQualifiedName(name, base));
|
||||
} else if (isDirectory(name)){
|
||||
nameList = getAllFXControllerClassName(base + "." + name, nameList);
|
||||
}
|
||||
}
|
||||
return nameList;
|
||||
}
|
||||
|
||||
public List<String> scanAllClassName(String base) {
|
||||
return getAllFXControllerClassName(base, new LinkedList<>());
|
||||
}
|
||||
|
||||
private static String toFullyQualifiedName(String shortName, String basePackage) {
|
||||
StringBuilder sb = new StringBuilder(basePackage);
|
||||
sb.append('.');
|
||||
sb.append(StringUtils.trimExtension(shortName));
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
private static boolean isClassFile(String name) {
|
||||
return name.endsWith(".class");
|
||||
}
|
||||
private static boolean isDirectory(String name){
|
||||
return !name.contains(".");
|
||||
}
|
||||
private static List<String> readFromDirectory(String path) {
|
||||
File file = new File(path);
|
||||
String[] names = file.list();
|
||||
if (null == names) {
|
||||
return null;
|
||||
} else {
|
||||
return Arrays.asList(names);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static boolean hasDeclaredAnnotation(Class clazz, Class annotation){
|
||||
if(annotation == null){
|
||||
return false;
|
||||
}
|
||||
if (hasAnnotationInList(annotation, clazz.getDeclaredAnnotations())) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean hasAnnotation(Class clazz, Class annotation) {
|
||||
if(annotation == null){
|
||||
return false;
|
||||
}
|
||||
if (hasAnnotationInList(annotation, clazz.getAnnotations())) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean hasAnnotationInList(Class annotation, Annotation[] annotations2) {
|
||||
if(getAnnotationInList(annotation,annotations2) == null){
|
||||
return false;
|
||||
}else{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public static Annotation getAnnotationInList(Class annotation,Annotation[]annotations){
|
||||
if(annotations == null || annotation == null){
|
||||
return null;
|
||||
}
|
||||
for (Annotation annotation1 : annotations) {
|
||||
if (annotation1.annotationType().equals(annotation)) {
|
||||
return annotation1;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
17
src/main/java/cn/edu/scau/biubiusuisui/utils/FileUtils.java
Normal file
17
src/main/java/cn/edu/scau/biubiusuisui/utils/FileUtils.java
Normal file
@@ -0,0 +1,17 @@
|
||||
package cn.edu.scau.biubiusuisui.utils;
|
||||
|
||||
import cn.edu.scau.biubiusuisui.exception.ProtocolNotSupport;
|
||||
|
||||
import java.net.URL;
|
||||
|
||||
/**
|
||||
* @Author jack
|
||||
* @Date:2019/6/25 7:01
|
||||
*/
|
||||
public class FileUtils {
|
||||
|
||||
|
||||
public URL getFXMLFile(String fxmlFilePath) throws ProtocolNotSupport {
|
||||
return this.getClass().getClassLoader().getResource(fxmlFilePath);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
package cn.edu.scau.biubiusuisui.utils;
|
||||
|
||||
/**
|
||||
* @Author jack
|
||||
* @Date:2019/6/25 3:46
|
||||
*/
|
||||
import java.net.URL;
|
||||
|
||||
public class StringUtils {
|
||||
private StringUtils() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* "file:/home/whf/cn/fh" -> "/home/whf/cn/fh"
|
||||
* "jar:file:/home/whf/foo.jar!cn/fh" -> "/home/whf/foo.jar"
|
||||
*/
|
||||
public static String getRootPath(URL url) {
|
||||
String fileUrl = url.getFile();
|
||||
int pos = fileUrl.indexOf('!');
|
||||
|
||||
if (-1 == pos) {
|
||||
return fileUrl;
|
||||
}
|
||||
|
||||
return fileUrl.substring(5, pos);
|
||||
}
|
||||
|
||||
/**
|
||||
* "cn.fh.lightning" -> "cn/fh/lightning"
|
||||
*
|
||||
* @param name
|
||||
* @return
|
||||
*/
|
||||
public static String dotToSplash(String name) {
|
||||
return name.replaceAll("\\.", "/");
|
||||
}
|
||||
|
||||
/**
|
||||
* "Apple.class" -> "Apple"
|
||||
*/
|
||||
public static String trimExtension(String name) {
|
||||
int pos = name.indexOf('.');
|
||||
if (-1 != pos) {
|
||||
return name.substring(0, pos);
|
||||
}
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* /application/home -> /home
|
||||
*
|
||||
* @param uri
|
||||
* @return
|
||||
*/
|
||||
public static String trimURI(String uri) {
|
||||
String trimmed = uri.substring(1);
|
||||
int splashIndex = trimmed.indexOf('/');
|
||||
|
||||
return trimmed.substring(splashIndex);
|
||||
}
|
||||
|
||||
public static String getBaseClassName(String name){
|
||||
int index = name.indexOf("$");
|
||||
if(index == -1){
|
||||
return name;
|
||||
}
|
||||
return name.substring(0,index);
|
||||
}
|
||||
|
||||
|
||||
public static String toInstanceName(String name){
|
||||
String result = name.substring(0, 1).toLowerCase().concat(name.substring(1));
|
||||
return result;
|
||||
}
|
||||
|
||||
public static String toClassName(String name){
|
||||
String result = name.substring(0, 1).toUpperCase().concat(name.substring(1));
|
||||
return result;
|
||||
}
|
||||
}
|
||||
12
src/main/resources/Main.fxml
Normal file
12
src/main/resources/Main.fxml
Normal file
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import javafx.scene.control.Button?>
|
||||
<?import javafx.scene.control.Label?>
|
||||
<?import javafx.scene.layout.Pane?>
|
||||
|
||||
<fx:root prefHeight="400.0" prefWidth="600.0" type="Pane" xmlns="http://javafx.com/javafx/8.0.172-ea" xmlns:fx="http://javafx.com/fxml/1" fx:controller="cn.edu.scau.biubiusuisui.example.MainController">
|
||||
<children>
|
||||
<Button fx:id="btn" layoutX="366.0" layoutY="159.0" mnemonicParsing="false" text="Button" onAction="#send"/>
|
||||
<Label fx:id="label" layoutX="130.0" layoutY="159.0" prefHeight="30.0" prefWidth="184.0" text="JavaFX Plus is awesome!" />
|
||||
</children>
|
||||
</fx:root>
|
||||
10
src/main/resources/Main2.fxml
Normal file
10
src/main/resources/Main2.fxml
Normal file
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import javafx.scene.control.Button?>
|
||||
<?import javafx.scene.layout.Pane?>
|
||||
|
||||
<fx:root prefHeight="400.0" prefWidth="600.0" type="Pane" xmlns="http://javafx.com/javafx/8.0.171" xmlns:fx="http://javafx.com/fxml/1" fx:controller="cn.edu.scau.biubiusuisui.example.MainController">
|
||||
<children>
|
||||
<Button fx:id="btn" layoutX="266.0" layoutY="179.0" mnemonicParsing="false" text="Button" />
|
||||
</children>
|
||||
</fx:root>
|
||||
1
src/main/resources/index.js
Normal file
1
src/main/resources/index.js
Normal file
@@ -0,0 +1 @@
|
||||
console.log('123123');
|
||||
14
src/test/java/MainTest.java
Normal file
14
src/test/java/MainTest.java
Normal file
@@ -0,0 +1,14 @@
|
||||
import cn.edu.scau.biubiusuisui.example.Student;
|
||||
import cn.edu.scau.biubiusuisui.factory.FXEntityFactory;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* @Author jack
|
||||
* @Date:2019/6/25 2:11
|
||||
*/
|
||||
public class MainTest {
|
||||
@Test
|
||||
public void test(){
|
||||
FXEntityFactory fxEntityFactory = FXEntityFactory.getInstance();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
package cn.edu.scau.biubiusuisui.factory;
|
||||
|
||||
import cn.edu.scau.biubiusuisui.annotation.FXEntity;
|
||||
import cn.edu.scau.biubiusuisui.entity.FXPlusContext;
|
||||
import cn.edu.scau.biubiusuisui.example.Student;
|
||||
import javafx.beans.property.Property;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* @Author jack
|
||||
* @Date:2019/6/28 1:32
|
||||
*/
|
||||
public class FXEntityFactoryTest {
|
||||
|
||||
@Test
|
||||
public void getClassProperty() {
|
||||
FXEntityFactory fxEntityFactory =FXEntityFactory.getInstance();
|
||||
Student student = new Student();
|
||||
student.setName("Jack");
|
||||
try {
|
||||
Map<String, Property> entityProperty = fxEntityFactory.getEntityProperty(student,null);
|
||||
entityProperty.forEach((k,v)->{
|
||||
System.out.println("key" + k +" v" + v);
|
||||
});
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getInstance() {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void createJavaBeanProxy() {
|
||||
Student student = new Student();
|
||||
student.setName("NAME");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void createJavaBeanProxy2() throws InstantiationException, IllegalAccessException {
|
||||
Student student1 = (Student) FXEntityFactory.getInstance().createJavaBeanProxy(Student.class);
|
||||
System.out.println(student1);
|
||||
FXPlusContext.getProryByBeanObject(student1).getStringPropertyMap().forEach((k,v)->{
|
||||
System.out.println("k " +k +"v" + v);
|
||||
});
|
||||
student1.setName("Jack");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getEntityProperty() {
|
||||
}
|
||||
}
|
||||
BIN
target/classes/META-INF/JavaFx-Plus.kotlin_module
Normal file
BIN
target/classes/META-INF/JavaFx-Plus.kotlin_module
Normal file
Binary file not shown.
12
target/classes/Main.fxml
Normal file
12
target/classes/Main.fxml
Normal file
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import javafx.scene.control.Button?>
|
||||
<?import javafx.scene.control.Label?>
|
||||
<?import javafx.scene.layout.Pane?>
|
||||
|
||||
<fx:root prefHeight="400.0" prefWidth="600.0" type="Pane" xmlns="http://javafx.com/javafx/8.0.172-ea" xmlns:fx="http://javafx.com/fxml/1" fx:controller="cn.edu.scau.biubiusuisui.example.MainController">
|
||||
<children>
|
||||
<Button fx:id="btn" layoutX="366.0" layoutY="159.0" mnemonicParsing="false" text="Button" onAction="#send"/>
|
||||
<Label fx:id="label" layoutX="130.0" layoutY="159.0" prefHeight="30.0" prefWidth="184.0" text="JavaFX Plus is awesome!" />
|
||||
</children>
|
||||
</fx:root>
|
||||
10
target/classes/Main2.fxml
Normal file
10
target/classes/Main2.fxml
Normal file
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import javafx.scene.control.Button?>
|
||||
<?import javafx.scene.layout.Pane?>
|
||||
|
||||
<fx:root prefHeight="400.0" prefWidth="600.0" type="Pane" xmlns="http://javafx.com/javafx/8.0.171" xmlns:fx="http://javafx.com/fxml/1" fx:controller="cn.edu.scau.biubiusuisui.example.MainController">
|
||||
<children>
|
||||
<Button fx:id="btn" layoutX="266.0" layoutY="179.0" mnemonicParsing="false" text="Button" />
|
||||
</children>
|
||||
</fx:root>
|
||||
Binary file not shown.
Binary file not shown.
BIN
target/classes/cn/edu/scau/biubiusuisui/annotation/FXField.class
Normal file
BIN
target/classes/cn/edu/scau/biubiusuisui/annotation/FXField.class
Normal file
Binary file not shown.
Binary file not shown.
BIN
target/classes/cn/edu/scau/biubiusuisui/annotation/FXScan.class
Normal file
BIN
target/classes/cn/edu/scau/biubiusuisui/annotation/FXScan.class
Normal file
Binary file not shown.
Binary file not shown.
BIN
target/classes/cn/edu/scau/biubiusuisui/annotation/FXView.class
Normal file
BIN
target/classes/cn/edu/scau/biubiusuisui/annotation/FXView.class
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
target/classes/cn/edu/scau/biubiusuisui/example/Demo.class
Normal file
BIN
target/classes/cn/edu/scau/biubiusuisui/example/Demo.class
Normal file
Binary file not shown.
Binary file not shown.
BIN
target/classes/cn/edu/scau/biubiusuisui/example/Student.class
Normal file
BIN
target/classes/cn/edu/scau/biubiusuisui/example/Student.class
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user