Browse Source

无JIRA任务 修改populate的时候的一个小bug

bugfix/10.0
richie 6 years ago
parent
commit
da86f47dde
  1. 10
      designer-base/src/main/java/com/fr/design/ui/ModernUIPane.java
  2. 6
      designer-base/src/main/resources/com/fr/design/ui/InitNameSpace.js
  3. 6
      designer-base/src/test/resources/com/fr/design/ui/demo.html

10
designer-base/src/main/java/com/fr/design/ui/ModernUIPane.java

@ -105,13 +105,11 @@ public class ModernUIPane<T> extends BasicPane {
public void populate(final T t) { public void populate(final T t) {
browser.addLoadListener(new LoadAdapter() { browser.addScriptContextListener(new ScriptContextAdapter() {
@Override @Override
public void onFinishLoadingFrame(FinishLoadingEvent event) { public void onScriptContextCreated(ScriptContextEvent event) {
if (event.isMainFrame()) { JSValue ns = event.getBrowser().executeJavaScriptAndReturnValue("window." + namespace);
JSValue ns = event.getBrowser().executeJavaScriptAndReturnValue("window." + namespace); ns.asObject().setProperty(variable, t);
ns.asObject().setProperty(variable, t);
}
} }
}); });
} }

6
designer-base/src/main/resources/com/fr/design/ui/InitNameSpace.js

@ -1,6 +1,6 @@
var arr ="%s".split(".").reverse(); let arr ="%s".split(".").reverse();
var create = function (obj, names) { let create = function (obj, names) {
var name = names.pop(); let name = names.pop();
if (!name) { if (!name) {
return; return;
} }

6
designer-base/src/test/resources/com/fr/design/ui/demo.html

@ -10,6 +10,12 @@
return Pool.data; return Pool.data;
}; };
</script> </script>
<script type="text/javascript">
window.onload = function () {
document.getElementById("name").value = Pool.data.getName();
document.getElementById("age").value = Pool.data.getAge();
};
</script>
</head> </head>
<body> <body>
<div>测试页面,请点击最下面的按钮</div> <div>测试页面,请点击最下面的按钮</div>

Loading…
Cancel
Save