Browse Source

KERNEL-493 设计器数据交换部分的API示例

bugfix/10.0
richie 6 years ago
parent
commit
d4bf754302
  1. 4
      designer-base/src/main/java/com/fr/design/actions/server/ConnectionListAction.java
  2. 8
      designer-base/src/main/java/com/fr/design/dcm/UniversalDatabaseComponent.java
  3. 6
      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

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();
}

8
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,11 +12,11 @@ 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() {
}

6
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,9 +12,9 @@ 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();

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;
}
}
Loading…
Cancel
Save