Browse Source

Merge pull request #906 in DESIGN/design from ~RICHIE/design:release/10.0 to release/10.0

* commit '09b9832a40a0a711cee131c8c728169223456bb3':
  新方法
  完善一下API
  KERNEL-594 新插件管理版本检查
  KERNEL-493 上传测试文件
  KERNEL-493 设计器数据交换部分的API示例
bugfix/10.0
richie 6 years ago
parent
commit
7ea6695bf6
  1. 4
      designer-base/src/main/java/com/fr/design/actions/server/ConnectionListAction.java
  2. 12
      designer-base/src/main/java/com/fr/design/dcm/UniversalDatabaseComponent.java
  3. 8
      designer-base/src/main/java/com/fr/design/dcm/UniversalDatabaseDialog.java
  4. 8
      designer-base/src/main/java/com/fr/design/dcm/UniversalDatabaseOpener.java
  5. 11
      designer-base/src/main/java/com/fr/design/dcm/UniversalDatabasePane.java
  6. 34
      designer-base/src/main/java/com/fr/design/dcm/UniversalDcmBridge.java
  7. 28
      designer-base/src/main/java/com/fr/design/upm/UpmBridge.java
  8. 27
      designer-base/src/main/java/com/fr/design/upm/loader/UpmDesignResourceLoader.java
  9. 2
      designer-base/src/main/resources/com/fr/design/dcm/index.js
  10. 276
      designer-base/src/main/resources/com/fr/design/dcm/style.css
  11. 57
      designer-base/src/main/resources/com/fr/design/upm/database/database.js
  12. 2
      designer-base/src/main/resources/com/fr/design/upm/warn.js

4
designer-base/src/main/java/com/fr/design/actions/server/ConnectionListAction.java

@ -13,7 +13,7 @@ import com.fr.design.gui.NameInspector;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.DesignerFrame;
import com.fr.design.menu.MenuKeySet;
import com.fr.design.upm.database.UniverseDatabaseOpener;
import com.fr.design.dcm.UniversalDatabaseOpener;
import com.fr.file.ConnectionConfig;
import com.fr.general.IOUtils;
import com.fr.transaction.CallBackAdaptor;
@ -61,7 +61,7 @@ public class ConnectionListAction extends UpdateAction {
*/
public void actionPerformed(ActionEvent evt) {
if (ServerPreferenceConfig.getInstance().isUseUniverseDBM()) {
UniverseDatabaseOpener.showUniverseDatabaseDialog();
UniversalDatabaseOpener.showUniverseDatabaseDialog();
} else {
openDesignDatabaseManager();
}

12
designer-base/src/main/java/com/fr/design/upm/database/UniverseDatabaseComponent.java → designer-base/src/main/java/com/fr/design/dcm/UniversalDatabaseComponent.java

@ -1,4 +1,4 @@
package com.fr.design.upm.database;
package com.fr.design.dcm;
import com.fr.web.struct.AssembleComponent;
import com.fr.web.struct.Atom;
@ -12,22 +12,22 @@ import com.fr.web.struct.impl.FineUI;
* @version 10.0
* Created by richie on 2019-05-16
*/
public class UniverseDatabaseComponent extends AssembleComponent {
public class UniversalDatabaseComponent extends AssembleComponent {
public static final UniverseDatabaseComponent KEY = new UniverseDatabaseComponent();
public static final UniversalDatabaseComponent KEY = new UniversalDatabaseComponent();
private UniverseDatabaseComponent() {
private UniversalDatabaseComponent() {
}
@Override
public ScriptPath script(RequestClient req) {
return ScriptPath.build("/com/fr/design/upm/database/database.js");
return ScriptPath.build("/com/fr/design/dcm/index.js");
}
@Override
public StylePath style(RequestClient req) {
return StylePath.EMPTY;
return StylePath.build("/com/fr/design/dcm/style.css");
}
@Override

8
designer-base/src/main/java/com/fr/design/upm/database/UniverseDatabaseDialog.java → designer-base/src/main/java/com/fr/design/dcm/UniversalDatabaseDialog.java

@ -1,4 +1,4 @@
package com.fr.design.upm.database;
package com.fr.design.dcm;
import com.fr.design.dialog.BasicPane;
import com.fr.design.dialog.UIDialog;
@ -12,15 +12,15 @@ import java.awt.*;
* @version 10.0
* Created by richie on 2019-05-16
*/
public class UniverseDatabaseDialog extends UIDialog {
public class UniversalDatabaseDialog extends UIDialog {
public UniverseDatabaseDialog(Frame frame, BasicPane pane) {
public UniversalDatabaseDialog(Frame frame, BasicPane pane) {
super(frame);
setUndecorated(true);
JPanel panel = (JPanel) getContentPane();
panel.setLayout(new BorderLayout());
add(pane, BorderLayout.CENTER);
setSize(new Dimension(800, 500));
setSize(new Dimension(1000, 600));
GUICoreUtils.centerWindow(this);
setResizable(false);
}

8
designer-base/src/main/java/com/fr/design/upm/database/UniverseDatabaseOpener.java → designer-base/src/main/java/com/fr/design/dcm/UniversalDatabaseOpener.java

@ -1,4 +1,4 @@
package com.fr.design.upm.database;
package com.fr.design.dcm;
import com.fr.design.dialog.UIDialog;
import com.fr.design.mainframe.DesignerContext;
@ -10,7 +10,7 @@ import javax.swing.*;
* @version 10.0
* Created by richie on 2019-05-16
*/
public class UniverseDatabaseOpener {
public class UniversalDatabaseOpener {
private static UIDialog dialog = null;
@ -19,9 +19,9 @@ public class UniverseDatabaseOpener {
}
public static void showUniverseDatabaseDialog() {
UniverseDatabasePane upmPane = new UniverseDatabasePane();
UniversalDatabasePane upmPane = new UniversalDatabasePane();
if (dialog == null) {
dialog = new UniverseDatabaseDialog(DesignerContext.getDesignerFrame(), upmPane);
dialog = new UniversalDatabaseDialog(DesignerContext.getDesignerFrame(), upmPane);
}
dialog.setVisible(true);
}

11
designer-base/src/main/java/com/fr/design/upm/database/UniverseDatabasePane.java → designer-base/src/main/java/com/fr/design/dcm/UniversalDatabasePane.java

@ -1,4 +1,4 @@
package com.fr.design.upm.database;
package com.fr.design.dcm;
import com.fr.design.dialog.BasicPane;
import com.fr.design.ui.ModernUIPane;
@ -13,7 +13,7 @@ import java.awt.*;
* @version 10.0
* Created by richie on 2019-05-16
*/
public class UniverseDatabasePane extends BasicPane {
public class UniversalDatabasePane extends BasicPane {
private ModernUIPane<Object> modernUIPane;
@ -22,14 +22,15 @@ public class UniverseDatabasePane extends BasicPane {
return "Database";
}
public UniverseDatabasePane() {
public UniversalDatabasePane() {
setLayout(new BorderLayout());
modernUIPane = new ModernUIPane.Builder<Object>()
.withComponent(UniverseDatabaseComponent.KEY)
modernUIPane = new ModernUIPane.Builder<>()
.withComponent(UniversalDatabaseComponent.KEY)
.prepare(new ScriptContextAdapter() {
@Override
public void onScriptContextCreated(ScriptContextEvent event) {
JSValue window = event.getBrowser().executeJavaScriptAndReturnValue("window");
window.asObject().setProperty("DcmHelper", UniversalDcmBridge.getBridge(event.getBrowser()));
}
})
.build();

34
designer-base/src/main/java/com/fr/design/dcm/UniversalDcmBridge.java

@ -0,0 +1,34 @@
package com.fr.design.dcm;
import com.fr.decision.webservice.bean.BaseBean;
import com.fr.design.bridge.exec.JSBridge;
import com.teamdev.jxbrowser.chromium.Browser;
import com.teamdev.jxbrowser.chromium.JSObject;
/**
* @author richie
* @version 10.0
* Created by richie on 2019-05-17
* 桥接Java和JavaScript的类
*/
public class UniversalDcmBridge {
public static UniversalDcmBridge getBridge(Browser browser) {
return new UniversalDcmBridge(browser);
}
private JSObject window;
private UniversalDcmBridge(Browser browser) {
this.window = browser.executeJavaScriptAndReturnValue("window").asObject();
}
/**
* 获取所有的数据连接
* @return 数据连接集合
*/
@JSBridge
public BaseBean getConnections() {
return null;
}
}

28
designer-base/src/main/java/com/fr/design/upm/UpmBridge.java

@ -2,6 +2,7 @@ package com.fr.design.upm;
import com.fr.base.passport.FinePassportManager;
import com.fr.config.MarketConfig;
import com.fr.config.ServerPreferenceConfig;
import com.fr.decision.webservice.v10.plugin.helper.category.impl.UpmResourceLoader;
import com.fr.design.bridge.exec.JSBridge;
import com.fr.design.bridge.exec.JSCallback;
@ -61,6 +62,20 @@ public class UpmBridge {
this.window = browser.executeJavaScriptAndReturnValue("window").asObject();
}
/**
* 更新插件管理中心资源文件这个方法仅仅是为了语义上的作用更新
* @param callback 安装完成后的回调函数
*/
@JSBridge
public void update(final JSFunction callback) {
startDownload(callback);
}
/**
* 下载并安装插件管理中心的资源文件
* @param callback 安装完成后的回调函数
*/
@JSBridge
public void startDownload(final JSFunction callback) {
new SwingWorker<Void, Void>(){
@ -76,10 +91,10 @@ public class UpmBridge {
protected void done() {
try {
get();
callback.invoke(window, Toolkit.i18nText("Fine-Design_Basic_Update_Plugin_Manager_Download_Success"));
callback.invoke(window, "success", Toolkit.i18nText("Fine-Design_Basic_Update_Plugin_Manager_Download_Success"));
EventDispatcher.fire(DownloadEvent.SUCCESS, "success");
} catch (Exception e) {
callback.invoke(window, Toolkit.i18nText("Fine-Design_Basic_Update_Plugin_Manager_Download_Error"));
callback.invoke(window, "error", Toolkit.i18nText("Fine-Design_Basic_Update_Plugin_Manager_Download_Error"));
FineLoggerFactory.getLogger().error(e.getMessage(), e);
EventDispatcher.fire(DownloadEvent.ERROR, "error");
}
@ -87,6 +102,15 @@ public class UpmBridge {
}.execute();
}
/**
* 获取upm的版本信息
* @return 版本信息
*/
@JSBridge
public String getVersion() {
return ServerPreferenceConfig.getInstance().getOptimizedUPMVersion();
}
@JSBridge
public String i18nText(String key) {
return Toolkit.i18nText(key);

27
designer-base/src/main/java/com/fr/design/upm/loader/UpmDesignResourceLoader.java

@ -1,27 +0,0 @@
package com.fr.design.upm.loader;
import com.fr.decision.webservice.bean.plugin.store.ProjectInfoBean;
import com.fr.decision.webservice.v10.plugin.helper.category.impl.BaseResourceLoader;
/**
* @author richie
* @version 10.0
* Created by richie on 2019-04-18
*/
public class UpmDesignResourceLoader extends BaseResourceLoader {
@Override
public String getPluginPath() {
return "upm/plugin_design.html";
}
@Override
public void checkResourceExist(ProjectInfoBean projectInfoBean) throws Exception {
}
@Override
public String getDownloadPath() throws Exception {
return "http://fanruan-market.oss-cn-shanghai.aliyuncs.com/upm/1.0/upm-10.0.zip";
}
}

2
designer-base/src/main/resources/com/fr/design/dcm/index.js

File diff suppressed because one or more lines are too long

276
designer-base/src/main/resources/com/fr/design/dcm/style.css

@ -0,0 +1,276 @@
.bi-plugin-redis {
padding: 20px; }
.database-connection-layout {
width: 100%;
height: 100%;
background-color: #f7f8fa; }
.database-connection-layout .title {
background-color: #fff;
border-bottom: 1px solid #e8eaed; }
.database-connection-layout .title .title-item {
height: 39px;
line-height: 39px;
padding-left: 15px;
padding-right: 15px;
text-align: center;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
position: relative;
flex-shrink: 0;
font-weight: 700;
cursor: pointer; }
.database-connection-layout .title .close-button {
position: absolute !important;
right: 5px;
top: 5px;
width: 30px;
height: 30px;
cursor: pointer;
background-image: url(./img/icon_close9x9_normal.png);
background-repeat: no-repeat;
background-position: center; }
.database-connection-layout .linkset {
margin: 10px;
bottom: 0px;
background-color: #ffffff; }
.database-connection-layout .linkStatus {
margin: 10px;
top: 40px;
background-color: #ffffff; }
.database-left {
border-right: 1px solid #e8eaed; }
.database-left .select-group {
border-bottom: 1px solid #e8eaed; }
.database-left .select-group .select {
margin: 10px; }
.database-left .select-group .select .database-link-items {
padding-left: 10px; }
.database-left .select-group .select .database-link-items .link-item {
border-top: 1px solid #e8eaed; }
.database-left .select-group .status-title {
font-weight: 700;
margin-left: 12px;
margin-top: 12px; }
.database-left .left-list {
margin: 10px; }
.database-left .left-list .left-item {
height: 24px;
line-height: 24px;
cursor: pointer; }
.database-left .left-list .left-item:hover {
background-color: rgba(54, 133, 242, 0.05); }
.database-left .left-list .left-item:hover .icons .action-icon {
visibility: visible !important; }
.database-left .left-list .left-item .icons {
float: right !important; }
.database-left .left-list .left-item .icons .action-icon {
visibility: hidden; }
.database-left .left-list .left-item .icons .b-font {
font-size: 16px; }
.database-left .left-list .left-item-selected {
background-color: rgba(54, 133, 242, 0.05); }
.database-left .left-list .left-item-selected .link-title {
color: #3685f2; }
.database-right {
min-width: 400px;
overflow: auto; }
.database-right .bi-flex-center-adapt-layout {
height: 100%; }
.database-right .bi-flex-center-adapt-layout .data-connection-background {
background: url(./img/resources.png) center center no-repeat;
background-size: contain; }
.database-right .right-status-title {
border-bottom: 1px solid #e8eaed;
color: #3d4d66;
line-height: 40px;
padding-left: 10px;
font-weight: 700; }
.database-right .right-status-body {
margin: 10px 30px 0px 30px;
height: 50%; }
.database-right .right-status-body .right-status-item {
height: 150px;
width: 50%;
top: 0;
left: 0;
position: absolute !important; }
.database-right .right-status-body .right-status-item .right-status-board {
margin-left: 25px;
position: relative !important;
left: -25px; }
.database-right .right-status-body .right-status-right {
height: 150px;
width: 50%;
top: 0;
right: 0;
position: absolute !important; }
.database-right .right-status-body .right-status-right .right-status-board {
margin-right: 25px;
position: relative !important;
left: 25px; }
.database-right .right-status-body .right-status-board {
background-color: #f7f8fa;
color: #3d4d66;
width: 100%;
height: 100%; }
.database-right .right-status-body .right-status-board .right-status-board-item {
text-align: center;
margin-top: 38px; }
.database-right .right-status-body .right-status-board .right-status-board-item .right-status-text {
display: inline-block; }
.database-right .right-status-body .right-status-board .right-status-board-item .card-font1 {
color: #13CD66;
font-size: 32px; }
.database-right .right-status-body .right-status-board .right-status-board-item .card-font2 {
color: #3685F2;
font-size: 32px; }
.database-right .right-content {
height: 100%; }
.database-right .right-content .right-title {
border-bottom: 1px solid #e8eaed;
color: #3d4d66;
line-height: 40px;
padding-left: 10px; }
.database-right .right-content .right-title .right-title-text {
font-weight: 700; }
.database-right .right-content .right-title .right-title-button {
float: right !important;
margin-right: 10px;
margin-top: 8px; }
.database-right .right-content .right-show {
margin: 10px; }
.database-right .right-content .right-show .right-form {
width: 100%; }
.both-side {
line-height: 24px;
margin-bottom: 10px; }
.both-side .left {
white-space: nowrap;
text-overflow: ellipsis;
position: relative;
flex-shrink: 0;
font-weight: 700; }
.both-side .hint {
padding-left: 5px;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
position: relative;
flex-shrink: 0;
margin-left: 5px;
color: #9ea6b2; }
.shared-component-title {
height: 24px;
line-height: 24px;
margin-bottom: 10px;
color: #9ea6b2;
border-bottom: 1px solid #e8eaed; }
.comfirm-content {
margin-top: 40px;
margin-left: 20px; }
.comfirm-content .comfirm-icon {
background-image: url(./img/warning.png);
background-size: contain;
margin-right: 12px; }
.comfirm-content .bi-text {
height: 50px;
line-height: 50px;
margin-left: 12px; }
.more-link .more-link-item {
width: 538px;
overflow: hidden auto;
left: -10px !important;
right: 0px;
top: 10px;
bottom: 0px;
position: absolute;
height: 380px; }
.more-link .more-link-item .link-item {
margin-left: 10px;
margin-bottom: 10px;
cursor: pointer;
border: solid 1px #fff; }
.more-link .more-link-item .link-item:hover {
border: solid 1px #3480f2; }
.more-link .more-link-item .link-item .selected {
position: absolute !important;
right: -1px;
top: -1px;
height: 30px;
width: 30px;
background: url(./img/database-selected.png) center center no-repeat;
background-size: contain; }
.more-link .more-link-item .link-item .text {
height: 27px;
line-height: 27px;
padding-left: 2px;
padding-right: 2px;
text-align: center;
white-space: nowrap;
background: #F0F3F7; }
.popover-notitle .bi-header-background {
display: none; }
.popover-notitle .bi-absolute-layout {
top: 0px !important; }
.bi-custom-show .show-content {
text-align: center; }
.bi-custom-show .show-content .loading-icon {
display: block;
background: url(./img/loading.gif) center center no-repeat;
background-size: contain;
margin: 0 auto;
margin-bottom: 18px; }
.bi-custom-show .show-content .success-icon {
display: block;
background: url(./img/success.png) center center no-repeat;
background-size: contain;
margin: 0 auto;
margin-bottom: 18px; }
.bi-custom-show .show-content .error-icon {
display: block;
background: url(./img/error.png) center center no-repeat;
background-size: contain;
margin: 0 auto;
margin-bottom: 18px; }
.bi-custom-show .show-content .buttons {
margin-top: 18px; }
.bi-custom-show .show-content .buttons div {
margin: 0 4px; }
.bi-custom-show .show-more {
text-align: left !important;
height: 73px;
background: #F2F4F7;
margin-bottom: 10px;
padding: 5px;
margin-top: 10px; }
.link-font .b-font:before {
content: "\e759";
color: inherit; }
.link-text-font .b-font:before {
content: "\e763";
color: inherit; }
.info-font .b-font:before {
content: "\e63c";
color: inherit; }
.delete-font .b-font:before {
content: "\e6c4";
color: inherit; }
/*# sourceMappingURL=style.css.map*/

57
designer-base/src/main/resources/com/fr/design/upm/database/database.js

@ -1,57 +0,0 @@
window.addEventListener("load", function (ev) {
var combo1 = BI.createWidget({
type: "bi.vertical",
items: [
{
type: "bi.text_value_combo",
text: "选项1",
width: 300,
items: [
{
el: {
type: "bi.single_select_radio_item",
width: 290,
text: "选项1",
value: 1
},
text: "选项1",
value: 1,
lgap: 10
},
{
el: {
type: "bi.single_select_radio_item",
width: 290,
text: "选项2",
value: 2
},
lgap: 10,
text: "选项2",
value: 2
},
{
el: {
type: "bi.single_select_radio_item",
width: 290,
text: "选项3",
value: 3
},
lgap: 10,
text: "选项3",
value: 3
}
]
}
]
});
BI.createWidget({
type:"bi.absolute",
element: "body",
items: [{
el: combo1,
left: 100,
top: 100
}]
});
});

2
designer-base/src/main/resources/com/fr/design/upm/warn.js

@ -4,7 +4,7 @@ window.onload = function () {
text: PluginHelper.i18nText("Fine-Design_Basic_Update_Plugin_Manager_Resource_Warn"),
height: 30
});
let callback = function(text) {
let callback = function(status, text) {
download.setValue(text);
};
let buttonOK = BI.createWidget({

Loading…
Cancel
Save