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.DesignerContext;
import com.fr.design.mainframe.DesignerFrame; import com.fr.design.mainframe.DesignerFrame;
import com.fr.design.menu.MenuKeySet; 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.file.ConnectionConfig;
import com.fr.general.IOUtils; import com.fr.general.IOUtils;
import com.fr.transaction.CallBackAdaptor; import com.fr.transaction.CallBackAdaptor;
@ -61,7 +61,7 @@ public class ConnectionListAction extends UpdateAction {
*/ */
public void actionPerformed(ActionEvent evt) { public void actionPerformed(ActionEvent evt) {
if (ServerPreferenceConfig.getInstance().isUseUniverseDBM()) { if (ServerPreferenceConfig.getInstance().isUseUniverseDBM()) {
UniverseDatabaseOpener.showUniverseDatabaseDialog(); UniversalDatabaseOpener.showUniverseDatabaseDialog();
} else { } else {
openDesignDatabaseManager(); 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.AssembleComponent;
import com.fr.web.struct.Atom; import com.fr.web.struct.Atom;
@ -12,11 +12,11 @@ import com.fr.web.struct.impl.FineUI;
* @version 10.0 * @version 10.0
* Created by richie on 2019-05-16 * 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.BasicPane;
import com.fr.design.dialog.UIDialog; import com.fr.design.dialog.UIDialog;
@ -12,9 +12,9 @@ import java.awt.*;
* @version 10.0 * @version 10.0
* Created by richie on 2019-05-16 * 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); super(frame);
setUndecorated(true); setUndecorated(true);
JPanel panel = (JPanel) getContentPane(); 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.dialog.UIDialog;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
@ -10,7 +10,7 @@ import javax.swing.*;
* @version 10.0 * @version 10.0
* Created by richie on 2019-05-16 * Created by richie on 2019-05-16
*/ */
public class UniverseDatabaseOpener { public class UniversalDatabaseOpener {
private static UIDialog dialog = null; private static UIDialog dialog = null;
@ -19,9 +19,9 @@ public class UniverseDatabaseOpener {
} }
public static void showUniverseDatabaseDialog() { public static void showUniverseDatabaseDialog() {
UniverseDatabasePane upmPane = new UniverseDatabasePane(); UniversalDatabasePane upmPane = new UniversalDatabasePane();
if (dialog == null) { if (dialog == null) {
dialog = new UniverseDatabaseDialog(DesignerContext.getDesignerFrame(), upmPane); dialog = new UniversalDatabaseDialog(DesignerContext.getDesignerFrame(), upmPane);
} }
dialog.setVisible(true); 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.dialog.BasicPane;
import com.fr.design.ui.ModernUIPane; import com.fr.design.ui.ModernUIPane;
@ -13,7 +13,7 @@ import java.awt.*;
* @version 10.0 * @version 10.0
* Created by richie on 2019-05-16 * Created by richie on 2019-05-16
*/ */
public class UniverseDatabasePane extends BasicPane { public class UniversalDatabasePane extends BasicPane {
private ModernUIPane<Object> modernUIPane; private ModernUIPane<Object> modernUIPane;
@ -22,14 +22,15 @@ public class UniverseDatabasePane extends BasicPane {
return "Database"; return "Database";
} }
public UniverseDatabasePane() { public UniversalDatabasePane() {
setLayout(new BorderLayout()); setLayout(new BorderLayout());
modernUIPane = new ModernUIPane.Builder<Object>() modernUIPane = new ModernUIPane.Builder<>()
.withComponent(UniverseDatabaseComponent.KEY) .withComponent(UniversalDatabaseComponent.KEY)
.prepare(new ScriptContextAdapter() { .prepare(new ScriptContextAdapter() {
@Override @Override
public void onScriptContextCreated(ScriptContextEvent event) { public void onScriptContextCreated(ScriptContextEvent event) {
JSValue window = event.getBrowser().executeJavaScriptAndReturnValue("window"); JSValue window = event.getBrowser().executeJavaScriptAndReturnValue("window");
window.asObject().setProperty("DcmHelper", UniversalDcmBridge.getBridge(event.getBrowser()));
} }
}) })
.build(); .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