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) {
browser.addLoadListener(new LoadAdapter() {
browser.addScriptContextListener(new ScriptContextAdapter() {
@Override
public void onFinishLoadingFrame(FinishLoadingEvent event) {
if (event.isMainFrame()) {
JSValue ns = event.getBrowser().executeJavaScriptAndReturnValue("window." + namespace);
ns.asObject().setProperty(variable, t);
}
public void onScriptContextCreated(ScriptContextEvent event) {
JSValue ns = event.getBrowser().executeJavaScriptAndReturnValue("window." + namespace);
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();
var create = function (obj, names) {
var name = names.pop();
let arr ="%s".split(".").reverse();
let create = function (obj, names) {
let name = names.pop();
if (!name) {
return;
}

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

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

Loading…
Cancel
Save