支持函数表达式和change表达式
This commit is contained in:
@@ -1,43 +1,13 @@
|
||||
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{
|
||||
public class ExpressionParserTest {
|
||||
|
||||
@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");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package cn.edu.scau.biubiusuisui.expression.data;
|
||||
|
||||
import cn.edu.scau.biubiusuisui.annotation.FXValue;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* @Author jack
|
||||
* @Date:2019/7/27 3:13
|
||||
*/
|
||||
public class ExpressionParserTest {
|
||||
|
||||
private ExpressionParser expressionParser;
|
||||
@Before
|
||||
public void init(){
|
||||
expressionParser = new ExpressionParser(null);
|
||||
}
|
||||
@Test
|
||||
public void parse() {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getArgs() throws NoSuchMethodException {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,5 @@
|
||||
package cn.edu.scau.biubiusuisui.factory;
|
||||
|
||||
import cn.edu.scau.biubiusuisui.entity.FXPlusContext;
|
||||
import cn.edu.scau.biubiusuisui.example.Student;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
@@ -36,12 +34,12 @@ public class FXEntityFactoryTest {
|
||||
|
||||
@Test
|
||||
public void createJavaBeanProxy2() throws InstantiationException, IllegalAccessException {
|
||||
Student student1 = (Student) FXEntityFactory.createJavaBeanProxy(Student.class);
|
||||
System.out.println(student1);
|
||||
FXPlusContext.getProxyByBeanObject(student1).getStringPropertyMap().forEach((k, v)->{
|
||||
System.out.println("k " +k +"v" + v);
|
||||
});
|
||||
student1.setName("Jack");
|
||||
// Student student1 = (Student) FXEntityFactory.createJavaBeanProxy(Student.class);
|
||||
// System.out.println(student1);
|
||||
// FXPlusContext.getProxyByBeanObject(student1).getStringPropertyMap().forEach((k, v)->{
|
||||
// System.out.println("k " +k +"v" + v);
|
||||
// });
|
||||
// student1.setName("Jack");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user