解决spring的Bug以及实现了EL表达式绑定基本元素属性
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
package cn.edu.scau.biubiusuisui.expression;
|
||||
|
||||
import cn.edu.scau.biubiusuisui.annotation.FXEntity;
|
||||
import cn.edu.scau.biubiusuisui.example.Student;
|
||||
import cn.edu.scau.biubiusuisui.factory.FXEntityFactory;
|
||||
import javafx.application.Application;
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.collections.ObservableMap;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.cell.PropertyValueFactory;
|
||||
import javafx.stage.Stage;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* @Author jack
|
||||
* @Date:2019/7/24 11:55
|
||||
*/
|
||||
public class ExpressionParserTest extends Application{
|
||||
|
||||
@Override
|
||||
public void start(Stage primaryStage) throws Exception {
|
||||
// test - ok
|
||||
Label label = new Label("text");
|
||||
ObservableMap<String, Object> namespace = FXCollections.observableHashMap();
|
||||
Student student = new Student();
|
||||
Student studentProxy = (Student) FXEntityFactory.createJavaBeanProxy(student);
|
||||
studentProxy.setName("jack");
|
||||
namespace.put("student", studentProxy);
|
||||
ExpressionParser expressionParser = new ExpressionParser(namespace);
|
||||
expressionParser.parse(label,"text=${student.name}");
|
||||
System.out.println(label.textProperty());
|
||||
studentProxy.setName("jack-modified");
|
||||
System.out.println(label.textProperty());
|
||||
System.out.println(label.textProperty().getValue());
|
||||
}
|
||||
|
||||
public void testValueFactory(){
|
||||
new PropertyValueFactory("password");
|
||||
}
|
||||
}
|
||||
@@ -2,11 +2,8 @@ package cn.edu.scau.biubiusuisui.factory;
|
||||
|
||||
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;
|
||||
|
||||
/**
|
||||
* @Author jack
|
||||
* @Date:2019/6/28 1:32
|
||||
@@ -34,15 +31,14 @@ public class FXEntityFactoryTest {
|
||||
|
||||
@Test
|
||||
public void createJavaBeanProxy() {
|
||||
Student student = new Student();
|
||||
student.setName("NAME");
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void createJavaBeanProxy2() throws InstantiationException, IllegalAccessException {
|
||||
Student student1 = (Student) FXEntityFactory.createJavaBeanProxy(Student.class);
|
||||
System.out.println(student1);
|
||||
FXPlusContext.getProryByBeanObject(student1).getStringPropertyMap().forEach((k,v)->{
|
||||
FXPlusContext.getProxyByBeanObject(student1).getStringPropertyMap().forEach((k, v)->{
|
||||
System.out.println("k " +k +"v" + v);
|
||||
});
|
||||
student1.setName("Jack");
|
||||
|
||||
Reference in New Issue
Block a user